Introduction

A new Magecart campaign is leveraging Stripe's API infrastructure to host the credit card-stealing payload and data exfiltrated from checkout pages. This activity is enabled by Google Tag Manager (GTM) and Stripe domains, such as googletagmanager. com, which are trusted by online stores. Sansec researchers discovered that the malicious code is loaded from a GTM container and executed on every page that includes it. The entire malicious activity relies on the implicit trust of these domains by online stores, bypassing security measures like Content Security Policy (CSP) rules and network filters. Sansec found that the malicious code is embedded in legitimate-looking GTM containers, which activate when a shopper reaches a checkout page. The malicious code reads JavaScript code from the metadata fields of a specific Stripe customer record and reassembles it to execute. The data stolen includes credit card numbers, expiration dates, CVV codes, customer names, billing and email addresses, and phone numbers. The stolen data is stored locally and exfiltrated through a separate routine. Sansec also discovered a variant of the attack where Google Firestore is used instead of Stripe. The payload is retrieved from a Firestore document named tracking/captcha in a project called braintree-payment-app. The stolen data is stored in a different localStorage key (_d_data_customer_).

Credit card theft campaign abuses Stripe to host stolen payment info

Stripe API and GTM Usage

Stripe is a widely-used payment processing platform that online stores use to accept credit cards, manage customer orders, and handle billing. The Magecart campaign exploits the implicit trust that online stores place in Stripe and Google Tag Manager domains. This trust allows the skimmer to bypass security measures and execute malicious code. This process allows the malware to capture payment data and store it locally before exfiltrating it.

Firestore Variant

The names of the document and the project help the malware blend in with legitimate payment and bot-protection traffic. This variant of the attack suggests that the Magecart campaign is evolving to use different infrastructure to evade detection.

Preventing Magecart Attacks

Customers can protect themselves from such risks by using one-time virtual cards with set limits. Organizations can also implement robust security measures, such as strict CSP rules, network filters, and regular security audits, to prevent Magecart attacks. Additionally, organizations should monitor their payment processing systems for any suspicious activity and promptly investigate any anomalies. Sansec also recommends using AI-based security solutions, such as Adaptive Security's AI agents, to uncover email threats and phishing attempts that may be missed by existing defenses.

Conclusion

By understanding the Magecart attack vector and implementing robust security measures, organizations can mitigate the risk of such attacks and protect their customers' sensitive information.

Comments