PHP2Shell: how the vulnerabilities work and when to update PHP

PHP2Shell is the name given to two critical vulnerabilities in the PHP engine. Under exploitable conditions, they can allow code execution on the server and disclosure of sensitive process memory, including without authentication. Protecting a website requires patching the runtime that handles its requests and verifying that the updated processes are actually running.

Original editorial diagram 01 / QUESTION 02 / EVIDENCE 03 / DECISION
↗ Original diagram No simulated results presented as evidence
In this guide ⌄

The disclosure on 21 October 2026 prompted me to inspect the server where I manage multiple websites. On 22 October, I applied the patches while keeping the existing PHP branches and checked the results. This guide explains the technical problem, when action is needed, and the detail that would have left the real-world update incomplete. Sources and version information were checked on 22 October 2026.

2 November update: what the AgID survey measures

2 November 2026 update to the PHP2Shell guide: fewer publicly reported PHP versions do not equal a count of servers confirmed to be patched.

This note supplements the existing guide. It preserves the vulnerability explanations, mitigations and historical 22 October case; it is not a new audit of my server.

What the new survey measures

In its 30 October report , CERT-AGID describes a passive 29 October check of 22,371 Italian IPA URLs: 382 advertised potentially vulnerable versions, versus 650 initially. Of the originally flagged URLs, 215 now advertised an updated version.

The decline also includes hidden versions and unreachable addresses. The agency calls for server-side confirmation, including backports. These figures concern the examined list, not every Italian website or my own servers.

Use the observation without overstating assurance

An external observation can support a question to a hosting provider. To close a remediation task, I would propose a small evidence record separating the stages of the work.

Stage Evidence to collect Decision supported
Initial report Domain and dated observation Identify the service to examine
Remediation Full package identifier and advisory Connect the build to the claimed fix
Activation Assigned runtime and relevant processes Establish which build serves requests
Verification Results and scope limitations Document closure within the checked scope

This table is an operational proposal, not a report of new customer-site tests.

An example request to a provider

ILLUSTRATIVE SCENARIO

Illustrative scenario: an unchanged version number

A hosting panel still displays an older short version number. Before concluding that a fix is missing, I would ask for the full package name and the vendor reference documenting its patches.

I would then ask which runtime the domain uses and what evidence confirms that the active service uses the stated build. A panel screenshot alone would not close the task. Credentials and confidential details should not be included in a public explanation.

This generic example neither identifies a hosting company nor certifies a customer’s protection.

Integrate verification into the workflow

  1. 1

    Connect the report to the actual service being managed.

  2. 2

    Obtain the provider’s statement identifying the build.

  3. 3

    Compare the evidence with the relevant advisory.

  4. 4

    Check the runtime assigned to the site, not just an interpreter installed on the host.

  5. 5

    Record activation of the corrected processes and authorised verification results.

  6. 6

    Preserve the date, scope and limitations before closing the task.

The repository linked by the agency is technical material to review, rather than a command to run indiscriminately. The agency notes functions that change configurations and restart services. I have not executed those scripts or changed infrastructure during this editorial work.

Before closing the check

CHECKLIST

Check your project

0/6

For work with Row Tech , the starting point is an auditable path from the initial report to the intervention, with evidence kept within the authorised scope.

28 October update: a separate third vulnerability

The PHP Security Team’s 23 October notice describes a further issue, CVE-2026-115560 . The 21 October patches for the original pair do not fix this condition: the version table below applies only to CVE-2026-109618 and CVE-2026-109619.

The documented path requires all of the following: session.serialize_handler initially set to php_binary or php_serialize ; a runtime switch to php with ini_set() before session_start() ; and session upload-progress tracking still enabled. Merely using PHP sessions does not establish this exposure.

Pending the regular fix, PHP suggests session.upload_progress.enabled=0 . Keep the mitigation in place if already applied. CERT-AGID highlights checking the serving configuration and restarting the affected processes. First assess the impact on upload-progress features. Checking only CLI PHP or an HTTP banner is insufficient.

Act if the path is applicable and unmitigated. Do not repeat the same change if the disabled setting is already verified on the relevant web processes. PHP also states that applications which never change the serializer at runtime can keep the feature enabled with respect to this specific path; updates for the original pair remain necessary.

The 25 October CSIRT recommendation, republished by CSIRT Toscana , reiterates patching, mitigation and verification. I do not transfer the original pair’s severity score to this third CVE or invent a fixed release absent from the notice consulted.

The server case below remains dated 22 October: it does not establish an assessment of this new condition. This is a documentation update, without new server checks or changes.

What PHP2Shell is and why your website may be affected

The identifiers are CVE-2026-109618 and CVE-2026-109619 . They concern internal memory management and the lifecycle of requests in PHP: the component that executes application code.

OpenAI’s account describes AI-assisted research and coordination with maintainers and partners. This matters: discovering a flaw, fixing it and distributing the fix are separate steps, each with its own responsibilities and checks.

For a website operator, the practical question is which component needs updating. WordPress, a plugin or a framework may be running on a vulnerable PHP installation. Updating the CMS does not establish that PHP, often managed by the hosting provider, has also been updated.

The PHP Foundation places the problem in central parts of the language and explains the work needed to fix it while preserving ecosystem compatibility. This is a security update to prioritize, rather than a reason to abandon PHP.

How an HTTP request can become a memory-safety problem

A browser sends a request, the web server routes it to the runtime, and PHP prepares the required data, runs the application and finishes processing. Some preparation happens before website code runs. Temporary structures must be cleaned up correctly at the end.

With PHP-FPM, a worker is a process that can handle multiple requests in succession. Memory belonging to one request must not continue to be treated as valid by the next. Pool settings and process reuse are described in the FPM manual .

Reaching memory_limit does not mean exhausting the server’s RAM

A configured PHP limit can stop a request even when the machine still has available memory. As an illustrative example, imagine a 128 MB limit for an operation: exceeding it does not require consuming all physical RAM.

Calif’s research also shows why the size of an incoming request and the size of the structures created in memory are different quantities. Compact input can require more memory when interpreted. For defenders, the relevant point is that an upload-size limit alone does not establish that the runtime is safe.

The problem is not that PHP limits memory usage. It is what happens to internal state when an error interrupts an operation at the wrong moment.

CVE-2026-109618: an error interrupts a partially initialized structure

The PHP advisory on OOM corruption describes an interruption during memory-error handling. A structure can already be visible to cleanup routines without being fully initialized. Request shutdown may then treat incomplete data as valid.

OOM means out of memory. Here, it is more than a potential service interruption: the way the interruption is handled can corrupt memory and, under exploitable conditions, enable code execution.

Imagine a register that already lists an entry while its fields are still being populated. If processing stops and cleanup trusts the register, it may operate on something that was not ready. This is an analogy for the defect, not a description of a payload.

The fix changes out-of-memory handling to prevent interruptions from leaving cleanup routines with that invalid state. Raising a numeric limit is not equivalent to applying this engine change.

CVE-2026-109619: a later request encounters stale state

In the second issue, state retained by a process may still refer to memory owned by a request that has already ended. Once that memory has been freed, the reference is dangling: using it again is a use-after-free .

The PHP advisory on stale global state distinguishes the operation that leaves this state behind from the operation that later consumes it. Some operations can happen before the new request’s normal initialization replaces the state. Conditions depend on the PHP version, configuration and application processing.

The boundary that needs protection is between requests: a reference left over from earlier work must not become trusted data during the same process’s next task. The patch addresses this lifecycle and state cleanup.

Apache mod_php and PHP-FPM have different conditions

With mod_php , PHP is integrated into Apache. With FPM, Apache or another frontend forwards requests to separate PHP processes. This changes error and cleanup paths; it does not justify declaring FPM immune.

The PHP Foundation reports demonstrations before application code runs with mod_php , as well as code-execution paths confirmed on FPM through application processing. That does not mean the same request can exploit every FPM installation. The operational conclusion is to update an affected runtime and check the relevant vendor advisories.

What an attacker could do

Wiz’s research reports demonstrations of code execution and process-memory disclosure. That memory may contain credentials, tokens or API keys. The applications used in the demonstrations illustrate the impact of a runtime flaw; they are not an exclusive list of products to check.

The effect in your environment depends on what the PHP process can read, write or reach. This distinguishes a capability gained by an attacker from the consequences made possible by the system’s permissions.

Capability gained Possible consequence, depending on permissions and environment
Execute code as the PHP process Modify writable files, read accessible configuration or interact with reachable services
Read sensitive memory Expose secrets held by the process, requiring investigation and replacement of affected credentials
Interrupt processing or processes Cause errors and make PHP-dependent features unavailable

Code execution does not automatically mean root access. The PHP advisory specifies the worker account’s privileges. Taking control of the entire system would require additional conditions. Access limited to one website’s process can nevertheless have serious consequences for the data it handles.

An interactive shell is one possible form of access, not a prerequisite for harm. Disclosure of confidential data is a problem even if no unfamiliar file appears in the website directory.

You need to take action if

  • PHP handles web requests on an affected version , without a documented fix from the project or distributor.
  • You have updated packages or the container image but have not checked whether active processes use the fix.
  • You use an unsupported branch without a verified backport and a reliable maintenance path.
  • You know the CMS version but not which PHP executes the website: identify it first, rather than treating missing information as proof of a fix.

When contacting a hosting provider, I would ask for the complete package or image version applied to my environment, references to both CVEs, and confirmation that the update is active. A general statement about a hosting plan does not by itself establish the status of a particular installation.

No further patching is needed if

Here this means no additional patch for these two CVEs on that component , following verification. It is not a statement that the system has no other vulnerabilities.

  • The web runtime already contains both fixes and active processes have been checked. Retain the complete version, patch source and verification date.
  • The service does not use PHP and cannot forward requests to an affected PHP runtime. An HTML homepage alone does not establish this condition.
  • The provider manages the runtime and has verifiably confirmed that your environment is fixed. You do not need to install the provider’s packages yourself; you need a record of that confirmation.

If you cannot determine which situation applies, the status is needs verification . Hiding the PHP version in response headers or seeing no browser errors does not change that status.

Which versions contain the fixes

The first patched releases of the supported branches, listed in the PHP announcement of 21 October 2026 , are:

PHP branch First patched upstream release
8.2 8.2.35
8.3 8.3.36
8.4 8.4.27
8.5 8.5.12

This table concerns upstream releases. Distribution packages also require checking the vendor revision: a backport brings a fix to an earlier base without adopting all the changes in a newer branch.

Ubuntu documents , for example, a fix for Ubuntu 24.04 in package 8.3.6-0ubuntu0.24.04.13 . Comparing only 8.3.6 with 8.3.36 would lead to the wrong conclusion. That Ubuntu package must not, however, be confused with PPA packages or those from other vendors.

CASE STUDY

The detail I verified on PHP 8.1

On the server examined, PHP 8.1 came from an already configured repository. The earlier package was 8.1.34, revision 8; the corrected package was still 8.1.34, revision 9. Before installing it, I compared the candidate package hash with APT metadata and read the changelog, which referenced both CVEs. After the update, I checked the package and processes. This backport does not restore upstream support for PHP 8.1: migration still needs to be planned.

How to update while protecting website continuity

The process depends on who manages the environment:

Environment What to verify with the responsible operator
Managed or shared hosting A patch on the website’s runtime and confirmation that it is active; a PHP version selector is not sufficient evidence
Directly administered server Packages from the correct repository, compatible extensions and replacement of affected processes
Containers or application platform An image containing the corrected runtime and deployment to the instances actually serving traffic

In my intervention, I separated patching from branch migration. A site using PHP 8.3 received the 8.3 fix; it was not automatically moved to 8.5. This keeps the change bounded, while still requiring compatibility checks.

I followed this process:

  1. 1

    Inventory. Map domains to runtimes and PHP branches. Include administration, APIs and panels that may use a different PHP interface from public pages.

  2. 2

    Recovery. Save configurations, versions and material needed to recover the previous runtime; check application-data backups separately.

  3. 3

    Vendor packages. Check candidates and changelogs, then simulate dependencies to identify removals and changes outside the plan.

  4. 4

    Installation. Update the affected runtime and extensions with a consistent package set, preserving panel-managed configurations.

  5. 5

    Activation. Replace processes using the earlier components and check the runtime actually in use.

  6. 6

    Validation. Compare responses and logs, test relevant features and record those not exercised.

For Ubuntu, the distributor’s procedure remains the reference. A server using a control panel and additional repositories requires understanding those components before running a general upgrade. Dependency simulation does not prove that a payment or upload will work.

Three initial checks on Debian or Ubuntu with FPM

For an 8.3 branch managed as a system service, these are examples of read-only commands. Adapt the names to your environment:

  • dpkg-query -W php8.3-fpm php8.3-common shows installed packages and complete versions.
  • apt-cache policy php8.3-fpm compares the installed version with the candidate known to the local package indexes.
  • systemctl show php8.3-fpm --property=MainPID identifies the service’s main process; it does not by itself prove which patch it has loaded.

In my checks, I also compared the executables associated with processes and looked for processes still using replaced binaries. By contrast, php -v in a terminal identifies CLI PHP, which may differ from the website’s runtime. APT indexes also need refreshing before using the candidate as an operational reference.

OpenAI’s php2shell-checker can help compare versions exposed by binaries or HTTP headers. Its README explains limitations involving absent or modified headers and backports. An unknown result requires further checks. I did not run it during this intervention: I had access to packages, processes and configurations.

The real-world case: updated on disk was not enough

The intervention was carried out with Codex’s operational assistance and my authorization, retaining verification records. On 22 October, the inventory covered 82 active primary sites: 78 with PHP enabled and four with PHP disabled. I applied 79 PHP package updates without changing the assigned branches. Generated pool and web-configuration files retained their previous hashes.

Before After the intervention
PHP 8.2.34 PHP 8.2.35
PHP 8.3.35 PHP 8.3.36
PHP 8.4.26 PHP 8.4.27
PHP 8.1.34, vendor revision 8 PHP 8.1.34, vendor revision 9 with a verified backport

CASE STUDY

Four CGI processes still used the old executable

After installation, FPM used the corrected binaries, but four Apache PHP-CGI processes still pointed to the replaced executable. I completed their replacement through a graceful Apache reload and repeated the check. No PHP processes were still using removed executables, and no replaced PHP modules remained mapped in the FPM processes checked. Package verification and process verification had answered two different questions.

The 82 homepages returned the same HTTP status codes as before, with no new connection errors or 5xx responses. I added 15 GET checks and five browser checks, including the cart and ISPConfig login page. The database, mail services and Redis retained their processes.

With an empty cart, accessing checkout redirected to the cart: that is not a payment test. I did not place orders, submit real forms, upload files or authenticate to applications. The record distinguishes these limits from successful checks.

The inventory also revealed separate maintenance work: legacy services to reconcile and uneven backup coverage. I did not present runtime recovery copies as complete backups of every site, or stop old services before understanding their dependencies. Patching the branches in use and maintaining the inventory remain separate responsibilities.

If you cannot update immediately: mitigation and patching have different roles

The PHP advisory proposes temporary measures that interrupt specific paths. Disabling session.upload_progress.enabled , applying it before request processing and replacing the workers, blocks confirmed session paths; it does not cover every variant.

Likewise, memory_limit=-1 , mentioned as a way to reduce a controllable OOM path, does not make the installation safe and changes memory-consumption safeguards. It is not a setting to apply indiscriminately to a shared server. HTTP limits and resource containment must be considered alongside the features the website needs to keep working.

In my case, corrected packages were available, so I used them. If patching is blocked, the decision to make with the infrastructure operator is how to reduce or suspend the affected service’s exposure until it is fixed, recording what remains reachable.

Cloudflare or another WAF does not update origin PHP

Cloudflare described WAF protections for PHP2Shell . This is an additional defensive layer whose coverage needs checking against actual traffic; it does not change the server’s installed binary.

If a hostname uses Cloudflare only for DNS, its traffic does not pass through the WAF proxy. Coverage must also be considered for directly reachable origins and other names outside the protected path. Having a DNS zone in a dashboard does not establish that every request is filtered.

Rather than treating firewalling and patching as alternatives, an operational plan needs to identify which risk each control reduces and verify the fix on the vulnerable component.

