CVE-2026-67434: PHP_CodeSniffer gitblame report command injection via crafted filename
Impact
PHPCodeSniffer versions before v3.13.6 and v4.0.2 contain a command injection vulnerability in the code creating the Gitblame, Hgblame and Svnblame report(s).
As a result, running PHPCodeSniffer over untrusted files, for example, in a CI pipeline that scans pull requests, or on a developer machine reviewing third-party code, could result in attacker-controlled shell commands being executed when the Gitblame, Hgblame or Svnblame report(s) would process a file whose name contains shell metacharacters.
Users using the default Full report, or any of the other non-blame reports, are not affected. Users on a runtime platform which does not allow filenames to contain shell metacharacters, such as " and ;, are not affected.
Patched versions
The issue has been fixed in PHPCodeSniffer v3.13.6 and v4.0.2. We recommend all users upgrade to these versions at their earliest convenience.
Workaround
Users of PHPCodeSniffer who cannot upgrade immediately should ensure they do not use the Gitblame, Hgblame or the Svnblame reports when scanning untrusted code.
This is especially relevant for CI jobs, pre-commit or review tooling, automated review services, and any service that scans untrusted repositories or uploaded source trees.
Credits
Many thanks to both @Faze-up and @edorian for responsibly disclosing this vulnerability.
How can I report a security bug?
Please report security vulnerabilities privately via the "Security and quality" tab on the PHPCodeSniffer repository.
Other sources
PHPCodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards. Prior to versions 3.13.6 and 4.0.2, PHPCodeSniffer contains a command injection vulnerability in the code that generates the Gitblame, Hgblame, and Svnblame report formats. As a result, running PHPCodeSniffer over untrusted files, for example in a continuous integration pipeline that scans pull requests, or on a developer machine reviewing third party code, could result in attacker controlled shell commands being executed when the Gitblame, Hgblame, or Svnblame report processes a file whose name contains shell metacharacters. Users using the default Full report, or any of the other non-blame reports, are not affected. Users on a runtime platform which does not allow filenames to contain shell metacharacters, such as " and ;, are not affected. This issue is fixed in versions 3.13.6 and 4.0.2.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/squizlabs/php_codesnifferto a version that resolves this vulnerability.Fixed in 4.0.2 - Upgrade
Upgrade
composer/squizlabs/php_codesnifferto a version that resolves this vulnerability.Fixed in 3.13.6 - Upgrade
Upgrade
PHP_CodeSnifferto a version that resolves this vulnerability.Fixed in 3.13.6 - Upgrade
Upgrade
PHP_CodeSnifferto a version that resolves this vulnerability.Fixed in 4.0.2 - Configuration
If you cannot upgrade from versions before v3.13.6 and v4.0.2, do not use the Gitblame, Hgblame, or Svnblame report(s) when scanning untrusted code.
PHP_CodeSniffer report formats (Gitblame/Hgblame/Svnblame) Use of Gitblame, Hgblame, Svnblame reports = disabled
Event History
Frequently Asked Questions
What is the severity of CVE-2026-67434?
CVE-2026-67434 has a risk rating of 60, indicating a moderate severity level.
What vulnerability does CVE-2026-67434 represent?
CVE-2026-67434 represents a command injection vulnerability in PHP_CodeSniffer affecting specific report generation functions.
How do I fix CVE-2026-67434?
To fix CVE-2026-67434, upgrade PHP_CodeSniffer to version 3.13.6 or 4.0.2 or later.
What software is affected by CVE-2026-67434?
CVE-2026-67434 affects PHP_CodeSniffer versions prior to 3.13.6 and 4.0.2.
In what scenarios is CVE-2026-67434 a risk?
CVE-2026-67434 poses a risk when running PHP_CodeSniffer on untrusted files, particularly in CI pipelines.