CVE-2024-31211
Medium · 5.5CVSS
5.5
EPSS
2.8%
Published
Apr 4, 2024
CISA due date
—
Cloudanix analysis
A problem in older WordPress versions lets site administrators run unauthorized code on the server, which could allow them to take control of the website.
- Exploitation
- Remote Authenticated
- Attacker needs
- High Privilege
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Web Framework
- Class
- Deserialization
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Unserialization of WP_HTML_Token instances invokes arbitrary code execution through the class __destruct() magic method.
Why it matters to the business
Administrators could gain the ability to run unauthorized code on the web server, enabling site takeover, data exposure, or defacement; the issue affects a widely deployed publishing platform with millions of installations.
How an attack unfolds
An attacker with administrative privileges crafts a malicious serialized WP_HTML_Token object, submits it through an entry point that triggers unserialization, and the destructor executes attacker-controlled code.
How to fix it
Upgrade WordPress to version 6.4.2 or newer. For git-based deployments apply commit 0730353098a9e36a319695d1f28c122361e4aef7 in wordpress/wordpress or ec3f364c491bac22e7479b00074c6b004bdd0592 in wordpress/wordpress-develop.
How to confirm the fix worked
Verify the installed WordPress core version is 6.4.2 or later; inspect source files for the presence of the referenced commit hashes or updated WP_HTML_Token destructor logic.
Typical attack path
- Obtain high-privileged (administrator) access
- Craft and inject a serialized WP_HTML_Token payload containing malicious code references
- Trigger unserialization of the object via an affected code path
- Execute arbitrary code in the context of the web server process
How to detect it
Review web server and application logs for serialized object patterns containing WP_HTML_Token references, unexpected destructor activity, or PHP unserialize errors around administrative actions.
What your security team should do
- Immediately upgrade all WordPress instances to 6.4.2 or newer
- Audit administrative accounts and limit unnecessary high-privilege access
- Enable application logging for unserialize operations and review for anomalies
- Monitor EPSS and exploit maturity indicators for any future changes
The record
WordPress is an open publishing platform for the Web. Unserialization of instances of the `WP_HTML_Token` class allows for code execution via its `__destruct()` magic method. This issue was fixed in WordPress 6.4.2 on December 6th, 2023. Versions prior to 6.4.0 are not affected.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Bitnami | wordpress | 6.4.0 | 6.4.2 |
| Bitnami | wordpress-multisite | 6.4.0 | 6.4.2 |
| Debian:13 | wordpress | 0 | 6.4.2+dfsg1-1 |
| Ubuntu:16.04:LTS | wordpress | 0 | No fix |
| Ubuntu:18.04:LTS | wordpress | 0 | No fix |
| Ubuntu:20.04:LTS | wordpress | 0 | No fix |
| Ubuntu:22.04:LTS | wordpress | 0 | No fix |
| Ubuntu:24.04:LTS | wordpress | 0 | 6.4.3+dfsg1-1ubuntu1 |
| Ubuntu:24.10 | wordpress | 0 | 6.4.3+dfsg1-1ubuntu1 |
| Ubuntu:Pro:16.04:LTS | wordpress | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | wordpress | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | wordpress | 0 | No fix |
Related vulnerabilities
- CVE-2022-4973 WordPress Core, in versions up to 6.0.2, is vulnerable to Authenticated Stored Cross-Site… Also affects wordpress
- CVE-2024-32111 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')… Also affects wordpress
- CVE-2024-31111 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site… Also affects wordpress
- CVE-2024-6307 WordPress Core is vulnerable to Stored Cross-Site Scripting via the HTML API in various… Also affects wordpress
- CVE-2024-4439 WordPress Core is vulnerable to Stored Cross-Site Scripting via user display names in the… Also affects wordpress
- CVE-2023-5692 WordPress Core is vulnerable to Sensitive Information Exposure in versions up to, and… Also affects wordpress
- CVE-2024-31210 WordPress is an open publishing platform for the Web. Also affects wordpress
- CVE-2023-2745 WordPress Core is vulnerable to Directory Traversal in versions up to, and including… Also affects wordpress