06:00 UTC Charta Aetatis Cyberpunk

Console Newsletter Pro Sign in Early access Register
Aa · Display
Themes
Type size
Density
Cloud & Identity · Wiz · · 36:03 runtime

Breaking Down PHP2Shell with Sagi Tzadik & Thai Duong

In the wiki PHP2shellPHPWordPressWizOpenAICalif Also namedDrupal, Large Language Models, Atlas, Gemini 4 Argon
Transcript 4768 words

This research changed my view on AI doing vulnerability research.

Like, I was amazed by the capabilities of Frontier model doing

memory corruption exploitation. Like, I did not expect that.

Welcome to Crying Out Cloud, the podcast that will make you laugh, cry, and reconsider all of your cloud security fears. I'm Amitai. Eden, my usual co-host, isn't here because she's on vacation. With me today are Sagi Tzadik from Wiz Research, and Thai Duong from Calif. And today we're going to be talking about a few new

vulnerabilities that have come out in PHP. We're gonna talk about what they mean. We're gonna talk about how to deal with them. So hopefully this will be an interesting conversation. Sagi, tell us about yourself. Hi, everyone. My name is Sagi Tzadik. I work as a security researcher for the Wiz Research team. I've been doing security research for the past 10 years or so,

and I'm very excited about this research. Thai, tell us about yourself a bit. Hi, I'm Thai. I run Calif. We are a small security consultancy.

We do, you know, security research, red teaming,

security engineering. Very happy to be here today and, you know, I'm a big fan of Sagi.

Very honored, you know, to be on the show with him.

Thank you so much. Likewise. Crying Out Cloud, bringing people together.

So Thai, let's start with you. Can you tell us a bit what these vulnerabilities are? What is PHP2Shell? Okay. It's a remote code execution, basically. You can just point it at a random PHP application.

Even an empty PHP script would be enough, you know, to

get RCE and a shell, you know, from the web server.

And it's actually pretty… It's a bug class,

you know, that consists of like multiple vulnerabilities.

And if you look into the history of the bug class, you would see that

it was first discovered in 2004.

And the person who first, you know, discovered it was

Stefan Escher, and he's the OG in PHP security, right?

And I have like his posting to Bugtraq open in one of my tabs

and basically he found that, you know, you can disrupt or

interrupt some of the memory allocation in PHP and turn that into a

use-after-free, basically, and got code execution out of that.

And it was like 22 years ago.

And I think like some people, like our engineer, like the

person on our side who found this vulnerability was Ryan A, and

he's a PHP historian basically.

And so he knew everything about like all the bug classes

in PHP and I think he found the same thing in early August.

And so what Stefan found like 22 years ago is still there.

And it's still RCE and it affected like all the major versions

of PHP, like 5.x, 7.x, and 8.x. So yeah, it's a pretty big deal And this

vulnerability was actually discovered by multiple research teams around

the same time, which is interesting. So I'd like each of you to tell me a bit about,

like, the background, like before you had learned that other

organizations had discovered this. So Sagi, what was the process like? Like, how did you actually… how did you come about to finding this?

Yeah. So in our team, we are huge fans of PHP.

Like, we have a very intimate knowledge with the programming language.

And it's actually quite a funny story regarding how we

found this in our team. We use an internal harness called Atlas.

It's based on Gemini 4 and GPT 5.6 All, and

other frontier models. And we pointed it at a CMS called Drupal, which is a very popular PHP

application, and we asked it to find memory corruption vulnerabilities in

PHP that can be triggered from Drupal.

So the goal was not a PHP RCE, it was an RCE on Drupal

that uses PHP to gain this. Now, it hunted for a couple of hours, and it came up with something that,

like a memory corruption in PHP that is exploitable from Drupal.

Amazing. And then we went one step further and asked it, "Okay,

so we have this bug in PHP. Can you please adapt it to WordPress?" Another very popular CMS. It

went for, I don't know, eight more hours and returned with, "No, I

could not port this bug to WordPress. However, I did find a more generic bug that can be exploited

on both WordPress, Drupal, and probably any other PHP application."

And essentially, this is PHP2Shell. Interesting.

So you didn't even set out to find a PHP vulnerability?

No, no, we wanted a CMS vulnerability. We wanted a PHP memory corruption that can be triggered through a CMS, but we

ended up actually finding something with like much more serious.

So Thai, what was the process like from your perspective?

So basically we were part of the, we are part of the Patch the Planet

