New phpAfterShell Attack Bypasses PHP2Shell Fix to Enable Remote Code Execution

Blog WriterCybersecurity News - Original News Source is cybersecuritynews.com


A new PHP attack dubbed phpAfterShell can lead to unauthenticated remote code execution on vulnerable servers, even if they have the October patches for PHP2Shell.

Researchers at depthfirst disclosed the flaw on November 19 and demonstrated how it could be combined with a separate bug in PHP to run code remotely. The vulnerability, tracked as CVE-2026-126714, has a CVSS v4.0 score of 9.2.

The flaw sits in PHP’s default file-based session handler. Sessions let web applications remember a user’s login status, shopping cart, or other details between requests.

When upload progress is enabled, PHP can open and update a session file while it is still reading an upload request. That work can happen before the application starts running, so a login check in the application does not prevent PHP from reaching the affected code.

If a session update is interrupted, PHP can leave behind a file that contains a mix of old and new data. The application may later accept that file as valid when it calls session_start().

The risk goes beyond incorrect session values. PHP can also rebuild objects from the stored data, a process known as deserialization. The October fix did not address what happens when an interrupted write leaves a session file in this state.

As Cyber Security News reported in its coverage of the November PHP security updates, CISA added two flaws from the earlier PHP2Shell disclosures to its Known Exploited Vulnerabilities catalog.

That listing applies to the October flaws, not phpAfterShell. Depthfirst’s disclosure documents a research demonstration of the new attack, not evidence that attackers have used it in the wild.

PHP2Shell Bypasses PHP2Shell

The October patch restricted which objects PHP could rebuild during upload-progress processing. In Depthfirst’s technical analysis, the new attack takes a different path.

PHP accepts the damaged session file when the application opens the session later, outside the upload-progress step covered by the earlier fix. The researchers combined that behavior with a memory corruption flaw in a built-in PHP class to achieve remote code execution.

Code would run with the permissions of the PHP worker, not necessarily with full control of the server. Those permissions can still give an attacker access to credentials, application files, or customer records that the worker can read or change.

According to depthfirst’s advisory, applications that store sessions in Redis or a database instead of using PHP’s file handler are not affected by this specific flaw.

The fixed releases are PHP 8.2.36, 8.3.37, 8.4.28, and 8.5.13. The October PHP2Shell updates do not include this fix. The original PHP 8 release introduced features such as named arguments and union types, but PHP 8.0 and 8.1 are now out of support. Teams still running either branch should move to a supported release.

If an upgrade must wait, depthfirst recommends setting session.upload_progress.enabled = 0 in the web service’s php.ini and restarting the PHP workers.

This blocks the upload-progress route described by the researchers but does not repair the session handler. After patching, verify the version serving web requests rather than checking only the command-line binary. For container deployments, rebuild and redeploy the application image.

If a Linux distribution supplies PHP, check its advisory for the patched package, since its version number may differ from the upstream release

What Are Leading Organizations Doing About AI and Cyber Risks? Find Out. View Details!

The post New phpAfterShell Attack Bypasses PHP2Shell Fix to Enable Remote Code Execution appeared first on Cyber Security News.