论文标题
您的固件告诉您的不是应该如何仿真:一种固件仿真的规范指导方法(扩展版)
What Your Firmware Tells You Is Not How You Should Emulate It: A Specification-Guided Approach for Firmware Emulation (Extended Version)
论文作者
论文摘要
由于缺乏外围模型,因此模拟微控制器的固件具有挑战性。现有工作发现如何通过分析目标固件来响应外围读取操作。这是有问题的,因为固件有时不包含足够的线索来支持仿真,甚至包含误导性信息(例如,车载固件)。在这项工作中,我们提出了一种新方法,该方法从外围规范中构建外围模型。使用NLP,我们将人类语言(以芯片手册记录)的外围行为转化为一组结构化条件行动规则。通过在运行时检查,执行和链接它们,我们可以动态地合成每个固件执行的外围模型。提取的条件行动规则可能不完整,甚至是错误的。因此,我们建议将符号执行纳入快速查明根本原因。这有助于我们对有问题的规则进行手动纠正。我们已经为跨三个不同芯片供应商的五个受欢迎的MCU董事会实施了想法。使用新的基于编辑距离的算法来计算痕量差异,我们对大型固件语料库的评估证实,与最先进的解决方案相比,我们的原型实现了更高的忠诚度。从准确的仿真中受益,我们的仿真器有效地避免了在现有的模糊工作中观察到的假阳性。我们还设计了一种新的动态分析方法来针对规范执行驱动程序代码合规性检查。我们发现了一些不合规,后来我们确认是种族条件引起的错误。
Emulating firmware of microcontrollers is challenging due to the lack of peripheral models. Existing work finds out how to respond to peripheral read operations by analyzing the target firmware. This is problematic because the firmware sometimes does not contain enough clues to support the emulation or even contains misleading information (e.g. buggy firmware). In this work, we propose a new approach that builds peripheral models from the peripheral specification. Using NLP, we translate peripheral behaviors in human language (documented in chip manuals) into a set of structured condition-action rules. By checking, executing, and chaining them at runtime, we can dynamically synthesize a peripheral model for each firmware execution. The extracted condition-action rules might not be complete or even be wrong. We, therefore, propose incorporating symbolic execution to quickly pinpoint the root cause. This assists us in the manual correction of the problematic rules. We have implemented our idea for five popular MCU boards spanning three different chip vendors. Using a new edit-distance-based algorithm to calculate trace differences, our evaluation against a large firmware corpus confirmed that our prototype achieves much higher fidelity compared with state-of-the-art solutions. Benefiting from the accurate emulation, our emulator effectively avoids false positives observed in existing fuzzing work. We also designed a new dynamic analysis method to perform driver code compliance checks against the specification. We found some non-compliance which we later confirmed to be bugs caused by race conditions.