CVE-2026-67434
JSON

7.3high

PHP_CodeSniffer gitblame report command injection via crafted filename

Severity
7.3high CVSS:4.0 by GitHub_M
Exploit likelihood
0.77% (higher than 56% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-hmqg-cxww-wqhq

Description

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards. Prior to versions 3.13.6 and 4.0.2, PHP_CodeSniffer contains a command injection vulnerability in the code that generates the Gitblame, Hgblame, and Svnblame report formats. As a result, running PHP_CodeSniffer 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.

Affected

Product or packageVersionsReported by
PHPCSStandards PHP_CodeSniffer< 3.13.6, >= 4.0.0, < 4.0.2CVE List
squizlabs/php_codesniffer (Packagist)before 3.13.6, from 4.0.0 before 4.0.2GitHub Advisory Database

All scores

GitHub_M7.3high CVSS:4.0CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Classification

CWE-78

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards. Prior to versions 3.13.6 and 4.0.2, PHP_CodeSniffer contains a command injection vulnerability in the code that generates the Gitblame, Hgblame, and Svnblame report formats. As a result, running PHP_CodeSniffer 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.

GitHub Advisory Database
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.

NVD (es)

PHP_CodeSniffer tokeniza archivos PHP y detecta violaciones de un conjunto definido de estándares de codificación. Antes de las versiones 3.13.6 y 4.0.2, PHP_CodeSniffer contiene una vulnerabilidad de inyección de comandos en el código que genera los formatos de informe Gitblame, Hgblame y Svnblame. Como resultado, ejecutar PHP_CodeSniffer sobre archivos no confiables, por ejemplo en una tubería de integración continua que escanea solicitudes de extracción, o en una máquina de desarrollador revisando código de terceros, podría resultar en la ejecución de comandos de shell controlados por el atacante cuando el informe Gitblame, Hgblame o Svnblame procesa un archivo cuyo nombre contiene metacaracteres de shell. Los usuarios que utilizan el informe Full predeterminado, o cualquiera de los otros informes no-blame, no se ven afectados. Los usuarios en una plataforma de tiempo de ejecución que no permite que los nombres de archivo contengan metacaracteres de shell, como ” y ;, no se ven afectados. Este problema está solucionado en las versiones 3.13.6 y 4.0.2.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-67434 changed 2026-08-07CVE Terms of Use
GitHub Advisory DatabaseGHSA-hmqg-cxww-wqhq changed 2026-08-06CC-BY-4.0
NVDCVE-2026-67434 changed 2026-10-24Public domain