Abstract
Testing modern cloud services is challenging due to the stateful nature and strict input requirements of REST APIs. Traditional fuzzing methods often fail to penetrate deep application logic, reaching a "coverage plateau." Pythia is a novel fuzzer that combines grammar-based parsing with deep learning-driven mutations and coverage-guided feedback. By using a sequence-to-sequence (seq2seq) autoencoder to learn latent representations of valid API requests, Pythia generates syntactically valid yet diverse test cases. Evaluation on production-scale services like GitLab and Mastodon revealed 29 new bugs, demonstrating Pythia's effectiveness in discovering complex vulnerabilities and outperforming state-of-the-art tools.
Introduction
Modern web applications are built on REST APIs that require highly structured inputs (e.g., JSON) and maintain complex internal states. Traditional "blackbox" fuzzers struggle with these requirements, often producing invalid requests that are rejected by the API's initial parser. While grammar-based fuzzers like RESTler improve upon this by using API specifications, they often rely on static dictionaries, leading to limited exploration of the input space. Pythia addresses these issues by learning the "validity envelope" of an API from existing traffic and using code-coverage feedback to guide its search for new, interesting code paths.
System Architecture
Pythia's workflow is organized into a continuous feedback loop consisting of three main phases: parsing, learning-based mutation, and execution.
- Parsing with Regular Grammars: Pythia takes valid API request sequences (seeds) and parses them into Abstract Syntax Trees (ASTs). This transforms raw HTTP traffic into a structured format that preserves the relationships between different parts of the request.
- Learning-Based Mutation: This is the core of Pythia. A seq2seq autoencoder is trained on the ASTs to learn their latent representation. To generate new tests, Pythia injects Gaussian noise into this latent space. The decoder then transforms the noisy vector back into a request that is syntactically valid but contains unexpected values.
- Coverage-Guided Feedback: Pythia monitors the target service's source code to track executed basic blocks. It uses this information to prioritize "interesting" seeds—those that reach previously unvisited code—for further mutation, preventing the fuzzer from wasting resources on redundant tests.
Key Insights: Navigating the Validity Envelope
By mutating in the latent space of an autoencoder rather than at the raw text level, Pythia ensures that its generated requests stay within the "envelope" of what the API considers valid. This allows the fuzzer to bypass simple input validation and trigger deep semantic bugs. Unlike random tree mutations, the neural network learns which parts of a request are "fuzzable" and which are critical dependencies, allowing it to escape the coverage plateaus encountered by traditional tools.
Evaluation and Results
The authors evaluated Pythia on three major open-source cloud services: GitLab, Mastodon, and Spree. The fuzzer was initialized with seed test cases from RESTler after it had reached its own coverage plateau.
Bug Discovery
Pythia discovered 29 new bugs across the tested services. Most were "500 Internal Server Errors" caused by unhandled exceptions, such as improper handling of malformed URI characters or invalid UTF-8 sequences in database queries. As shown in the example above, Pythia can generate complex sequences of requests where a specific malformed value in a later request triggers a server-side crash.
Performance and Efficiency
Pythia consistently outperformed baselines, including RESTler and random mutation strategies. In the GitLab "Commits" API, Pythia covered over 400 more lines of code than the initial seed set. The "seed distillation" approach was found to be essential for navigating the massive state space of REST APIs efficiently.
Conclusion
Pythia represents a significant step forward in REST API fuzzing by integrating deep learning with grammar-based testing and coverage feedback. Its ability to learn and explore the latent space of valid API requests allows it to find complex bugs that evade traditional tools. Future work will focus on improving hyperparameter tuning and expanding the system's ability to generate entirely new request sequences from scratch.
Summary updated