What Your Firmware Tells You Is Not How You Should Emulate It: A Specification-Guided Approach for Firmware Emulation

08/16/2022
by   Wei Zhou, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
07/16/2021

Automatic Firmware Emulation through Invalidity-guided Knowledge Inference (Extended Version)

Emulating firmware for microcontrollers is challenging due to the tight ...
research
09/24/2021

Finding Taint-Style Vulnerabilities in Linux-based Embedded Firmware with SSE-based Alias Analysis

Although the importance of using static analysis to detect taint-style v...
research
10/14/2021

Verifying Compliance in Process Choreographies: Foundations, Algorithms, and Implementation

The current push towards interoperability drives companies to collaborat...
research
09/05/2017

Context Generation from Formal Specifications for C Analysis Tools

Analysis tools like abstract interpreters, symbolic execution tools and ...
research
07/19/2019

Online Set-Based Dynamic Analysis for Sound Predictive Race Detection

Predictive data race detectors find data races that exist in executions ...
research
02/05/2023

LExecutor: Learning-Guided Execution

Executing code is essential for various program analysis tasks, e.g., to...

Please sign up or login with your details

Forgot password? Click here to reset