Overview
The Metlo CLI includes a fuzzing capability that automatically tests your API endpoints for common vulnerabilities like SQL injection and XSS by injecting attack payloads into request parameters.Command
Options
The hostname to run fuzz tests against (e.g.,
api.example.com)Print detailed test errors and response information
Path to a
.env file containing environment variables for test executionSet individual environment variables (can be used multiple times). Format:
--env KEY=valueHow It Works
- Fetch Endpoints: The CLI fetches all endpoints for the specified host from your Metlo backend
- Generate Attack Tests: For each endpoint, it generates tests using attack payloads:
SQLI_TIME- Time-based SQL injection payloadsXSS- Cross-site scripting payloads
- Inject Payloads: Attack payloads are injected into:
- Query parameters (first parameter)
- Form data (first field)
- JSON body (first key)
- Detect Vulnerabilities: Tests check if the response time is abnormal (>1000ms for SQL injection) which may indicate successful exploitation
Examples
Basic fuzz testing:Attack Payloads
The fuzzer uses theATTACK_PAYLOAD variable which is substituted with different attack vectors:
SQL Injection (Time-Based)
Payloads designed to cause database delays:- Tests if the database executes injected SQL commands
- Monitors response time to detect successful injection
- Fails if response takes longer than 1000ms
XSS (Cross-Site Scripting)
Payloads designed to inject scripts:- Tests if user input is reflected without proper encoding
- Checks if script tags can be injected
Test Generation
For each endpoint, the fuzzer generates a test with:Output
Running tests:Interpreting Results
Slow Response Times
If a SQL injection test fails (response > 1000ms), it may indicate:- Potential SQL Injection: The database executed the injected SQL delay command
- Slow Endpoint: The endpoint is naturally slow (check verbose output)
- Network Issues: Temporary network latency
Test Failures
Any test failure should be investigated:- Review the attack payload that was injected
- Check the response time and content
- Verify input validation and sanitization in your code
- Consider using parameterized queries and output encoding
Limitations
- Injection Points: Only tests the first parameter/field in queries, forms, and JSON bodies
- Attack Types: Currently supports SQL injection (time-based) and XSS payloads
- False Positives: Slow endpoints may trigger false positives for SQL injection
- Authentication: Requires valid credentials in environment variables
Best Practices
- Run Regularly: Include fuzz testing in your CI/CD pipeline
- Use Staging: Run against staging environments, not production
- Review Results: Always investigate failures, even potential false positives
- Combine Approaches: Use fuzz testing alongside other security testing methods
- Set Environment Variables: Use
--envfilefor authentication tokens and API keys
Exit Codes
- Exit code 0: All fuzz tests passed (no vulnerabilities detected)
- Exit code 1: One or more tests failed (potential vulnerability)