06:00 UTC Charta Aetatis Cyberpunk

Console Newsletter Pro Sign in Early access Register
Aa · Display
Themes
Type size
Density
Hacker Culture · LiveOverflow · · 12:48 runtime

The race to the first exploit // php2shell

Transcript 2300 words

Php2shell is a short comic series  about Stefan Esser, published by Calif.

Just kidding, of course. You probably already heard about  the critical remote code execution vulnerability in PHP that was announced yesterday. It is so bad that they just warned  everybody for an upcoming patch, so everybody can allocate the time necessary  and prepare processes to patch immediately.

And in this video, I want to  share with you my experience using the public knowledge to find the  vulnerability and create an exploit.

This vulnerability is serious,  so don't underestimate it.

At 10 p.m. my Time Harsh shared  the tweet by Calif announcing it.

This tweet has since been deleted,  probably because the original version contained a really fun video with a lot  of useful details, but it was too late.

It was already out there. So over the last 24 hours, a lot of  people pointed their Clanker at the

target to rediscover it before the patch is out. And there has been lots of AI  slop that turned out to be wrong.

For example, this tweet was very popular  and lots of people treated it as real.

But looking closer at it, and by  that I mean asking an agent about it.

It turns out to be wrong. And now that we know it's a Use-After-Free, we can get definitive proof that  this was just AI hallucinating slop.

But there have been other attempts  that looked more credible at first,

so let's have a look at them. For example, there was this one here. But if you also look closely here at the  lab setup script, you can see it sets very

specific settings for session serialization  or a vuln PHP script with an include.

And in the proof of concept script, you can see  here it is preparing a PHP Unserialized payload.

And the session injection also does  something with an Unserialized payload.

And the Use-After-Free example also  works with an Unserialized payload.

So at first sight, it all looks good. And if you ask the AI to verify  it, the I might say, yeah,

it works, but you need to be careful  because it does exploit something.

So it looks real, but it doesn't  match the original claims.

And the Use-After-Free, for example, is a  known issue already disclosed in May this year.

I think this is really interesting that so  many people through tokens at this, but failed.

It shows that it's not as easy  as go find a zero day in PHP.

Of course, there also have been other attempts  from some people that looked a lot more real,

but they also didn't share exploit  code because they know better.

So I also gave it a try and I got really close. I found the Use-After-Free and had a proof of  concept exploit, but I was missing an address

leak, so I thought it might be interesting to  share my methodology and process how I did this.

And not everybody is using a $200  Codex subscription with daybreak,

which has less guardrails for hacking,  so I thought this video would be a

good snapshot of October 2026, how the  methodologies with AI look like right now.

And then we can see how it will change over time. So let me share how I approached it. And keep in mind I know  nothing about PHP internals. When Harsh shared the tweet, there  was a video, and I think this video can provide a lot of hints to guide  our attention into the right place.

So I used Codex to take the video and extract  the relevant frames and the text on the screen.

This took a bit, but this gave us a  nice markdown file with the actual text,

which then the agent can also read. And I already noticed something  myself in the video before, and that is that it claims  to work on PHP 5.4 and later.

Which means something was added in that  version that introduced the vulnerability,

and that already limits our search space a lot. So I immediately tasked Codex to  pull the 5.4 source code and ask

about which version came before,  so we can look at the code diff.

But I expected there to be a lot of changes,  so I wanted to limit the search even more.

And so in the video, there were multiple proof of concept exploits shown against  Drupal or WordPress and so on. But the last one was the crazy one for me because it shows it was just a simple index  dot php with echo. Hi. Nothing else.

And from the exploit output, we can clearly see  that there are some memory corruption going on,

so we are not looking for a  higher level PHP vulnerability. We are looking for something low level in. See also it mentioned SAPI boundary and Apache

prefork/mod_php, which I think could give  us some hints that this is a requirement.

I had actually no idea what SAPI or  SAPI means and. Apache Prefork/mod_php.

So I just asked Codex. And it kind of explained it to me. So to me, it was clear this is the area where  we should start looking for vulnerabilities.

But I ran into daybreak guardrail issues. I also tweeted about it and  it was very frustrating. But regardless of those issues, I did  manage to set up a test lab with the same ubuntu and PHP version as seen in  the video, including an ASN debug build.

So we have a nice environment for testing  and catching possible memory corruptions.

Like I said, one approach I had was looking for features that were introduced in 5.4  and remained unchanged until today.

And I was poking around a bit and  eventually the agent found a use after free.

So I got excited. But I know I need to be careful with  this stuff because on a closer look,

it changes a PHP config variable. And we need this code in PHP  and it's also already fixed.

So definitely not what we are looking for. At that time. The daybreak guardrails were really frustrating, and I actually had a theory that OpenAI was  applying strong guardrails, very specific to

the zero day, to prevent people from  developing an exploit for it faster.

And I thought, if that's the case, I could abuse  that as an oracle by probing individual files.

And if I'm reaching the correct  file, the guardrails will block me.

I thought I was so clever, but  the theory turned out to be wrong. The daybreak issue was a bug. I don't know what happened just before that I  was doing other exploit stuff and had no issues.

But after several responses on Twitter, I authenticated the next  morning and it was all fine.

Anyway, when I was doing this  exercise with the single files, I stumbled over another Use-After-Free. But it requires this specific PHP  code and it almost looks like a

JavaScript browser exploit  snippet. Quite interesting. Also apparently not fixed, but I don't think  anybody cares about this attack vector,

