GHSA-r6hr-vr92-vv28: High severity composer/phpcsstandards/phpcsutils vulnerability

Published Sep 29, 2026
·
Updated

Impact

PHPCSUtils versions 1.0.0-alpha1 through 1.2.2 contain an arbitrary code execution vulnerability in PHPCSUtils\AbstractSniffs\AbstractArrayDeclarationSniff::getActualArrayKey(). The vulnerable method is reached by any sniff that extends AbstractArrayDeclarationSniff and calls getActualArrayKey().

Running PHPCS over untrusted PHP code through such a sniff, for example, in a CI pipeline that lints pull requests, or on a developer machine reviewing third-party code, could lead to arbitrary command execution on the scanning host.

The vulnerability happens when the method determines the value of an array key using eval(). A maliciously crafted array key such as 'system'('id') would be executed when the code was scanned.

Known attack vectors

Known code paths that reach the vulnerable method include the following PHPCSExtra sniffs:

- Universal.Arrays.DuplicateArrayKey - Universal.Arrays.MixedArrayKeyTypes

Other packages that call AbstractArrayDeclarationSniff::getActualArrayKey() may also be vulnerable.

Patches

This issue has been fixed in PHPCSUtils 1.2.3. We recommend all users upgrade to 1.2.3 or later.

Workaround

Users who cannot upgrade immediately can disable the sniffs that reach the vulnerable method by adding <exclude> tags to their custom ruleset (replace the placeholder standard and sniff names with the ones used in your setup):

xml <rule ref="Standard"> <exclude name="Standard.Category.SniffName"/> </rule>

For example, to disable the two PHPCSExtra sniffs listed under "Known attack vectors":

xml <rule ref="Universal"> <exclude name="Universal.Arrays.DuplicateArrayKey"/> <exclude name="Universal.Arrays.MixedArrayKeyTypes"/> </rule>

To verify that the sniffs have been disabled, run PHPCS with the -e flag, which lists all the sniffs a standard will run. The excluded sniffs should no longer appear in the output:

phpcs -e --standard=/path/to/ruleset.xml

Credits

Many thanks to @rodrigoprimo 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 PHPCSUtils repository.

Affected Software

1 affected componentFixes available
composer/phpcsstandards/phpcsutils>=1.0.0-alpha1<1.2.3
1.2.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/phpcsstandards/phpcsutils to a version that resolves this vulnerability.

    Fixed in 1.2.3
  2. Upgrade

    Upgrade PHPCSUtils to a version that resolves this vulnerability.

    Fixed in 1.2.3
  3. Configuration

    Add <exclude> tags for Universal.Arrays.DuplicateArrayKey and Universal.Arrays.MixedArrayKeyTypes to disable the vulnerable PHPCSExtra sniffs if PHPCSUtils cannot be upgraded immediately.

    PHPCS custom ruleset excluded sniffs = Universal.Arrays.DuplicateArrayKey; Universal.Arrays.MixedArrayKeyTypes

Event History

Sep 29, 2026
Advisory Published
via GitHub·05:57 PM
Data Sourced
via GitHub·05:57 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which environments are most exposed to exploitation?

Environments that run PHPCS against untrusted PHP code are exposed, including CI systems that lint pull requests and developer machines used to review third-party code. Exploitation results in command execution on the host performing the scan.

2

What does an attacker need to do to trigger the issue?

An attacker needs to supply PHP code that is scanned by a sniff extending AbstractArrayDeclarationSniff and calling getActualArrayKey(). A malicious array key such as 'system'('id') can be executed during scanning.

3

Which sniffs are known to reach the vulnerable code path?

Known affected code paths include the PHPCSExtra sniffs Universal.Arrays.DuplicateArrayKey and Universal.Arrays.MixedArrayKeyTypes. Other packages may also be affected if they call AbstractArrayDeclarationSniff::getActualArrayKey().

4

How can I determine whether an installation needs remediation?

Installations using PHPCSUtils versions 1.0.0-alpha1 through 1.2.2 need remediation if their scanning configuration can reach getActualArrayKey(), particularly through the known PHPCSExtra sniffs. The issue is fixed in PHPCSUtils 1.2.3 and later.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203