Secure World in the Normal World: "공개되지 않은" 환경을 "오픈소스로 공개"하는 것의 의미

Type
Talk
Track
보안과 프라이버시 (Security & Privacy)
Language
Korean
Time
Nov 28, 2026, 1:45 PM - 2:15 PM
Room
#400

Abstract

스마트폰의 지문, 얼굴인증 정보, 결제 키는 Android가 아니라 TrustZone이라는 분리된 영역에 보관되지만, 그 안에서 돌아가는 코드는 소스가 거의 공개되어 있지 않고 기기에서 디버깅할 수도 없습니다. 이 발표에서는 Xiaomi 15, Galaxy S25 같은 Snapdragon 기기의 TrustZone 애플리케이션을 PC에서 실행하고 분석할 수 있도록, Unicorn과 AFL++ 같은 오픈소스 위에 직접 리버싱해서 만든 에뮬레이터 Qurarin을 소개합니다. 리버싱으로 만든 도구를 오픈소스로 공개하면서 무엇을, 어디까지 공개하기로 했는지, 그리고 이 도구가 다른 연구자들에게 어떤 도움이 될 수 있는지 이야기합니다.

Your phone keeps fingerprints, face authentication data, and payment keys not in Android but in an isolated area called TrustZone, yet the code running inside it is almost never published and cannot be debugged on a device. This talk introduces Qurarin, an emulator I built by reverse engineering, on top of open-source projects such as Unicorn and AFL++, so that TrustZone applications from Snapdragon devices like the Xiaomi 15 and the Galaxy S25 can be run and analyzed on a PC. I’ll talk about what I chose to publish, and how far I chose to go, when releasing a reverse-engineered tool as open source, and how the tool can help other researchers.


Description

스마트폰에 등록한 지문이나 얼굴인증 정보, 결제에 쓰는 키는 어디에 보관될까요? Android나 iOS가 아닙니다. Android의 경우에는 TrustZone이라는 별도의 영역이 있고, 모바일 OS가 통째로 해킹당해도(루트 권한이 있어도) 여기 있는 데이터는 꺼낼 수 없도록 CPU 수준에서, 일부 기종은 물리적으로도 분리되어 있습니다. 그런데 정작 그 안에서 돌아가는 애플리케이션(Trusted Application, 이하 TA)은 소스가 거의 공개되어 있지 않고, 실제 기기에서는 디버거조차 붙일 수 없습니다. 가장 민감한 데이터를 다루는 코드인데, 취약점이 있는지 기존의 일반적인 소프트웨어 디버깅 방법으로는 확인하기 어렵습니다.

취약점을 찾는 난이도는 코드를 직접 보고 실행해볼수 있을 때와 아닐 때가 천지차이입니다. 기기만으로 디버깅이 안 된다면 기기 밖에서 직접 TA를 돌리면 되겠다고 생각했고, 이것을 위한 에뮬레이터를 직접 만들기로 했습니다. Qurarin은 Snapdragon 칩이 들어간 스마트폰의 TrustZone(Qualcomm QSEE)에서 동작하는 TA를 PC에서 실행하고 디버깅하고 퍼징할 수 있게 해 주는 에뮬레이터입니다. 실제로 Xiaomi 15, Galaxy S25 같은 최신 기기에 들어 있는 TA를 기기 없이 그대로 구동할 수 있었습니다. TrustZone을 통째로 부팅하는 대신 TA 실행에 필요한 환경만 재현합니다. CPU 에뮬레이션은 Unicorn, 퍼징은 AFL++처럼 이미 공개된 오픈소스 라이브러리 기반으로 구동되고, 발표에서는 이 도구들을 어떻게 조합했는지도 함께 소개합니다.

물론 쉽게 되지는 않았습니다. TA가 TrustZone 운영체제에 요청하는 기능을 에뮬레이터가 대신 처리해 줘야 하는데, 이 부분은 문서가 전혀 없습니다. 결국 펌웨어를 직접 리버싱해서 하나씩 알아내고, 에뮬레이터에 다시 구현했습니다.

