️ Silent But Deadly: How an Ignored CSP Header Let My XSS Slip
A reflected XSS vulnerability existed in a profile edit page because the Content Security Policy (CSP) header was not applied to that endpoint, allowing script execution. An attacker could execute arbitrary JavaScript in a victim's browser to steal cookies or perform actions on their behalf.
Free Link 🎈
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 CSP header was not consistently applied to all endpoints, leaving the profile edit page without protection.
Impact
An attacker could steal session cookies and potentially hijack user accounts, though the text does not confirm actual exploitation beyond a proof of concept.
What the attacker needed
Victim clicks a crafted link
The fix
The CSP header should be applied consistently to all endpoints, including the profile edit page.
How it was found
- Access the profile edit endpoint with a name parameter.
- Inject a script payload into the name parameter.
- Check that the endpoint lacks a CSP header.
- Observe the script executing and exfiltrating cookies.
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 Content Security Policy (CSP) is a browser rule that blocks unauthorised scripts from running. Here, the rule was missing on one page, so a malicious script placed in the URL ran in the victim's browser. This let an attacker read cookies or act as the user.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.