Cyber Risks · PortSwigger Research

Lab: Reflected XSS protected by very strict CSP, with dangling markup attack

Summary: PortSwigger's lab demonstrates a form hijacking attack against a site using a strict CSP that blocks external subresources, exploiting a missing form-action directive to inject a button whose formaction points to an attacker-controlled exploit server. The attack uses formmethod="get" so the victim's CSRF token is included in the URL sent to the exploit server, letting the attacker exfiltrate the token and use it to authorize changing the victim's email to hacker@evil-user.net.

Bottom line: A CSP that blocks external subresources can still leave form submissions unrestricted, so a single injected button can hand an attacker the CSRF token needed to change a victim's account email.

Read the original at PortSwigger Research ↗

Topics
Vulnerabilities & Patching
Related