DITING: A Static Analyzer for Identifying Bad Partitioning Issues in TEE Applications

arXiv:2502.15281 · cs.CR, cs.SE · Submitted 2025-02-21 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: Security Radio. Generated commentary on the latest security and cryptography papers.

Nadia: We're looking at the paper: "DITING: A Static Analyzer for Identifying Bad Partitioning Issues in TEE Applications".

Title and authors: Nadia: So this DITING tool, it analyzes the data flows of parameters passed between the normal world and TEE to check them against rules for input/output and shared memory interactions. It’s trying to catch those bad partitioning issues at the source.

Elias: The authors found that bad partitioning often comes down to two main things: first, there's a lack of secure interface components between the normal world and the TEE, like not encrypting output data or not checking bounds on input data. Second is when there are insecure mechanisms inside the TEE code itself.

Priya: So what does this analysis actually look like in practice? Is it just checking if a parameter goes where it's supposed to go, or is it deeper than that?

Nadia: It’s deeper because they constructed data flows using CodeQL to trace every path of input/output and shared memory parameters. They do a preparation step first where they define rules based on sensitive functions and data.

Elias: That preparation step is key, because it lets them set up specific rules for what operations are allowed on that sensitive stuff before they start tracing the actual data paths through the code.

The paper's summary: Nadia: So what’s the core idea of DITING in simple terms? They want to identify where parameters get mishandled when moving between the secure TEE and the untrusted normal world.

Elias: Essentially, they build a system that traces how data flows through input/output and shared memory parameters to see if those flows violate specific security rules they set up. It’s about checking whether these parameters pass through functions or interact with data related to those initial rules.

Priya: When you look at the actual findings, what are the main types of issues DITING is designed to catch? Is it just one kind of vulnerability?

Nadia: They focused on three main threat vectors emerging from bad partitioning practices. First, sensitive data leakage if something sensitive like cryptographic keys or passwords is output to the normal world without encryption. Second, input validation weaknesses where input parameters are used in array accesses or memory copies without checking their boundaries. And third, direct usage of shared memory which lets both partitions access the same physical memory region through shallow copies.

Elias: So they are targeting these specific scenarios: unencrypted data output, lack of bounds checking on inputs, and insecure reliance on shared memory sharing mechanisms. It maps out exactly where the partitioning breaks down based on these three vectors.

The paper's improvements: Nadia: They outlined three specific rules they formulated to detect these issues. Rule one targets unencrypted data output, looking for a sink of an output parameter that doesn't have a source passing through an encryption API.

Elias: That rule is designed to catch when sensitive statements or parameter usage lack the necessary security components for output parameters. It flags situations where sensitive data leaves the TEE without being encrypted.

Priya: And what about input validation? How does Rule two specifically address the risk of buffer overflows?

Nadia: Rule two addresses input validation weaknesses by flagging when input parameters are used in array accesses or memory copies without any preceding conditional checks. They make an exception if the TEE explicitly allocates memory whose size matches the input buffer.

Elias: That rule is looking for sinks that don't come from a source that has gone through a check, which directly relates to potential buffer overflows because it prevents using untrusted input as an index or causing a memory copy to exceed boundaries.

Nadia: Rule three focuses on shared memory integrity by capturing scenarios where shallow copying allows both partitions to access the same physical memory region. They detect this by identifying the presence of insecure components when direct use of shared memory or its shallow copies occurs.

Conclusion: Elias: So to wrap up, DITING’s effectiveness was tested using the PartitioningE-Bench benchmark, which has one hundred ten test cases covering three types of bad partitioning vulnerabilities. They got an F1 score of zero point nine zero in identifying these issues overall.

Nadia: And they showed high precision and recall for detecting unencrypted data output, getting a high F1 score of zero point nine six specifically for that rule violation type. But they also noted some trade-offs in the shared memory detection, achieving a recall above ninety five percent but with lower precision below eighty five percent.

Priya: So what does this mean for us who are trying to trust these TEE applications? It shows that while we can find issues, the detection isn't perfect across all types of bad partitioning.

Elias: The authors acknowledge that most tools need successful compilation and expert customization, and they suggest future work should focus on incorporating semantic context from the code to reduce false positives in their rules.

Nadia: They also mentioned that porting entire programs into TEE significantly increases the Trusted Computing Base, which is a big design consideration for anyone building these systems.

Priya: It’s clear they can find a lot of issues, but the next step must be to fix them automatically and make sure those rules are robust enough for real-world complexity.

