A 250$ CSS Injection — My First Finding on Hackerone!
A country parameter was reflected inside a style attribute without sanitisation, allowing an attacker to break out of the background-image URL and inject arbitrary CSS. This could be used for phishing, but stealing user information required an old browser.
Published on medium.com
This is my first story on medium, to tell the story of how I found a CSS injection and exploited it, within a hackerone public program. I hope you learn a new attack vector on any real-world site you test.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application inserted the user-controlled country parameter into a style attribute without validating or escaping it, allowing the attacker to break out of the url() context.
Impact
This flaw could be used in phishing attacks, but stealing user information required the victim to use an old browser; the attacker could not escape the style attribute.
What the attacker needed
Victim clicks a crafted link; victim uses an old browser (for data theft)
The fix
The report says the issue was fixed within a week.
How it was found
- Open the page and find the feature that changes the country flag.
- Observe that changing the country parameter reflects the value inside a style attribute after '.svg)'.
- Try XSS techniques without success.
- Use a CSS comment to close the url() and inject additional style rules.
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 write-up has not been written yet. The Original tab links to the source.
A website took a value from the URL (the country code) and pasted it directly into a style rule that sets a background image. By adding special characters, the attacker could close the image URL and add their own CSS rules, changing how the page looks. This is called CSS injection; it is not the same as running JavaScript, so its impact is limited.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.