How I Hacked [Oculus] OAuth +Ebay +IBM
The Oculus Answers forum allowed users to upload files with a spoofed content type, enabling the upload of a malicious SWF file that could execute script and steal OAuth access tokens. The OAuth authorisation endpoint on api.oculus.com also failed to properly validate the redirect_uri parameter, allowing an attacker to redirect users to the malicious SWF and capture tokens.
Published on ahussam.me
Early 2015, when I was looking for a BB I learned that Oculus is under scope of Facebook BB
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
In early 2015 I was hunting on the Facebook bug bounty programme when I learned that Oculus was in scope. At the time the main Oculus domain was https://developer.oculusvr.com/, but the menu contained a link to https://answers.oculus.com/, a community Q&A site. That site is where the interesting feature lived: you can upload images in comments.

The image above shows the scope listing that led me to treat Oculus as a target.
Setup
The only tooling involved was a browser, Burp Suite to intercept and modify requests, and a copy of xss.swf by @evilcos, available at https://github.com/evilcos/xss.swf. No account details, versions or special roles are described in the report; the precondition is simply that the comment form on answers.oculus.com accepts an image upload.
Finding it
After some browsing I noticed that comments allow image uploads, and that is where I wanted to dig. The upload path has a first filter that checks whether the uploaded file is an image by looking at the file name and confirming it ends with an image extension. The request also carries the parameter image=true.
That combination, an extension check on the name plus a client-supplied content type, is the classic setup for a content-type confusion bug: the server trusts the declared MIME type rather than the bytes or the extension alone.
Exploitation
Step 1: upload XML under an image name
I uploaded a file named xxml.jpg, intercepted the request in Burp, changed the content type to text/xml, and forwarded it.

The screenshot shows the intercepted request with the modified content type. The name still ends in .jpg, so the extension check passes while the body is XML.
Step 2: probe other types
I then uploaded XML. I also tried .php and .html; those were uploaded, which produced a 500 server error. That produced a 500 server error.
Step 3: upload a SWF
I wanted a harmful attack, so I used a SWF. A SWF can be used for SOP bypass, XSS, open redirect, and leaking a CSRF token, because the token was stored in cookies. The xss.swf tool by @evilcos does exactly this job.
I repeated the same procedure with .swf: intercept, change the content type to application/x-shockwave-flash, forward.
The video shows the interception and forwarding of the SWF upload.

The screenshot shows the uploaded evil SWF file in place on the site.
Step 4: report to Facebook
Everything looked good, so I reported it to Facebook. After a while Facebook closed my account, and replied:
Hi Abdullah, Thank you for your report. This subdomain is actually not part of the Facebook bug bounty program and is hosted by AnswerHub. If you believe you have discovered a security vulnerability in that site, please consider responsibly disclosing it directly to them.
Thanks,
Mark Security Facebook
That was disappointing, because I had assumed every *.oculus.com domain was in scope.
Step 5: pivot to the OAuth flow on api.oculus.com
I logged in using api.oculus.com and saw a chance to steal an access token. After some research I found that I could steal the token using the uploaded SWF file and a redirect (the details were lost while formatting). The final proof-of-concept URL was:
https://api.oculus.com/v1/oauth2/authorize?client_id=answerHub&response_type=token%20id_token&nonce=-blahblah&state=&redirect_uri=https://answers.oculus.com/storage/attachments/131-xss.jpg&country=US&locale=en_US
The redirect_uri points at a stored attachment on answers.oculus.com. Because redirect_uri was not properly validated on api.oculus.com, I could change its value, and the same weakness can be used for an open redirect. The affected host, api.oculus.com, is in scope.
Step 6: second report
I reported again:
Hi , Mark I know that it is hosted on answerhub and I will report them but if you see that answers.oculus.com can be used to steal access tokens >from api.oculus.comand the will affect (api.oculus.com) which is in the scope it can be used to redirect as well
Logged out and open this URL you will get the the page of login and when user log in he will redirect to swf file that steal access token >and that will affect OAuth of Oculus. URL://URL Open redirect for example URL://URL That should be bug in the system of oculus .
Thanks .
The reply was:
Hi Abdullah, Thanks again for writing in. The improper validation of redirect_uri on api.oculus.com was already known to us due to a previous report. There’s a fix currently being tested. As Mark mentioned, since answers.oculus.com is hosted by a third-party called AnswerHub, the issue of a stored XSS on AnswerHub is >unfortunately out-of-scope. I’d encourage you to reach out to them directly and let them know about the issue. Thanks, Aaron Security Facebook
Step 7: other AnswerHub customers
Because AnswerHub is a third-party product, other companies use it too. I made a Google dork to search for it and got good results, including eBay and IBM. I did the same process for each site.


