Repository navigation
M4 — UDP protocol payloads (core::payload), the port of payload.cc - #56
Merged
Merged
Conversation
Backlog #2: a bare UDP probe only elicits a reply from a service that answers anything, so most open UDP ports read open|filtered. nmap sends a protocol-specific payload on well-known ports; this ports that. The finding that shaped the design: nmap has no payload data file. Modern payload.cc DERIVES the table from nmap-service-probes — every `Probe UDP` line not flagged `no-payload` contributes its probe string to each port in its `ports` directive (probablePorts, not sslports). core::probedb already parses all of that, including the no-payload flag, so core::payload is a pure index over data we already parse and fuzz: no new file format, no new untrusted-input parser. core::payload - from_probe_db mirrors init_payloads(); count/for_port/get reproduce udp_payload_count and udp_port2payload (including its index wrap). - probe_payloads gives the datagrams for one logical probe — the C's MAX(numpayloads, 1) loop. sys::group - RawScanKind::build_probe becomes build_probes -> Vec<Vec<u8>>: a UDP probe sends one datagram per registered payload, all from the same encoded source port. SYN and flag kinds return a single packet. - Because the datagrams share a source port, a reply cannot be tied to a particular payload (the C says so too), so the engine keeps one outstanding entry per (port, tryno) and matches by port. - A payload that cannot be built is skipped rather than suppressing its siblings; the probe fails only if nothing could be built. core::udpscan: build_udp_probe_with takes an explicit payload; build_udp_probe keeps the bare datagram. cli: loads the table via the existing nmap-service-probes loader and degrades to bare datagrams with a notice when it is absent. C nmap fatal()s there, failing the whole scan over an optional data file. Verification - payload_corpus.rs: over the real 2.5 MB file our table agrees with an independent derivation on all 33205 (port, payload) pairs across 33110 ports, max 4 per port, plus per-port counts and byte-level anchors for 53/111/123/137/161/500/1900/5353 (DNS header, ASN.1 SEQUENCE on SNMP, SSDP M-SEARCH). - Unit tests that both payloads for a port reach the wire, and that the bare kind attaches nothing. - On-the-wire differential extended to payload-carrying datagrams, including an odd-length payload (checksum padding path). - Live: a responder answering only well-formed queries reads `open` on port 53 (all three DNS payloads delivered) and `open|filtered` on 5399 where no payload is registered — the payload is the whole difference. Gates: fmt + clippy (default and all-features) on 1.97.0; 318 core tests; miri clean; unsafe-audit 11/11 documented, 0 undocumented; cargo deny clean; fuzz services_probes_parse extended to cover the derivation, 356k runs no crashes; all four privileged e2e suites pass as root. Ledger: udpscan-empty-payload resolved; new payload-cap-warns-not-fatal (truncate + report instead of the C's fatal), payload-missing-db-degrades, payload-one-datagram-per-payload. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JfEzHqD7a7TKDuUs5GwZ2w
kj299
marked this pull request as ready for review
July 25, 2026 13:24
kj299
pushed a commit
that referenced
this pull request
Nov 14, 2026
Three of the six are older lessons that did not fire (#42 CI liveness, #41 review every step, #47 defaults are inputs); each now has a command that fails. The others: - #56: Phase 0 read nmap's --send-eth path as its default, and the claim stood four steps because the oracle could not run here. The threat model gains a register of claims read but not measured, each traced from the option's default, and a table of the checks each received message's standard requires of a receiver. The flaw scanner found 0 of the milestone's 3 C defects: each is an absent check. - #57: a flag a gate script passes on every run is a matrix column with one value (-Pn hid a two-milestone-old defect). PLAYBOOK (400 lines), REVIEW-GATE, ORACLE-CHECKS, the prompts and all six skills carry them; check-kit passes. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01JfEzHqD7a7TKDuUs5GwZ2w
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backlog #2: a bare UDP probe only elicits a reply from a service that answers anything, so most open UDP ports read
open|filtered. nmap sends a protocol-specific payload on well-known ports — a DNS query to 53, an SNMP get to 161 — which coaxes a real answer. This ports that.The finding that shaped the design
nmap has no payload data file. Modern
payload.ccderives the table fromnmap-service-probes: everyProbe UDPline not flaggedno-payloadcontributes its probe string as a payload for each port in itsportsdirective (probablePorts— notsslports).core::probedbalready parses all of that, including theno-payloadflag, from M3. Socore::payloadis a pure index over data we already parse and fuzz — no new file format, no new untrusted-input parser, no new fuzz target.What lands
core::payload—from_probe_dbmirrorsinit_payloads();count/for_port/getreproduceudp_payload_countandudp_port2payload(including its index wrap);probe_payloadsgives the datagrams for one logical probe, the C'sMAX(numpayloads, 1)loop.sys::group—RawScanKind::build_probebecomesbuild_probes -> Vec<Vec<u8>>: a UDP probe sends one datagram per registered payload, all from the same encoded source port. SYN and flag kinds return a single packet. Because the datagrams share a source port, a reply cannot be attributed to a particular payload (the C notes this too), so the engine keeps one outstanding entry per(port, tryno)and matches by port. A payload that cannot be built is skipped rather than suppressing its siblings.core::udpscan—build_udp_probe_withtakes an explicit payload;build_udp_probekeeps the bare datagram.cli— loads the table through the existingnmap-service-probesloader, degrading to bare datagrams with a notice when absent.Verification
Differential.
payload_corpus.rsruns over the real 2.5 MB file and agrees with an independent derivation on all 33 205 (port, payload) pairs across 33 110 ports, max 4 per port — plus per-port counts for 53/111/123/137/161/500/1900/5353 and byte-level anchors (DNS 12-byte header, ASN.1SEQUENCEon SNMP, SSDPM-SEARCHon 1900).On the wire. The on-the-wire differential now covers payload-carrying datagrams, including an odd-length payload (the checksum's trailing-byte padding path).
Live proof it works. A responder that answers only well-formed (≥12 byte) queries, on port 53 (payloads registered) and 5399 (none):
The payload is the entire difference between
openandopen|filtered.Gates
fmt + clippy (default and all-features) on pinned 1.97.0 · 318 core tests · miri clean · unsafe-audit 11/11 documented, 0 undocumented (no new unsafe) ·
cargo denyclean · fuzzservices_probes_parseextended to cover the derivation (356k runs, no crashes — same input domain, existing corpus, so no new CI target).Ledger
udpscan-empty-payloadresolved. New:payload-cap-warns-not-fatal— the Cfatal()s if a port exceedsMAX_PAYLOADS_PER_PORT(a limit that exists only because its count/index areu8); we keep the ceiling so the payload sequence matches but truncate and report instead of killing the scan.payload-missing-db-degrades— C nmapfatal()s when it cannot loadnmap-service-probes, failing a-sUscan outright on a stripped install; we warn and scan with bare datagrams.payload-one-datagram-per-payload— documents that the group congestion window counts logical probes, not datagrams, so-sUpacing is slightly more permissive than the C's per-datagram accounting.Remaining in backlog #2
SYN/flag ICMP back-fill —
core::udpscan::embedded_probealready returns the quoted destination, which is what attributes an error to the right host in a group scan.🤖 Generated with Claude Code
https://claude.ai/code/session_01JfEzHqD7a7TKDuUs5GwZ2w
Generated by Claude Code