This combination of an Arbitrary File Read (CVE-2024-34102) and a Buffer Overflow in glibc (CVE-2024-2961) allows for unauthenticated Remote Code Execution on the following versions of Magento and Adobe Commerce and earlier if the PHP and glibc versions are also vulnerable: - 2.4.7 and earlier - 2.4.6-p5 and earlier - 2.4.5-p7 and earlier - 2.4.4-p8 and earlier Vulnerable PHP versions: - From PHP 7.0.0 (2015) to 8.3.7 (2024) Vulnerable iconv() function in the GNU C Library: - 2.39 and earlier The exploit chain is quite interesting and for more detailed information check out the references. The tl;dr being: CVE-2024-34102 is an XML External Entity vulnerability leveraging PHP filters to read arbitrary files from the target system. The exploit chain uses this to read /proc/self/maps, providing the address of PHP's heap and the libc's filename. The libc is then downloaded, and the offsets of libc_malloc, libc_system and libc_realloc are extracted, and made use of later in the chain. With this information and expert knowledge of PHP's heap (chunks, free lists, buckets, bucket brigades), CVE-2024-2961 can be exploited. A long chain of PHP filters is constructed and sent in the same way the XXE is exploited, building a payload in memory and using the buffer overflow to execute it, resulting in an unauthenticated RCE.
Vulnerability
CVE-2024-34102
XXE can expose crypt key and other secrets granting full admin access
Vulnerability details
- Score
- 9.8
- Severity
- critical
CVSS 3.1 · adobe
Vector string
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HDescription
Adobe Commerce versions 2.4.7, 2.4.6-p5, 2.4.5-p7, 2.4.4-p8 and earlier are affected by an Improper Restriction of XML External Entity Reference ('XXE') vulnerability that could result in arbitrary code execution. An attacker could exploit this vulnerability by sending a crafted XML document that references external entities. Exploitation of this issue does not require user interaction.
CVE ProgramExploit source choices
15 sourcesCosmicSting (CVE-2024-34102)
POC for CVE-2024-34102. A pre-authentication XML entity injection issue in Magento / Adobe Commerce.
CVE-2024-50603: Aviatrix Controller Unauthenticated Command Injection
CVE-2024-34102: Unauthenticated Magento XXE
CosmicSting: critical unauthenticated XXE vulnerability in Adobe Commerce and Magento (CVE-2024-34102)
Exploitation CVE-2024-34102
Adobe Commerce XXE exploit
CVE-2024-34102 (Magento XXE)
CVE-2024-34102 exploit for python3
Exploiter a Vulnerability detection and Exploitation tool for GeoServer Unauthenticated Remote Code Execution CVE-2024-36401.
An alternative solution(as a Magento 2 extension) to fix the XXE vulnerability CVE-2024-34102(aka Cosmic Sting). If you cannot upgrade Magento or cannot apply the official patch, try this one.
Free security patch for Magento Open Source and Mage-OS by Big Cart Energy: closes CVE-2024-34102 (CosmicSting) on the Magento 2.3 and 2.4 releases that have no official fix, as one plugin on the Web API input processor that applies the rule of Adobe's fix. No core file is modified.
bka/magento-cve-2024-34102-exploit-cosmicstring source repository
A PoC demonstration , critical XML entity injection vulnerability in Magento