National Cyber Warfare Foundation (NCWF)login

knife for static triage, disassembly, and bug-focused auditing of PE, ELF, Mach-O, and WASM binaries


0 user ratings
2026-11-14 15:31:40
milo
Red Team (CNA)
"knife

knife is a Rust-built reverse engineering toolkit that parses, disassembles, and audits PE, ELF, Mach-O, and WebAssembly files statically for authorized analysts and vulnerability researchers.








Toolbl4ckr0ss3/knife — a static reverse engineering and binary auditing toolkit in Rust covering PE, ELF, Mach-O, and WebAssembly
CategoryStatic binary analysis and reverse engineering CLI/TUI
Primary UseTriage, disassembly, cross-referencing, and sink-oriented vulnerability auditing of binaries during authorized research
Safe UseFor authorized security assessments, malware triage in isolated labs, and defensive vulnerability research; the tool is strictly static and never executes the target
Telemetry NotePurely local static analysis: it reads bytes on disk, stores annotations in a SHA-256-keyed local database, and performs network I/O only via its own knife update check — nothing contacts the target or third parties

knife is a compact Rust binary that wants to replace the usual pile of triage utilities on an analyst's workstation. Its tagline — find the bug, not just the binary — signals the difference from generic file-and-strings workflows: the project's explicit goal is to move from identification to a ranked hypothesis about where a binary is actually vulnerable. It handles four executable formats — PE, ELF, Mach-O, and WebAssembly — and the README is unambiguous about scope: it is static only, reading the bytes on disk and never running the target. That boundary matters for malware analysts working with hostile samples, and it makes the tool a natural fit for authorized triage pipelines and isolated research VMs.


The design philosophy the README articulates is that five tools become one: headers, strings and IOCs, imports, entropy, and disassembly, plus the analytical step most of them leave to you. The canonical example is a binary that imports memcpy; a hundred tools will report that. knife instead reads the call sites and tells you which one takes its length from a subtraction — a classic integer-underflow-into-huge-copy pattern. The demo against 7z.dll shows knife sec flagging disabled stack cookies (/GS absent, no __security_cookie in the load config) and cleared GUARD_CF, with a computed exposure score of 7 out of missing or weakened mitigations, while knife audit names the specific copy-underflow candidate with its function and address.


Internally, the interesting engineering choice is function discovery. Stripped C++ binaries routinely defeat naive function recovery, and the README says knife seeds discovery from the PE exception directory, growing 7z.dll from 87 to 6472 recovered functions before ranking dangerous calls by the provenance of the arguments that reach them. This is what elevates the tool from a disassembler wrapper to something closer to a lightweight static auditor: without good function boundaries, per-sink analysis is noise. The same recovery path is claimed to work on Linux daemons and macOS dylibs, which suggests the analysis core is format-aware rather than PE-specific.


The vulnerability research workflow is organized around four commands. knife sec reads real mitigations rather than flags — the README is refreshingly precise here, noting that a PE with DYNAMIC_BASE set but no .reloc still loads at its preferred base, and a GUARD_CF flag with an empty guard table checks nothing. knife sinks matches the binary against a catalogue grouped by the mistake each API enables (unbounded copies, format strings, input-sized stack allocation, command execution), resolving every hit to concrete call sites in named functions rather than an import list; the README cites 327 call sites across 17 APIs on kernel32.dll.


The crown of that pipeline is knife audit, which performs a bounded backward data-flow walk from each catalogued call site to recover where the interesting argument came from, keeping only sites whose provenance matches a bug pattern: a memcpy length computed by subtraction, an allocation sized by a multiply, a printf format loaded from memory. Findings are ranked, named, and honest about reachability — when dangerous arithmetic reaches a sink on only some paths, the finding says so, and the README openly states that empty results do not establish unreachability because indirect dispatch sits outside the direct call graph. That kind of stated limitation is a good sign of a tool built by someone who uses it. knife xrefs and knife paths complete the picture: what references a function, import, address, or string (--str TEXT for string references), and the shortest call chains from entry points and exports down to a sink.


Beyond auditing, the triage surface is dense. knife FILE produces a full report — verdict, hashes, sections, mitigations, capabilities, IOCs, artifacts, and entry-point disassembly. knife iocs extracts URLs, IPs, domains, emails, wallets, registry keys, and paths, defanged — a defensive touch that spares analysts accidental clicks. knife hashes emits MD5/SHA-1/SHA-256 plus imphash, knife map renders a whole-file entropy sparkline with packed regions flagged, and knife scan looks for crypto constants, packer markers, and embedded formats. Firmware work is covered too: knife ihex validates Intel HEX checksums and reports load regions and entry points, while knife artifact performs a bounded 7-Zip/firmware package inventory without extraction or execution — again, no running of untrusted code.


Driver-focused analysis gets its own command. knife drv targets kernel drivers and BYOVD scenarios, reporting identity, devices, IRP dispatch tables, IOCTLs, kernel primitives, signing status, and matches against the loldrivers dataset. This is squarely defensive territory: BYOVD attacks are a dominant elevation vector, and being able to enumerate a driver's IOCTL surface statically, before anything touches a live kernel, is exactly the workflow threat hunters and IR teams need on suspicious driver drops.


The interactive side, knife tui FILE, is a monochrome debugger-style workspace with function list, listing, and cross-references, plus a file explorer when invoked bare — sniffing PE/ELF/Mach-O badges from magic bytes. The keybinding model is compact but complete: Tab/Shift+Tab for pane focus, d/f for pseudocode and spatial CFG views, g for goto with va:0x.. and off:0x.. addressing, n/c to name or note whatever the cursor is on. :split and :compare FUNC clone the listing into a second column for side-by-side analysis, and :reload re-reads the target on a background worker without losing layout or annotations. Notably, file offsets are always labelled OFF because, as the README puts it, the tool does not pretend header bytes are virtual addresses — small correctness details that practitioners notice.


Persistence is well thought through. Names, notes, bookmarks, patches, types, and prototypes save immediately to a SHA-256-keyed database shared between TUI and CLI, keyed to the binary's hash rather than its path — a sensible choice when the same sample appears under different filenames across a case. KNIFE_NO_CACHE=1 forces fresh analysis, --db PATH relocates the store, and there is a whole annotation CLI on top: knife name, knife note, knife proto for exact function prototypes, knife var for pseudocode variable renames, and knife field/knife type for reusable typed structures, with knife typelib --export/--import to move layouts between binaries. knife patch stages binary edits against --vaddr or --off without touching the input file, exporting an atomically written patched copy on demand — a safe pattern for experimentation.


Two features stand out as forward-looking. knife mcp runs a Model Context Protocol server over stdio, exposing the tool's analyses as callable tools for AI agents — an acknowledgment that LLM-assisted reverse engineering is becoming a normal workflow, while keeping execution local and static. knife diff A B compares two binaries' functions, imports, and sections, exiting 1 on any change, which slots neatly into CI for detecting supply-chain tampering in vendored binaries. Add --json to any analysis command for machine-readable output and the whole toolkit becomes scriptable. Architecture coverage for disassembly is x86/x64 and AArch64, with the audit data-flow currently scoped to x86/x64 per the README.


Installation is standard Rust distribution: cargo install reknife (note the crate name differs from the repo name), cargo binstall reknife for prebuilt binaries, or a release archive from the GitHub Releases page. There is a built-in updater, knife update, that verifies GitHub's SHA-256 asset digest, rejects downgrades, and backs up the previous executable — knife update --check --json gives a machine-readable version check. The project is MIT-licensed, sits at a healthy early adoption level, ships CI, and runs on Linux, macOS, and Windows, with shell completions for bash, zsh, fish, PowerShell, and elvish.


For the authorized practitioner, knife earns its Swiss-army-knife billing by closing the gap the README identifies at the outset: most tools stop at telling you what a binary contains, while knife pushes into argument provenance at dangerous call sites and reports the consequence of every missing mitigation. It is not a decompiler replacement, and the README is honest about indirect-dispatch blind spots — but as a first-pass static auditor, IOC extractor, driver triage station, and diffing instrument in one dependency-light binary, it is a strong addition to a professional analysis kit, and entirely appropriate for lab, IR, and code-review use against software you are authorized to examine.



Official project repository for bl4ckr0ss3/knife.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/knife-for-static-triage-disassembly-and.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.