The two screenshots show the results on eBay and IBM.
Step 8: report to AnswerHub
It was time to report to AnswerHub, so I contacted Matthew Schmidt, the CTO of DZone, the builder of AnswerHub, which is a paid service. They did not give a bounty; they said they would send a package of DZone things, but I never received anything. I do not know whether it was my post office or whether they never sent it. Weeks later they published a release note without my name, so I contacted them again and they added it, but got my last name wrong. The changelog is at http://answerhub.com/releases/changelogs/answerhub-1.6.3-release-change-log/.
I told Facebook all of this and Neal Poole replied:
Hi Abdullah, Glad to hear it! Thanks, Neal Security Facebook
Root cause
The upload filter on answers.oculus.com checked the file name for an image extension, and a file named xxml.jpg with Content-Type: text/xml or application/x-shockwave-flash was accepted.
The second issue is on api.oculus.com: the OAuth authorisation endpoint did not properly validate redirect_uri, so an attacker could point it at an arbitrary URL, including the stored SWF attachment. Facebook stated that this weakness was already known from a previous report and that a fix was being tested.
Impact
On answers.oculus.com, an attacker could store a SWF; SWF can be used for SOP bypass, XSS, open redirect and leaking a CSRF token stored in cookies. Combined with the redirect_uri weakness on api.oculus.com, I found that I could steal the access token using the uploaded SWF and a redirect, though the details were lost. I did the same process against other AnswerHub customers such as eBay and IBM. Facebook treated the AnswerHub-hosted XSS as out of scope because the subdomain is run by a third party.
Fix
Facebook said the improper validation of redirect_uri on api.oculus.com was already known and a fix was being tested. For the upload issue, the report does not describe a fix; the correct approach is to validate uploaded files by content rather than by name and declared content type, and to serve user uploads from a separate origin or with a restrictive Content-Type and Content-Disposition.
Variants to test
- Upload a file with an image extension but a different declared content type (
text/xml,application/x-shockwave-flash,text/html) and check whether the stored file is served back with that type. A positive result is the server echoing the modified type or executing the content. - Try
.phpand.htmluploads to see whether the server stores them and returns a 500 error, as it did here; a positive result is a stored file that is reachable and interpreted. - Search for other instances of the same third-party product with a Google dork and repeat the upload test. A positive result is the same acceptance of a mismatched content type on another customer's site.
- Test OAuth
redirect_urivalidation on related hosts by substituting an attacker-controlled URL. A positive result is a redirect to that URL after login, which can be chained with a stored file to capture tokens.
What happened, in plain words
In early 2015 I was hunting for bugs on the Facebook bug bounty programme. A bug bounty programme is a scheme where a company pays people for finding and reporting security problems in its products, instead of punishing them. I learned that Oculus, the virtual reality company Facebook had bought, was included in that programme. "In scope" means the company has said which of its websites and services are fair game for testing.
At the time the main Oculus website was https://developer.oculusvr.com/. But the menu on that site had a link to https://answers.oculus.com/, a community question-and-answer site where users help each other. That site is where the interesting feature lived: you can upload images in comments.

