自动定位ARM指令在真实设备和CPU仿真器之间的偏差
Automatically Locating ARM Instructions Deviation between Real Devices and CPU Emulators
摘要:
Emulator由于其细粒度的跟踪能力、完整的系统监控功能以及在不同操作系统和体系结构上运行的可扩展性而被广泛用于构建动态分析框架。然而,模拟器是否与真实设备一致是未知的。为了理解这个问题,我们的目标是自动定位不一致的指令,这些指令在仿真器和真实设备之间的行为不同。我们的目标是ARM架构,它提供了机器可读的规范。在此基础上,设计并实现了第一个面向ARM体系结构规约语言(ASL)的符号执行引擎,提出了一个测试用例生成器。我们生成了2,774,649个代表性指令流,并在不同架构版本的四个ARM真实设备(即,ARMv 5、ARMv 6、ARMv7-a和ARMv 8-a)和最先进的仿真器(即,QEMU)。我们找到了155,642个不一致的指令流,其中包括30%的指令编码和47.8%的指令。我们发现ARM手册中未定义的实现和QEMU的实现错误是导致不一致的主要原因。此外,我们发现了四个QEMU错误,这些错误已被开发人员确认并修补,涵盖了13种指令编码,包括最常用的编码(例如,STR,BLX)。利用这些不一致的指令,我们构建了三个安全应用程序,并演示了这些指令在检测仿真器、反仿真和反模糊方面的能力。
英文摘要:
Emulator is widely used to build dynamic analysis frameworks due to its fine-grained tracing capability, full system monitoring functionality, and scalability of running on different operating systemsand architectures. However, whether the emulator is consistent with real devices is unknown. To understand this problem, we aim to automatically locate inconsistent instructions, which behave differently between emulators and real devices. We target ARM architecture, which provides machine readable specification. Based on the specification, we propose a test case generator by designing and implementing the first symbolic execution engine for ARM architecture specification language (ASL). We generate 2,774,649 representative instruction streams and conduct differential testing with these instruction streams between four ARM real devices in different architecture versions (i.e., ARMv5, ARMv6, ARMv7-a, and ARMv8-a) and the state-of-the-art emulators (i.e., QEMU). We locate 155,642 inconsistent instruction streams, which cover 30% of all instruction encodings and 47.8% of the instructions. We find undefined implementation in ARM manual and implementation bugs of QEMU are the major causes of inconsistencies. Furthermore, we discover four QEMU bugs, which are confirmed and patched by thedevelopers, covering 13 instruction encodings including the most commonly used ones (e.g.,STR,BLX). With the inconsistent instructions, we build three security applications and demonstrate thecapability of these instructions on detecting emulators, anti-emulation, and anti-fuzzing.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。