CSS Injection on /embed/ via bgcolor parameter leaks user's CSRF token and allows for XSS
The bgcolor parameter on the /embed/ page was inserted into a CSS style block without sanitisation, letting an attacker inject arbitrary CSS rules. By enumerating a CSRF token through CSS selectors, the attacker could steal the token and potentially combine it with HTML-returning endpoints to achieve XSS.
Ben Sadeghipour Follow with ziot and d0nut
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 10 hours
- Paid in 9 hours
- Disclosed after 57 days
Hi there,
There's a CSS injection here: https://chaturbate.com/embed/admin/?bgcolor=%7D*%7Bbackground:red&tour=nvfS&disable_sound=0&campaign=iNSGX
body, div#main, div.content, div.block, div.section {margin: 0px; padding: 0px;}
body {min-width:800px;}
div.content {width: 100%;}
body {background: }*{background:red;}
This allows an attacker to enumerate the CSRF token. Once the CSRF token is enumerated, we can
#POC
- Go to
http://d0nut.pythonanywhere.com/demo/token_stealing/7GTt5qD1LD273WYkJyaR/reset - Now go to
http://d0nut.pythonanywhere.com/demo/token_stealing/7GTt5qD1LD273WYkJyaRand let it do it's magic :)
There are numerous endpoints like POST /choose_broadcaster_chat_color where it returns Content-Type: text/html; charset=utf-8 that could potentially allow a hacker to combine the two for XSS (I haven't gotten that far yet)
Do you mind asking your HackerOne contact to allow collaboration on your program, so I can invite another researcher that helped me exploit this fully?
Thanks, Ben
Impact
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 bgcolor parameter was concatenated into a CSS style block without validation or escaping, allowing CSS injection.
Impact
An attacker could steal a user's CSRF token and potentially chain this with HTML-returning endpoints to achieve XSS, though the reporter had not yet demonstrated the XSS.
What the attacker needed
Attacker can host a page to run the CSS enumeration
How it was found
- Open the crafted /embed/ URL with the injected bgcolor value.
- Observe the injected CSS rule appearing in the page's style block.
- Use the injected CSS to enumerate the CSRF token.
- Visit the attacker's demo reset page, then the demo page to run the token-stealing proof of concept.
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 can let you change how it looks by putting values into a style sheet (CSS). Here the site pasted a user-supplied colour value straight into that style sheet, so an attacker could add their own styling rules. Those rules can be used to test guesses about secret values on the page, one character at a time, until the secret is revealed.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.