Stealing Credit Card Info with CSS
A CSS injection flaw in a payment form allowed an attacker to load arbitrary CSS via a postMessage, which could be used to exfiltrate credit card details as the user typed them. The attacker could steal card number, CVV, and expiry data by sending crafted CSS that triggered requests to their server.
castilho.sh
Published on castilho.sh
It's been a while since I posted something ... But I plan to bring new content into the blog and to get off on the right foot.
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 user-supplied font URLs directly into a CSS @import rule without sanitisation, allowing arbitrary CSS injection.
Impact
An attacker could steal credit card information (card number, CVV, and expiry date) from users who typed it into the form after being tricked into visiting a malicious page.
What the attacker needed
Victim clicks a link; victim types card details
How it was found
- The attacker creates CSS files that use attribute selectors to match input values and trigger background-image requests to their server.
- The attacker hosts these CSS files on their own server.
- The attacker sends a postMessage to the checkout page with the CSS file URLs in the fonts array.
- The victim visits the attacker's page, which opens the checkout page and sends the postMessage.
- The victim types their credit card information into the form.
- The browser loads the attacker's CSS, which causes requests to the attacker's server containing the typed characters.
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.
The payment page accepted a list of font styles from another window and inserted them into the page without checking. An attacker could send their own stylesheet that made the browser request a URL containing the characters typed into the card form, revealing the card details to the attacker's server.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.