Découverte d’une vulnérabilité XSS avec contournement de la CSP via unpkg.com
A help-search page reflected user input into the HTML without proper filtering, allowing an attacker to inject a script tag. Because the site's Content Security Policy trusted unpkg.com, a script hosted there could be loaded and executed, bypassing the CSP.
Bonjour à tous, aujourd’hui je vais vous parler d’une vulnérabilité que j’ai découverte sur un sous-domaine d’un grand site de vente français. Pour l’exemple, nous appellerons ce site example.com.
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 search parameter was reflected into the page without adequate output encoding, and the CSP's script-src allowlist included a public host (unpkg.com) that serves attacker-chosen scripts.
Impact
An attacker could run arbitrary JavaScript on the help subdomain, enabling phishing, redirects and page manipulation, though the author notes session cookies were not usable on the main domain.
What the attacker needed
Victim clicks a crafted link; no account needed
The fix
The site should encode reflected input and remove broad public hosts such as unpkg.com from the script-src allowlist.
How it was found
- Open the help search results page with a query parameter.
- Inject HTML that includes a script tag pointing to a script hosted on unpkg.com.
- Load the modified URL and observe that the script executes despite the CSP.
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 reflected cross-site scripting (XSS) bug lets an attacker put their own code into a page a victim loads, so the code runs in the victim's browser. Here the site tried to block this with a Content Security Policy, a rule list saying which script sources are allowed, but it allowed a public code-hosting site, so the attacker could load a script from there. The result is that the injected code still ran.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.