Sansec logo

Compromised certificate authority

Sansec

by Sansec

Published in Guides

eComscan found CA bundle files on your server that still trust the compromised eMudhra certificate authority. With such a bundle, PHP accepts a forged HTTPS certificate for Stripe, Mollie or any other API your store calls.

The risk is in the connections your store makes, so Sansec Shield cannot block it: Shield checks the requests that come in. Fix the flagged files below.

If you are a merchant, forward this page to your developer or hosting provider.

Fix per flagged file

The alert lists each flagged file by its path. Fix every file in that list. The system bundle and the bundles in your store code are separate files: updating one leaves the others vulnerable.

Flagged fileFix
/etc/ssl/certs/ca-certificates.crt, /etc/pki/tls/certs/ca-bundle.crt or another file under /etcUpdate the system bundle as root
vendor/composer/ca-bundle/res/cacert.pemRun composer update composer/ca-bundle (fixed in 1.4.16 and 1.6.0)
wp-includes/certificates/ca-bundle.crtWordPress has no fixed release yet. Replace the file
vendor/stripe/stripe-php/data/ca-certificates.crtRun composer update stripe/stripe-php (fixed in 7.128.1, 8.12.1, 9.9.1, 10.21.1, 11.0.1, 12.8.1, 13.18.1, 14.10.1, 15.10.1, 16.6.1, 17.6.1, 18.2.1, 19.4.2, 20.3.2, 21.3.3 and 22.0.1). Version 6 and older have no fix: upgrade to version 7 or later
vendor/Google/IO/cacerts.pem inside an extension, such as app/code/Anowave/Ec/vendor/Google/IO/cacerts.pemA copy of the Google API PHP client 1.x, which gets no more releases. Replace the file. You do not need to upgrade the extension
Any other fileReplace the file. This fixes the alert without a new release. Upgrade the extension, plugin or library later, when it ships a fixed bundle

Many extensions and libraries ship their own bundle, such as Unirgy's Magento extensions (Unirgy/SimpleLicense/ssl/cacert.pem), Wordfence (wf-waf/src/cacert.pem) and UpdraftPlus (includes/cacert.pem). In UpdraftPlus, you can instead tick "Use the server's SSL certificates" in its settings.

Guzzle 3, the Google API PHP client 1.x and Sentry Raven 1.x get no more releases. Upgrade to a current major version, or replace their bundle file.

Once you have fixed every listed file, eComscan reports the alert as fixed.

System bundle

As root, update the ca-certificates package:

# Debian and Ubuntu
apt-get update && apt-get install --only-upgrade ca-certificates

# Alpine Linux
apk upgrade ca-certificates

# Fedora, RHEL 8 to 10, Rocky Linux, AlmaLinux and Oracle Linux
dnf upgrade ca-certificates

# Arch Linux
pacman -Syu

The fixed Amazon Linux 2023 package (ALAS2023-2026-3306) removes emSign ECC Root CA - G3 but still trusts the Comodo AAA Services root, which cross-signed six of the eight intermediates. On Amazon Linux 2023, run this as root to update and then distrust that root:

dnf update ca-certificates --releasever 2023.12.20261026
d=/etc/pki/ca-trust/source/blocklist; [ -d $d ] || d=/etc/pki/ca-trust/source/blacklist
trust extract --overwrite --format=pem-bundle \
  --filter='pkcs11:object=Comodo%20AAA%20Services%20root;type=cert' \
  $d/Comodo_AAA_Services_root.pem &&
update-ca-trust

RHEL 7 has no fixed package. On RHEL 7, run this as root:

d=/etc/pki/ca-trust/source/blocklist; [ -d $d ] || d=/etc/pki/ca-trust/source/blacklist
trust extract --overwrite --format=pem-bundle \
  --filter='pkcs11:object=Comodo%20AAA%20Services%20root;type=cert' \
  $d/Comodo_AAA_Services_root.pem &&
trust extract --overwrite --format=pem-bundle \
  --filter='pkcs11:object=emSign%20ECC%20Root%20CA%20-%20G3;type=cert' \
  $d/emSign_ECC_Root_CA_-_G3.pem &&
update-ca-trust

Your server then rejects every certificate issued under the Comodo AAA Services root and emSign ECC Root CA - G3. The fixed packages for the other distributions remove or distrust the same roots.

Replacing a bundle file

Overwrite the flagged file with the current Mozilla bundle from curl.se. In your store root, run this for each path in the alert:

curl -o wp-includes/certificates/ca-bundle.crt https://curl.se/ca/cacert.pem

A WordPress update, composer install or a new deploy puts the vendor's copy back. eComscan then alerts again. Repeat this step after each of those, or add it to your deploy script, until the vendor ships a fixed bundle.

On Adobe Commerce Cloud, Platform.sh and other hosts with a read-only file system, you cannot change files on the server. Replace the file in your project repository and commit it. For a file under vendor/, which the build reinstalls with composer install, add the curl command to your build hook instead.

Wordfence and similar plugins report the replaced ca-bundle.crt as a modified WordPress core file.

Testing a fix

Test each file from the alert against the certificate chains from the disclosure site. Set f to the full path of the flagged file:

f=/path/to/your/store/vendor/composer/ca-bundle/res/cacert.pem
cd /tmp && curl -sO https://emudhra.we-have-a-problem.com/chains.zip && unzip -oq chains.zip
for c in chains/dv-g3b-emudhra.we-have-a-problem.com.pem chains/dv-g3b-aaa-emudhra.we-have-a-problem.com.pem; do
  openssl verify -CAfile "$f" -untrusted $c $c
done

If OpenSSL prints OK for either chain, the file still trusts the compromised intermediates. If OpenSSL prints an error for both chains, the file is fixed.

The commands below test the system bundle only, which curl and PHP use by default. They can pass while a bundle file in your store code still fails the test above.

curl -sS -o /dev/null https://dv-g3b-emudhra.we-have-a-problem.com/ && echo VULNERABLE
curl -sS -o /dev/null https://dv-g3b-aaa-emudhra.we-have-a-problem.com/ && echo VULNERABLE
php -r 'echo @file_get_contents("https://dv-g3b-emudhra.we-have-a-problem.com/") === false ? "OK\n" : "VULNERABLE\n";'

More information

Need expert advice? We are here to help!

Stay up to date with the latest eCommerce attacks

Sansec logo

experts in eCommerce security

Terms & Conditions
•
Privacy & Cookie Policy