Pretrain byte surprise
A Byte Generative Model learns next-byte prediction from raw protocol messages. Its predictive entropy becomes an explicit cue for changes in byte structure.
Protocol reverse engineering · 2026
Field Inference for Unknown Binary Protocols Without Priors or Binaries
A trace-only neural system that recovers byte-level field boundaries in a protocol it has never seen, using only a collection of raw same-format messages at inference time.
Motivation
Field inference is the first step in reverse engineering an unknown protocol: determine where one field ends and the next begins. Parser construction, fuzzing, intrusion detection, and malware command-and-control analysis all depend on getting these boundaries right.
A single byte sequence is ambiguous. The same four bytes could encode a number, timestamp, checksum, length, or several smaller fields. Existing systems typically need analyst-supplied priors, a runnable target binary, or training on the target protocol's own traffic. The missing evidence is often visible only across messages: constants stay fixed, payloads vary, and length fields co-vary with message size.
Method
A Byte Generative Model learns next-byte prediction from raw protocol messages. Its predictive entropy becomes an explicit cue for changes in byte structure.
The Cross-Message Byte Encoder computes mean, variance, and maximum activation at the same offset across valid messages and injects them at every transformer layer.
For each adjacent byte pair, the boundary head combines both embeddings, their difference and interaction, Byte-GM entropy, and cross-message variance.
The Byte-GM, encoder, and heads are fixed after offline training. An unseen protocol needs no labels, specification, executable, endianness prior, or target-specific retraining.
An optional auxiliary head assigns coarse protocol-agnostic roles after segmentation. It is not used to improve the boundary results reported below, which come from direct gap-level training.
Performance
0.808
Competitive with the conservative BinaryInferno detector at 0.736, while recovering far more true boundaries.
0.784
Removing four protocols from the training pool reduces average F1 by only 0.023 from the leave-one-out setting.
1.4-6.6 ms
The 1.44M-parameter frozen model runs from 1.4 ms on an RTX 6000 Ada to 6.6 ms on a commodity Xeon CPU.
| Method | Precision | Recall | False-positive rate | F1 |
|---|---|---|---|---|
| NeurInferno | 0.808 | 0.815 | 0.079 | 0.807 |
| NetPlier | 0.565 | 0.538 | 0.201 | 0.533 |
| Nemesys | 0.505 | 0.342 | 0.198 | 0.398 |
| Netzob | 0.562 | 0.266 | 0.145 | 0.316 |
| BinaryInferno | 0.736 | 0.115 | 0.000 | 0.192 |
The held-out protocol is excluded from main-model training, validation, hyperparameter tuning, and Byte-GM pretraining. Ground-truth dissector labels are used only for evaluation.
What the results show
Removing cross-message statistics reduces leave-one-out F1 from 0.807 to 0.741. Removing Byte-GM entropy produces a similar drop to 0.742. The two signals are complementary: one exposes fixed-versus-variable behavior across messages, while the other marks changes in within-message predictability.
Performance improves with more same-format messages and largely saturates around 64-100 messages, but the model retains most of its final F1 with 32. Its advantage is consistent across link, network, transport, routing, infrastructure, and industrial-control protocols.