Automated API fuzzer for security testing.
| 29 | |
| 30 | |
| 31 | class APIFuzzer: |
| 32 | """Automated API fuzzer for security testing.""" |
| 33 | |
| 34 | # SecLists paths for general fuzzing strings |
| 35 | SECLISTS_FUZZ_PATHS = ( |
| 36 | "Fuzzing/big-list-of-naughty-strings.txt", |
| 37 | "Fuzzing/FuzzingStrings-SkullSecurity.org.txt", |
| 38 | ) |
| 39 | |
| 40 | # Fuzz payloads by category |
| 41 | PAYLOADS = { |
| 42 | "string": [ |
| 43 | "", # Empty |
| 44 | " ", # Space |
| 45 | "null", |
| 46 | "undefined", |
| 47 | "None", |
| 48 | "true", |
| 49 | "false", |
| 50 | "0", |
| 51 | "-1", |
| 52 | "999999999999", |
| 53 | "A" * 1000, # Long string |
| 54 | "A" * 10000, # Very long string |
| 55 | "<script>alert(1)</script>", # XSS |
| 56 | "{{7*7}}", # Template injection |
| 57 | "${7*7}", # Template injection |
| 58 | "#{7*7}", # Template injection |
| 59 | "../../../etc/passwd", # Path traversal |
| 60 | "..\\..\\..\\windows\\system32\\config\\sam", |
| 61 | "%00", # Null byte |
| 62 | "%0d%0a", # CRLF |
| 63 | "\r\n", # CRLF |
| 64 | "admin'--", # SQL |
| 65 | "1; DROP TABLE users", # SQL |
| 66 | '{"$gt": ""}', # NoSQL |
| 67 | "`id`", # Command injection |
| 68 | "| ls", # Command injection |
| 69 | ], |
| 70 | "integer": [ |
| 71 | 0, |
| 72 | -1, |
| 73 | 1, |
| 74 | 2147483647, # Max int32 |
| 75 | -2147483648, # Min int32 |
| 76 | 9999999999999999, # Large number |
| 77 | 1.5, # Float as int |
| 78 | "1", # String as int |
| 79 | "abc", # Invalid |
| 80 | None, |
| 81 | ], |
| 82 | "boolean": [ |
| 83 | True, |
| 84 | False, |
| 85 | "true", |
| 86 | "false", |
| 87 | 1, |
| 88 | 0, |