CVE-2018-12895

WordPress Core < 4.9.7 - Authenticated Arbitrary File Deletion

2018-07-05 00:00
Matt Barry

Strategic Overview

Status
Patched in 3.7.27
Affected Core
WordPress 4.9
Affected Version
3.7 – 4.9.6 · 14 branches
CVSS
8.8High
Weakness type
CWE-22 · Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
CVE
CVE-2018-12895
View all WordPress 4.9 vulnerabilities

At a glance

CVE-2018-12895 is a high-severity Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in the WordPress 4.9 WordPress release line, affecting 3.7 – 4.9.6 · 14 branches. It carries a CVSS score of 8.8 (reachable over the network; low attack complexity; high confidentiality, integrity, availability impact). Exploitation requires an authenticated account. The issue is fixed in version 3.7.27; sites on affected versions should update now. Disclosed July 2018, reported by Matt Barry.

Vulnerability Overview

WordPress through 4.9.6 allows Author users to execute arbitrary code by leveraging directory traversal in the wp-admin/post.php thumb parameter, which is passed to the PHP unlink function and can delete the wp-config.php file. This is related to missing filename validation in the wp-includes/post.php wp_delete_attachment function. The attacker must have capabilities for files and posts that are normally available only to the Author, Editor, and Administrator roles. The attack methodology is to delete wp-config.php and then launch a new installation process to increase the attacker's privileges.

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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Reaching this weakness in WordPress 4.9 3.7 – 4.9.6 · 14 branches takes any authenticated account. Path traversal happens when user-controlled text is used to build a filesystem path without being constrained to an intended directory, so sequences like ../ walk the resolved path somewhere else.

Depending on the operation, it means reading files outside the intended folder — wp-config.php being the usual target — or writing to and deleting paths the web server can touch. For WordPress 4.9 the fix is 3.7.27: builds 3.7 – 4.9.6 · 14 branches are affected, anything from 3.7.27 onward is not.

Remediation

Update to one of the following versions, or a newer patched version: 3.7.27, 3.8.27, 3.9.25, 4.0.24, 4.1.24, 4.2.21, 4.3.17, 4.4.16, 4.5.15, 4.6.12, 4.7.11, 4.8.7, 4.9.7

How does WordSec protect against this?

The attempt arrives as an ordinary request to WordPress 4.9: WordSec's web application firewall inspects request payloads before WordPress loads them. None of that substitutes for the fix: updating to 3.7.27 is the step that ends it.

  • Firewall
  • Alerts

External References

Related records

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