How to assess possible attack attempts or effects

A memory error is not proof of compromise. Wiz’s research suggests investigating correlations between unusual multipart traffic, memory errors, repeated 500 responses, abnormal process behavior and unexpected session cookies. These are signals to investigate in context, not an automatic diagnosis.

In the documented case, I checked service health and logs during the intervention without conducting a retrospective forensic investigation. I have no evidence linking the earlier slowdowns to PHP2Shell.

If concrete indicators emerge, patching and incident response are two tasks to coordinate . The response should address containment, evidence preservation, assessment of affected data and secrets, and recovery from a trustworthy state. The NIST incident-response reference places preparation, detection, response and recovery within risk management.

Changing a password does not remove any persistent malicious code; installing a patch does not automatically revoke secrets already stolen. The order of operations and preservation of evidence require a case-specific decision.

After patching: reduce the impact of the next problem

Routine configuration still matters. OWASP’s PHP guidance covers supported branches, error handling and settings that need adapting to the environment. Applying it requires compatibility checks, rather than copying an entire configuration file found online.

My maintenance plan would include an inventory of runtimes actually used, retirement of services with no dependencies, permissions limited to what is necessary and separation between sites. I would also include backup-availability checks and recovery exercises proportionate to the data being protected.

Errors should be recorded usefully without exposing sensitive details to visitors. Hiding errors on public pages does not fix the internal defect described in the advisories. Similarly, increasing process capacity to reduce queues does not apply a security patch.

Checklist for verifying the fix

This checklist helps collect evidence of remediation; completing it is not certification of the entire system.

CHECKLIST

Check your project

0/6

The record to retain is which component was fixed, with which version and what subsequent checks were performed. Finding CGI processes still using the old executable made that requirement tangible in my intervention.

If you need to establish who manages PHP for your project, you can talk to Row Tech with your hosting inventory and available confirmations. A scoped assessment helps identify the necessary action and recognize what still needs investigation.

Sources and scope

Antonio Ferone

Written by

Antonio Ferone

Personal projects, technical explanations and field notes. I trace questions through evidence, keeping the limits of each assessment clear.

Author profile ↗

THE NEXT STEP

Apply the method to your project

For a professional project, discuss sources, constraints and responsibilities with the Row Tech team.

Talk to Row Tech ↗

Frequently asked questions

The questions that matter

Is updating WordPress or its plugins enough?

You must also verify PHP. The CMS and runtime have separate update cycles; a hosting environment may have different people or services managing each.

Do I need to move every website to PHP 8.5?

In the case described, I patched the existing branches and kept their assignments. Branch migration is a separate activity requiring compatibility checks. The fixed releases listed here are those available at the check on 22 October 2026.

Does PHP-FPM make me immune?

No. Conditions differ from mod_php and also depend on the application. Official sources include FPM among the environments that need updating.

I have no upload form. Can I ignore the advisory?

The presence of an upload button does not describe every request-preparation or extension path. Verify the runtime and patch rather than inferring safety from the website interface alone.

If the version still says 8.1.34, did the update fail?

Not necessarily. In the documented case, the vendor package revision changed and its changelog documented the backport. Evidence includes the complete package version and active processes, not just the displayed base number.

If there are no log errors, does that mean the site was not attacked?

An absence of errors in the sample examined does not establish an absence of attacks or earlier compromise. In my case, log checks validated the intervention; they did not replace a forensic investigation.

Are the 382 URLs definitely vulnerable servers?

No. The figure counts URLs advertising potentially vulnerable versions in the cited survey.

Was every URL no longer flagged patched?

The source also distinguishes unreachable addresses and versions no longer exposed. These cannot automatically be counted as remediated.

Can an apparently old version include a fix?

Check the provider’s build and any backport rather than relying only on the short version number.

Does this note update your server’s status?

No. It is a documentary update, not a new audit.

Were the AgID tools executed?

No repository script was executed in this editorial task.

Will this create a second PHP2Shell guide?

No. It proposes an integration into the existing guide while preserving its URLs and earlier content.

Continue reading

Projects and technical notes

Explore projects ↗

Explore related content

Find articles, projects and resources on the same themes.