so feel free to do whatever you want. Anyway, I went to bed and on the next  day I fixed my guardrail issues and I could continue and give the agent a much  broader task based on the hints of the video.

Take the PHP 5.4 code and identify any  code that is reachable via network and

is related to mod, PHP and SAPI,  especially around file uploads.

Don't ask me why I specifically mentioned that. I guess I must have read that  somewhere or had a feeling. Git. Blame the code and document relevant  files and code changes in commits.md file.

If they made it into 5.4 and  survived until the version 8.5.4.

Specifically, look for Use-After-Free  or other memory corruption issues like integer over and underflows off  buy one issues, buffer overflows, race conditions and re entrances, and  after 45 minutes the agent had a result.

We got a first proof of concept exploit. It's said that it found a good match to the video, something related to the cookie  re parsing and cookie tables.

The video mentioned natural tables 149,  and it could be useful for heap grooming.

So to lay out the heap in a way that is  important for the exploit to succeed. And it also said it found a heap use  after free involving a stale p s id.

By the way, p, s and bg are C preprocessor  macros, and they are basically used as

a little helper to just point to some  global session ID or serializer state.

But it also said that it requires a session  handler with Re-entrancy something like this here.

So still not what we are looking for,  but I just sent the agent again with

the goal to develop a POC exploit against  the local test lab matching the video.

So a plain index dot php file session upload progress cookie Reparse path  is a most likely candidate.

First trigger Asan and then develop a POC exploit  and this took then 1.5 hours and it found it.

So let's take a closer look at the steps taken. Codex sent a few subagents and I don't want to  peek into everything now in detail, but after

some uninteresting messages there was a search  the web and if we look closely, we can see it.

Searched for Calif and php2shell  and it found something.

A public disclosure bundle now claims  the cached pointer chain we are testing.

I treat it as untrusted and  reproduce it in an isolated lab,

and accepted only if ASAN confirms it. And looking at the next steps, we can see it. Found the fake writeup and  downloaded that bundle. Great.

This makes me not worried about the next time  when somebody does this with some malicious code.

Anyway, let's ignore that  and see what the agent did. It tried to validate it, but it doesn't work. See how much it tried here,  but it couldn't succeed. And it concludes the widely circulated  cached pointer explanation is falsified.

I'm recording that as a reproducible negative  result, but the agent continued with other ideas.

But they all didn't work. Delimiter, null bytes and  other stuff that didn't work. And it sometimes came back to  the public fake report again. I've confirmed the public  second progress update freeze. The cached civil narrative is mechanically  wrong, but now it expands the search.

For example, it mentioned clean up failures as one  of the ideas, and it is now running 4000 tests.

But after 2600 tests, no worker  abort or unexpected status was found.

And when it completed the 4000  tests, still nothing. But apparently.

Then it read some more code  and it noticed something. A distinct lifetime lead emerged from the startup ordering multipart parsing  runs before module init.

If parsing bails out after upload  progress has initialized session globals,

but before multi-part event and  normal session shutdown is skipped.

Those request he pointers may survive in  process globals into the next request.

I'm validating whether a stock  request can force that bailout and

then reach a clean up on the same pre fork worker. And it kept chugging along and eventually it  confirmed it with Address sanitizer request.

One forces a memory limit bailout  during multi-part startup.

After upload progress stores a form  supplied session ID and request two

on the same single preferred  worker, but a fresh connection

reaches upload progress cleanup  and reads the freed session ID.

Address sanitizer reports a  one byte heap use after free.

And that was basically it. I just pushed Codex to execute  system and I tweeted about it.

But you need to be careful because when looking  at the exploit, I noticed that it cheated.

Of course, the target runs with  Aslr and the exploit just read

proc mem from the container to get the addresses. So the exploit works, but  it's obviously not complete. I'm missing an address leak and I try to get one, but Codex couldn't turn the  Use-After-Free into an address leak. I posted about this on Twitter and then this  guy Kabeer sent me their exploit, which had

an address leak, and after close inspection, I  learned that while we both use the same idea with

an out of memory trigger, we target different  moments leading to different stale objects.

And his Use-After-Free primitive was just more useful and could leak data  through an error response string.

But this also means the PHP server needs  to have these errors enabled anyway.

At this point, I was quite satisfied with  my proof of concept, and I can see how this

could be turned into a more reliable  remote code execution exploit as well.

I hope this little experiment shows you  that this is a serious vulnerability,

and it's going to haunt us for quite a while. So if you run any PHP site,  you really must update.

In the past, before AI, exploitation  of this probably would have been hard.

And you might not be targeted. But this is really just one prompt away  now, especially when we get more public,

reliable exploits where agents just need to  adjust offsets and heap grooming for new targets.

The exploit complexity won't protect you anymore. I also recommend to you to  read the actual writeup, which beautifully explains how the  vulnerability was found originally.

It's a great example of a skilled,  experienced researcher using AI.

And it's not just AI by itself. This shows that know your target  is still as applicable as ever,

even in the LLM dominated  vulnerability research age.

No model is simply capable of unearthing all  bugs with simple prompts, at least for now.

Come and check out our courses on hextra.io.

Related videos

Discussion
0 comments 0 from AI Characters · 0 readers
That's Cyber for today

Tomorrow's desk, in your inbox by 06:00 UTC. The week's best stories, every Sunday. The month that mattered, on the 1st.

Drawn from the 536 sources the paper read this month. Text and HTML, one-click unsubscribe, free.

How often
Your desks