November 29, 2026
PHP2Shell Explained in Plain English: Two Critical PHP Bugs
How two flaws deep inside PHPโs engine put millions of websites at risk in October 2026, and what every beginner should know about them.
By Jijo Shibu
11 min read
Web Server Security
On October 21, 2026, government websites in several countries quietly went offline. So did parts of some of the biggest names on the internet. Admins were not being dramatic. They were being careful.
The reason was PHP2Shell, the nickname for two serious bugs in PHP, the language behind a huge slice of the web. Some estimates say PHP powers around 70% of websites. If you have ever used WordPress, Drupal, or a hundred other web tools, you have probably touched PHP without knowing it.
Here is the unsettling part. These bugs were not in one website or one plugin. They were in the engine underneath.
The Mail Room Analogy
Picture a big office building. Visitors do not walk straight up to the departments. Every parcel goes through a mail room first. A clerk opens it, sorts it, and keeps notes on a desk. Only then does it go upstairs to the department, where a security guard checks who is allowed to do what.
PHP is that mail room clerk. The departments upstairs are the website's own code, with its login pages and its checks. Now imagine the clerk makes a mistake while sorting. The security guard upstairs never gets a chance to help, because the parcel never reached him.
Keep that mail room in mind. We will come back to it.
What Is PHP2Shell?
PHP2Shell is the name for two separate vulnerabilities in the PHP engine, called the runtime. Both can lead to remote code execution (RCE). That means a stranger on the internet could make your server run commands it was never meant to run.
Both flaws were given a CVSS v4.0 severity score of 9.2 out of 10. That is "critical" territory.
The name has "Shell" in it because a shell is what attackers dream of: a doorway into the machine. But a small note of honesty here. The nickname does not mean every attack gives total control. What an attacker could do depends on the server's permissions and setup. Even a small foothold on a web server can be a big deal, though.
๐ Key Terms Runtime โ The engine that actually runs your PHP code on the server. Remote Code Execution (RCE) โ When an attacker makes a computer run code of their choosing, from far away. CVE โ A public ID number given to a known security flaw, so everyone can talk about the same bug. CVSS โ A score from 0 to 10 that shows how severe a flaw is.
๐ก Think about it this way: you can lock every department upstairs, and it will not help if the mail room itself is broken.
But how can a mail room break? Let's meet the first bug.
Bug One: CVE-2026-109618 and the Overflowing Desk
Every request that reaches PHP gets some memory to work with, like a small desk for the clerk. PHP sets a limit on how big that desk is. When a parcel needs more space than the desk allows, PHP stops the job. This is called an out-of-memory (OOM) error.
Running out of memory is normal. Every program has to deal with it. The problem here was how PHP stopped.
In certain paths, the clerk gave up in the middle of sorting. A half-opened parcel was left on the desk. Then the cleanup crew arrived. They assumed every parcel on the desk was fully sorted, so they treated the half-finished one as ready and started tidying it away. But parts of it were never set up. The crew was cleaning up things that did not exist properly.
In software, this is memory corruption. Once memory is corrupted in the wrong way, a skilled attacker may be able to steer what happens next. In this case, that can end in code execution.
Which requests can push PHP into running out of memory? File uploads are one relevant area, because PHP has to build many small internal pieces to handle them. A request can look small on the outside but use much more memory on the inside. Having an upload form does not mean you were hacked, though. It is one way into the code path, not proof of an attack.
๐ Key Terms Out-of-memory (OOM) โ When a program asks for more memory than it is allowed to have. Memory corruption โ When a program's memory ends up in a broken or unexpected state. Multipart upload โ The standard way a browser sends files and form fields together.
So if running out of memory is normal, why was this one dangerous?
Because of what was left behind. Which brings us to the second bug.
Bug Two: CVE-2026-109619 and the Stale Sticky Note
The clerk keeps sticky notes on the desk. One says "current parcel is on shelf 12." When the shift ends, the clerk should peel off every note and wipe the desk clean.
PHP does something like this with its global state. Some of it points to memory that belongs to the current request. When the request ends, PHP is supposed to reset those pointers, then free the memory.
In this second bug, a fatal error could skip the reset step. The shelf got cleared and reused, but the sticky note still said "shelf 12." Then the next request handled by the same worker found the old note. It followed it to a place that now held something else entirely.
This is called a use-after-free bug. The program uses memory after it was handed back. Imagine following an old note to a room that has been completely rebuilt. You walk in expecting one thing and find something else. In the wrong hands, that can mean crashes, leaked data, or code execution.
This matters most when PHP reuses its workers for many requests. Reusing workers is great for speed. It also means one request's leftovers can reach the next.
๐ Key Terms Use-after-free โ A bug where a program keeps using memory after it was released. Global state โ Settings and notes the runtime keeps across its work, not just inside one task. Worker โ A PHP process that handles requests, often one after another.
How It Works, Step by Step
Here is the big picture at a high level, without any attack recipe:
Step 1: A request arrives at the web server and is passed to PHP.
Step 2: PHP starts sorting it, long before the website's own code runs.
Step 3: A specially shaped request pushes PHP into an error path, such as running out of memory.
Step 4: PHP's cleanup treats broken or stale notes as if they were fine.
Step 5: Memory ends up corrupted, or a later request follows a stale pointer.
Step 6: In the worst case, an attacker's code runs. No password was needed, because the website's login checks never even started.
Think of it like a mail room that mistakes a half-sorted parcel for a finished one, then lets the next shift follow an old sticky note into a rebuilt room.
Both bugs can happen before authentication. That is why this was so alarming. Your login page, your input checks, and your CMS rules sit upstairs. These flaws live downstairs.
What Happened in the Real World
The timeline reads like a thriller.
PHP published emergency fixes on October 21, 2026. But the story began earlier. Researchers had been reporting issues to the PHP team since the summer, and AI tools played a big role in finding them. Security teams reported that frontier AI models helped them turn old, hard-to-reach weaknesses into working findings. One report said the vulnerable code had been sitting there for more than a decade.
Attackers moved fast too. Amazon's threat team saw an attempt against its honeypot sensors on October 17, four days before the public fix. After the release, exploit attempts exploded. Cloudflare's CEO said they saw thousands of attempts in the hours before the announcement and then millions afterward.
On October 26, both CVEs were added to the CISA Known Exploited Vulnerabilities list. That list is for flaws attackers are really using, not just ones that could be used.
A few details are worth knowing. The disclosure itself was messy, with a planned embargo broken by early publication of some information. Days later, PHP also announced a third issue, CVE-2026-115560, which is a separate bug and not part of the PHP2Shell pair.
One more number sticks in the mind. Censys reported over 32 million services still using an affected PHP version days after the fix. That count is an upper limit, because Linux vendors often fix bugs without changing the version number. Still, it shows how long a patch can take to reach everyone.
Why It Matters
For everyday users: You may never know which PHP version your favorite sites run. If a site you use stores your email, address, or orders, a runtime bug can put that data in play, even if you did everything right.
For businesses: A hacked web server means downtime, lost trust, and a scramble to figure out what was touched. Many organizations pulled sites offline just to be safe, and that costs money and reputation.
For developers and builders: Writing safe application code is not enough. Your login checks cannot protect you if the engine below them breaks. The runtime is part of your security boundary.
For regulators and compliance teams: If personal data is exposed through an unpatched known flaw, "we did not know" becomes a hard answer. Patch records and inventories matter.
Why It Matters for Sysadmins and Defenders
This is the section to bookmark. If you run anything that uses PHP, here is the practical checklist.
- Find every PHP runtime. Check servers, containers, shared hosting, staging, and any software that bundles PHP inside it. Do not stop at one website.
- Update to a fixed version. The fixed releases are 8.5.12, 8.4.27, 8.3.36, and 8.2.35. Older branches like 8.1 and below no longer get upstream fixes, so ask your vendor about backports or plan a move.
- Restart or replace workers. Updating files on disk does not change a process that is already running. Old PHP workers keep running old code until they restart. For containers, redeploy and confirm the old ones are gone.
- Verify what is actually running. On Ubuntu, a command like
apt list '?installed ?name(^php[0-9.]+$)'shows installed PHP packages. Remember that the command line PHP and the web-serving PHP can be different installs. - Look back in your logs. The first known attempt was seen on October 17, so review from then on. Look for odd POST requests, strange child processes, and unexpected outbound connections.
- Use a WAF as a backstop, not a fix. A web application firewall can block some patterns while you patch. It cannot repair PHP's memory handling.
- Limit blast radius. Give PHP the fewest permissions it needs, and keep secrets and cloud roles narrow.
Pro Tip: Patching is like fixing the mail room, but you also have to check whether anyone slipped through while it was broken. Fix first, then investigate.
Common Misconceptions
- "My plugins are updated, so I'm safe." Plugins and your CMS sit upstairs. These bugs live in the runtime downstairs, so you need to update PHP itself.
- "Every upload form means I was hacked." An upload form is a possible route, not proof of an attack. Being vulnerable, being scanned, being attacked, and being compromised are four different things.
- "A WAF solves this." A firewall can reduce risk for a while. Only a fixed PHP version completes the repair.
Key Takeaways
- PHP2Shell is two critical PHP engine bugs,
CVE-2026-109618andCVE-2026-109619, both scored 9.2. - One comes from unsafe cleanup after running out of memory. The other comes from a stale pointer surviving across requests.
- Both happen early, before a website's own login and checks, which is why app-level security is not enough.
- The fix is to update PHP, restart the workers, verify the version, and check the logs.
- Attacks started before the public fix, so always look back before the disclosure date.
โ ๏ธ Going Deeper
If the basics clicked and you want to go further, here's what to explore next:
- Use-after-free bugs โ One of the most studied memory-safety flaw types, and a good next topic for any beginner in exploit research.
- Coordinated disclosure โ How researchers and maintainers try to release fixes quietly, and why PHP2Shell's embargo was a hot debate.
- CISA KEV catalog โ A real list of flaws known to be used in attacks, useful for deciding what to patch first.
- PHP-FPM vs Apache mod_php โ Different ways of running PHP, with different exposure. The advisories describe mod_php as the highest-risk setup for the demonstrated path.
- Official write-ups โ Read the PHP security advisories, Wiz Research's technical analysis, and the TryHackMe PHP2Shell room for hands-on learning in a safe lab.
๐ง Quick Knowledge Check
Try answering these before scrolling to the answer key โ you'll be surprised how much stuck!
- What are the two CVE numbers that make up PHP2Shell?
- What does RCE stand for?
- In our mail room analogy, what do the departments upstairs represent?
- Why can PHP2Shell succeed even when a website's login and input checks are strong?
- What went wrong in
CVE-2026-109618after PHP ran out of memory? - What does "use-after-free" mean in simple terms?
- Why do reused PHP workers make the stale-state bug more important?
- Name two of the fixed PHP versions released on October 21, 2026.
- Why is updating files on disk not enough after patching PHP?
- ๐ Research question: What is the CISA Known Exploited Vulnerabilities (KEV) catalog, and on what date were the PHP2Shell CVEs added to it?
๐ Answer Key
No peeking before you've tried! Answers are here to confirm, not replace, your thinking.
Q1: CVE-2026-109618 and CVE-2026-109619.
Q2: Remote Code Execution.
Q3: The website's own code, with its login pages and security checks.
Q4: The bugs live in the PHP engine and can trigger before the website's code runs, so those checks never get a chance to stop the request.
Q5: The cleanup code treated half-set-up memory as if it were ready, which could lead to memory corruption.
Q6: A program keeps using a piece of memory after it has already been given back, like following a note to a room that has been rebuilt.
Q7: One request's leftover state can reach the next request handled by the same worker.
Q8: Any two of 8.5.12, 8.4.27, 8.3.36, or 8.2.35.
Q9: Running PHP workers keep using the old code until they are restarted or replaced.
Q10: The CISA KEV catalog is a public list of vulnerabilities that are known to be exploited in real attacks, and the PHP2Shell CVEs were added on October 26, 2026. Check CISA's site to confirm and read the details.
The scariest bugs are not always in the code we write. Sometimes they hide in the quiet mail room we never see, and the real lesson of PHP2Shell is to know what runs underneath your website, and keep it fixed.
If you found this useful, give it a clap ๐ โ it helps more people discover it. And if you have questions, drop them in the comments. I read every one.
Want to talk cybersecurity, share resources, or just connect? Find me on LinkedIn โ I'm always happy to connect with curious minds.