Hacker News new | ask | show | jobs
by dikei 44 days ago
From my understanding, the PHP bug is memory disclosure.

The RCE exploit is application dependent: it requires exploitable PHP code already deployed in the server. However, that exploitable code path is widely deployed by the most popular PHP software: WP, Drupal, Joomla, etc, so in practice most PHP deployments are vulnerable to the RCE attack.

1 comments

From my understanding, the vulnerability is a use-after-free, i.e. PHP allocates memory, stores pointer to it, frees it, maybe re-uses the memory for something new and then accesses the pointer. So totally exploitable.

Note that use-after-free would be prevented in memory-safe languages such as Java, Go or Rust.

PHP itself is a memory safe language, this is a bug in the language implementation and VM. Which happens in other memory safe languages like Java or C#. This is sort of the equivalent of a Rust compiler bug that allows unsafe behavior to slip through, which also exist.
No, PHP interpreter is written in C where such things happen every 100 lines of code. If PHP interpreter was written in Rust, this vulnerability wouldn't exist.

To be fair, C has simplicity as an attractive feature (compared to other languages) but being memory-unsafe is unacceptable, so we need either memory-safe C or stop using it.

Most interpreters or runtimes are written in unsafe languages. Including V8 (Chrome and Node), C#, and others. Also PHP is not really interpreted, it works just like C# or Java where it's compiled to bytecode that runs on a virtual machine.
Not all UAF are explotiable. It really depends on what code that uses the stale pointer does with it and how controllable the freed/re-used data are. Although when evaluating I'd count much more on the first condition, rather than the second one, which may not be so easy to ascertain.
> Note that use-after-free would be prevented in memory-safe languages such as Java, Go or Rust.

There are also hardened malloc/free implementations for C based runtimes. Of course none of that is perfect, the famous heartbleed exploit for example bypassed any outside memory protection as the library agressively reused already allocated buffers, none of the languages you named would protect against that.

> So totally exploitable.

Great, so show us a working exploit.

https://github.com/9bie/php2shell-bypass-aslr-exp

Buy 5$ on deepseek and have it write a script to grind out the right offsets to use for the most popular docker images.

I got it working just now; shell on any docker image i pull.

GG this dumb ass blog-post and thread.

Yeah? You got it working? Then why can't it pawn my webserver running php-5.6 and drupal 7? Should be pretty easy, those are both unpatched ancient versions.
Probably because you're too cheap to spend $5 on DeepSeek tokens? Its specifically labeled for a 8.4 version IIRC.

I'm not sure what your question is or what you're getting at. The only time-sink for general purpose exploit is to churn through previous PHP versions to get the right offsets/struct sizes and common memory configurations.

Do you think security is done by running obscure configurations?

Or because they understand its not worth spending the money on, since the person making the assertion should demonstrate it.

The question we are getting at is - is this easily exploitable? I haven't see evidence of that.

Why write? Put your unpatched PHP server to the Internet and someone will show you working exploit.
Oh it's live and nobody's bothered it