Make API calls on behalf of another user (CSRF protection bypass)
The API playground relied only on a custom request header to block cross-site request forgery. By using a Flash file that sent the header and then followed a redirect to the playground, an attacker could make a logged-in user's browser issue API calls on their behalf, such as changing the profile biography.
Originally disclosed on HackerOne
- Fixed in 5 days
- Paid in 5 days
- Disclosed after 5 days
Hi!
Brief I have discovered a way to issue API calls on behalf of other users. The problem stems from the fact that the API playground at https://developer.vimeo.com/api/playground/me has a very weak CSRF protection. The only thing protecting this resource from CSRF attacks is the demand that the "X-Requested-With: XMLHttpRequest" request header is present on the call.
At first sight, this seems impossible to circumvent because sending AJAX requests cross-domain is blocked by CORS, but there is a way to spoof the "X-Requested-With" request header in Flash.
I have only created a proof-of-concept for Safari (tested on newest version on OSX), but there is a big chance that this is possible from other browsers (and other plugins) too.
PoC
- Log in to Vimeo in Safari
- Visit https://s3.amazonaws.com/avlidienbrunn/vimeo_pwn.swf
- Your profile biography now says "avlidienbrunn+was+here"
Video demonstration I have made a Video explaining the issue, but at the time of writing this I am still uploading it to Vimeo (I will put a password on it and attach it to a comment).
Technical details It's possible to send the "X-Requested-With" header with Flash, but we can't send it cross-domain due to the SOP implementation with Adobe's crossdomain.xml files. However, we can trick Flash into sending the request anyway by issuing the request to a domain that does allow it, which in turn sends a HTTP 307 redirect to the resource that we want to target. Flash will send the request to the new resource before requesting crossdomain.xml on the new domain.
- Safari requests https://s3.amazonaws.com/avlidienbrunn/vimeo_pwn.swf
- SWF requests https://avlidienbrunn.se/crossdomain.xml
- SWF requests https://avlidienbrunn.se/vimeo_pwn.php (issues 307 redirect to Vimeo API playground)
- SWF requests https://developer.vimeo.com/api/playground/me (including the X-Requested-With header)
- SWF requests https://developer.vimeo.com/crossdomain.xml
Since it's step #4 that issues the API call, we can make the currently logged in user issue the call regardless of the crossdomain.xml file. We can, however, not read the response from the API call.
Mathias
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the CSRF defence relied solely on the presence of a custom request header, which Flash could set and which survived a cross-domain redirect.
Impact
An attacker could make a logged-in user perform API actions such as editing their profile, though the attacker could not read the responses; the proof of concept was demonstrated only in Safari.
What the attacker needed
Victim logged in; victim uses Safari with Flash; victim visits attacker page
How it was found
- Log in to the target site in Safari.
- Visit the attacker-hosted Flash file.
- The Flash file loads the attacker domain's crossdomain policy and then requests a script that returns a redirect.
- The redirect sends the request to the API playground with the custom header included.
- The logged-in user's profile biography is changed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Websites often trust a request just because it carries a special header that normal cross-site requests cannot add. The researcher used a Flash file to add that header and then bounced the request through a redirect, so the browser sent it to the target site with the user's login cookies attached. The user only had to visit a page while logged in.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.