SD-Fuzz: A State-Aware Industrial Control Protocol Fuzzing Framework Based on Diffusion Models
Abstract
1. Introduction
1.1. Security Situation and Challenges of Industrial Control Systems
1.2. Main Limitations of Existing Techniques
- Training instability and mode collapse. Existing generative fuzzers typically rely on Generative Adversarial Networks (GANs). For instance, WGGFuzz [11] utilizes WGAN-GP to generate protocol payloads, while GANFuzz [9] applies standard GAN architectures. However, even with gradient penalty techniques, the discriminator in these models can easily overfit to the highly structured industrial traffic, causing vanishing gradients for the generator and a substantial reduction in sample diversity [14].
- Insufficient generation diversity. GAN-based models rely on implicit density estimation and often struggle to capture the full high-dimensional discrete distribution of protocol messages. This limitation is particularly evident when attempting to generate rare function codes and uncommon field combinations, which heavily restricts their ability to trigger diverse and complex anomalies [10,15].
- Lack of state awareness. While recent tools like AFLNet [8] have advanced stateful fuzzing for general network protocols by tracking explicit response codes to infer state transitions, industrial control protocols often lack such clear, standardized response codes. Consequently, deep learning-based ICS fuzzers (including SeqFuzzer and DiffusionFuzz) predominantly remain stateless, focusing solely on single-message generation. They cannot reliably produce multi-step interaction sequences that align with real protocol session logic. As a result, deep defects that depend on specific state transitions or execution order (e.g., sequential buffer overflows or state machine violations) are typically challenging to access [16,17].
1.3. Motivations and Contributions of This Work
- We apply a discrete DDPM to industrial protocol fuzzing, incorporating cosine noise scheduling and DDIM sampling to enhance the syntactic legitimacy and diversity of generated messages.
- We design a lightweight online HMM module that learns hidden state transition patterns unsupervised from real interaction traffic and provides real-time guidance for generating logically consistent multi-step sequences.
- We implement a closed-loop adaptive SD-Fuzz framework that combines diffusion-based generation, lightweight mutation, high-fidelity traffic replay, and online feedback. Evaluation on three representative Modbus/TCP slave implementations shows that the framework achieves a test-case recognition rate (TCRR) of 91.3% and a state transition coverage of 50.1%. It also triggers various exceptions, including memory corruption and logic errors, that are typically unreachable by stateless methods.
2. Materials and Methods
2.1. Overall Architecture
- Data Preprocessing Module (DPM): cleans raw traffic and extracts dual-track features.
- Data Generation Module (DGM): generates state-aware test sequences.
- Lightweight Mutation Module (DMM): applies targeted low-intensity perturbations.
- Data Sending and Receiving Module (DSRM): handles realistic TCP session communication.
- System Listening Module (SLM): monitors execution, detects anomalies, extracts state paths, and updates the HMM online.
2.2. Traffic Capture and Preprocessing
- For the DDPM: fixed-length byte sequences (maximum length 263 bytes, short packets padded with token 256, and vocabulary size 257).
- For the HMM: only the function code sequence (normal codes mapped to 1–43, exception codes ≥ 128).
2.3. Core Generation Module: State-Aware Discrete Denoising Diffusion
2.3.1. Discrete DDPM for Single Protocol Messages
2.3.2. Hidden Markov Model for State Inference and Online Evolution
2.3.3. State-Aware Sequence Generation Algorithm
| Algorithm 1 Generate_Realistic_Test_Sequence | |
| Input: | |
| s_cur | //current hidden state (initially sampled from π) |
| λ = (A, B, π) | //latest HMM parameters |
| DDPM | //trained discrete diffusion model (unconditional sampling) |
| MAX_LEN = 128 | //maximum sequence length |
| Output: | |
| Seq | //state-consistent test sequence |
| 1. Seq ← [] | |
| 2. while |Seq| < MAX_LEN do | |
| 3. s_next ∼ Categorical(A[s_cur, :]) | // sample next hidden state |
| 4. F ← {f ∈ {1, …, K} | B[s_next, f] > 0.0005} | // allowed function codes (prob > 0.05%) |
| 5. if F = ∅ then | |
| 6. F ← argmax_f B[s_next, f] | // fallback: the most likely code |
| 7. end if | |
| 8. m ∼ DDPM() | // unconditional DDIM sampling |
| 9. m[6] ← random.choice(F) | // force function code (byte 7, index 6) |
| 10. m[4:6] ← Recalculate_MBAP_Length(m[6:]) | // recompute MBAP Length field (unless intentional mismatch) |
| 11. Seq.append(m) | |
| 12. s_cur ← s_next | |
| 13. if s_cur ∈ Anomaly_States and Uniform(0, 1) < 0.3 then | |
| 14. break | // 30% chance to simulate client abort |
| 15. end if | |
| 16. end while | |
| 17. return Seq | |
2.4. Lightweight Mutation, Communication, and Monitoring Modules
2.4.1. Lightweight Mutation Module (DMM)
- Bit-flip probability limited to 0.5–1.5% (on average 1–3 bits per PDU);
- Symbolic boundary offsets (±1, ±2, ±4096) applied to register start address and read/write count fields;
- 10% probability of intentionally mutating the Unit Identifier or Protocol Identifier fields in the MBAP header;
- 5% probability of creating an MBAP Length field mismatch with the actual PDU length.
2.4.2. Data Sending and Receiving Module (DSRM)
2.4.3. System Listening Module (SLM)
- Anomaly detection: It monitors process crashes using ASan or Valgrind3.27.0, exception responses (function code ≥ 0x80), abnormal TCP terminations (RST/FIN), and watchdog timeouts exceeding 3 s. Upon detection, the full test context (seed sequence, PCAP file, and crash stack) is recorded for later analysis.
- State-path extraction: For every successful round trip, SLM applies Viterbi decoding using the current HMM parameters to infer the most likely hidden-state path and adds it to the online training buffer.
- Coverage-guided scheduling: SLM tracks the set of observed state transition edges and computes state coverage in real time according to Equation (6):
3. Results
3.1. Experimental Setup
3.1.1. Hardware and Software Environment
3.1.2. Test Targets
- Modbus RSSIM2 v8.21.2.7 (weight 30%): a professional-grade simulation server commonly used in training and testing.
- Modbus Slave v6.1.3 (weight 30%): a popular commercial emulation tool known for its strict register boundary checks.
- Modbus Poll v7.0.1 running in slave mode (weight 40%): a widely used diagnostic tool that exhibits distinct parsing behavior when operated as a slave.
3.1.3. Target Protocol and Data Format
3.1.4. Dataset Construction
3.1.5. Comparative Baseline Methods
- WGGFuzz [11]: a generative model based on WGAN-GP + VAE.
- Peach Fuzzer [6]: a classic industrial-grade mutation- and template-based fuzzer.
- AFLNet [8]: a coverage-guided grey-box fuzzer designed for stateful network protocols.
- DiffusionFuzz [19]: the latest publicly available stateless diffusion model baseline.
- TXL-Fuzz [28]: a long attention mechanism-based fuzz testing model for industrial IoT protocols.
3.2. Evaluation Metrics
- Test Case Recognition Rate (TCRR): the percentage of generated messages that the target successfully parses and responds to.
- Anomaly Triggering Efficiency (ATE): the number of unique crashes and anomalies triggered per hour.
- Distribution Generation Diversity (DGD): the ratio of unique function codes appearing in generated messages to the total function codes in the training data.
- State Coverage: the ratio of actually exercised HMM state transition edges to the total inferred edges.
3.3. Main Experimental Results
3.3.1. Single-Message Legitimacy (TCRR)
3.3.2. Anomaly Triggering Efficiency (ATE) Comparison
3.3.3. Generation Diversity (DGD)
3.3.4. State Transition Coverage
3.3.5. Vulnerability Mining Results
3.3.6. Vulnerability Case Studies
| Listing 1. Minimized triggering payload (hex). |
| MBAP : 00 2A 00 00 00 17 01 PDU : 10 00 01 FF FF 08 AA AA AA AA AA AA AA AA |
| Listing 2. Crash log and stack trace captured via pwndbg. |
| Program received signal SIGSEGV, Segmentation fault. => 0x0000aaaab6f1c7a0 <__memcpy_aarch64+160>: str q0, [x0], #0x10 Registers: x0 0x000000000041fff0 (dst) x2 0x000000000001fffe (len) <- Derived from attacker’s Quantity lr 0x0000000000402e9c <process_write_multiple_req+220> [+] Backtrace: #0 0x0000aaaab6f1c7a0 in __memcpy_aarch64() #1 0x0000000000402e9c in process_write_multiple_req() #2 0x0000000000402190 in modbus_tcp_handle_request() #3 0x00000000004018f4 in tcp_worker_loop() #4 0x0000000000401230 in main() |
| Listing 3. Vulnerable memory copy operation without bounds checking. |
| copy_len = quantity * 2; // No check against ByteCount or map bounds memcpy(dst, src, copy_len); |
3.3.7. Portability and Protocol Migration
3.4. Ablation Study
3.5. Threats to Validity
4. Discussion
4.1. Performance and State Awareness
4.2. Generalization Across Heterogeneous Protocols
4.3. Critical Analysis of Limitations
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Karnik, N.; Bora, U.; Bhadri, K.; Kadambi, P.; Dhatrak, P. A comprehensive study on current and future trends towards the characteristics and enablers of industry 4.0. J. Ind. Inf. Integr. 2022, 27, 100294. [Google Scholar] [CrossRef]
- Anton, S.D.D.; Fraunholz, D.; Krohmer, D.; Reti, D.; Schneider, D.; Schotten, H.D. The global state of security in industrial control systems: An empirical analysis of vulnerabilities around the world. IEEE Internet Things J. 2021, 8, 17525–17540. [Google Scholar] [CrossRef]
- Beaman, C.; Redbourne, M.; Mummery, J.D.; Hakak, S. Fuzzing vulnerability discovery techniques: Survey, challenges and future directions. Comput. Secur. 2022, 120, 102813. [Google Scholar] [CrossRef]
- Zuo, F.; Luo, Z.; Yu, J.; Chen, T.; Xu, Z.; Cui, A.; Jiang, Y. Vulnerability detection of ICS protocols via cross-state fuzzing. IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst. 2022, 41, 4457–4468. [Google Scholar] [CrossRef]
- Zhang, X.; Zhang, C.; Li, X.; Du, Z.; Mao, B.; Li, Y.; Zheng, Y.; Li, Y.; Pan, L.; Liu, Y.; et al. A survey of protocol fuzzing. ACM Comput. Surv. 2024, 57, 35. [Google Scholar] [CrossRef]
- Luo, Z.; Zuo, F.; Shen, Y.; Jiao, X.; Chang, W.; Jiang, Y. ICS protocol fuzzing: Coverage guided packet crack and generation. In Proceedings of the 2020 57th ACM/IEEE Design Automation Conference (DAC); IEEE: New York, NY, USA, 2020; pp. 1–6. [Google Scholar] [CrossRef]
- Lin, P.-Y.; Huang, T.-C.; Tien, C.-W. ICPFuzzer: Proprietary communication protocol fuzzing by using machine learning and feedback strategies. Cybersecurity 2021, 4, 28. [Google Scholar] [CrossRef]
- Pham, V.-T.; Böhme, M.; Roychoudhury, A. Aflnet: A greybox fuzzer for network protocols. In Proceedings of the 2020 IEEE 13th International Conference on Software Testing, Validation and Verification (ICST); IEEE: New York, NY, USA, 2020. [Google Scholar] [CrossRef]
- Hu, Z.; Shi, J.; Huang, Y.; Xiong, J.; Bu, X. GANFuzz: A GAN-based industrial network protocol fuzzing framework. In Proceedings of the 15th ACM International Conference on Computing Frontiers, Ischia, Italy, 8–10 May 2018; pp. 138–145. [Google Scholar] [CrossRef]
- Zhao, H.; Li, Z.; Wei, H.; Shi, J.; Huang, Y. SeqFuzzer: An industrial protocol fuzzing framework from a deep learning perspective. In Proceedings of the 2019 12th IEEE Conference on Software Testing, Validation and Verification (ICST); IEEE: New York, NY, USA, 2019; pp. 59–67. [Google Scholar] [CrossRef]
- Yang, H.; Huang, Y.; Zhang, Z.; Li, F.; Gupta, B.B.; VijayaKumar, P. A novel generative adversarial network-based fuzzing cases generation method for industrial control system protocols. Comput. Electr. Eng. 2024, 117, 109268. [Google Scholar] [CrossRef]
- Villa, C.; Doumanidis, C.; Lamri, H.; Rajput, P.H.N.; Maniatakos, M. ICSQuartz: Scan Cycle-Aware and Vendor-Agnostic Fuzzing for Industrial Control Systems. In Proceedings of the Network and Distributed System Security (NDSS) Symposium, San Diego, CA, USA, 24–28 February 2025; Available online: https://www.ndss-symposium.org/wp-content/uploads/2025-795-paper.pdf (accessed on 15 December 2025).
- Ezeobi, U.; Hounsinou, S.; Olufowobi, H.; Zhuang, Y.; Bloom, G. MCFICS: Model-based Coverage-guided Fuzzing for Industrial Control System Protocol Implementations. In Proceedings of the IECON 2024-50th Annual Conference of the IEEE Industrial Electronics Society; IEEE: New York, NY, USA, 2024; pp. 1–6. [Google Scholar] [CrossRef]
- Arjovsky, M.; Chintala, S.; Bottou, L. Wasserstein generative adversarial networks. In Proceedings of the 34th International Conference on Machine Learning (ICML); PMLR: New York, NY, USA, 2017; pp. 214–223. Available online: https://www.mlmi.eng.cam.ac.uk/files/gong_dissertation_reduced.pdf (accessed on 19 December 2025).
- Luo, Z.; Zuo, F.; Jiang, Y.; Gao, J.; Jiao, X.; Sun, J. Polar: Function code aware fuzz testing of ics protocol. ACM Trans. Embed. Comput. Syst. (TECS) 2019, 18, 93. [Google Scholar] [CrossRef]
- Wang, J.; Chen, B.; Wei, L.; Liu, Y. Superion: Grammar-aware greybox fuzzing. In Proceedings of the 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE); IEEE: New York, NY, USA, 2019; pp. 724–735. [Google Scholar] [CrossRef]
- Shang, Z.; Garbelini, M.E.; Chattopadhyay, S. U-fuzz: Stateful fuzzing of iot protocols on cots devices. In Proceedings of the 2024 IEEE Conference on Software Testing, Verification and Validation (ICST); IEEE: New York, NY, USA, 2024; pp. 209–220. [Google Scholar] [CrossRef]
- Ho, J.; Jain, A.; Abbeel, P. Denoising diffusion probabilistic models. Adv. Neural Inf. Process. Syst. 2020, 33, 6840–6851. [Google Scholar]
- Zong, X.; Luo, W.; Ning, B.; He, K.; Lian, L.; Sun, Y. DiffusionFuzz: Fuzzing framework of industrial control protocols based on denoising diffusion probabilistic model. IEEE Access 2024, 12, 67795–67808. [Google Scholar] [CrossRef]
- Nichol, A.Q.; Dhariwal, P. Improved denoising diffusion probabilistic models. In Proceedings of the International Conference on Machine Learning; PMLR: New York, NY, USA, 2021; pp. 8162–8171. Available online: https://www.academia.edu/72572601/Improved_Denoising_Diffusion_Probabilistic_Models (accessed on 17 December 2025).
- Natella, R.; Pham, V.T. Profuzzbench: A benchmark for stateful protocol fuzzing. In Proceedings of the 30th ACM SIGSOFT International Symposium on Software Testing and Analysis, Aarhus, Denmark, 11–17 July 2021; pp. 662–665. [Google Scholar] [CrossRef]
- Al Sardy, L.; Prasad, A.R.; German, R. i7Fuzzer: Neural-Guided Fuzzing for Enhancing Security Testing of Stateful Protocols. In Proceedings of the International Conference on Computer Safety, Reliability, and Security; Springer Nature: Cham, Switzerland, 2025; pp. 115–128. [Google Scholar] [CrossRef]
- Pereyda, J. Boofuzz: Network Protocol Fuzzing for Humans. GitHub. 2016. Available online: https://github.com/jtpereyda/boofuzz (accessed on 17 December 2025).
- Tsankov, P.; Dashti, M.T.; Basin, D. SECFUZZ: Fuzz-testing security protocols. In Proceedings of the 2012 7th International Workshop on Automation of Software Test (AST); IEEE: New York, NY, USA, 2012; pp. 1–7. [Google Scholar] [CrossRef]
- Song, J.; Meng, C.; Ermon, S. Denoising diffusion implicit models. arXiv 2020, arXiv:2010.02502. [Google Scholar] [CrossRef]
- Godefroid, P.; Peleg, H.; Singh, R. Learn&fuzz: Machine learning for input fuzzing. In Proceedings of the 2017 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE); IEEE: New York, NY, USA, 2017; pp. 50–59. [Google Scholar] [CrossRef]
- Lan, J.; Chen, C.; Cai, J.; Ming, X.; Li, M.; Wang, Y.; Zhang, Y.; Song, Y. ConDiffFuzz: Dependency-Aware Consistency Checking for Differential Fuzzing of Industrial Control Protocol Implementations. Electronics 2026, 15, 1324. [Google Scholar] [CrossRef]
- Chen, L.; Wang, Y.; Xiang, X.; Jin, D.; Ren, Y.; Zhang, Y.; Pan, Z.; Chen, Y. Txl-fuzz: A long attention mechanism-based fuzz testing model for industrial iot protocols. IEEE Internet Things J. 2024, 11, 38238–38245. [Google Scholar] [CrossRef]






