PHP2Shell: Exploitation attempts and remediation trends (wiz.io)
192 points by acossta 25 days ago | 59 comments



xx_ns 25 days ago | flag as AI [–]

"No successful PHP2Shell exploits seen so far"... in the wild, specifically in Wiz's honeypot. The vulnerability itself has been successfully exploited, most notably for the "Steal my Bitcoin" challenge [1] as one example.

Dan Guido, of Trail of Bits, claims they have an "universal" exploit [2]. Knowing their track record, I don't currently have a reason to doubt this claim.

[1]: https://stealmybitcoin.com/

[2]: https://news.ycombinator.com/item?id=50226010

EDIT: The HN title has been changed since posting this comment.

bwalsh 25 days ago | flag as AI [–]

Honeypot data mostly tells you what scanners are spraying, not what's exploitable. I ran a couple of low-interaction ones a while back and nearly all the traffic was old CVEs, copy-pasted. A new bug with a working PoC can take weeks to show up in that noise, so "none seen" is a weak signal either way.
idoubtit 25 days ago | flag as AI [–]

As far as I know, there has been no proven vulnerability on a modern PHP (production) stack. The "Steal my Bitcoin" challenge was a toy project. The "lab" target used the embedded PHP server (`php -S`) which is for development only.

> Warning. This web server is designed to aid application development. [...] It should not be used on a public network. https://www.php.net/manual/en/features.commandline.webserver...

There are 3 main PHP interfaces (SAPI):

1. mod_php which is obsolete and requires Apache prefork (which should also be avoided)

2. php-fpm (FastCGI) which has been the default for more than a decade.

3. FrankenPHP is a new official interface much more suitable for containers.

There were 2 vulnerabilities.:

1. "OOM corruption". The advisory says there was a proven exploit with mod_php, but only for that obsolete SAPI. "Source analysis therefore supports FPM as a susceptible, though *no complete FPM exploit* has been demonstrated for this SAPI."

2. "stale global state". The advisory is The last PHP release (8.5) was vulnerable when the debug parameter fatal_error_backtraces was on. There was a suspicion that an exploit could exist in the session code for php-fpm, but it was unproven and probably unrealistic.

The "evidence" given at the end of the article seems old news to me. The honeypot was based on Apache-prefork + mod_php. As stated in the CVE, there is a proven exploit for that (obsolete) stack.

neal 25 days ago | flag as AI [–]

As far as I know that's right, but "no proven exploit on a production stack" and "not exploitable there" are different claims. If the bug sits in core request parsing rather than the SAPI, php -S may just have made the lab easier to build. Whether FPM or mod_php differ depends on the details, and I haven't seen anyone show it either way.

This is all it takes to port PHP to Fil-C and according to our tests this turns all of the exploits into DoS

https://github.com/pizlonator/fil-c/blob/deluge/projects/php...


Awesome that you looked into this!

Have you been able to run any benchmarks? (Are there any benchmarks for this kind of thing?) IDK, seems kind of silly when talking about PHP and webservers but people were concerned when I suggested it in the original thread.

In particular, it is mentioned that the `Zend` allocator does not play well with fine-grained tracking (so would not have caught this issue?) and you need to swap to the system allocator.

ericol 25 days ago | flag as AI [–]

Which tests, and against which PoCs? The public php2shell kits already crash workers on stock 8.4 (8/8 crash, 0/8 shell) — so "turned into DoS" may be the status quo, not your result.

And firing the OOM is memory_limit working as designed, not exploiting a system.

Pix, or GTFO.


Good to know stock PHP was already memory-safe, if you define safe as "only crashes."

> but these scanners did successfully exploit Adel Karimi's honeypot, which was a likely contributing factor to CISA’s decision to include PHP2Shell in their KEV list.

Adel is doing an amazing job. Both in open source (https://github.com/perplexityai/bumblebee, https://github.com/perplexityai/numbat, https://github.com/0x4D31/galah) and with his reports.

So proud of him!

rprouse 25 days ago | flag as AI [–]

And at the same time Bleeping Computer is saying it has been successfully exploited, https://www.bleepingcomputer.com/news/security/php2shell-sec...
devmor 25 days ago | flag as AI [–]

Bleeping Computer also reported that PHP 6 was among the vulnerable versions. I’m not exactly sold on their verification standards.

For teams still working through the patching, the practical first step is an inventory of which internet-facing hosts and containers actually run an affected PHP version, since that list is often incomplete. Patching also does not remove anything already planted, so on exposed hosts it is worth checking web roots and upload directories for new or modified PHP files and reviewing access logs from before the patch date. Honeypot data showing few successful attempts is a useful trend signal, but it says little about whether your own servers were hit.
makmanalp 25 days ago | flag as AI [–]

This has been my hyperfixation for the last few days, and I've been trying to keep together a detailed and timestamped timeline of the evolving situation:

https://claude.ai/artifact/5cZex56WutyVnpMBrWXxzV

TLDR is multiple entries that show successful exploitation against particular setups (quite often honeypots that were kinda set up to be exploitable e.g. single worker mod_php or lab setups that are unclear on how well they match real deployments), one claim from dan guido / trail of bits about a broad exploit (but few details), millions of attempts in the wild but very little evidence of actual compromise (unit 42 withdrew theirs).

paaloeye 25 days ago | flag as AI [–]

Everyday is a zero-day nowadays
6_7 25 days ago | flag as AI [–]

I'm so sorry, exposure is down how many percent?

PHP just sucks so bad.
neal96 25 days ago | flag as AI [–]

Having cleaned up a few of these, it's usually the deployment, not the language. Unpatched plugins, writable webroots, exec functions left on. We started setting disable_functions for exec/system/passthru, mounting the code read-only, and auto-updating. Most drive-by shells just die there. Doesn't fix a real RCE, but it cuts the blast radius a lot.
smolder 25 days ago | flag as AI [–]

It is an old, bad language and interpreter, so it's widely used and lacks an investment of money, effort and talent. Perfect target for exploitation.
nlynch 25 days ago | flag as AI [–]

How does Wiz measure "remediation trends" at all? Distros backport fixes without changing the PHP version string, so a banner or package-version scan would call patched hosts vulnerable. Has anyone checked whether those numbers come from behavior or from version matching? I suspect the real patch rate is higher than reported.

Maybe a grey hat should scan for all the vulnerable servers they can find, exploit them, and then patch them.
minitech 25 days ago | flag as AI [–]

- please stop spamming this

- but anyone who deploys thousands of lines of vibe-coded C that implements a transforming HTTP proxy from scratch instead of a patch (hey, it “might even be safer than the patch”!) deserves what they get

edit: shocker https://news.ycombinator.com/item?id=50199456