Engineering

PHP2Shell: is your Laravel app exposed, and what to do today

Qorinx Engineering · 10 min read · Updated 2026
PHP2Shell: is your Laravel app exposed, and what to do today

If your product runs on Laravel, PHP2Shell concerns you, and the fix is not in your code. PHP2Shell is the nickname for two critical flaws in the PHP runtime itself, fixed on October 21, 2026, both rated CVSS 9.2. A Laravel app on an unpatched PHP version is exposed no matter how clean its own code is, and running composer update will not change that. You patch the runtime, restart the long-running processes, and check that the patch is live on the server that actually takes traffic.

This is a plain guide for a founder or CTO. It covers what happened, how to tell whether you are exposed, what to do today, and what the episode says about who owns your servers. It does not replace the official advisories, which we link below. As of October 26, 2026 the details are still moving, so check them before you act.

What is PHP2Shell, in plain terms?

PHP2Shell is two bugs in how PHP handles memory failures while it processes a web request. As Laravel News describes them, the first lets out-of-memory handling interrupt PHP while internal request data is only partly set up, so cleanup later treats invalid data as valid. The second lets internal state owned by one request survive after its memory is freed, so a later request on the same worker can use it.

The result is that an attacker with no account can potentially run code on your server. The PHP team rates the risk highest for Apache with mod_php, where it has a working exploit that triggers before any application code runs. The same report says the team asks everyone to update immediately and that there are no complete mitigations.

Two details matter for a product owner:

  • It sits below your application. Your validation, your policies and your Laravel version are not involved. A security package or a framework patch cannot fix a bug that fires before your code starts.
  • It was found with AI help. According to the timeline Simon Willison quotes from Wiz, Wiz Research discovered the first flaw on August 19, 2026 using its own tooling plus two frontier models, and reported it to the PHP security team on August 24. The patch followed on October 21. Researchers can use AI to find a subtle memory bug, and attackers can use the same tools to turn a patch into an exploit.

That second point is worth keeping in mind. The gap between "a fix exists" and "someone is attacking the unfixed version" is shrinking, and this release showed it. According to the PHP Foundation's account, the CVE IDs began circulating online on October 20, one of the reporting firms then published a proof of concept video by mistake, and PHP moved the release forward by a day. Simon Willison notes that exploits were circulating before the patch shipped.

Is your Laravel app affected?

Almost certainly, if it runs on PHP below the fixed releases. Every PHP install that serves web requests is in scope, including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. That covers the way most Laravel apps run in production.

The fixed versions are PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Anything older on those branches is exposed. PHP 8.1 and older no longer get official releases from the PHP project, although backports exist through some distributions and long-term-support vendors.

The real question is not "which Laravel version are we on". It is "where does our PHP come from, and who updates it". The answer depends on how you host:

  • Laravel Cloud. In Laravel's October 21 status update, quoted by Laravel News, every running application on Cloud was patched in place with no redeploy needed. If you are on Cloud, confirm your app reports a fixed version and move on.
  • Laravel Forge. Forge servers need a manual update. Laravel's own advisory is blunt that Forge's automatic security updates do not patch PHP, because PHP is installed from a separate package repository that Ubuntu's unattended upgrades never touch. A server with automatic updates switched on can still be vulnerable.
  • Laravel Vapor. Patched runtimes are live, but you must deploy your apps yourself, and apps on a custom or Docker image runtime need a new deployment rather than a plain redeploy.
  • Docker and Kubernetes. The PHP version lives in your base image. Rebuild from a patched tag and redeploy. Updating a running container is not enough, and if you pin images by digest, the old digest stays vulnerable until you change it.
  • Shared hosting or a managed host. Your host patches the runtime on its own schedule. Ask them in writing which package and build you are on, and whether the workers were restarted.
  • Plain Ubuntu or Debian servers. Distributions often patch under an unchanged upstream version number, so the package changelog, not the version string, is the proof.

Do not forget the machines nobody thinks about: staging servers, CI runners, internal admin tools, an old marketing site on a forgotten VPS. An attacker scanning the internet does not care which one is your flagship product.

How do you patch a Laravel app today?

Work from the most exposed server to the least: public-facing production first, then staging, then internal tools. For each one the sequence is the same. These steps follow Laravel's Forge advisory, the clearest runbook we have seen, and they apply to most Ubuntu servers whether or not you use Forge.

  1. Record what you have. Check the PHP version each site actually uses, and list every PHP version installed on the box, including ones no site uses right now.
  2. Update the PHP packages for every installed version to the fixed release. On Forge, the dashboard has an Update PHP action that also repairs the package source first. Expect PHP-FPM to restart, which means a few seconds of downtime, so choose a quiet moment.
  3. Restart the long-running processes. This is the step teams miss. The package upgrade restarts PHP-FPM, but processes started from the command line keep running the old code until you restart them. That means queue workers, Horizon, Octane and Reverb. The advisory suggests running php artisan queue:restart, php artisan horizon:terminate and php artisan octane:reload in each affected app.
  4. Verify through the thing that serves traffic. Check the version reported by php-fpm itself, not only the command line php, and confirm it matches the fixed release. For PHP 8.1 and earlier the version number does not change after a backport, so you check the package revision instead.
  5. Redeploy containers and serverless apps from a rebuilt, patched image.

