- Home
- Free patches
- CVE-2024-34102 (CosmicSting) Magento security patch
CVE-2024-34102 (CosmicSting) Magento security patch
Free Composer patch for CVE-2024-34102 (CosmicSting), the Magento XXE flaw, on releases Adobe never fixed. Tested on eight releases, 2.3.0 to 2.4.9.
- Updated
- Maintained by The Big Cart Energy team
Install with Composer
Run it from your Magento root as the file-system owner. Test it on staging first, with a backup you've restored at least once.
Before you install. This patch is free software under OSL-3.0 (opens in a new tab), with no support. Apart from the license's own warranty of provenance, it is provided "AS IS" and WITHOUT WARRANTY, express or implied, and the entire risk as to its quality is with you. It's tested only on the versions listed on this page. Try it on a staging store first and keep a backup you have restored. By installing it you accept our terms and the package's license. Not affiliated with Adobe.
The copy button and the repository link wait for this box.
composer require bigcartenergy/module-cosmicsting-patchThe source and every release live on GitHub: github.com/bigcartenergy/module-cosmicsting-patch
Then enable the module, register it and compile:
bin/magento module:enable BigCartEnergy_CosmicStingPatch
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:cleansetup:di:compile is needed in production mode and does no harm in developer mode. In production mode, setup:upgrade also empties the deployed static files unless you run it with --keep-generated. So either run bin/magento setup:static-content:deploy after the compile, as after any module install, or pass --keep-generated (the module ships no static content) and let setup:di:compile rebuild the generated code.
- It's a module, not a
.patchfile: nothing in the Magento source changes, and no patching tool is involved. - It adds no table, setting, menu item, cron job or storefront output, and it depends on no other Big Cart Energy package.
- The package is on Packagist, so Composer needs no extra repository.
- No Composer? Download the release archive from the repository: its link sits under the install command above and unlocks once you tick the box. The archive unpacks into one folder named after the repository and the release. Copy that folder's contents,
registration.phpincluded, toapp/code/BigCartEnergy/CosmicStingPatch, then run the samebin/magentocommands. - Not sure you need it? Check your release before it goes anywhere near production.
Check that it's working
bin/magento module:status BigCartEnergy_CosmicStingPatchIt prints "Module is enabled". From then on, each refusal writes one line to var/log/bigcartenergy_cve-2024-34102.log, after Magento's own timestamp: the UTC time, the client IP address, the request method and path, and the refused type. The request body is never logged.
If the file doesn't exist, nothing has been refused yet. That's the expected state for a store that never receives such a request, not a sign that the guard is off.
Already exposed? Patching doesn't rotate your keys
A fix acts on requests from the moment it's in place. It changes nothing that happened before. If your store has run an exposed release since the flaw went public on June 11, 2024, Adobe's guidance for this CVE is that merchants "must apply the VULN-27015 patch (dependent on your version) and rotate your encryption keys" (Adobe). We'd say the same to a store patched with this module:
- Rotate the store's encryption keys. Adobe's guidance on securing your store and rotating encryption keys covers the key.
- Review the admin users, integrations and API tokens.
- On 2.4.4 to 2.4.7, apply Adobe's isolated patch or the patch release of your line too, for the July 2024 hotfix this module doesn't contain.
The module does none of that for you. If you think the store has already been hit: Store hacked or down? Get help now.
Logging and IP addresses
Logging is on by default. IP addresses are personal data in the EU, so if your store has no basis to keep them, turn the log off from a small module of your own: the three files below. Magento merges every module's etc/di.xml in module load order, and the last value wins. This patch sets enableLog to true in its own etc/di.xml, so yours must load after it, which is what the <sequence> in your module.xml is for. Without that <sequence>, a module whose name sorts before BigCartEnergy loads first, loses the merge, and the log stays on with nothing to tell you. Don't put the override in Magento's app/etc/di.xml either: that file belongs to the magento/magento2-base package and is written over when that package updates.
app/code/Acme/PatchLogOff/registration.php (use your own vendor name in place of Acme):
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Acme_PatchLogOff',
__DIR__
);app/code/Acme/PatchLogOff/etc/module.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Acme_PatchLogOff">
<sequence>
<module name="BigCartEnergy_CosmicStingPatch"/>
</sequence>
</module>
</config>app/code/Acme/PatchLogOff/etc/di.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="BigCartEnergy\CosmicStingPatch\Plugin\Webapi\ServiceInputProcessorPlugin">
<arguments>
<argument name="enableLog" xsi:type="boolean">false</argument>
</arguments>
</type>
</config>Then run bin/magento module:enable Acme_PatchLogOff, bin/magento setup:upgrade, bin/magento setup:di:compile and bin/magento cache:clean; the static-content note at the top of this tab applies here too. Running both of our patches? One module can switch both logs off: list both patch modules in the <sequence> and both plugin types in the di.xml.
Confirm it took. bin/magento module:status lists the enabled modules in load order, and Acme_PatchLogOff must come after BigCartEnergy_CosmicStingPatch; if it comes before, the <sequence> is missing or misspelled and the log is still on. Nothing exposes the switch directly, so the check that settles it is the file: run your store's own API traffic on a staging copy and confirm var/log/bigcartenergy_cve-2024-34102.log gains no line.
The guard works the same with the log off.
How to remove the patch
Same rules as the install: a staging copy first, with a backup.
bin/magento module:disable BigCartEnergy_CosmicStingPatch
composer remove bigcartenergy/module-cosmicsting-patch
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:cleanIn production mode, the static-content note at the top of this tab applies to this setup:upgrade too. Nothing is left behind except the log file, which you can delete.
Am I affected?
Read your release from the Magento root:
bin/magento --versionIt prints a line such as Magento CLI 2.4.3-p3. A patch file applied on top of a release doesn't change that line, so if someone may have applied Adobe's isolated patch by hand, ask whoever deploys the store. Our guide to checking your version and patch level covers the other places to look. Then find your row. We read Adobe's fix in the Magento Open Source code of every release below, so the table says what the code says.
| Your Magento Open Source release | Adobe's fix | This module |
|---|---|---|
| 2.3.0 to 2.3.7-p4 | None | Yes |
| 2.4.0 to 2.4.3-p3 | None | Yes |
| 2.4.4 to 2.4.4-p8, 2.4.5 to 2.4.5-p7, 2.4.6 to 2.4.6-p5, 2.4.7 | Adobe's isolated patch VULN-27015, or the patch release of your line in the next row | Yes, if you've applied neither, as the stopgap until you do: both of Adobe's fixes also carry the July 2024 hotfix in the note below, which this module doesn't |
| 2.4.4-p9 and later, 2.4.5-p8 and later, 2.4.6-p6 and later, 2.4.7-p1 and later, 2.4.8, 2.4.9 | Included | Not needed. Installed anyway, it's redundant: core refuses the same types a moment later |
"Yes" means the release needs a fix, not that we tested the module on it: the tested releases are under How we tested it. Installed next to Adobe's fix, the module stays out of the way. On our 2.4.8 and 2.4.9 test installs, whose core already has the fix, every flow we tested returned the same response with and without the module; where the module refused a request first, it only added its log line.
The note on 2.4.4 to 2.4.7. Adobe followed the June 2024 fix with a hotfix on July 17, 2024 (AC-12485), which its 2.4.4 patch notes describe as resolving "a JSON web token (JWT) validation issue related to CVE-2024-34102". Adobe's isolated patch contains that hotfix, and so do the patch releases that followed it: 2.4.4-p10 is the first of its line to list it. Stores already on the June releases (2.4.4-p9, 2.4.5-p8, 2.4.6-p6 and 2.4.7-p1) don't need this module, but Adobe's notes ask them to apply the hotfix. This module doesn't contain it: it closes the input-processor hole only. On 2.4.4 to 2.4.7, Adobe's isolated patch or the patch release of your line is the complete fix, and this module is the stopgap until you apply one. Magento's JSON web tokens for the Web API arrived in 2.4.4 (the magento/module-jwt-user-token package is first required by 2.4.4), so on 2.3.0 to 2.4.3 the hotfix has no counterpart, and this module is the whole of what we can offer for the vulnerability there.
Mage-OS ships the same Web API code as the Magento Open Source release it's based on, so that release's row applies to it. We haven't tested this version of the module on Mage-OS.
What CosmicSting is, and how the patch works
CosmicSting (CVE-2024-34102) is an XML external entity (XXE) flaw in the Magento Web API. Adobe scores it 9.8 out of 10 (CVSS 3.1): an attacker needs no login and no user interaction, and Adobe says it could lead to arbitrary code execution. Adobe fixed it for supported releases in bulletin APSB24-40 on June 11, 2024.
The flaw lives in Magento\Framework\Webapi\ServiceInputProcessor, the class that turns a REST or SOAP request body into the objects a service method expects: it accepted PHP's XML classes as types to build from request data. Adobe's fix makes it refuse subclasses of SimpleXMLElement and DOMElement with the error "Invalid data type".
The module is one before plugin on convertValue(), the processor's one public entry point, which the processor also passes through for every nested value. It refuses a conversion to either XML class, the class itself as well as any subclass, directly or as an array item type, with Adobe's own message, so monitoring that matches the official fix keeps working. One value the processor builds without that entry point is an object-typed custom attribute. For those, the module resolves the attribute's type the way the processor does (the entity type of the owning object, then Magento's custom attribute type locator) and refuses it the same way when it's an XML class. Simple types and mixed are never checked, every other request is untouched, and no core file is edited.
On 2.3.0, install the SessionReaper patch alongside it. That release converts a service method's own parameters and setter values, where this guard refuses the XML classes, but copies nested constructor data without converting it. That data never reaches an XML class on 2.3.0, with or without this module, and the SessionReaper patch removes the keys on that path that fail Adobe's allow-list. Together the two cover both paths.
How we tested it
On every release below we ran the same checks, with the module alone and alongside the SessionReaper patch:
- install and
setup:di:compile - guest checkout over REST to a placed order, customer sign-up, product search with filters and sort orders, and admin product saves with custom and extension attributes, Magento's own object-typed custom attribute included
- one SOAP call with search criteria
- the guard refusing an XML-typed parameter on a test fixture, single and as a list, with its log line
- object-typed custom attributes on a test fixture: one of a non-XML type passing untouched, and an XML-typed one refused with "Invalid data type" on every release
- removal, then REST again
Every legitimate flow returned the same results with the module as without it on every release. On the releases that already carry Adobe's fix, the refusal was identical too: the module answered first, with the same message, and added its log line. The unit suite passes on PHPUnit 6.5, 9, 10 and 12.
| Release | PHP | Database | On this release |
|---|---|---|---|
| Magento Open Source 2.4.9 | 8.5 | MySQL 8.4 | Adobe's fix is in core; the module is redundant |
| Magento Open Source 2.4.8 | 8.3 | MySQL 8.4 | Adobe's fix is in core; the module is redundant |
| Magento Open Source 2.4.7 | 8.2 | MySQL 8.0 | The module is the only guard |
| Magento Open Source 2.4.6 | 8.1 | MySQL 8.0 | The module is the only guard |
| Magento Open Source 2.4.3-p3 | 7.4 | MySQL 8.0 | The module is the only guard |
| Magento Open Source 2.3.7-p4 | 7.4 | MySQL 5.7 | The module is the only guard |
| Magento Open Source 2.3.5-p2 | 7.3 | MySQL 5.7 | The module is the only guard |
| Magento Open Source 2.3.0 | 7.2 | MySQL 5.7 | The module is the only guard; see the 2.3.0 note above |
We installed 2.3.0 and 2.3.5-p2 from Adobe's public release tags rather than as Composer projects, because the public package mirror serves no 2.3 release before 2.3.7-p2; the code under test is each release's own. A release that isn't in this table hasn't been tested, and we haven't tested this version of the module on Mage-OS. The Tested versions tab carries the same list.
Patch or upgrade?
A patch is not an upgrade. This module closes one hole in a release that Adobe no longer patches; it doesn't fix the others, and it never will. The lasting fix is a supported release of Magento Open Source, and our Magento end-of-life guide has Adobe's support dates. Install the module, then plan the upgrade. Stuck on an old version? We'll patch you now and upgrade you when you're ready.
Want it done for you? It's part of our Magento development work. We install the patch on your staging copy first, run your checkout and integrations through it and read the guard's log before it goes to production. On 2.4.4 to 2.4.7, we apply Adobe's isolated patch or your line's patch release as well. If the store ran exposed, we rotate the keys and review the admin users, integrations and tokens with you, then scope the upgrade. Like every engagement, it's scoped in writing, and we don't publish prices; how an engagement runs covers the rest. Talk shop and tell us your release, how you deploy and what talks to your API.
Tested versions
| Magento | Status | What to do |
|---|---|---|
| 2.4.9 | Fixed in core | Harmless if installed. |
| 2.4.8 | Fixed in core | Harmless if installed. |
| 2.4.7 | Patched with this package installed | Install this package. |
| 2.4.6 | Patched with this package installed | Install this package. |
| 2.4.3-p3 | Patched with this package installed | Install this package. |
| 2.3.7-p4 | Patched with this package installed | Install this package. |
| 2.3.5-p2 | Patched with this package installed | Install this package. |
| 2.3.0 | Patched with this package installed | Install this package. |
We list only the exact releases we installed this package on and tested. If your version isn't here, we haven't tested it. Running a fork or heavy customizations? Ask us to check before you install.
FAQ
Am I affected by CVE-2024-34102?
Yes, if your store runs Magento Open Source 2.3.0 to 2.3.7-p4 or 2.4.0 to 2.4.3-p3, which Adobe never fixed, or 2.4.4 to 2.4.4-p8, 2.4.5 to 2.4.5-p7, 2.4.6 to 2.4.6-p5 or 2.4.7 without Adobe's isolated patch. 2.4.4-p9, 2.4.5-p8, 2.4.6-p6 and 2.4.7-p1, the June 2024 releases, and every later release include the fix and don't need the module; on the June releases themselves, Adobe also asks for its July 17, 2024 hotfix. Run bin/magento --version from the Magento root to read your release; Mage-OS follows the Magento Open Source release it's based on. We've tested the module on eight Magento Open Source releases, listed under Tested versions. No Mage-OS or Adobe Commerce release is among them. Treat any other release as untested.
Is CVE-2024-34102 being exploited?
Yes. CISA added CVE-2024-34102 to its Known Exploited Vulnerabilities catalog on July 17, 2024, and Adobe's release notes say it "has been exploited in the wild in very limited attacks targeting Adobe Commerce merchants." Adobe scores it 9.8 out of 10 (CVSS 3.1): an attacker needs no login and no user interaction.
Does this replace Adobe's official patch?
No, and it isn't Adobe's. It applies the input refusal Adobe shipped on June 11, 2024 to releases that never got it, and it also refuses the two XML classes themselves. Adobe followed that fix with a hotfix on July 17, 2024 for a JSON web token validation issue related to the same CVE. Adobe's isolated patch for 2.4.4 to 2.4.7 contains it, and so do the patch releases that followed; this module doesn't. On those lines, Adobe's isolated patch or a later patch release is the complete fix, and the module is the stopgap until you apply one. Magento's JSON web tokens for the Web API arrived in 2.4.4, so on 2.3.0 to 2.4.3 the hotfix has no counterpart, and the module is the whole of what we can offer there.
Do I still need to rotate my encryption keys?
If your store has run an exposed release since June 11, 2024, yes. Adobe's guidance for this CVE is that merchants "must apply the VULN-27015 patch (dependent on your version) and rotate your encryption keys," and we'd say the same to a store patched with this module. Review the admin users, integrations and API tokens as well, and on 2.4.4 to 2.4.7 apply Adobe's isolated patch or your line's patch release too, for the July 2024 hotfix the module doesn't contain. The module does none of that: it acts on requests from the moment it's installed and changes nothing that came before.
Will it break checkout or my integrations?
Not in anything we tested. It acts at one point, where Magento turns a REST or SOAP request into objects, and there it refuses only PHP's two XML classes and their subclasses, whether they arrive as a parameter or as an object-typed custom attribute; every other request passes untouched. On every release we tested, guest checkout to a placed order, customer sign-up, product search, product saves with custom and extension attributes (Magento's own object-typed custom attribute included) and a SOAP call ran the same with and without it. Your extensions are the part we haven't seen, so install it on a staging copy first, with a backup you've restored, run your integrations and read var/log/bigcartenergy_cve-2024-34102.log. Removing it takes one composer remove and the usual setup commands.
Do I need the SessionReaper patch too?
If your release lacks Adobe's SessionReaper fix, yes. CVE-2025-54236 is a separate flaw in the same part of Magento, with its own package. Adobe's fix for it is in 2.4.6-p13, 2.4.7-p8, 2.4.8-p3, 2.4.9 and later releases of those lines, and no Magento Open Source patch release of 2.4.5 or older carries it. The two packages install side by side, run in a fixed order and don't interfere. On 2.3.0, install both: that release builds nested API data differently, and the two together cover both paths.
Has the patch been security-reviewed?
Yes. Before release, a review separate from the build looked specifically for ways past each guard, over both the REST and SOAP APIs and with the patches alone and together, checked the package itself, and approved this version only after every blocking issue it found was fixed.
Changelog
| Date | What changed |
|---|---|
| First published. |
Release notes and the diff for every version of the package are on its GitHub releases page. The repository link on the Install tab unlocks once you tick the box.
Stuck on an old version?
We'll patch you now and upgrade you when you're ready.