Elias: So that’s the rundown on DITING: A Static Analyzer for Identifying Bad Partitioning Issues in TEE Applications. We’ll keep an eye on how they move from detection to fixing these kinds of partitioning errors.

Singapore Management University

cs.CR, cs.SE

Submitted: 2025-02-21

Updated: 2025-07-10

DOI: 10.1109/TSE.2026.3726954

Code: https://github.com/lsds/sgx-lkl

License: http://creativecommons.org/licenses/by/4.0/

Importance score: 78/100

The gist: Trusted Execution Environment (TEE) applications still face vulnerabilities stemming from bad partitioning…

Key concepts

Bad Partitioning Issues
These are security vulnerabilities in TEE apps arising from improper separation between the normal world and the TEE. They occur when parameters passed between these two environments are used insecurely, leading to potential data leaks or malicious manipulation.
Data Flow Analysis
This is the core technique DITING uses to trace every path a piece of data takes through a program. It maps how input/output and shared memory parameters move from their source (like user input) to where they are used in the TEE code, helping pinpoint potential security errors.
Rule-Based Detection Logic
DITING defines specific rules to check for known bad practices. For example, one rule checks if sensitive output data is sent without encryption, another checks if input parameters are used in memory operations without proper bounds checking. This systematic rule application identifies violations.
PartitioningE-Bench
This is the benchmark dataset used to test DITING's effectiveness. It contains 110 test cases covering various types of bad partitioning vulnerabilities, such as unencrypted output, input validation weaknesses, and shared memory misuse. It helps measure how well DITING performs in finding these specific flaws.

Terminology

Summary

Trusted Execution Environment (TEE) applications still face vulnerabilities stemming from bad partitioning, which can lead to critical security problems such as leaking sensitive data to the normal world or being adversely affected by malicious inputs from the normal world The authors propose DITING, a static analyzer that detects these partitioning issues by analyzing data flows of input/output and shared memory parameters

Problem Identification and Motivation

The paper addresses the fact that vulnerabilities in TEE applications often arise from insecure data communication between the normal world and TEE, which usually relies on three types of parameters: input/output and shared memory. The authors found that bad partitioning issues are often caused by the improper usage of these parameters. p. 1

Where the paper says it

Our contributions of this paper include: • The first systematic summary of partitioning issues. With the real-world vulnerable code where input, output, and shared memory parameters are handling in sensitive functions and data of TEE, we summarized that the bad partitioning issues in TEE are often caused by the improper usage of these parameters.

Specifically, the paper discusses two key aspects of TEE bad partitioning issues: (1) the absence of secure interface components between the normal world and the TEE, and (2) the use of insecure mechanisms within TEE code. p. 1
Where the paper says it

