Skip to content

feat: decoy ClientHello, fake among split pieces and a QUIC Initial decoy - #8

Merged
Nemu-x merged 4 commits into
mainfrom
feat/fake-improvements
Oct 29, 2026
Merged

Nemu-x merged 4 commits into
mainfrom
feat/fake-improvements

Conversation

@Nemu-x

@Nemu-x Nemu-x commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Three additions to the fake methods: a decoy ClientHello with another server name, the fake as one piece among split pieces, and a QUIC Initial decoy for the UDP burst.

Decoy ClientHello (ByeDPI --fake-sni, --fake-tls-mod, --fake-offset):

Fake: &desync.FakeOptions{TTL: 4, SNI: []string{"www.example.com", "cdn-##.example.net"}, Randomize: true}
  • SNI: one name per connection, */?/# become a random alphanumeric/letter/digit; DNS host names only, at most 64. Randomize: fresh random, session ID and key shares. FromOriginal: build the decoy from the real ClientHello (needs SNI or Randomize, excludes Payload). Offset: start the decoy at a later byte.
  • The decoy is decoded and re-encoded with every length recomputed, then padded/truncated to the fake piece; the template's padding extension keeps it at 517 bytes.

Fake with split pieces (ByeDPI parts followed by -f), Windows and Linux/Android:

desync.Options{Split: []desync.Pos{{Offset: 1, FromSNI: true}}, Disorder: true, Fake: &desync.FakeOptions{TTL: 4, Prefix: -1}}
  • The fake prefix end is one more cut; the piece ending there is the fake, the others are normal writes; Disorder/OOB still act on the first piece. A fake first piece with Disorder/OOB fails with ErrFakeFirstPiece before any byte; SplitWaitAcked with fake is rejected.
  • Linux lowers the hop limit only after SIOCOUTQNSD reports the earlier pieces sent. Windows applies the TTL to the TransmitFile request and writes later pieces right after submitting it; it holds the 2-slot transmit limit meanwhile, so a long SplitDelay after a fake delays other connections' fakes.

QUIC Initial decoy for the UDP burst, all three OSes:

desync.UDPOptions{TTL: 4, Template: desync.UDPTemplateQUICInitial, SNI: "www.example.com", QUICOnly: true}
  • A real QUIC v1 client Initial per burst (random DCID/SCID, ClientHello in a CRYPTO frame with ALPN h3, padded to 1200 bytes, encrypted with the Initial keys of RFC 9001). QUICOnly bursts only before datagrams that look like a QUIC client Initial; other UDP is untouched. QUICInitialPayload(sni) for a fixed payload.

Key() gains the new fields only when set (existing keys pinned in tests). desync-socks: -fake-sni, -fake-tls-mod rand,orig, -fake-offset; -fake now combines with -split, -disorder, -oob. Credits in third_party/NOTICE.

Rebased onto #7 (auto TTL): the auto-TTL hook is kept in both native backends.

Tests: decoy parses with ParseHello and carries the SNI, wildcards, FromOriginal across records, validation, keys; piece sequencing on every OS (boundaries, which piece is fake, partial counts, ErrFakeFirstPiece); byte-identical server stream natively on Windows and Linux; Linux low-hop drop filter (root) for split-fake, fake-split, split-fake-wait, random-fake, disorder-fake, oob-fake, disoob-fake, fake-sni, fake-orig, split-fake-sni, IPv4 and IPv6, each delivering the original after one retransmission; QUIC RFC 9001 A.1 key vectors, decrypting the template, QUICOnly gating over UDP loopback. Checks after the rebase: gofmt, go mod tidy -diff, vet windows/linux/darwin; tests on Windows (Go 1.26.10 and 1.20.14) and Linux in Docker as root with -race (34 low-hop/auto-TTL subtests pass, none skipped). Not verified: real networks and DPI (decoy names, QUIC template), macOS runtime of the QUIC parts (CI), Windows retransmission of a differing decoy (loopback does not drop), whether real QUIC servers accept the template.

FakeOptions gains SNI (a list, one name drawn per connection, ByeDPI
wildcards), FromOriginal, Randomize and Offset (ByeDPI --fake-sni,
--fake-tls-mod orig/rand, --fake-offset). The decoy is decoded and
re-encoded as a valid ClientHello with every length recomputed, then
padded or truncated to the fake piece.

Fake now combines with Split, Random.Split, Disorder, OOB, SplitDelay and
SplitWaitSent: the fake prefix end is one more cut and the piece ending
there is the fake, as in ByeDPI's part sequence. A fake first piece with
Disorder/OOB fails with ErrFakeFirstPiece before sending; SplitWaitAcked
is rejected. Linux lowers the hop limit only after SIOCOUTQNSD reports the
earlier pieces sent; Windows writes the later pieces right after the
TransmitFile submission. Key() lists the decoy options only when set.
UDPOptions.Template = UDPTemplateQUICInitial generates a QUIC v1 client
Initial per burst: random DCID/SCID, a CRYPTO frame with a ClientHello for
UDPOptions.SNI, PADDING to 1200 bytes, payload and header protection with
the RFC 9001 Initial keys. QUICInitialPayload returns one such packet for a
fixed Payload. QUICOnly limits the burst to datagrams that look like a QUIC
client Initial, leaving other UDP traffic untouched.
-fake-sni, -fake-tls-mod rand,orig and -fake-offset set the decoy
ClientHello; -fake now combines with -split, -disorder and -oob.
@Nemu-x
Nemu-x merged commit bd6a3dc into main Oct 29, 2026
19 checks passed
@Nemu-x
Nemu-x deleted the feat/fake-improvements branch October 29, 2026 17:44
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.

1 participant