Closed Bug 1637112 (CVE-2020-12407) Opened 4 years ago Closed 4 years ago

'border-image' rendering is broken in WebRender

Categories

(Core :: Graphics: WebRender, defect)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
mozilla78
Tracking Status
firefox-esr68 --- unaffected
firefox75 --- wontfix
firefox76 --- wontfix
firefox77 + verified
firefox78 + verified

People

(Reporter: MatsPalmgren_bugz, Assigned: nical)

References

(Regression)

Details

(4 keywords, Whiteboard: [post-critsmash-triage][adv-main77+])

Attachments

(6 files)

Attached file Testcase

The test works correctly in Firefox v76 and Chrome v81.

Attached image Screenshot

Is the top border segment of the first box rendering random memory?

I see it broken in 75 as well. Probably WebRender specific?

Yeah, it's a WebRender bug looks like. And yeah, it's GPU memory, I got some text from my terminal there :)

Component: Web Painting → Graphics: WebRender
Summary: 'border-image' rendering is broken in Nightly → 'border-image' rendering is broken in WebRender
Flags: needinfo?(nical.bugzilla)
Regressed by: 1606771
Keywords: regression

Hmm, this seems like a security issue then.

Group: core-security
Group: core-security → gfx-core-security
Assignee: nobody → nical.bugzilla
Status: NEW → ASSIGNED

I would be surprised if this is exploitable but the fix is simple enough that it is a good candidate for uplift.

Flags: needinfo?(nical.bugzilla)

Can we land a test for this?

Yeah I'll add a reftest. I wasn't sure the behavior was what the spec intended.

Can a web page get images back out of WebRender? Like, the leaked data is on the screen, but not on something like a <canvas> that could be read back? Would it be captured by a screenshot?

Web pages aren't allowed to read pixels back from webrender. In gecko we have two ways to do screenshots, one that reads webrender's framebuffers (what the gecko profiler uses) and one that reconstructs the page on the content process and draws it without webrender (drawWindow which extensions can ask access to, but that's not affected by webrender). Both are privileged APIs that web pages don't have access to as far as I know.
I think webrtc has a screen sharing feature, which I expect can see the output of webrender, but that requires pretty verbose permission requests.

Beyond that I believe that it's quite hard to craft getting the texture cache's pieces of uninitialized memory to land on anything interesting. You are more likely to land on other bits of content of the same page which, if you get to that point, you already have access to.

(In reply to Nicolas Silva [:nical] from comment #13)

Beyond that I believe that it's quite hard to craft getting the texture cache's pieces of uninitialized memory to land on anything interesting. You are more likely to land on other bits of content of the same page which, if you get to that point, you already have access to.

It's actually quite easy for me to see interesting content from other processes. If I start a separate browser and load a video into it I often get a region of that video into the border and not just a single frame - it's a slice of the live running video stream!

Also, many programs off-load more than just rendering to the GPU these days so if we can somehow write to their GPU memory here then it might be more problematic.

My understanding is that we are reading uninitialized parts of a texture here. There is a strict separation between what shaders can read and write, and it would require a pretty catastrophic driver bug to be able to write into another program's active gpu memory.
It would take a security exploit for a page to be able to read webrender's gpu memory, so I am not overly worried. It doesn't hurt to treat this as a security issue anyway.

it's a slice of the live running video stream!

That's pretty wild, I wonder if this can be reproduced with webgl.

Comment on attachment 9148030 [details]
Bug 1637112 - Don't draw border-image segments with zero slice size. r=mstange

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: I don't think it can without another exploit, so hard. But if an attacker manages to read back webrender's memory, then this could let them read random things from other process's gpu memory.
  • Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
  • Which older supported branches are affected by this flaw?: all
  • If not all supported branches, which bug introduced the flaw?: None
  • Do you have backports for the affected branches?: Yes
  • If not, how different, hard to create, and risky will they be?: it should apply cleanly to older branches.
  • How likely is this patch to cause regressions; how much testing does it need?: Not very likely, let's let it bake on nightly for a few days and uplift after that.
Attachment #9148030 - Flags: sec-approval?
Attachment #9148352 - Flags: sec-approval?

Which older supported branches are affected by this flaw?: all

I'm having trouble reconciling that answer with others earlier saying ESR-68 is unaffected. Do we need this fixed on ESR or not?

Flags: needinfo?(nical.bugzilla)

My bad. The bug exists in all branches but it will not cause NaN texture coordinates in esr 68 which is the cause of the rendered garbage here. It does in Release, though.

Flags: needinfo?(nical.bugzilla)

WebRender is also disabled on ESR. Unless there's also a non-WR variant of this issue as well?

This is webrender-only.

Comment on attachment 9148030 [details]
Bug 1637112 - Don't draw border-image segments with zero slice size. r=mstange

sec-approval+, a=dveditz for beta

Attachment #9148030 - Flags: sec-approval?
Attachment #9148030 - Flags: sec-approval+
Attachment #9148030 - Flags: approval-mozilla-beta+
Attachment #9148352 - Flags: sec-approval?
Attachment #9148352 - Flags: sec-approval+
Attachment #9148352 - Flags: approval-mozilla-beta+
Flags: qe-verify+
QA Whiteboard: [qa-triaged]
Whiteboard: [post-critsmash-triage]

Reproduced the issue on Windows 10 and Ubuntu 18, with Nightly 78.0a1, Build ID 20200518093924.

Verified as fixed on Ubuntu 18, Windows 10 x64 and MacOS 10.14.6, with

  • Latest Nightly 78.0a1, Build Id 20200525093440
  • Latest Beta 77.0b9, Build ID 20200521224544.
Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main77+]
Attached file advisory.txt
Alias: CVE-2020-12407
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: