Iframe injection & content spoofing & scripts execution via json viewer
A JSON API endpoint reflected a user-controlled parameter into a page that could be rendered as HTML, allowing an attacker to inject an iframe or script. An attacker could spoof page content and run script in the context of the affected domain.
Originally disclosed on Mozilla
- Fixed in 18 days
- Paid in 24 days
- Disclosed after 18 days
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0
Build ID: 20180206200532
Steps to reproduce:
Hello ,
When we have a response of json with a parameter that a client can edit we can spoof the content wyciwyg using ("javascript:)
Example in gdata.youtube.com
Just visit the link below and click in javascript :
https://gdata.youtube.com/feeds/api/videos?format=5&max-results=8&v=%22JUST---CLICK-HERE--%3E%22javascript:document.write(/%3Ciframe%2520src=http:evil.com%3E/)&alt=jsonc
Or
https://gdata.youtube.com/feeds/api/videos?format=5&max-results=8&v=%22javascript:document.write(%2527%3Cscript%3Ealert(document.location)%3C/script%3E%2527)&alt=jsonc
We can see that we have a frame of evil.com in gdata.youtube.com we can also execute a scripts using the same method .
The frame is injected in view-source:wyciwyg://99/https://gdata.youtube.com......
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 JSON response reflected a user-controlled parameter without encoding, and the browser rendered the response as HTML, so injected markup and script executed.
Impact
An attacker could spoof content on the affected domain and execute script in its context, though the report does not show any further exploitation.
What the attacker needed
Victim clicks a crafted link; browser renders JSON as HTML
How it was found
- Open the crafted link that contains the injected value in the parameter.
- Click the javascript link shown in the response.
- Observe the injected iframe or script executing on the affected domain.
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.
Some websites return data in a format called JSON, which is meant to be read by programs, not shown as a web page. If the site lets a visitor's input appear in that output without cleaning it, a crafted link can make the browser treat the data as a real page and run attacker-supplied code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.