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.
翻译:模拟器被广泛用于建立动态分析框架, 原因是其精细的追踪能力、 完整的系统监测功能以及在不同操作系统和结构上运行的可缩放性。 但是, 模拟器是否与真实设备一致还不清楚。 要了解这一问题, 我们的目标是自动定位不一致的指示, 模擬器和真实装置之间行为不一。 我们的目标为ARM结构结构, 提供机器可读规格。 根据规格, 我们提议一个测试案例生成器, 设计和实施亚美尼亚马克结构规格语言( ASL) 的第一个象征性执行引擎。 我们生成了2 774 649个有代表性的指令流, 并且在不同结构版本( 即 ARMv5、 ARMv6、 ARMv7-a) 和 ARMv8-a) 的四个真正指令流之间进行差异测试。 我们针对的是提供机器可读性规格的ARMR结构结构结构结构结构结构。 我们找到了155 642的不一致性指令流, 涵盖所有指令的30% 和47.8% 指令的反向性指令。 我们发现在亚美尼亚准则中未定义的4个指令执行过程, 和SARMUMUMU 中, 中, 最经常地证明了 。