CSP form hijacking is a web attack that abuses a site’s own forms to send data or requests to an attacker-controlled destination. The attacker exploits content security policy gaps, injected scripts, or misconfigured form actions to capture credentials, payment details, or session data while the page still appears legitimate.
How CSP Form Hijacking Works
CSP form hijacking abuses a site’s own trusted form flow rather than replacing the page outright. By injecting script or manipulating form actions, the attacker can redirect submitted data to an attacker-controlled destination while the user still sees a familiar interface.
The abuse is effective because users tend to trust an intact login, checkout, or support form. If the page continues to render normally, the malicious redirection can blend into ordinary browser behaviour and escape quick visual inspection.
Why It Is Dangerous
This attack can capture high-value data in transit, including credentials, payment details, and session material. Because the submission often originates from a legitimate page and a legitimate user action, the exfiltration path may look like normal application traffic until the destination or payload is examined closely.
It is especially dangerous when a site relies on permissive inline scripting, weak form destination controls, or vulnerable third-party content. In those cases, the browser is still enforcing policy, but the policy is no longer protecting the form journey the application actually depends on.
Common Abuse Paths
Form hijacking usually rides in through script injection, malicious browser-side dependencies, compromised tags, or an application bug that lets an attacker alter form attributes such as action or submit handlers. The attacker does not need to replace the entire site, only the trust path the form uses.
Some attacks are overtly malicious, while others exploit a subtle configuration gap. For example, a page may allow unexpected destinations for form posts or load code from a dependency that can rewrite the submission target at runtime.
What Defenders Need to Watch
Defenders should look for unexpected form destinations, suspicious client-side script changes, and outbound requests that do not match the application’s normal submission patterns. Review browser-side code paths, dependency integrity, and any place where user input can influence a form action or submission handler.
Because the page may still function normally for users, detection often depends on comparing expected application behaviour with actual network egress. A strong baseline of normal form targets and browser-side behaviour makes it easier to spot subtle redirection.
Risk and Threat Considerations
CSP form hijacking can turn a trusted web flow into a silent data theft channel. The main risk is not page defacement, but invisible diversion of credentials, card data, or session-related information from a legitimate interaction.
Failure mechanism: The attacker gains code execution or form control through injected script, compromised dependencies, or weak form-action restrictions, then rewrites where the browser sends submitted data.
Impact: Sensitive user input can be exfiltrated without breaking the visible page flow, which increases the chance of credential theft, account takeover, fraud, and delayed incident discovery.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-53 Rev 5, OWASP ASVS and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | SC-18 — Mobile Code | Controls active content that can alter form behavior in the browser. |
| SI-10 — Information Input Validation | Supports validation of user-controlled inputs that influence form handling or destinations. | |
| Recommendation — Restrict and validate executable client-side content that can rewrite form destinations. Validate and constrain user-controlled fields that affect form submission paths. | ||
| OWASP ASVS | V13 — Configuration | Covers secure browser and application configuration that shapes form-action and script trust. |
| V16 — Security Logging and Error Handling | Supports logging and review of suspicious submission behavior and client-side anomalies. | |
| Recommendation — Harden application configuration to prevent unauthorized form-action redirection. Log and review anomalous submission flows and unexpected client-side behavior. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | Addresses secure development and validation of application code that handles browser forms. |
| Recommendation — Review application code and dependencies that can alter client-side form behavior. | ||
Practitioner Guidance
Why practitioners should care: Treat form submission paths as a security boundary, not just a front-end convenience. If the application depends on browser-side logic to protect where data goes, the integrity of that logic becomes part of the control set.
What to watch for: Pay attention to code paths that can alter form actions, override submit behaviour, or introduce untrusted third-party JavaScript. Those are the points where a normal-looking page can become a covert exfiltration channel.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 23, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org