osec.one case analysis cover: card skimmers inside Google Tag Manager containers, the store's own trusted tag loading the checkout stealer

Most online stores already load one script from Google on every page: the Google Tag Manager (GTM) snippet that feeds analytics and ad pixels. Since 2021, Magecart groups have used that same snippet to deliver card skimmers. Recorded Future counted 316 stores in the first year and 314 confirmed GTM infections by August 2022, with 165,000+ card records from them for sale. In February 2025 Sucuri cleaned a Magento store where the GTM tag sat in a database block, and in June 2026 Sansec found GTM containers that pull a skimmer out of a Stripe customer record and post the stolen cards back to Stripe.

What these cases share: nothing on the page looks foreign. The loader comes from googletagmanager.com, a host every store's security policy already allows, and in the newest case the stolen data goes to api.stripe.com, which a store's checkout has to allow anyway. This write-up goes through how a tag manager becomes a checkout stealer, why the usual allowlists and integrity hashes don't catch it, and the checks that do.

Six steps: attacker gets into the store admin, database or GTM account; a GTM snippet with the attacker's container ID is added to a Magento CMS block or head config, or a custom tag to the store's own container; the browser loads gtm.js from googletagmanager.com, which the CSP allows; on the checkout page the custom tag runs the skimmer; the skimmer reads card number, expiry and CVV when the buyer clicks to pay; the data is sent to a look-alike domain or a Stripe account, about five cards a day for months

Timeline

WhenWhat happenedSource
4 Feb 2021First trojanized GTM container seen on a storeRecorded Future (Gemini Advisory)
Dec 2021316 stores with skimmers in GTM containers, at least 88,000 card records posted to dark web shops; two variants; mostly US Magento storesRecorded Future
25 Aug 2022569 infected domains, 314 confirmed GTM-based, 87 still infected; 165,000+ card records; average 3.5 months before removal; a third, XOR-obfuscated variant from July 2022Recorded Future Insikt
6 Feb 2025Sucuri: GTM-MLHK2N68 loaded from Magento's cms_block.content table, skimmer on checkout, backdoor in media/index.php; container on at least 6 sitesSucuri
31 Mar 2025PCI DSS v4.0 requirements 6.4.3 (inventory and authorise every payment-page script) and 11.6.1 (detect changes on payment pages) stop being optionalPCI Security Standards Council
24 Dec 2025Stripe customer record that later held a skimmer payload createdSansec
4 Jun 2026Sansec: four GTM containers load a skimmer from Stripe customer metadata and upload stolen cards to Stripe as fake customers; a Firestore variantSansec

Five years in, the method has barely changed. What changed is where the code sits: first inside the container, then on a domain the container calls, and now inside a payments API the store itself trusts.

How a tag manager becomes a loader

The GTM snippet is a few lines of inline JavaScript that add https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX to the page. The container behind that ID holds tags and triggers, and one tag type, Custom HTML, runs any JavaScript you put in it, on any page the trigger matches. Whoever controls the container controls what runs on the store.

The public cases show two ways in:

1. The attacker's own container on your store. The attacker gets write access to the store (an admin password, an unpatched extension, a Magento bug such as CosmicSting) and pastes a GTM snippet with their container ID into a place the store prints on every page. On Magento that's usually the database, not a file: a CMS block (cms_block.content, Sucuri's 2025 case), a CMS page, or the theme's head HTML in core_config_data (path design/head/includes). A file scan finds nothing, and the same container ID on several unrelated stores is the giveaway that it isn't the store's.
2. A custom tag in your own container. Anyone who can publish in the store's GTM account (a marketing agency, a former contractor, a phished Google account) can add a Custom HTML tag set to fire on /checkout. No change to the store at all. The public reports don't say how often this route was used, but Sansec's advice to review every tag you didn't add yourself covers it.

Once the tag runs, the skimmer is ordinary: wait for the checkout form, read the card fields when the buyer clicks to pay, encode them, send them out. Sansec's 2026 loader only runs on URLs containing checkout, waits 2 seconds, saves a card only when number, expiry month, expiry year and CVV are all present, and uploads 1 second after each page load and then every 60 seconds.

Three generations of hiding place

VariantWhere the skimmer livesWhere the cards goScale
2021 variant 1 (from Mar 2021)Plain JavaScript inside a unique GTM container per victim8 domains made to look like Google's187 domains, 52 still infected Aug 2022
2021 variant 2 (from Jun 2021)Container holds a loader; the skimmer is on a separate siteThe same dual-use site (17 domains)118 sites, 22 still infected
2022 variant 3 (Jul 2022)Inside the container, XOR-encrypted with a per-container key4 exfiltration domains13 sites, all still infected
2025 Sucuri caseGTM tag stored in Magento's cms_block.content, obfuscated, rewritten analytics.jseurowebmonitortool[.]comGTM-MLHK2N68 on at least 6 sites
2026 Sansec caseStripe customer metadata, fetched with a hard-coded test keyapi.stripe.com, as new Stripe customers4 containers named; store count not published

Worked: 165,000 records over 314 GTM-infected stores is about 525 cards a store. Spread over the average 3.5 months (about 105 days) before removal, that's roughly 5 cards a day: no unusual traffic, no failed orders, nothing in the store's own data. Stores usually hear about it from customers or their payment processor once enough cards turn up in fraud reports; Sucuri's 2025 case started with a customer reporting card theft.

Why allowlists and hashes don't stop it

ControlWhat it checksWhy the GTM skimmer gets past
CSP script-src https://www.googletagmanager.comWhich hosts may serve scriptsEvery container is served from the same host; the attacker's differs only in ?id=
CSP connect-srcWhere scripts may send data2021-2025 cases used new domains (a report-only CSP would show them); the 2026 case posts to api.stripe.com, which Stripe checkouts must allow
Subresource Integrity (SRI)That a script's bytes match a hashgtm.js is rebuilt every time a container is published, so it can't carry a fixed hash
File integrity monitoringChanges to files on the serverThe snippet is a row in the database, not a file
Looking at the page in devtoolsWhat runs in the browserRecorded Future: skimmers increasingly switch off when developer tools are open; Sansec's runs only on checkout URLs

That doesn't make CSP useless. A policy in report mode, with connect-src limited to the hosts you really use, would have reported every 2021-2025 exfiltration domain the first time a buyer's browser tried it; osec CSP Reports collects those reports and groups them by blocked host. What it can't see is a skimmer that uses a host you already trust, which is why the remaining checks are about which container IDs your pages load and what is in them.

Checks that find it

1. List the container IDs your pages load. You should know them by heart: usually one, sometimes two. Search your checkout page's HTML and, on Magento, the database (cms_block.content, cms_page.content, and core_config_data values under design/head/includes and design/footer/absolute_footer) for googletagmanager, GTM- and gtag/js?id=. Any ID you don't recognise is the incident.
2. Review every tag in your own container. Custom HTML tags with obfuscated code, tags that fire only on checkout, and anything that mentions api.stripe.com, firestore.googleapis.com or a key starting sk_test_ or sk_live_ (a Stripe secret key never belongs in a browser). Check who has Publish rights and turn on 2-Step Verification for each Google account with access.
3. Load checkout while watching the network. Every request leaving the payment page should go to your processor or your own API. A POST to api.stripe.com/v1/customers from the buyer's browser is not a payment.
4. Keep GTM off the payment page if you can. Analytics tags rarely need to run on the card form. A trigger exception for checkout URLs, or a hosted payment page or payment fields in the processor's own iframe, takes the card numbers out of reach of anything in the container.

For the first check, the osec SRI check lists every script tag a page's HTML loads and marks Google Tag Manager as a dynamic host (no fixed hash possible), with the full URL so you can read the container ID. Its limit: the standard GTM snippet is inline JavaScript that creates the script tag, so the check sees gtag/js?id= and gtm.js?id= tags written into the HTML but not one added by another script. Use it as the quick outside look and the database search as the real inventory.

Controls that break each step

StepControlNotes
Write access to the storePatch Magento and extensions, MFA on admin, a non-default admin URL, admin restricted by IPCosmicSting (2024) gave attackers exactly this access
Snippet in the databaseAlert on changes to cms_block, cms_page and the core_config_data head/footer paths; weekly diff of stored HTMLPCI DSS 11.6.1 asks for change detection on payment pages at least weekly
Tag in your own containerFew publishers, 2-Step Verification, workspace approvals, review the version historyAgencies' and former staff's access is the usual gap
gtm.js loadsKnow your container IDs; a page-script inventory (PCI DSS 6.4.3) that lists themSRI can't pin gtm.js
Skimmer on checkoutKeep GTM off the card form, or use hosted payment fields or a hosted payment pageRemoves the target, not just the attacker
Cards leave the browserReport-only CSP with a tight connect-src; flag browser calls to payment APIs that don't come from the processor's own scriptCatches new domains; a trusted-API route needs the content checks above

How it compares

Each Magecart case on this site abuses a different trusted thing. In British Airways 2018 the attackers edited a library file on BA's own server. In Polyfill.io a widely used CDN domain was sold and started serving malicious code. In CosmicSting 2024 a Magento bug gave attackers the access to plant skimmers in the first place. Here the trusted thing is the store's own tag manager: a file check finds nothing, a host allowlist approves it, and an integrity hash can't be set. What does work is plain: know which container IDs and tags should be there, and look.

Paste your checkout page URL and see every script it loads, which ones can be pinned with an integrity hash, and which come from hosts like Google Tag Manager that change under the same address. Free, nothing to install.

Check your page's scripts

Sources

• Recorded Future (Gemini Advisory), Magecart Groups Abuse Google Tag Manager (Dec 2021): https://www.recordedfuture.com/blog/magecarts-group-abuse-google-tag-manager
• Recorded Future Insikt, Threat Actors Continue to Abuse Google Tag Manager for Payment Card e-Skimming (data to 25 Aug 2022): https://www.recordedfuture.com/research/threat-actors-continue-to-abuse-google-tag-manager-for-payment-card-e-skimming
• Sucuri, Google Tag Manager Skimmer Steals Credit Card Info From Magento Site (6 Feb 2025): https://blog.sucuri.net/2025/02/google-tag-manager-skimmer-steals-credit-card-info-from-magento-site.html
• The Hacker News, Hackers Exploit Google Tag Manager to Deploy Credit Card Skimmers on Magento Stores (10 Feb 2025): https://thehackernews.com/2025/02/hackers-exploit-google-tag-manager-to.html
• Sansec, skimmer using the Stripe API and Google Tag Manager (4 Jun 2026): https://sansec.io/research/stripe-api-skimmer-infrastructure
• Sucuri, Credit Card Skimmer Malware Targeting Magento Checkout Pages (Nov 2024; core_config_data): https://blog.sucuri.net/2024/11/credit-card-skimmer-malware-targeting-magento-checkout-pages.html
• Sansec, GetCCInfo skimmer profile (database fields used): https://sansec.io/malware/getccinfo
• PCI Security Standards Council, PCI DSS v4.0 (requirements 6.4.3 and 11.6.1): https://www.pcisecuritystandards.org/document_library/