archive / 2026

PHP2Shell: the patch night I got to skip

A critical PHP bug hit the front page of Hacker News today. Checking whether it affected this blog took five minutes. Reading the access log afterwards was more interesting: more than half of all requests to this site are attacks.

This evening a link to the PHP 8.2.35 release climbed to the top of Hacker News. It’s part of a coordinated set of PHP security releases for a pair of bugs that people quickly nicknamed PHP2Shell. They live in the session.upload_progress code path, and according to the advisory quoted in the thread, every PHP installation that serves web requests is at risk: PHP-FPM, mod_php, php-cgi, the lot.

The details were still settling while I read the thread. One of the two CVEs was reportedly withdrawn, and people were arguing about whether the other one really leads to code execution. Debian had patched packages out early. Some other distributions and the official Docker images were still catching up.

I’ve written this kind of post before: Heartbleed was a night of replacing certificates, and Log4Shell ate a Christmas. So I did what I always do now. I opened a terminal and typed ssh before I’d finished reading the advisory.

“We don’t run PHP” is a hypothesis#

My first thought was “this blog doesn’t run PHP”. That’s exactly the kind of sentence that cost me a Christmas in 2021, when “we’re a Go shop” turned out to mean “we’re a Go shop with Java in four places nobody remembered”. A belief about your own systems is a hypothesis until you’ve checked it.

Checking took less time than reading the advisory:

$ dpkg -l | grep -ci php
0
$ command -v php php-fpm php-cgi
$ pgrep -l php
$ grep -ci php /etc/caddy/Caddyfile
0

No PHP packages, no PHP binaries, no PHP processes, and Caddy doesn’t pass anything on to a FastCGI backend. The blog is a folder of HTML files built by Hugo. There’s simply nothing on this server that could parse a PHP session, let alone one with an upload progress field in it.

While I was logged in anyway, I asked apt what was waiting:

$ apt-get -s upgrade | grep ^Inst
Inst ca-certificates [20250419] (20250419+deb13u1 Debian-Security:13/stable-security [all])

One package, and not a PHP one. Since last week this server runs unattended-upgrades, which installs Debian’s updates every morning. It had already run today, before this update appeared, so it’ll pick it up tomorrow. That’s the whole patch night: zero minutes.

What the internet asks my server#

Which made me curious. Since last week, Caddy writes an access log for this site. It keeps 30 days and then throws them away. So I had nine days of data, from October 13 until tonight. What does the internet actually ask a small static blog?

Mostly, it turns out, for things that aren’t there.

Out of 11,700 requests, 6,338 were scanners looking for something to break into, sent from 443 different addresses. More than half of all traffic to this site is not people reading it. Here’s what they were after:

What they’re looking forRequests
PHP scripts1,961
.env files, in 352 spellings2,846
other WordPress files1,185
cloud credentials, SSH keys, config files245
a .git directory101
total6,338

All of them got the same answer: my 404 page. Nine days of scanning, and not one of these requests found a file.

Counting doesn’t need anything fancy. Caddy logs one JSON object per request, so a few lines of Python will do:

zcat -f /var/log/caddy/access.log* | python3 -c '
import sys, json, collections
seen = collections.Counter()
for line in sys.stdin:
    uri = json.loads(line)["request"]["uri"].lower()
    for needle in (".php", ".env", "/.git", "wp-"):
        if needle in uri:
            seen[needle] += 1
            break
print(seen.most_common())'

The .env lottery#

The most popular target isn’t PHP at all. It’s .env files: the file where frameworks keep database passwords and API keys, and which ends up in a web root more often than anyone likes to admit. The scanners don’t just try /.env. They tried 352 different variants: .env.save, .env.bak, .env.old, .env.production, .env.staging, /app/.env, /config/.env, /api/.env, and so on. Each one is a guess at how someone might have made a backup in a hurry.

If you deploy anything with a .env file: check today that your web server can’t serve it, under any name.

Bots that want to install WordPress for you#

The single most requested URL was /wp-admin/install.php, with 1,170 requests from 144 addresses. That’s not a vulnerability scan. It’s something worse: if you upload WordPress and don’t finish the setup screen right away, the first visitor to install.php gets to choose the admin password. From there it’s one plugin upload to running code on your server. Bots check for that, constantly, on every domain they know about. Freshly registered domains are especially interesting, because that’s where people are halfway through setting something up.

My favourite detail: in 1,144 of those requests, the User-Agent header was the URL itself, http://domienator.com/wp-admin/install.php?step=1. Somebody’s scanner has a bug, and it puts the target in the wrong header. Nobody has noticed, because nobody reads these logs.

The other WordPress requests were mostly for wlwmanifest.xml, a leftover from Windows Live Writer that’s a reliable sign of a WordPress install. The scanners looked for it in 19 directories: /wordpress/, /blog/, /wp/, /shop/, /sito/, and also /2018/, /2019/, /2020/ and /2021/. This blog does have a /2019/. There’s just no WordPress in it.

No PHP2Shell rush (yet)#

I half expected a spike today. Exploiting the session upload progress bug needs a POST to a PHP script, and a fresh critical CVE usually gets mass scanning within hours. Here are the PHP requests per day:

Oct 13Oct 14Oct 15Oct 16Oct 17Oct 18Oct 19Oct 20Oct 21
289248345183164223166179164

Today looks like any other day. In nine days there were only 4 POST requests to a PHP script, and none of them today. The scanners are still knocking on the same doors as last week. I suspect that’ll change once someone publishes a working exploit, and I’ll check again in a few days. It’s a cheap experiment when the answer can only be 404.

The other front door#

The web server isn’t the only thing that gets visitors. SSH saw between 722 and 2,081 failed login attempts per day this week. That’s noise, too: this server only accepts SSH keys, so guessing passwords gets you nowhere, no matter how many you try.

Since last week, a small nftables firewall also limits each address to 10 new SSH connections per minute. Since the last reboot, two days ago, it dropped 705 connection attempts from addresses that were in too much of a hurry. It also dropped 53,730 packets sent to ports where nothing listens at all. I didn’t have to do anything for those numbers, which is the point.

Boring, on purpose#

I don’t want to be smug about this. A static site isn’t invulnerable. Something still has to talk to the internet. On this server that’s Caddy and OpenSSH, with the Linux kernel underneath them and the small Go service that powers the live features behind Caddy. Those can have bugs, and one day one of them will. When that happens, it’ll be my turn for a patch night. Debian’s updates install themselves now, but Caddy comes from its own repository, and a Go program only gets the fixes from a new Go release when I rebuild it.

But the difference with my Log4Shell Christmas is huge. Every piece of software that runs is software I chose. I can list it from memory, and I can check that list in five minutes. Everything that isn’t there, like PHP, WordPress, a database or an admin panel, can’t be broken into, no matter how creative the bots get. I wrote about this a few years ago in Boring technology is a feature. It’s nice when the theory survives contact with an actual Wednesday evening.

So, if you run PHP: go patch, because this one is serious. If you don’t, spend the five minutes anyway and check that you really don’t. And while you’re in there, have a look at your access log. It’s the most honest description of the internet you’ll ever read: a few thousand robots, every day, patiently asking for a file called .env.save.

    Tip: / opens search, ↑↓ to select, ↵ to open.