AWS Builder Center
PHP2Shell: Inside the Critical PHP Vulnerabilities That Put Web Servers at Risk

PHP2Shell: Inside the Critical PHP Vulnerabilities That Put Web Servers at Risk

PHP2Shell has highlighted critical security risks in PHP-powered web applications. This article explores CVE-2026-109618 and CVE-2026-109619, explaining the vulnerabilities, potential remote code execution risks, affected PHP versions, official security patches, and practical mitigation strategies. Learn how developers and system administrators can assess exposure, investigate suspicious activity, and strengthen web application security using verified guidance.

MCA | Cloud Network Operation Consultant
Modern web applications depend on layers of software working together. A website may use a content management system, third-party plugins, a database, an authentication service, a web server, and a server-side programming language such as PHP. Security controls at one layer cannot always compensate for a vulnerability in another.
On October 21, 2026, the PHP project published emergency security releases addressing two critical vulnerabilities in the PHP runtime. Tracked as CVE-2026-109618 and CVE-2026-109619, and collectively referred to as PHP2Shell, these vulnerabilities can potentially allow an unauthenticated remote attacker to execute code on a vulnerable server.
Both vulnerabilities received a CVSS v4.0 severity score of 9.2 out of 10.
What makes this incident especially important is that the weaknesses reside in PHP's internal request-processing and memory-management behavior. They are not limited to a single WordPress plugin, a particular website, or one application framework.
For defenders, the central question is therefore broader than whether a website's code is secure. They must establish which PHP runtimes are exposed, whether the vulnerable code has been fixed, and whether suspicious activity occurred before remediation.
This article examines the technical causes, affected environments, possible attack paths, implications for connected services, mitigation strategies, and the longer-term lessons for web security.

1. What is PHP, and why does a vulnerability in it matter?

PHP is a server-side programming language widely used to build dynamic websites and web applications. Unlike JavaScript executed in a visitor's browser, PHP commonly executes on the server, where it can process requests, interact with databases, manage sessions, generate pages, and communicate with other services.
PHP is used by major content management systems and web platforms, including WordPress, Drupal, and Joomla, as well as custom applications and numerous hosting environments.
A typical request follows a path similar to this:
  1. A browser or client sends an HTTP request.
  1. A web server or reverse proxy receives the request.
  1. The server passes PHP requests to the appropriate PHP runtime or worker.
  1. PHP parses request data and initializes the execution environment.
  1. Application code processes the request.
  1. The application may interact with databases, files, authentication systems, or external APIs.
  1. A response is returned to the client.
The exact sequence varies by deployment.
The important detail is that PHP performs internal processing before application code necessarily begins executing. If a vulnerability is triggered during this earlier processing, application-level authentication and input-validation code may never get an opportunity to reject the request.
That is why a vulnerability in the runtime can have consequences beyond a single application component.

2. What exactly is PHP2Shell?

PHP2Shell is the name used for two critical PHP vulnerabilities that can enable remote code execution on vulnerable systems.
Remote code execution, commonly abbreviated as RCE, means an attacker can cause a target system to execute code chosen by the attacker under the privileges available to the vulnerable process.
Unauthenticated remote code execution is particularly serious because exploitation does not necessarily require a valid account or an authenticated session.
The two vulnerabilities are distinct, even though both involve PHP's handling of internal state and request processing.
  • CVE-2026-109618: Remote code execution associated with out-of-memory handling and improperly initialized request memory.
  • CVE-2026-109619: Remote code execution associated with stale global state that continues to reference memory belonging to a previous request.
Both were addressed in PHP's October 21 security releases.
The nickname PHP2Shell should not be interpreted as evidence that every attack automatically provides a fully privileged operating-system shell. The resulting capabilities depend on successful exploitation, the PHP process's permissions, the host configuration, and the surrounding security controls.
Nevertheless, arbitrary code execution within a web worker can be sufficient to expose application data, modify accessible files, access available secrets, or establish a foothold for further investigation by an attacker.

3. CVE-2026-109618: Understanding the out-of-memory vulnerability

The first vulnerability concerns how PHP handles memory-allocation failures during request processing.
To understand the issue, it helps to distinguish a normal memory error from an unsafe cleanup path.
When PHP processes an incoming request, it allocates memory for internal structures that represent request data. Those structures must be initialized consistently and cleaned up safely when the request finishes or fails.
An out-of-memory condition occurs when a required memory allocation cannot be completed.
The PHP implementation uses an internal control-flow mechanism involving  longjmp()  to interrupt certain operations when an out-of-memory error occurs. In vulnerable execution paths, this interruption can happen while request-related memory is only partially initialized.
The operation exits, but some internal state may not be in a condition that the normal cleanup code expects.
If cleanup subsequently reads or branches on that invalid state, the result can be memory corruption. Under exploitable conditions, this can lead to remote code execution.
The security issue is not simply that PHP can run out of memory. Memory exhaustion is a normal failure condition that software must handle safely. The vulnerability arises because particular error-handling paths do not correctly preserve the invariants required by later cleanup operations.

Why multipart requests matter

HTTP multipart/form-data is commonly used for file uploads and forms containing multiple fields.
During multipart parsing, PHP builds internal representations of incoming fields, uploaded files, and associated metadata.
The PHP advisory identifies several ways that request processing can consume unexpectedly large amounts of memory relative to the apparent size of the request. These include excessive multipart-part headers and structures created while parsing certain field names and file controls.
As a result, a request that appears to respect an ordinary body-size limit may still trigger substantial internal memory allocation.
In particular configurations, an allocation failure can occur at a point where PHP's request state is not yet fully initialized.
The vulnerable cleanup path may then process that invalid state.

Does this mean every file upload is dangerous?

No.
Multipart requests are a relevant attack surface for this vulnerability, but the presence of an upload form does not itself establish that a system has been exploited.
Risk depends on the PHP version, the server API, request-processing behavior, configuration, and the conditions required to reach the vulnerable error path.
The correct response is to patch the runtime, review exposure, and apply sensible request-size and resource limits. Disabling uploads can reduce exposure where uploads are unnecessary, but it is not a universal replacement for the security update.

4. CVE-2026-109619: Understanding stale global state and use-after-free

The second vulnerability involves a memory-safety problem known as use-after-free.
A program allocates memory for an object or data structure, uses it, and eventually releases that memory when it is no longer needed.
The problem occurs when another part of the program continues to hold a reference to that memory after it has been released.
The memory may subsequently be reused for something else. If the old reference is accessed, the program can interpret unrelated data as though it were the original object.
Depending on the circumstances, this can cause crashes, information disclosure, memory corruption, or code execution.

Why PHP workers make request boundaries important

Some PHP server configurations reuse worker processes to handle multiple requests. Reusing workers improves performance because the server does not need to create a new process for every request.
However, the runtime must carefully separate the state belonging to one request from the state belonging to the next.
PHP maintains internal global state for operations such as error handling, sessions, objects, and extensions. Some of this state can temporarily refer to memory owned by the current request.
When a request finishes, PHP must reset those references before releasing the associated memory.
The vulnerability arises when a particular execution path fails to reset the state correctly, or when a later operation repopulates it after the expected reset.
A subsequent request handled by the same worker can then encounter a stale reference before the runtime has completed normal initialization.
The dangerous sequence is conceptually:
  1. A request causes PHP to establish internal state associated with its memory.
  1. An error or another interruption prevents the expected reset.
  1. PHP releases the memory belonging to that request.
  1. A reused worker retains a reference to the released memory.
  1. A later operation accesses the stale state before it is properly initialized.
This is a lifecycle failure within the runtime. It is not equivalent to an ordinary application variable retaining an old value.

Why configuration and session processing matter

The PHP security advisory describes specific ways that internal state can be produced and consumed across request boundaries. These include certain early configuration-diagnostic paths and session upload-progress processing.
The precise reachability of these paths depends on the server API, PHP version, configuration, and application behavior.
It is therefore inaccurate to assume that every PHP deployment exposes every documented path in exactly the same way.
The official advisory should be treated as the source of truth for the technical conditions and mitigations.

5. Why application-level security controls may not be sufficient

Many web applications use several defensive layers:
  • Authentication to establish who a user is.
  • Authorization to determine what that user may access.
  • Input validation to reject malformed or unexpected data.
  • CSRF protection to limit cross-site request forgery.
  • Web application firewalls to inspect HTTP traffic.
  • Rate limiting to restrict excessive requests.
These controls remain important, but they solve different problems.
If a vulnerable PHP runtime processes a request before application code executes, an application-level authentication check cannot necessarily prevent the runtime from reaching the vulnerable code path.
Similarly, validating a request inside a controller is too late to protect parsing operations that have already occurred.
This does not mean authentication or input validation is useless. It means the security boundary must include the runtime and the web server, not only the application.
A defense-in-depth architecture assumes that individual controls can fail and attempts to limit the impact when they do.

6. Which PHP environments should be reviewed?

The PHP project identifies web-serving configurations including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP, and LiteSpeed as potentially affected.
The project identifies Apache mod_php as the highest-risk configuration for the demonstrated pre-application attack path.
This distinction matters because server APIs do not all process request startup and cleanup in exactly the same way. The fact that a particular path has been demonstrated against one configuration does not establish identical exploitability in every other configuration.
Organizations should inventory all PHP deployments rather than limiting their review to a single website or server.
The inventory should include:
  • Traditional virtual machines and dedicated web servers.
  • Shared hosting and managed hosting environments.
  • Container images used by Docker, Kubernetes, and other orchestration systems.
  • PHP applications deployed through continuous integration and delivery pipelines.
  • Development, testing, staging, and production environments.
  • Long-running workers and services that bundle a PHP runtime.
  • Third-party software and appliances that include PHP internally.
A software inventory should identify the runtime actually executing, not just the version specified in a project file.
For example, updating a dependency manifest does not necessarily update PHP installed on a host. Likewise, updating a container image in a registry does not replace containers that are already running.

7. How could a PHP runtime compromise affect connected systems?

The impact of a successful compromise depends on what the PHP process is allowed to access.
A web application may be connected to a database, object storage, an email service, an identity provider, payment processing, internal APIs, or a cloud environment.
If an attacker obtains code execution inside the application process, the attacker may be able to use some of those existing permissions.
This is why runtime security and identity security cannot be treated as separate concerns.

Databases and application data

If the PHP process can connect to a database, an attacker may attempt to use the application's database credentials and permissions.
Potential consequences include unauthorized reading or modification of accessible records, depending on the database role and network restrictions.
A compromised web worker does not automatically grant unrestricted database access. The actual risk depends on the permissions assigned to the application and the controls enforced by the database.

Credentials and secrets

Applications frequently need credentials to communicate with other services.
Depending on the deployment, sensitive values may exist in environment variables, configuration files, mounted secret files, secret-management services, or process-accessible memory.
If a compromised process can access these values, they may be exposed.
For this reason, credentials should be scoped to the smallest practical set of resources. Secrets should not be embedded in source code or unnecessarily shared across unrelated applications.
If compromise is suspected, credential rotation should be based on an assessment of which secrets the affected workload could access.

Internal services and network access

A web server may be able to reach internal services that are not publicly accessible.
An attacker who controls the server process may attempt to use those network paths.
Network segmentation, outbound traffic restrictions, service authentication, and explicit authorization can reduce this risk.
Private network placement alone should not be considered sufficient protection for an internal service.

Cloud permissions

Cloud-hosted applications may receive permissions through workload identities, instance roles, task roles, or other mechanisms.
If an attacker gains code execution inside a workload, the attacker may attempt to use the permissions available to that workload.
This does not mean the entire cloud account is automatically compromised. The potential impact depends on the granted permissions, credential protections, network controls, and the attacker's ability to move beyond the initial process.
The general lesson applies to any hosting provider: application identities should have narrowly scoped permissions, and sensitive management operations should not be available to ordinary web workloads without a clear requirement.

8. What about WordPress, Drupal, Joomla, and third-party plugins?