program with OpenAI, and we proposed, you know, 10 projects

with them, and one of them was PHP.

Because again, we also love PHP. Like Ryan on the team, he loves PHP.

And then I think in end of July.

You know, the way Patch the Planet works is we have to convince the

people, you know, at the, like the PHP people to join the program, right?

But we're lucky because like Stefan Escher is also at like Calif. So we asked

him to introduce us, and he connected us with like Volker at the

PHP Foundation, and with like Stefan as the middleman, like Volker, you know,

basically Stefan vouched for us. And then that's how, you know, we signed up Volker to

the Patch the Planet program. And then immediately the next day, because we know, you know, we are looking

for like Stefan's, you know, memory corruption vulnerabilities in PHP.

So we just searched for that, and within one day, it, you know,

gave me, gave us, you know, gave Ryan. Ryan did all the work. I'm just, you know, a messenger here. And he found that… oh, it's actually, there's a bug there.

Actually, like, I think he found the first bug, and then we reported

it to Volker like immediately, and then they asked us like, or they told

us that, oh, they're actually aware of a similar issue that was discovered

as part of an internal audit in 2024.

But back then, because they couldn't develop an

exploit- Hmm … and they saw that the fix would be very involving, and

because the lack of an exploit, so they decided not to do anything.

They still, you know, getting a CVE for it and, you

know, assigned a high severity vulnerability, but they didn't fix it.

And so they asked us for an exploit, and it took us several days

to build the exploit for WordPress, and we shared it with them, and

then I think they convinced that, yeah, this is a real problem.

And they started like planning the fix. And then afterward, like, we found like other variants, like

that worked against like Apache and NGINX and, you know, in the end,

I think we built working exploits for all the major PHP applications

out there on Apache and NGINX.

And, yeah, that's how we found it. I think totally we spent about I think two weeks or something.

And then Volker, he was, you know, there's some problem and

then, so there was some delay. Because initially I think the plan was to

get this fixed in September. Because every month, like PHP would have a monthly release and

but then we missed that deadline. And then when we came back in September, Volker shared with us

that, oh, somebody at Wiz also found, you know, some issue.

And they said they consider those issue duplicates of our issue.

But then we asked them like, "Can you share, you know, so that we can check out?" And then I think they added us to one of the

Sagi's bug reports on GitHub. And we found that it's actually not the same issue.

It's a pretty unique, you know, issue, different from what we found.

It's beautiful. We like it a lot. And that's how we know, oh, it's actually like, you know, they're like,

like we found a few ways already. But then after we saw like Sagi bugs, and I think

OpenAI also was involved because after we share the initial finding

with them, or maybe they started scanning, you know, independently

as well, and also found a bunch of issue. And then we learned that, oh, there are multiple ways to attack, you

know, to exploit the vulnerabilities and how to exploit this kind of issue.

And it becomes very clear that this is a, you know, a family of bugs.

And hopefully, you know, PHP is gonna put the end to this family.

It's interesting that it almost sounds like there are a few

impacts of AI here. Like, one is that it makes these types of vulnerabilities

perhaps easier to discover. Like arguably, perhaps they couldn't have been discovered before.

But then, you know, you say they actually did find an issue like this or even

the same issue a few years ago, but they didn't consider it exploitable.

So beyond the discovery aspect, you could also say that AI is also changing

what might be like the severity of a vulnerability just by proving that,

something that previously wasn't considered exploitable is now suddenly considered exploitable. Which I think is fascinating. I also find it interesting that the fact that multiple

parties found this at the same time. Do you think that has to do with the advancement of models of

the time, or is it more of a coincidence?

Yeah. I think it's kind of… Oh, sorry. Sorry. No, go ahead, Thai. Yeah. I think it could be both, right? Basically, everybody was using the same models and I think what happened

was there was WordPress to Shell, and that basically triggered interest in PHP,

you know, in- Mm … many companies.

Because if you really want to do better than WordPress to Shell, then you need to get deeper into, you know, the engine, right?

No, no, I love- This is exactly what we were thinking. Yeah. We love, like, you know, that work.

It's beautiful and, but as researcher, we want to do something

new and more powerful. So that's, you know, one of the motivation. I'm not saying that that's the only motivation. And then I think, like, the models, they know

about this bug family, right?

Because the data and everything is on the internet. It's just that it needs somebody to actually trigger

this specific knowledge. And I think maybe we've just lucky, maybe we just like, because

we know about this bug class, maybe because Stefan Escher is at Calif and

Ryan is a PHP historian, so we trigger this, you know, neuron within the models.

And then we found the vulnerability. And, but I think, yeah, I believe with this, like I strongly believe,

like after the vulnerabilities, the knowledge that there are vulnerabilities

like this in PHP are published, then people would be able to quickly

reproduce it and even build exploits.

It would show that, you know, it's just like the matter of like whether you know what you're looking for. If you know, then you can ask the model. And to your second point about AI can actually help

speed up, like, exploitation. I think it's not just speeding up, right? It allows us to overcome, like, difficulties.

It's not like we cannot do this manually. It's more like it's gonna take a lots of time, like to do heap

grooming and everything, you know, over the internet.

But now with AI, it's just, you know, do it and so we don't

have to worry about that part.

And because there are always a human behind this exploitation, right?

So if it's take too much time, then the human's gonna give up at some point.

And I think this could be what happened in 2024, right?

Like, it just takes time and that's with a paid audit, and the

consultants were paid to do it, and so they maybe just gave up.

But now with AI, we can just like slash go and then, you know?

So do you think that we should expect variants,

and maybe bypasses of this vulnerability to appear, like,

in the coming weeks or months? Like, do you think it's likely or is this attack

surface now, like, been wiped out?

Sagi, what do you think? Yeah. So we spent a lot of time validating the patch provided by PHP.

So both we at Wiz, Calif, OpenAI, probably spent many tokens on this.

And from our review of the patch of PHP, it seems like they treat

the root cause of the vulnerability. Essentially, they changed how they handle internal errors.

And all of the vulnerabilities and all of the variants that we reported,

they all stem from the same bug. So they all stem from how PHP handles errors internally.

So from, like, our review of the patch, it seems like it's a good patch.

I won't say that there won't be ever again a vulnerability- … in

PHP error handling. That would be a bad bet. That would be a bad bet. Yeah. But, like, from my perspective, I feel quite confident with the patch.

So, Sagi, what do you think

makes the vulnerability significant? And what do you think makes the discovery itself significant?

Yeah. So PHP powers approximately 70% of the web.

Like, seven out of every 10 websites you

encounter are likely written in PHP. And this vulnerability also dates back to, like, more than a decade ago.

This means that once this is released, there are going to be

many vulnerable websites by many companies that either know or

don't know they're running PHP. So patching this is going to be very difficult for the community.

So, like, this makes the vulnerability very

significant and very critical. And regarding the discovery, actually, this research

changed my view on AI doing vulnerability research.

Like, I was amazed by the capabilities of Frontier model doing

memory corruption exploitation. Like, I did not expect that. Doing memory corruption research and exploitation is very hard even for

a very skilled human researcher. And to do this on this scale, essentially AI enables you

to scale this type of research. Like, if you want a memory corruption exploit for PHP version 5.4 and

PHP version 8.5, it would take a human a research time to do this.

But with AI, you spawn two sub-agents, and you get the same

exploit for both versions of PHP. This is like… This blows my mind.

So you mean that, like, historically, you might need to sort of work

very hard to tailor- Yes, this would have taken- … the payload

to- This would have taken traditionally a human researcher

months of work, and we did this, like, end-to-end in a couple of weeks.

Like, even after you know the vulnerability exists? Yes, yes, yes. Like, even after you know exactly the code, like, it'll still take a few months to- Absolutely. Absolutely. Give, like, a human a description of the vulnerability,

it would take him a lot of time to find the vulnerability and to

write a proper exploit that actually works end-to-end over the internet. It would take him a lot of time to do that.

So this changes everything Yeah. For me personally, absolutely.

So you now become an agent gardener Absolutely. This is what I've been doing for the, I don't know how much time.

Yeah. Yeah. So I think Ryan, our engineer, he came up with this term, like agentic

exploit development, basically. Like- Yeah … so you basically like build an exploit for a target, and

then you do it in your lab, right? And then you set up a lab, like Ubuntu, Apache, or NGINX, you come up with an

exploit, and then you deploy it against a real target over the internet.

And then it may not work, right? Because, you know, there may be differences in config and things like that. In the past, that basically would kill your exploit

because, you know, how could you debug remotely, right?

Now you can tell the AI, "Okay, the exploit worked locally,"

but there may be some different on the server side, on the remote side.

Go and debug it, and it can just, you know, debug and figure

out what was different. And it does it while you sleep. Exactly. Exactly. Yeah. And, yeah, it just like try… It can do that like autonomously,

which is amazing, right? And this is not something, you know, we had just like six months ago, I think.

Yeah. Yeah, I've been hearing the term, the November singularity.

Talking about, I think like Opus 4.7 or something.

Mm-hmm. Yes. That was the time when everything changed.

I think what you mentioned about the lab, I think is also applicable to the defensive side. Like we've been working on building detections for exploitation,

and it was interesting how much we could scale that up as well. Like basically say like just ask an agent, "Let's spin up, you know, 100

different, you know, variations on a vulnerable

instance." You know, this version of Apache, this version of PHP,

this version of WordPress, whatever. And then just try, you know, all sorts of variations on a proof

of concept exploit, and then just see whatever triggers, and then that gives you hints for how you need to build protections against this,

and what sort of traces it leaves on the affected machine.

So it's also interesting, I think, like how detection engineering is also being

scaled up by AI and also doing stuff for us while we sleep.

Yeah. No, man, like, for vulnerability research, 80% of the work used

to be in setting up labs, right? You spend so much time setting up things so that, you know, you have a good target.

Mm-hmm. Now it's just a proper way. You can just tell AI that, "I want a lab like this, go

do it for me." And that's it.

So that actually, like, pretty cool, right? Because you can actually hack more things and/or even defend

more things, like you said. Mm-hmm. So, what did the disclosure process look like? Like how do you… Like, you know that you have this vulnerability, you know that it affects 70% of the internet, right? How do you make sure that the internet is as prepared as it can be

before D-Day, before disclosure day? Yeah. So the disclosure process was actually really interesting in this one,

because this is such a widespread vulnerability, like it impacts,

as you said, like 70% of the internet. We wanted to make sure that it is as easy as possible

for users to be protected. So we talked with like many distros and WAF vendors and cloud providers

to ensure that they all have like either the patches available,

so all of the distros like release the patch on the same day.

We wanted to make sure that web application firewall providers,

they are aware of this and that they have like proper rules set

up to protect customers that cannot apply the patch immediately.

Because it's easy to say to customers, "Please go apply the patch,"

but in practice, it can take a while because either you are not even sure

which PHP applications you have in your organization.

Perhaps some of the PHP applications are legacy applications that you

don't want to update because you're afraid that they're going to break.

So we wanted to make sure that we are attacking this from like multiple

perspectives and that patches are available, WAF rules are

available, and stuff like that. And this actually involved like many companies and many vendors

working this simultaneously. We have like actually a daily meeting with like the PHP

maintainers and OpenAI and Calif and everyone working on this. So it's been really like a very interesting disclosure process.

When we found the bug, you know, we reached out to Volker Dusch

at the PHP Foundation immediately. And, like I mentioned earlier, we shared the exploit.

And then so I think they set up a working group.

Eventually we created a shared channel on Slack with them.

It was just us and them. And then we looped in OpenAI, and then, you know, when we saw that,

like, Wiz also found some bugs, we looped in, like, Wiz, created, like, a

larger channel with, like, everybody, and then set up that daily sync.

And then we found, oh, we need an even larger channel, you know, for the WAF

and the hyperscaler, and everybody who runs, you know, PHP at scale,

including the distro and WordPress and Drupal, you know, all of those people.

So this becomes multiple channels.

And to be honest, this is the first time we did something like this.

I would be lying if I tell you I know what I'm doing.

Luckily, there are people, a lot of people who knows this, right? And they, you know, from Wiz, from OpenAI, from PHP Foundation,

especially from PHP Foundation. I think I, you know, shout out to Volker and Nils and

a bunch of other people there. Volker told us that, you know, they have three people working

on this nonstop since August. And basically the way it works is PHP, we must, like,

fix the thing in PHP first, right? That's the first priority. Get the patch done, and then, you know, everybody gonna review

the patches and then unleash their favorite agents, you know, to

try to find variants and regression.

And then I think we get that done, I think one week, I think

probably five days or 10 days ago. And now the next step is pushes out… PHP didn't release binaries, right, to their customer.

Most of the customer, most of their user actually rely on the Linux

distro for the- Yeah … updates for the, you know, packages.

So the way it usually work is PHP put out a source, a new, you know,

software package, a new software, like source code only update, and then Red

Hat would take the software tarball and create, you know, RPMs out of that.

