November 24, 2026
PHP2Shell Explained:Understanding Critical PHP Remote Code Execution Vulnerabilities
A practical security research walkthrough of CVE-2026–109618 and CVE-2026–109619, PHP memory corruption, runtime assessment, authorized…

By Rebline CyberSec
21 min read
PHP2Shell
A practical security research walkthrough of CVE-2026–109618 and CVE-2026–109619, PHP memory corruption, runtime assessment, authorized security validation, and defensive monitoring.
Rebline CyberSec | SECURITY · RESEARCH · LEARNING
1. Introduction
PHP is one of the most widely deployed server-side programming languages on the web.
It powers content management systems, enterprise applications, APIs, e-commerce platforms, administrative interfaces, and many other web services.
However, a vulnerability in the PHP runtime itself can have implications far beyond a single application.
In October 2026, two critical vulnerabilities in PHP became publicly known. They are collectively associated with the name PHP2Shell.
The vulnerabilities are:
- CVE-2026–109618
- CVE-2026–109619
Both have a reported CVSS 4.0 severity score of 9.2.
They involve memory-safety problems in PHP's internal request processing and fatal-error handling mechanisms.
Under affected conditions, these issues can enable unauthenticated remote code execution or sensitive process-memory disclosure.
What makes PHP2Shell important?
Traditional web application vulnerabilities often involve problems such as:
- SQL injection.
- Cross-site scripting.
- Local file inclusion.
- Insecure deserialization.
- Authentication bypass.
- Broken access control.
PHP2Shell is different.
The underlying security defects exist in the PHP runtime.
This means an application does not necessarily need to contain an obvious vulnerable PHP function or an insecure application-level implementation to be exposed.
The vulnerability can affect applications running on an affected PHP runtime, subject to the relevant execution conditions.
Why should security professionals care?
For penetration testers, PHP2Shell demonstrates the importance of evaluating the application runtime rather than examining application source code alone.
For red-team operators, it highlights the security implications of public-facing PHP infrastructure.
For blue-team engineers, it creates a need for runtime inventory, patch verification, process monitoring, and HTTP telemetry analysis.
For security architects, it reinforces the importance of application isolation and least-privilege execution.
What will this research demonstrate?
This article explains:
- PHP2Shell and its associated vulnerabilities.
- PHP request processing and memory-management concepts.
- The security implications of out-of-memory handling.
- How affected PHP deployments can be identified.
- How to build an isolated PHP assessment laboratory.
- How to verify PHP versions and runtime configuration.
- How to identify suspicious web-server behavior.
- How to implement defensive monitoring.
- How to plan remediation and post-patch verification.
The practical lab focuses on safe, reproducible defensive assessment rather than executing an exploit against a vulnerable server.
2. Understanding the Technical Concept
2.1 What exactly is PHP2Shell?
PHP2Shell is the name associated with research into two related memory-safety vulnerabilities in PHP core.
The name also refers to the combined exploit script used in the original demonstrations.
It is important to understand that PHP2Shell is not simply a PHP web-shell upload vulnerability.
The research concerns the PHP interpreter's internal memory-management behavior.
The two vulnerability classes include:
- Improper handling of memory exhaustion during request processing.
- Invalid or stale global state following interrupted execution and request cleanup.
The research demonstrated remote code execution and memory disclosure in controlled environments.
Source: https://www.php2shell.com/
2.2 Understanding CVE-2026–109618
Technical category: Out-of-memory handling and memory corruption.
PHP manages memory while processing application requests.
For example, a web application may process:
- HTTP request parameters
- Uploaded files.
- Multipart form data.
- PHP session information.
- Arrays and strings.
- Application-generated objects.
PHP provides memory limits to prevent a single request from consuming excessive resources.
Consider this simplified example:
memory_limit = 128Mmemory_limit = 128MThis configuration establishes a PHP memory limit for an execution context.
When an operation exceeds the available PHP memory budget, PHP can raise a fatal error.
The problem addressed by CVE-2026–109618 concerns how certain internal execution paths handle out-of-memory conditions.
In particular, the research describes problematic control flow involving longjmp() and request state that may not have been initialized or cleaned up correctly.
Why does this matter?
When an execution path is interrupted unexpectedly, internal data structures must remain consistent.
If memory-management assumptions are violated, subsequent operations may access invalid or improperly initialized state.
Depending on the execution path, this can contribute to memory corruption and remote code execution.
2.3 Understanding CVE-2026–109619
Technical category: Stale global state and use-after-free behavior.
A use-after-free condition occurs when software continues to reference memory after that memory has been released.
Consider a simplified conceptual example:
char *buffer = malloc(100);
free(buffer);
/* Incorrect: buffer still references released memory */char *buffer = malloc(100);
free(buffer);
/* Incorrect: buffer still references released memory */The pointer variable still contains an address, but the memory it referenced is no longer owned by that allocation.
This can create unpredictable behavior.
CVE-2026–109619 concerns related problems in PHP's handling of internal state following fatal-error processing.
The research describes global state retaining references to memory regions that have already been freed.
If subsequent operations access those references, memory disclosure or other unsafe behavior may occur.
Security significance:
- Sensitive memory may become accessible.
- Internal application state may become inconsistent
- Further memory corruption may become possible.
- Under demonstrated conditions, remote code execution may result.
The precise exploitability depends on the runtime, configuration, and execution path.
2.4 Understanding longjmp()
The C programming language provides setjmp() and longjmp() for non-local control flow.
A simplified conceptual example:
#include <setjmp.h>
#include <stdio.h>
jmp_buf environment;
void operation(void) {
printf("Operation started\n");
longjmp(environment, 1);
}
int main(void) {
if (setjmp(environment) == 0) {
operation();
} else {
printf("Control returned\n");
}
return 0;
}#include <setjmp.h>
#include <stdio.h>
jmp_buf environment;
void operation(void) {
printf("Operation started\n");
longjmp(environment, 1);
}
int main(void) {
if (setjmp(environment) == 0) {
operation();
} else {
printf("Control returned\n");
}
return 0;
}This is an educational demonstration of non-local control flow.
It is not PHP2Shell exploit code.
In a complex interpreter, interrupted control flow must account for:
- Allocated memory.
- Temporary objects.
- Active request context.
- Error state.
- Global references.
- Cleanup handlers.
If cleanup assumptions are incorrect, memory-safety problems can occur.
2.5 Understanding PHP request processing
A simplified PHP request lifecycle looks like this:
HTTP REQUEST
|
v
WEB SERVER / SAPI
|
v
PHP REQUEST INIT
|
v
REQUEST DATA PARSING
|
v
PHP APPLICATION
|
v
REQUEST SHUTDOWN
|
v
MEMORY CLEANUP
|
v
WORKER REUSEHTTP REQUEST
|
v
WEB SERVER / SAPI
|
v
PHP REQUEST INIT
|
v
REQUEST DATA PARSING
|
v
PHP APPLICATION
|
v
REQUEST SHUTDOWN
|
v
MEMORY CLEANUP
|
v
WORKER REUSESAPI means Server Application Programming Interface.
It is the integration layer between PHP and its hosting environment.
Examples include:
- Apache module.
- CGI.
- FastCGI.
- PHP-FPM.
A critical security consideration is that different deployment architectures have different worker and request-lifecycle characteristics.
2.6 Understanding PHP-FPM
PHP-FPM stands for PHP FastCGI Process Manager.
It manages PHP worker processes and handles requests received through FastCGI.
A typical Nginx and PHP-FPM architecture:
INTERNET
|
v
NGINX
|
v
FASTCGI PROTOCOL
|
v
PHP-FPM
|
v
PHP INTERPRETER
|
v
APPLICATION
|
v
DATABASEINTERNET
|
v
NGINX
|
v
FASTCGI PROTOCOL
|
v
PHP-FPM
|
v
PHP INTERPRETER
|
v
APPLICATION
|
v
DATABASEPHP-FPM worker management settings can influence process reuse and resource consumption.
For example:
pm = dynamic
pm.max_children = 10
pm.max_requests = 500pm = dynamic
pm.max_children = 10
pm.max_requests = 500These settings control worker-management behavior.
They are not PHP2Shell fixes.
Reducing worker reuse can sometimes reduce the persistence of certain problematic states, but it is only a supplementary measure.
2.7 The two vulnerabilities compared
Property — — CVE-2026–109618 — — CVE-2026–109619
Main issue — OOM-related memory corruption — Stale global memory state
Technical concept — Interrupted execution and initialization — Use-after-free
Relevant mechanism — Fatal error handling — Memory lifecycle
Potential consequence — Remote code execution — Memory disclosure or RCE
Main remediation — Fixed PHP runtime — Fixed PHP runtime
3. Real-World Security Scenario
Scenario classification: Hypothetical enterprise environment based on documented PHP deployment patterns.
Consider an organization operating an internet-facing PHP application.
Environment
Internet
|
v
Cloud Firewall
|
v
Nginx Reverse Proxy
|
v
PHP-FPM Workers
|
v
PHP Application
|
+------> MySQL Database
|
+------> Redis Session Store
|
+------> Internal APIInternet
|
v
Cloud Firewall
|
v
Nginx Reverse Proxy
|
v
PHP-FPM Workers
|
v
PHP Application
|
+------> MySQL Database
|
+------> Redis Session Store
|
+------> Internal APIThe application uses a PHP runtime that has not received the relevant security updates.
The organization also has several supporting services:
- Administrative interfaces.
- File-upload functionality.
- API integrations.
- Database connections.
- Application sessions.
- Cloud service credentials.
Potential attack surface
The public-facing application accepts HTTP requests.
The PHP runtime processes requests through its configured SAPI.
The vulnerabilities are in PHP core, so application-level security controls alone cannot be assumed to prevent exploitation.
Possible impact
If a vulnerable execution path is successfully exploited, the PHP worker's privileges determine the immediate access available.
Potential consequences include:
- Unauthorized server-side code execution.
- Access to files readable by the worker.
- Exposure of application configuration.
- Access to database credentials available to the application.
- Unauthorized API activity.
- Service disruption.
- Further compromise where additional weaknesses exist.
Important privilege distinction
Suppose PHP-FPM executes as:
www-datawww-dataSuccessful code execution initially operates within the privileges of that process.
It does not automatically grant root access.
However, weak file permissions, exposed secrets, excessive service-account privileges, or additional vulnerabilities can increase the impact.
Red-team assessment objectives
An authorized security assessment should answer:
- Which PHP runtimes are installed?
- Which runtime serves the public application?
- Is the installed version affected?
- Is the relevant security update installed?
- Which SAPI is being used?
- Which security configurations are enabled?
- Are suspicious process activities present?
- Is the application running with excessive privileges?
Blue-team assessment objectives
The defensive team should:
- Identify every PHP runtime.
- Map PHP runtimes to applications.
- Review external exposure.
- Apply the appropriate security updates.
- Inspect application and web-server logs.
- Review PHP worker behavior.
- Check for unauthorized process execution.
- Verify that remediation is complete.
4. Lab Environment Setup
We will create a local defensive PHP assessment environment.
4.1 Lab objectives
The laboratory will demonstrate:
- PHP runtime identification.
- PHP version verification.
- SAPI identification.
- PHP configuration inspection.
- HTTP response validation.
- Security configuration review.
- Remediation verification.
It will not send memory-exhaustion payloads or execute a remote shell.
4.2 Required components
Component — — Requirement
Operating system — Ubuntu 24.04 or compatible Linux
Container runtime — Docker
PHP — 8.4.28 Apache image
Web server — Apache
Browser — Any modern browser
CLI — Bash, curl
Programming language — Python 3, PHP
PHP 8.4.28 was listed as a security release on November 19, 2026. The version is used here as an educational patched-runtime example. Always verify the latest vendor-supported release before production deployment.
4.3 Verify Docker
docker --versiondocker --versionIllustrative output:
Docker version 2.x.xDocker version 2.x.xThe exact version depends on the installation.
4.4 Create the laboratory directory
mkdir -p ~/rebline-php2shell-lab
cd ~/rebline-php2shell-labmkdir -p ~/rebline-php2shell-lab
cd ~/rebline-php2shell-labExplanation:
mkdircreates the project directory.-pcreates missing parent directories.cdchanges into the project directory.
4.5 Create the PHP application
Create the source directory:
mkdir -p srcmkdir -p srcCreate src/index.php:
<?php
header("Content-Type: text/plain");
echo "REBLINE PHP SECURITY LAB\n";
echo "PHP Version: " . PHP_VERSION . "\n";
echo "PHP SAPI: " . PHP_SAPI . "\n";
echo "Memory Limit: " .
ini_get("memory_limit") . "\n";
echo "Post Max Size: " .
ini_get("post_max_size") . "\n";
echo "Upload Max Size: " .
ini_get("upload_max_filesize") . "\n";
echo "Upload Progress: " .
ini_get("session.upload_progress.enabled") . "\n";
echo "Display Errors: " .
ini_get("display_errors") . "\n";
echo "Expose PHP: " .
ini_get("expose_php") . "\n";
echo "Runtime Status: LAB INFORMATION ONLY\n";<?php
header("Content-Type: text/plain");
echo "REBLINE PHP SECURITY LAB\n";
echo "PHP Version: " . PHP_VERSION . "\n";
echo "PHP SAPI: " . PHP_SAPI . "\n";
echo "Memory Limit: " .
ini_get("memory_limit") . "\n";
echo "Post Max Size: " .
ini_get("post_max_size") . "\n";
echo "Upload Max Size: " .
ini_get("upload_max_filesize") . "\n";
echo "Upload Progress: " .
ini_get("session.upload_progress.enabled") . "\n";
echo "Display Errors: " .
ini_get("display_errors") . "\n";
echo "Expose PHP: " .
ini_get("expose_php") . "\n";
echo "Runtime Status: LAB INFORMATION ONLY\n";This application displays selected runtime properties.
It does not execute system commands or expose a PHP information page.
4.6 Create a defensive PHP configuration
Create php.ini:
display_errors = Off
log_errors = On
expose_php = Off
memory_limit = 128M
post_max_size = 8M
upload_max_filesize = 8M
session.upload_progress.enabled = 0display_errors = Off
log_errors = On
expose_php = Off
memory_limit = 128M
post_max_size = 8M
upload_max_filesize = 8M
session.upload_progress.enabled = 0Configuration explanation:
Directive — — Purpose
display_errors — Prevent error details from being displayed to users
log_errors — Enable error logging
expose_php — Reduce PHP version disclosure
memory_limi — tSet a PHP memory limit
post_max_size — Limit POST request body size
upload_max_filesize — Limit uploaded file size
session.upload_progress.enabled — Disable upload-progress tracking
Disabling session upload progress is an additional mitigation for a documented uncommon exploitation vector. It is not a replacement for installing fixed PHP releases.
4.7 Start the container
docker pull php:8.4.28-apachedocker pull php:8.4.28-apacheExplanation:
docker pulldownloads the container image.php:8.4.28-apacheidentifies the PHP release and Apache variant.
Start the container:
docker run -d \
--name rebline-php-lab \
-p 127.0.0.1:8080:80 \
-v "$PWD/src:/var/www/html:ro" \
-v "$PWD/php.ini:/usr/local/etc/php/conf.d/99-rebline.ini:ro" \
php:8.4.28-apachedocker run -d \
--name rebline-php-lab \
-p 127.0.0.1:8080:80 \
-v "$PWD/src:/var/www/html:ro" \
-v "$PWD/php.ini:/usr/local/etc/php/conf.d/99-rebline.ini:ro" \
php:8.4.28-apacheImportant parameters:
-d: Run in the background.--name: Assign a container name.-p 127.0.0.1:8080:80: Bind the web service only to localhost.-v: Mount local files into the container.:ro: Mount files read-only.
The local-only binding is important because this laboratory does not need public network exposure.
4.8 Verify the container
docker psdocker psThen:
docker logs rebline-php-labdocker logs rebline-php-labThe first command displays running containers.
The second displays container startup logs.
5. Step-by-Step Practical Walkthrough
Step 1: Identify the PHP runtime
Objective:
Identify the PHP runtime version available inside the container.
Why it matters:
PHP installations can exist in multiple locations.
The CLI version may not be the same version used by the web application.
Command / Configuration:
docker exec rebline-php-lab php -vdocker exec rebline-php-lab php -vExpected Output:
Illustrative output:
PHP 8.4.28 (cli)
Zend Engine v4.4.xPHP 8.4.28 (cli)
Zend Engine v4.4.xThe exact Zend Engine patch-level information depends on the image.
Technical Explanation:
docker execexecutes a command inside an existing container.php -vdisplays the PHP CLI version.- The output identifies the command-line runtime.
Security Observation:
This confirms the container's CLI runtime version.
It does not independently establish the version used by every other PHP service on the host.
Screenshot / Image:
A terminal showing the Docker command and PHP version.
Next Step:
Inspect the active PHP configuration.
Step 2: Inspect PHP configuration
Objective:
Identify the configuration file and active configuration values.
Why it matters:
PHP security behavior depends on the active configuration.
Different SAPIs can load different configuration files.
Command / Configuration:
docker exec rebline-php-lab php --inidocker exec rebline-php-lab php --iniThen:
docker exec rebline-php-lab php -idocker exec rebline-php-lab php -iFor a focused review:
docker exec rebline-php-lab php -r '
echo "memory_limit=" . ini_get("memory_limit") . PHP_EOL;
echo "post_max_size=" . ini_get("post_max_size") . PHP_EOL;
echo "upload_max_filesize=" . ini_get("upload_max_filesize") . PHP_EOL;
echo "display_errors=" . ini_get("display_errors") . PHP_EOL;
echo "session.upload_progress.enabled=" .
ini_get("session.upload_progress.enabled") . PHP_EOL;
'docker exec rebline-php-lab php -r '
echo "memory_limit=" . ini_get("memory_limit") . PHP_EOL;
echo "post_max_size=" . ini_get("post_max_size") . PHP_EOL;
echo "upload_max_filesize=" . ini_get("upload_max_filesize") . PHP_EOL;
echo "display_errors=" . ini_get("display_errors") . PHP_EOL;
echo "session.upload_progress.enabled=" .
ini_get("session.upload_progress.enabled") . PHP_EOL;
'Expected Output:
memory_limit=128M
post_max_size=8M
upload_max_filesize=8M
display_errors=0
session.upload_progress.enabled=0memory_limit=128M
post_max_size=8M
upload_max_filesize=8M
display_errors=0
session.upload_progress.enabled=0Technical Explanation:
php --iniidentifies loaded configuration files.php -idisplays PHP configuration information.ini_get()retrieves the current value of a configuration directive.
Security Observation:
We can now inspect whether the intended defensive settings have been loaded.
Screenshot / Image:
Terminal showing PHP configuration values.
Next Step:
Verify the web-facing PHP runtime.
Step 3: Identify the web-facing runtime
Objective:
Determine the PHP version and SAPI used by the HTTP application.
Why it matters:
A CLI PHP version does not automatically represent the runtime serving HTTP requests.
This is an important source of false confidence during security assessments.
Command / Configuration:
curl -i http://127.0.0.1:8080/curl -i http://127.0.0.1:8080/Expected Output:
Illustrative response:
HTTP/1.1 200 OK
Content-Type: text/plain
REBLINE PHP SECURITY LAB
PHP Version: 8.4.28
PHP SAPI: apache2handler
Memory Limit: 128M
Post Max Size: 8M
Upload Max Size: 8M
Upload Progress: 0
Display Errors: 0
Expose PHP: 0
Runtime Status: LAB INFORMATION ONLYHTTP/1.1 200 OK
Content-Type: text/plain
REBLINE PHP SECURITY LAB
PHP Version: 8.4.28
PHP SAPI: apache2handler
Memory Limit: 128M
Post Max Size: 8M
Upload Max Size: 8M
Upload Progress: 0
Display Errors: 0
Expose PHP: 0
Runtime Status: LAB INFORMATION ONLYThe exact SAPI string depends on the PHP image and integration.
Technical Explanation:
curlsends an HTTP request.-iincludes response headers.127.0.0.1refers to the local machine.8080is the locally published port.
The application reads its own web-runtime information using PHP constants and configuration functions.
Security Observation:
The HTTP response establishes which runtime is handling this particular application request.
This is more relevant to the web application's security assessment than relying only on the host's CLI PHP version.
Screenshot / Image:
Terminal showing HTTP response headers and PHP runtime information.
Next Step:
Check the PHP security release baseline.
Step 4: Verify PHP patch status
Objective:
Compare the installed PHP release with the published fixed versions.
Why it matters:
The first security update for a branch is the minimum historical remediation baseline, not necessarily the latest recommended patch.
Command / Configuration:
docker exec rebline-php-lab php -r '
echo PHP_VERSION, PHP_EOL;
'docker exec rebline-php-lab php -r '
echo PHP_VERSION, PHP_EOL;
'The relevant first fixed versions were:
Branch — — First fixed release
PHP — 8.28.2.35
PHP — 8.38.3.36
PHP — 8.48.4.27
PHP — 8.58.5.12
PHP subsequently published additional security releases on November 19, 2026:
Branch — — Later security release
PHP — 8.28.2.36
PHP — 8.38.3.37
PHP — 8.48.4.28
PHP — 8.58.5.13
Technical Explanation:
The first fixed version indicates the release in which the original vulnerability fix appeared.
Later security releases may include additional corrections.
Organizations should follow the current release and supported package guidance for their environment.
Linux distributions may also backport security fixes without changing the upstream version string in the expected way.
Security Observation:
Do not conclude that an installation is vulnerable or secure using a simplistic version comparison alone.
Check the operating-system vendor's security advisory and package changelog.
Screenshot / Image:
A comparison table showing installed PHP release, fixed baseline, vendor patch status, and assessment result.
Next Step:
Inspect the web server and PHP process architecture.
Step 5: Inspect PHP worker architecture
Objective:
Identify the server integration and process architecture.
Why it matters:
Apache module execution and PHP-FPM have different worker-management behavior.
Command / Configuration:
For the Apache lab:
docker exec rebline-php-lab apachectl -Mdocker exec rebline-php-lab apachectl -MFor process inspection:
docker exec rebline-php-lab ps auxdocker exec rebline-php-lab ps auxExpected Output:
Illustrative process information:
USER PID COMMAND
root 1 apache2 -DFOREGROUND
www-data 20 apache2 -DFOREGROUND
www-data 21 apache2 -DFOREGROUNDUSER PID COMMAND
root 1 apache2 -DFOREGROUND
www-data 20 apache2 -DFOREGROUND
www-data 21 apache2 -DFOREGROUNDExact process identifiers and process layouts vary.
Technical Explanation:
apachectl -Mdisplays loaded Apache modules.ps auxdisplays running processes.www-datais a commonly used low-privilege web-server account.
Security Observation:
The PHP application should run with only the permissions required for its operation.
The web worker should not have unnecessary access to administrative files, deployment secrets, or unrelated applications.
Screenshot / Image:
Apache module list and process tree.
Next Step:
Evaluate application exposure and defensive configuration.
Step 6: Evaluate PHP security configuration
Objective:
Review security-relevant PHP configuration values.
Why it matters:
Additional hardening can reduce information exposure and constrain some attack paths.
Command / Configuration:
docker exec rebline-php-lab php -r '
$settings = [
"display_errors",
"log_errors",
"expose_php",
"memory_limit",
"post_max_size",
"upload_max_filesize",
"session.upload_progress.enabled"
];
foreach ($settings as $setting) {
printf(
"%-40s %s\n",
$setting,
ini_get($setting)
);
}
'docker exec rebline-php-lab php -r '
$settings = [
"display_errors",
"log_errors",
"expose_php",
"memory_limit",
"post_max_size",
"upload_max_filesize",
"session.upload_progress.enabled"
];
foreach ($settings as $setting) {
printf(
"%-40s %s\n",
$setting,
ini_get($setting)
);
}
'Expected Output:
display_errors 0
log_errors 1
expose_php 0
memory_limit 128M
post_max_size 8M
upload_max_filesize 8M
session.upload_progress.enabled 0display_errors 0
log_errors 1
expose_php 0
memory_limit 128M
post_max_size 8M
upload_max_filesize 8M
session.upload_progress.enabled 0Technical Explanation:
The code uses an array of configuration names and loops through each setting.
printf() formats the output.
The script is read-only and does not modify PHP configuration.
Security Observation:
A defensive configuration review should be documented alongside the PHP version assessment.
Configuration hardening does not replace a fixed runtime.
Screenshot / Image:
PHP security configuration review.
Next Step:
Review logs for suspicious behavior.
Step 7: Investigate suspicious application activity
Objective:
Identify unusual web-server errors and PHP worker activity.
Why it matters:
Memory exhaustion, repeated HTTP 500 responses, unexpected worker restarts, and unusual requests can provide useful investigation signals.
They are not independently proof of exploitation.
Command / Configuration:
Inspect Apache logs:
docker logs --since 1h rebline-php-labdocker logs --since 1h rebline-php-labCheck recent container events:
docker events --since 1hdocker events --since 1hCheck process status:
docker exec rebline-php-lab ps auxdocker exec rebline-php-lab ps auxExpected Output:
Normal laboratory activity should produce routine startup and HTTP request records.
If the service encounters an error, logs may contain an error message or HTTP failure information.
Technical Explanation:
docker logsdisplays application-container output.--since 1hrestricts the displayed period.docker eventsdisplays Docker lifecycle events.ps auxprovides a process snapshot.
For a real production investigation, also collect Apache, Nginx, PHP-FPM, operating-system, and endpoint telemetry.
Security Observation:
Look for correlated indicators rather than treating one HTTP 500 response as evidence of an attack.
Screenshot / Image:
Apache logs and process monitoring output.
Next Step:
Build a defensive detection workflow.
Step 8: Verify the final security state
Objective:
Confirm that the laboratory is using the intended runtime and configuration.
Why it matters:
Security remediation should produce evidence that can be independently reviewed.
Command / Configuration:
docker exec rebline-php-lab php -v
curl -s http://127.0.0.1:8080/
docker psdocker exec rebline-php-lab php -v
curl -s http://127.0.0.1:8080/
docker psExpected Output:
A running container, the expected PHP release, and the intended security configuration.
Technical Explanation:
The three checks validate:
- CLI runtime information.
- Web-facing runtime information.
- Container availability.
The web-facing runtime check is particularly important because the application may use a different PHP SAPI from other processes.
Security Observation:
A successful laboratory verification is not proof that another production system is patched.
Repeat the same assessment for each deployed PHP runtime and application.
Screenshot / Image:
Final assessment evidence with runtime version, SAPI, and configuration.
Next Step:
Document the findings and create a remediation record.
6. Technical Analysis
6.1 How PHP2Shell works conceptually
The underlying research can be understood through four stages.
Stage 1: Request processing
The PHP runtime accepts and processes request data.
Stage 2: Fatal error handling
Certain memory-management paths encounter an out-of-memory or fatal-error condition.
Stage 3: Invalid internal state
Improper cleanup or state handling can leave memory or internal references inconsistent.
Stage 4: Security consequence
Under specific conditions, subsequent processing may expose sensitive memory or permit remote code execution.
This is a conceptual description of the vulnerability classes, not an operational exploit sequence.
6.2 Why memory safety matters
Memory-safe programming requires that applications and runtimes correctly manage:
- Allocation.
- Deallocation.
- Pointer validity.
- Object lifetime.
- Buffer boundaries.
- Initialization.
- Cleanup.
- Error recovery.
Errors in these areas can create serious security weaknesses.
6.3 What does the research establish?
The published research reports demonstrations of:
- Pre-authentication remote code execution.
- Application-agnostic memory disclosure.
- Multiple affected PHP application environments.
- Different exploitation characteristics across runtime configurations.
The vulnerabilities exist in PHP core, so the issue should not be treated as exclusively a WordPress vulnerability.
6.4 Important limitations
Security assessment results should account for:
- PHP version.
- PHP build.
- Operating system.
- SAPI.
- Apache or PHP-FPM configuration.
- Worker management.
- Memory limits.
- Session configuration.
- Application behavior.
- Vendor security backports.
6.5 False-positive considerations
A security scanner might report a PHP installation as vulnerable based on its visible version.
However:
- A distribution may have backported the fix.
- A runtime may not be the one serving the application.
- Multiple PHP versions may be installed.
- A container may use a different PHP release.
- The application may use a separate PHP-FPM pool.
- A version banner may be inaccurate or hidden.
Therefore, combine version discovery with package-level verification and web-runtime inspection.
6.6 Why ordinary application scanning may be insufficient
An application scanner generally evaluates application-visible behavior.
However, PHP2Shell concerns the underlying runtime.
A scanner that only tests application endpoints may not accurately determine the security status of every PHP runtime on a host.
A mature assessment should combine:
- Application testing.
- Runtime inventory.
- Package verification.
- Container inspection.
- Configuration review.
- Vendor advisory comparison.
7. Detection and Mitigation
7.1 Primary remediation: Update PHP
The most important defensive action is installing the PHP security updates.
The first fixed versions were:
- 8.2.35
- 8.3.36
- 8.4.27
- 8.5.12
As of November 24, 2026, later security releases listed by PHP include:
- 8.2.36
- 8.3.37
- 8.4.28
- 8.5.13
Check the official PHP release archive and the security guidance from your operating-system or hosting provider before selecting a production update.
Official release archive:
https://www.php.net/archive/2026.php
Important: Updating WordPress, Drupal, Laravel, or another application does not necessarily update the PHP runtime underneath it.
7.2 Temporary defensive measures
If immediate patching is not possible, review the official PHP guidance.
Potential supplementary controls include:
Disable session upload progress where unnecessary:
session.upload_progress.enabled = 0session.upload_progress.enabled = 0Prevent PHP errors from being displayed publicly:
display_errors = Off
log_errors = Ondisplay_errors = Off
log_errors = OnRestrict HTTP request size appropriately:
post_max_size = 8M
upload_max_filesize = 8Mpost_max_size = 8M
upload_max_filesize = 8MThese values are examples, not universal production recommendations.
The PHP advisory also discusses memory-limit handling, fatal-error backtraces, and worker reuse.
These mitigations have operational trade-offs and do not replace security updates.
In particular, setting:
memory_limit = -1memory_limit = -1is not a general recommendation. It removes PHP's finite memory limit and transfers resource-exhaustion handling to the operating system, potentially affecting availability.
7.3 Application isolation
Use least privilege.
Recommended controls:
- Run PHP under a dedicated low-privilege account.
- Restrict application directory permissions.
- Keep secrets outside publicly accessible directories.
- Restrict database permissions.
- Isolate applications using containers or other suitable boundaries.
- Restrict outbound network connectivity where practical.
- Apply SELinux or AppArmor policies where compatible.
- Avoid running web applications as root.
7.4 Detection opportunities
The following indicators can help identify suspicious activity.
Indicator — — Investigation objective
Unusual multipart requests — Examine request patterns
Unexpectedly large PHPSESSID cookies — Investigate possible memory disclosure
Repeated HTTP 500 responses — Review PHP errors and request context
PHP memory-limit errors — Determine whether resource exhaustion is legitimate
Unexpected worker restarts — Investigate process instability
PHP spawning shell interpreters — Review possible server-side command execution
Unusual outbound connections — Investigate possible compromise
Unexpected file modifications — Examine integrity and persistence
No single indicator proves PHP2Shell exploitation.
7.5 Example Sigma-style detection
The following rule is a generic process-behavior detection example.
It looks for a web-server process launching a shell interpreter.
It is not a signature for the specific PHP2Shell CVEs.
title: Web Server Spawning Shell Interpreter
id: 58d1c7d9-5b9a-4e20-a1c8-123456789012
status: experimental
description: >
Detects possible shell execution by a web
server or PHP worker process.
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|endswith:
- '/apache2'
- '/httpd'
- '/php-fpm'
selection_child:
Image|endswith:
- '/sh'
- '/bash'
- '/dash'
condition: selection_parent and selection_child
falsepositives:
- Authorized maintenance scripts
- Expected application subprocesses
- Administrative automation
level: hightitle: Web Server Spawning Shell Interpreter
id: 58d1c7d9-5b9a-4e20-a1c8-123456789012
status: experimental
description: >
Detects possible shell execution by a web
server or PHP worker process.
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|endswith:
- '/apache2'
- '/httpd'
- '/php-fpm'
selection_child:
Image|endswith:
- '/sh'
- '/bash'
- '/dash'
condition: selection_parent and selection_child
falsepositives:
- Authorized maintenance scripts
- Expected application subprocesses
- Administrative automation
level: highDeployment notes:
- Field names depend on the endpoint telemetry provider.
- Process ancestry may be recorded differently.
- Some legitimate applications spawn subprocesses.
- Correlate the alert with the executable path, command line, user, network activity, and parent process.
7.6 SIEM investigation workflow
WEB REQUEST LOGS
|
v
HTTP ANOMALY REVIEW
|
v
PHP ERROR CORRELATION
|
v
PROCESS TREE ANALYSIS
|
v
NETWORK ACTIVITY REVIEW
|
v
INCIDENT TRIAGE
|
+------+------+
| |
v v
Expected Suspicious
Activity Activity
| |
v v
Document Contain
Investigate
RemediateWEB REQUEST LOGS
|
v
HTTP ANOMALY REVIEW
|
v
PHP ERROR CORRELATION
|
v
PROCESS TREE ANALYSIS
|
v
NETWORK ACTIVITY REVIEW
|
v
INCIDENT TRIAGE
|
+------+------+
| |
v v
Expected Suspicious
Activity Activity
| |
v v
Document Contain
Investigate
Remediate7.7 Incident response
If exploitation is suspected:
- Preserve relevant logs.
- Identify affected PHP runtimes.
- Determine the exposure period.
- Review unusual authentication activity.
- Examine PHP worker process ancestry.
- Review unexpected file modifications.
- Investigate outbound connections.
- Identify exposed application secrets.
- Rotate potentially compromised credentials.
- Apply security updates.
- Verify the integrity of affected systems.
- Retest and document recovery.
If sensitive process memory may have been exposed, assess credentials and tokens that could have existed in that memory.
8. Advanced Research and Innovation
8.1 Research direction: PHP Runtime Exposure Intelligence
A useful defensive research opportunity is a unified PHP runtime assessment platform.
The proposed platform would collect information from:
- Host operating systems.
- Apache configurations.
- Nginx configurations.
- PHP-FPM pools.
- Docker images.
- Kubernetes workloads.
- Cloud-hosted applications.
- Software package inventories.
The system would correlate each runtime against vendor security advisories.
8.2 Proposed architecture
ASSET DISCOVERY
|
v
PHP RUNTIME INVENTORY
|
+--------+--------+
| | |
v v v
Apache PHP-FPM Containers
| | |
+--------+--------+
|
v
VERSION CORRELATION
|
v
SECURITY ADVISORIES
|
v
EXPOSURE ANALYSIS
|
+--------+--------+
| |
v v
RED TEAM BLUE TEAM
Assessment Monitoring
| |
+--------+--------+
|
v
REMEDIATION CHECK
|
v
VERIFIED SECURITYASSET DISCOVERY
|
v
PHP RUNTIME INVENTORY
|
+--------+--------+
| | |
v v v
Apache PHP-FPM Containers
| | |
+--------+--------+
|
v
VERSION CORRELATION
|
v
SECURITY ADVISORIES
|
v
EXPOSURE ANALYSIS
|
+--------+--------+
| |
v v
RED TEAM BLUE TEAM
Assessment Monitoring
| |
+--------+--------+
|
v
REMEDIATION CHECK
|
v
VERIFIED SECURITYThis is a proposed architecture, not an existing standardized product.
8.3 Research improvement 1: Multi-runtime discovery
Many environments have more than one PHP installation.
For example:
Host
|
+-- PHP CLI
|
+-- Apache PHP Module
|
+-- PHP-FPM Pool A
|
+-- PHP-FPM Pool B
|
+-- Docker PHP Runtime
|
+-- Kubernetes PHP WorkloadHost
|
+-- PHP CLI
|
+-- Apache PHP Module
|
+-- PHP-FPM Pool A
|
+-- PHP-FPM Pool B
|
+-- Docker PHP Runtime
|
+-- Kubernetes PHP WorkloadAn assessment should discover each runtime separately.
A secure CLI version does not prove that the web-facing runtime is also secure.
8.4 Research improvement 2: Container image verification
A container may continue using an outdated PHP image even after the host operating system has been updated.
A defensive pipeline should:
- Identify all running containers.
- Extract the PHP image reference.
- Inspect the installed PHP version.
- Check the image's build date and provenance.
- Compare the runtime against security advisories.
- Rebuild and redeploy updated images.
- Verify the running container after deployment.
8.5 Research improvement 3: Runtime-aware vulnerability management
Traditional vulnerability management often focuses on software names and versions.
A more complete system should also identify:
- Runtime type.
- Process model.
- Loaded extensions.
- Active configuration.
- Application mapping.
- Worker configuration.
- Container boundaries.
This provides more useful assessment context.
8.6 Research improvement 4: AI-assisted security analysis
AI can assist security teams with:
- Parsing PHP security advisories.
- Comparing package versions.
- Generating investigation checklists.
- Summarizing configuration differences.
- Mapping affected applications.
- Drafting remediation reports.
- Explaining memory-safety concepts.
AI-generated vulnerability conclusions must still be verified using authoritative vendor information.
8.7 Research improvement 5: Memory-safety testing
An advanced research program could study:
- PHP memory allocation behavior.
- Error recovery.
- Request shutdown.
- Worker lifecycle.
- Memory sanitization
- AddressSanitizer.
- UndefinedBehaviorSanitizer.
- Regression testing.
These investigations should be performed on isolated, instrumented builds using approved test cases and non-production environments.
The broader research question is:
How can runtime security testing identify memory-management defects before they become remotely exploitable vulnerabilities?
9. Key Takeaways
- PHP2Shell is associated with two critical PHP core vulnerabilities.
- CVE-2026–109618 involves out-of-memory handling and memory corruption.
- CVE-2026–109619 involves stale global state and use-after-free behavior.
- Both vulnerabilities can have serious remote security consequences.
- The problem exists in PHP core, not exclusively in WordPress or another CMS.
- Different PHP SAPIs and worker models must be assessed independently.
- CLI PHP versions do not necessarily represent web-facing PHP versions.
- Vendor security updates are the primary remediation.
- Configuration hardening provides additional protection but does not replace patching.
- Detection requires correlation across HTTP, PHP, process, and network telemetry.
- Least privilege reduces the impact of successful application compromise.
- Post-remediation verification is essential.
10. Conclusion
PHP2Shell demonstrates how vulnerabilities in a widely deployed runtime can create security risks across many different applications.
The important lesson is that application security cannot be separated from runtime security.
An application may follow secure coding practices and still inherit risks from the interpreter, operating system, libraries, and deployment environment beneath it.
For penetration testers, this reinforces the importance of runtime-aware assessments.
For red teams, it demonstrates why authorized infrastructure and software-version assessment must accompany application testing.
For blue teams, it highlights the importance of patch management, process monitoring, and application isolation.
For security architects, it emphasizes the value of least privilege, secure runtime configuration, and continuous software inventory.
The most valuable lesson is not simply that PHP2Shell can lead to remote code execution.
It is that organizations must understand what software actually executes their applications, verify that it is maintained, and retain evidence that remediation is complete.
Secure the runtime. Protect the application. Verify the environment.
11. References and Further Learning
Primary PHP2Shell research
- PHP2Shell Research Hub https://www.php2shell.com/
- Calif Research — PHP2Shell: A Tale of Two PHP Remote Vulnerabilities https://calif.io/php2shell/
- Wiz Research — PHP2Shell research and exploitation analysis https://www.wiz.io/
- PHP Official Security Releases https://www.php.net/archive/2026.php
- PHP Security Advisory Archive https://www.php.net/security/
Security advisories
- CVE-2026–109618 https://www.cve.org/CVERecord?id=CVE-2026-109618
- CVE-2026–109619 https://www.cve.org/CVERecord?id=CVE-2026-109619
- Palo Alto Networks Unit 42 — PHP2Shell Threat Brief https://unit42.paloaltonetworks.com/
- Wiz — PHP2Shell Exploitation Attempts and Remediation Trends https://www.cve-db.com/article/php2shell-exploitation-attempts-and-remediation-trends-817674af
Technical documentation
- PHP Manual — Configuration https://www.php.net/manual/en/configuration.php
- PHP Manual — PHP-FPM https://www.php.net/manual/en/install.fpm.php
- PHP Manual — Sessions https://www.php.net/manual/en/book.session.php
- PHP Manual — Error Handling https://www.php.net/manual/en/book.errorfunc.php
- Docker Documentation https://docs.docker.com/
Security frameworks
- OWASP Web Security Testing Guide https://owasp.org/www-project-web-security-testing-guide/
- MITRE ATT&CK — Exploit Public-Facing Application (T1190) https://attack.mitre.org/techniques/T1190/
- MITRE ATT&CK — Command and Scripting Interpreter (T1059) https://attack.mitre.org/techniques/T1059/
- Sigma Detection Rules https://sigmahq.io/
- NIST SP 800–115 — Technical Guide to Information Security Testing and Assessment https://csrc.nist.gov/pubs/sp/800/115/final
Research methodology note
This article combines publicly documented PHP2Shell research with an original defensive assessment workflow and an illustrative isolated laboratory. The laboratory does not demonstrate exploitation of either CVE. Its outputs are examples and should be replaced with genuine screenshots and execution evidence before publication.
All security testing must be performed on systems you own or have explicit authorization to assess.
Rebline CyberSec
SECURITY · RESEARCH · LEARNING
Understand the vulnerability. Assess the runtime. Strengthen the defense.