PHPCSStandards PHP_CodeSniffer
PHP_CodeSniffer gitblame report command injection via crafted filename
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 versions and mitigation
From the CVE record and the vendor's references.Affected
- < 3.13.6
- >= 4.0.0, < 4.0.2
Fixed in 3.13.6, 4.0.2
Mitigation
Upgrade PHP_CodeSniffer to 3.13.6 or 4.0.2 or later.
References
- Vendor advisory github.com/PHPCSStandards/PHP_CodeSniffer/secu…
- Patch github.com/PHPCSStandards/PHP_CodeSniffer/pull…
- Patch github.com/PHPCSStandards/PHP_CodeSniffer/comm…
3 more
Timeline
Days relative to CVE publicationNo public PoC found yet; not in CISA KEV.
PoC repositories
Found on GitHub.No PoC repositories found yet.