Skip to content

Fuzz targets for the wire format, startup lines, fragments and the TCP stack - #62

Merged
allwinpower merged 2 commits into
mainfrom
allwin/fuzz-targets
Oct 28, 2026
Merged

allwinpower merged 2 commits into
mainfrom
allwin/fuzz-targets

Conversation

@allwinpower

Copy link
Copy Markdown
Owner

cargo-fuzz targets for the input a hostile server or a local app controls, in their own workspace under fuzz/, and a CI workflow that runs each for 60 seconds.

Target Input
frame frame::parse on bytes in any chunk size, then every payload decoder (Hello, Addr, u32/u64, CONNECT_ERR)
handshake read_banner and read_hello on hostile server output
ipfrag Reassembler::add on crafted IPv4 fragments, then fragment on the result
tcp_stack the vendored ipstack, configured as stack_config in tunmode.rs, fed TCP segments whose sequence numbers track the stack's own, so inputs get past the handshake

ipfrag finds the crash fixed in GHSA-2c7x-2cp2-g77m within a second on 0.3.0. On main, 10-minute runs found nothing: frame 6.6 million inputs, handshake 12.6 million, ipfrag 3.9 million, tcp_stack 64 thousand.

tcp_stack uses a multi-threaded runtime: the vendored stack's Drop for IpStackTcpStream waits for its session task with block_in_place, which a current-thread runtime does not allow. Upstream ipstack no longer blocks there (narrowlink/ipstack 0f95edc).

fuzz.yml runs on pull requests and pushes that touch crates/core, crates/client/src/ipfrag.rs, third_party/ipstack or fuzz/, and weekly. It is not a required check, so a nightly toolchain problem cannot block merges. A crash uploads its input as an artifact.

CONTRIBUTING.md gets a Fuzzing section. Checked: actionlint and zizmor (medium and up) clean; all four targets run 20 seconds on current main with no crash.

…P stack

cargo-fuzz (nightly) in its own workspace under fuzz/:
- frame: frame::parse in any chunk size, then every payload decoder.
- handshake: read_banner and read_hello on hostile server output.
- ipfrag: Reassembler::add and fragment, on crafted IPv4 fragments.
- tcp_stack: the vendored ipstack, configured as tun mode does, fed
  TCP segments whose numbers track the stack's own.

Run one with: cargo +nightly fuzz run frame
On pull requests and pushes that touch the code a target covers, and
weekly. A crash fails the job and uploads its input. CONTRIBUTING.md
says how to run the targets locally.
@allwinpower
allwinpower enabled auto-merge (squash) October 28, 2026 17:55
Comment thread fuzz/fuzz_targets/handshake.rs Dismissed
@allwinpower
allwinpower merged commit 6ae8752 into main Oct 28, 2026
14 of 15 checks passed
@allwinpower
allwinpower deleted the allwin/fuzz-targets branch October 28, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants