All vulnerabilities
CRITICALSupply chainexploited in the wild

SC-PHP-GIT-2021

CI/CD · Git infrastructure · PHP (php-src)

Summary

On March 28, 2021, attackers compromised PHP's self-hosted Git server at git.php.net and pushed two malicious commits directly to the php-src master branch, the canonical source for the PHP interpreter used by a large share of the web. The first commit was disguised as a minor typo fix and the second as a revert, with the author and committer fields forged to impersonate PHP creator Rasmus Lerdorf and core maintainer Nikita Popov, exploiting the fact that Git lets anyone locally set arbitrary commit authorship. The injected code added a backdoor in the request-handling path that inspected the incoming User-Agentt header and, if its value began with the string zerodium, passed the remainder to zend_eval_string to execute attacker-supplied PHP code, yielding unauthenticated remote code execution on any server built from the poisoned source. The code carried the comment 'REMOVETHIS: sold to zerodium, mid 2017'. Maintainers caught the commits during routine post-commit review and reverted them before any release build incorporated them, and investigators concluded the git.php.net server itself was breached rather than an individual account. In response, PHP discontinued its own Git infrastructure and moved the canonical repository to GitHub.

How to avoid it in your code

  • Move canonical source off self-hosted Git onto a hardened, audited forge with enforced authentication.
  • Require cryptographically signed commits and verify signatures in branch protection.
  • Enforce mandatory code review and protected branches before merge to release branches.
  • Audit and rebuild from a known-clean source after any infrastructure compromise.
  • Reproduce release artifacts from verified commits to confirm no injected code.

References

Related vulnerabilities

All Supply chain →