GIVE YOUR AGENT THE EVIDENCE

Set up in your agent.

One prompt to get started. Paste it into your coding agent to connect cve.new through MCP and bring vulnerability context into your workflow.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GIVE YOUR AGENT THE EVIDENCE

Investigate in your agent.

Turn this advisory into a focused investigation. Ask your agent to check your project’s versions, explain the evidence, and suggest a compatible fix.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GHSA-hmqg-cxww-wqhqhigh7.3

PHP_CodeSniffer gitblame report command injection via crafted filename

Check your stack

The advisory, in context

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.

Affected packages

Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.

Ecosystem versions

Earlier releases before 3.13.6

Fixed in 3.13.6

102 explicitly affected versions

1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.5.0, 1.5.0RC1, 1.5.0RC2, 1.5.0RC3, 1.5.0RC4, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 2.0.0, 2.0.0RC1, 2.0.0RC2, 2.0.0RC3, 2.0.0RC4, 2.0.0a1, 2.0.0a2, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.5.0, 2.5.1, 2.6.0, 2.6.1, 2.6.2, 2.7.0, 2.7.1, 2.8.0, 2.8.1, 2.9.0, 2.9.1, 2.9.2, 3.0.0, 3.0.0RC1, 3.0.0RC2, 3.0.0RC3, 3.0.0RC4, 3.0.0a1, 3.0.1, 3.0.2, 3.1.0, 3.1.1, 3.10.0, 3.10.1, 3.10.2, 3.10.3, 3.11.0, 3.11.1, 3.11.2, 3.11.3, 3.12.0, 3.12.1, 3.12.2, 3.13.0, 3.13.1, 3.13.2, 3.13.3, 3.13.4, 3.13.5, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.3.0, 3.3.1, 3.3.2, 3.4.0, 3.4.1, 3.4.2, 3.5.0, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.5.5, 3.5.6, 3.5.7, 3.5.8, 3.6.0, 3.6.1, 3.6.2, 3.7.0, 3.7.1, 3.7.2, 3.8.0, 3.8.1, 3.9.0, 3.9.1, 3.9.2

View affected-version evidence
{
  "ranges": [
    {
      "events": [
        {
          "introduced": "0"
        },
        {
          "fixed": "3.13.6"
        }
      ],
      "type": "ECOSYSTEM"
    }
  ],
  "versions": [
    "1.4.2",
    "1.4.3",
    "1.4.4",
    "1.4.5",
    "1.4.6",
    "1.4.7",
    "1.4.8",
    "1.5.0",
    "1.5.0RC1",
    "1.5.0RC2",
    "1.5.0RC3",
    "1.5.0RC4",
    "1.5.1",
    "1.5.2",
    "1.5.3",
    "1.5.4",
    "1.5.5",
    "1.5.6",
    "2.0.0",
    "2.0.0RC1",
    "2.0.0RC2",
    "2.0.0RC3",
    "2.0.0RC4",
    "2.0.0a1",
    "2.0.0a2",
    "2.1.0",
    "2.2.0",
    "2.3.0",
    "2.3.1",
    "2.3.2",
    "2.3.3",
    "2.3.4",
    "2.4.0",
    "2.5.0",
    "2.5.1",
    "2.6.0",
    "2.6.1",
    "2.6.2",
    "2.7.0",
    "2.7.1",
    "2.8.0",
    "2.8.1",
    "2.9.0",
    "2.9.1",
    "2.9.2",
    "3.0.0",
    "3.0.0RC1",
    "3.0.0RC2",
    "3.0.0RC3",
    "3.0.0RC4",
    "3.0.0a1",
    "3.0.1",
    "3.0.2",
    "3.1.0",
    "3.1.1",
    "3.10.0",
    "3.10.1",
    "3.10.2",
    "3.10.3",
    "3.11.0",
    "3.11.1",
    "3.11.2",
    "3.11.3",
    "3.12.0",
    "3.12.1",
    "3.12.2",
    "3.13.0",
    "3.13.1",
    "3.13.2",
    "3.13.3",
    "3.13.4",
    "3.13.5",
    "3.2.0",
    "3.2.1",
    "3.2.2",
    "3.2.3",
    "3.3.0",
    "3.3.1",
    "3.3.2",
    "3.4.0",
    "3.4.1",
    "3.4.2",
    "3.5.0",
    "3.5.1",
    "3.5.2",
    "3.5.3",
    "3.5.4",
    "3.5.5",
    "3.5.6",
    "3.5.7",
    "3.5.8",
    "3.6.0",
    "3.6.1",
    "3.6.2",
    "3.7.0",
    "3.7.1",
    "3.7.2",
    "3.8.0",
    "3.8.1",
    "3.9.0",
    "3.9.1",
    "3.9.2"
  ]
}
Ecosystem versions

From 4.0.0 before 4.0.2

Fixed in 4.0.2

2 explicitly affected versions

4.0.0, 4.0.1

View affected-version evidence
{
  "ranges": [
    {
      "events": [
        {
          "introduced": "4.0.0"
        },
        {
          "fixed": "4.0.2"
        }
      ],
      "type": "ECOSYSTEM"
    }
  ],
  "versions": [
    "4.0.0",
    "4.0.1"
  ]
}

References