WordPress REST Batch route confusion + SQLi RCE chain reproduction (CVE-2026-63030 & CVE-2026-60137)
WordPress REST Batch 路由混淆 + WP_Query SQL 注入 → 未授权远程代码执行
This report covers two interconnected security vulnerabilities in the WordPress core; when combined, they can lead to unauthenticated remote code execution (RCE):
| CVE ID | Vulnerability Name | Vulnerability Type | Severity Level |
|---|---|---|---|
| CVE-2026-63030 | REST Batch route confusion causes misalignment of REST sub-request routing and validation logic | Route confusion / Authentication bypass | High |
| CVE-2026-60137 | Improper handling of the WP_Query::author__not_in parameter | SQL Injection (SQLi) | Critical |
Overall vulnerability chain path: The attacker exploits the batch route confusion in CVE-2026-63030 to bypass REST authentication and parameter validation boundaries, injecting malicious parameters into sub-requests and triggering the SQL injection in CVE-2026-60137; through the SQL injection, a temporary administrator account is directly inserted into the wp_users table, then that account is used to log in to the backend to obtain an administrator Cookie, and then the native WordPress plugin upload interface is called to upload a malicious PHP plugin, and finally the plugin file is accessed to execute system commands, completing RCE. After finishing, the POC automatically deletes the plugin and the temporary account, leaving no trace.
| Item | Affected Scope |
|---|---|
| WordPress Core | WordPress 7.0.1 (the php8.2-apache image has been verified to contain the vulnerability); other similar versions that enable the REST API batch/v1 are pending confirmation by official advisory |
| Affected Components | The wp-json/batch/v1 batch request endpoint; the author__not_in query parameter of WP_Query |
| PHP Version | PHP 8.2 verified; other PHP versions are theoretically affected |
| Database | MySQL 8.0 verified; other MySQL/MariaDB versions are theoretically affected |
/wp-json/).batch/v1 enabled (enabled by default).wp-content/plugins/ directory (satisfied by a default WordPress installation; the POC writes via the backend plugin upload interface).www-data).The batch/v1 endpoint of the WordPress REST API is used to batch-execute multiple sub-requests within a single HTTP request, reducing client round trips. The normal request body format is as follows:
POST /wp-json/batch/v1 HTTP/1.1
Content-Type: application/json
{
"requests": [
{
"path": "/wp/v2/posts",
"args": { "per_page": 2 }
}
]
}
In the normal flow:
batch/v1 endpoint itself is a public endpoint (GET-type batch read operations do not require authentication).requests array, iterates over each sub-request, and routes each one independently to the corresponding REST controller based on its path.author__not_in is a legitimate parameter for post query endpoints such as /wp/v2/posts, with the semantics of "exclude posts by the specified author IDs," and its intended value is an integer array (e.g., [1, 2]).When parsing the request body, batch/v1 has a flaw in handling the boundary between top-level JSON fields and sub-request args. An attacker elevates parameters such as author__not_in from the nested requests[i].args to the top level of the request body, constructing the following malformed request:
{
"requests": {
"0": {
"path": "/wp/v2/posts"
}
},
"author__not_in": ["1 AND (SELECT SLEEP(5))"]
}
This construction causes two misalignments:
author__not_in is not rejected by the batch endpoint; instead, it is leaked/merged into the query parameters of the sub-request /wp/v2/posts, bypassing the boundary constraint that "sub-request parameters must be nested within args."batch/v1 public endpoint itself does not validate author__not_in; under normal circumstances, /wp/v2/posts would cast this parameter to an integer. Because the parameter enters via a top-level "bypass," WordPress's parameter sanitization and permission-checking flow fails to trigger correctly, and the malicious string is passed directly to WP_Query.When constructing the post query SQL, WP_Query concatenates the author__not_in parameter into the AND author NOT IN (...) clause. Normally this parameter should be an array of integers, but the code does not enforce integer casting (intval/cast) on the array elements, causing the attacker-injected string "1 AND (SELECT SLEEP(5))" to be spliced into the SQL verbatim:
AND wp_posts.post_author NOT IN ('1 AND (SELECT SLEEP(5))')
An attacker can use a UNION-based query to read arbitrary database contents, and can also execute write operations such as INSERT through stacked queries/subqueries (depending on the database configuration). In this vulnerability chain, the POC uses this injection point to directly insert a temporary account with an administrator role and its password hash into the wp_users table.
Create docker-compose.yml in the /lab/wp-lab directory with the following contents: