upatch.dev

CVE-2026-9860

Offload, AI & Optimize with Cloudflare Images <= 1.10.2 - Authenticated (Author+) Remote Code Execution via 'api-key' / 'account-id' Parameters in cf_images_do_setup AJAX Action

Refuses PHP write opens of wp-config.php to mitigate CVE-2026-9860 in Cloudflare Images for WordPress.

High 8.8Vetted

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

At a glance

CVE-2026-9860 is a high (CVSS 8.8) vulnerability in Offload, AI & Optimize with Cloudflare Images, published 18 June 2026. A vetted upatch, cve-2026-9860-wp-config-block, blocks it on running Linux machines with shirudo until Offload, AI & Optimize with Cloudflare Images is upgraded.

Severity
High 8.8 CVSS 3.1
Chance of exploitation
0.6% in the next 30 days (EPSS, 24 Nov 2026)
Known exploited
No, not on CISA’s KEV list
Weakness
CWE-434
Affected software
Offload, AI & Optimize with Cloudflare Images (vanyukov)
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

CVE-2026-9860, published on 18 June 2026, is an authenticated (Author+) remote code execution vulnerability in the Offload, AI & Optimize with Cloudflare Images (cf-images) plugin for WordPress in versions up to and including 1.10.2. In CF_Images\App\Settings::ajax_do_setup() (registered for the wp_ajax_cf_images_do_setup action), versions up to 1.10.1 call check_ajax_request() in CF_Images\App\Traits\Ajax, which verifies the cf-images-nonce nonce and checks only current_user_can( 'upload_files' ) rather than manage_options. Because CF_Images\App\Media::enqueue_scripts() localizes cf-images-nonce in the CFImages JavaScript object on wp-admin/upload.php, any Author-level or higher user can obtain the nonce and call cf_images_do_setup. In versions up to and including 1.10.2, ajax_do_setup() reads $_POST['data']['account-id'] and $_POST['data']['api-key'] via filter_input( INPUT_POST, 'data', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ) (bypassing wp_magic_quotes()) and passes them through sanitize_text_field(), which does not strip single quotes, to write_config(). write_config() formats define( '$name', '$value' ); and calls write(), which opens ABSPATH . 'wp-config.php' with fopen( $wp_config_path, 'w' ) and writes the unescaped string, allowing single quotes in account-id or api-key to break out of the single-quoted string literal and inject arbitrary PHP code into wp-config.php. Version 1.10.2 added a current_user_can( 'manage_options' ) check to ajax_do_setup(), and version 1.10.3 (changeset 3564001) restricted account-id and api-key to /^[A-Za-z0-9_\-]+$/ and escaped backslashes and single quotes in write_config().

Official description

The Offload, AI & Optimize with Cloudflare Images plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1.10.2 via the 'account-id' parameter parameter. This is due to insufficient privilege enforcement on the cf_images_do_setup AJAX handler, which requires only the upload_files capability (Author+) rather than manage_options before writing to wp-config.php, combined with the absence of single-quote escaping — sanitize_text_field() does not strip single quotes, and filter_input(INPUT_POST) bypasses wp_magic_quotes() slashing — allowing a single quote in the account-id or api-key parameter to break out of the single-quoted PHP string literal in the write_config() define() statement. This makes it possible for authenticated attackers, with author-level access and above, to execute code on the server. This is possible because the 'cf-images-nonce' nonce required by the AJAX handler is exposed to all Author-level and above users on wp-admin/upload.php via the CFImages JavaScript object, meaning any upload-capable user can satisfy the nonce check and reach the vulnerable wp-config.php write path.

Affected versions

The vulnerability is in the WordPress plugin cf-images up to and including version 1.10.2, and is fixed in version 1.10.3. The upatch uses SEC("lsm/file_open") with CO-RE reads of struct file, struct dentry, and struct task_struct, which are present on all Linux kernels supported by shirudo with BPF LSM enabled.

Sources

More references from NVD (6)

Mitigation

One BPF LSM program attaches to lsm/file_open and returns -EPERM when all of the following hold:

Check Condition
Open mode file->f_mode & FMODE_WRITE is non-zero
File name file->f_path.dentry has length 13 and name wp-config.php
Process The current task's comm or mm->exe_file basename starts with php, apache, or httpd

Reads of wp-config.php (FMODE_WRITE clear) pass after the first bit test. Writes to any file whose name is not 13 bytes long pass after reading d_name.len. Refusals are counted in the refused per-CPU array map at key 0.

Side effects

  • WordPress plugins and core code running under PHP or Apache (php*, apache*, httpd*) cannot open wp-config.php for writing. In cf-images, initial setup and disconnect operations that write or remove CF_IMAGES_ACCOUNT_ID and CF_IMAGES_KEY_TOKEN defines in wp-config.php fail to modify the file unless compatibility mode (compat, which stores credentials in database site options instead of wp-config.php) is used.
  • Normal WordPress page loads, media uploads, database option updates, and reading wp-config.php are unaffected.
  • Administrators editing wp-config.php over SSH with editors or shell utilities (vim, nano, sed, cp, mv) are unaffected because their executable and command names do not match php*, apache*, or httpd*.

Preemption model and cost

The program keeps no shared state beyond the per-CPU refused counter, which is updated with __sync_fetch_and_add, making it safe under all preemption models including preemptible RCU, PREEMPT_LAZY, and PREEMPT_RT. On read opens (!(file->f_mode & FMODE_WRITE)), the program returns immediately after one field check; on write opens, it checks d_name.len == 13 before reading the file name or inspecting the current task.

The policy

97 lines of BPF C, attached at 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
#define FMODE_WRITE	0x2

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

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

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

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

static __always_inline bool is_wp_config(const struct dentry *dentry)
{
	const unsigned char *name;
	char buf[16] = {};

	if (!dentry || BPF_CORE_READ(dentry, d_name.len) != 13)
		return false;
	name = BPF_CORE_READ(dentry, d_name.name);
	if (!name || bpf_probe_read_kernel(buf, 14, name))
		return false;
	return buf[0] == 'w' && buf[1] == 'p' && buf[2] == '-' &&
	       buf[3] == 'c' && buf[4] == 'o' && buf[5] == 'n' &&
	       buf[6] == 'f' && buf[7] == 'i' && buf[8] == 'g' &&
	       buf[9] == '.' && buf[10] == 'p' && buf[11] == 'h' &&
	       buf[12] == 'p' && buf[13] == 0;
}

static __always_inline bool is_php_or_httpd(const char *s, __u32 len)
{
	if (len >= 3 && s[0] == 'p' && s[1] == 'h' && s[2] == 'p')
		return true;
	if (len >= 6 && s[0] == 'a' && s[1] == 'p' && s[2] == 'a' &&
	    s[3] == 'c' && s[4] == 'h' && s[5] == 'e')
		return true;
	if (len >= 5 && s[0] == 'h' && s[1] == 't' && s[2] == 't' &&
	    s[3] == 'p' && s[4] == 'd')
		return true;
	return false;
}

static __always_inline bool current_is_php(void)
{
	struct task_struct *task = bpf_get_current_task_btf();
	const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);
	const unsigned char *name;
	char comm[16] = {};
	char buf[16] = {};
	__u32 len;

	if (!bpf_get_current_comm(&comm, sizeof(comm)) &&
	    is_php_or_httpd(comm, sizeof(comm) - 1))
		return true;
	if (!exe)
		return false;
	len = BPF_CORE_READ(exe, d_name.len);
	name = BPF_CORE_READ(exe, d_name.name);
	if (!name || bpf_probe_read_kernel_str(buf, sizeof(buf), name) <= 0)
		return false;
	return is_php_or_httpd(buf, len);
}

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

SEC("lsm/file_open")
int BPF_PROG(cve_2026_9860_open, struct file *file, int ret)
{
	if (ret)
		return earlier_verdict(ret);
	if (!(file->f_mode & FMODE_WRITE))
		return 0;
	if (!is_wp_config(file->f_path.dentry) || !current_is_php())
		return 0;
	count_refused();
	return -EPERM;
}

Process

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

  1. 18 Jun 2026CVECVE published
  2. 25 Nov 2026Pull requestPull request #76 openedAdd CVE-2026-9860: Refuses PHP write opens of wp-config.php to mitigate CVE-2026-9860 in Cloudflareromanlab
  3. 25 Nov 2026CIUpdate upatch.devcancelled
  4. 25 Nov 2026CICIpassed
  5. 25 Nov 2026MergeMerged #76romanlab
  6. 25 Nov 2026CIUpdate upatch.devcancelled

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

Evidence

On a vulnerable Offload, AI & Optimize with Cloudflare Images (cf-images) 1.10.1 setup, the loaded upatch refused PHP's write open of wp-config.php in cf_images_do_setup (HTTP 500, file unchanged).

Tested
25 Nov 2026
Target
Offload, AI & Optimize with Cloudflare Images (cf-images) 1.10.1 on PHP, loopback only
Kernel
7.4-shirudo-ci-20261123
Architecture
x86_64
Results
Statecf_images_do_setup writes wp-config.php
Before loadingyes (reached)
Upatch loadedno (blocked, HTTP 500)
After unloadingyes (reached)
tools-test.log Output of tools/test --setup showing cf_images_do_setup writing wp-config.php before and after, and being blocked while the upatch is loaded.
tools/test --setup, 2026-11-25T14:19:55Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-9860
  setup   done         WP_AJAX_URL=http://127.0.0.1:18080/admin-ajax.php WP_CONFIG_PATH=/opt/upatch-payload/cve-2026-9860/site/wp-config.php
  before  reached      cf_images_do_setup wrote CF_IMAGES_ACCOUNT_ID=probe19b547c78b1b into wp-config.php; restored it
  loaded  blocked      cf_images_do_setup failed to open wp-config.php for writing (HTTP 500) and left it unchanged
  after   reached      cf_images_do_setup wrote CF_IMAGES_ACCOUNT_ID=probef97575c69c75 into wp-config.php; restored 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-9860
Publish and roll out
shirudo bpm push build/packages/cve-2026-9860-1.0.0.bee oci://<registry>/<namespace>/cve-2026-9860 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-9860-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>