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 yourself
quackd

Analyze quackd binary - report vulnerabilities.

Dr.Binary
todo_write
run_sandbox
inspect_binary

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.

dump_data
todo_write
read_file
read_file
read_file

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.

run_sandbox

~4,300 lines total across 62 functions — manageable. Reading the largest functions first.

read_file

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.

read_file

Main loop looks standard. Now the per-peer read/write handlers and frame parsing.

read_file
read_file

Read/write handlers look structured. The core protocol logic is in 0x1067e0 (frame handler). Reading it now.

read_file

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.

read_file
read_file
read_file
read_file

Cursor-based readers are bounds-checked. Now the validators, copy helpers, and the publish/outbox path.

read_file
read_file
read_file
read_file
read_file

All helpers so far are bounds-checked. Now the publish delivery path and outbox buffer management.

read_file
read_file
read_file
read_file
read_file
read_file

Delivery builder and buffer helpers check out so far. Reading topic management, peer lifecycle, and remaining helpers.

read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file
read_file

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.

run_sandbox
read_file
read_file
read_file
run_sandbox

Address base mismatch — Ghidra uses 0x100000 base, r2 uses 0. Adjusting.

run_sandbox

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.

read_file
run_sandbox

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.

read_file
read_file
read_file
read_file
read_file
read_file
read_file

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.

run_sandbox
run_sandbox

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.

run_sandbox

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:

run_sandbox

All confirmed. Writing the final report.

todo_write
write_file
todo_write

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), r13 is used as a fake peer* flowing into realloc(*(fake+0xc8), …) + payload memcpy — 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_cap config value has no upper clamp → memory-exhaustion footgun.
  • L4/L5 Slow-consumer handling silently unsubscribes; STATS/PONG responses kill peers when outbox_cap is 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?

Dr.Binary
run_sandbox

Newer angr keeps call edges in kb.calls (a networkx graph) rather than on the Function object — adjusting:

run_sandbox

kb.calls doesn't exist in this angr version — the call graph lives on the CFG model (cfg.model.callgraph). Third try:

run_sandbox

This angr build has a different API layout — let me introspect instead of guessing:

run_sandbox

angr 10.0.2 — call edges live in each function's transition_graph. Final version:

run_sandbox

Nodes are FuncNode objects — one more fix to extract .addr:

run_sandbox

Both questions answered below — including a live angr demo I just ran against quackd.

1. Tools available

Binary / firmware analysis (specialized)

ToolPurpose
inspect_binaryLightweight rz-bin triage: imports, sections, strings, protections (no decompilation)
dump_dataFull Ghidra decompilation → one .c per function + suspicious.json, analysis.json, toc.json
semantic_function_searchNatural-language search over a dumped binary's function index
diff_binaries / diff_function / find_suspicious_pairsghidriff whole-binary diff; DGMC per-function statement diff; pair triage
build_dependency_graphDT_NEEDED/SONAME/symbol cross-binary graph for an extracted firmware
build_env_dict + taint_analyzeOperation Mango: env/nvram dictionary + backward taint analysis (cmdi / strfmt / memcpy sinks), angr-based
map_reachabilityangr call-graph labeling: reachable / reachable_indirect / unreachable from entry points
skillLoads 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:

  1. Through the workflow tools (no manual scripting): taint_analyze runs 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_reachability builds 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.

  2. 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 (0x105de0 etc.) instead of angr's default 0x400000 base. This angr build (10.0.2) keeps call edges in each Function.transition_graph, not kb.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?