The image above shows the scope listing that led me to treat Oculus as a target.
What follows is the story of what I found, how I found it, and what the companies involved said. I have kept it in the order it happened, and I explain each idea from scratch as it comes up.
The pieces you need to understand first
Before the steps, a few everyday ideas. You do not need to know any of this beforehand.
- A web request is what your browser sends to a website when you click something or submit a form. Think of it as a letter: it has an address (the URL), some headers (labels on the envelope, such as what kind of content is inside), and sometimes a body (the contents).
- Intercepting a request means catching that letter before it leaves your computer, so you can read it and change it. The tool I used for this is Burp Suite, a program that sits between your browser and the website like a post office clerk who opens every envelope. Burp Suite is a proxy: software that passes traffic through and lets you inspect and edit it.
- A content type (also called a MIME type) is a label that says what kind of file something is.
image/jpegmeans a photo,text/xmlmeans XML data,application/x-shockwave-flashmeans a Flash animation. The browser and the server use this label to decide how to handle the file. - A file extension is the part of a file name after the dot, such as
.jpgor.swf. It is just text in the name; it does not prove what is inside the file. - A cookie is a small piece of data a website asks your browser to keep and send back on every later request. It is how a site remembers that you are logged in. A token is a similar secret string, often stored in a cookie, that proves who you are. If someone else gets your token, they can act as you.
- XSS (cross-site scripting) means getting your own code to run inside someone else's website, in the browser of a victim who visits it. The code then runs with the trust the victim's browser gives that site.
- SOP (same-origin policy) is a browser rule that stops a page from one website reading data from another website. An SOP bypass is a way around that rule.
- An open redirect is a link on a trusted site that sends the visitor to any address an attacker chooses. It looks trustworthy because the first part of the link is the real site.
- CSRF (cross-site request forgery) is tricking a logged-in user's browser into sending a request the user did not intend. A CSRF token is a secret value the site checks to make sure the request really came from its own pages.
- OAuth is the system that lets you log in to one site using another account, or lets an app ask a service for permission on your behalf. When it works, the service hands the app an access token, a secret that lets the app act for you. The
redirect_uriis the address the service sends you back to after you log in. If the service does not check that address carefully, an attacker can make it point somewhere else. - An API is a way for programs to talk to a service, rather than for people clicking pages.
api.oculus.comis the program-facing part of Oculus. - A SWF is a Flash file. Flash was a browser plugin that could run animations and small programs. A SWF can be used for SOP bypass, XSS, open redirect, and leaking a CSRF token, because the token was stored in cookies.
- A 500 server error is the server saying "something went wrong on my side". It is a crash message, not a success message.
- A Google dork is a search query built to find pages with particular characteristics, for example pages that contain a certain product's upload form.
Setup
The only tooling involved was a browser, Burp Suite to intercept and modify requests, and a copy of xss.swf by @evilcos, available at https://github.com/evilcos/xss.swf. That file is a tool by @evilcos that I used for the SWF upload.
No account details, versions or special roles are described in the report; the precondition is simply that the comment form on answers.oculus.com accepts an image upload.
Finding it
After some browsing I noticed that comments allow image uploads, and that is where I wanted to dig. Why comments? Because a comment is content that stays on the site and is shown to other people. If I can put something dangerous there, every visitor who views the comment is exposed. That is called stored XSS: the harmful content is saved on the server, not just reflected back once.
The upload path has a first filter that checks whether the uploaded file is an image by looking at the file name and confirming it ends with an image extension. The request also carries the parameter image=true.
In plain words: the site's guard looks at the label on the box (the file name ending in .jpg) and at a note in the request saying "this is an image", but it does not open the box to see what is really inside. That combination, an extension check on the name plus a client-supplied content type, is the classic setup for a content-type confusion bug: the server trusts the declared MIME type rather than the bytes or the extension alone. "Client-supplied" means the value comes from my browser, so I can change it before it arrives.
Exploitation
Step 1: upload XML under an image name
I uploaded a file named xxml.jpg, intercepted the request in Burp, changed the content type to text/xml, and forwarded it.

The screenshot shows the intercepted request with the modified content type. The name still ends in .jpg, so the extension check passes while the body is XML.
Why do it this way? The name is what the filter reads, and the name still says .jpg, so the filter is satisfied. The content type is a separate label in the request, and I changed that label to text/xml. That is the confusion: two labels disagree, and the server believes the one I control.
Step 2: probe other types
I then uploaded XML. I also tried .php and .html; those were uploaded, which produced a 500 server error. That produced a 500 server error.
Step 3: upload a SWF
I wanted a harmful attack, so I used a SWF. The xss.swf tool by @evilcos does exactly this job.
I repeated the same procedure with .swf: intercept, change the content type to application/x-shockwave-flash, forward.
The video shows the interception and forwarding of the SWF upload.

