← Cocha Insights

PHP2Shell: Why Two Critical PHP Flaws Put AI Integrations at Risk

PHP2Shell vulnerability illustration showing a PHP-based AI gateway connected to enterprise data, with exposed API keys, access tokens and app permissions.

Updated October 31, 2026. First published October 21, 2026.

In this post

  1. PHP2Shell: the fix in one paragraph
  2. How to check if you’re affected
  3. What PHP disclosed
  4. What changed since October 21
  5. The gateway nobody filed under AI
  6. What an attacker gets
  7. A 15-minute triage for executives
  8. What IT should do now
  9. Quick answers
  10. Where this leaves your firm

1. PHP2Shell: the fix in one paragraph

PHP2Shell is the nickname for CVE-2026-109618 and CVE-2026-109619, two critical flaws that let an unauthenticated request run code on a PHP server. PHP fixed both on October 21, 2026, in versions 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Anything older on those branches is vulnerable. Both flaws carry a CVSS v4.0 score of 9.2. See the NVD records for CVE-2026-109618 and CVE-2026-109619. PHP 8.1 and earlier get no updates from the PHP project, so those servers need a vendor backport or an upgrade. PHP says updating is the only complete fix.

2. How to check if you're affected

Start with where PHP runs. Then find out which version is answering web requests, because the two answers often differ.

Find the PHP-based systems. List what serves web traffic on your side. That means WordPress and other CMS sites, intranets, internal tools and webhook receivers. It also means any small gateway someone built to connect a document system to an AI model. A Next.js front end, a Node API or a Python agent service isn’t touched by these CVEs. Then ask your vendors which of their products run PHP under the hood. You can’t patch those yourself.

Check the version the web server uses. The command line build that php -v reports can differ from the one behind Apache or PHP-FPM. Check the web-facing runtime instead: your hosting panel, the PHP version your CMS health tool shows, or php-fpm -v for FPM. In a container, check the running container and its image digest. A latest tag doesn’t prove the image was rebuilt.

Know your runtime type. PHP lists every installation serving web requests as at risk, including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. It rates mod_php highest, where an unauthenticated request can trigger the attack before any application code runs.

Read the version string carefully. Linux distributions and LTS vendors got the patches ahead of release, and backported builds often keep an older version number. A package showing 8.3.30 may be patched, or may not be. Check your distribution’s security advisory for the CVE IDs rather than trusting the number.

If you’re on 8.1 or earlier. PHP published minimal source backports for 7.4, 8.0 and 8.1 for people who build from source or have no LTS vendor. Otherwise, ask your vendor for a backported package or plan the upgrade.

A third party “PHP2Shell checker” doesn’t replace these steps. Don’t paste server details into a site you haven’t vetted, and don’t run scanners against systems you don’t own.

3. What PHP disclosed

Details leaked on October 20, ahead of a coordinated disclosure. The PHP security team pulled its release forward and published its security advisory on October 21.

CVE-2026-109618 is remote code execution through out-of-memory corruption. Malformed multipart requests can drive PHP to run out of memory while request data is only partly set up, and the cleanup routine then treats that bad data as valid. Under Apache mod_php this happens during request startup, before any application script loads.

CVE-2026-109619 is remote code execution through stale global state. State owned by one request survives into the next request handled by the same worker, after its memory has been freed.

Versions 8.1 and older no longer get upstream releases. Your vendor may already have a package, since distributions received the patches early.

4. What changed since October 21

Exploitation status was still moving as of October 21. watchTowr reported exploitation attempts against both CVEs in its honeypot network, and Huntress said it had not seen exploitation on partner systems as of that afternoon. Attempts aren’t breaches. They do mean the patch window is short. On October 26, CISA added CVE-2026-109618 and CVE-2026-109619 to its Known Exploited Vulnerabilities catalog, with an October 29 due date for federal civilian agencies, and updated its PHP alert to say so.

October 23: PHP informational advisory. PHP suggested setting session.upload_progress.enabled=0 until its next regular bugfix release, to close an unlikely further route. That setting was already a listed mitigation for CVE-2026-109619. The route needs an unusual setup, where an application changes the session serialize handler at runtime. PHP says a full advisory for a separate CVE, CVE-2026-115560, will come with that release.

October 26: updated Windows builds. PHP released 8.5.12-1, 8.4.27-1, 8.3.36-1 and 8.2.35-1 to bundle Brotli 1.2.1, which fixes CVE-2026-111497, a separate out-of-bounds write in Brotli decompression. In Windows builds it’s reachable through the cURL extension when automatic response decompression is turned on. That’s off by default in cURL, though applications can enable it. The PHP source and version numbers are unchanged. On Windows, take the rebuild.

5. The gateway nobody filed under AI

Picture a firm that wanted Claude or Azure OpenAI wired into its document workflow quickly. Someone builds a small internal gateway in PHP, because the team knows PHP or because it bolts onto an existing intranet. The gateway stores an API key. It runs under an Entra app registration with Microsoft Graph permissions so it can pull SharePoint documents into prompts.

The firm also put prompt filtering and DLP in front of the AI traffic.

