Emulating firmware for microcontrollers is challenging due to the tight coupling between the hardware and firmware. This has greatly impeded the application of dynamic analysis tools to firmware analysis. The state-of-the-art work automatically models unknown peripherals by observing their access patterns, and then leverages heuristics to calculate the appropriate responses when unknown peripheral registers are accessed. However, we empirically found that this approach and the corresponding heuristics are frequently insufficient to emulate firmware. In this work, we propose a new approach called uEmu to emulate firmware with unknown peripherals. Unlike existing work that attempts to build a general model for each peripheral, our approach learns how to correctly emulate firmware execution at individual peripheral access points. It takes the image as input and symbolically executes it by representing unknown peripheral registers as symbols. During symbolic execution, it infers the rules to respond to unknown peripheral accesses. These rules are stored in a knowledge base, which is referred to during the dynamic firmware analysis. uEmu achieved a passing rate of 95% in a set of unit tests for peripheral drivers without any manual assistance. We also evaluated uEmu with real-world firmware samples and new bugs were discovered.
翻译:缩微控制器的固态软件由于硬件和固态软件之间紧密的连接而具有挑战性。 这极大地妨碍了将动态分析工具应用于固态软件分析。 最先进的工作通过观察其访问模式自动模拟未知外围物, 并随后在进入未知外围物登记册时利用超能力来计算适当的反应。 然而, 我们从经验中发现, 这种方法和相应的超自然体学往往不足以模仿固态软件。 在这项工作中, 我们提议了一种名为 uEmu 的新方法, 以效仿未知外围物的固态软件。 与试图为每个外围物建立通用模型的现有工作不同, 我们的方法学会如何在单个外围物进入点正确模仿固态软件执行。 它将图像作为输入, 并象征性地将未知外围物登记册作为符号进行执行。 在象征性执行过程中, 我们推导出应对未知外围物进入的规律, 这些规则储存在一个知识库中, 动态固态软件分析中提到了这一点。 uEmu在一套没有任何手动协助的外围力驱动器的单位测试中取得了95%的通过率率。 我们还评估了企业的样品。