Closed Bug 1308090 Opened 3 years ago Closed 3 years ago

Out of bounds read/null ptr dereference when combining a data URI f or a video element injected into the about:feeds context, and createImageBitmap for that video element.

Categories

(Core :: Canvas: 2D, defect)

52 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox49 --- ?
firefox50 --- fixed
firefox51 --- fixed
firefox52 --- fixed

People

(Reporter: jerri.rice.001, Assigned: Gijs)

Details

(4 keywords, Whiteboard: [post-critsmash-triage][sg:dos][adv-main50-])

Attachments

(5 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20160919214112

Steps to reproduce:

Setup a video element injected into the about:feeds context with a data URI  misrepresenting the mime type as video/ogg for what should be audio/ogg.  I then time the playing of this video element with createImageBitmap which is the tricky part(think race condition).


Actual results:

When the timing is just right it casues a memory corruption crash, that I believe may  be exploitable.  The reason I believe this is when the timing isn't right to trigger the crash, it will return a valid promise object.

This leads me to believe that in those instances if one were to follow up and retrieve the image bitmap data it *should* reveal  memory that was read which is very serious imo.

This is an incredibly hard to reproduce issue.  Also crash submission fails in these instances.  I'm attaching a testcase from another bug which sets up the opening of a page with the about:feeds context, and also screenshots showing both the crashed out tab(e10s) and output to the global console showing that crash submission fails.


Expected results:

None of what does happen.
Crash submission failing.
A crashed out tab showing that the URL for the page is the about:feeds context.
Once the page with the about:feeds context is loaded using the attached testcase the trailing code executed in the web console for that page with different timings will either cause a memory corruption crash, or return a valid promise object.

I'm currently lacking both the proper debugging tools and time to dig into this further.  Not to mention I just had people attempt a BE on my current room while I was dead asleep.  Authorities contacted but no help as usual.

Please help me follow up on this issue as it seems very serious, and my current situation is unnerving to say the least.

Sorry for the unneeded info, but this is getting completely out of hand.  I'm still trying to work through it all.

The code to execute is as follows:

document.querySelectorAll('video')[0].src ='data:video/ogg;base64,T2dnUwACAAAAAAAAAAC1v/BfAAAAAMVFfV4BHgF2b3JiaXMAAAAAAUSsAAD/////APQB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3G1lqtLbZaY6wx11pzTinFmFqqsbVWa4stt1hrzh2ElEIprYVSWkutxZhaizWU0lIppbVQSmstthpTa7GGUlorpbRWUmqttVZri63GlFKMrbUaU2qxxlpzji22nFqLtbVWa2qt1lhrzrHGHAsAABhwAAAIMKEMFBqyEgCIAgAgCFHKOSkJQo45R6lBiDnnKFWOQSihtYo5KKG01jknoaUYO+egpBZjSamlGGstKbUWY60FAAAUOAAABNigKbE4QKEhKwGAKAAAxhiEGIPQGKMUYxAag5RiDEKkFGPOQYiUUsw5CBljzkEoJWPMOQilhBBKKCWlEEIopaRUAABAgQMAQIANmhKLAxQasiIAiAIAAIxBjCHGEHROSiclctBJ6aQ0EEJqnaXOUmqxxJhZKrGVGBsIHbWQWkatxFha7KiVGEtsBQCAHTgAgB1YCIWGrAQA8gAAEGSUYsw55xBCSjHmnHMIIaUYc845pRRjjjnnnFKKMeacc44x5phzEELIGGPOOQghdM45ByGEEDrnnIMQQgidc85BCCGEzjnnIIQQQgEAQAUOAAABNopsTjASVGjISgAgDwAAMEYp5yCU0ijFGIRSUmqUYgxCKSlVzkEoJaXWKucglJJSax2EUlJqrcYOQikptRZjKSWl1mKstZSSUosx1ppaii3WWnNOqcUYY605FwCAu+AAAHZgo8jmBCNBhYasBADyAAAQhJRijDHnkFJMMcaYc0gpxRhjzDnFFGOMOeecUowxxpxzjjHGmHPOOccYY8w555xjjDnnnHPOMcacc84555xzzjnnnHPOOeecc845AQBABQ4AAAE2imxOMBJUaMhKACAPAAAwBkIIIYQQQQghhBBCaCCEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBC55xzzjnnnHPOOeecc84555wTAOJ44QDoM2GjyOYEI0GFhqwEAFIBAABjEGJMQkqtNUw5ByGV2GJsFHMOQkkxthg5J6Gl1mLMtXJOSkqxxVpzJ6WlGGvOPfcOSmsx9pxzziWlGmvtPffeS2ut1pp77rmn1mrtPffee28txpxr7r333mrNtffee+891lhzz7333nsBACYRD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6Y725txMOM7y33ujc2e1seEm1kIAkiXu2krl837l4Xn0tfHX7s39wzfhlshid23zT3h9/+is8M/Q+H3/1tCRrdseiO7ceTgX/ojMq82g/ygAJAn7FTj3v9hp/+/DdsbqudbsE8gBJ1IF/zrXan32/x9/Ff/fSOPcoNvWbm5Zli5/7MlP4eBAJ4WfFlPPg3zc5N0bADoV/N6GL26g2YYDe2l+Nc/zdI6do82x6kUeC6TupFXdMgoA2Bh6EW4aCobfF/HZz5ntu/b7/uwSsI0j1+/Pp9aZsrJs3ngyNuYLdoU+Aice6g/R7neebPrTg2NWEcDgHn1Kn/0vSDLhSeW88EqQfHsoQj06jH1GfobYgWoTjHccCk9C5NwDdfbiPTMx38+Eyp0UoRYCbmj6F4SKYT6LzH71+v0yJuSnqZaYKbJ5YjSxlDEtlQURSdWBUDASVPNCqopEB/52lpTj94TpZKwXv1MdxELSAD4V/HVrHzDAhgUg2GWTcwKMAAAAkKzOB3mZwup9nH2mMft57M8ghXfZdxZPxrw1LJ5o3oQYP1OAeKI5cqRDs3OkaigSGelovRNngEgb5ztoHkKbusQIB+Ii/Wwo4uSNCErm20btGJaWz9LyWRqgiGMADg==';document.querySelectorAll('video')[0].play();setTimeout(createImageBitmap.bind(window,document.querySelectorAll('video')[0]),150)

Changing the timing around is crucial.

I know this a mess, but I believe I may have more pressing issues for the time being.
Depends on: 1307857
Local nightly build gets me: EXC_BAD_ACCESS on 0x4c

#0	0x0000000111c94901 in mozilla::layers::Image::GetFormat() [inlined] at /Users/gkruitbosch/dev/builds/opt/dist/include/ImageContainer.h:196
#1	0x0000000111c94901 in mozilla::dom::ImageUtils::ImageUtils(mozilla::layers::Image*) [inlined] at /Users/gkruitbosch/dev/firefox-unified/dom/canvas/ImageUtils.cpp:248
#2	0x0000000111c948fa in mozilla::dom::ImageUtils::ImageUtils(mozilla::layers::Image*) at /Users/gkruitbosch/dev/firefox-unified/dom/canvas/ImageUtils.cpp:246
#3	0x0000000111cafc37 in mozilla::dom::ImageBitmap::ImageBitmap(nsIGlobalObject*, mozilla::layers::Image*, bool) [inlined] at /Users/gkruitbosch/dev/firefox-unified/dom/canvas/ImageBitmap.cpp:401
#4	0x0000000111cafbb6 in mozilla::dom::ImageBitmap::ImageBitmap(nsIGlobalObject*, mozilla::layers::Image*, bool) [inlined] at /Users/gkruitbosch/dev/firefox-unified/dom/canvas/ImageBitmap.cpp:405
#5	0x0000000111cafbb6 in mozilla::dom::ImageBitmap::CreateInternal(nsIGlobalObject*, mozilla::dom::HTMLVideoElement&, mozilla::Maybe<mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> > const&, mozilla::ErrorResult&) at /Users/gkruitbosch/dev/firefox-unified/dom/canvas/ImageBitmap.cpp:829
#6	0x0000000111cb1869 in mozilla::dom::ImageBitmap::Create(nsIGlobalObject*, mozilla::dom::HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrCanvasRenderingContext2DOrImageBitmapOrArrayBufferViewOrArrayBuffer const&, mozilla::Maybe<mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> > const&, mozilla::ErrorResult&) at /Users/gkruitbosch/dev/firefox-unified/dom/canvas/ImageBitmap.cpp:1437
#7	0x00000001113c6f81 in nsGlobalWindow::CreateImageBitmap(mozilla::dom::HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrCanvasRenderingContext2DOrImageBitmapOrArrayBufferViewOrArrayBuffer const&, mozilla::ErrorResult&) at /Users/gkruitbosch/dev/firefox-unified/dom/base/nsGlobalWindow.cpp:14417
#8	0x0000000111a28fb1 in mozilla::dom::WindowBinding::createImageBitmap(JSContext*, JS::Handle<JSObject*>, nsGlobalWindow*, JSJitMethodCallArgs const&) [inlined] at /Users/gkruitbosch/dev/builds/opt/dom/bindings/WindowBinding.cpp:12699
#9	0x0000000111a28821 in mozilla::dom::WindowBinding::createImageBitmap_promiseWrapper(JSContext*, JS::Handle<JSObject*>, nsGlobalWindow*, JSJitMethodCallArgs const&) at /Users/gkruitbosch/dev/builds/opt/dom/bindings/WindowBinding.cpp:12837
#10	0x0000000111a240db in mozilla::dom::WindowBinding::genericPromiseReturningMethod(JSContext*, unsigned int, JS::Value*) at /Users/gkruitbosch/dev/builds/opt/dom/bindings/WindowBinding.cpp:14791
#11	0x0000000113b5825b in js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) [inlined] at /Users/gkruitbosch/dev/firefox-unified/js/src/jscntxtinlines.h:239
#12	0x0000000113b58156 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) at /Users/gkruitbosch/dev/firefox-unified/js/src/vm/Interpreter.cpp:458
#13	0x0000000113b52397 in js::CallFromStack(JSContext*, JS::CallArgs const&) [inlined] at /Users/gkruitbosch/dev/firefox-unified/js/src/vm/Interpreter.cpp:509
#14	0x0000000113b5238f in Interpret(JSContext*, js::RunState&) at /Users/gkruitbosch/dev/firefox-unified/js/src/vm/Interpreter.cpp:2922
#15	0x0000000113b450d8 in js::RunScript(JSContext*, js::RunState&) at /Users/gkruitbosch/dev/firefox-unified/js/src/vm/Interpreter.cpp:404
#16	0x0000000113b58550 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct) at /Users/gkruitbosch/dev/firefox-unified/js/src/vm/Interpreter.cpp:476
#17	0x0000000113b58716 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) at /Users/gkruitbosch/dev/firefox-unified/js/src/vm/Interpreter.cpp:522
#18	0x00000001139d649b in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) at /Users/gkruitbosch/dev/firefox-unified/js/src/jsapi.cpp:2836
#19	0x0000000111b7a295 in mozilla::dom::Function::Call(JSContext*, JS::Handle<JS::Value>, nsTArray<JS::Value> const&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&) at /Users/gkruitbosch/dev/builds/opt/dom/bindings/FunctionBinding.cpp:36
#20	0x00000001113c030d in void mozilla::dom::Function::Call<nsCOMPtr<nsISupports> >(nsCOMPtr<nsISupports> const&, nsTArray<JS::Value> const&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JSCompartment*) [inlined] at /Users/gkruitbosch/dev/builds/opt/dist/include/mozilla/dom/FunctionBinding.h:70
#21	0x00000001113c02f0 in nsGlobalWindow::RunTimeoutHandler(nsTimeout*, nsIScriptContext*) at /Users/gkruitbosch/dev/firefox-unified/dom/base/nsGlobalWindow.cpp:12304
#22	0x00000001113b71d9 in nsGlobalWindow::RunTimeout(nsTimeout*) at /Users/gkruitbosch/dev/firefox-unified/dom/base/nsGlobalWindow.cpp:12547
#23	0x0000000111399157 in nsGlobalWindow::TimerCallback(nsITimer*, void*) at /Users/gkruitbosch/dev/firefox-unified/dom/base/nsGlobalWindow.cpp:12793
#24	0x0000000110698d68 in nsTimerImpl::Fire() at /Users/gkruitbosch/dev/firefox-unified/xpcom/threads/nsTimerImpl.cpp:480
#25	0x000000011068c0cd in nsTimerEvent::Run() at /Users/gkruitbosch/dev/firefox-unified/xpcom/threads/TimerThread.cpp:286
#26	0x000000011068fede in nsThread::ProcessNextEvent(bool, bool*) at /Users/gkruitbosch/dev/firefox-unified/xpcom/threads/nsThread.cpp:1082
<snip>


AFAICT CreateInternal is being called with a nullptr data, ie

  layers::Image* data = lockImage.GetImage();

returns null.

It looks like the code:

  // Create ImageBitmap.
  ImageContainer *container = aVideoEl.GetImageContainer();

  if (!container) {
    aRv.Throw(NS_ERROR_NOT_AVAILABLE);
    return nullptr;
  }

  AutoLockImage lockImage(container);
  layers::Image* data = lockImage.GetImage();
  RefPtr<ImageBitmap> ret = new ImageBitmap(aGlobal, data);

 should nullcheck data just like it nullchecks container.
Group: firefox-core-security → core-security
Status: UNCONFIRMED → NEW
Component: Untriaged → Canvas: 2D
Ever confirmed: true
Keywords: crash, testcase
Product: Firefox → Core
Attached patch Patch v0.1Splinter Review
Attachment #8798443 - Flags: review?(jmuizelaar)
(In reply to :Gijs Kruitbosch from comment #6)
> Created attachment 8798443 [details] [diff] [review]
> Patch v0.1

Forgot to mention: this avoids a crash for me locally. The promise I end up with is rejected with an error, which I think is the expected behaviour here.
Flags: sec-bounty?
If there's a timing issue lurking here then the proposed patch will get the null deref crashes out of the way and then any remaining crashes you can trigger should stand out more
Comment on attachment 8798443 [details] [diff] [review]
Patch v0.1

Review of attachment 8798443 [details] [diff] [review]:
-----------------------------------------------------------------

Why/when does lockImage.GetImage(); return NULL?
(In reply to Jeff Muizelaar [:jrmuizel] from comment #9)
> Comment on attachment 8798443 [details] [diff] [review]
> Patch v0.1
> 
> Review of attachment 8798443 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Why/when does lockImage.GetImage(); return NULL?

I'm not familiar with this code, so I'm really not the best person to ask. This is also why I didn't take the bug. But AFAICT:

https://dxr.mozilla.org/mozilla-central/rev/da986c9f1f723af1e0c44f4ccd4cddd5fb6084e8/gfx/layers/ImageContainer.h#655-671

AutoLockImage gets the video's ImageContainer and asks it for its images. If the array it gets back is empty, lockImage.GetImage() will return nullptr.

Why would the array be empty? Well, the 'intuitive' explanation here, from my perspective, is because you have a <video> element that loads an audio file that's pretending to be a video. We will happily play that, but there won't be an image stream to have images from. I haven't followed all the code to verify this is true, though. I don't know how the poster attribute factors in - I can reproduce without it (and also without all the about:feeds stuff). Probably worth writing a crash test to go with this.
(In reply to :Gijs Kruitbosch from comment #10)
> (In reply to Jeff Muizelaar [:jrmuizel] from comment #9)
> > Comment on attachment 8798443 [details] [diff] [review]
> > Patch v0.1
> > 
> > Review of attachment 8798443 [details] [diff] [review]:
> > -----------------------------------------------------------------
> > 
> > Why/when does lockImage.GetImage(); return NULL?
> I can reproduce without it (and also without all the
> about:feeds stuff). Probably worth writing a crash test to go with this.

Interesting, because I could not get this to work without about:feeds.
Removing bug 1307857 from the depends list since this apparently can work without about:feeds.  Did you execute the code in an iframe with the sandbox attribute or what?

I did in fact try multiple times to trigger this from a normal content webpage but maybe I just didn't try hard enough.
No longer depends on: 1307857
Attachment #8798443 - Flags: review?(jmuizelaar) → review+
Attached file Simplified testcase
To answer the 'where do you see this outside about:feeds' question, here's a testcase that crashes my nightly if you click the button. I'm running it on localhost, but I would assume it'll work on bugzilla as well...
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Comment on attachment 8798443 [details] [diff] [review]
Patch v0.1

[Security approval request comment]
How easily could an exploit be constructed based on the patch?
Well, the patch fixes a nullptr issue, so I guess it should be kind of obvious, but OTOH if it's a nullptr crash that's sec-low and we wouldn't be having this conversation. I'm just not sure about whether there's anything else lurking here. I haven't seen anything else, but that's no guarantee.

Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
We haven't really looked for an actual security problem (beyond nullptr dos crash)

Which older supported branches are affected by this flaw?
I expect everything. The blame on this code dates to Fx42, so that'd include ESR.

If not all supported branches, which bug introduced the flaw?
bug 1044102

Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
Should be easy for this nullptr crash. Unknown for anything else that might be lurking.

How likely is this patch to cause regressions; how much testing does it need?
Very unlikely, shouldn't need much testing. It should be easy to convert the attached testcase to an actual crashtest.
Attachment #8798443 - Flags: sec-approval?
Group: core-security → gfx-core-security
Making this a sec-low in lieu of other suggestions and clearing sec-approval. Let's check this into trunk.
Keywords: sec-low
Attachment #8798443 - Flags: sec-approval?
https://hg.mozilla.org/mozilla-central/rev/3e3005182470
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Comment on attachment 8798443 [details] [diff] [review]
Patch v0.1

Approval Request Comment
[Feature/regressing bug #]: createImageBitmap against a video element
[User impact if declined]: crashes!
[Describe test coverage new/current, TreeHerder]: I've written a test in another bug that I intend to land soon. But this is a 4-line patch to do a nullcheck that mirrors another nullcheck right above it, so we should be just fine.
[Risks and why]: none, see above.
[String/UUID change made/needed]: nope.
Attachment #8798443 - Flags: approval-mozilla-beta?
Attachment #8798443 - Flags: approval-mozilla-aurora?
If this is a guaranteed nullptr (as the fix suggests) then it's just a DOS and doesn't need to be hidden. Keeping hidden for now in case something else is lurking here that wasn't clear to us in the first description.
Flags: sec-bounty? → sec-bounty-
Whiteboard: [sg:dos]
(In reply to Daniel Veditz [:dveditz] from comment #19)
> If this is a guaranteed nullptr (as the fix suggests) then it's just a DOS
> and doesn't need to be hidden. Keeping hidden for now in case something else
> is lurking here that wasn't clear to us in the first description.

fwiw, I tried for a while to crash on a build with the fix I wrote here, using the testcase I attached, with various setTimeout values, and I was no longer able to crash at all. Of course, maybe even more thorough testing by QA could find something else...
Comment on attachment 8798443 [details] [diff] [review]
Patch v0.1

Crash fix, Aurora51+, Beta50+
Attachment #8798443 - Flags: approval-mozilla-beta?
Attachment #8798443 - Flags: approval-mozilla-beta+
Attachment #8798443 - Flags: approval-mozilla-aurora?
Attachment #8798443 - Flags: approval-mozilla-aurora+
Group: gfx-core-security → core-security-release
I believe to exploit this it would require combination with another memory corruption bug at the very least.
Flags: qe-verify-
Whiteboard: [sg:dos] → [post-critsmash-triage][sg:dos]
Whiteboard: [post-critsmash-triage][sg:dos] → [post-critsmash-triage][sg:dos][adv-main50-]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.