Skip to content

Improve Blob/File/MediaSource handling#88

Merged
weizman merged 13 commits intomainfrom
fix-issue-87
Jun 14, 2023
Merged

Improve Blob/File/MediaSource handling#88
weizman merged 13 commits intomainfrom
fix-issue-87

Conversation

@weizman
Copy link
Copy Markdown
Member

@weizman weizman commented Jun 11, 2023

This PR addresses #87 (see #88 (comment)) but ended up being more complicated...

Follow comments below in this PR by order for ctx, but to sum things up:

  • Making URL objects out of blobs/files is not longer fully forbidden.
  • If you use JS to create a blob, you can turn it into a URL object only if it is in the blob-types whitelist.
  • However, if you take a native blob (as a result of a fetch response for example) you can turn it into a URL object with no limitations.
    • This allows attackers to fetch malicious content and turn into a Blob, which is why Snow must be integrated with strong cross origin CSP
  • Also, this opens up @arxenix awesome bypass [WIP] Hook URL object creation #45 (comment), therefore Worker protection was also introduced at Hook Workers to appropriately treat Blobs completely #89

@weizman
Copy link
Copy Markdown
Member Author

weizman commented Jun 11, 2023

Currently this is only a PoC, which will probably end up quite similar to this.
I,

@weizman
Copy link
Copy Markdown
Member Author

weizman commented Jun 12, 2023

  • refactored blobs and url creation hooks to look better
  • still needs to:
    • make error handling clearer
    • write more tests to test new and more complex logic
    • test against popular sites

@weizman weizman changed the title [draft] poc for fixing issue 87 Improve Blob/File/MediaSource handling Jun 12, 2023
@weizman weizman marked this pull request as ready for review June 12, 2023 09:27
@weizman
Copy link
Copy Markdown
Member Author

weizman commented Jun 12, 2023

PROBLEM: This implementation reopens @arxenix brilliant bypass so this work isn't done yet.

@weizman
Copy link
Copy Markdown
Member Author

weizman commented Jun 13, 2023

revert 3dbc5aa test improvement, so I could handle this correctly on a different PR #89

@weizman
Copy link
Copy Markdown
Member Author

weizman commented Jun 13, 2023

Merged Worker protection so this solution is actually hermetic ac7a51a (this addresses #88 (comment))

@weizman
Copy link
Copy Markdown
Member Author

weizman commented Jun 14, 2023

Update, had to change direction a bit 6ee2c98
Some apps do expect to be able to fetch a resource as a native Blob and use JS to turn it into a URL obj (which I decided to block).
Therefore, instead of having an allowed-blobs list so that only JS crafted blobs are allowed to become URL objs, new approach differentiate "artificial blobs" (blobs made with JS) vs "native blobs" (blobs fetched remotely and handed by the browser).
If a blob is artificial, only allow it to become a URL object if its type is in the types whitelist.
If a blob is native, let it do whatever it wants.
This allows attackers to use XHR to fetch the malicious HTML they want as a blob and turn it into an object URL easily - which is just another reason why we MUST promote Snow as a solution that is almost irrelevant without CSP...

@weizman weizman merged commit e6359c3 into main Jun 14, 2023
@weizman weizman deleted the fix-issue-87 branch June 14, 2023 15:03
@weizman weizman mentioned this pull request Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant