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
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.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
1- Range: <=1.10.2
Patches
Vulnerability mechanics
Root cause
"Insufficient capability checks on the `cf_images_do_setup` AJAX handler combined with missing single-quote escaping in the `account-id` parameter allows authenticated attackers to inject arbitrary PHP code into `wp-config.php`."
Attack vector
An authenticated attacker with Author-level access (or higher) can craft a POST request to the `cf_images_do_setup` AJAX action. The `cf-images-nonce` nonce is available to any user who can access `wp-admin/upload.php`, so the nonce check is trivially satisfied. The handler uses `sanitize_text_field()` on the `account-id` parameter, which does not strip single quotes, and reads the input via `filter_input(INPUT_POST)`, bypassing WordPress's `wp_magic_quotes()` slashing. By injecting a single quote into the `account-id` value, the attacker can break out of the single-quoted PHP string literal inside the `define()` statement written to `wp-config.php`, achieving arbitrary PHP code execution on the server.
Affected code
The vulnerability resides in the `cf_images_do_setup` AJAX handler, which writes user-supplied `account-id` and `api-key` values into `wp-config.php` via a `define()` statement. The handler is registered in the plugin's setup/configuration code (not shown in the truncated `class-media.php` excerpt, but referenced in the advisory). The nonce required for the AJAX call is exposed to all Author-level users on `wp-admin/upload.php` through the `CFImages` JavaScript object in `Media::enqueue_scripts()` (line 94 of `class-media.php`).
What the fix does
The advisory does not include a patch diff, but the recommended remediation is to enforce the `manage_options` capability on the `cf_images_do_setup` AJAX handler (restricting it to administrators) and to escape single quotes or use a safer method for writing configuration values to `wp-config.php`. Without these changes, any Author-level user can inject arbitrary PHP code into the configuration file.
Preconditions
- authAttacker must have an authenticated WordPress account with at least Author-level privileges (i.e., the `upload_files` capability).
- inputThe attacker must know or obtain the `cf-images-nonce`, which is exposed to all Author+ users on the Media Library page (`wp-admin/upload.php`).
Generated on Jun 18, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- plugins.trac.wordpress.org/browser/cf-images/tags/1.10.1/app/class-media.phpmitre
- plugins.trac.wordpress.org/browser/cf-images/tags/1.10.1/app/class-settings.phpmitre
- plugins.trac.wordpress.org/browser/cf-images/tags/1.10.1/app/class-settings.phpmitre
- plugins.trac.wordpress.org/browser/cf-images/tags/1.10.1/app/traits/trait-ajax.phpmitre
- plugins.trac.wordpress.org/changesetmitre
- www.wordfence.com/threat-intel/vulnerabilities/id/a772041e-015e-48e8-9fab-79f1fcdb265cmitre
News mentions
0No linked articles in our index yet.