Formjacking
Formjacking is a cyberattack in which criminals inject malicious code into a website's forms, most often the payment or checkout page, to secretly capture the information a customer types in. Because the stolen data, such as card details entered on a payment page, is intercepted as the shopper submits the form, the attack can occur without the customer or the merchant noticing. It has been described as a form of man-in-the-middle attack, since it intercepts communications between the user and the website.
Formjacking refers to the unauthorized injection of malicious JavaScript into a website's form fields—commonly on checkout or login pages—to skim data entered by users, including payment card details and other sensitive authentication or credential information. The injected script executes in the client browser and intercepts form input at or before submission, functioning as a client-side man-in-the-middle interception between the user and the intended endpoint. Because the data captured can include cardholder data such as the PAN and, on payment forms, sensitive authentication data such as CAV2/CVC2/CVV2/CID entered during checkout, formjacking is a concern for the security of client-side payment page scripts; the specific controls that govern script integrity and monitoring on payment pages should be confirmed against the current published PCI DSS.
Why it matters
Formjacking targets the client side of a web application—the browser environment where a customer actually types their information—rather than the merchant's back-end servers. This makes it particularly difficult to detect, because the malicious JavaScript executes in the shopper's browser and can capture data at or before submission without triggering server-side alarms. As a result, an attack can persist for an extended period while neither the customer nor the merchant notices that form input is being intercepted.
The data at risk on a payment or checkout page can include cardholder data such as the PAN, as well as sensitive authentication data such as CAV2/CVC2/CVV2/CID that a customer enters during checkout. Sensitive authentication data must not be stored after authorization, yet formjacking captures it precisely at the moment of entry, before the merchant's own storage and control decisions come into play. This makes the integrity and monitoring of client-side scripts on payment pages a meaningful security concern. The specific controls governing payment page script integrity and change detection should be confirmed against the current published PCI DSS, as requirement wording and numbering differ between versions.
Because formjacking operates through third-party or injected scripts loaded into the payment page, it also highlights the risk introduced by the many external scripts commonly present on modern checkout pages. A compromise of any script with access to form fields can expose the data a customer submits, which is why script inventory, integrity verification, and monitoring are central to reducing this exposure rather than any single detection control.
Who it's relevant to
Inside Formjacking
Common questions
Answers to the questions practitioners most commonly ask about Formjacking.