Taint analysis
FAT traces source-to-sink flow in ELF binaries and shell scripts. The output is a set of findings with provenance, not a proof of exploitability.
Binary taint
fat taint --file ./www/cgi-bin/diag.cgi --summary
fat taint --file ./www/cgi-bin/diag.cgi --json > taint.json
fat taint --file ./usr/sbin/httpd --sink-candidates sinks.json --json > taint.json
fat taint-query --file ./www/cgi-bin/diag.cgi
taint uses the core source/sink models and any operator-supplied profile. taint-query asks a narrower path question against the same analysis. --sink-candidates consumes the output of sink-discovery, which is the usual route for stripped binaries.
Cross-binary state
fat taint-cross --rootfs ./rootfs
fat taint-cross --rootfs ./rootfs \
--source-profile ./my-target-models.yaml \
--state-profile ./my-target-state.yaml
taint-cross stitches flows through shared state. It ships no catalog of which function reads or writes a device’s configuration API:
--source-profilesupplies binary source/sink models, merged with the core models.--state-profilemaps read, write, and flush names into shared-state families.
Without --state-profile, taint-cross assigns no read/write roles and emits no cross-binary findings; JSON is []. A state profile alone does not teach the binary analyzer how an unfamiliar function carries data. Both flags take file paths, and an invalid selected file is an error.
--json and --as-taint-json preserve identity in model_provenance and state_model_provenance. External identities include the declared name, selected path, and SHA-256 of the loaded file.
Shell taint
fat taint --lang shell --file ./app/init/wifi.sh --summary
fat taint --lang shell --rootfs ./extracted-rootfs --json
fat taint --lang shell --rootfs ./extracted-rootfs \
--source-profile ./my-target-shell.yaml --severity high
Shell analysis parses scripts with tree-sitter-bash and walks assignments forward, so a chain such as $(cat /configs/...) → $var → sed -i "s/.../$var/g" is reported as one flow. Findings serialize to the same TaintFinding JSON as binary taint.
The always-loaded shell profile contains only constructs that hold for any POSIX script: positional parameters, read, cat/head/tail, RFC 3875 CGI variables, and documented uci get, fw_printenv, and getprop reads. It asserts nothing about a device’s filesystem. A read of /configs/... is Secondary on the strength of the read alone.
Use --source-profile to declare target-specific sources. A path-prefix source declares a mount attacker-writable, promotes reads under it to Primary, and makes the finding cite the mount by name.
Shell taint is deliberately unsound: shell is too dynamic to prove reachability. Every finding is a Candidate at WEAK strength, and only flows with a named source are reported. For sink hits without provenance, use fat sink-discovery --rootfs.
Interpret findings
model_provenanceandstate_model_provenancetell you exactly which models produced a result.- A named source is evidence of an input path, not proof that an attacker controls it.
- A sink candidate is a place to look, not a vulnerability verdict.
- Runtime confirmation is a separate step: Binary triage shows how to turn findings into hooks and compare traces.