Skip to content
XSS Disclosed report Intermediate

XSS via React element spoofing

A cross-site scripting vulnerability existed on Imgur because a URL parameter was parsed into an object that could spoof a React element, allowing an attacker to inject HTML with an event handler. An attacker could execute JavaScript in a victim's browser when they visited a crafted link, potentially performing actions as the victim or reading the session cookie.

jouko Follow

Originally disclosed on HackerOne

  • Fixed in 5 days
  • Paid in 5 days
  • Disclosed after 5 days

Hello, I noticed an XSS on imgur. Proof of concept: visit the URL

http://imgur.com/vidgif/ticket/aaaaaaaa?error[props][dangerouslySetInnerHTML][__html]=%3Cimg%20src=a%20onerror=%22alert(%27XSS%20on%20%27%2bdocument.domain)%22%3E&error[_isReactElement]=true&error[type]=body

It's not the simplest case as it requires some React magic. There is a good explanation of this type of vulnerabilities at http://danlec.com/blog/xss-via-a-spoofed-react-element . Corresponding H1 report: https://hackerone.com/reports/49652 .

The impact is as usual. The attacker could execute operations on behalf of the victim who visits a malicious link, or access e.g. the session cookie (IMGURSESSION).

I haven't yet checked if this the only such occurrence on Imgur.

Attachments

imgur-xss.png
imgur-xss.png From the original on HackerOne

The original report as published on HackerOne, by jouko. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application passed user-controlled URL parameters into a React element creation function without validating that the object was a genuine React element, allowing an attacker to set properties like dangerouslySetInnerHTML.

Impact

The attacker could execute operations on behalf of the victim who visits a malicious link, or access the session cookie (IMGURSESSION).

What the attacker needed

Victim clicks a crafted link

How it was found

  1. Craft a URL with parameters that spoof a React element and include an HTML payload with an event handler.
  2. Send the URL to a victim or trick them into visiting it.
  3. The victim's browser executes the injected JavaScript.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Cross-site scripting (XSS) is when an attacker can make a website run their own JavaScript in another user's browser. Here, the site took a specially crafted link and treated part of it as a React element, which let the attacker sneak in an image tag with an error handler that runs code. The victim just has to click the link for the code to run.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by jouko

View all

13 more disclosed reports, best first.

More from Imgur

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.