Closed Bug 522531 Opened 16 years ago Closed 16 years ago

Firebug most likely exploitable due to jsdIValue.getProperty calls

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME
Tracking Status
blocking2.0 --- alpha4+

People

(Reporter: bzbarsky, Unassigned)

Details

(Whiteboard: [sg:critical?][firebug-blocks])

jsdValue::GetProperty calls JSD_GetValueProperty which calls jsd_GetValueProperty, which does: JS_GetUCProperty(cx, obj, nameChars, nameLen, &val) where |obj| is whatever object is inside the jsdIValue (so quite possibly not wrapperized) and cx is a JSContext that the debugger service sets up in _newJSDContext. In particular, cx does not have an associated nsIScriptContext, and its global object doesn't have an associated nsIPrincipal. If I read nsScriptSecurityManager::GetSubjectPrincipal correctly, if above JS_GetUCProperty triggers GetSubjectPrincipal calls they will come back with NS_OK and null, which means the caller will treat the subject principal as system. Pretty sure this should be exploitable.
Flags: blocking1.9.2?
Flags: blocking1.9.0.16?
Note that for extra fun we need to fix this without breaking Firebug in the process. Or update Firebug in sync.
blocking1.9.1: --- → ?
blocking2.0: --- → ?
blocking1.9.1: ? → needed
f
Flags: blocking1.9.0.16? → wanted1.9.0.x+
Whiteboard: [sg:critical?]
I agree with comment #2. boris, this sounds like an escalation vulnerability? Can scripts in content theoretically gain higher privilege because of this? Any other recommendations?
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [sg:critical?] → [sg:critical?][firebug-p1]
As far as Firebug goes, bug 507448 fixes this. We only call the getProperty for arg names. (But don't close it, we need to fix sometime).
> boris, this sounds like an escalation vulnerability? The failure mode here is a web page running arbitrary script of its choice with the system principal.
(In reply to comment #4) > As far as Firebug goes, bug 507448 fixes this. We only call the getProperty for > arg names. (But don't close it, we need to fix sometime). That bug hasn't landed on 1.9.2 yet, though blocking/approval has been requested. Is there likely to be a "better" fix for this in time for 1.9.2, or should we get that one marked as a blocker right now?
(In reply to comment #5) > > boris, this sounds like an escalation vulnerability? > > The failure mode here is a web page running arbitrary script of its choice with > the system principal. right. full, backstage pass. Does JJB's comment in #4 mitigate this? Sounds like we'll be able to fix in Firebug once patch in 507448 lands on branch, though unlikely we'll get a fix for 3.0/1.9.1.
Whiteboard: [sg:critical?][firebug-p1] → [sg:critical?][firebug-p1][firebug-blocks]
> Is there likely to be a "better" fix for this in time for 1.9.2 I'm not competent to write one. We need to fix this inside jsd if we're going to get it fixed on the 1.9.0 and 1.9.1 branches, and I'm not quite sure how to go about doing that without breaking Firebug...
(In reply to comment #8) > > Is there likely to be a "better" fix for this in time for 1.9.2 > > I'm not competent to write one. We need to fix this inside jsd if we're going > to get it fixed on the 1.9.0 and 1.9.1 branches, and I'm not quite sure how to > go about doing that without breaking Firebug... bz - Okay, so I think you're saying that, in the meantime, bug 507448 has to block then, right? And do you agree with John that bug 507448 should be enough to mitigate it, given Firebug's usage?
Bug 507448 is a prerequisite for firebug usage changing so as to avoid calling the vulnerable function this bug is about. It's not enough on its own; firebug changes are needed too. Hence the last sentence of comment 4.
Flags: blocking1.9.2? → blocking1.9.2+
(In reply to comment #0) > jsdValue::GetProperty calls JSD_GetValueProperty which calls > jsd_GetValueProperty, which does: > > JS_GetUCProperty(cx, obj, nameChars, nameLen, &val) > > where |obj| is whatever object is inside the jsdIValue (so quite possibly not > wrapperized) ... So in the case of: var pvalue = frame.scope.getProperty(argName); we can replace it with: var scope = XPCSafeJSObjectWrapper(frame.scope.getWrappedValue()); then var pvalue = scope.argName; safely correct? (Firebug 1.5 wants to support Firefox 3.5, and bug 507448 will probably not reach that far back).
> var scope = XPCSafeJSObjectWrapper(frame.scope.getWrappedValue()); > var pvalue = scope.argName; I believe this should be safe, yes. Blake?
Yes, that should be safe.
so based on comment #11, we *could* fix this in Firebug code, but it's relying on a patch that won't make it back to 1.9.1, is this correct? We need an owner for this bug.
Sorry I was not clear. http://code.google.com/p/fbug/source/detail?r=4859 implements the change proposed in Comment 11. Therefore Firebug 1.5 does not need anything from this bug *and* it does not need 507448. With the answer from comment 13, we don't need this bug for firebug 1.5. Since its too late for FF 3.6, I think we just move on.
Whiteboard: [sg:critical?][firebug-p1][firebug-blocks] → [sg:critical?][firebug-blocks]
Firebug can move on, but as this is an sg:critical bug I'm reluctant to close it with WONTFIX or WFM. Someone else should make that call.
We should still fix jsd (either by making this API safe or removing it).
We should create a new bug for the JSD API removal/fixing, and close this one out, since Firebug is no longer exploitable. Removing blocking, at the least.
Flags: blocking1.9.2+ → blocking1.9.2-
Filed bug 529835.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WORKSFORME
blocking+ in case this is reopened for some reason
blocking2.0: ? → alpha4+
Please correct us if we've gotten it wrong, but it looks like we don't need this bug on the branches.
blocking1.9.1: needed → ---
Component: JavaScript Debugging/Profiling APIs → JavaScript Engine
Group: core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.