CVE-2019-8942

WordPress Core < 5.0.1 - Remote Code Execution

2019-02-19 00:00
Simon Scannell

Strategic Overview

Status
Patched in 3.7.28
Affected Core
WordPress 5.0
Affected Version
3.7 – 5.0 · 15 branches
CVSS
8.8High
Weakness type
CWE-94 · Improper Control of Generation of Code ('Code Injection')
CVE
CVE-2019-8942
View all WordPress 5.0 vulnerabilities

At a glance

CVE-2019-8942 is a high-severity Improper Control of Generation of Code ('Code Injection') vulnerability in the WordPress 5.0 WordPress release line, affecting 3.7 – 5.0 · 15 branches. It carries a CVSS score of 8.8 (reachable over the network; low attack complexity; high confidentiality, integrity, availability impact). The issue is fixed in version 3.7.28; sites on affected versions should update now. Disclosed February 2019, reported by Simon Scannell.

Vulnerability Overview

WordPress before 4.9.9 and 5.x before 5.0.1 allows remote code execution because an _wp_attached_file Post Meta entry can be changed to an arbitrary string, such as one ending with a .jpg?file.php substring. An attacker with author privileges can execute arbitrary code by uploading a crafted image containing PHP code in the Exif metadata. Exploitation can leverage CVE-2019-8943.

Technical Analysis

The vector marks this flaw as remotely reachable over the network, with low attack complexity — no special timing or configuration is needed, and no interaction from a victim user. A successful exploit has high impact on confidentiality, integrity, availability — full site compromise territory.

CWE-94: Improper Control of Generation of Code ('Code Injection')

Reaching this weakness in WordPress 5.0 3.7 – 5.0 · 15 branches takes a caller who can reach the endpoint. Code injection means input from a request reaches a language construct that evaluates code, so the attacker's text is executed rather than treated as data.

The injected code runs with the web server's privileges, giving the attacker the same access to the database and filesystem as WordPress itself. For WordPress 5.0 the fix is 3.7.28: builds 3.7 – 5.0 · 15 branches are affected, anything from 3.7.28 onward is not.

Remediation

Update to one of the following versions, or a newer patched version: 3.7.28, 3.8.28, 3.9.26, 4.0.25, 4.1.25, 4.2.22, 4.3.18, 4.4.17, 4.5.16, 4.6.13, 4.7.12, 4.8.8, 4.9.9, 5.0.1

How does WordSec protect against this?

The attempt arrives as an ordinary request to WordPress 5.0: WordSec's web application firewall inspects request payloads before WordPress loads them. Classes like this one can leave something behind, so the staged malware scanner is the second half: it looks for dropped files and modified code rather than for the request that created them. None of that substitutes for the fix: updating to 3.7.28 is the step that ends it.

  • Firewall
  • Scanner
  • Alerts

External References

Related records

Vulnerability data © Defiant, Inc., provided under the Wordfence Intelligence T&C