A restart is a small deploy, so do it on purpose and watch the failed jobs table afterward. A queue worker that dies mid-job on a payment or an email is a real customer problem, and a calm patch window avoids it.

Then look at your logs since October 20 for unusual worker crashes, memory-exhausted errors or a burst of HTTP 500 responses. Be aware that the bugs fire below the application layer, so your application logs may show very little. If a server handles anything sensitive and was exposed for days, rotating the credentials PHP could read is a sensible precaution.

What if you cannot patch right now?

Sometimes you cannot patch today. A host has not shipped the package, a server is on an unsupported Ubuntu release, or a fragile legacy app needs testing first. Be honest about what that means.

Laravel News lists settings that reduce exposure to specific attack paths: removing the PHP memory limit somewhere an app cannot override it, lowering post_max_size, enforcing request limits at the proxy, and turning off session upload progress. The PHP team is clear that these do not make an install safe. Treat them as a bridge for hours, not a plan for weeks.

A web application firewall helps in the same limited way. Vercel, for example, says it deployed WAF rules before disclosure, and also says plainly that WAF protection does not replace patching and that requests bypassing its network, including direct requests to an origin server, are not covered. The same logic applies to any CDN in front of your app. If your origin is reachable by its IP address, the firewall in front of it is a suggestion.

Old versions need extra care. Laravel says Forge servers on Ubuntu 20.04 or older cannot get the update, and it recommends creating a new server on a supported release. On PHP 8.0 and 8.1, Laravel's sources disagree: the October 21 status notes said Forge and Vapor had no patch, while the Forge advisory later lists backported package revisions for 8.1 and older. Either way, a backport is a stopgap on an end-of-life branch, and the real task is an upgrade to PHP 8.2 or later.

What does PHP2Shell say about your product?

Most of the pain this week came from one question that teams could not answer quickly: who owns the runtime? Here is what we would take away if we were building your product.

Someone must own PHP upgrades. Not "the app is on a recent Laravel, so it is modern". A named person, with a calendar. PHP 8.2 gets security fixes only and reaches end of life on December 31, 2026. If you are patching an 8.2 server this week, put its move to a newer branch on the roadmap in the same sitting, so the next emergency is a routine change.

Your deployment path should make patching boring. A containerized app with a base image you rebuild on a schedule, a pipeline that deploys on merge, and a restart of queue workers on every deploy turns this week into an afternoon. A server set up by hand two years ago, with a PHP install nobody remembers, turns it into a weekend. That is why we treat cloud and DevOps work as part of the build, not an afterthought.

Distance from the runtime is a feature. Laravel Cloud patched running apps in place with no action from customers. Managed platforms are not free and they add their own constraints, but a small team with no operations person should weigh that honestly when choosing where to host. We cover the wider stack trade-offs in is Laravel good for startups.

Assume the window keeps shrinking. InfoQ reported on October 3 that AI agents can turn public clues into working exploits, quoting one open source maintainer who saw probes for a bug pattern minutes after opening the fix. That is one maintainer's account, not a measured law, but it matches what happened here. A monthly patch cycle is not enough for critical runtime issues. You need to be able to ship a runtime update within a day.

None of this is a reason to leave PHP. The flaws are old: Laravel's advisory says they affect PHP versions dating back to 2004. They surfaced through an audit and AI-assisted research, and were fixed by a handful of developers paid full time by the PHP Foundation, who coordinated with distributions, WAF vendors and cloud hosts. That is an ecosystem working under pressure. It does mean the framework is only one layer of your security, as we cover in the security checklist we run on every rescue, where the runtime and the server sit next to secrets, auth and dependencies.

When should you bring in a senior engineer?

You can patch a single, well-run server yourself in under an hour if you follow the steps above. Bring in help when any of these is true:

  • You inherited the app. Nobody can tell you where PHP is installed, how it is deployed, or whether anything runs outside the main server.
  • You are on PHP 8.1 or older. A backport is a stopgap, and the upgrade is where the risk is. Old PHP often means an old Laravel, old packages and thin test coverage. That is upgrade-with-a-safety-net work, not a quick job.
  • The system is fragile. If a restart might lose jobs, or deploys are manual and scary, fix that before the next critical release, not during it.
  • You handle sensitive data. If a server could have been exposed to public exploits for days, you want someone to review logs and decide what to rotate.

When we look at an inherited Laravel app, the first questions are what runs where, who can deploy, and how fast the runtime can change. If the honest answer is "we do not know", that is the real finding, and it is worth fixing before the next advisory. Our backend rescue work starts there, and the cost of leaving it alone is spelled out in what a failing system actually costs you.

If you want a senior team to patch, upgrade or take over a Laravel product, see our Laravel development service. You get one scoping call and a fixed quote in writing within 48 hours, and you keep full ownership of the code and the infrastructure.

On sul projekt, mis vajab seda mõtteviisi?

Too probleem. Fikseeritud pakkumine, päris tähtaeg, kogenud inseneritöö.

Broneeri tasuta 30-minutiline kõne