CVE Decoded #6: CVE-2026–63030 + CVE-2026–60137 (WordPress)
A counting error in WordPress's batch REST API caused permission checks to be applied to one request while a different request's handler was executed, allowing unauthenticated attackers to reach privileged parameters. Chained with an SQL injection in the author__not_in query parameter, this let attackers extract admin credentials and take over the server.
medium.com
Published on medium.com
Owasp
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
This write-up looks at two WordPress Core vulnerabilities that were published on July 17, 2026 and chained together into an unauthenticated remote code execution chain that the security community named "wp2shell".
| Field | Value |
|---|---|
| CVE IDs | CVE-2026-63030 (Route Confusion) + CVE-2026-60137 (SQL Injection) |
| Published | July 17, 2026 |
| Severity | Critical, CVSS 9.8 |
| Affected software | WordPress Core, versions before 6.8.6, 6.9.5 and 7.0.2 |
| Platform | Web, PHP, open source |
| Vulnerability type | REST API Batch Route Confusion + SQL Injection leading to unauthenticated RCE |
The feature at the centre of the first bug is the WordPress Batch API at /wp-json/batch/v1. Normally, an application that needs five things from the server, such as a user profile, latest comments, draft posts, site settings and notifications, has to send five separate HTTP requests. The Batch API lets the client pack all five requests into a single JSON array and send it once. WordPress opens the box, processes the sub-requests sequentially inside the server, bundles the answers and returns them in one trip.
The second bug lives in wp-includes/class-wp-query.php, in the WP_Query class.
Setup
No accounts, roles or tooling are described. The chain is explicitly unauthenticated: the author states that the attacker does not need a username, an author role or anything else, and that default WordPress installations are vulnerable. No third-party plugin or theme is involved; vanilla WordPress out of the box is enough.
Finding it
The author frames the discovery as a counting slip. WordPress kept two parallel PHP arrays while processing a batch: $requests, which stores the parsed request objects or error notices, and $matches, which stores the route handler, the actual function that will be executed for that request. As long as index i in one array corresponds to index i in the other, permission checks and execution line up.
The coat check analogy in the article makes the failure mode concrete. An attendant keeps a clipboard of tickets and clearances and a rack of coats. A customer tries to check a surfboard, which is refused, so the attendant writes a rejection at position 1 on the clipboard but forgets to hang an empty hanger at position 1 on the rack. The next customer, with a harmless windbreaker, gets ticket 2, which is approved, and the windbreaker is hung on hanger 1. The two lists have slipped by one position. When the attendant later processes ticket 2 and checks the clipboard, the ticket is approved, but the coat grabbed from rack position 2 belongs to someone else entirely.
That is CVE-2026-63030: security checks run against one request while the actions of a different request are executed.
Exploitation
Step 1: Craft a batch request
The attacker sends a single HTTP POST request to /wp-json/batch/v1 containing multiple nested JSON sub-requests.
Step 2: Inject the desync poison
Sub-request #0 carries an invalid path (///), which makes wp_parse_url() fail. $requests receives an error entry, but $matches is skipped entirely because the loop hits continue before the handler is appended.
Step 3: Smuggle privileged parameters
Sub-request #1 is crafted with query parameters that normally require elevated rights, paired with an innocent public endpoint. Because of the drift, request 1 now points at handler 0.
Step 4: Trigger route confusion
The dispatcher evaluates permissions for the innocent endpoint but executes the sensitive route handler, because index 1 reads $matches[0].
Step 5: Chain with SQL injection
The smuggled parameters reach WP_Query's author__not_in clause, triggering CVE-2026-60137. The attacker sends:
{ "author__not_in": ["1) UNION SELECT user_pass FROM wp_users WHERE ID=1--"]}
WordPress blindly builds:
SELECT * FROM wp_posts WHERE post_author NOT IN (1) UNION SELECT user_pass FROM wp_users WHERE ID=1
The database returns the admin's password hash.
Step 6: Pop the shell
With admin access secured in under 2 seconds, the attacker uploads a web shell and takes complete control of the web server. The full chain is: extract admin credentials, create a new admin account, upload a PHP web shell, full server control.
Root cause
CVE-2026-63030: the missing null
The vulnerable code is in wp-includes/rest-api/class-wp-rest-server.php, in WP_REST_Server::serve_batch_request_v1(). The vulnerable version:
public function serve_batch_request_v1( $request ) { $requests = array(); $matches = array(); foreach ( $request['requests'] as $args ) { $parsed_url = wp_parse_url( $args['path'] ); if ( false === $parsed_url ) { $requests[] = new WP_Error( 'parse_path_failed', __( 'Could not parse the path.' ), array( 'status' => 400 ) ); continue; } $single_request = new WP_REST_Request( $args['method'] ?? 'POST', $parsed_url['path'] ); $matches[] = $this->match_request_to_handler( $single_request ); $requests[] = $single_request; } return $this->dispatch_batch_requests( $requests, $matches );}
When the path fails to parse, $requests gets a new WP_Error entry at index 0, the loop calls continue, and $matches receives nothing. On the next iteration, a normal request arrives: $requests[1] gets the new request, while $matches[0] gets the handler for request 1. The arrays are permanently desynchronised. Request 1 points to handler 0, request 2 points to handler 1, and so on.
Because WordPress evaluates permissions based on the entry in one array but executes the route logic based on the entry in the mismatched array, an attacker can send a harmless public request, such as reading a public post, to satisfy permission checks while the dispatcher silently executes an internal, privileged route handler.
CVE-2026-60137: the unsanitised author__not_in
The second bug is in wp-includes/class-wp-query.php. WP_Query accepts author__not_in, which is supposed to be an array of author IDs to exclude from results. WordPress trusted that the parameter would always contain clean integers:
if ( ! empty( $q['author__not_in'] ) ) { $author_not_in = implode( ',', (array) $q['author__not_in'] ); $where .= " AND {$wpdb->posts}.post_author NOT IN ($author_not_in)";}
Normally this parameter is only reachable through authenticated admin-level API calls, and the REST API permission checks would block a random visitor from passing it to the posts endpoint. CVE-2026-63030 broke those permission checks, letting attackers smuggle author__not_in through a misrouted batch sub-request and bypass all the gates.
Why the chain works
Neither bug alone is catastrophic. Route confusion without the SQL injection only lets you hit API endpoints that return errors. SQL injection without route confusion is unreachable by unauthenticated users. Chained, they are devastating.
Impact
The chain is rated 9.8 Critical, and the author argues the score is not an exaggeration:
- Zero authentication required. Any anonymous visitor could send the request.
- Default installations are vulnerable. No buggy third-party plugin or obscure theme is needed.
- Mass scanning began immediately. Because the batch endpoint is enabled by default on virtually all modern WordPress sites, automated scanning tools and exploit scripts flooded the internet within 48 hours of disclosure.
The end state is full server takeover: admin credentials extracted, a new admin account created, a PHP web shell uploaded, and complete control of the web server.
Fix
CVE-2026-63030
The fix is a single line. The patched code inserts a null placeholder into $matches whenever a path fails to parse, so both arrays advance in lockstep:
@@ -1720,6 +1720,7 @@ $parsed_url = wp_parse_url( $args['path'] ); if ( false + $matches[] = null; // THE FIX: Keep $matches perfectly aligned with $requests! $requests[] = new WP_Error( 'parse_path_failed', __( 'Could not parse the path.' ), array( 'status' => 400 ) ); continue; }
With $matches[] = null; in place, the index numbers never drift and the route confusion is dead.
CVE-2026-60137
The patch enforces strict integer casting with absint(), WordPress's built-in function that converts any input to an absolute positive integer:
if ( ! empty( $q['author__not_in'] ) ) { $author_not_in = implode( ',', array_map( 'absint', (array) $q['author__not_in'] ) ); $where .= " AND {$wpdb->posts}.post_author NOT IN ($author_not_in)";}
Any SQL injection payload such as 1) UNION SELECT user_pass... is reduced to just 1, and the malicious fragments are destroyed before they reach the database.
Operational mitigations
- Update WordPress Core immediately to version 7.0.2, 6.9.5 or newer.
- Verify auto-updates: in
wp-config.php, ensuredefine( 'WP_AUTO_UPDATE_CORE', true );is active so security hotfixes apply automatically. - Block
/wp-json/batch/v1at the WAF: if you cannot update immediately, create a Cloudflare or Nginx firewall rule to block all requests to the endpoint. Most normal sites do not use batch REST requests. - Audit admin users: check the WordPress Users table for rogue administrator accounts created in or after July 2026.
Variants to test
- Other batch-style endpoints with parallel bookkeeping. Look for APIs that keep one array of requests and a second array of resolved handlers or permissions. A positive result is a malformed sub-request that produces an error entry in one array while the other array stays shorter, followed by a later sub-request whose permission check and executed handler refer to different entries.
- Error branches that skip an append. Grep for
continue,breakand earlyreturninside loops that append to more than one collection. A positive result is a code path where one collection grows and the other does not, leaving indexes misaligned for all subsequent iterations. - Parameters that are only safe because of upstream authorisation. For each query argument that is concatenated into SQL, check whether the only thing preventing unauthenticated use is a permission check elsewhere. A positive result is a parameter such as
author__not_inthat reaches string concatenation without integer casting, combined with any route or permission bypass that makes it reachable. - Array-typed parameters passed to
implode. Search forimplodecalls on request-derived arrays that are not wrapped inarray_map( 'absint', ... )or an equivalent cast. A positive result is a payload element such as1) UNION SELECT ...surviving into the generated SQL. - Batch endpoint exposure. Check whether
/wp-json/batch/v1is reachable on installations that do not use it. A positive result is a reachable batch endpoint on a site with no legitimate batch clients, which is the precondition for blocking it at the WAF as a stopgap.
What happened, in plain words
In July 2026, two bugs were published in WordPress itself, the software that runs a very large share of the world's websites. Neither bug is very dangerous on its own. Put together, they let a stranger with no account and no password take over a website completely. The security community gave the combination a nickname: "wp2shell", The security community gave the combination a nickname: "wp2shell".

The first bug, CVE-2026-63030, is a counting mistake. WordPress has a feature that lets a program send several requests to a site in one go, and while handling them it keeps two lists that are supposed to stay in step. A malformed entry in the first list makes the second list skip a slot, so from then on the two lists point at different things. WordPress ends up checking whether you are allowed to do one thing, then actually doing a different thing.
The second bug, CVE-2026-60137, is a database injection. WordPress has a setting for "show me posts by everyone except these authors", and it trusted that the list of author numbers would always be plain numbers. If you can reach that setting, you can slip database commands into it and make the site hand over password hashes.
Normally only an administrator can reach that setting. The first bug is what lets a stranger reach it. That is why the two are described as a chain: the first opens a door, the second does the damage behind it.
Below I go through the whole story from zero, explaining each idea as it comes up. If you can use a browser, you can follow this.
The basic details
| Field | Value |
|---|---|
| CVE IDs | CVE-2026-63030 (Route Confusion) + CVE-2026-60137 (SQL Injection) |
| Published | July 17, 2026 |
| Severity | Critical, CVSS 9.8 |
| Affected software | WordPress Core, versions before 6.8.6, 6.9.5 and 7.0.2 |
| Platform | Web, PHP, open source |
| Vulnerability type | REST API Batch Route Confusion + SQL Injection leading to unauthenticated RCE |
A few of those words need unpacking before anything else makes sense.
CVE stands for Common Vulnerabilities and Exposures. It is a public catalogue number for a known security flaw, a bit like a registration plate for a bug. When you see "CVE-2026-63030", you can look that exact identifier up in public databases and read the official description.
WordPress Core means the main body of WordPress, the part that everyone installs, as opposed to add-ons. WordPress is built from a central program plus optional extras called plugins (which add features) and themes (which change how a site looks). "Core" is the engine, and the engine is what was broken here.
PHP is the programming language WordPress is written in. It is a language that runs on the web server, the machine that holds a website and answers visitors' browsers.
Open source means the code is published and anyone can read it. That is relevant here: the fix is visible to everyone, and so is the mistake.
CVSS 9.8 is a severity score. CVSS is a standard way of scoring how bad a bug is, from 0 to 10. 9.8 is near the top of the scale, in the "Critical" band. The score is not a measure of how many sites were hit; it is a measure of how easy the bug is to use and how much damage it can do.
RCE stands for Remote Code Execution. It means an attacker, sitting somewhere else on the internet, can make the server run code of their choosing. That is usually the worst outcome in web security, because from there the attacker can do anything the server can do.
Unauthenticated means "without logging in". An unauthenticated attack needs no username, no password and no account of any kind. Anyone who can reach the site can try it.
What is an API?
An API, or Application Programming Interface, is the way one piece of software asks another piece of software to do something. The article compares it to a waiter in a restaurant: your phone is the customer, the server is the kitchen, and the API is the waiter carrying orders back and forth. You do not walk into the kitchen yourself; you tell the waiter what you want, and the waiter brings back the result.
On the web, an API is usually a set of addresses on a site that return data rather than web pages. When a mobile app shows your profile, it is not loading a web page; it is calling an API address and getting back a structured answer.
REST is a common style for building such APIs. You do not need the details; what matters is that WordPress exposes a REST API, meaning a set of addresses under a path that programs can call.
What is the WordPress Batch API?
Normally, if an app needs five things from the server, such as your user profile, your latest comments, your draft posts, the site settings and your notifications, it has to send five separate HTTP requests. An HTTP request is a single message a browser or app sends to a server, like a letter with an address on it; the server sends back an HTTP response, the reply.
Five separate trips over the internet is slow. To speed things up, WordPress introduced the Batch API at /wp-json/batch/v1.
Instead of sending five separate delivery drivers, you pack all five requests into a single cardboard box, a JSON array, and send it once. JSON is a plain text format for structured data, made of curly braces, square brackets, names and values; it is how programs write lists and records in a way both sides can read. An array is simply an ordered list.
WordPress opens the box, processes all five requests one after another inside the server, bundles the five answers together and ships them back in one trip.
That is efficient, and it is also where the trouble started.
The coat check analogy
To see the first bug without reading any code, imagine a busy coat check counter in a nightclub.
The attendant behind the counter uses two separate tracking systems:
- A clipboard: a list of customer tickets and security clearance notes, such as "Ticket #1: valid, Ticket #2: valid".
- A rack: the physical row of hangers holding the jackets, hanger #1, hanger #2 and so on.
Everything works as long as item #1 on the clipboard matches coat #1 on the rack.
Clipboard: [ Ticket 1: Checked ] -> [ Ticket 2: Checked ]
Rack: [ Coat 1: Alice ] -> [ Coat 2: Bob ]
Now customer #1 walks up and tries to check a giant dripping-wet surfboard. The attendant shakes their head: sorry, we do not accept surfboards. The attendant writes a rejection note on the clipboard at position 1: "Ticket 1: REJECTED".
Here is the catastrophic mistake: the attendant was so flustered by the surfboard that they forgot to hang an empty hanger on the rack for position 1.
A few seconds later, an attacker walks up with a harmless cheap windbreaker and gets ticket 2. The attendant writes "Ticket 2: APPROVED" on the clipboard and hangs the windbreaker on the rack. But because position 1 was skipped on the rack, the windbreaker ends up on hanger 1.
Clipboard: [ 1: REJECTED ] -> [ 2: APPROVED ]
Rack: [ 1: ATTACKER ] -> [ 2: ?????? ]
The two lists have slipped out of alignment by one position. When the attendant processes ticket 2, they check the clipboard: "Ticket 2 is approved!" But they grab whatever is sitting on rack position 2, which happens to belong to the VIP club owner, whose jacket contains the keys to the safe.
That is CVE-2026-63030. A single skipped slot in an internal list caused WordPress to run security checks on one request while executing the actions of a completely different request.
So what went wrong?
The vulnerability lives inside wp-includes/rest-api/class-wp-rest-server.php, in the method WP_REST_Server::serve_batch_request_v1().
A file path like that is just the location of a file inside the WordPress folder on the server. A method is a named block of code inside a program; when something calls the method by name, that block runs. So the bug sits in the block of code that serves batch requests.
The two parallel lists
When a batch request arrives, WordPress processes each sub-request inside a loop. A loop is code that repeats the same steps for every item in a list. To keep track of things, it maintained two separate PHP arrays:
$requests: stores the parsed request objects or error notices.$matches: stores the route handler, the actual code function that will be executed for that request.
A route is the part of a web address that tells the server which piece of code should answer. A handler is that piece of code. So $requests is the clipboard and $matches is the rack.
Normally, the loop processes request index 0, finds its route handler, and pushes both:
$requests[0]matches$matches[0]$requests[1]matches$matches[1]$requests[2]matches$matches[2]
An index is a position in a list. Programmers usually count from 0, so the first item is at index 0, the second at index 1, and so on.
The missing null
To process a sub-request, WordPress first has to parse its URL path using wp_parse_url( $args['path'] ). To parse a path means to take the text of the address and break it into its parts, so the program knows which route is being asked for.
What happens if someone sends a deliberately malformed, unparseable path, such as ///malformed-path or an invalid URI scheme? wp_parse_url() fails and returns false. In programming, false is the value that means "no" or "this did not work".
Look at what the code did when that happened:
$parsed_url = wp_parse_url( $args['path'] );
if ( false === $parsed_url ) {
$requests[] = new WP_Error( 'parse_path_failed', 'Could not parse the path.' );
continue;
}
$matches[] = $this->match_request_to_handler( $single_request );
Line by line:
$parsed_url = wp_parse_url( $args['path'] );takes the path from the incoming sub-request and tries to break it into parts, storing the result in a variable called$parsed_url.if ( false === $parsed_url ) {asks: did the parsing fail? If the answer is yes, run the block below.$requests[] = new WP_Error( 'parse_path_failed', 'Could not parse the path.' );adds an error notice to the$requestslist. The empty square brackets mean "append to the end of the list". This is the rejection note on the clipboard.continue;tells the loop to stop working on this item and jump straight to the next one. Everything below is skipped for this item.$matches[] = $this->match_request_to_handler( $single_request );is the line that would have added a handler to the$matcheslist. Because of thecontinue, it never runs for a failed path.
So when the path failed to parse:
$requestsreceived a new error entry at index 0.- The loop called
continue, skipping the rest of the block. $matchesreceived nothing. It stayed completely empty.
On the next iteration, at index 1, a normal request arrived:
$requests[1]got the new request.$matches[0]got the handler for request 1.
Now the lists were permanently out of step. Request 1 was pointing to handler 0. Request 2 was pointing to handler 1.
Why this bug alone is not enough
Because WordPress evaluated permissions based on the entry in one list, but executed the route logic based on the entry in the mismatched list, attackers could send a harmless, public request, such as reading a public post, to satisfy permission checks, while the dispatcher silently executed an internal, privileged route handler behind the scenes.
A permission check is the part of a program that asks "is this person allowed to do this?". Here the check was answered using one list, and the work was done using the other.
But the route confusion alone does not give you code execution. It gives you access to API endpoints you should not reach. An endpoint is one specific address on an API that does one specific job. To turn that access into a full server takeover, attackers needed a second bug.
The second link in the chain: CVE-2026-60137 (SQL Injection)
- CVE ID: CVE-2026-60137
- Severity: Medium standalone (CVSS 5.9) but Critical when chained (CVSS 9.8)
- Affected file:
wp-includes/class-wp-query.php
Notice the two scores. On its own, this bug is rated 5.9, medium. Chained with the first, the pair is rated 9.8. That is a good illustration of why severity is about context as much as about the bug itself.
What is SQL injection?
Every WordPress site stores its posts, users, passwords and settings inside a database. A database is an organised store of data that a program can ask questions of, like a very large, very strict spreadsheet. When WordPress wants to find something, such as "show me all posts not written by user #5", it writes a command in a language called SQL and sends it to the database.
SQL stands for Structured Query Language. It is the standard language for talking to databases: you write a query, the database reads it and returns matching rows.
SQL injection happens when an attacker can sneak their own database commands into a spot where WordPress expected a simple number. Instead of asking "show me posts not by user 5", the attacker makes WordPress ask "show me posts not by user 5; also, give me every admin password in the database". The name comes from the attacker injecting extra SQL into a query the program builds.
The vulnerable author__not_in parameter
WordPress's WP_Query class accepts a parameter called author__not_in. A parameter is a named input you pass to a piece of code, like a form field. This one is supposed to be an array of author IDs to exclude from results. For example: "show me all posts except those by authors 3 and 7."
The problem? WordPress trusted that this parameter would always contain clean integers. An integer is a whole number, like 3 or 7.
if ( ! empty( $q['author__not_in'] ) ) {
$author_not_in = implode( ',', (array) $q['author__not_in'] );
$where .= " AND {$wpdb->posts}.post_author NOT IN ($author_not_in)";
}
Line by line:
if ( ! empty( $q['author__not_in'] ) ) {checks whether the parameter was supplied and is not empty. If it is empty, there is nothing to do.$author_not_in = implode( ',', (array) $q['author__not_in'] );turns the list of author numbers into a single piece of text with commas between the values.implodeis a PHP function that joins list items into one string; the(array)part forces the input to be treated as a list. A string is just text.$where .= " AND {$wpdb->posts}.post_author NOT IN ($author_not_in)";glues that text into the SQL query being built. The.=means "append to what is already there". The result is a condition saying the post's author must not be in the given list.
The key point is that the values are pasted straight into the SQL text. Nothing checks that they are actually numbers.
Normally, this parameter is only reachable through authenticated admin-level API calls. A random visitor cannot just pass author__not_in to the posts endpoint, because WordPress's REST API permission checks would block it.
But CVE-2026-63030 broke those permission checks. The route confusion let attackers smuggle author__not_in through a misrouted batch sub-request, bypassing all the gates.
So the attacker sends:
{ "author__not_in": ["1) UNION SELECT user_pass FROM wp_users WHERE ID=1--"]}
This is a JSON object with one field. The field is named author__not_in, and instead of a list of numbers it contains a single string that is not a number at all. That string is the attack.
WordPress blindly builds:
SELECT * FROM wp_posts WHERE post_author NOT IN (1) UNION SELECT user_pass FROM wp_users WHERE ID=1
Read that query in two halves. The first half, SELECT * FROM wp_posts WHERE post_author NOT IN (1), is the query WordPress meant to write: give me all columns of all posts whose author is not number 1. The second half, UNION SELECT user_pass FROM wp_users WHERE ID=1, was added by the attacker. UNION is a SQL keyword that glues the results of two queries into one result set. So the database is asked for the posts, and then also for the password column of the user with ID 1, which is normally the administrator.
And the database happily returns the admin's password hash. A password hash is not the password itself but a scrambled fingerprint of it. Sites store hashes so that a stolen database does not directly reveal passwords. It is still valuable to an attacker.
The fix for CVE-2026-60137
The patch enforces strict integer casting using absint(), WordPress's built-in function that converts any input to an absolute, positive integer:
if ( ! empty( $q['author__not_in'] ) ) {
$author_not_in = implode( ',', array_map( 'absint', (array) $q['author__not_in'] ) );
$where .= " AND {$wpdb->posts}.post_author NOT IN ($author_not_in)";
}
Line by line:
- The
ifline is unchanged: only run this when the parameter is present and not empty. array_map( 'absint', (array) $q['author__not_in'] )walks over every item in the list and applies theabsintfunction to it.absintturns whatever it is given into a positive whole number. A cast is a deliberate conversion from one type of value to another, here from text to number.implode( ',', ... )then joins the cleaned numbers with commas, exactly as before.- The last line glues the cleaned list into the SQL, exactly as before.
By wrapping every value through absint(), any SQL injection payload such as 1) UNION SELECT user_pass... gets reduced to just 1. The malicious SQL fragments are completely destroyed before they ever touch the database.
The full chain: wp2shell
Both bugs fit together like puzzle pieces:
- CVE-2026-63030 (route confusion) lets the attacker bypass permission checks and reach restricted API parameters.
- CVE-2026-60137 (SQL injection) lets the attacker inject SQL through the now-reachable
author__not_inparameter. - Together they give wp2shell: extract admin credentials, create a new admin account, upload a PHP web shell, full server control.
A web shell is a small program an attacker uploads to a server so they can send it commands through the browser and have the server run them. It is the practical form of remote code execution.
Neither bug alone is catastrophic. The route confusion without the SQL injection just lets you hit API endpoints that return errors. The SQL injection without the route confusion is unreachable by unauthenticated users. But chained together, they are devastating. That is why the security community gave the combination a name: "wp2shell".
The code for CVE-2026-63030, before and after the fix
Let us look at the actual code in wp-includes/rest-api/class-wp-rest-server.php before and after the fix.
The vulnerable code
public function serve_batch_request_v1( $request ) {
$requests = array();
$matches = array();
foreach ( $request['requests'] as $args ) {
$parsed_url = wp_parse_url( $args['path'] );
if ( false === $parsed_url ) {
$requests[] = new WP_Error(
'parse_path_failed',
__( 'Could not parse the path.' ),
array( 'status' => 400 )
);
continue;
}
$single_request = new WP_REST_Request( $args['method'] ?? 'POST', $parsed_url['path'] );
$matches[] = $this->match_request_to_handler( $single_request );
$requests[] = $single_request;
}
return $this->dispatch_batch_requests( $requests, $matches );
}
Line by line:
public function serve_batch_request_v1( $request ) {declares the method that handles a batch request. The$requestin the brackets is the incoming box of sub-requests.$requests = array();creates an empty list for the requests and their error notices. This is the clipboard.$matches = array();creates a second empty list for the handlers. This is the rack.foreach ( $request['requests'] as $args ) {starts a loop that goes through each sub-request in the batch, one at a time, calling the current one$args.$parsed_url = wp_parse_url( $args['path'] );tries to break the sub-request's path into parts.if ( false === $parsed_url ) {asks whether parsing failed.$requests[] = new WP_Error( ... );appends an error notice to the clipboard. The three arguments inside are the error code, the human-readable message and an HTTP status of 400, which means "bad request".continue;skips the rest of the loop body for this sub-request and moves to the next one. This is the line that causes the whole problem, because the rack never gets an entry.$single_request = new WP_REST_Request( $args['method'] ?? 'POST', $parsed_url['path'] );builds a proper request object from the method and the parsed path. The?? 'POST'means "use the method if one was given, otherwise default to POST".$matches[] = $this->match_request_to_handler( $single_request );finds the handler for this request and appends it to the rack.$requests[] = $single_request;appends the request itself to the clipboard.return $this->dispatch_batch_requests( $requests, $matches );hands both lists to the code that actually runs the requests, and returns the result.
The order of the last two lines matters. The handler is appended to $matches before the request is appended to $requests, but in the normal path both lists grow by one each time, so they stay aligned. It is only the continue that breaks the pattern.
The patched code
The fix from the WordPress core team is one of the cleanest one-liners in open-source security history:
@@ -1720,6 +1720,7 @@
$parsed_url = wp_parse_url( $args['path'] );
if ( false
+ $matches[] = null; // THE FIX: Keep $matches perfectly aligned with $requests!
$requests[] = new WP_Error( 'parse_path_failed', __( 'Could not parse the path.' ), array( 'status' => 400 ) );
continue;
}
This is a diff, a standard way of showing a change to a file. Lines starting with a plus sign are new; lines without a sign are context, shown so you can see where the change goes. The @@ line is a header saying where in the file the change sits.
The added line, $matches[] = null;, appends an empty placeholder to the rack whenever a path fails to parse. null is a special value meaning "nothing here". The comment after the // explains the intent: keep $matches perfectly aligned with $requests.
That is it. A single line. By inserting $matches[] = null;, the $matches list receives an empty placeholder whenever a path fails to parse. Both lists advance in lockstep. The index numbers never drift. The route confusion is dead.
A note on the snippets: they are streamlined from WordPress Core wp-includes/rest-api/class-wp-rest-server.php to focus directly on the list synchronisation logic.
The attack, step by step
- Craft a batch request. The attacker sends a single HTTP POST request to
/wp-json/batch/v1containing multiple nested JSON sub-requests. POST is the HTTP method normally used to send data to a server, as opposed to GET, which is used to ask for a page. - Inject the desync poison. Sub-request #0 has an invalid path (
///), triggering thewp_parse_url()failure.$requestsgets an error entry;$matchesgets skipped. "Desync" is short for desynchronisation: the two lists are no longer in step. - Smuggle privileged parameters. Sub-request #1 is crafted with query parameters that normally require elevated rights, paired with an innocent public endpoint. A query parameter is the part of a web address after a question mark, used to pass values to the server.
- Trigger route confusion. The dispatcher evaluates permissions for the innocent endpoint, but executes the sensitive route handler, because index 1 reads
$matches[0]. - Chain with SQL injection (wp2shell). The smuggled parameters hit
WP_Query'sauthor__not_inclause, triggering CVE-2026-60137 to dump credentials or inject an admin session. A session is the server's memory of you being logged in; if an attacker can create one for an admin, they are effectively logged in as that admin. - Pop the shell. With admin access secured in under 2 seconds, the attacker uploads a web shell and takes complete control of the web server.
So was it bad?
This bug scored a 9.8 Critical, and for once, the score is not an exaggeration.
- Zero authentication required. The attacker does not need a username, an author role or even a newsletter subscription. Any anonymous visitor could send it.
- Default WordPress installations are vulnerable. You did not need a buggy third-party plugin or an obscure theme. Plain, vanilla WordPress right out of the box was vulnerable.
- Mass scanning began immediately. Because the batch endpoint is enabled by default on virtually all modern WordPress sites, automated scanning tools and exploit scripts flooded the internet within 48 hours of disclosure. Disclosure is the moment a vulnerability is made public. Scanning means automated programs checking many sites at once for the telltale sign of a vulnerable one.
The end state is full server takeover: admin credentials extracted, a new admin account created, a PHP web shell uploaded, and complete control of the web server.
The fix
Update WordPress Core
Update immediately to version 7.0.2, 6.9.5 or newer.
Verify auto-updates
In wp-config.php, the main configuration file of a WordPress site, ensure this line is active so security hotfixes apply automatically:
define( 'WP_AUTO_UPDATE_CORE', true );
define sets a named constant, a value that cannot change while the program runs. Here it switches on automatic updates for WordPress Core.
Block the endpoint at the WAF
If you cannot update immediately, create a Cloudflare or Nginx firewall rule to block all requests to /wp-json/batch/v1. Most normal sites do not even use batch REST requests. A WAF, or Web Application Firewall, is a filter that sits in front of a website and blocks requests matching rules you set. Cloudflare and Nginx are common products used for this.
Audit admin users
Check your WordPress Users table for any rogue administrator accounts created in or after July 2026. A rogue account is one an attacker created for themselves. The Users table is the part of the database that stores accounts.
Takeaway
- Parallel lists are an architectural trap. Whenever you find yourself maintaining two separate lists,
$arrayA[$i]and$arrayB[$i], that rely on matching indexes, stop and refactor. If a singlecontinue,breakor earlyreturntouches one list but misses the other, your entire security model collapses. Store related state inside a single unified object instead:
$batch_items[] = new BatchItem( $request, $handler );
That line shows the alternative: one list whose items each hold both the request and its handler, so they cannot drift apart.
- Off-by-one errors are not just for C programmers. We usually associate off-by-one bugs with buffer overflows in C or C++. A buffer overflow is when a program writes past the end of a fixed-size memory area. But here, a simple off-by-one index drift in modern PHP generated a route confusion flaw that completely bypassed an enterprise authentication layer.
- One line can break the internet. The difference between a fortress and a compromised server was literally:
$matches[] = null;
- Always inspect error-handling branches. The bugs are rarely in the code that runs when things go right; they hide in the cleanup code when things fail.
Glossary
- absint: A WordPress function that converts any input into a positive whole number, discarding anything that is not a number.
- API (Application Programming Interface): The agreed way one program asks another program to do something, like a waiter carrying orders between a customer and a kitchen.
- Array: An ordered list of values in programming.
- Batch API: A WordPress feature at
/wp-json/batch/v1that accepts several sub-requests in one HTTP request and returns all the answers together. - Buffer overflow: A bug where a program writes more data into a fixed-size memory area than it can hold.
- Cast: A deliberate conversion of a value from one type to another, such as text to number.
- continue: A programming instruction that skips the rest of the current loop iteration and moves to the next item.
- CVE (Common Vulnerabilities and Exposures): A public catalogue number for a known security flaw.
- CVSS: A standard scoring system for vulnerability severity, from 0 to 10.
- Database: An organised store of data that a program can query, like a very strict spreadsheet.
- Desync (desynchronisation): A state where two lists or processes that should stay in step have drifted apart.
- Diff: A standard text format showing what changed in a file, with added lines marked by a plus sign.
- Disclosure: The moment a vulnerability is made public.
- Endpoint: One specific address on an API that performs one specific job.
- Handler: The piece of code that actually runs for a given route.
- Hash (password hash): A scrambled fingerprint of a password, stored instead of the password itself.
- HTTP request: A single message a browser or app sends to a server, with a reply called a response.
- Index: A position in a list, usually counted from 0.
- Integer: A whole number, such as 3 or 7.
- JSON: A plain text format for structured data, built from braces, brackets, names and values.
- Loop: Code that repeats the same steps for every item in a list.
- Method: A named block of code inside a program that runs when called by name.
- null: A special value meaning "nothing here".
- Off-by-one error: A mistake where a count or position is wrong by exactly one.
- Open source: Software whose code is published and readable by anyone.
- Parameter: A named input passed to a piece of code, like a form field.
- Permission check: The part of a program that decides whether the current user is allowed to do something.
- PHP: The programming language WordPress is written in.
- Query parameter: The part of a web address after a question mark, used to pass values to the server.
- RCE (Remote Code Execution): An attacker making a server run code of their choosing from somewhere else on the internet.
- REST: A common style for building APIs over HTTP.
- Rogue account: An account an attacker created for themselves.
- Route: The part of a web address that tells the server which code should answer.
- Scanning: Automated programs checking many sites at once for signs of a vulnerability.
- Session: The server's memory of you being logged in.
- SQL (Structured Query Language): The standard language for talking to databases.
- SQL injection: Sneaking extra database commands into a spot where a program expected a plain value.
- String: Text, as opposed to a number.
- Unauthenticated: Without logging in; needing no account or password.
- WAF (Web Application Firewall): A filter in front of a website that blocks requests matching rules you set.
- Web shell: A small program uploaded to a server so an attacker can send it commands through the browser.
- WordPress Core: The main body of WordPress that everyone installs, as opposed to plugins and themes.