GHSA-mhfv-8rc9-w38c: Squizlabs/php codesniffer Arbitrary Shell Execution Vulnerability

HIGH
Published
Advisory Summary

GHSA-mhfv-8rc9-w38c is a HIGH arbitrary shell execution vulnerability (General Security Weakness) affecting Squizlabs/php codesniffer libraries in the Packagist ecosystem. The issue involves arbitrary shell execution. Remediation is available by upgrading affected packages to version 2.8.1.

GHSA-mhfv-8rc9-w38c at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-mhfv-8rc9-w38c
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Squizlabs/php codesniffer
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix GHSA-mhfv-8rc9-w38c

To remediate this vulnerability, upgrade all affected Squizlabs/php codesniffer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

squizlabs/php_codesniffer fixed: 2.8.1
Upgrade squizlabs/php_codesniffer to 2.8.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for squizlabs/php_codesniffer

How to Check if You Are Affected

To determine whether your application is affected by GHSA-mhfv-8rc9-w38c, inspect your project dependencies for Squizlabs/php codesniffer:

inspect dependencies for squizlabs/php_codesniffer

Analyze the terminal output to locate any version of Squizlabs/php codesniffer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.8.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Squizlabs/php codesniffer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Uses of shell_exec() and exec() were not escaping filenames and configuration settings in most cases

GHSA-mhfv-8rc9-w38c Affected Squizlabs/php codesniffer Versions

1 component(s)
Fixed Versions:
2.8.1
Product / Package Ecosystem Affected Versions Fixed Version
squizlabs/php_codesniffer
Packagist
≥ 1.0.0
< 2.8.1
2.8.1

References

Frequently Asked Questions

What is GHSA-mhfv-8rc9-w38c?
GHSA-mhfv-8rc9-w38c is a security vulnerability in Squizlabs/php codesniffer involving Arbitrary shell execution under General Security Weakness.
Which Squizlabs/php codesniffer versions are affected?
Affected versions include releases prior to 2.8.1 across affected packages: squizlabs/php_codesniffer.
What version fixes GHSA-mhfv-8rc9-w38c?
Upgrading to 2.8.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is squizlabs/php_codesniffer affected?
Yes, squizlabs/php_codesniffer is affected in releases prior to 2.8.1. Upgrade your dependency to 2.8.1 or later.
What CWE is associated with GHSA-mhfv-8rc9-w38c?
GHSA-mhfv-8rc9-w38c is classified under General Security Weakness.
How can I check Packagist dependencies for GHSA-mhfv-8rc9-w38c?
Run the dependency tree command: 'inspect dependencies for squizlabs/php_codesniffer'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mhfv-8rc9-w38c",
  "modified" : "2022-03-26T00:06:00Z",
  "published" : "2022-03-26T00:06:00Z",
  "aliases" : [ ],
  "summary" : "Arbitrary shell execution",
  "details" : "Uses of shell_exec() and exec() were not escaping filenames and configuration settings in most cases",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "squizlabs/php_codesniffer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "2.8.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/squizlabs/php_codesniffer/2017-03-01.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/squizlabs/PHP_CodeSniffer"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/2.8.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-26T00:06:00Z",
    "nvd_published_at" : null
  }
}