Created
February 12, 2016 17:39
-
-
Save andresriancho/52d0c1527453b752fd96 to your computer and use it in GitHub Desktop.
cURL header injection
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 | |
$proxy = 'http://127.0.0.1:8080'; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,"http://www.w3af.org/"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_PROXY, $proxy); | |
$headers = array(); | |
$headers[] = "Foo: 0\r\nX: Y"; | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
$server_output = curl_exec ($ch); | |
curl_close ($ch); | |
/* | |
This HTTP request is sent (note the injected X: Y header): | |
GET / HTTP/1.1 | |
Host: www.w3af.org | |
Accept: */* | |
Foo: 0 | |
X: Y | |
Connection: close | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment