AZSecureby Azguards Technolabs

Exploited vulnerabilities · Magento

CosmicSting (CVE-2024-34102)

Anyone can make an unpatched Magento store hand over its env.php file, encryption key included, through the REST API. No login needed.

Actively exploited (CISA KEV)CVE-2024-34102CVSS 9.8 (critical)

Free website scan

Is your store serving malware right now?

Checks home, product, cart and checkout pages, blocklists, exposed files and spam shown only to Google. Takes about a minute.

How CosmicSting works

Magento's REST API accepted XML that could point to files on the server. By sending a crafted request, an attacker could get the store to read a file and return its contents. The usual target was app/etc/env.php, which holds the database password and the encryption key.

The encryption key is the valuable part. With it, attackers can mint their own admin API tokens and edit the store through the API, and that is how most CosmicSting victims ended up with a card skimmer on checkout. On servers that also ran a vulnerable glibc (CVE-2024-2961), the same flaw could be pushed further, to running code.

Adobe fixed it in bulletin APSB24-40 in June 2024. Within weeks it was being exploited at scale: Sansec counted more than 4,000 stores hacked through it by seven different groups. CISA added it to its list of known exploited vulnerabilities in July 2024.

What attackers do with it

  • A copy of env.php, with your database credentials and encryption key.
  • Admin API access, used to plant skimmers in CMS blocks, store configuration or layout updates.
  • Code execution on servers that also run a vulnerable glibc.

Signs of a CosmicSting compromise

  • <script> tags you didn't add in CMS blocks, CMS pages or design configuration (core_config_data). Look at anything that loads on checkout first.
  • Integrations or admin API tokens nobody on your team created.
  • POST requests to /rest/ endpoints with XML bodies that declare external entities. Your access logs will show them if you kept logs from mid-2024.

How to fix CosmicSting

  1. Install a fixed release on every store, or Adobe's isolated patch for CVE-2024-34102 if you can't upgrade yet.
  2. Rotate the encryption key, and don't skip this step. The patch closes the hole, but a key stolen before you patched still works.
  3. Change the database password and any third-party API keys kept in env.php or the admin configuration.
  4. Go through CMS blocks, pages, configuration and layout updates for injected scripts, and delete integrations you don't recognise.

Check if your Magento site is exposed

From outside, we can't see your exact patch level. What the free scan does check is the result attackers were after: skimmer scripts and known malicious domains on your storefront and checkout. A deep scan reads the installed Magento version, compares it with APSB24-40 and searches the database for injected scripts.

Patched late, or not sure when?

A deep scan checks your installed version against this advisory and looks for what attackers leave behind, with read-only access. An Azguards engineer signs off the report.

Common questions about CosmicSting

I patched CosmicSting. Am I safe?

Only if nobody took the encryption key before you patched. If you patched late, or you're not sure when, rotate the key and check the store for injected scripts.

Does an attacker need an admin account?

No. Anyone who can reach your REST API can try it, and the REST API is public on almost every Magento store.

Which versions fix CosmicSting?

2.4.7-p1, 2.4.6-p6, 2.4.5-p8 and 2.4.4-p9, plus every release after them. Adobe also published an isolated patch for stores that can't upgrade straight away.

Sources

Reviewed by Yash, Azguards security team. Last updated 9 Nov 2026.