The screenshot shows the uploaded evil SWF file in place on the site.
Step 4: report to Facebook
Everything looked good, so I reported it to Facebook. After a while Facebook closed my account, and replied:
Hi Abdullah, Thank you for your report. This subdomain is actually not part of the Facebook bug bounty program and is hosted by AnswerHub. If you believe you have discovered a security vulnerability in that site, please consider responsibly disclosing it directly to them.
Thanks,
Mark Security Facebook
That was disappointing, because I had assumed every *.oculus.com domain was in scope. The reply says the subdomain is run by a third party, AnswerHub, so Facebook treated it as someone else's responsibility.
Step 5: pivot to the OAuth flow on api.oculus.com
I logged in using api.oculus.com and saw a chance to steal an access token. After some research I found that I could steal the token using the uploaded SWF file and a redirect (the details were lost while formatting). The final proof-of-concept URL was:
https://api.oculus.com/v1/oauth2/authorize?client_id=answerHub&response_type=token%20id_token&nonce=-blahblah&state=&redirect_uri=https://answers.oculus.com/storage/attachments/131-xss.jpg&country=US&locale=en_US
Line by line, in plain words:
https://api.oculus.com/v1/oauth2/authorizeis the OAuth login endpoint on the Oculus API. This is the address that starts the login-and-consent flow.client_id=answerHubsays which application is asking for permission. Here it is the AnswerHub application.response_type=token%20id_tokenasks the service to return a token and an identity token.%20is a space encoded in a URL.nonce=-blahblahis a value meant to make each login request unique. Here it is a placeholder.state=is normally a value the site uses to check the reply belongs to the request it started. Here it is empty.redirect_uri=https://answers.oculus.com/storage/attachments/131-xss.jpgis the address the service will send the user to after login. It points at the stored attachment onanswers.oculus.com, which is the uploaded SWF.country=US&locale=en_USare ordinary settings for country and language.
The redirect_uri points at a stored attachment on answers.oculus.com. Because redirect_uri was not properly validated on api.oculus.com, I could change its value, and the same weakness can be used for an open redirect. The affected host, api.oculus.com, is in scope.
I found that I could steal the access token using the uploaded SWF file and a redirect, though the details were lost while formatting.
Step 6: second report
I reported again:
Hi , Mark I know that it is hosted on answerhub and I will report them but if you see that answers.oculus.com can be used to steal access tokens >from api.oculus.comand the will affect (api.oculus.com) which is in the scope it can be used to redirect as well
Logged out and open this URL you will get the the page of login and when user log in he will redirect to swf file that steal access token >and that will affect OAuth of Oculus. URL://URL Open redirect for example URL://URL That should be bug in the system of oculus .
Thanks .
The reply was:
Hi Abdullah, Thanks again for writing in. The improper validation of redirect_uri on api.oculus.com was already known to us due to a previous report. There’s a fix currently being tested. As Mark mentioned, since answers.oculus.com is hosted by a third-party called AnswerHub, the issue of a stored XSS on AnswerHub is >unfortunately out-of-scope. I’d encourage you to reach out to them directly and let them know about the issue. Thanks, Aaron Security Facebook
So Facebook said the redirect_uri weakness was already known and being fixed, and that the stored XSS on the AnswerHub-hosted subdomain was out of scope. The second point is the key one for the rest of the story: the upload problem belongs to AnswerHub, the company that makes the software.
Step 7: other AnswerHub customers
Because AnswerHub is a third-party product, other companies use it too. I made a Google dork to search for it and got good results, including eBay and IBM. I did the same process for each site.


