Finding Bug-Inducing Program Environments

Zahra Mirzamomen, Marcel BöhmearXiv 2023 · DOI

Abstract

Traditional fuzzing techniques primarily focus on program inputs, often overlooking the critical role of the external environment—such as configuration files, databases, and system resources—in triggering vulnerabilities. This paper presents AFLChaos, a coverage-guided fuzzer designed to automatically synthesize bug-inducing environments. By intercepting system calls and mutating external resources accessed during execution, AFLChaos uncovers "environment-dependent" bugs that traditional input-only fuzzers miss. Evaluation on seven major open-source projects demonstrates that AFLChaos discovers 13 new bugs and significantly improves code coverage, notably achieving a 167.6% increase in Dnsmasq.

Introduction

Most automated bug-finding tools operate under the assumption that malformed user inputs are the primary drivers of software failures. However, complex software systems, particularly servers, are deeply intertwined with their external environments. A program might process a malicious network packet correctly but crash when encountering a corrupted configuration file or an unexpected database state.

The primary challenge in fuzzing the environment is its sheer scale. Attempting to capture and mutate the entire state of a virtual machine is computationally expensive and introduces significant "noise"—mutations that do not influence program behavior. AFLChaos addresses this by efficiently identifying and mutating only the specific environmental states that impact program execution.

Methodology: AFLChaos Architecture

AFLChaos is built upon the AFLNet network fuzzer and introduces a dual-component architecture consisting of a runtime for system call interception and a fuzzer for environment seed management.

System Call Interception and Capture

Using LD_PRELOAD, AFLChaos intercepts resource-related system calls (e.g., open, read). This allows the tool to monitor exactly which external resources a program accesses. In Capture Mode, the tool records these resources to create an "initial environment seed."

Fuzzing and Mutation

In Fuzzing Mode, the runtime provides mutated versions of resources whenever the program attempts to access them. The fuzzer manages an "environment corpus" alongside the standard input corpus.

The overall architecture of AFLChaos, showing the interaction between the fuzzer process and the program runtime via shared memory.

The mutation strategy employs three primary operators: fuzzing the contents of a specific resource, switching a resource with a version known to increase coverage, and switching the program input while maintaining a mutated environment. This approach treats the environment as a "first-class seed," allowing for structured, fine-grained mutations rather than treating the environment as an opaque blob.

Evaluation

The effectiveness of AFLChaos was evaluated using ProFuzzBench, focusing on seven widely-used open-source server projects: DCMTK, Dnsmasq, Kamailio, Live555, OpenSSH, OpenSSL, and PureFtpd. These subjects were chosen for their heavy reliance on external configurations and resources.

Key Results

AFLChaos demonstrated a clear advantage over the baseline input fuzzer, AFLNet.

  • Bug Discovery: AFLChaos identified 13 previously unknown bugs across five projects. Notably, AFLNet failed to find any of these bugs, as they were only reachable through environment-specific mutations.
  • Coverage Gains: AFLChaos achieved an average of 7% higher branch coverage than the baseline. The most dramatic improvement was seen in Dnsmasq, where coverage increased by 167.6%.
Mean branch coverage over 24 hours. AFLChaos (solid line) consistently outperforms the baseline AFLNet (dotted line) across all subjects.

Discussion and Limitations

A key insight from this work is the "Everything is a File" philosophy. By focusing on file-system-related system calls, AFLChaos can capture a vast array of environmental factors, from configuration files to device handles. Furthermore, the synergy between input and environment fuzzing allows the tool to discover new code paths that subsequently reveal new parts of the environment to fuzz.

However, the approach is not without limitations. Intercepting system calls and managing environment states introduces performance overhead. In some cases, such as OpenSSH, execution speed dropped significantly due to "hangs" where corrupted environments caused the program to wait indefinitely for connections. Future work will focus on expanding the scope of intercepted resources and improving triage efficiency for the discovered bugs.

Conclusion

AFLChaos demonstrates that the program environment is a fertile ground for vulnerability discovery. By elevating the environment to a first-class citizen in the fuzzing process, security researchers can uncover deep-seated bugs that remain hidden from traditional input-focused tools.

Summary updated

BibTeX
@misc{mirzamomen2023finding,
  author = {Zahra Mirzamomen and Marcel Böhme},
  title = {{Finding Bug-Inducing Program Environments}},
  year = {2023},
  eprint = {2304.10044},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.10044},
}
Figure