Closed
Bug 326931
Opened 19 years ago
Closed 19 years ago
Content should not be able to call SetBoxObjectFor
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bzbarsky, Assigned: neil)
Details
(Keywords: fixed1.8.1, verified1.8.0.4, Whiteboard: [sg:critical])
Attachments
(2 files, 2 obsolete files)
1.64 KB,
patch
|
neil
:
approval-aviary1.0.9?
neil
:
approval1.7.14?
bzbarsky
:
approval-branch-1.8.1+
darin.moz
:
approval1.8.0.4+
|
Details | Diff | Splinter Review |
8.90 KB,
patch
|
jst
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
We have all sorts of code that assumes that it can rely on the box object in the table to be correct... Unfortunately, content can set this value to an object of its choice. Not good. :(
![]() |
Reporter | |
Comment 1•19 years ago
|
||
Oh, to be precise what this means is that it should be easy to get into situations where we're calling virtual methods on deleted frames.
So I think to fix this we should move the method to nsIDocument (from nsIDOMNSDocument), since the only callers are nsGenericElement and nsXULElement.
The problem is that I really don't have time to write (and test!) the 3+ versions of the patch this will require (for 1.7, 1.8, trunk, with new interfaces added on 1.7/1.8 because we don't want to change nsIDocument) any time in the next few days.
Anyone else willing to help? :(
Flags: blocking1.9a1?
Flags: blocking1.8.1?
Flags: blocking1.8.0.2?
Flags: blocking1.7.13?
Flags: blocking-aviary1.0.8?
Comment 2•19 years ago
|
||
Can we get a security group reading on the security exposure of this?
We're well past code freeze deadline for 1.0.8/1.7.13. I am minusing for these releases and nominating it for the next 1.0.x/1.7.x release.
Flags: blocking1.7.14?
Flags: blocking1.7.13?
Flags: blocking1.7.13-
Flags: blocking-aviary1.0.9?
Flags: blocking-aviary1.0.8?
Flags: blocking-aviary1.0.8-
![]() |
Reporter | |
Comment 3•19 years ago
|
||
> Can we get a security group reading on the security exposure of this?
As I said in comment 1, "get into situations where we're calling virtual methods on deleted frames". That means arbitrary code execution (probabilistically) if the attacker can prefill memory with a known byte pattern.
If we're close to shipping 1.7.x we shouldn't hold for this, I guess...
Comment 4•19 years ago
|
||
Comment 3 helps understand what the attack can be. I am still not sure how easy it is to exploit. How easy is it for an attacker to pre-fill memory and then to call that memory? Is this vulnerability low, medium, or high risk of exploit?
![]() |
Reporter | |
Comment 5•19 years ago
|
||
> How easy is it for an attacker to pre-fill memory
Trivial -- create a large array in JavaScript. We'll put it in memory somewhere.
> and then to call that memory?
This is a little more difficult to answer, especially since we arena-allocate frames. David, do you know whether we ever shrink the frame arena during the lifetime of a page? Basically, if we deallocate the frame's memory while it's still in the tree, we can put the JS array described above on top of it, and then we're screwed. If we don't shrink the arena, we might be ok.
> Is this vulnerability low, medium, or high risk of exploit?
I guess I'd rate it as medium for now pending figuring out exactly what the arena behavior is, I guess.
Comment 6•19 years ago
|
||
Would love a fix in 1.8.0.2, ask for approval if a patch gets created. Until then this isn't looking like it could make it.
Flags: blocking1.8.0.3?
Flags: blocking1.8.0.2?
Flags: blocking1.8.0.2-
Updated•19 years ago
|
Whiteboard: [sg:critical
Updated•19 years ago
|
Whiteboard: [sg:critical → [sg:critical]
Assignee | ||
Comment 7•19 years ago
|
||
For the branches, could we just disallow a non-null boxObject?
That would only require some code rearrangement in nsDocument.
![]() |
Reporter | |
Comment 8•19 years ago
|
||
That might work, yeah....
Assignee | ||
Comment 9•19 years ago
|
||
Attachment #214092 -
Flags: superreview?(bzbarsky)
Attachment #214092 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 10•19 years ago
|
||
![]() |
Reporter | |
Comment 11•19 years ago
|
||
Comment on attachment 214092 [details] [diff] [review]
Branch-safe patch
>Index: nsDocument.cpp
>+ if (!mBoxObjectTable) {
>+ mBoxObjectTable = new nsSupportsHashtable(12);
I know this code didn't use to handle OOM.... but why don't we fix it to deal while we're here?
r+sr=bzbarsky with that; on trunk I'd still like to move the method to nsIDocument (and perhaps rename to "ClearBoxObjectFor"?).
Attachment #214092 -
Flags: superreview?(bzbarsky)
Attachment #214092 -
Flags: superreview+
Attachment #214092 -
Flags: review?(bzbarsky)
Attachment #214092 -
Flags: review+
Assignee | ||
Comment 12•19 years ago
|
||
Attachment #214092 -
Attachment is obsolete: true
Attachment #214093 -
Attachment is obsolete: true
Attachment #214101 -
Flags: approval-branch-1.8.1?(bzbarsky)
![]() |
Reporter | |
Updated•19 years ago
|
Attachment #214101 -
Flags: approval-branch-1.8.1?(bzbarsky) → approval-branch-1.8.1+
Assignee | ||
Comment 14•19 years ago
|
||
Comment on attachment 214101 [details] [diff] [review]
Updated for review comments
Stop people messing around with our table of box objects potentially causing arbitrary code execution.
Attachment #214101 -
Flags: approval1.8.0.3?
Attachment #214101 -
Flags: approval1.7.14?
Attachment #214101 -
Flags: approval-aviary1.0.9?
Updated•19 years ago
|
Flags: blocking1.9a1?
Flags: blocking1.9a1+
Flags: blocking1.8.1?
Flags: blocking1.8.1+
Flags: blocking1.8.0.3?
Flags: blocking1.8.0.3+
Flags: blocking1.7.14?
Flags: blocking1.7.14+
Flags: blocking-aviary1.0.9?
Flags: blocking-aviary1.0.9+
Comment 15•19 years ago
|
||
Comment on attachment 214101 [details] [diff] [review]
Updated for review comments
NS_IMETHODIMP
nsDocument::SetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject* aBoxObject)
{
+ if (aBoxObject) {
+ return NS_ERROR_INVALID_ARG;
+ }
So, a non-null aBoxObject is an error?
![]() |
Reporter | |
Comment 16•19 years ago
|
||
That's correct. We don't want content to override the box object that _should_ be there, but clearing one is ok (since on next get we'll just create a correct one). The point is, we need to return the right _types_ of box objects in all cases from GetBoxObjectFor.
Comment 17•19 years ago
|
||
Comment on attachment 214101 [details] [diff] [review]
Updated for review comments
a=darin on behalf of drivers for MOZILLA_1_8_0_BRANCH. We'd like to see a trunk patch as well before 1.8.0.3 is released.
Attachment #214101 -
Flags: approval1.8.0.3? → approval1.8.0.3+
![]() |
Reporter | |
Updated•19 years ago
|
Assignee: general → neil
Assignee | ||
Comment 18•19 years ago
|
||
(In reply to comment #17)
>We'd like to see a trunk patch as well before 1.8.0.3 is released.
That'll be a bit tricky; obviously the patch has baked on the 1.8.0 branch for six weeks but this function no longer exists on the trunk.
Comment 19•19 years ago
|
||
OK, that works too. Please forgive my ignorance :)
![]() |
Reporter | |
Comment 20•19 years ago
|
||
Er... SetBoxObjectFor seems to exist on the trunk.... Were we going to remove it in some other bug or something?
Assignee | ||
Comment 21•19 years ago
|
||
My bad, I was sure we were going to replace it with ClearBoxObjectFor.
darin, this means that the patch has in fact baked on the trunk too :-)
![]() |
Reporter | |
Comment 22•19 years ago
|
||
> My bad, I was sure we were going to replace it with ClearBoxObjectFor.
Well, we still should. I don't think this patch got checked in to trunk... Certainly not according to lxr.
Assignee | ||
Comment 24•19 years ago
|
||
Because it also includes the nsSupportsHashtable to nsInterfaceHashtable update.
Attachment #219278 -
Flags: superreview?(bzbarsky)
Attachment #219278 -
Flags: review?(jst)
![]() |
Reporter | |
Comment 25•19 years ago
|
||
Comment on attachment 219278 [details] [diff] [review]
"Scary" trunk patch
Excellent
Attachment #219278 -
Flags: superreview?(bzbarsky) → superreview+
Comment 26•19 years ago
|
||
Comment on attachment 219278 [details] [diff] [review]
"Scary" trunk patch
r=jst
Attachment #219278 -
Flags: review?(jst) → review+
Assignee | ||
Comment 27•19 years ago
|
||
Trunk fix checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 28•19 years ago
|
||
v.fixed based on comments and code inspection.
Keywords: fixed1.8.0.4 → verified1.8.0.4
Comment 29•19 years ago
|
||
could this have caused trunk regression described in https://bugzilla.mozilla.org/show_bug.cgi?id=338630
Updated•19 years ago
|
Group: security
Updated•12 years ago
|
Component: DOM: Mozilla Extensions → DOM
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•