TL;DR
This paper introduces CarpetFuzz, a novel system that automatically extracts constraints between program command-line options from their documentation. By leveraging NLP, CarpetFuzz identifies and filters invalid option combinations, significantly reducing the search space for fuzzing and enabling the discovery of previously unreachable code and vulnerabilities.
What Problem Does This Paper Address?
Modern software is incredibly complex, leading to vast codebases and numerous command-line options that control program behavior. Fuzzing, a popular technique for finding software vulnerabilities, often struggles to explore code paths that are only accessible through specific combinations of these options. While some fuzzers attempt to explore option combinations, they often generate many invalid ones due to a lack of understanding of option relationships (like conflicts or dependencies). This inefficiency hinders the discovery of vulnerabilities hidden behind these option-dependent code paths. Manually identifying these relationships is time-consuming and impractical for large-scale testing.
Methods
CarpetFuzz tackles this problem by employing a multi-stage approach:
- Option and Description Extraction: The system first parses program documentation (specifically the "OPTIONS" section) to extract all command-line options and their corresponding descriptions.
- Relationship Identification (R-sentence Detection): Using NLP techniques, CarpetFuzz identifies sentences within the descriptions that declare relationships between options. This involves:
- Explicitly Declared Relationships: A machine learning model, trained using active learning to minimize human labeling effort, identifies sentences that explicitly state relationships (conflict, dependency, etc.).
- Implicitly Declared Relationships: For relationships not explicitly stated, CarpetFuzz analyzes sentence structure, predicates, and objects to infer conflicts. This involves techniques like dependency parsing and constituency parsing to identify parallel structures and semantic similarities/opposites.
- Relationship Extraction: Once R-sentences are identified, CarpetFuzz extracts the concrete relationships (conflict, dependency) and the specific options involved. This uses dependency trees and finite state machines (FSMs) to model the semantic meaning of keywords, modals, and negations.
- Combination Filtering and Prioritization:
- Filtering: All possible option combinations are generated, and then invalid ones (those violating identified constraints) are filtered out.
- Pruning: To further reduce the combinatorial explosion, N-wise testing (specifically 6-wise) is applied to the valid combinations.
- Prioritization: The remaining valid combinations are prioritized based on their potential to increase code coverage during a dry run, aiming to explore more critical paths first.
- Fuzzing: The prioritized, valid option combinations are then fed to a fuzzer (like AFL) to guide the fuzzing process.
Datasets
- Training Data: A small, manually labeled dataset was created using active learning on sentences extracted from Linux manpages.
- Evaluation Data: The system was evaluated on the documentation of 20 popular, real-world open-source programs. These programs cover various input file types (image, certificate, text, etc.) and are actively maintained. The paper also mentions using the POWER benchmark for comparison.
Key Insights and Ideas
- Documentation as a Goldmine: The paper highlights that valuable, structured information about program behavior and option interactions is often embedded within seemingly unstructured natural language documentation.
- Implicit Relationships are Crucial: Many important option relationships, particularly conflicts, are not explicitly stated but can be inferred through linguistic analysis of sentence structure and semantics.
- Combinatorial Explosion is a Major Bottleneck: The sheer number of possible option combinations is a significant barrier to thorough fuzzing, and simply mutating options randomly is inefficient.
- NLP for Practical Fuzzing: CarpetFuzz demonstrates that advanced NLP techniques can be effectively applied to solve a practical problem in software security, bridging the gap between human-readable documentation and machine-executable fuzzing strategies.
- Vulnerabilities Hidden in Plain Sight: The discovery of numerous vulnerabilities, many of which require specific, non-obvious option combinations, underscores the importance of this approach.
Key Results
- High Accuracy: CarpetFuzz achieved 96.10% precision and 88.85% recall in extracting relationships from documentation. For implicitly declared relationships, precision was 95.87% and recall was 90.09%.
- Significant Combination Reduction: The system reduced the number of option combinations to be tested by an average of 67.91%.
- Improved Fuzzing Performance: CarpetFuzz helped AFL discover 45.97% more code paths that other fuzzers could not reach.
- Vulnerability Discovery: CarpetFuzz discovered 57 unique crashes, including 43 undisclosed (0-day) vulnerabilities, with 30 of these receiving CVE IDs.
- Comparison to POWER: CarpetFuzz found 1.71 times more unique crashes than the state-of-the-art option configuration fuzzer POWER on its benchmark.
Limitations and Future Work
- NLP Model Limitations: The accuracy of the NLP model is dependent on the underlying parsers (spaCy, NLTK, AllenNLP), which can struggle with complex sentences or domain-specific terms, leading to some false negatives.
- Lack of Common Sense: The system sometimes misses relationships that require human common sense (e.g., understanding that "horizontal" and "vertical" dimensions are distinct but related). The authors suggest incorporating a common-sense knowledge graph.
- Linux-Centric: CarpetFuzz is currently implemented for Linux systems. Extending it to support other operating systems with different command-line conventions (e.g., Windows) is a future direction.
- Crash-Based Detection: Like AFL, CarpetFuzz primarily focuses on finding vulnerabilities that cause crashes. Integrating with sanitizers (like TSan, UBSan) could expand its detection capabilities to non-crash vulnerabilities.
- Option Position Constraints: The current system does not handle constraints related to the specific position of an option in the command line.
- Option Names: While descriptions are used, incorporating analysis of option names themselves could further improve relationship identification.
Summary updated