Home Learn Practice Pricing Host a CTF Community Blogs
Sign Up
Wp2Shell
Web Easy 100 pts

Wp2Shell

wp2shell is an easy CTF machine built around a realistic WordPress 7.0.x deployment vulnerable to the public CVE-2026-63030 batch route confusion chain. The lab is designed for beginner to intermediate security learners who are practicing ethical web exploitation and understanding how REST API validation bypasses can lead to full compromise.

Players begin by discovering a WordPress site with a lab-specific REST API endpoint at /wp-json/wp2shell-lab/v1/batch. The batch handler mirrors the real WordPress core vulnerability: a malformed URL (http://:) causes wp_parse_url() to fail, pushing a WP_Error to $validation[] without a corresponding $matches[] entry. This desynchronizes the arrays, and the dispatch loop reads $matches[$i] by original index — resolving to a different route's handler and permissive schema validation.

Skills covered:

  • WordPress REST API enumeration
  • Batch endpoint discovery
  • Malformed URL parsing exploitation
  • Array index desync understanding
  • Schema validation bypass
  • UNION-based SQL injection
  • Token-based authentication chaining
  • Post-exploitation via bounded diagnostic console
1
REST API Enumeration
Begin by identifying the WordPress REST API surface. WordPress exposes route information at the root REST endpoint. Look for lab-specific namespaces and routes that indicate the attack surface.
Q1. Which REST API namespace contains the lab-specific routes? +10 pts
Check the WordPress REST API index at /wp-json/ for custom namespaces.
Q2. Which endpoint accepts a batch of sub-requests? +10 pts
Look for a route that accepts POST requests and accepts an array of requests.
Q3. What malformed URL triggers wp_parse_url() to fail? +15 pts
A URL with a scheme but no host causes wp_parse_url() to return false.
Q4. Which query parameter is the SQL injection vector? +15 pts
The player brief mentions this parameter by name.
2
Batch Route Confusion
The batch handler mirrors CVE-2026-63030. A malformed URL causes array desync, and the dispatch loop reads the wrong handler index. This shifts schema validation, allowing scalar values to reach the SQL injection sink.
Q1. Which CVE does this lab model? +20 pts
The vulnerability involves REST batch route confusion combined with SQL injection.
Q2. What does the malformed URL cause wp_parse_url() to return? +10 pts
PHP's wp_parse_url() returns false when it cannot parse the URL.
Q3. Submit the user flag. flag +30 pts
Use a UNION SELECT to extract secrets from the wp2shell_lab_secrets table.
3
Post-Exploitation
After extracting the stage2_token via SQL injection, use it to create an administrator account and access the bounded diagnostic console to retrieve the root flag.
Q1. Which endpoint creates an administrator account? +10 pts
Look for a route that accepts a token, username, and password.
Q2. Which endpoint provides command execution? +10 pts
This endpoint runs bounded commands from an allowlist.
Submit the root flag.
Use the stage2_token to authenticate to the diagnostic endpoint and read /opt/wp2shell-lab/root.txt.