만들고 나니 다른 고민이 생겼습니다. 리버싱해서 만든 도구를 오픈소스로 내려면 무엇을, 어디까지 공개해도 되는지부터 정해야 했습니다. 펌웨어는 제가 배포할 수 있는 것이 아니므로 레포에 넣지 않고, 사용자가 준비한 펌웨어를 실행 시점에 불러오도록 설계했습니다. 공개하는 것은 제가 작성한 에뮬레이터 코드와 분석으로 알아낸 동작 방식입니다.

이 고민은 저만의 것이 아니라고 생각합니다. 최근 LLM 덕분에 리버싱이 훨씬 쉬워지면서, 남의 프로그램을 분석해 거의 그대로 다시 만든 뒤 오픈소스라며 공개하는 경우를 굉장히 자주 봅니다. 그래서 이 발표에서는 Qurarin의 구조와 함께, 공개 범위를 어떤 기준으로 정했는지도 숨김없이 이야기하려 합니다.

Qurarin을 공개하면 실제 기기나 별도 장비 없이도 누구나 TA를 실행하고 분석할 수 있게 됩니다. 지금까지 일부 연구자만 할 수 있던 TrustZone 분석의 진입 장벽을 낮추는 것이 공개의 가장 큰 목적입니다. 아직 QSEE만 지원하지만, 다른 제조사의 TrustZone 구현으로 넓히는 일을 포함해 같이 해 볼 만한 부분도 소개하겠습니다.

Where does your phone keep your fingerprint, your face authentication data, and the keys it uses for payments? Not in Android or iOS. On Android, there is a separate area called TrustZone, isolated at the CPU level, and on some models physically as well, so that its data stays out of reach even if the mobile OS is fully compromised (even with root privileges). Yet the applications that run inside it (Trusted Applications, or TAs) are almost never published as source, and on a real device you can’t even attach a debugger. This is the code that handles the most sensitive data on the phone, and the usual ways of debugging software can’t tell you whether it has vulnerabilities.

Finding vulnerabilities is a completely different job depending on whether you can read and run the code yourself. If debugging can’t be done with the device alone, I figured I could run the TAs off the device, and I decided to build an emulator for exactly that. Qurarin lets you run, debug, and fuzz, on a PC, the TAs that live in the TrustZone (Qualcomm QSEE) of Snapdragon-based smartphones. I have used it to run TAs taken from recent devices such as the Xiaomi 15 and the Galaxy S25 as they are, with no device attached. Instead of booting the whole of TrustZone, it recreates only the environment a TA needs in order to run. It runs on existing open-source libraries, with Unicorn for CPU emulation and AFL++ for fuzzing, and I’ll show how these pieces fit together.

It wasn’t easy, of course. The emulator has to handle everything a TA asks the TrustZone operating system to do, and none of that is documented. In the end I had to reverse engineer the firmware, work it out piece by piece, and reimplement it in the emulator.

Once it worked, a different problem came up. To release a tool built through reverse engineering as open source, I first had to decide what I could release, and how far I could go. The firmware isn’t mine to distribute, so it is not in the repo. Qurarin is designed to load firmware that the user provides at run time. What I’m releasing is the emulator code I wrote and what I learned about how the system behaves.

I don’t think this problem is mine alone. Now that LLMs have made reverse engineering far easier, I very often see people analyze someone else’s program, rebuild it almost as is, and publish the result as “open source.” So in this talk I’ll cover not only how Qurarin works, but also, openly, how I decided where to draw the line on what to publish.

With Qurarin public, anyone can run and analyze TAs without a physical device or special equipment. Lowering the barrier to TrustZone analysis, which until now only a small number of researchers could do, is the main reason for releasing it. It currently supports only QSEE, and I’ll also point out where others can help, including extending it to other vendors’ TrustZone implementations.

Speakers