Cyber Risks · PortSwigger Research

Content security policy: allows form hijacking

Summary: PortSwigger Research describes how Content Security Policy, a mechanism meant to block cross-site scripting by disabling untrusted JavaScript execution, can be bypassed for form hijacking when the form-action directive is not set. The guidance recommends setting form-action to 'none' when no form actions are used, to 'self' for same-origin-only submissions, and allow-listing external hosts only with the understanding that attackers can then submit to those same resources.

What you should know: A CSP without a form-action directive leaves form destinations uncontrolled, so an injected form can post credentials to an attacker's host even while the policy appears to be enforcing script restrictions.

Read the original at PortSwigger Research ↗

Topics
Vulnerabilities & Patching
Related