bughunt

Reports

Every layer reports in the same shape, so one command can give you one report, in the form its reader needs.

One report from every layer

bughunt audit ~/code/shop
bughunt audit ~/code/shop --url http://localhost:3000 --spec openapi.json --token-file token

audit reads the code and runs the repo's fuzz targets. Give it --url and a description of the API and it attacks the running app too. --skip scan or --skip fuzz leaves a layer out.

See a sample report, made by bughunt from a small demo app with planted bugs.

Formats

bughunt audit . --format html --output report.html
bughunt audit . --format markdown >> "$GITHUB_STEP_SUMMARY"
bughunt scan . --format sarif --output report.sarif
--formatFor
text (default)Reading in a terminal. In a terminal, audit and lab also show live screens, then print the plain result.
markdownA pull request comment or a CI job summary.
htmlOne self-contained page to send someone. It has no scripts and fetches nothing, so it is safe to open and works offline.
jsonScripts: every section and finding, with every field.
sarifGitHub's code-scanning tab and most security dashboards (SARIF 2.1.0).

Severity

LevelMeans
criticalUsable from outside with serious harm: a package with a known critical vulnerability, a provider key in the code, SQL injection.
highA real weakness an attacker could use: a missing login check, one user reading another's data, a leaked secret.
mediumA weakness that needs other conditions to hurt.
lowHardening: missing headers, unpinned images, limits not set.

Package findings are rated by their CVSS score in the usual bands. The overall risk in the summary is the worst finding's level, in words a reader who is not technical can act on.

Retests

bughunt audit . --format json --output before.json
# fix things
bughunt audit . --compare before.json --format html --output retest.html

Each finding is marked new or still open, and what the earlier report had that this run did not find is listed as fixed. A finding from a layer that did not run this time is never called fixed.

What a report says

  1. The result, first: how many findings and how serious, or "No findings". If part of the run did not happen, it says so in the same sentence.
  2. What ran, layer by layer: how much was read or tested, what was left out and why, and what was not really reached.
  3. Each finding, most serious first.

What a finding carries

PartWhat it is
WhereA file and line, an API operation, or a fuzz target.
EvidenceThe code line; the answer and the curl command that reproduces it; the line that panicked and the input that caused it.
FixWhat to do about it: the rule's suggested change, how to handle the bad input, the command that replays a failing input.
ReferencesWeakness ids such as CWE-89, the OWASP category, and links that explain the rule.
FingerprintThe finding's identity, which stays the same when its line moves. It is what the baseline records.

A report never calls "did not run" clean

If the scanner is missing, a fuzzer is not installed, or the API server is down, that layer appears in the report as did not run with the reason, the other layers still run, and the exit status is 2 unless there are findings (then it is 1). A dashboard reading the SARIF sees the same, as a failed run.

Reports are safe to open

Everything in a report can come from the code that was scanned: file names, code, messages. In the HTML page every value is escaped and only plain https:// references become links. In the terminal, control characters are replaced, so a file name cannot forge lines or clear the screen. bughunt's own fuzz targets check this.