Fuzzing
What is it?
API Fuzzing is a dynamic security testing technique that sends malformed, unexpected, or random inputs to API endpoints to uncover vulnerabilities, crashes, and logic flaws.
Unlike signature-based testing, fuzzing explores unknown attack surfaces by systematically mutating input data and observing how the API behaves under abnormal conditions.
Fuzzing is particularly effective at identifying:
- Input validation weaknesses
- Parsing and deserialization issues
- Unhandled exceptions
- Memory or resource handling flaws
- Hidden or undocumented behaviors
What are specific examples?
- Sending malformed JSON or invalid data structures
- Injecting unexpected data types (e.g., string instead of integer)
- Boundary value testing (very large or negative inputs)
- Overlong strings or deeply nested objects
- Invalid encoding formats (UTF-8, base64 anomalies)
- Missing required fields or adding unexpected parameters
Test case FAQs
When is this test case applicable?
- All API endpoints accepting user-controlled input
- Endpoints with complex schemas or nested payloads
- APIs handling file uploads, parsing, or transformations
- High-risk areas such as authentication, search, or filters
How does it work?
Prerequisites
- API schema (OpenAPI/Swagger) or inferred parameter structure
- Baseline valid requests for mutation
- Optional fixtures for valid data contexts
Test sequence
- Generate a baseline valid request
- Apply input mutations:
- Data type changes
- Boundary values
- Malformed structures
- Randomized payloads
- Send mutated requests across all parameters:
- Query
- Path
- Headers
- Body
- Monitor responses for anomalies:
- Server errors (
5xx) - Unexpected success responses
- Crashes or timeouts
- Inconsistent validation behavior
- Server errors (
- Correlate findings across multiple payload variations
Success/Failure indications
-
Failure (vulnerable):
- API crashes or returns
5xxerrors - Unhandled exceptions or stack traces exposed
- Unexpected acceptance of malformed input
- Inconsistent validation across similar inputs
- API crashes or returns
-
Success (secure):
- Invalid inputs consistently rejected (
4xx) - Errors handled gracefully without leaking internal details
- Strict schema enforcement across all parameters
- Invalid inputs consistently rejected (
What is the solution?
- Enforce strict input validation and schema checks
- Use strong typing and validation libraries
- Implement centralized error handling
- Avoid exposing internal error messages or stack traces
- Apply limits on input size, depth, and complexity
- Continuously fuzz APIs in CI/CD pipelines