TeeDFuzzer: Fuzzing Trusted Execution Environment
Abstract
:1. Introduction
- We identify three challenges of testing TEE, which are insufficient native features for testing, the requirement of system call dependency, and difficulties in reproducing bugs.
- We develop innovative methods to test TEE by solving the challenges. We use customized CAs and TAs to conduct fuzzing, analyze data flow of system calls, and record system call sequences for reproducing.
- We test OP-TEE with our TeeDFuzzer, and it exposes 17 crashes with one bug confirmed by the developer.
2. Background and Related Work
2.1. TrustZone-Assisted TEE
2.2. Trusted Kernel
2.3. Trusted Execution Environment Testing
2.4. Kernel Fuzzing
2.5. LLM Based Testing
3. Overview of TeeDFuzzer
Architecture of TeeDFuzzer
- Data Collection. The data collection module of TeeDFuzzer gathers information using two distinct approaches. The first involves instrumenting the core code of the Trusted Kernel. This method captures parameter information at the entry and exit points of system calls by instrumenting their source code, as well as code block coverage by modifying the kernel code itself. The second approach employs a Pseudo TA, which runs in the secure world and is compiled alongside the system kernel core code. This Pseudo TA encodes and collects sequences of system calls invoked during normal system operation, enabling the construction of test cases that closely mimic real-world scenarios.
- Dependency Inferrer. During the normal operation of the Target Host, we employ a lightweight data flow-based method to infer dependencies between system calls within the Trusted Kernel. This inference leverages characteristics of the Trusted Kernel system call parameters and the parameter data collected at system call entry and exit points by the data collection module. Using this approach, the dependency inferrer initializes the system call dependency digraph. During the fuzzing process, the data collection module continuously captures system call logs to track taint information. This tainted data is then used to dynamically enhance the system call dependency digraph.
- Initial Seed Corpus Generation. We will utilize the system call sequences collected during normal system operations, along with the inferred system call dependency digraph, to guide the initialization of the seed corpus.
- Fuzzer. During the fuzzing of the Trusted Kernel in the TEE, the fuzzer utilizes the initial seed corpus, system call dependency digraph, and fuzzing configuration as inputs. The outputs, which are test cases containing system call information, can be transmitted to the secure world’s invoker via the CA. The fuzzer retains the following types of test cases: (1) those that traverse each distinctive execution path for coverage-guided fuzzing, (2) unique test cases that induce a fatal signal in the tested program, and (3) unique test cases that cause the program to time out. The latter two types are identified as potential bugs.
- Invoker. The invoker, running as a TA in S-EL0, receives test cases shared by the fuzzer via the CA. It then parses these test cases and executes the system call sequences derived from them.
- Manager. Sometimes, a bug in the Trusted Kernel causes the Target Host to become trapped in the secure world, preventing it from returning to the normal world and causing it to hang. During fuzzing, the manager on the Analysis Host monitors the Trusted Kernel for any bugs that might crash or hang the Target Host. This monitoring involves checking the heartbeat signal between the Analysis Host and the Target Host to determine if a restart is necessary. Upon restarting, the manager records the input sequence that triggered the system crash, along with error information, for further analysis and reproduction.
4. Design of TeeDFuzzer
4.1. System Call Encoding in TEE
4.2. Data Collection for Graph Construction
- Coverage Bitmap Initialization: Prior to each test case, a dedicated system call in the secure world initializes a coverage bitmap within the session context. This bitmap is designed to record executed code paths and branches within the Trusted Kernel.
- Instrumentation and Logging: As system calls are executed, the instrumented kernel logs detailed entry and exit events, including parameter information, to secure world logs. These logs provide a comprehensive trace of the kernel’s execution flow.
- Data Analysis: The logged data are transmitted to an Analysis Host where they are processed to generate a system call dependency digraph. This digraph elucidates the relationships and dependencies between system calls, serving as a metric for the code coverage achieved during fuzzing.
- Direct Integration with the Trusted Kernel: Unlike conventional Trusted Applications that operate in user space and rely on the GlobalPlatform API, Pseudo TAs are embedded within the kernel. This integration allows them to execute with the same privileges as the kernel core, eliminating the overhead associated with address space isolation.
- Trace Buffer Management: At the commencement of a secure session, the session identifier is passed to the Pseudo TA, which initializes a dedicated system call trace buffer. Throughout the session, this buffer is populated with the sequence of executed system calls.
- Data Retrieval: Upon the termination of the session, the contents of the trace buffer are retrieved and stored via a command issued from the normal world. This recorded sequence represents the real-world operational behavior of the system.
4.3. Dependency Inferrer
4.3.1. System Call Dependencies
4.3.2. System Call Dependency Digraph
4.3.3. Program Slicing for Dependency Graph
4.3.4. Taint Tracking
- Log Collection and Initial Analysis: During fuzzing, the Trusted Kernel transmits logs of executed system calls to the Analysis Host. These logs include both entry and exit parameter information for each call. The dependency inferrer on the Analysis Host parses these logs, identifying which parameters are written (e.g., b in syscall_a) and which parameters or environmental variables are subsequently read.
- Identifying the Taint Source: In the deterministic phase of fuzzing, two nearly identical test cases are executed. They differ in exactly one parameter for a single system call (e.g., syscall_a with a1 modified), which is marked as the taint source. In Figure 4, syscall_a produces the output b, which may propagate to other calls.
- Monitoring Subsequent Calls for Changes: After syscall_a completes, every subsequent call (such as syscall_b and syscall_c) is monitored for exit parameter changes that might be attributed to the taint source. If the exit parameter (e.g., b1 in syscall_b) differs between the two test cases, that parameter is flagged as tainted and added to the taint queue.
- Comparing Parameters with the Taint Queue: For each subsequent system call, the dependency inferrer compares its parameters (name, type, and value) against the entries in the taint queue. If a parameter matches a taint entry, it indicates that the system call depends on the earlier tainted call. In the figure, if b or an environment variable updated by syscall_a is later consumed by syscall_b or syscall_c, a taint match is recorded.
- Establishing the Dependency in the Digraph: Once a taint match is identified, the dependency inferrer adds or updates an edge in the system call dependency digraph. For example, if syscall_b reads a parameter tainted by syscall_a, an edge is drawn from syscall_a to syscall_b, annotated with the specific parameter (b) or environment variable that triggered the dependency. This annotation ensures that future analysis can distinguish between parameter-based and environment-based dependencies.
- Integrating Environment Variables: The ENV node in Figure 4 represents global or shared state that can be read or modified by system calls. If syscall_a writes to ENV and syscall_b subsequently relies on this updated state, the inferrer notes an environment dependency. Such dependencies are captured in the digraph by edges leading to or from the ENV node, reflecting how changes to global state can affect the behavior of subsequent calls.
4.4. Dynamic Refinement of Dependency Graph
4.5. Fuzzer
4.6. Invoker
4.7. Manager
5. Evaluation
5.1. Coverage and Bug Discovery
5.2. Case Study
5.3. Limitations and Future Directions
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
TEE | The Trusted Execution Environment |
TCB | Trusted Computing Base |
IoT | Internet of Things |
TA | Trusted Application |
OS | Operating System |
CA | Client Application |
SMC | Secure Monitor Call |
PL | Privilege Level |
EL | Execution Levels |
References
- Wu, B.; He, S. Self-learning and explainable deep learning network toward the security of artificial intelligence of things. J. Supercomput. 2023, 79, 4436–4467. [Google Scholar]
- Kurmus, A.; Tartler, R.; Dorneanu, D.; Heinloth, B.; Rothberg, V.; Ruprecht, A.; Schröder-Preikschat, W.; Lohmann, D.; Kapitza, R. Attack Surface Metrics and Automated Compile-Time OS Kernel Tailoring. In Proceedings of the NDSS, San Diego, CA, USA, 24–27 February 2013; The Internet Society: Reston, VA, USA, 2013. [Google Scholar]
- Akram, A.; Akella, V.; Peisert, S.; Lowe-Power, J. Sok: Limitations of confidential computing via tees for high-performance compute systems. In Proceedings of the 2022 IEEE International Symposium on Secure and Private Execution Environment Design (SEED), Storrs, CT, USA, 26–27 September 2022; IEEE: Piscataway, NJ, USA, 2022; pp. 121–132. [Google Scholar]
- Paju, A.; Javed, M.O.; Nurmi, J.; Savimäki, J.; McGillion, B.; Brumley, B.B. SoK: A Systematic Review of TEE Usage for Developing Trusted Applications. In Proceedings of the 18th International Conference on Availability, Reliability and Security, Benevento, Italy, 29 August–1 September 2023; pp. 1–15. [Google Scholar]
- Oliveira, D.; Gomes, T.; Pinto, S. uTango: An Open-Source TEE for IoT Devices. IEEE Access 2022, 10, 23913–23930. [Google Scholar]
- Pinto, S.; Santos, N. Demystifying Arm TrustZone: A Comprehensive Survey. ACM Comput. Surv. 2019, 51, 130. [Google Scholar] [CrossRef]
- Cerdeira, D.; Santos, N.; Fonseca, P.; Pinto, S. SoK: Understanding the Prevailing Security Vulnerabilities in TrustZone-assisted TEE Systems. In Proceedings of the 2020 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA, 18–21 May 2020; pp. 1416–1432. [Google Scholar] [CrossRef]
- Zhu, X.; Zhou, W.; Han, Q.L.; Ma, W.; Wen, S.; Xiang, Y. When Software Security Meets Large Language Models: A Survey. IEEE/CAA J. Autom. Sin. 2025, 12, 317–334. [Google Scholar] [CrossRef]
- Zhou, W.; Zhu, X.; Han, Q.L.; Li, L.; Chen, X.; Wen, S.; Xiang, Y. The Security of Using Large Language Models—A Survey with Emphasis on ChatGPT. IEEE/CAA J. Autom. Sin. 2025, 12, 1–26. [Google Scholar] [CrossRef]
- Shiba, K.; Kuzuno, H.; Yamauchi, T. Prevention Method for Stack Buffer Overflow Attack in TA Command Calls in OP-TEE. In Proceedings of the 2023 Eleventh International Symposium on Computing and Networking Workshops (CANDARW), Matsue, Japan, 27–30 November 2023; IEEE: Piscataway, NJ, USA, 2023; pp. 274–278. [Google Scholar]
- Zhang, H.; She, D.; Qian, Z. Android Root and Its Providers: A Double-Edged Sword. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security, Denver, CO, USA, 12–16 October 2015; Association for Computing Machinery: New York, NY, USA, 2015; pp. 1093–1104. [Google Scholar] [CrossRef]
- Chen, X.; Li, C.; Wang, D.; Wen, S.; Zhang, J.; Nepal, S.; Xiang, Y.; Ren, K. Android HIV: A study of repackaging malware for evading machine-learning detection. IEEE Trans. Inf. Forensics Secur. 2019, 15, 987–1001. [Google Scholar] [CrossRef]
- GlobalPlatform. TEE Internal Core API Specification. 2021. Available online: https://globalplatform.org/specs-library/tee-internal-core-api-specification/ (accessed on 23 March 2025).
- Han, H.; Cha, S.K. IMF: Inferred Model-Based Fuzzer. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, Dallas, TX, USA, 30 October–3 November 2017; Association for Computing Machinery: New York, NY, USA, 2017; pp. 2345–2358. [Google Scholar] [CrossRef]
- Pailoor, S.; Aday, A.; Jana, S. MoonShine: Optimizing OS Fuzzer Seed Selection with Trace Distillation. In Proceedings of the 27th USENIX Security Symposium (USENIX Security 18), Baltimore, MD, USA, 15–17 August 2018; pp. 729–743. [Google Scholar]
- Liu, B.; Zhang, C.; Gong, G.; Zeng, Y.; Ruan, H.; Zhuge, J. FANS: Fuzzing Android Native System Services via Automated Interface Analysis. In Proceedings of the 29th USENIX Security Symposium (USENIX Security 20), Boston, MA, USA, 12–14 August 2020; pp. 307–323. [Google Scholar]
- Ispoglou, K.; Austin, D.; Mohan, V.; Payer, M. FuzzGen: Automatic Fuzzer Generation. In Proceedings of the 29th USENIX Security Symposium (USENIX Security 20), Boston, MA, USA, 12–14 August 2020; pp. 2271–2287. [Google Scholar]
- Corina, J.; Machiry, A.; Salls, C.; Shoshitaishvili, Y.; Hao, S.; Kruegel, C.; Vigna, G. Difuze: Interface aware fuzzing for kernel drivers. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, Dallas, TX, USA, 30 October–3 November 2017; pp. 2123–2138. [Google Scholar]
- Babić, D.; Bucur, S.; Chen, Y.; Ivančić, F.; King, T.; Kusano, M.; Lemieux, C.; Szekeres, L.; Wang, W. Fudge: Fuzz driver generation at scale. In Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Tallinn, Estonia, 26–30 August 2019; pp. 975–985. [Google Scholar]
- Kohlbrenner, D.; Shinde, S.; Lee, D.; Asanovic, K.; Song, D. Building Open Trusted Execution Environments. IEEE Secur. Priv. 2020, 18, 47–56. [Google Scholar] [CrossRef]
- Mill, H. OP-TEE. 2024. Available online: https://www.trustedfirmware.org/projects/op-tee/ (accessed on 1 May 2024).
- Sheng, C.; Zhou, W.; Han, Q.L.; Ma, W.; Zhu, X.; Wen, S.; Xiang, Y. Network Traffic Fingerprinting for IIoT Device Identification: A Survey. IEEE Trans. Ind. Inform. 2025, 1–14. [Google Scholar] [CrossRef]
- Deng, Z.; Guo, Y.; Han, C.; Ma, W.; Xiong, J.; Wen, S.; Xiang, Y. AI agents under threat: A survey of key security challenges and future pathways. ACM Comput. Surv. 2025, 57, 182. [Google Scholar]
- Cai, C.; Xu, L.; Zhou, A.; Wang, C. Toward a secure, rich, and fair query service for light clients on public blockchains. IEEE Trans. Dependable Secur. Comput. 2021, 19, 3640–3655. [Google Scholar] [CrossRef]
- Jeon, S.; Kim, H.K. TZMon: Improving mobile game security with ARM trustzone. Comput. Secur. 2021, 109, 102391. [Google Scholar] [CrossRef]
- Dai, W.; Wang, Q.; Wang, Z.; Lin, X.; Zou, D.; Jin, H. Trustzone-based secure lightweight wallet for hyperledger fabric. J. Parallel Distrib. Comput. 2021, 149, 66–75. [Google Scholar]
- Riscure. OP-TEE Fuzzer. 2019. Available online: https://github.com/Keysight/optee_fuzzer (accessed on 1 May 2024).
- Harrison, L.; Vijayakumar, H.; Padhye, R.; Sen, K.; Grace, M. PARTEMU: Enabling Dynamic Analysis of Real-World TrustZone Software Using Emulation. In Proceedings of the 29th USENIX Security Symposium (USENIX Security 20), Boston, MA, USA, 12–14 August 2020; USENIX Association: Berkeley, CA, USA, 2020; pp. 789–806. [Google Scholar]
- Khalid, F.; Masood, A. Vulnerability analysis of qualcomm secure execution environment (QSEE). Comput. Secur. 2022, 116, 102628. [Google Scholar] [CrossRef]
- Hanel, L. Kinibi-520a: The latest Trustonic Trusted Execution Environment (TEE). 2021. Available online: https://www.trustonic.com/technical-articles/kinibi-520a-the-latest-trusted-execution-environment-tee/ (accessed on 23 March 2025).
- Samsung. SAMSUNG TEEGRIS SDK. 2017. Available online: https://developer.samsung.com/teegris/overview.html (accessed on 23 March 2025).
- Beniamini. FuzzZone. 2017. Available online: https://github.com/laginimaineb/fuzz_zone/tree/master/FuzzZone (accessed on 23 March 2025).
- Zhu, X.; Wen, S.; Camtepe, S.; Xiang, Y. Fuzzing: A survey for roadmap. ACM Comput. Surv. 2022, 54, 230. [Google Scholar] [CrossRef]
- Feng, X.; Zhu, X.; Han, Q.L.; Zhou, W.; Wen, S.; Xiang, Y. Detecting vulnerability on IoT device firmware: A survey. IEEE/CAA J. Autom. Sin. 2022, 10, 25–41. [Google Scholar] [CrossRef]
- Zhu, X.; Böhme, M. Regression greybox fuzzing. In Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security, Virtual Event, 15–19 November 2021; pp. 2169–2182. [Google Scholar]
- Feng, X.; Sun, R.; Zhu, X.; Xue, M.; Wen, S.; Liu, D.; Nepal, S.; Xiang, Y. Snipuzz: Black-box fuzzing of iot firmware via message snippet inference. In Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security, Virtual Event, 15–19 November 2021; pp. 337–350. [Google Scholar]
- Kim, K.; Jeong, D.R.; Kim, C.H.; Jang, Y.; Shin, I.; Lee, B. HFL: Hybrid Fuzzing on the Linux Kernel. In Proceedings of the NDSS, San Diego, CA, USA, 23–26 February 2020. [Google Scholar]
- Deng, Y.; Xia, C.S.; Peng, H.; Yang, C.; Zhang, L. Large language models are zero-shot fuzzers: Fuzzing deep-learning libraries via large language models. In Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis, Seattle, WA, USA, 17–21 July 2023; pp. 423–435. [Google Scholar]
- Liu, Z.; Chen, C.; Wang, J.; Che, X.; Huang, Y.; Hu, J.; Wang, Q. Fill in the blank: Context-aware automated text input generation for mobile gui testing. In Proceedings of the 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), Melbourne, Australia, 14–20 May 2023; IEEE: Piscataway, NJ, USA, 2023; pp. 1355–1367. [Google Scholar]
Fuzzers | #Crashes | TTC (h) | #Bugs | TTB |
---|---|---|---|---|
TeeDFuzzer | 17 | 1.5 | 1 | 1.5 |
optee_fuzzer | 2 | 5 | 1 | 5 |
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. |
© 2025 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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Wen, S.; Xu, L.; Tian, L.; Liu, S.; Ding, Y. TeeDFuzzer: Fuzzing Trusted Execution Environment. Electronics 2025, 14, 1674. https://doi.org/10.3390/electronics14081674
Wen S, Xu L, Tian L, Liu S, Ding Y. TeeDFuzzer: Fuzzing Trusted Execution Environment. Electronics. 2025; 14(8):1674. https://doi.org/10.3390/electronics14081674
Chicago/Turabian StyleWen, Sheng, Liam Xu, Liwei Tian, Suping Liu, and Yong Ding. 2025. "TeeDFuzzer: Fuzzing Trusted Execution Environment" Electronics 14, no. 8: 1674. https://doi.org/10.3390/electronics14081674
APA StyleWen, S., Xu, L., Tian, L., Liu, S., & Ding, Y. (2025). TeeDFuzzer: Fuzzing Trusted Execution Environment. Electronics, 14(8), 1674. https://doi.org/10.3390/electronics14081674