Skip to content
XSS Disclosed report Intermediate

CSRF leads to a stored self xss

A favourites folder name was not sanitised, so a stored cross-site scripting payload in the folder name executed when an image was saved to that folder. Because the folder could be created via a cross-site request forgery, an attacker could deliver the payload to a victim who then added an image to the folder.

hogarth45 Follow

Originally disclosed on HackerOne

  • Triaged in 47 hours
  • Fixed in 17 months
  • Paid in 6 months
  • Disclosed after 18 months

Followup from #311460

#Summary Self xss and CSRF are both out of scope, but when paired it is possible to create an attack on a user.

#Description A favorites folder with an xss payload for a name will launch when saving an image to said folder.

This can be verified by following these steps

  • Visit your favorites
  • Create New Folder
  • Change name to
"'><img src=x onerror=prompt(1)>
  • Save
  • Visit a photo
  • Click the little plus next to the heart on bottom left of image
  • Add to the folder
  • xss will launch

Since self xss is out of scope, we will need a method of delivering this attack to a user. This can be done via a CSRF to create a favorites folder.

POC

Using a form like so to create the CSRF:

<html>
<body onload='document.forms[0].submit()'>
  <form method='POST' enctype='application/json' action='https://api.imgur.com/3/folders'>
    <input name='name' value='New Test"><img src=x onerror=prompt(2)>'>
    <input name='is_private' value='false'>
  </form>
</body>
</html>

Or be logged into your imgur account and visit

http://blackdoorsec.net/sandbox/imgur2.html

This will create the folder with an xss name that can be used to attack an account.

Impact

account hijacking since a user would still need to add an image to the folder for the attack to work, the success rate will be lower than normal

#Scenerio since reddit/imgur communities overlap malicious links containing the CSRF could be sent throughout the site. out of the few thousand hits the link would get, i imagine there would be several successful compromised imgur accounts.

The original report as published on HackerOne, by hogarth45. 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 folder name was stored and later rendered without proper output encoding, and the folder-creation endpoint accepted cross-site requests without a CSRF token.

Impact

An attacker could hijack an account, though the success rate is lower because the victim must still add an image to the folder.

What the attacker needed

Victim is logged in; victim adds an image to the folder

How it was found

  1. Visit your favourites
  2. Create a new folder
  3. Set the folder name to a script payload
  4. Save the folder
  5. Visit a photo and add it to the folder
  6. The script runs

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.

A website let you name a folder, but it did not clean up special characters in that name. When the folder name was later shown on a page, the browser treated part of it as code and ran it. Separately, another site could make your browser create such a folder without you meaning to, which is called cross-site request forgery.

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 hogarth45

View all

7 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.