Closed Bug 1645430 Opened 6 years ago Closed 5 years ago

blob may access local storage.

Categories

(Core :: DOM: File, task)

task

Tracking

()

RESOLVED INVALID

People

(Reporter: febou92, Unassigned)

Details

(Keywords: reporter-external, Whiteboard: [reporter-external] [client-bounty-form] [verif?])

Attachments

(3 files)

Attached image POC.svg

In the Firefox version 77.0.1. A blob page can access the local storage of the parent site. This may allow token stealing via XSS. Via the GUI we cannot access that token, so I think this is not the intended behavior.

This was done with a malicious SVG on a website I was testing. (Code of POC included)

Flags: sec-bounty?

Can you provide a more complete PoC?

The SVG file, if loaded in an image tag or via a CSS background-image or list-style-image rule or similar, shouldn't run script at all, AIUI - and I cannot reproduce it doing so, either. Are you seeing something else?

It's also not clear what the connection with a blob URI is, from the SVG file...

Flags: needinfo?(febou92)
Attached image example1.PNG
Flags: needinfo?(febou92)
Attached image example2.PNG

sorry about that.
I am trying to explain my best without giving screenshots of the site that lead me to see this potential vulnerability.
https://example.com would have a link to blob:https://example.com/cf3b42fa-5ff8-4a2a-8751-f09e15cea50a.
When the user clicks on the link to see the image, the javascript would execute and send the LocalStorage of https://example.com.
Please see the attached images example1 and example2, I hope this will let help.

(In reply to febou92 from comment #4)

sorry about that.
I am trying to explain my best without giving screenshots of the site that lead me to see this potential vulnerability.
https://example.com would have a link to blob:https://example.com/cf3b42fa-5ff8-4a2a-8751-f09e15cea50a.
When the user clicks on the link to see the image, the javascript would execute and send the LocalStorage of https://example.com.
Please see the attached images example1 and example2, I hope this will let help.

Once script executes on a blob: page, this is expected, a blob is same-origin with the page creating the blob. See https://developer.mozilla.org/en-US/docs/Web/API/URL/origin , https://w3c.github.io/FileAPI/#originOfBlobURL . The same thing happens in Chrome (at least when loading the svg off a file/http URI), as far as I can tell.

If the embedding page wants to avoid this, it should create the blob from a sandboxed iframe so it gets a null principal. Not creating / linking to such blob URIs would also help...

Group: firefox-core-security → dom-core-security
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Component: Security → DOM: File
Product: Firefox → Core
Resolution: --- → INVALID

I understand that it is normal for the blob to execute javascript, but should it be able to read the LocalStorage of https://example.com.
It might be confusing to me since you cannot read it from the GUI I was led to believe these were isolated.

(In reply to febou92 from comment #6)

It might be confusing to me since you cannot read it from the GUI I was led to believe these were isolated.

I think the storage inspector not showing this is a (non-security) bug in the devtools storage inspector and how it copes with blob URIs. Nicolas, who knows about the storage inspector and if we're aware of this?

(see also other devtools bugs relating to blob - https://bugzilla.mozilla.org/buglist.cgi?quicksearch=prod%3DDevTools%20blob&list_id=15291503 ; it doesn't appear there's one about this problem; bug 1054028 seems to be about previewing blobs stored in storage...)

Flags: needinfo?(nchevobbe)

Let's ask Belén and David

Flags: needinfo?(nchevobbe)
Flags: needinfo?(dwalsh)
Flags: needinfo?(balbeza)

I concur with :Gijs, this appears to be a UI bug we should clean up. I will create a bug for this.

Flags: needinfo?(dwalsh)

Thanks David, could you See Also or otherwise post the new bug here for reference?

Flags: sec-bounty?
Flags: sec-bounty-
Flags: needinfo?(dwalsh)
Flags: needinfo?(dwalsh)
Flags: needinfo?(balbeza)
Group: dom-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: