upatch.dev

CVE-2026-119977

WordPress Core 4.7.0 - 7.1.3 - Unauthenticated Upgrade-Window Staged-Installer Remote Code Execution

Refuses creating or opening wp-config.php inside wp-content/upgrade/ to mitigate CVE-2026-119977.

High 8.1VettedKnown exploited

EPSS 8.1%: the estimated chance this CVE is exploited in the next 30 days, as of 24 Nov 2026.

At a glance

CVE-2026-119977 is a high (CVSS 8.1) vulnerability in WordPress, published 31 October 2026 and on CISA's Known Exploited Vulnerabilities list. A vetted upatch, cve-2026-119977-wp-upgrade-block, blocks it on running Linux machines with shirudo until WordPress is upgraded.

Severity
High 8.1 CVSS 3.1
Chance of exploitation
8.1% in the next 30 days (EPSS, 24 Nov 2026)
Known exploited
Yes, on CISA’s KEV list since 3 Nov 2026
Weakness
CWE-367
Affected software
WordPress (WordPress Foundation)
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

CVE-2026-119977 affects WordPress Core 4.7.0 through 7.1.3. During a full-package core upgrade (Core_Upgrader::upgrade in src/wp-admin/includes/class-core-upgrader.php), WP_Upgrader::unpack_package (src/wp-admin/includes/class-wp-upgrader.php) unpacks the release archive into a predictable directory under wp-content/upgrade/ named basename( basename( $package, '.tmp' ), '.zip' ), such as wp-content/upgrade/wordpress-7.1.3-no-content/wordpress/.

Because wp-content/upgrade/ is inside the web root and the unpacked wordpress/ tree contains wp-config-sample.php and wp-admin/setup-config.php but no wp-config.php, an unauthenticated client can request /wp-content/upgrade/<working_dir>/wordpress/wp-admin/setup-config.php?step=2 during the upgrade window. setup-config.php sets ABSPATH to the staged wordpress/ directory, connects to the attacker-supplied database host ($_POST['dbhost']), and writes a new wp-config.php into the staged directory (fopen( $path_to_wp_config, 'w' )). In vulnerable versions, update_core (src/wp-admin/includes/update-core.php) sets $skip = array( 'wp-content', 'wp-includes/version.php' ) before calling copy_dir, so a wp-config.php written in the working directory is either loaded by staged scripts or copied over the site's wp-config.php.

WordPress 7.1.4 fixes the issue in commit e7b33f536d308e9656442677edefdcfe1d4fa130 (b625b2d49c6ad3abfe8ca884e5453966d05790fd in WordPress/WordPress) by adding WP_Upgrader::get_working_dir_name to append a 16-character random suffix from wp_generate_password( 16, false ), creating wp-content/upgrade/index.php, and adding 'wp-config.php' to $skip in update_core.

Official description

WordPress Core is vulnerable to Remote Code Execution in versions 4.7 through 7.1.3. This is due to predictable, web-accessible staging paths used during full-package core upgrades. This makes it possible for unauthenticated attackers to execute code on the server during the upgrade window.

Affected versions

WordPress Core:

Branch Affected Fixed in
7.1 7.1.0 to 7.1.3 7.1.4
7.0 7.0.0 to 7.0.7 7.0.8
6.9 6.9.0 to 6.9.10 6.9.11
4.7 to 6.8 4.7.0 to 6.8.11 4.7.39 to 6.8.12

Sources

More references from NVD (10)

Mitigation

Two BPF LSM programs return -EPERM to PHP and Apache processes (comm matching php, php-*, php[0-9]*, apache2, or httpd) when targeting a file named wp-config.php under wp-content/upgrade/:

Hook Refused
lsm/inode_create Creating wp-config.php inside wp-content/upgrade/ (up to three directory levels deep)
lsm/file_open Opening wp-config.php inside wp-content/upgrade/ (up to three directory levels deep)

Each program checks d_name.len == 13 and d_name.name == "wp-config.php" first, returning 0 on all other files before walking d_parent or checking the current task's command name. The lsm/file_open program also prevents reading or copying a wp-config.php planted in wp-content/upgrade/ before the upatch was loaded.

The refused per-CPU array map counts refusals: key 0 (REFUSED_CREATE) for inode_create and key 1 (REFUSED_OPEN) for file_open.

Side effects

  • Invoking setup-config.php?step=2 inside wp-content/upgrade/<working_dir>/wordpress/wp-admin/ fails to write wp-config.php and reports Unable to write to wp-config.php file..
  • Normal WordPress operation, reading and writing the site's real wp-config.php above wp-content/, and unpacking and copying core, plugin, and theme upgrades inside wp-content/upgrade/ keep working because legitimate packages contain wp-config-sample.php, never wp-config.php.
  • Not covered: a PHP runtime whose task comm does not start with php and is not apache2 or httpd, or a WP_CONTENT_DIR whose directory name is not wp-content.

Preemption model and cost

The programs share only the per-CPU refused counter, updated with __sync_fetch_and_add, and are safe under preemptible RCU, PREEMPT_LAZY, and PREEMPT_RT. On every file create or open whose name length is not 13, each hook performs one length check and returns.

The policy

135 lines of BPF C, attached at lsm/inode_create and lsm/file_open.

// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause

#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.h>

#define EPERM 1

char _license[] SEC("license") = "Dual BSD/GPL";

enum {
	REFUSED_CREATE,
	REFUSED_OPEN,
	NR_COUNTERS,
};

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
	__uint(max_entries, NR_COUNTERS);
	__type(key, __u32);
	__type(value, __u64);
} refused SEC(".maps");

