Skip to content
SQL injection Write-up Advanced

wp2shell: The WordPress Core Flaw That Turns an Anonymous Request

A chain of two WordPress Core flaws — a SQL injection in WP_Query's author__not_in handling and a REST API batch-route confusion — could let an unauthenticated attacker reach remote code execution on affected 6.9 and 7.0 sites. A bare installation with no plugins was said to be exposed, and a working proof-of-concept had reportedly become public.

Germano Costi Follow

Published on medium.com

This time, the issue is not a theme. It is not a page builder.

Germano Costi, on medium.com

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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a type-confusion in WP_Query's author__not_in parameter that let raw input reach the database query, combined with a REST API batch endpoint that misaligned internal request handling so a sub-request ran under the wrong handler context without authentication.

Impact

An anonymous attacker could execute code on affected 6.9 and 7.0 sites, though the full code-execution path reportedly worked only when no persistent object cache was in use, and 6.8 sites were affected by the SQL injection alone.

What the attacker needed

Affected WordPress 6.9.0-6.9.4 or 7.0.0-7.0.1; no persistent object cache for full RCE; no login needed

The fix

WordPress shipped 6.9.5, 7.0.2 and 6.8.6 to fix the issues, and sites that cannot update immediately should block anonymous access to both batch endpoint URL forms.

How it was found

  1. Send an anonymous request to the WordPress REST API batch endpoint
  2. Use the batch-route confusion so a sub-request runs under the wrong handler context
  3. Route attacker-controlled input into the vulnerable WP_Query author__not_in path
  4. Reach remote code execution on an affected 6.9 or 7.0 site

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

WordPress is a popular system for building websites, and most security scares involve add-ons called plugins. Here the mistake was in WordPress itself, so even a site with no add-ons could be at risk. Two separate weaknesses were combined: one let an attacker slip database commands into a search, and the other confused the site's programming interface so the request arrived without a login.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by Germano Costi

View all

3 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.