1. Block suspicious uploads at the CDN

Early security research points to PHP’s session upload progress feature and specially crafted multipart/form-data requests. PHP hasn’t confirmed this as the cause, but we can already reduce exposure.

If your CDN supports request body inspection, block multipart POST requests containing the field PHP_SESSION_UPLOAD_PROGRESS. That’s the default field PHP uses to activate upload progress tracking.

As an example, on Bunny, you can configure this through Shield custom WAF rules.

Alternatively, use CDN Edge Rules to block multipart POST requests outside known upload paths. This is less precise and must be tested against your actual site comprehensively. WordPress plugins may accept file uploads through contact forms, product customization, or custom API endpoints.

Before blocking anything, test your checkout, media uploads, and any customer forms that accept files. Also make sure attackers cannot bypass your CDN and reach the origin server directly – but that’s relevant independent of the PHP2Shell CVE.

2. Disable PHP upload progress tracking

PHP enables session upload progress by default. WordPress core doesn’t require this feature, although individual plugins might.

You can disable it in your PHP configuration:

session.upload_progress.enabled = Off

The easiest way is through your hosting panel. On PHP-FPM installations, you may also use .user.ini. Apache installations using mod_php can configure it through .htaccess.

Verify the setting through PHP running on your website, not the command line. A temporary PHP script calling ini_get('session.upload_progress.enabled') works. Remove that script after checking.

Disabling this feature should not stop normal file uploads. It only disables PHP’s session-based progress tracking.

Important: This addresses a suspected attack path. It is not a confirmed fix for both vulnerabilities.

3. Prepare for the patch

While waiting for your host, check three things:

  • Your store has a recent backup stored outside the web server, and you know it restores.
  • Unused administrator accounts and API credentials have been removed.
  • Your hosting provider plans to deploy the PHP security release.

Once the patch becomes available, update PHP as soon as your host provides it.

The CDN rules can remain useful afterward, provided they don’t interfere with legitimate uploads.

The important distinction is simple: these measures reduce your exposure. Only the PHP security fix addresses the underlying vulnerabilities.

This is also a good moment to check the PHP version on your server. Many sites are still running outdated PHP versions such as PHP 7.4 or even older. Make sure to upgrade.

Please spread the word and share this with your network.

Leave a Reply

Read the latest about AI in e-commerce

Every week, I share new tools, fresh perspectives, and merchant spotlights. Subscribe now. It’s free.

← Back

Thank you for signing up.

Now, please check your inbox and confirm your subscription by clicking the link in the email I just sent you.

Find more information about how your data will be processed in the privacy policy.

You connected AI to your store. Did your customers consent?

Check out my article for e-commerce merchants.

Discover more from Matthias Reinholz

Subscribe now to keep reading and get access to the full archive.

Continue reading