Identification of FormJacking

Formjacking is a type of cyber attack where an attacker injects malicious code into web forms on e-commerce websites to steal sensitive information entered by users, such as credit card details, personal information, and login credentials. Identifying formjacking involves detecting unauthorized modifications to web forms and monitoring for suspicious network activity. Here are steps to identify formjacking:


  1. Monitoring Network Traffic: Use network monitoring tools to inspect outgoing traffic from the website. Look for any unusual POST requests that might indicate data being sent to unauthorized destinations.
  2. Analyzing JavaScript Code: Review the JavaScript code used on the website to look for any suspicious scripts or modifications that could be injecting malicious code into web forms.
  3. Inspecting HTML and JavaScript: Manually review the HTML and JavaScript code of web forms to check for any unauthorized changes or additions made by attackers.
  4. Monitoring for Data Exfiltration: Keep an eye on outbound network traffic for any signs of sensitive data being transmitted to suspicious domains or servers.
  5. Browser Developer Tools: Use browser developer tools to inspect network requests, JavaScript console logs, and DOM modifications in real-time while interacting with the website.
  6. Scanning for Vulnerabilities: Perform regular security scans and vulnerability assessments to identify any weaknesses in the website's code or infrastructure that could be exploited for formjacking attacks.


  • Example 1: During a routine security audit, a penetration tester discovers that the checkout page of an e-commerce website has been modified to include additional JavaScript code that captures user input data and sends it to a remote server controlled by attackers.
  • Example 2: A security researcher identifies a formjacking attack targeting a popular online retailer after noticing unauthorized network traffic originating from the retailer's website to suspicious domains known for hosting formjacking scripts.


  1. Secure Code Development: Implement secure coding practices to prevent injection attacks, such as input validation and output encoding, to mitigate the risk of formjacking attacks.
  2. Content Security Policy (CSP): Utilize CSP headers to restrict the execution of scripts to trusted sources, limiting the impact of formjacking attacks by preventing the execution of unauthorized scripts.
  3. Regular Code Audits: Conduct regular code reviews and security audits to identify and address any vulnerabilities or unauthorized modifications to web forms.
  4. Endpoint Security: Deploy endpoint security solutions, such as web application firewalls (WAFs) and intrusion detection systems (IDS), to detect and block malicious activity related to formjacking attacks.
  5. User Education: Educate users about the risks of formjacking attacks and advise them to monitor their bank statements for any unauthorized transactions or suspicious activity.

By identifying and mitigating formjacking attacks, organizations can protect their users' sensitive information and maintain the integrity of their e-commerce websites.