JSON Viewer: Make even top level windows protected from content level window access.
The JSON viewer exposes a postChromeMessage function to content scripts, and a content window can open the viewer in a top-level window and then dispatch events from that same document with arbitrary data. This could let a content window send crafted messages through the viewer's communication channel.
Originally disclosed on Mozilla
- Fixed in 7 days
- Paid in 14 days
- Disclosed after 7 days
+++ This bug was initially created as a clone of Bug #1297361 +++
Follow up for:
https://bugzilla.mozilla.org/show_bug.cgi?id=1295309#c26
JSON viewer uses `Cu.exportFunction` to export `postChromeMessage` method into content scope to create a communication channel (used for, copying & saving JSON data and HTTP headers from the content).
This should be replaced by window listeners.
Honza
Follow up, this is fine and all, but with content able to open the json viewer in a top level window, and that window remaining accessible from the content window, we still have some work to do. The problem is that the patch is checking that the event is dispatched from the proper document, but there is no check to see if the event is trusted(which I don't think it can be here.)
So with a content level window accessing this window, it would still be possible for that content window to dispatch events using eval or whatever from the json viewer window so that it would in fact be from the same document. The problem is that the content window could put whatever object in as the data to be sent with the event.
I hope people are following me here.
The answer in my mind is obvious. This is intended to be a part of the developer tools, so just make any window that has the content type of application/json or the internal Mozilla equivalent(I cant remember right off) inaccessible from content level windows.
I'll await thoughts on this, while pursuing other bugs. Trying to spread my attention to as many places as possible while I can.
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 viewer's event listener only checks that the event comes from the correct document, not that the event is trusted, so a content window that opened the viewer can dispatch events from that same document with arbitrary data.
Impact
A content window could send arbitrary objects as data through the JSON viewer's communication channel, though the text does not describe a concrete exploit beyond that.
What the attacker needed
Content can open the JSON viewer in a top-level window; the viewer window remains accessible from content
The fix
The text proposes making any window with the JSON content type inaccessible from content-level windows, but does not say it was fixed.
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.
A browser feature for viewing JSON data lets web pages talk to it through a special function. The problem is that a malicious page can open this viewer in a new window and then send fake messages to it, because the viewer does not check who is really sending them. The suggested fix is to stop normal web pages from being able to access windows that show JSON.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.