Magecart Hack Injects JavaScript to Steal Online Payment Data

Magecart Hack Injects JavaScript to Steal Online Payment Data

A new Magecart-style campaign is actively targeting e-commerce websites by injecting malicious JavaScript that intercepts and exfiltrates payment card data during checkout.

The malicious script was hosted at cc-analytics[.]com/app.js and discovered on compromised e-commerce sites through script injection.

The code employs heavy obfuscation using hex encoding and base conversion functions to evade detection.

Security researchers deobfuscated the payload using debugger methods and Python string analysis, revealing the true intent: harvesting sensitive payment information.

The decompiled code demonstrates how the attack works. Event listeners are placed on checkout input fields and payment method buttons.

When users enter credit card numbers or billing information, the JavaScript collects these values and transmits them to attacker-controlled servers at pstatics[.]com via XMLHttpRequest POST requests.

The discovery, initially shared on X by SDCyber Research, reveals a sophisticated operation utilizing obfuscated code and distributed infrastructure across multiple domains.

The data exfiltration only occurs when card numbers exceed 14 characters, suggesting the attackers implemented basic validation to avoid capturing incomplete or test data.

Infrastructure Discovery

Pivoting on the initial domain through URLScan revealed a broader attack infrastructure. The malicious script appeared on multiple compromised websites, injected via