PHP2Shell affects the underlying PHP runtime, so PHP-based applications may be exposed even when their application code and plugins are fully updated.
For example, WordPress, Drupal, and Joomla installations can depend on PHP versions supplied by the hosting platform.
Updating a CMS or plugin alone does not repair a vulnerable PHP runtime.
The reverse is also true: updating PHP does not automatically fix unrelated vulnerabilities in the CMS, its plugins, themes, or extensions.
Administrators should therefore assess two separate categories:
  1. Runtime security: Is the deployed PHP version fixed for the relevant vulnerabilities?
  1. Application security: Are the CMS, plugins, themes, dependencies, and custom code maintained and configured securely?
The same distinction applies to e-commerce platforms, frameworks, internal portals, and custom PHP applications.
A vulnerability in a runtime can increase risk across many applications, but it does not establish that every application built on that runtime has been compromised.

9. Timeline and the importance of early threat intelligence

The PHP security releases were published on October 21, 2026.
Amazon Threat Intelligence reported observing an exploitation attempt in its MadPot telemetry on October 17, four days before public disclosure. AWS also reported identifying proof-of-concept activity around the time of the release.
These findings demonstrate why security teams should not assume that a public disclosure date marks the beginning of all malicious activity.
However, threat-intelligence observations must be interpreted carefully. An exploitation attempt against a honeypot is evidence of attempted activity, not proof of a successful compromise of an unrelated organization.
Likewise, the existence of public proof-of-concept code does not prove that a particular server has been attacked.
The practical lesson is to use the earliest credible exposure date when reviewing logs and incident evidence, rather than examining only activity after the advisory was published.
Security teams should also distinguish between scanning, attempted exploitation, successful exploitation, and confirmed persistence. These are different events and require different levels of evidence.

10. Which versions are fixed?

The PHP project published the following fixed releases on October 21, 2026.
PHP branch
Fixed release
PHP 8.5
8.5.12
PHP 8.4
8.4.27
PHP 8.3
8.3.36
PHP 8.2
8.2.35
Earlier releases in the affected branches should be assessed against the official advisory.
PHP 8.1 and older branches require additional care because they are no longer supported upstream. Some distributions and long-term support vendors may provide backported security fixes, but administrators must verify the exact package and vendor advisory.
A package's displayed version may not always tell the whole story when a distributor backports security fixes without adopting the upstream version number. Consult the operating-system or hosting vendor's security bulletin as well as the PHP advisory.
PHP 8.2 is also approaching its announced end-of-life date of December 31, 2026. Organizations using it should plan a supported-version migration rather than treating the immediate patch as the end of their maintenance obligations.

11. Immediate remediation: what administrators should do

Step 1: Identify every PHP runtime

Use asset inventories, package managers, configuration management, container registries, deployment manifests, and hosting dashboards to identify PHP versions.
Do not assume that one server or one application represents the entire environment.

Step 2: Prioritize exposed systems

Start with publicly accessible PHP applications, especially those that process untrusted requests or file uploads.
Also consider business criticality, the sensitivity of accessible data, the permissions available to the workload, and whether the runtime is already end-of-life.

Step 3: Install the appropriate security update

Use the fixed release or the verified vendor package applicable to the operating system and deployment platform.
Test compatibility where practical, but do not allow routine testing to become an indefinite delay for a critical exposed system. Use emergency change procedures when appropriate.

Step 4: Restart or replace affected workers

Updating files on disk does not necessarily mean an already running process has begun using the patched code.
Restart or replace the affected PHP workers and services according to the platform's supported procedure.
For containerized applications, build or obtain a patched image, deploy it, and confirm that old vulnerable tasks or pods are no longer serving traffic.

Step 5: Verify the running version

Confirm the runtime version from the actual deployed environment, not just the development workstation or build pipeline.
Where applicable, verify the CLI and web-serving runtime separately. They may use different binaries, configuration files, or package versions.

Step 6: Review remaining exposure

Repeat the asset inventory and check for systems that were missed, failed to update, or are still running old processes.
Document exceptions, the reason for each exception, the compensating controls in place, and the expected remediation date.

12. Temporary mitigations: useful, but not a substitute for patching