Therefore, this paper discusses TEE bad partitioning issues based on two key aspects: (1) the absence of secure interface components between the normal world and the TEE (e. , returning output data without encryption, and using input data missing bounds checking), and (2) the use of insecure mechanisms within TEE code (e.

DITING System Design

The DITING tool is designed to identify bad partitioning issues by constructing data flows of parameters passed between the normal world and TEE using CodeQL. The design process involves six key steps:

  1. Preparation Step: Rule Establishment, where sensitive functions and data are identified, and rules are established to define permissible operations on these sensitive functions and data

  2. Dataflow Construction, where the data flows of input/output and shared memory parameters will be generated to trace the path of each parameter

  3. Parameter Analysis, which involves analyzing whether the parameters pass through functions or interact with data related to rules in the preparation step

  4. Rule Matching with Parameter Data flows, where data flows are matched against established rules to identify violations

  5. Reporting Bad Partitioning Issues, where detailed reports highlighting bad partitioning issues are generated based on rule violations

Rule Establishment and Detection Logic

The authors formulated three rules for detecting these issues, which focus on identifying insecure parameter interactions with in-TEE sensitive functions and data. These rules are defined using notations like o for output parameter, i for input parameter, m for shared memory parameter, and x, y, z for data in the TEE code. p. 4

Where the paper says it

Meanwhile, we define some commonly TABLE II: Defined notations of parameters, variables, and operations in the TEE code. o : The output parameter i : The input parameter m : The shared memory parameter x, y, z : The data in the TEE code y := ENC(x) : y is a return value or buffer of the encryptionrelated cryptographic API, where x is passed into.

** Rule 1 for Unencrypted Data Output identifies violations where sensitive statements or parameter usage lack security components The violation is identified when a sink of an output parameter does not have a source that passes through an encryption API. p. 5

Where the paper says it

Based on this classification: • Violations of Rules 1 and 2 can be detected by identifying critical statements that lack an associated secure component; • Violations of Rule 3, which involve the direct use of shared memory or its shallow copies, can be identified by detecting the presence of an insecure component. Data flow Generation In this step, we construct the data flow of each parameter passed between the normal world and TEE according to the source and sink shown in Fig.

3**

** Rule 2 for Input Validation Weaknesses addresses the lack of bounds checking, flagging violations when input parameters are used in array accesses or memory copies without preceding conditional checks An exception is made when TEE explicitly allocates memory whose size matches the input buffer. 4**

** Rule 3 for Direct Usage of Shared Memory captures scenarios where shallow copying shared memory allows both partitions to access the same physical memory region, which is identified as a bad partitioning instance This is detected by identifying the presence of an insecure component when direct use of shared memory or its shallow copies occurs. 6**

Evaluation and Results

The effectiveness of DITING was evaluated using the PartitioningE-Bench benchmark, which consists of 110 test cases covering three types of bad partitioning vulnerabilities. Experimental results demonstrate that DITING achieves an F1 score of 0. p. 1

Where the paper says it

Due to the lack of datasets containing TEE partitioning issues, we created the first Partitioning Errors Benchmark named PartitioningE-Bench, which consists of 110 test cases, and 90 cases of them cover 3 types of bad partitioning vulnerabilities. Experimental results demonstrate that DITING achieves an F1 score of 0.

90 in identifying bad partitioning issues. p. 0
Where the paper says it

JOURNAL OF LATEX CLASS FILES, VOL. 8, AUGUST 2015 1 DITING: A Static Analyzer for Identifying Bad Partitioning Issues in TEE Applications Chengyan Ma , Ruidong Han, Jieke Shi, Ye Liu, Yuqing Niu, Di Lu , Chuang Tian , Jianfeng Ma , Debin Gao , and David Lo , Fellow, IEEE Abstract—Trusted Execution Environment (TEE) enhances the security of mobile applications and cloud services by isolating sensitive code in the secure world from the non-secure normal world.

The precision and recall for the detection of unencrypted data output achieved a high F1 score of 0. p. 8
Where the paper says it

Answer to RQ1: (1) DITING provides the highest F1 score of 0. 96 in the detection of unencrypted data output (both precision and recall exceed 90%).

96.

Efficiency and Real-World Performance

The efficiency evaluation showed that while the time cost of data flow construction increases with Line Count (LoC), DITING still exhibits high efficiency for detecting bad partitioning issues, taking around 5.56 milliseconds. p. 8

Where the paper says it

The time spent on data flow analysis remains relatively low and does not grow significantly with the changes of LoC (from 3. 96 milliseconds to 7.

In the in-the-wild study, DITING reported 154 issues caused by bad partitioning in real-world TEE projects, and 130 of them were confirmed by the authors. p. 9
Where the paper says it

Answer to RQ3: DITING is capable of identifying bad partitioning issues in real-world projects. Through a review of 154 issues reported by DITING in the wild, we have confirmed that 130 of them were true alarms by ourselves.

The detection of direct usage of shared memory achieved the best recall above 95%, but with relatively low precision below 85%. p. 8
Where the paper says it

96 in the detection of unencrypted data output (both precision and recall exceed 90%). (2) The detection of direct usage of shared memory achieves the best recall (above 95%), but with relatively low precision (below 85%).

Conclusion and Future Work

The paper concludes that DITING can help to find bad partitioning issues in TEE applications. The authors aim to explore automated solutions for fixing bad partitioning issues in TEE applications based on the detection results in the future. p. 9

Where the paper says it

Therefore, if these definitions are not accurate or comprehensive enough, it may lead to biased detection results. We need to update the rules based on the newly discovered bad partitioning issues in actual TEE applications to expand the detection capabilities of DITING.

The study also suggests that incorporating more vulnerabilities from real-world TEE projects into PartitioningE-Bench could reduce biases introduced by manual injection. p. 9
Where the paper says it

This could lead to a discrepancy between the distribution of bad partitioning issues in the dataset and those in real-world TEE projects, thereby affecting the evaluation of detection accuracy. It is possible that we incorporate more vulnerabilities from real-world TEE projects into PartitioningE-Bench to reduce biases introduced by manual injection.

Furthermore, future work should evaluate DITING on other TEE architectures and large-scale real-world projects to improve external applicability. p. 9
Where the paper says it

In addition, the evaluated projects are relatively small in scale and do not cover complex industrial-level projects. Future studies should evaluate DITING on a broader range of TEE architectures and large-scale real-world projects, thereby improving the external applicability of the experimental results.

The study also notes that refining the rules by incorporating the semantic context of the code could further reduce false positives. p. 8
Where the paper says it

In summary, if we formulate additional filters for the reported issues in the future, it is possible to effectively reduce FPs that deviate from the predefined rules but do not actually introduce security risks. What’s more, we can refine the rules by incorporating the semantic context of the code, and FNs can be further reduced.

The authors acknowledge that most tools necessitate successful compilation and expert customization, and LLMDFA can improve data flow path identification. p. 9
Where the paper says it

However, most tools (e. , CodeQL and Frama-C [34]) typically necessitate successful compilation and expert customization.

The study also highlights the need to update rules based on newly discovered bad partitioning issues in actual TEE applications. p. 9
Where the paper says it

Therefore, if these definitions are not accurate or comprehensive enough, it may lead to biased detection results. We need to update the rules based on the newly discovered bad partitioning issues in actual TEE applications to expand the detection capabilities of DITING.

The authors also suggest that porting entire programs into TEE significantly increases the Trusted Computing Base (TCB). The paper addresses the gap by comprehensively detecting security vulnerabilities caused by bad partitioning in TEE implementations. p. 9
Where the paper says it

Poorly designed TEE code partitioning can result in severe security risks, such as the leakage of sensitive data or the injection of untrusted data, which could influence the integrity of TEE application execution. Our work addresses this gap by comprehensively detecting security vulnerabilities caused by bad partitioning in

The authors also mention that poor design of TEE code partitioning can result in severe security risks. p. 9
Where the paper says it

Research addressing bad partitioning issues in TEE projects remains limited, despite it being an equally critical concern. Poorly designed TEE code partitioning can result in severe security risks, such as the leakage of sensitive data or the injection of untrusted data, which could influence the integrity of TEE application execution.

Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.

Improvements for AI systems

  1. Improve security by developing DITING, a tool that can analyze data flows of parameters passed between normal world and TEE to identify violations of defined rules for input/output and shared memory interactions. This allows developers to detect bad partitioning issues before deployment by checking whether these parameters pass through functions or interact with data related to rules in the preparation step.

  2. Enhance vulnerability detection by creating PartitioningE-Bench, the first benchmark consisting of 110 test cases covering 90 cases of bad partitioning vulnerabilities. This dataset allows for comprehensive evaluation of DITING's effectiveness across different partitioning types: unencrypted data output, input validation weaknesses, and direct usage of shared memory.

  3. Increase detection precision for sensitive data leakage by focusing on Rule 1 violation: Sink(o) not in SC(x), which flags output parameters receiving in-TEE data without encryption as a bad partitioning instance. This specifically targets the risk where sensitive data (e.g., cryptographic keys, passwords, or authentication tokens) is output to the normal world without encryption.

  4. Improve detection of buffer overflows by implementing Rule 2 violation checking: Sink(CS) not in SC(i), which flags input parameters used in array accesses or memory copies without preceding conditional checks. This addresses the risk where an input value may be an index of an array (e.g., a[params[0].value.a]) or where a buffer overflow may occur because memory copy operations within TEE could exceed the boundaries of the inputs.

  5. Strengthen shared memory integrity checks by implementing Rule 3 violation checking: Sink(y) exists ISC(m) or ISC(x), which flags direct usage of shared memory. This addresses the risk where TEE applications may access shared memory directly through shallow copies, making them vulnerable to runtime manipulation by untrusted normal-world processes controlled by attackers.

Abstract

Trusted Execution Environment (TEE) enhances the security of mobile applications and cloud services by isolating sensitive code in the secure world from the non-secure normal world. However, TEE applications are still confronted with vulnerabilities stemming from bad partitioning. Bad partitioning can lead to critical security problems of TEE, such as leaking sensitive data to the normal world or being adversely affected by malicious inputs from the normal world. To address this, we propose an approach to detect partitioning issues in TEE applications. First, we conducted a survey of TEE vulnerabilities caused by bad partitioning and found that the parameters exchanged between the secure and normal worlds often contain insecure usage with bad partitioning implementation. Second, we developed a tool named DITING that can analyze data-flows of these parameters and identify their violations of security rules we defined to find bad partitioning issues. Different from existing research that only focuses on malicious input to TEE, we assess the partitioning issues more comprehensively through input/output and shared memory. Finally, we created the first benchmark targeting bad partitioning, consisting of 110 test cases. Experiments demonstrate that DITING achieves an F1 score of 0.90 in identifying bad partitioning issues.

Related papers