static __always_inline void count(__u32 key)
{
	__u64 *value = bpf_map_lookup_elem(&refused, &key);

	if (value)
		__sync_fetch_and_add(value, 1);
}

static __always_inline bool name_is(const struct dentry *dentry,
				    const char *want, __u32 want_len)
{
	const unsigned char *name = BPF_CORE_READ(dentry, d_name.name);
	char buf[16] = {};

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) != want_len ||
	    want_len > sizeof(buf) - 1)
		return false;
	if (bpf_probe_read_kernel_str(buf, sizeof(buf), name) < 0)
		return false;
	for (__u32 i = 0; i < sizeof(buf) - 1; i++) {
		if (i == want_len)
			return true;
		if (buf[i] != want[i])
			return false;
	}
	return false;
}

static __always_inline bool under_wp_upgrade_dir(const struct dentry *dentry)
{
	const struct dentry *dir = BPF_CORE_READ(dentry, d_parent);

	for (int i = 0; i < 4; i++) {
		const struct dentry *parent;

		if (!dir)
			return false;
		parent = BPF_CORE_READ(dir, d_parent);
		if (name_is(dir, "upgrade", 7) &&
		    name_is(parent, "wp-content", 10))
			return true;
		if (dir == parent)
			return false;
		dir = parent;
	}
	return false;
}

static __always_inline bool str_eq(const char *buf, const char *want, __u32 len)
{
	for (__u32 i = 0; i < len; i++) {
		if (buf[i] != want[i])
			return false;
	}
	return buf[len] == '\0';
}

static __always_inline bool is_php_name(const char *buf)
{
	if (buf[0] != 'p' || buf[1] != 'h' || buf[2] != 'p')
		return false;
	return buf[3] == '\0' || buf[3] == '-' ||
	       (buf[3] >= '0' && buf[3] <= '9');
}

static __always_inline bool current_is_php_runtime(void)
{
	char comm[16] = {};

	if (bpf_get_current_comm(&comm, sizeof(comm)) == 0) {
		if (is_php_name(comm) || str_eq(comm, "apache2", 7) ||
		    str_eq(comm, "httpd", 5))
			return true;
	}
	return false;
}

static __always_inline int earlier_verdict(int ret)
{
	return ret >= -4095 && ret < 0 ? ret : -EPERM;
}

SEC("lsm/inode_create")
int BPF_PROG(cve_2026_119977_create, const struct mnt_idmap *idmap,
	     struct inode *dir, struct dentry *dentry, umode_t mode, int ret)
{
	if (ret)
		return earlier_verdict(ret);
	if (!name_is(dentry, "wp-config.php", 13))
		return 0;
	if (!under_wp_upgrade_dir(dentry) || !current_is_php_runtime())
		return 0;
	count(REFUSED_CREATE);
	return -EPERM;
}

SEC("lsm/file_open")
int BPF_PROG(cve_2026_119977_open, struct file *file, int ret)
{
	const struct dentry *dentry = BPF_CORE_READ(file, f_path.dentry);

	if (ret)
		return earlier_verdict(ret);
	if (!name_is(dentry, "wp-config.php", 13))
		return 0;
	if (!under_wp_upgrade_dir(dentry) || !current_is_php_runtime())
		return 0;
	count(REFUSED_OPEN);
	return -EPERM;
}

Process

How this upatch was written, checked and reviewed, from the registry’s history.

  1. 31 Oct 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #6 openedAdd CVE-2026-119977: Refuses creating or opening wp-config.php inside wp-content/upgrade/romanlab
  3. 25 Nov 2026ReviewReviewedqodo-code-review[bot] (automated)
  4. 25 Nov 2026MergeMerged #6romanlab

No human review is recorded on GitHub for this upatch yet.

Evidence

On WordPress 7.1.3 with a staged core upgrade in wp-content/upgrade/, the loaded upatch refused creating wp-config.php via the staged setup-config.php endpoint while leaving normal WordPress operation intact.

Tested
25 Nov 2026
Target
WordPress 7.1.3 on PHP CLI built-in web server, loopback only
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Machine
shirudo test VM
Distribution
Ubuntu 26.04
Results
StateStaged setup-config.php writes wp-config.php in wp-content/upgrade/
Before loadingreached (wrote wp-config.php, HTTP 200)
Upatch loadedblocked (could not create wp-config.php)
After unloadingreached (wrote wp-config.php, HTTP 200)
tools-test.log Output of tools/test --setup for cve-2026-119977-1.0.0.bee on the shirudo test VM.
tools/test --setup, 2026-11-25T09:42:18Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-119977
  setup   done         WORDPRESS_URL=http://127.0.0.1:8080 WORDPRESS_UPGRADE_DIR=/opt/upatch-payload/cve-2026-119977/wordpress/wp-content/upgrade
  before  reached      staged setup-config.php wrote wp-config.php in wp-content/upgrade/ (HTTP 200); removed it
  loaded  blocked      staged setup-config.php could not create wp-config.php in wp-content/upgrade/
  after   reached      staged setup-config.php wrote wp-config.php in wp-content/upgrade/ (HTTP 200); removed it
  PASS: reached before, blocked while loaded, reached again after

Use it

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-119977
Publish and roll out
shirudo bpm push build/packages/cve-2026-119977-1.0.0.bee oci://<registry>/<namespace>/cve-2026-119977 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-119977-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>