The application discloses a
microcontroller unit (MCU)
firmware grey box fuzzing test method. The method first establishes a high-fidelity
peripheral simulator in a
simulation execution environment, the
peripheral simulator including
peripheral registers, internal states and state machines, and determines the interrupt line enable state by jointly monitoring the global interrupt controller register and the peripheral interrupt
control register to realize the controlled triggering of the peripheral interrupt. Secondly, the time when the
firmware or DMA reads the peripheral data register is determined as an input consumption point during
firmware execution, an incremental snapshot containing the
processor register state, the peripheral state and the memory
dirty page information is saved at the input consumption point, and only the input data that has not been read is mutated after the snapshot is restored. Finally, the
test input is divided into
multiple input streams corresponding to different peripherals or data registers, a probability distribution is constructed according to the
access frequency of each input
stream, and the input
stream to be mutated is selected, so that the path exploration efficiency and the
vulnerability discovery capability of the fuzzing test are improved.