PHP2Shell Explained: The PHP Flaw Found With AI, and What to Do About It
Two critical PHP flaws, found with the help of AI, put much of the web at risk. What is confirmed, how to fix it today, and what AI-powered attacks mean next.
Key takeaways
- PHP2Shell is two critical flaws (CVE-2026-109618 and CVE-2026-109619) in PHP itself, so sites built on WordPress, Drupal, Joomla, Magento and similar software can be exposed until PHP is updated.
- Fixed versions are 8.2.35, 8.3.36, 8.4.27 and 8.5.12. PHP 8.1 and older get no normal update, so they need a vendor fix or an upgrade.
- Attack attempts are real, but proof of successful break-ins at scale is still missing, and the public exploits are unreliable. Act now, but there is no need to panic.
- The figure of about 70% of the web measures how much of the web uses PHP. It does not measure how many sites are vulnerable.
- AI helped find this bug and is also making attacks cheaper, so the time between a disclosed flaw and the first attacks keeps shrinking. Automatic updates matter more than ever.
The short version
On October 21, 2026, the team behind PHP released emergency updates for two critical security flaws that are now called PHP2Shell. PHP is the programming language behind a very large part of the web, including WordPress, so a flaw in PHP itself matters far beyond one plugin or one website.
The flaws can let an attacker run their own code on a web server without logging in. They were found with the help of AI tools, and within hours of the news spreading, security companies were reporting waves of automated attacks. What many headlines skip is how many of those attempts have actually worked, and the honest answer right now is that nobody has shown it at scale.
This guide covers what happened, what is confirmed and what is not, how to check and fix your own site, and what AI-assisted hacking could mean in the months ahead. It is a fast-moving story. This page was last updated on October 24, 2026, and we will keep correcting it as better information arrives.
If you only have two minutes, do this: find out which PHP version your website uses, compare it with the table below, and ask your host to confirm the patch if you are not sure.
What PHP2Shell actually is
PHP2Shell is a nickname for two separate bugs in the PHP engine, the part of the software that reads and runs PHP code. PHP rated both 9.2 out of 10 on the CVSS v4.0 scale, which is the top end of critical. The security firm watchTowr rated them 10.0, but that was its own score, not PHP's.
The first flaw, CVE-2026-109618, is about running out of memory. When PHP cannot get the memory it needs partway through starting a request, it stops abruptly and then cleans up using data that was only half prepared. Researchers at Rapid7 explain that a specially built upload request can push PHP into that state even when the request looks small enough to be allowed.
The second flaw, CVE-2026-109619, is about leftovers. A PHP worker handles many requests one after another. Sometimes a request ends badly, for example with a fatal error or a timeout, and a piece of memory is released but a pointer to it is left behind. The next request on the same worker can then use that stale pointer. Security people call this a use-after-free.
The worst case is the one in the nickname. An attacker gets a shell, which means they can run commands on your server. From there they could read files, steal stored passwords and keys, or plant a backdoor. Wiz, one of the companies that found the flaws, said an attacker could read passwords, tokens and API keys out of a PHP process's memory.
The weak spot is old. Reports say the flaws affect nearly every PHP version back to 5.4, and that signs of the memory problem were spotted in a 2024 security audit but not fixed, because nobody found a way to turn it into code execution at the time. Apache's mod_php setup is considered the highest risk, since one request can trigger the problem before your own site code even starts. PHP-FPM, php-cgi, FrankenPHP and LiteSpeed setups are affected too.
Which PHP versions are fixed
These are the versions that contain the fix. If you run any of these or newer, you are covered for these two flaws.
| PHP branch | Vulnerable | Fixed in | Notes |
|---|---|---|---|
| 8.5 | Before 8.5.12 | 8.5.12 | Current branch |
| 8.4 | Before 8.4.27 | 8.4.27 | |
| 8.3 | Before 8.3.36 | 8.3.36 | |
| 8.2 | Before 8.2.35 | 8.2.35 | Security support ends December 31, 2026 |
| 8.1, 8.0, 7.4 | All versions | No normal update | Source backports exist. Get a vendor fix or upgrade. |
| 7.3 and older | Reported affected back to 5.4 | No upstream fix announced | Upgrade, or rely on a vendor backport |
- Many Linux systems and hosts fix problems without changing the version number. This is called backporting, so a version string like 8.1.30 does not tell you whether you are safe.
- Check the package changelog for the two CVE numbers instead of trusting the version alone.
How AI found it, and why that is in the headline
Three groups found pieces of this independently, all around August, and all used AI. A California firm called Calif found the first problem on August 1 while taking part in an OpenAI project called Patch the Planet, using OpenAI's GPT-5.6 Sol model. The security company Wiz, which Google owns, found it on August 19 using several AI models plus its own tool. OpenAI then looked into it separately and found more. Fortune reports that they worked with the PHP Foundation and other companies on the fix.
Greg Brockman, OpenAI's president, said the bug had been in PHP for 14 years, and that a limited version of it had been seen in 2024 but was not considered important then. That is the part worth sitting with. People reviewed this code for over a decade and the dangerous path stayed hidden. AI tools, which can read huge amounts of code and test ideas quickly, connected the dots.
Wiz called it an AI inflection point in its own blog post. That is a company describing its own work, so read the wording with some caution. The underlying point still stands, and OpenAI made it too: the same abilities that help defenders find flaws before attackers do can also help attackers.
One note on sourcing. The AI details come from news reports and company blog posts, not from PHP's own advisory, so treat them as reported rather than independently verified.
Timeline of what happened
Times are in UTC. The order matters, because it shows how little time defenders had.
| When | What happened |
|---|---|
| August 1 | Calif finds the first flaw with AI help, according to Fortune. |
| August 19 | Wiz independently finds the flaws. |
| October 17 | Amazon says its telemetry caught a PHP2Shell exploit attempt, four days before the public release. |
| October 20 | Details leak. PHP posts an advance notice, and a proof-of-concept video is published by mistake. |
| October 21, early | Cloudflare switches on protective firewall rules by default. |
| October 21, 13:34 | Security advisories go up, shortly before the scheduled 14:00 release. Patches follow. |
| October 21, afternoon | watchTowr reports active exploitation attempts. Cloudflare says attempts grew from tens of thousands within 45 minutes to millions by evening. |
| October 22 | Sansec revises its view: mass exploitation is less likely than first expected, because the public exploits do not work on default setups. |
| October 23 | PHP publishes a separate issue, CVE-2026-115560. Rapid7 says a mitigation exists but no patch yet. |
What is confirmed, and what is not
This is where most coverage gets sloppy, so here it is as plainly as we can put it, based on what the sources say as of October 24.
- Confirmed: the two flaws are real, PHP rated them critical, and fixes exist for the supported branches.
- Confirmed: attack attempts have been recorded. Cloudflare, Amazon and watchTowr all report them, and several public proof-of-concept exploits exist.
- Not confirmed: that attackers have broken into sites at scale. Rapid7 has not observed exploitation in the wild, and The Hacker News reported that no source had confirmed a successful break-in of a specific server. CISA said on October 21 that it had not observed exploitation.
- Disputed: how easy it is. Rapid7 found that each public exploit works only for a particular mix of operating system, PHP version and web server. Sansec found they do not work against a default PHP install, and most need a separate bug in the target site. Rapid7 still expects a more portable technique to appear quickly.
- Misread: the 70% figure. About 69% of websites with a known server-side language use PHP, according to the figure cited on Wikipedia's incident page. That is PHP's popularity, not the number of vulnerable sites. Palo Alto Networks' early estimate was about 22.6 million potentially vulnerable instances, which is also an early figure.
Are you affected? A quick self-check
Find the row that looks like your setup.
| Your setup | Exposed? | What to do |
|---|---|---|
| WordPress, Drupal, Joomla, Magento or WooCommerce on shared hosting | Yes, if the host's PHP is not patched | Check your PHP version, then ask your host to confirm the patch. |
| A managed WordPress host | Possibly. Many patch for you. | Check the host's status page or ask support. |
| Your own server or VPS running PHP | Yes, until you update | Update the PHP package and restart PHP and the web server. |
| Docker or other containers with PHP | Yes, until the image is rebuilt | Rebuild and redeploy a patched image. |
| A site on Node.js, Python, Ruby or plain HTML | Not by this flaw, which is in PHP | Keep your own dependencies updated. |
| Behind Cloudflare or another firewall | Less exposed, not safe | Keep the rules on and patch anyway. |
How to check and fix your site, step by step
Do these in order. Most people finish the first five steps in well under an hour.
- Step 1: Find your PHP version. In WordPress, open Tools, then Site Health, then the Info tab, then Server. Hosting panels such as cPanel usually show it on a PHP version or PHP selector page. If you run your own server, remember that php -v only describes the command line copy of PHP. The copy that serves your site, such as PHP-FPM or Apache, can be a different build.
- Step 2: Compare it with the table above. If you are on a fixed version or newer, you are covered for these two flaws. If not, or if you are unsure, keep going.
- Step 3: Check for backported fixes. On Debian or Ubuntu, you can search the package notes for the CVE numbers with a command like apt changelog php8.3-cli | grep -E "CVE-2026-109618|CVE-2026-109619", using your own package name. On Red Hat style systems, rpm -q php-cli --changelog does the same job.
- Step 4: Update, then restart. Install the update from your host or package manager, then restart PHP-FPM, Apache and any long-running workers. A patch does nothing until the old processes are replaced. With containers, rebuild the image and redeploy, because patching a running container leaves the image itself vulnerable.
- Step 5: On shared hosting, ask your host. Send a short message asking whether the PHP2Shell patch for CVE-2026-109618 and CVE-2026-109619 is applied on your server. cPanel and CloudLinux have released backported fixes, so a good host may already be covered. If your host cannot give a clear answer, treat that as a warning sign.
- Step 6: If you cannot patch yet, use stopgaps, knowing they are incomplete. PHP's maintainers said updating is the only safe choice. Security firms list these temporary measures: turn off session upload progress (session.upload_progress.enabled=0) in server-level settings rather than in site code, then restart; on PHP 8.5 set fatal_error_backtraces=0; keep post_max_size low and limit request sizes at your web server or proxy; and if your site never accepts uploads, block multipart/form-data requests before they reach PHP. Some guidance also suggests memory_limit=-1, but that one is debated because it can raise memory use, so only use it on your host's advice.
- Step 7: Think about taking the site offline if you cannot patch soon and you hold sensitive data. The NSA, CERT-EU and the UK's NCSC advised that sites which cannot be updated promptly should go offline until they can. Sansec, writing about online stores, said that was not necessary for them. It depends on your risk.
- Step 8: Retest after patching. The fix adds a hard memory limit, so review memory_limit and post_max_size, then test your forms, checkout and file uploads.
- Step 9: Move off old versions. PHP 7.4, 8.0 and 8.1 get no normal updates, and PHP 8.2 security support ends on December 31, 2026. Plan a move to 8.3 or newer. Test plugins and themes on a staging copy first and keep a way to roll back.
- Step 10: Look for signs of trouble, especially if you were exposed for days. Researchers point to unusual multipart upload requests followed by memory limit errors or repeated HTTP 500 errors, very large PHPSESSID cookies, and PHP workers restarting for no clear reason. Rapid7 also notes that finding nothing in your logs does not prove you are safe.
- Step 11: If you think you were hit, assume secrets were exposed. Change passwords, rotate API keys and tokens, turn on two-factor sign-in and restore from a clean backup. Because the flaws can reveal data from PHP's memory, rotating secrets is sensible even when you cannot prove anything was taken.
What AI-assisted attacks look like so far
PHP2Shell is a story about AI helping to find a bug. The bigger worry is AI helping to use bugs. Reporting over the past few weeks, mostly from Reuters and Fortune, describes several incidents. Some details are still estimates, and we have marked them that way.
- A campaign that began on September 25 used autonomous AI agents to try to break into more than 1,200 websites and reportedly compromised about 100 companies, according to Reuters. Researchers estimated the cost at roughly 5,000 dollars of AI usage, or about 50 dollars per successful breach. The attacker has not been publicly identified in the reporting we read.
- Several South Korean banks were breached in October. Reuters reported the attackers were likely based in China, and the Wall Street Journal reported that data on an estimated 68,000 people was stolen. Reuters also reported that the attackers used a state-developed AI tool built on open models together with commercial AI coding tools. The attribution is described as likely, not confirmed, and the 68,000 figure is an estimate.
- Hugging Face was attacked by an autonomous agent in July. In the week of October 18, an AI agent attacked the coding tool OpenCode nonstop for 48 hours and compromised accounts for about 1.4% of its users, and some people lost up to 1,700 dollars, according to Fortune.
What the experts are saying
Jessica Ji, a senior research analyst at Georgetown's Center for Security and Emerging Technology, told Fortune that AI tools have gotten meaningfully better over the past year at tasks like analyzing large volumes of code. Varun Chandrasekaran, a professor at the University of Illinois, said the low cost of AI agents fundamentally changes the economics of exploitation. TJ Sayers of the Center for Internet Security said AI helps turn complex exploit chains into practical attacks.
Put those together and the picture is simple. Attacks used to be limited by human time and skill. A lot of the searching, testing and retrying can now be handed to software that works all night for a small fee. That does not make every attacker a genius. It makes mediocre attackers faster and more persistent.
What could happen next
Nobody can predict this exactly, and anyone who sounds certain is guessing. Based on what has already happened, these are the developments we think are most worth planning for. The last two are our own judgment, not reported facts.
- The patching window keeps shrinking. Security firms recorded attack attempts within hours of the news, and Amazon says it saw one days earlier. For a small site, waiting for a monthly maintenance day is no longer a safe plan. Automatic updates, or a host that patches for you, are the realistic answer.
- Unsupported software becomes a permanent target. PHP 7.4, 8.0 and 8.1 will not get normal fixes. As finding flaws gets cheaper, attackers have more reason to hunt in software that will never be patched.
- Public exploits will get better. Rapid7 and Sansec both say today's exploits are unreliable, and Rapid7 expects a more portable technique to appear quickly. The gap between attempts and real breaches may close.
- More old bugs will surface. The PHP flaw hid in code for more than a decade. Other widely used open-source projects hold code of a similar age that people have reviewed but never searched this thoroughly. We would expect more finds like this one. That is good news when defenders find them first, and a problem when the fix takes weeks to reach everyone.
- Defenders get the same help. This bug was found by researchers using AI before it was publicly used, and Linux distributions received patches ahead of the release. Faster discovery on the defending side is real too.
Three situations to plan for
These are our reading of the evidence, not predictions.
| Situation | What it looks like | What it means for you |
|---|---|---|
| Best case | Most sites patch within days. Public exploits stay unreliable. Few confirmed breaches. | A scare and a patch. You lose an hour. |
| Most likely | Steady background attacks for weeks or months against unpatched servers. Some breaches on neglected sites and old PHP versions. | Patched sites are fine. Neglected sites, often on cheap shared hosting, get hit. |
| Worst case | A reliable one-request exploit appears while many hosts are still unpatched. Mass compromise, stolen data, and spam or phishing sent from hijacked servers. | Expect downtime. Rotate secrets and restore from clean backups. |
A prevention plan that does not need a security team
None of this is exotic. These habits protect you against the next flaw as well as this one.
| Habit | Why it helps | Effort |
|---|---|---|
| Automatic updates for PHP, your CMS and plugins | Shrinks the time you are exposed | Low |
| Managed hosting that patches the server for you | You inherit a security team | Low |
| A web application firewall, such as Cloudflare's | Can block known attack patterns while you patch, though attackers adapt | Low |
| Offsite backups that you have tested | Lets you recover after a compromise | Medium |
| Separate secrets you can rotate, plus two-factor sign-in | Limits the damage if memory is read | Medium |
| Removing plugins and themes you do not use | Fewer places for bugs to hide | Low |
| Security notices from your CMS and host | You hear about problems first | Low |
- If you need to rotate secrets, the Secure Token Generator and Password Generator on this site create strong random values in your browser, and the TOTP Generator helps with two-factor codes.
- The Security Headers Analyzer and SSL/TLS Checker cover everyday site hygiene. None of our tools detects PHP2Shell, and we do not claim they do.
Mentioned in this post
Password Generator
Generate strong, truly random passwords, memorable passphrases, or PINs — built on the Web Crypto API instead of Math.random(), with guaranteed character coverage, bulk generation, and a live strength meter.
TOTP / 2FA Code Generator
Generate real-time TOTP (Time-based One-Time Password) codes from a Base32 secret key — the same algorithm every authenticator app uses — with live countdown, algorithm/digit/period controls, and otpauth:// URI import, entirely in your browser.
Secure Token / API Key Generator
Generate cryptographically secure random tokens in hex, Base64, Base64URL, or UUID v4 format using the browser's CSPRNG — for API keys, session secrets, and unique identifiers, with bulk generation and download.
HTTP Security Headers Analyzer
Fetch a URL's response headers and grade them against the OWASP Secure Headers baseline — CSP, HSTS, X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy, and the Cross-Origin-* isolation headers — with a letter grade and a plain-English reason behind every point.
SSL/TLS Configuration Checker
Connect live to a domain on port 443 to see which TLS protocol versions it accepts, the negotiated cipher, and full certificate details — issuer, expiry, trust status, and every domain it covers — from a real handshake, not a static lookup.
Frequently asked questions
Has my WordPress site been hacked because of PHP2Shell?
Not necessarily. Attack attempts have been widely reported, but as of the latest reports no source has confirmed a successful break-in of a specific server, and the public exploits only work under particular conditions. Patch first, then check for the warning signs listed above.
Do I need to take my website offline?
The NSA, CERT-EU and the UK's NCSC advised taking sites offline if they cannot be updated promptly. Sansec said online stores did not need to go offline. If your host can patch within a day or two and you can apply the temporary measures, many small sites will stay up. Decide based on how sensitive your data is.
Which PHP version should I use?
Use a patched build of a supported branch, such as 8.3.36, 8.4.27 or 8.5.12. PHP 8.2 works, but its security support ends on December 31, 2026, so 8.3 or newer gives you more time. Check that your plugins and themes support the version first.
Is it true that PHP2Shell puts 70% of the internet at risk?
That figure comes from PHP's popularity. About 69% of sites with a known server-side language use PHP, according to the figure cited on Wikipedia's incident page. It does not mean 70% of sites are vulnerable. An early estimate from Palo Alto Networks was about 22.6 million potentially vulnerable instances.
Does a firewall protect me?
It can help. Cloudflare switched on protective rules by default, but it also reported that attackers changed their payloads to get around them. Treat a firewall as extra cover while you patch, not a replacement for patching.
Are sites built with Node.js, Python or static files affected?
Not by these two flaws, because they are in PHP. Your own code and dependencies still need regular updates.
How do I know my host has patched?
Ask them to confirm the CVE numbers, and do not rely on the version string alone, because fixes are often backported. On servers you control, check the package changelog and restart PHP processes. Aikido offers a free checker for public URLs that reports whether a site is vulnerable, mitigated or patched.
What is CVE-2026-115560?
A separate PHP issue published on October 23. According to Rapid7, a mitigation exists but no patch had been released at the time, and exploiting it relies on a non-standard configuration. PHP said it had not seen exploitation. We will update this page when a fix ships.
Did attackers use AI to exploit PHP2Shell?
We found no confirmed reporting that AI was used to launch the PHP2Shell attacks. The AI link in this story is about finding the flaws. Separate incidents in recent weeks, such as the campaign against more than 1,200 websites, did involve AI agents according to Reuters.
Sources and further reading
The facts in this guide come from these pages. They are outside sites, and some of them update as the story develops.
- PHP2Shell (Wikipedia, live incident page)
- Rapid7: CVE-2026-109618 and CVE-2026-109619, critical unauthenticated remote code execution in PHP
- Sansec: PHP2Shell research and updates
- The Hacker News: PHP issues emergency patches for two critical PHP2Shell RCE flaws
- Fortune: AI tools discovered the PHP vulnerability, and the race is on to patch it
- Fortune: Powerful new AI models are powering a growing wave of cyberattacks
- Wordify: what the PHP security release means for your WordPress site
- Aikido: PHP2Shell fix guide and patched images