None of that helps here. PHP2Shell doesn’t attack the prompt or the model. It attacks the PHP interpreter, and on the most exposed configuration it does that before your application code runs at all. An attacker with code execution on that box doesn’t need to fool the model. They open the config file, copy the client secret, and call Graph as your app.

That’s why this belongs in an AI security conversation. The prompt controls were fine. The runtime beneath them set the blast radius.

6. What an attacker gets

Code runs as the web worker account. Everything that account can read is in play: environment files, wp-config.php, cached OAuth tokens, client secrets and connection strings.

From there the damage tracks the permissions. An app registration with tenant-wide SharePoint read can read every site. One with write access, or rights to edit agent instructions or flows, lets an attacker change what your AI does and come back later through a door that looks legitimate. It’s the blast radius question we keep asking about AI agents, and the same standing access problem that AI connectors create.

Running a vulnerable version isn’t evidence of compromise. An unpatched, internet-facing host is a reason to investigate. It isn’t grounds to announce a breach.

7. A 15-minute triage for executives

Nobody needs to read the advisories to run this meeting. They need answers to seven questions.

  1. Which internet-facing systems run PHP? Include the public website, intranet, AI gateways and vendor appliances.
  2. What PHP version is the web process running on each, checked from that process or container rather than a package list?
  3. Who owns the patch for each one, and is it done?
  4. Which of those servers hold an API key, client secret or token for Microsoft 365, Claude, Copilot or Azure OpenAI?
  5. What permissions do those identities hold? Flag anything tenant-wide or with write access.
  6. Is anything on PHP 8.1 or older, and does it have a vendor backport, an upgrade date or a plan to come off the internet?
  7. Who is reviewing logs from October 20 forward?

8. What IT should do now

Patch and prove it. Install the fixed release or your distribution’s backported package. Backported builds often keep an older version string, so check the vendor advisory rather than the number alone. Restart PHP-FPM or Apache so the new interpreter loads, then confirm the version from inside the running web container.

Reduce exposure where you can’t patch yet. PHP lists interim settings, including an administratively enforced memory_limit=-1, a low post_max_size, and session.upload_progress.enabled=0. PHP says plainly these don’t make an installation safe. If a host can’t be patched, take it off the internet.

Don’t close the ticket on a WAF rule. Blocking multipart uploads on paths that never take files can cut noise at the edge. The flaw lives in the interpreter, so Cloudflare or any WAF is a speed bump. It isn’t the fix.

Hunt. Look for PHP worker crashes, web server processes launching shells or download tools, new PHP files in web roots and upload folders, and outbound connections that start after inbound POST requests. A clean scan is a data point. It isn’t a verdict.

Fix the identities. Give each AI integration its own app registration, scoped to the sites and actions it needs. If an exposed host held secrets and you can’t rule out access, rotate them and review the sign-in history for that app.

Look back. Details leaked on October 20, and exploitation attempts were reported from October 21. Review web and sign-in logs from that point for any PHP host you couldn’t patch right away.

9. Quick answers

The nickname for CVE-2026-109618 and CVE-2026-109619, two critical PHP flaws that allow unauthenticated remote code execution. PHP fixed them on October 21, 2026.

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Versions 8.1 and older need a vendor backport or an upgrade.

Yes. CISA added both CVEs to its Known Exploited Vulnerabilities catalog on October 26, 2026, with an October 29 due date for federal civilian agencies. watchTowr had reported exploitation attempts against both CVEs from October 21.

Not by these CVEs. Only components running a vulnerable PHP runtime are in scope, including plugins, middleware and vendor products built on PHP.

It can block some attack traffic, but the flaw is in the PHP interpreter. Updating PHP is the only complete fix.

If you already set session.upload_progress.enabled=0 as listed in the original mitigations, keep it in place. PHP says no further action is needed.

10. Where this leaves your firm

The fix for PHP2Shell is a patch, and CISA’s federal due date has already passed. If a PHP host is still unpatched, that’s today’s job.

The lesson is about identity. Plenty of AI integrations went live fast, on whatever stack was handy, with permissions sized for convenience. The weakest runtime in that chain sets the blast radius. Spend an hour on the app registrations behind your AI tools.

If you want a second set of eyes on which AI connectors and integrations can reach which data, that’s part of what the free AI Readiness Snapshot reviews. It is a 60-minute working session followed by written findings and a 30-minute review, read-only, with no changes and no software.

Primary sources

Related guides

Related articles

Have a question?

Talk with Cocha about your AI and data security priorities.

281-607-0616
info@cochatechnology.com

About the author

Steven R. Combs

Steven R. Combs

Co-Founder and Principal
Cocha Technology

Steven brings 30 years in IT and 15 years working with law firms. He helps organizations deploy Claude and Microsoft 365 Copilot with practical data protection, permissions, and ongoing governance.

Request your free AI Readiness Snapshot →

From guidance to action

See where your AI rollout needs attention.

The free AI Readiness Snapshot identifies selected priorities across permissions, data protection, monitoring, Shadow AI, and Secure Score. Deeper assessment and remediation are separately scoped.

Request your free Snapshot → Review the scope →

More guidance