AIFORE: Smart Fuzzing Based on Automatic Input Format Reverse Engineering

Ji Shi, Zhun Wang, Zhiyao Feng, Yang Lan, Shisong Qin, Wei You, Wei Zou, Mathias Payer, Chao ZhangUSENIX Security 2023

TL;DR

This paper introduces AIFORE, a novel system that automatically reverses input formats to guide fuzzing more effectively. By combining dynamic taint analysis, deep learning for field type classification, and a smart power scheduling algorithm, AIFORE significantly outperforms existing methods in both format recognition and bug detection, uncovering previously missed vulnerabilities.

What Problem Does This Paper Address?

Fuzzing is a powerful technique for finding software vulnerabilities, but its effectiveness heavily relies on the quality of the generated inputs. Creating high-quality inputs often requires understanding the target program's input format. Manually reverse-engineering these formats is time-consuming and error-prone, while existing automated approaches have limitations in accurately identifying field boundaries, classifying field types, and effectively utilizing this knowledge to guide fuzzing. This paper tackles these challenges by proposing a fully automated system, AIFORE, that learns input formats and uses this knowledge to enhance fuzzing efficiency and bug-finding capabilities.

Methods

AIFORE employs a three-pronged approach:

  • Field Boundary Analysis: It uses byte-level dynamic taint analysis to track which input bytes are processed by basic blocks (BBs). A minimum cluster algorithm then groups these tainted bytes into indivisible fields, treating BBs as the fundamental unit for analysis rather than individual instructions.
  • Field Type Classification: A Convolutional Neural Network (CNN) model is trained to predict the semantic type of input fields (e.g., size, enumeration, magic number, string, checksum, offset) based on how BBs process them. This goes beyond simply identifying program variable types.
  • Format-Guided Power Scheduling: A novel power scheduling algorithm is introduced to intelligently allocate fuzzing effort. It prioritizes seeds that exhibit new format variants and assigns more mutation power to formats that have been less explored, aiming to balance fuzzing across different input structures.

Datasets

The paper doesn't explicitly list a single, consolidated dataset. Instead, it describes the data used for training and evaluation:

  • Training and Validation Data: The CNN model was trained on approximately 10,582 fields from 8 different formats, using a 4:1 ratio for training and validation sets.
  • Evaluation Targets: The system was evaluated on 17 programs and 15 diverse file formats (including image, executable, compression, and compound files) and 2 network protocols. These programs were compiled with various optimization levels (-O0 to -Os) to test robustness.
  • Ground Truth: For format extraction, the authors used public format templates from the 010 Editor tool, which are written by experts and verified by the community. This ground truth was manually refined to account for program-specific parsing behavior and ambiguities.

Key Insights and Ideas

  • BBs as Semantic Units: The core idea that basic blocks (BBs) are more informative than individual instructions for understanding how input fields are processed is crucial. This allows for more robust field boundary identification.
  • Semantic Field Types are Key: Focusing on semantic field types (like "size" or "magic number") rather than just program variable types (like "int") provides more actionable information for fuzzing.
  • Deep Learning for Format Understanding: Using CNNs to learn patterns of BB processing enables accurate prediction of field types, even for unseen formats, showcasing the power of machine learning in this domain.
  • Smart Power Allocation is Critical: The power scheduling algorithm is vital for efficiently exploring diverse input formats. It prevents the fuzzer from getting stuck on one format and ensures broader coverage.
  • Format Knowledge Improves Fuzzing: The paper strongly demonstrates that understanding input formats directly leads to better code coverage and the discovery of more bugs.

Key Results

  • Field Boundary Accuracy: AIFORE achieved an average accuracy of 73.31% for field boundary recognition across various optimization levels, significantly outperforming baselines like ProFuzzer (36.27%) and TIFF-fuzzer (63.14%).
  • Field Type Accuracy: The CNN model achieved an average Top-1 accuracy of 84.26% for field type identification on unseen formats, surpassing ProFuzzer (56.60%) and AFL-Analyze (36.76%).
  • Fuzzing Performance: AIFORE demonstrated a significant improvement in code coverage, achieving an average of 6% higher BB coverage than ProFuzzer and 26% higher than WEIZZ.
  • Bug Detection: AIFORE uncovered 20 bugs in 15 programs that were missed by other fuzzers, including critical vulnerabilities like buffer overflows and NULL pointer dereferences.
  • Efficiency: AIFORE's format extraction process was significantly faster than ProFuzzer and AFL-Analyze, especially for larger input files, due to its taint analysis approach.

Limitations and Future Work

  • Reliance on Dynamic Taint Analysis: AIFORE's accuracy is dependent on how the target program parses input. If a program doesn't process certain fields or parses individual bytes separately, AIFORE might miss information or produce false positives. The authors suggest feeding the same format to multiple programs to mitigate this.
  • Byte Granularity: The current analysis operates at the byte level, limiting its ability to analyze bit-level fields or text-based inputs where keywords are the minimum unit.
  • Encrypted/Obfuscated Inputs: Analyzing encrypted or obfuscated inputs is challenging due to the lack of discernible format information.
  • Future Work: The authors suggest extending the analysis to bit-level fields and exploring techniques to handle encrypted or obfuscated inputs. They also highlight the potential for further optimization of the power scheduling algorithm.

Summary updated

BibTeX
@inproceedings{shi2023aifore,
  author = {Ji Shi and Zhun Wang and Zhiyao Feng and Yang Lan and Shisong Qin and Wei You and Wei Zou and Mathias Payer and Chao Zhang},
  title = {{AIFORE: Smart Fuzzing Based on Automatic Input Format Reverse Engineering}},
  booktitle = {USENIX Security},
  year = {2023},
  url = {https://openreview.net/forum?id=kB70eHjqHO},
}
Figure