Analysis
Analyze quackd binary - report vulnerabilities
- Analysis:
- Reviewed decompiled code and raw disassembly; validated candidate issues with CFG/call chains and angr-assisted reachability.
- Conclusion:
- Confirmed high-severity use-after-free in the PUBLISH delivery loop allowing remote DoS; potential heap-groomed write for RCE; recommended saving next pointer(s
Tools: todo_write, run_sandbox, inspect_binary, skill, skill:ghidra-analysis, dump_data, read_file, write_file
Run it yourselfAnalyze quackd binary - report vulnerabilities.
Triage complete: quackd is a stripped x86-64 PIE ELF — a network daemon ("quackd %s (QUACK/1)") with peers/topics/subscriptions, token auth, and config file parsing. Full RELRO, canary, NX. Not packed — decompilation is appropriate. Dumping now.
No auto-flagged suspicious functions — I'll manually review the decompiled code, prioritizing network/protocol parsing. Let me check the dump files by size first.
~4,300 lines total across 62 functions — manageable. Reading the largest functions first.
This is main() — CLI + config parsing. The fixed-size copies are bounds-checked (host<64, token<128, token_file<4096). Now the main event loop and network path.
Main loop looks standard. Now the per-peer read/write handlers and frame parsing.
Read/write handlers look structured. The core protocol logic is in 0x1067e0 (frame handler). Reading it now.
The dispatcher maps a QUACK/1 protocol: HELLO(1), AUTH(3), JOIN(0x10), LEAVE(0x13), PUBLISH(0x20), ACK(0x22), PING(0x40), STATS(0x42), QUIT(0x50). Now the parsing primitives — where memory-safety bugs would live.
Cursor-based readers are bounds-checked. Now the validators, copy helpers, and the publish/outbox path.
All helpers so far are bounds-checked. Now the publish delivery path and outbox buffer management.
Delivery builder and buffer helpers check out so far. Reading topic management, peer lifecycle, and remaining helpers.
All append/serialize helpers are bounds-checked. But I spotted something suspicious in the publish delivery loop (0x105de0): on delivery failure it calls unlink_node_from_list_and_update_counts (which frees the subscription node) and then dereferences plVar6 = *plVar6 — a potential use-after-free. Let me verify in disassembly and check the remaining functions.
Address base mismatch — Ghidra uses 0x100000 base, r2 uses 0. Adjusting.
Use-after-free CONFIRMED at the instruction level (0x5ebb: mov rbx, [rbx] after the node was freed by call 0x5cc0). Let me resolve the remaining peer-destroy logic and a couple of helpers before writing the report.
Peer destruction is clean (0x7de0 frees+zeroes both buffer structs; Ghidra's param_1[0xc]+8 was just peer+0xc8). Checking the last few helpers.
die() is variadic — I noticed some call sites in main appear to pass fewer args than format specifiers (e.g. "%s:%u: invalid value for '%s': %s"). Let me verify arg counts at those call sites in disassembly.
Both sites pass full arg sets (r8 = value string) — Ghidra just hid them; no format-string bug. Final check on FUN_00105730's apparently argument-less FUN_00105200() call.
FUN_00105730 correctly passes the peer to FUN_00105200 (rdi intact at 0x57c0) — no bug there. One last confirmation that unlink (0x5cc0) really frees the node:
All confirmed. Writing the final report.
quackd analysis complete
quackd is a stripped x86-64 PIE daemon implementing a custom "QUACK/1" binary pub/sub protocol (QK\x01 frames) over TCP — HELLO/AUTH/JOIN/LEAVE/PUBLISH/PING/STATS/QUIT, optional token auth, poll()-based single-threaded event loop. Full RELRO + canary + NX. I decompiled all 62 functions (Ghidra) and verified every candidate issue against raw disassembly (radare2).
Confirmed vulnerability (High): Use-after-free in the PUBLISH delivery loop — 0x105de0
On delivery failure, the code frees the subscriber's 0x38-byte node (unlink → free @ 0x5d0c) and then dereferences the freed node to advance the iterator:
0x5eb6: call 0x5cc0 ; unlink_subscription -> free(node)
0x5ebb: mov rbx, qword [rbx] ; UAF: reads tcache metadata from freed chunk
0x5ed1: jne 0x5e81 ; loop continues with wild pointer
0x5e81: mov r13, qword [rbx+8]; treats garbage as peer*
- Trigger is remote and deterministic: the per-subscriber delivery frame size is
payload_len + strlen(topic) + 13, rejected if> 0xFFFF(0x104fb0). Since topic length cancels out, any PUBLISH with payload_len 0xFFF4–0xFFFF fails delivery → UAF. One crafted frame from an authenticated peer crashes the daemon (glibc ≥ 2.32 safe-linking scrambles the freed pointer → wild read → SIGSEGV). A join/leave dance primes the tcache so the read is non-NULL. - Impact: reliable remote DoS of the whole daemon; if the wild pointer survives (groomed heap),
r13is used as a fakepeer*flowing intorealloc(*(fake+0xc8), …)+ payloadmemcpy— a potential controlled heap-write path (RCE would additionally require defeating safe-linking; no pointer-leak primitive observed). - Also: when the tcache bin is empty the loop exits early — remaining subscribers silently lose the message.
Fix: save sub->next before any destructive unlink (standard iterator-during-removal pattern).
Lower-severity findings
- L1 Token length oracle — AUTH returns early on length mismatch (compare itself is constant-time).
- L2 PING (0x40) is answered pre-authentication in any state (echoes ≤64 bytes/frame).
- L3
inbuf_capconfig value has no upper clamp → memory-exhaustion footgun. - L4/L5 Slow-consumer handling silently unsubscribes; STATS/PONG responses kill peers when
outbox_capis set small.
Explicitly cleared
Frame parsing (bounds-checked cursors, session-id anti-spoof), all name copies (validators + strict < cap), outbox/inbox appends (overflow-guarded realloc, cap checks before every memcpy), format strings (all literals; the "missing args" were Ghidra artifacts — verified r8 in disassembly), config parsing, peer/topic lifecycle, and the hash-table rehash bounds.
Full evidence, PoC sketch, and fix recommendation are in quackd_vulnerability_report.md.
What tools do you have available? How you work with angr?
Newer angr keeps call edges in kb.calls (a networkx graph) rather than on the Function object — adjusting:
kb.calls doesn't exist in this angr version — the call graph lives on the CFG model (cfg.model.callgraph). Third try:
This angr build has a different API layout — let me introspect instead of guessing:
angr 10.0.2 — call edges live in each function's transition_graph. Final version:
Nodes are FuncNode objects — one more fix to extract .addr:
Both questions answered below — including a live angr demo I just ran against quackd.
1. Tools available
Binary / firmware analysis (specialized)
| Tool | Purpose |
|---|---|
inspect_binary | Lightweight rz-bin triage: imports, sections, strings, protections (no decompilation) |
dump_data | Full Ghidra decompilation → one .c per function + suspicious.json, analysis.json, toc.json |
semantic_function_search | Natural-language search over a dumped binary's function index |
diff_binaries / diff_function / find_suspicious_pairs | ghidriff whole-binary diff; DGMC per-function statement diff; pair triage |
build_dependency_graph | DT_NEEDED/SONAME/symbol cross-binary graph for an extracted firmware |
build_env_dict + taint_analyze | Operation Mango: env/nvram dictionary + backward taint analysis (cmdi / strfmt / memcpy sinks), angr-based |
map_reachability | angr call-graph labeling: reachable / reachable_indirect / unreachable from entry points |
skill | Loads workflows: ghidra-analysis, firmware-extraction, known-vuln-matching, binary-diff, taint-analysis, path-feasibility, etc. |
CVE intelligence: query_known_vulns (offline OSV matching), get_cve_patch (fix diffs), bisection_* (CVE lookup by version/date/branch, exploitable-CVE finder).
Sandbox: run_sandbox — shell with radare2, binwalk, 7zip, jadx, and Python 3.13 with angr 10.0.2, pwntools, qiling, numpy/pandas/scipy. Plus file tools (read_file/write_file/grep_files/…), web_search/web_fetch, task (subagents: firmware, malware, ctf, vulnerability), todo_write.
2. How I work with angr
Two modes:
-
Through the workflow tools (no manual scripting):
taint_analyzeruns Operation Mango's sink-driven backward analysis (RDA over angr CFGs) — that's the standard step after a Ghidra dump on a network binary;map_reachabilitybuilds the call graph with angr and labels every function's attacker-reachability for ranking findings. Both are "ranking/coverage" tools, not proofs — angr under-approximates indirect calls. -
Direct scripting in the sandbox — what I just did. Key detail: I load PIE binaries with
main_opts={'base_addr': 0x100000}so angr addresses match the Ghidra dump addresses (0x105de0etc.) instead of angr's default 0x400000 base. This angr build (10.0.2) keeps call edges in eachFunction.transition_graph, notkb.calls.
Demo run against quackd (CFGFast + caller map + BFS reachability):
arch: AMD64 | PIE: True | entry: 0x103620
functions recovered: 552
UAF fn : 0x105de0 | sub_105de0 | size 0x153
UAF callees: ['0x102430' (PLT), '0x104fb0' (deliver), '0x105cc0' (unlink+free), '0x1086c0' (clock)]
UAF callers : ['0x1067e0'] <- frame dispatcher
dispatcher callers : ['0x1052c0'] <- per-peer recv handler
recv handler (0x1052c0) reaches UAF (0x105de0): True
This independently corroborates yesterday's report: the UAF at 0x105de0 sits on the direct call chain from the network read handler — attacker-reachable, with the free (0x105cc0) and the fake-peer-consuming delivery (0x104fb0) as its two security-relevant callees.
Where angr adds more on quackd, if you want: (a) map_reachability over the whole binary to rank the L1–L5 findings; (b) a taint_analyze pass on quackd for memcpy/format-string sinks; (c) deeper work — a SimProcedure hooking recv with a QUACK/1 frame model, then symbolic exploration of the dispatcher (0x1067e0) to confirm the payload_len > 0xFFF3 trigger path end-to-end. Note (c) needs protocol modeling and is slower than the CFG/decompiler route I used.
Want me to run the taint pass or the reachability map on quackd?