| Function Code (Hex) | Description | Operation Type |
|---|---|---|
| 01 | Read Coils | Bit Read |
| 02 | Read Discrete Inputs | Bit Read |
| 03 | Read Holding Registers | Word Read |
| 04 | Read Input Registers | Word Read |
| 05 | Write Single Coil | Bit Write |
| 06 | Write Single Register | Word Write |
| 15 | Write Multiple Coils | Bulk Bit Write |
| 16 | Write Multiple Registers | Bulk Word Write |
| Test Model | Test Target | CTA (Categories) | NTA (Total Count) | ATITA (h) | TNR (%) | TPR (%) | ATE (Times/h) |
|---|---|---|---|---|---|---|---|
| SD-Fuzz | MobusRSSim | 7 | 225 | 0.60 | 95.28 | 94.15 | 1.48 |
| ModbusSlave | 5 | 68 | 1.99 | 94.72 | 93.88 | 1.12 | |
| xMasterSlave | 6 | 85 | 1.59 | 95.05 | 94.02 | 1.35 | |
| WGGFuzz | MobusRSSim | 6 | 198 | 0.74 | 93.36 | 92.81 | 1.31 |
| ModbusSlave | 4 | 57 | 2.58 | 92.54 | 92.39 | 0.99 | |
| xMasterSlave | 5 | 70 | 2.10 | 93.10 | 92.65 | 1.23 | |
| Peach Fuzzer | MobusRSSim | 4 | 92 | 1.83 | 85.42 | 89.76 | 0.68 |
| ModbusSlave | 3 | 32 | 5.25 | 84.39 | 88.91 | 0.45 | |
| xMasterSlave | 4 | 48 | 3.50 | 85.87 | 89.45 | 0.58 | |
| AFLNet | MobusRSSim | 5 | 105 | 1.45 | 91.23 | 91.78 | 0.92 |
| ModbusSlave | 4 | 45 | 3.38 | 90.65 | 91.12 | 0.72 | |
| xMasterSlave | 5 | 58 | 2.62 | 91.47 | 91.54 | 0.86 | |
| DiffusionFuzz | MobusRSSim | 5 | 112 | 1.01 | 92.85 | 92.10 | 0.98 |
| ModbusSlave | 4 | 52 | 2.17 | 91.92 | 91.87 | 0.84 | |
| xMasterSlave | 5 | 67 | 1.69 | 92.48 | 92.03 | 0.96 |
| Exception Type | Frequency (Counts) | ATITA (h) | Target Count | Vulnerability Nature |
|---|---|---|---|---|
| Slave crash | 38 | 0.36 | 6 | Denial of Service |
| Station ID offline | 92 | 0.15 | 5 | Logic Error |
| Abnormal function code | 58 | 0.23 | 6 | Input Validation |
| Window auto-close | 45 | 0.30 | 6 | Severe Crash |
| Data length unmatched | 83 | 0.16 | 6 | Format Error |
| Abnormal address | 52 | 0.26 | 5 | Boundary Check |
| Integer overflow | 12 | 1.13 | 5 | Numerical Error |
| Protocol state violation | 27 | 0.50 | 3 | Logic/Timing |
| Buffer overflow | 8 | 1.69 | 1 | Memory Corruption |
| Model | Number of Test Cases | Target Application | Number of Exceptions |
|---|---|---|---|
| SD-Fuzz | 200,000 | Modbus RSSIM2 v8.21.2.7 | 146 |
| Modbus Slave v6.1.3 | 66 | ||
| Modbus Poll v7.0.1 | 57 | ||
| Peach Fuzzer | 200,000 | Modbus RSSIM2 v8.21.2.7 | 61 |
| Modbus Slave v6.1.3 | 42 | ||
| Modbus Poll v7.0.1 | 45 | ||
| WGGFuzz | 200,000 | Modbus RSSIM2 v8.21.2.7 | 82 |
| Modbus Slave v6.1.3 | 51 | ||
| Modbus Poll v7.0.1 | 41 | ||
| TXL-Fuzz [28] | 200,000 | Modbus RSSIM2 v8.21.2.7 | 98 |
| Modbus Slave v6.1.3 | 57 | ||
| Modbus Poll v7.0.1 | 41 |
| Protocol | Training Time | TCRR | State Coverage | Example Bug Found |
|---|---|---|---|---|
| EtherCAT | 4.5 h | 89.4% | 48.7% | Heap overflow on master timeout |
| DNP3 | 5.2 h | 90.2% | 47.3% | Null pointer after lost link confirm |
| Configuration | TCRR | State Coverage |
|---|---|---|
| SD-Fuzz (full) | 91.3% | 50.1% |
| – DDPM | 79.2% | 0.0% |
| – HMM state guidance | 88.6% | 0.0% |
| – DMM lightweight mutation | 91.1% | 34.4% |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Tang, H.; Zhang, Z.; Zhao, K.; Liang, Z. SD-Fuzz: A State-Aware Industrial Control Protocol Fuzzing Framework Based on Diffusion Models. Electronics 2026, 15, 2156. https://doi.org/10.3390/electronics15102156
Tang H, Zhang Z, Zhao K, Liang Z. SD-Fuzz: A State-Aware Industrial Control Protocol Fuzzing Framework Based on Diffusion Models. Electronics. 2026; 15(10):2156. https://doi.org/10.3390/electronics15102156
Chicago/Turabian StyleTang, Hao, Zhiyong Zhang, Kejing Zhao, and Zhi Liang. 2026. "SD-Fuzz: A State-Aware Industrial Control Protocol Fuzzing Framework Based on Diffusion Models" Electronics 15, no. 10: 2156. https://doi.org/10.3390/electronics15102156
APA StyleTang, H., Zhang, Z., Zhao, K., & Liang, Z. (2026). SD-Fuzz: A State-Aware Industrial Control Protocol Fuzzing Framework Based on Diffusion Models. Electronics, 15(10), 2156. https://doi.org/10.3390/electronics15102156