Some environments may require a short period to test and deploy a security update.
Temporary controls can reduce exposure, but their coverage is incomplete and varies with the attack path.
Where the application does not require file uploads, blocking multipart/form-data requests at an appropriate front-end control may remove an unnecessary attack surface.
Request-body limits and other input-processing controls can reduce memory pressure. However, limits based only on total request size do not necessarily prevent every memory-amplification scenario described in the PHP advisory.
For the relevant PHP 8.5 attack path, the PHP advisory also describes disabling fatal error backtraces as a mitigation. Disabling session upload progress may reduce exposure to the associated session-state path.
These settings must be evaluated against the exact vulnerability, runtime, and deployment configuration. They do not address every possible producer and consumer of stale internal state.
AWS WAF and other web application firewalls can help block selected request patterns where the application architecture supports those controls. A WAF cannot directly repair PHP's internal memory-management logic.
The essential point is that temporary mitigations reduce selected risks; upgrading to a fixed PHP release is the complete remediation.
Use the official PHP advisories for exact configuration guidance rather than copying generic settings into production without understanding their effect.

13. Detection and incident investigation

Applying a patch is necessary, but it does not prove that the vulnerable system was never compromised.
If a server was exposed before remediation, investigate activity from the relevant exposure period.

Web and application logs

Review web-server access logs, error logs, reverse-proxy logs, application logs, and WAF logs where available.
Look for unusual POST requests, unexpected multipart traffic, repeated malformed requests, abnormal response patterns, and activity inconsistent with normal application behavior.
These indicators can support an investigation, but they are not proof of successful exploitation on their own.

Process and operating-system activity

Where evidence is available, investigate unexpected child processes, unfamiliar executables, suspicious file modifications, unusual authentication events, and unexplained outbound connections.
PHP applications do not ordinarily need to launch arbitrary operating-system commands for every request. Unexpected process creation should be assessed in context.

Credentials and cloud activity

Review access to secrets, service identities, database credentials, cloud APIs, and administrative functions available to the affected workload.
If a workload identity may have been misused, examine the corresponding audit logs and restrict or rotate the relevant credentials as appropriate.

Preserve evidence

If compromise is suspected, follow an incident-response plan. Isolate the affected workload where appropriate, preserve relevant logs and forensic evidence, and avoid destroying evidence unnecessarily during recovery.
Patching and restarting are important remediation steps, but restarting a process can eliminate useful volatile evidence. When there is credible evidence of a serious compromise, coordinate evidence collection and containment with the incident-response team while avoiding unnecessary exposure to ongoing attacks.

Distinguish vulnerability from compromise

A vulnerable version indicates exposure. A suspicious request indicates possible hostile activity. A successful exploit requires stronger evidence, and confirmed compromise requires evidence that an attacker obtained unauthorized execution or access.
Reports should make these distinctions explicit.

14. Recovery after a suspected compromise

If the investigation identifies successful exploitation, recovery must address more than the original PHP vulnerability.
A defensible recovery process includes:
  1. Contain the affected workload and preserve available evidence.
  1. Determine which applications, files, databases, identities, and external services the compromised process could access.
  1. Review changes to application files, scheduled tasks, startup mechanisms, accounts, and other persistence locations relevant to the environment.
  1. Rotate potentially exposed credentials and revoke unnecessary access.
  1. Rebuild affected workloads from trusted, patched images or known-good sources where appropriate.
  1. Restore data from verified backups if integrity has been affected.
  1. Validate the runtime version, permissions, network rules, and application behavior before restoring service.
  1. Continue monitoring for indicators associated with the incident.
Do not assume that removing a suspicious file or updating PHP alone proves that all attacker access has been eliminated.
The recovery process should be proportional to the evidence and follow the organization's incident-response procedures.

15. Long-term lessons for developers and security teams

PHP2Shell reinforces several engineering principles.

Keep runtimes supported and patched

Runtime maintenance should be part of normal software lifecycle management, not an occasional task triggered only by major headlines.
Maintain an inventory of runtime versions, identify end-of-life systems, and establish clear ownership for security updates.

Treat third-party dependencies and the runtime separately

Application dependencies, plugins, frameworks, and language runtimes have different update mechanisms.
Track each category and ensure that updating one does not create a false assumption that all other layers are secure.

Use least privilege

Run PHP under an account with only the permissions it needs. Avoid giving ordinary web workers administrative operating-system privileges or broad cloud permissions.
Restrict access to sensitive files, database operations, and internal services.

Separate workloads

Where practical, isolate applications with different trust levels, data classifications, and business requirements.
A compromise in one application should not automatically expose unrelated workloads.

Limit resource consumption safely

Apply sensible request-size, upload-count, input-variable, and execution limits based on application requirements.
Use resource controls that are appropriate for the operating system and deployment architecture. Resource limits can improve resilience, but they should not be mistaken for a fix for a memory-safety vulnerability.

Improve visibility

Collect useful logs, protect their integrity, synchronize timestamps, and ensure that responders can access relevant evidence when an incident occurs.
Monitoring should cover application behavior as well as operating-system, identity, and network activity.

Test recovery before an emergency

Maintain backups and practice restoring services from known-good artifacts.
A recovery plan that has never been tested may fail when the team most needs it.

16. The role of responsible disclosure and security research

Critical vulnerabilities require coordination between researchers, software maintainers, vendors, and defenders.
Responsible disclosure can give maintainers time to investigate, prepare fixes, and coordinate communications. At the same time, leaked details or early exploit development can shorten the time available for organizations to patch.
The PHP2Shell timeline illustrates why coordinated release processes, rapid patch availability, and clear vendor advisories matter.
Research assisted by AI has also received attention in connection with this incident. Wiz Research reported discovering the vulnerabilities with assistance from AI models. That is relevant to the changing security-research landscape, but it should not be interpreted as evidence that AI independently guarantees the discovery or prevention of all critical flaws.
AI-assisted research can help identify complex code paths. Findings still require technical validation, responsible disclosure, remediation, and careful assessment of exploitability.
For defenders, the priority remains the same: understand the evidence, apply the verified fix, and investigate systems that may have been exposed.

17. What should organizations expect next?

It is reasonable to expect increased scrutiny of affected PHP deployments after a critical vulnerability becomes public. Security researchers and attackers may examine the same technical details, and vulnerable systems may remain exposed while organizations work through inventories and maintenance schedules.
However, predictions about specific future victims, attack campaigns, or exploitation rates should not be presented as established facts without supporting evidence.
Organizations should prepare for the possibility of continued scanning and attempted exploitation by maintaining patched runtimes, monitoring relevant telemetry, and having a tested response process.
The broader lesson is not limited to PHP. Any widely deployed runtime, framework, library, or service can become a critical dependency when its internal security boundary fails.
A mature security program must be able to identify such dependencies, establish where they are used, deploy fixes efficiently, and verify the outcome.

Conclusion: Secure the runtime, not just the application

PHP2Shell demonstrates how a defect in a language runtime can undermine defenses built into the applications that depend on it.
The two vulnerabilities involve different failure mechanisms: one concerns unsafe state during out-of-memory handling, while the other concerns stale internal state surviving a request boundary. Both can lead to remote code execution under the relevant conditions.
For developers and system administrators, the immediate priorities are to identify affected runtimes, deploy the appropriate security updates, restart or replace vulnerable workers, verify the running versions, and investigate suspicious activity from the exposure period.
For organizations operating connected services, the incident is also a reminder to limit workload permissions, isolate applications, protect secrets, restrict unnecessary network access, and maintain reliable logs and recovery procedures.
No single control can eliminate every security risk. Effective protection comes from combining secure software, supported runtimes, disciplined patch management, least-privilege access, layered defenses, and evidence-based incident response.
The most important question after a critical vulnerability is not simply whether a patch is available. It is whether every affected system has been identified, correctly remediated, verified, and assessed for signs of compromise.

Official and technical references

  1. National Cyber Security Centre of the Netherlands —  PHP2Shell technical tracking and research 

This article is intended for security awareness and defensive remediation. Consult the official advisories and your platform vendor's instructions for environment-specific patching decisions.

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article