Closed
Bug 987433
Opened 11 years ago
Closed 11 years ago
Use after free with relList attribute of <a> element
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
FIXED
mozilla31
| Tracking | Status | |
|---|---|---|
| firefox28 | --- | unaffected |
| firefox29 | + | verified |
| firefox30 | + | verified |
| firefox31 | + | verified |
| firefox-esr24 | --- | unaffected |
| b2g-v1.2 | --- | unaffected |
| b2g-v1.3 | --- | unaffected |
| b2g-v1.4 | --- | fixed |
| b2g-v2.0 | --- | fixed |
People
(Reporter: nils, Assigned: smaug)
Details
(Keywords: csectype-uaf, sec-critical)
Attachments
(3 files, 1 obsolete file)
|
321 bytes,
text/html
|
Details | |
|
17.85 KB,
text/plain
|
Details | |
|
9.33 KB,
patch
|
khuey
:
review+
abillings
:
approval-mozilla-aurora+
abillings
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
Testcase crashes the latest ASAN Firefox build. ASAN output attached in crash.txt. The relList attribute is freed while JS references are still alive.
Probably related to changes in bug #968637
| Assignee | ||
Comment 2•11 years ago
|
||
Yes, we don't seem to call DropReference().
Why aren't we just using cycle collection here?
Updated•11 years ago
|
Keywords: csectype-uaf,
sec-critical
| Assignee | ||
Comment 4•11 years ago
|
||
That I can't recall. I think we should just CC here.
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bugs
Comment 5•11 years ago
|
||
Ouch, I'm sorry I missed that. :(
We should definitely kill off that weak ref. For one thing, holding on to the token list means we can mutate attributes, which can trigger mutation observers, so should keep the element alive.
And yes, this is a regression from bug 968637. Not sure whether I should add the dep....
| Assignee | ||
Updated•11 years ago
|
status-firefox30:
--- → affected
status-firefox31:
--- → affected
tracking-firefox30:
--- → ?
tracking-firefox31:
--- → ?
Updated•11 years ago
|
status-firefox29:
--- → unaffected
status-firefox-esr24:
--- → unaffected
| Assignee | ||
Comment 6•11 years ago
|
||
I can't reproduce this now. I think I did manage yesterday...
But based on the stack and the current code the patch is certainly needed.
Attachment #8396556 -
Flags: review?(khuey)
Comment on attachment 8396556 [details] [diff] [review]
patch
Review of attachment 8396556 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
::: content/base/src/nsDOMTokenList.h
@@ +77,5 @@
> void RemoveInternal(const nsAttrValue* aAttr,
> const nsTArray<nsString>& aTokens);
> inline const nsAttrValue* GetParsedAttr();
>
> + nsCOMPtr<Element> mElement;
The tree seems to use both nsCOMPtr and nsRefPtr with Element. We should clean that up at some point.
Attachment #8396556 -
Flags: review?(khuey) → review+
| Assignee | ||
Comment 8•11 years ago
|
||
Comment on attachment 8396556 [details] [diff] [review]
patch
[Security approval request comment]
How easily could an exploit be constructed based on the patch?
The patch itself doesn't actually touch the problematic code, but if someone realizes
why the patch is needed, then it is quite obvious.
Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
Check-in comment will be: "DOMTokenList should have a strong reference to its owner so that the API doesn't suddenly start returning empty string."
Which older supported branches are affected by this flaw?
30 (aurora)
If not all supported branches, which bug introduced the flaw?
bug 968637
Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
The patch applies cleanly to Aurora
How likely is this patch to cause regressions; how much testing does it need?
Not likely to cause regressions.
Attachment #8396556 -
Flags: sec-approval?
Attachment #8396556 -
Flags: approval-mozilla-aurora?
Updated•11 years ago
|
Comment 9•11 years ago
|
||
Comment on attachment 8396556 [details] [diff] [review]
patch
sec-approval+ and approved for Aurora.
Attachment #8396556 -
Flags: sec-approval?
Attachment #8396556 -
Flags: sec-approval+
Attachment #8396556 -
Flags: approval-mozilla-aurora?
Attachment #8396556 -
Flags: approval-mozilla-aurora+
| Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 10•11 years ago
|
||
Keywords: checkin-needed
Comment 11•11 years ago
|
||
We're seeing new leaks on the push that included this and two other patches on inbound
Comment 12•11 years ago
|
||
Backed out for mochitest leaks on all platforms.
https://hg.mozilla.org/integration/mozilla-inbound/rev/3620f69143dd
https://tbpl.mozilla.org/php/getParsedLog.php?id=36762599&tree=Mozilla-Inbound
https://tbpl.mozilla.org/php/getParsedLog.php?id=36761050&tree=Mozilla-Inbound
https://tbpl.mozilla.org/php/getParsedLog.php?id=36767576&tree=Mozilla-Inbound
https://tbpl.mozilla.org/php/getParsedLog.php?id=36761690&tree=Mozilla-Inbound
Comment 13•11 years ago
|
||
Do we traverse/unlink the token lists created by nsGenericHTMLElement::GetTokenList? I bet we don't. :( So we could get leaks now that those are wrappercached, in fact...
We do, for itemtype, itemref, and itemprop. http://mxr.mozilla.org/mozilla-central/source/content/base/src/FragmentOrElement.cpp#1801
But not for sandbox :( http://mxr.mozilla.org/mozilla-central/source/content/html/content/src/HTMLIFrameElement.h#83
| Assignee | ||
Comment 15•11 years ago
|
||
Uh.
| Assignee | ||
Comment 16•11 years ago
|
||
That means we need this for FF29 too, since that sandbox stuff was added in Bug 845057.
| Assignee | ||
Comment 17•11 years ago
|
||
(nsGenericHTMLElement::GetTokenList is too error prone)
| Assignee | ||
Comment 18•11 years ago
|
||
Updated•11 years ago
|
| Assignee | ||
Updated•11 years ago
|
Attachment #8397789 -
Flags: review?(khuey)
Updated•11 years ago
|
tracking-firefox29:
--- → +
Comment 19•11 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #16)
> That means we need this for FF29 too, since that sandbox stuff was added in
> Bug 845057.
If you nominate a patch, I'll approve it.
(In reply to Olli Pettay [:smaug] from comment #17)
> (nsGenericHTMLElement::GetTokenList is too error prone)
Indeed.
Comment on attachment 8397789 [details] [diff] [review]
hopefully less leaky
Review of attachment 8397789 [details] [diff] [review]:
-----------------------------------------------------------------
I don't review Foo*** very often.
Attachment #8397789 -
Flags: review?(khuey) → review+
| Assignee | ||
Comment 22•11 years ago
|
||
The previous patch got sec-a+, so I don't think it is worth to ask approval for the fixed patch.
Keywords: checkin-needed
Updated•11 years ago
|
Attachment #8396556 -
Attachment is obsolete: true
Comment 23•11 years ago
|
||
Keywords: checkin-needed
Comment 24•11 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #22)
> The previous patch got sec-a+, so I don't think it is worth to ask approval
> for the fixed patch.
ohai.
Can we get a beta and aurora patch though?
| Assignee | ||
Comment 25•11 years ago
|
||
Comment on attachment 8397789 [details] [diff] [review]
hopefully less leaky
This applies with fuzz
[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 968637 and Bug 845057
User impact if declined: sec-crit crashes
Testing completed (on m-c, etc.): just landed
Risk to taking this patch (and alternatives if risky):
Should be rather low risk. Leaks in the previous landing revealed another
cases of this issue, and the current patch is now safer.
String or IDL/UUID changes made by this patch: NA
Attachment #8397789 -
Flags: approval-mozilla-beta?
Attachment #8397789 -
Flags: approval-mozilla-aurora?
Updated•11 years ago
|
Attachment #8397789 -
Flags: approval-mozilla-beta?
Attachment #8397789 -
Flags: approval-mozilla-beta+
Attachment #8397789 -
Flags: approval-mozilla-aurora?
Attachment #8397789 -
Flags: approval-mozilla-aurora+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
| Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 27•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-aurora/rev/92cf8d0f0d58
https://hg.mozilla.org/releases/mozilla-beta/rev/8074caa1fb14
status-b2g-v1.2:
--- → unaffected
status-b2g-v1.3:
--- → unaffected
status-b2g-v1.4:
--- → fixed
status-b2g-v2.0:
--- → fixed
Keywords: checkin-needed
| Assignee | ||
Comment 28•11 years ago
|
||
Thanks again Ryan!
Comment 29•11 years ago
|
||
I reproduced the crash on ASAN build from 2014-03-24 and verified that the issue is fixed on latest Aurora, latest Nightly and Firefox 29 beta 5 ASAN builds.
Keywords: verifyme
Updated•11 years ago
|
Status: RESOLVED → VERIFIED
Updated•10 years ago
|
Group: core-security
You need to log in
before you can comment on or make changes to this bug.
Description
•