What is formjacking protection on payment pages?
Formjacking protection uses security controls to prevent malicious scripts from stealing information entered into web forms. On payment pages, it addresses a form of eSkimming, also called web skimming, that can expose card details before a customer submits a payment.
Effective protection controls what scripts can access and change while they run in the customer’s browser. Your team needs to establish whether a control can interrupt unauthorized behavior during that session and what happens when it detects a problem.
A checkout page can continue processing legitimate purchases while malicious code copies customer inputs. Successful transactions therefore do not establish that the payment experience is secure.
How formjacking reaches your checkout
An attacker may compromise your website’s code, a third-party service, or an account used to publish scripts through a tag manager. Once malicious JavaScript runs on a page, it may capture accessible form inputs or alter the page to collect information through a fake form.
The attack does not necessarily send data to an unfamiliar domain. In Source Defense research into a fake payment form, an attacker hid a legitimate Stripe payment iframe and displayed a convincing replacement. The malicious code sent captured data to the merchant’s own compromised server.
That example illustrates a limitation of relying on destination reputation alone: an attacker-controlled endpoint can sit within infrastructure your website already trusts.
How runtime controls interrupt data theft
Runtime controls act while JavaScript executes in the browser. A preventive policy can restrict a script’s access to sensitive fields or its ability to modify protected page elements.
Consider an analytics script that needs to record a checkout page view. That business purpose does not require access to a customer’s card number. A policy could allow the approved analytics activity while denying access to protected payment inputs.
When supported and enforced, that restriction can stop the prohibited read before the script receives the field value. Other controls can redact sensitive information or block a script from executing. The available action depends on the technology, policy, and deployment.
Monitoring serves a different purpose. A system can identify suspicious access and generate an immediate alert while still allowing the action to occur. For formjacking protection, verify exactly which actions your control blocks automatically and which require someone to intervene.
How prevention differs from source and file checks
Website defenses operate at different points in the payment journey. Source restrictions and file checks do not assign field-level permissions to JavaScript that is allowed to run.
| Control | What it evaluates or restricts | Boundary to understand |
| Web application firewall | Requests reaching the protected application | Does not itself enforce script access to form fields inside the customer’s browser. |
| Content Security Policy (CSP) | Browser rules for resources, script execution, and connections, including source, nonce, or hash restrictions | Does not assign approved scripts permissions to read particular form fields. |
| Subresource Integrity (SRI) | Whether a fetched resource matches an expected cryptographic hash | A matching file is not a determination that every action it performs is authorized. |
| Runtime monitoring | Script activity and behavior observed during execution | An alert alone does not prevent the observed action. |
| Runtime enforcement | Script actions governed by deployed policies | Prevention depends on the actions covered and whether enforcement is enabled. |
Mozilla’s documentation explains the mechanics of CSP and SRI. Neither makes a business decision about which customer information an approved script needs.
Our article on the browser-side control gap exposed by major website attacks examines the difference between approving code and controlling its behavior after deployment.
Hosted payment forms and the surrounding page
A payment provider’s embedded form can be surrounded by merchant-controlled scripts and page elements. An attacker who compromises that surrounding page may hide the genuine form or place a fake payment prompt in front of it.
This attack path does not require reading fields inside the genuine payment iframe. It diverts the customer into entering information somewhere else.
Your payment page security review should establish who controls the parent page, which scripts can modify it, and how unauthorized changes are restricted. Our explanation of client-side risk around hosted payment services explores those shared responsibilities.
Where formjacking protection fits into PCI DSS
PCI SSC’s payment-page security guidance addresses two distinct requirements in PCI DSS 4.0.1:
Requirement 6.4.3 addresses payment-page script management: confirming authorization, assuring script integrity, and maintaining an inventory with a written business or technical justification for each script’s necessity.
Requirement 11.6.1 addresses detecting unauthorized changes to security-impacting HTTP headers and payment-page script contents as received by the consumer’s browser, with alerts to personnel. The mechanism operates at least weekly or at a frequency established through the targeted risk analysis specified in Requirement 12.3.1.
Runtime blocking is a separate prevention capability. An alerting requirement should not be presented as a requirement to deploy automatic blocking.
Your validation path also matters. PCI SSC FAQ 1588 explains the SAQ A script-attack eligibility criterion for merchant pages with embedded payment forms and the approaches for addressing it. That specific criterion excludes redirect-only and fully outsourced payment-link flows. Confirm your applicable validation and responsibility boundaries with your acquirer or other compliance-accepting entity.
What to verify before choosing protection
When evaluating website security software for online payment protection, ask for a demonstration in your actual checkout environment.
Establish coverage. Identify the pages and scripts covered, including scripts loaded indirectly through other scripts or tag managers. Check the merchant page surrounding any hosted payment form.
Test the enforcement point. In controlled testing with synthetic data, demonstrate whether an unauthorized field read or page modification is blocked before it succeeds. Record which actions produce alerts without blocking.
Validate checkout functionality. Confirm that legitimate payment, fraud-screening, authentication, and analytics functions still work under the proposed policies. Test the payment methods and checkout variations your customers use.
Examine operating evidence. Review script approvals, business justifications, monitoring history, sample alerts, and investigation records. Assign responsibility for responding to findings and updating policies.
For a closer look at assessment evidence, see our guide to validating PCI DSS requirements 6.4.3 and 11.6.1.
See payment page protection in practice
Source Defense monitors JavaScript behavior and supports runtime controls that restrict unauthorized script activity and sensitive-data access.
Request a Source Defense demo to see how those controls apply to your payment flow, what they can prevent, and what evidence your team can use in its PCI work.
Previous