On 11 June 2024 Adobe fixed CVE-2024-34102 in Adobe Commerce and Magento Open Source. Adobe's own CVSS score was 9.8: no login, no user interaction. Yet, according to Sansec's timeline, Adobe initially gave the update its lowest priority rating and raised it twice, reaching its top priority only on 8 July. A week after the fix, Sansec estimated that three-quarters of stores had still not patched. It recorded the first attacks on 23 June and named the bug CosmicSting.
The attack that followed was simple and lucrative. Read the store's configuration file, take the encryption key, use it to mint an API token, then rewrite the store's content blocks to add a payment skimmer. By mid-July Sansec was watching stores fall at five to thirty an hour. In August Adobe released a hotfix to invalidate old encryption keys; later that month attackers combined CosmicSting with a glibc bug, CVE-2024-2961, to run code on servers. On 14 October one group compromised more than 2,000 stores in a few hours. The uncomfortable lesson: a store that patched after its key was stolen was still open until it changed the key.
- CVE
- CVE-2024-34102 (“CosmicSting”)
- Product
- Adobe Commerce and Magento Open Source 2.4.7, 2.4.6-p5, 2.4.5-p7, 2.4.4-p8 and earlier.
- Class
- Improper restriction of XML external entity reference (CWE-611).
- Severity
- CVSS 3.1: 9.8 (Critical), Adobe's score as published by NVD. No authentication or user interaction required.
- Timeline
- Fixed 11 June 2024; first attacks 23 June (Sansec); added to CISA's Known Exploited Vulnerabilities catalogue 17 July 2024.
- Fix
- Upgrade or apply Adobe's isolated patch, then rotate the encryption key and invalidate the old one. Patching does not revoke a key that has already been stolen.
The root cause, in one sentence
Magento's REST API turned JSON from an unauthenticated request into PHP objects, and one object it could be made to build was an XML parser holding attacker-supplied XML, with parser options the attacker also chose.
XML lets a document declare entities in a document type definition, and an entity can point at a file or a URL. A parser configured to resolve them will dutifully fetch whatever the document names and, if the result appears anywhere the attacker can see — or can be sent back out over the network — the attacker can read it. Searchlight Cyber's analysis shows the twist in CosmicSting: the vulnerable endpoint was a JSON API. Nobody thought of it as accepting XML. The framework's automatic object construction carried the XML in.
We are not publishing an exploit request. Sansec's CosmicSting overview covers detection and the clean-up steps. This post is about the bug class and how to test for it safely.
The five places XML parsers hide
1. Endpoints that openly accept XML
SOAP services, XML-RPC and older integration APIs are the obvious candidates. Less obvious: JSON endpoints whose framework quietly accepts XML as well when the request's content type changes. Each one is a parser that needs its own configuration check.
2. File formats that are XML underneath
Word, Excel and PowerPoint documents are zipped XML. So are SVG images, and many import formats — feeds, map files, configuration exports. An upload or import feature that opens these files is an XML parser with a friendlier name.
3. Single sign-on messages
SAML assertions are XML, and they are parsed before the signature that protects them can be checked. A parser that resolves entities in that step exposes the login flow to anyone who can send a crafted message.
4. Objects built from input
CosmicSting's route. When a framework maps request data onto constructors and properties, the question is not only “what does this endpoint expect?” but “what can this endpoint be made to build?” If the answer includes a parser, the endpoint parses XML whether or not anyone intended it to.
5. Unsafe options reachable from outside
Most modern parsers are safer by default than they used to be, but loading external definitions or substituting entities can still be switched on with a flag. If code exposes those flags — or a caller can supply them, as in CosmicSting — the safe default no longer applies.
Patch, then change the locks. When a vulnerability can read files, assume it already has: anything in a readable configuration file — encryption keys, API tokens, database passwords — may be in someone else's hands. A patch closes the door; it does not take back the keys.
How we test for it
- Find every parser. We map endpoints that accept XML, JSON endpoints that also accept it, document and image uploads, imports and single sign-on flows.
- Confirm resolution without reading anything. A harmless entity that points to a canary on our own infrastructure, where agreed, shows whether the parser resolves external references — without touching a single file on your server.
- Avoid reading secrets. If file access must be demonstrated, we read an agreed, harmless file. We describe the realistic impact from what the parser could reach, rather than retrieving your real configuration.
- Check the configuration in code where we can. In a white-box test we confirm every parser disables document type definitions or external entities, including those inside libraries.
- Follow the impact. We note which secrets an attacker could have reached, so the remediation includes rotating them rather than stopping at the patch.
- Report the exact fix. The finding names the endpoint, the parser and the setting, with evidence and a regression check.
A file-read finding needs remediation that matches its impact. Our reporting approach shows how we make that clear without publishing dangerous material.
Six things to check in your application this week
- List every XML parser, including document and SVG uploads, imports, SAML and libraries that parse XML for you.
- Disable document type definitions or external entity resolution in each one; OWASP's XXE Prevention Cheat Sheet gives the settings per language.
- Check that JSON endpoints reject XML rather than quietly accepting it.
- If you run Adobe Commerce or Magento, confirm you are on a fixed version and that the encryption key was rotated after the patch, following Adobe's and Sansec's guidance.
- Keep secrets out of files the web application can read where your platform allows, and rotate any that a file-read flaw could have exposed.
- Monitor checkout pages and content blocks for unexpected script changes — the point where a stolen key turns into stolen cards.
XXE rarely announces itself. We look for the parsers your application did not mean to have, as well as the ones it did.
References
- Sansec — CosmicSting attack and defence overview
- Sansec — CosmicSting attacks have started hitting major stores
- Searchlight Cyber (Assetnote) — Why nested deserialization is harmful: Magento XXE (CVE-2024-34102)
- NVD — CVE-2024-34102 detail
- NVD — CVE-2024-2961 detail
- OWASP — XML External Entity Prevention Cheat Sheet
- OWASP — WSTG: Testing for XML injection