The two screenshots show the results on eBay and IBM.
Why look for other customers? Because the flaw is in the shared product, not in one company's setup. That turns one finding into a finding that affects many organisations, and it also shows the software maker that the problem is theirs to fix.
Step 8: report to AnswerHub
It was time to report to AnswerHub, so I contacted Matthew Schmidt, the CTO of DZone, the builder of AnswerHub, which is a paid service. They did not give a bounty; they said they would send a package of DZone things, but I never received anything. I do not know whether it was my post office or whether they never sent it. Weeks later they published a release note without my name, so I contacted them again and they added it, but got my last name wrong. The changelog is at http://answerhub.com/releases/changelogs/answerhub-1.6.3-release-change-log/.
I told Facebook all of this and Neal Poole replied:
Hi Abdullah, Glad to hear it! Thanks, Neal Security Facebook
Root cause
The upload filter on answers.oculus.com checked the file name for an image extension, and a file named xxml.jpg with Content-Type: text/xml or application/x-shockwave-flash was accepted.
In everyday terms: the guard checked the label on the box and the note attached to it, but never the contents. Anyone who can write the note can get any contents past the guard.
The second issue is on api.oculus.com: the OAuth authorisation endpoint did not properly validate redirect_uri, so an attacker could point it at an arbitrary URL, including the stored SWF attachment. Facebook stated that this weakness was already known from a previous report and that a fix was being tested.
Impact
On answers.oculus.com, an attacker could store a SWF; SWF can be used for SOP bypass, XSS, open redirect and leaking a CSRF token stored in cookies. Combined with the redirect_uri weakness on api.oculus.com, I found that I could steal the access token using the uploaded SWF and a redirect, though the details were lost. I did the same process against other AnswerHub customers such as eBay and IBM. Facebook treated the AnswerHub-hosted XSS as out of scope because the subdomain is run by a third party.
Fix
Facebook said the improper validation of redirect_uri on api.oculus.com was already known and a fix was being tested. For the upload issue, the report does not describe a fix; the correct approach is to validate uploaded files by content rather than by name and declared content type, and to serve user uploads from a separate origin or with a restrictive Content-Type and Content-Disposition.
In plain words: open the box and check what is really inside, do not trust the label. And if you must store files from users, keep them somewhere that is not treated as part of your main site, so that even a bad file cannot borrow your site's trust.
Variants to test
If you want to try this kind of testing yourself, here is the same list of ideas in beginner terms. Only test on sites that allow it, such as a bug bounty programme's in-scope targets.
- Upload a file with an image extension but a different declared content type (
text/xml,application/x-shockwave-flash,text/html) and check whether the stored file is served back with that type. A positive result is the server echoing the modified type or executing the content. - Try
.phpand.htmluploads to see whether the server stores them and returns a 500 error, as it did here; a positive result is a stored file that is reachable and interpreted. - Search for other instances of the same third-party product with a Google dork and repeat the upload test. A positive result is the same acceptance of a mismatched content type on another customer's site.
- Test OAuth
redirect_urivalidation on related hosts by substituting an attacker-controlled URL. A positive result is a redirect to that URL after login, which can be chained with a stored file to capture tokens.
Glossary
- Access token: a secret string that proves you are logged in and lets a program act as you.
- API: a way for programs to talk to a service, as opposed to pages for people to click.
- Bug bounty programme: a scheme where a company pays people for reporting security problems in its products.
- Burp Suite: a proxy tool that lets you intercept, read and change web requests between your browser and a site.
- Content type (MIME type): a label saying what kind of file something is, such as
image/jpegortext/xml. - Content-type confusion: a bug where a server trusts the declared content type instead of checking the actual file contents.
- Cookie: a small piece of data a site asks your browser to keep and send back on later requests, often used to remember that you are logged in.
- CSRF (cross-site request forgery): tricking a logged-in user's browser into sending a request the user did not intend.
- CSRF token: a secret value a site checks to confirm a request came from its own pages.
- File extension: the part of a file name after the dot, such as
.jpg; it is only text and does not prove the contents. - Google dork: a search query built to find pages with particular characteristics.
- In scope: listed by a company as fair game for security testing under its programme.
- Intercept: catch a request before it leaves your computer so you can read or change it.
- OAuth: a system that lets an app get permission to act for you on another service, usually by handing it an access token.
- Open redirect: a link on a trusted site that sends the visitor to any address an attacker chooses.
- Origin: the combination of scheme, host and port that a browser uses to decide which site a page belongs to.
redirect_uri: the address an OAuth service sends the user to after login; if unchecked, it can be pointed anywhere.- Same-origin policy (SOP): a browser rule that stops a page from one site reading data from another site.
- SOP bypass: a way around the same-origin policy.
- Stored XSS: cross-site scripting where the harmful content is saved on the server and shown to later visitors.
- SWF: a Flash file format that browsers could run as animations or small programs.
- Token: a secret string used to prove identity or permission, often stored in a cookie.
- 500 server error: the server reporting that something went wrong on its side.
- XSS (cross-site scripting): getting your own code to run inside someone else's website, in a victim's browser.