← Latest papers
💻 computer science

Automated Repair of TEE Partitioning Issues via DSL-Guided and LLM-Assisted Patching

This paper presents TEERepair, a framework that combines a domain-specific language for encoding security patterns with large language models to automatically synthesize and validate patches for partitioning vulnerabilities in Trusted Execution Environment (TEE) applications, achieving an 87.6% repair success rate and successfully merging fixes into real-world projects.

Original authors: Chengyan Ma, Jieke Shi, Ruidong Han, Ye Liu, Feng Li, Yuqing Niu, David Lo

Published 2026-05-22
📖 4 min read☕ Coffee break read

Original authors: Chengyan Ma, Jieke Shi, Ruidong Han, Ye Liu, Feng Li, Yuqing Niu, David Lo

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine a high-security vault (the Trusted Execution Environment, or TEE) sitting inside a chaotic, potentially hostile city (the Operating System). The vault is designed to keep your most sensitive secrets—like passwords, bank keys, or private data—safe from the city's criminals.

However, there's a problem: the vault needs to talk to the city to get instructions and send back results. This conversation happens through a "doorway" or a partition.

The Problem: The Broken Doorway

In many cases, the people building these vaults make mistakes when designing this doorway. They might:

  1. Forget to lock the door: Sending secrets out in plain text instead of encrypted code.
  2. Ignore the size of the package: Letting a giant box (too much data) smash through the wall, causing a leak.
  3. Trust the wrong neighbor: Allowing the city to directly touch the vault's internal storage without checking if the neighbor has tampered with it.

These mistakes are called "Bad Partitioning Issues." They are like leaving the vault door wide open or using a flimsy lock.

The Challenge: Why Fixing It Is Hard

Fixing these mistakes automatically is incredibly difficult for three reasons:

  • No Rulebook: Unlike building a house where there are strict blueprints, there isn't a single, agreed-upon "secure way" to build these vault doorways. Developers often guess, leading to inconsistent and risky designs.
  • The Language Barrier: The code is written in a low-level language (C) that is like reading a machine's raw thoughts. It's hard to tell what a specific number or variable really means without deep human intuition.
  • The Black Box: You can't easily peek inside the vault while it's running to see if your fix works. Testing is slow, expensive, and requires special hardware.

The Solution: TEERepair

The authors created a tool called TEERepair to automatically fix these broken doorways. Think of it as a Master Architect (DSL) working alongside a Super-Intelligent Intern (LLM).

1. The Master Architect (The DSL)

The team created a special "rulebook" called a Domain-Specific Language (DSL).

  • Analogy: Imagine a set of Lego templates. The Architect says, "If you see a door without a lock, the rule is: Add a lock here, and put a keyhole there."
  • This rulebook doesn't write the whole code; it just provides the structure of the fix. It knows what needs to be done (e.g., "encrypt this data" or "check the size of this box") but leaves the specific details blank.

2. The Super-Intelligent Intern (The LLM)

The Large Language Model (LLM) is the intern who looks at the specific messy code and fills in the blanks left by the Architect.

  • Analogy: The Architect says, "Put a lock on the door." The Intern looks at the specific door in the code and says, "Okay, this door is made of wood and is 5 feet tall, so I'll install a 5-foot brass lock named my_lock."
  • The LLM uses its brain to understand the context, figure out variable names, and make sure the new code fits perfectly with the old code.

3. The Safety Inspector (The Two-Stage Check)

Once the Intern writes the fix, the tool doesn't just trust it. It runs a two-step inspection:

  • Stage 1 (The Quick Scan): A static analyzer checks the code instantly to see if the obvious "bad patterns" are gone. This is like looking at the blueprint to ensure the lock is actually there.
  • Stage 2 (The Real Test): The tool automatically builds a "test driver" (a robot) that tries to break the vault with the new fix. It runs the code on real hardware to make sure the vault still works correctly and doesn't leak secrets.

The Results

The team tested TEERepair on a benchmark of 89 known security holes.

  • Success Rate: It successfully fixed 87.6% of the problems.
  • Comparison: Other tools (like standard AI chatbots or older repair methods) only managed to fix about 13% to 19% of the issues.
  • Real World: The team took their fixes to real-world projects on GitHub. They submitted 5 "repair requests" (Pull Requests), and the project owners accepted and merged 2 of them, proving the tool works in the real world.

Summary

TEERepair is a system that combines strict security rules (the DSL) with smart AI reasoning (the LLM) to automatically patch holes in secure computer vaults. It acts like a master builder who knows exactly how to fix a security flaw, paired with a smart assistant who knows exactly where to put the fix in the specific code, ensuring the vault remains safe from the chaotic city outside.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →