Closed Bug 344745 Opened 20 years ago Closed 15 years ago

It is possible to get past _isValidWindow check in BrowserFeedWriter.write from a non-chrome, non-about:feeds page

Categories

(Firefox Graveyard :: RSS Discovery and Preview, defect)

x86
Linux
defect
Not set
normal

Tracking

(firefox5 unaffected, status2.0 unaffected, status1.9.2 unaffected, status1.9.1 unaffected)

RESOLVED FIXED
Tracking Status
firefox5 --- unaffected
status2.0 --- unaffected
status1.9.2 --- unaffected
status1.9.1 --- unaffected

People

(Reporter: Waldo, Assigned: mrbkap)

Details

(Whiteboard: [sg:dupe 352124])

Attachments

(1 file)

about:feeds functions through use of a global property on window, BrowserFeedWriter. It calls this property as a constructor to create a feed writer and then calls .write(window) on it, displaying the feed. The .write(window) method begins with a check designed to ensure that the passed-in window is allowed to call .write(). The check is as follows: _isValidWindow: function FW__isValidWindow(window) { var chan = window.QueryInterface(Ci.nsIInterfaceRequestor). getInterface(Ci.nsIWebNavigation). QueryInterface(Ci.nsIDocShell).currentDocumentChannel; const kPrefix = "jar:file:"; return chan.URI.spec.substring(0, kPrefix.length) == kPrefix; }, By specially constructing the appropriate window, it is possible to defeat this security mechanism and continue further code execution inside .write(). The example code (to be posted once this bug is filed) takes the cheap approach of imitating an XPCOM object and stumbling its way through calls; it doesn't progress very far once it passes the _isValidWindow check. (In particular it is slowed by an inability to respond to specific IIDs, since accessing Components.interfaces.* results in a security exception. If it were to cache the passed-in IIDs, I speculate it could be more intelligent in how it responds to QueryInterfaces and getInterfaces.) I speculate (without any evidence whatsoever) that if one were to create a hidden <iframe> which set many of the relevant properties on the window object, it would be possible to continue much further into the code. (This might fail due to how cross-domain checks work, but I don't know for sure.) Additionally, since even the stumbling approach manages to get _window and _document set (the interfaces through which the component fills in the preview page), that may be bad enough already. It's highly unclear to me exactly how much a malicious site could do with this access. Most of the code is DOM manipulation, but since local preferences are read and displayed, I believe it should be possible to get the values of some of the feed preferences under the right circumstances. I'll leave further exploration and analysis up to security people. :-)
Ideally, I'd like to install BrowserFeedWriter _only_ on about:feeds, but I see no way to register a component constructor for a specific site. If that's easy to add, that would be my ideal fix for this whole mess. Lack of that function is the only reason I attempted this meagre hack.
jesse, any idea if this is still a problem?
No idea. Waldo?
_isValidWindow() was changed to _getOriginalURI() in bug 344983, but I think the problem was still there. But I think this problem was patched in bug 352124 by wrapping the passed-in fake window and throwing if it's a non-native object.
Whiteboard: [sg:investigate]fixed by bug 352124?
Assignee: nobody → mrbkap
I think this has long been fixed.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Group: core-security
Whiteboard: [sg:investigate]fixed by bug 352124? → [sg:dupe 352124]
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: