bughunt

Safety

A tool that attacks things should be boring about what it touches. This is everything bughunt does on your machine.

If you used bughunt api 0.2.0, upgrade. It sent write requests on runs that were meant to be read-only. What was wrong, and the fix.

The guards on the API layer

  • Only this machine. For REST, GraphQL and gRPC alike, the address must be localhost, 127.0.0.1, ::1, *.localhost or *.test, written plainly as http://name:port/…. You can allow one other host by name with --allow-host, for a test environment you own.
  • No tricks with the address. An address with a login part, escapes, text after a bracket or an impossible port is refused outright. http://localhost:80@example.com/ goes to example.com, and different programs read such addresses differently, so there is no safe guess.
  • Read-only, really. Only GET is sent to a REST API, and only queries to a GraphQL API, unless you pass --write or --full. The usual probing of each path with methods it does not list is switched off, so no DELETE or POST is sent. gRPC cannot tell a read from a write, so it needs one of those flags.
  • Nowhere else. Proxy settings are not used for a local address. A settings file lying in the working folder is not read. A description that pulls parts of itself from another host is refused. Only flags that pace or narrow a run may follow --.
  • The token stays private. It is read from a file or BUGHUNT_TOKEN, taken out of the environment at once, and handed over without ever being an argument. If the server echoes it back, it is filtered from the report, the log and the saved results.

*.test and *.localhost are names reserved for local use; where they point is up to your own machine's or network's name lookup.

What each command runs

CommandRuns code from the repo?Safe on code you do not trust?
scanNo. It reads files.Yes, without --ref (see below).
apiNo. It sends requests to the address you gave.It is about the server, not a repo.
fuzz, auditYes: the fuzz targets, and the commands in its bughunt.toml.No. Only on code you would run the tests of.

The repo you scan is not trusted

  • It cannot switch findings off: nosemgrep comments and its own ignore file are not honoured, and what its settings file leaves out is counted.
  • Its settings file can name a baseline only as a plain file inside the repo.
  • A branch name cannot become an option to git, and outside tools are never run through a shell.
  • In a report, nothing from the repo becomes markup: values are escaped, and only plain https:// references become links.
  • --ref exports a branch through git, which trusts the repo's own git settings like any git command. Those do not travel with a clone, so this matters only for a repo you received as a copied folder or an archive. Scan such a repo without --ref.

What it writes

bughunt runs as your own user, never asks for root and collects no telemetry. It writes to ~/.cache/bughunt, to the report file you name with --output, and to the baseline file you name.

Some fuzzers keep their files in the repo, as they do when run by hand: cargo-fuzz in fuzz/corpus and fuzz/artifacts, Go in testdata/fuzz, and a compiled TypeScript target under node_modules/.cache/bughunt.

What it downloads

On first use: the scanner's rules, at one fixed commit, and Schemathesis, at one fixed version. Both are the versions bughunt was tested with.

install.sh downloads a release from GitHub and compares its SHA-256 with the published one before installing. That catches a damaged or swapped file; it cannot catch a compromised release, since the checksum comes from the same place.

Report a security issue

Please report privately: open the repository's Security tab and choose "Report a vulnerability". Don't open a public issue. You'll get a reply within a week, and a fix or a plan within 30 days.

These matter most: a way past the host check, a write without --write, the token showing up anywhere, a scanned repo hiding a finding or making bughunt run a command, and a run that could not do its work ending with exit status 0.