WordPress Coding Standards (WordPressCS) contains an arbitrary code execution vulnerabilityGHSA-3pwp-g2mj-5p3v
HIGHFix: WordPress/WordPress-Coding-Standards#2771GHSA-3pwp-g2mj-5p3v is a high-severity (CVSS 8.6) CWE-95 vulnerability in wp-coding-standards/wpcs. A fix is available for wp-coding-standards/wpcs — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- A successful exploit gives an attacker total control of the affected component, not partial access.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-3pwp-g2mj-5p3v.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
wp-coding-standards/wpcsReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
Impact
WordPress Coding Standards (WordPressCS) versions before 3.4.1 contain an arbitrary code execution vulnerability in the WordPress.WP.EnqueuedResourceParameters sniff. As a result, running PHPCS with WordPressCS over untrusted PHP code, 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.
This affects users of the WordPress and WordPress-Extra rulesets. The WordPress-Core ruleset and the WordPress-Docs ruleset are not affected.
The vulnerability happens when the sniff checks whether the $var argument passed to functions such as wp_enqueue_script() or wp_register_script() evaluates to a falsy value. The sniff's is_falsy() method reconstructed the argument and ran it through eval(). Because of this, a maliciously crafted $ver argument such as 'system'('id') would be executed during the scan.
Patches
This issue has been fixed in WordPressCS 3.4.1. We recommend all users upgrade to 3.4.1 or later.
Workaround
Users of the WordPress and WordPress-Extra rulesets, who cannot upgrade immediately, can disable the affected sniff by adding an <exclude> tag to their custom ruleset (the <rule> ref value might vary depending on the ruleset):
<rule ref="WordPress">
<exclude name="WordPress.WP.EnqueuedResourceParameters"/>
</rule>
To verify that the sniff has been disabled, run PHPCS with the -e flag, which lists all the sniffs a standard will run. WordPress.WP.EnqueuedResourceParameters should no longer appear in the output under the WordPress section:
phpcs -e --standard=/path/to/ruleset.xml
Credits
Many thanks to @FORIMOC 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 WPCS repository.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | wp-coding-standards/wpcs | ≥ 0.14.1&&< 3.4.1 | 3.4.1composer require wp-coding-standards/wpcs:^3.4.1 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for wp-coding-standards/wpcs, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update wp-coding-standards/wpcs to 3.4.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-3pwp-g2mj-5p3v is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Frequently Asked Questions
Is GHSA-3pwp-g2mj-5p3v in your dependencies?
Find it across Packagist, including transitive dependencies.