And then the other downstream distro would rely on Red Hat RPMs

And so on and so forth, right? And then the PHP, the, like WordPress for example, they're

gonna take like the work or the tarball, and they're gonna do something

on their side as well because they may have custom, you know, setup.

So that's how it usually works. And then I mentioned earlier, right, PHP basically does this every month.

So- Mm-hmm … it's like kind of somewhat, you know, a well-practiced, well-oiled machine. At the same time, this is the first time in 10 years that they have

this kind of vulnerability, so they need to involve more people.

You know, in the past it's just the distro. Now it's just like the WAF, the distro, us with OpenAI, and you can see like the

complexity would get like… would become much more, rapidly, right?

And then, you know, the timing as well.

We don't have lots of time because the longer we wait, the higher

the chances that it- Yeah, the chance of it being- Yeah. That's what I wanted to ask, like how do you manage the… How

do you manage the concern that, okay, we found this using AI, other

people have found this using AI. It, you know, from our perspectives it was like finding

the initial vulnerability was maybe surprisingly easy for the AI.

What if someone, what if a bad actor found this like while we're waiting

for the patches to come out? Like how do you manage that situation?

Yeah. So this is exactly why we have like a daily standup with the PHP

maintainers to understand the status and to like validate their patches.

We also try to monitor for exploitation in

the wild, whenever possible. But, yeah, the only way for people to actually be

mitigated is to install that patch.

I do think it's interesting to see… Sorry I think we can do

a lot on our side, but at the same time, you know, there's a lot of things

that outside of our control, right? People can just run and find the same thing.

And there's a lot of people who love PHP out there. And because PHP, you know, is 70% of the internet, so a lot

of, like, threat actors would love, you know, to try it out as well.

So who knows, maybe people found it already, and they didn't really, you

know, share because they want to use it. I think on our side, I think working with like WAF providers like

Cloudflare and the hyperscaler always, you know, and you guys have a lot of

like telemetry and everything, right? So that would be helpful to decide whether this has

been like exploited in the wild. But that's the best that we can do. If like the attacker is careful, and I think it's not easy to detect this attack.

That's the problem as well. You can watch for crashes, but you know, there will be a lot of false

positives and- PHP tends to crash.

Yeah. Good place to hide.

I think it's interesting, like hearing about the disclosure and like

all of the work groups then and the processes and the like the order

of operations that had to be set up to deal with this, it seems like that

is a very healthy and important side effect of this vulnerability existing.

Like the fact that there are now these relationships and, you know, this

coordination and so like the next time a vulnerability like this comes out,

the coordination will be a lot easier. And also, I think it increases the chance that these vulnerabilities

will be discovered by defenders, just by having this, you know, this

trust between all of these different organizations that are involved in the disclosure process. So I think that that's really important that this is happening now.

Yeah, absolutely. I think that there is a lot that happened in this disclosure process that other

vendors can actually take from it. Like, today it's PHP, tomorrow it's another very popular open source

software, and I think that we did some really good things in this disclosure

process that can be used in other disclosure processes as well.

Right. Yeah, I think… Oh, I'm sorry. I think, like, that's one of the things that we want to learn here, right? We believe, like, with the advance of AI, there will be more

bugs like this, and we need to learn how to deal with it, right?

And of course, in the past, we have, like, Log4j, we have React-to-Shell,

even WordPress-to-Shell. All of them are large scale vulnerabilities. But how we should think about, you know, in this age of AI,

when you release something, even a patch, people can just, you know, look

at the patch and come up with an exploit. And it's changed everything, right? Changed disclosure, changed how we work with, like, maintainers

and downstream distributors. So I think the experience that we collectively gain from this,

from this, you know, saga, I guess, would be super helpful for the

industry, for the internet as well

All right. So this was great. If anyone wants to learn more about these vulnerabilities, then

please check out the various blog posts that Wiz and Calif and

OpenAI and PHP's advisories, to learn more about the vulnerabilities

themselves, how they work, and how you can defend yourself against them and what you need to patch to. So thank you very much, Thai and Sagi.

If you've enjoyed the show, be sure to subscribe, share a link to

the podcast, but not your cloud keys. And as always, if your cloud security strategy is making you

cry, don't worry, just cry out cloud. Thank you for having me. Thank you. Thank you for coming on.

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 538 sources the paper read this month. Text and HTML, one-click unsubscribe, free.

How often
Your desks