Latest / Modularity Podcast / PHP2Shell: What WordPress Site Owners and Hosts Need to Know
Transcript
- 0:00What if your WordPress site could be taken over by a visitor who never touches
- 0:03WordPress at all?
- 0:05No login, no vulnerable plugin, nothing.
- 0:08That's the situation with PHP2Shell, and Dave, I want to make sure people understand
- 0:13the bug lives underneath their site, not in it.
- 0:16Right, and that's the part that trips people up.
- 0:19PHP is the engine.
- 0:20WordPress, Drupal, Joomla, MediaWiki, they're all applications running on top of it.
- 0:27PHP2Shell is actually two vulnerabilities, CVE twenty twenty six,
- 0:32one oh nine six one eight and CVE twenty twenty six, one oh nine six one nine.
- 0:38Both are rated 9.2 on the CVSS version 4 scale.
- 0:43The researchers showed an unauthenticated attacker can run their own code on the
- 0:48server.
- 0:49The researchers at Wiz put it plainly: even a bare Hello World script on an affected
- 0:55PHP version can be vulnerable.
- 0:57And the timeline matters here.
- 0:59This was supposed to be a coordinated disclosure on October 22nd.
- 1:03Details leaked on social media on October 20th, so the PHP team moved up and
- 1:09announced an emergency release for Wednesday, October 21st at 14:00 UTC.
- 1:15Then watchTowr reported seeing exploitation in the wild through its honeypot network
- 1:20on that same day.
- 1:21And the NSA put out an advisory telling organizations to inventory their internet
- 1:26facing PHP and patch.
- 1:29Which, for the NSA to name a programming language in a press release,
- 1:34tells you something.
- 1:36So let me walk through the mechanism, because it's actually elegant in an ugly way.
- 1:40Picture a PHP worker, the process that handles your web requests.
- 1:45It handles one request, then another, and it reuses memory and internal bookkeeping
- 1:50between them.
- 1:51Now, at the very start of a request, PHP parses multipart uploads,
- 1:57the kind of request a file upload form sends.
- 2:00That happens early, before normal initialization is finished,
- 2:04and before any WordPress code has run.
- 2:06So there's a window where PHP is half set up.
- 2:09Exactly.
- 2:10If PHP runs out of memory in that window, it hits a fatal error.
- 2:15It destroys the memory heap for that request, but some internal pointers still point
- 2:20at the memory that was just thrown away.
- 2:22The cleanup never finished.
- 2:23Then the next request handled by that same worker comes in,
- 2:27and PHP trusts those stale pointers as if they were live data.
- 2:32If an attacker has arranged for that freed memory to be reclaimed with content they
- 2:36control, PHP is now acting on attacker data.
- 2:40That's the use after free idea, right?
- 2:42Something gets freed, but the program keeps a reference to it.
- 2:45Yes.
- 2:46And it shows up in a few ways.
- 2:47In one, PHP can end up reading that reclaimed memory and putting its contents into a
- 2:53PHPSESSID cookie in the response.
- 2:57That's a memory disclosure, and the researchers said the memory can contain
- 3:01passwords, tokens, API keys and certificates.
- 3:05It works even if the app never starts a session.
- 3:09In the others, a fatal error backtrace pointer goes stale, or the OPcache,
- 3:15which stores compiled PHP in shared memory, gets confused about object types between
- 3:20workers.
- 3:21Those paths lead to corrupted memory and code execution.
- 3:25And just to be clear for the listener, the researchers demonstrated working remote
- 3:30code execution against the latest container images of WordPress,
- 3:34Drupal and Joomla.
- 3:36Those were representative targets.
- 3:38The bug doesn't care which CMS you run.
- 3:41Here's what bugs me, though.
- 3:42These flaws were old.
- 3:44The Wiz write up says the vulnerable code goes back more than a decade,
- 3:48and they say every PHP version in the last decade is affected by at least one of
- 3:53them, back to 5.4.
- 3:56So why now?
- 3:57That's the AI piece, and I think it's the most important takeaway from the whole
- 4:00story.
- 4:01The researchers say the hard part was never spotting that something looked off.
- 4:05The hard part was turning it into a reliable exploit.
- 4:08You have to chain several flaws together, and memory layouts differ across PHP
- 4:13versions, configurations, and applications.
- 4:16An exploit that works on one server can fall apart on the next,
- 4:20and every adjustment means more debugging.
- 4:22Which used to be a human bottleneck.
- 4:24You needed rare people with lots of time.
- 4:27Right.
- 4:27Wiz says they used frontier models, Gemini 4 Argon and GPT five point six Sol,
- 4:34along with their own tool, Wiz Atlas, to debug failures and adapt working exploits
- 4:39across multiple applications in hours.
- 4:41Their claim is that a single researcher finished in about a week what would have
- 4:45taken a world class team months.
- 4:47That's their framing, and they're a security company with a stake in the story,
- 4:50so weigh it that way.
- 4:52But the direction is hard to argue with.
- 4:55Complexity used to be a kind of protection, and it's getting weaker.
- 4:58And it cuts both ways.
- 4:59The same tools help defenders find these things before attackers do.
- 5:03But when you're a host, the practical lesson is that the gap between a bug being
- 5:07disclosed and a bug being weaponized is shrinking.
- 5:11watchTowr saw exploitation the same day as the patch.
- 5:14Which is why speed on our side matters more than ever.
- 5:18So let's talk about what a responsible host actually does in a moment like this.
- 5:22First, the shared responsibility model, because it explains who owns what.
- 5:27As a host, we own the runtime: the PHP engine, the web server,
- 5:32the operating system libraries.
- 5:34Our customers typically own the application layer: WordPress core,
- 5:38plugins, themes, user accounts.
- 5:41PHP2Shell sits entirely in our half.
- 5:44So when we talk to customers, the headline is that for this specific issue,
- 5:48there's nothing they need to patch themselves.
- 5:50And what we did started before the official fix existed.
- 5:54We tightened firewall rules, and added extra protections where they applied.
- 5:58Hosts that were in the loop could look at the shape of these attacks,
- 6:02things like malformed multipart uploads and odd session headers,
- 6:07and filter at the edge.
- 6:08That buys time, but I want to be honest about it.
- 6:11It's a stopgap.
- 6:13PHP itself says no configuration change fully mitigates this.
- 6:18The real fix is the patched engine.
- 6:21Then the patches roll out.
- 6:22The fixed releases are PHP 8.5.12, 8.4.27,
- 6:308.3.36 and 8.2.35.
- 6:35And here's a detail people miss: updating the binary isn't enough on its own.
- 6:41The workers hold state in memory, and that stale state is the whole problem.
- 6:45So you restart the PHP workers after updating so the fix takes effect.
- 6:51That's why some customers might see a brief service restart.
- 6:54We'd rather do rolling restarts and keep it short than leave a poisoned worker
- 6:59running.
- 7:00And we watch.
- 7:01The researchers suggest signals worth looking for: unusual multipart requests
- 7:05followed by memory limit errors, repeated HTTP 500 responses,
- 7:10strangely large or malformed PHPSESSID cookies, and unexplained worker churn.
- 7:16Because this happens below the application, normal app logs may show very little.
- 7:21So you're hunting in server level logs.
- 7:23Now the hard part for hosts is older PHP.
- 7:27PHP 8.1, 8.0 and 7.4 get no standard official release.
- 7:33You can use a distribution or long term support vendor package,
- 7:38or PHP's minimal source backports.
- 7:41And PHP 7.3 and older, including PHP 5, have no fix at all.
- 7:48watchTowr confirmed those older branches are affected too.
- 7:52So let's give people the dos and don'ts.
- 7:55Do confirm with your host that server level updates are applied.
- 7:58Don't just assume.
- 8:01Do log into your hosting panel and check what PHP version your site runs.
- 8:06If you're on 7.x, or 8.0 or 8.1, you're in the danger zone,
- 8:11and you need to schedule a move to 8.2 or newer.
- 8:14Do keep updating WordPress, themes and plugins.
- 8:17That doesn't fix PHP2Shell, but neglected plugins are their own door into your site.
- 8:23Now the don'ts.
- 8:25Don't count on a security plugin to save you.
- 8:28Those plugins run inside WordPress, and this bug fires in the engine during request
- 8:33startup.
- 8:34For PHP's most exposed setup, Apache mod PHP, PHP says an attack can succeed
- 8:41before any of the application's own code has run.
- 8:44Security plugins are still useful for other threats, just not this one.
- 8:48And don't go hunting for a snippet.
- 8:50There's no functions.php hook, no htaccess line, no php.ini tweak that patches a
- 8:57memory allocation failure inside the C engine.
- 8:59If someone online sells you one, be skeptical.
- 9:02Then there's the gray area, which is honestly the hardest.
- 9:05Plenty of business sites run on an abandoned plugin that breaks on PHP 8.2 or 8.3.
- 9:12The site owner says, don't touch it, it works.
- 9:15The host is then balancing two bad options: keep a backported patch in place for the
- 9:20old version, or push for an upgrade that might break something.
- 9:24My view is that's a budget conversation, not a technical one.
- 9:27Set aside developer time to modernize those dependencies now.
- 9:31Backports are a bridge, and bridges end.
- 9:34Once your PHP branch is past support with no patches, you're exposed the next time
- 9:38something like this lands.
- 9:40And with attackers moving faster, that next time may come sooner.
- 9:44So the short version: if you're with a host that's handling the server,
- 9:47check in, check your PHP version, and plan the upgrade you've been putting off.
- 9:52And if you're self managed, treat it as an emergency.
- 9:55Inventory every PHP install, update to the fixed release for your branch,
- 10:00restart the workers, and take anything you can't patch off the open internet.
- 10:04And if any of this feels like too much to handle alone, that's exactly what we do at
- 10:09Modularity Networks.
- 10:10Whether you need your PHP version checked, your hosting secured,
- 10:14or an old site modernized, you can get help with all of it at Modularity.us.