| ||||||||||||||||||||
Where string concatenation is used to build the *url* variable.
It is also important to notice that on Google’s side, it was possible to send these two HTTP requests and get the same response:
The reCAPTCHA API always used the first secret parameter on the request and ignored the second one. This is not a vulnerability, but was used in the exploit.
LAST PIECE OF THE PUZZLE
Web developers need to test their applications in an automated way, with that goal Google provided an easy way to “disable” reCAPTCHA’s verification in staging environments. This is well documented and explained in the documentation, to sum it up, if you want to disable reCAPTCHA verification please use the hard-coded site and secret key shown below:
PUTTING IT ALL TOGETHER
Now that we have all the ingredients, let’s take a look at the exploit:
If the application was vulnerable to HTTP parameter pollution AND the URL was constructed by appending the response parameter before the secret then an attacker was able to bypass the reCAPTCHA verification.
Note that I’m sending a specially crafted response to the vulnerable web application, which contains:
When the attack requirements are met, the following HTTP request is sent by the web application to the reCAPTCHA API:
Note that the request contains two secret parameters, the first one is controlled by the attacker (due to the HTTP parameter pollution in the vulnerable web application) and the second one is controlled by the application itself. Given that the reCAPTCHA API uses the first one, the response to this request is always:
Which will be processed by the web application and the attacker will be granted access.
FIXED UPSTREAM
Google decided to fix this issue in their REST API, and I believe it was a wise move. Their fix is simple: If the HTTP request to /recaptcha/api/siteverify contains two parameters with the same name, then return an error.
Fixing it this way they are protecting the applications which are vulnerable to the HTTP Parameter Pollution and the reCAPTCHA bypass, without requiring them to apply any patches: awesome!
EXPLOITABITY IN THE WILD
There are two strong requirements for this vulnerability to be exploitable in a web application, first, the application needs to have an HTTP parameter pollution vulnerability in the reCAPTCHA url creation: Github searches showed that ~60% of the integrations with reCAPTCHA are vulnerable.
Second, the vulnerable web application needs to create the URL with the response parameter first, and then the secret: “response=…&secret=…”. Strangely, almost all applications use “secret=…&response=…”. My guess is that Google’s documentation and code examples did it like that, and others simply copied the format. Google got lucky there… if they would have done it the other way around, this vulnerability would have affected even more sites. GitHub searches showed that only 5 to 10% of the reCAPTCHA implementations meet this requirement.
So, if I would have wanted to exploit this in the wild, only ~3% of the sites which use reCAPTCHA would have been vulnerable: not bad since this is used everywhere… but small compared to other vulnerabilities.
SUMMARY
TIMELINE
|
Friday, October 5, 2018
RECAPTCHA BYPASS VIA HTTP PARAMETER POLLUTION
Subscribe to:
Post Comments (Atom)
Osmedeus - Fully Automated Offensive Security Tool For Reconnaissance And Vulnerability Scanning
Osmedeus allow you automated run the collection of awesome tools to reconnaissance and vulnerability scanning against the target.
-
You’ve sent your phishing ruse, the target has run the Meterpreter payload, and you have shell on their system. Now what? If you follow...
-
Step 1 :- to get this 2 Files: 1. libxss-1.1.3.deb http://www.4shared.com/file/Sl6PMH_v/libxss-113.html 2. chromium-5.0.369.2.deb (...
-
Now if another day new entry, in the blog this time with a collection of Pentesting Bookmarks that I found in code.google which has ...
No comments:
Post a Comment