How to Deal with the CosmicSting Vulnerability (CVE-2024-34102) on Hypernode

CosmicSting (CVE-2024-34102, CVSS 9.8) is a critical vulnerability in Magento and Adobe Commerce 2.4.7 and earlier that lets attackers read any file on the server, including the encryption key in app/etc/env.php. Adobe released a fix on 11 June 2024. Shops that were not patched early should assume their keys were stolen.

For more information, see the CosmicSting attack and defense overview by Sansec.

What Hypernode Does

Requests that match the CosmicSting attack are written to /var/log/nginx/CVE-2024-34102.log. Attempts in your logs are normal, and do not mean that a patched shop with a rotated key was compromised.

What You Should Do

  1. Upgrade Magento to the latest version, or install Adobe’s isolated patch. See How to Apply Magento Patches.

  2. Rotate the encryption key, because patching alone is not enough:

    bin/magento encryption:key:change
    

    Rotating the key re-encrypts stored data, so plan a maintenance window.

  3. Remove the old key from crypt/key in app/etc/env.php, reset all admin passwords and delete integrations you do not recognize.

  4. Check your CMS blocks for JavaScript that you did not add.

Scan Your Shop with Sansec

Manual checks do not always find all malware. A scan with Sansec eComscan helps you find malware, backdoors, and known vulnerabilities in your shop. eComscan comes preinstalled on every Hypernode. To start a scan, run the following command:

ecomscan /data/web/magento2

If your shop lives in a different folder, change the path accordingly. See How to Set Up Sansec eComscan on Hypernode for more information.

If You Find Signs of Compromise

Rotate the Magento encryption key and every credential that the key protected, such as admin passwords, API and integration tokens, payment gateway credentials, database credentials, SSH and deploy keys, and the secrets in app/etc/env.php. Rotate these at the source, not only inside Magento. See How to Recover a Hacked Magento Shop for the general recovery steps.

Note

Hypernode does not clean up malware on customer shops. Your developer or a security partner has to do this.