A backdoor in PHP's core: how attackers tampered with the web language's source code

Airnite editorial team21 November 2026 · 6 min

In short

In March 2021, two tampered commits landed in the official PHP source code, disguised under the names of well-known developers. How the backdoor worked and what every software team should learn from it.

Published
Reading time
6 min
Author
Airnite editorial team
2tampered commitsunder the names of Rasmus Lerdorf and Nikita Popov (php.internals, 28 Mar 2021)
11lines of malicious codein ext/zlib/zlib.c, disguised as “Fix typo” (GitHub)
0logins neededcode execution via an HTTP header for any visitor (commit content)
2FArequired for write accesssince then only via the PHP organisation on GitHub (php.internals)

PHP powers many content management systems, online shops and customer portals. On 28 March 2021, two changes appeared in the PHP project's official source code repository that looked harmless. One of them was titled “Fix typo”. In fact it added a backdoor that would have allowed arbitrary code to be executed on any server running a PHP build with that change.

What happened?

According to an announcement by PHP core developer Nikita Popov on the php.internals mailing list, two malicious commits were pushed to the php-src repository, one under the name of PHP's creator Rasmus Lerdorf and one under Popov's own name. According to ESET, the first change was noticed during a routine review after the commit and was quickly reverted; developers from the community asked what the code actually did.

The project responded fundamentally. Its own Git server, git.php.net, was to be retired, and the former mirrors on GitHub became the canonical source. Since then, write access has been limited to members of the PHP organisation on GitHub, which requires two-factor authentication. The commit text mentioned “Zerodium”, a vulnerability broker; according to ESET, its CEO denied any involvement.

How does the attack work?

The malicious code is eleven lines in the file for zlib compression. It reads an HTTP header with the barely noticeable name “User-Agentt” (with a double t). If the value starts with the word “zerodium”, PHP executes the rest of the header as program code. An attacker would only have had to send a crafted request to a website – no login, no password.

How the attackers were able to push was explained in an update on 6 April 2021. By then the team no longer believed the Git server had been compromised. The changes had been pushed over HTTPS with password authentication against the master.php.net user database; it was possible that this database had leaked. The team switched to modern password hashing, reset all php.net passwords and rebuilt the server.

Who is affected?

The attack did not target a single company but the software supply chain: whoever manipulates code at the source reaches everyone who later uses it. The backdoor was spotted early thanks to attentive reviewers, not because of a technical barrier. According to Popov, as reported by ESET, the change was removed before it reached production use.

The pattern affects every company that develops its own software or uses third-party libraries. Old self-hosted servers with their own user management, password logins without a second factor and trust in well-known names in the commit history are exactly the weaknesses exploited here. A name on a commit does not prove who actually wrote it.

What should you do now?

PHP's measures are a good template: manage write access centrally, make two-factor authentication mandatory, shut down legacy systems and store passwords securely. Add a review process that takes small changes seriously. The backdoor was disguised as a typo fix – exactly the kind of commit that tends to be waved through.

Anyone using third-party software should know where every component comes from and obtain updates from defined sources. The checklist below sums up the key steps.

How does Airnite help?

Airnite develops software with a clean supply chain: protected repositories, mandatory reviews, signed commits and dependency checks in the build pipeline. In a penetration test, we check whether developer accounts, Git servers and build systems can be attacked from outside. In consulting, we show your team how to introduce processes that make such manipulation visible early.

Note: background article on a 2021 incident that is regarded as a textbook case of software supply chain attacks. Research status: 21 November 2026.

Checklist: what to do now

  • Grant write access to code repositories only through centrally managed accounts with two-factor authentication; shut down old servers and access paths.
  • Approve every change to the main branch via pull request and four-eyes review – including “typo fixes”.
  • Sign commits and verify signatures in the build pipeline.
  • Look out for suspicious patterns in reviews: eval calls, unusual header names, code in compression or logging modules.
  • Protect password databases for developer accounts with modern hashing and reset all passwords after an incident.
  • Inventory your own dependencies (SBOM) and obtain them only from trusted, defined sources.

PDF edition

The complete article with checklist and sources to share, print or bring to your next meeting.

Questions about this article?

Message us directly on WhatsApp. An Airnite expert will get back to you.

How Airnite helps

Sources

Every fact in this article is based on the sources below. Primary sources are marked.

  1. php.internals · Nikita Popov: Changes to Git commit workflow 28 Mar 2021 Primary sourcePrimary source: two tampered commits, suspected compromise of git.php.net, move to GitHub, 2FA requirement
  2. php.internals · Nikita Popov: Update on git.php.net incident 6 Apr 2021 Primary sourcePrimary source: server probably not compromised, possible leak of the user database, password reset
  3. GitHub · php/php-src commit c730aa2 “[skip-ci] Fix typo” 28 Mar 2021 Primary sourcePrimary source: content of the malicious code in ext/zlib/zlib.c
  4. ESET WeLiveSecurity · Backdoor added to PHP source code in Git server breach 30 Mar 2021Security research: discovery in review, explanation of how it works, Zerodium denial

General editorial information, not legal advice and not an assessment of your individual systems. Status: date of publication.

Can your systems be reached from the internet?

We check it with you: fast, confidential and with a clear list of actions.

Talk to an expert now