This prompt is designed for security testers and AppSec engineers who need to systematically probe whether an API gateway or Web Application Firewall (WAF) can be bypassed. The core job-to-be-done is generating a diverse set of obfuscated attack payloads and protocol-level manipulation scenarios that test the detection logic, not just the signature database. The ideal user has a working knowledge of HTTP, understands the target's expected positive-security model, and has a safe, authorized testing environment. The required context includes the target endpoint, the expected normal request structure, and the specific security control being tested (e.g., SQLi detection, path traversal blocking).
Prompt
API Gateway and WAF Evasion Test Prompt

When to Use This Prompt
Defines the specific job, ideal user, and critical constraints for the API Gateway and WAF Evasion Test Prompt.
You should use this prompt when you need to move beyond running a standard vulnerability scanner and want to create repeatable, evidence-based test cases for specific evasion techniques. This includes testing how the gateway handles URL encoding variations, Unicode normalization, HTTP parameter pollution, header injection, and content-type manipulation. It is not a replacement for a full penetration test or a generic 'fuzz the endpoint' instruction. The prompt's value is in its structured approach to generating payload variants and defining the expected 'block' vs. 'pass' behavior for each, creating a clear, auditable test oracle. A critical constraint is that this prompt must never be used against production systems without explicit authorization and a rollback plan.
Do not use this prompt if you lack a way to observe the backend application's response or the WAF's decision logs. The primary failure mode is a false negative—where a payload bypasses the gateway and reaches the backend, but you cannot confirm the evasion because you only see a generic 200 OK response from the gateway itself. Without backend logs or a canary endpoint, you are testing blindly. Before using this prompt, ensure your test harness can distinguish between a request blocked by the WAF (e.g., a 403 status code with a specific error page) and a request that was passed through but handled safely by the application. The next step is to prepare your target request template and define the specific evasion categories you want to investigate.
Use Case Fit
Where the API Gateway and WAF Evasion Test Prompt works, where it fails, and what you must have in place before running it.
Good Fit: Obfuscated Payload Generation
Use when: you need to generate encoding, casing, and protocol-level variants of known attack payloads to test WAF rule effectiveness. Guardrail: always pair generated payloads with an expected block/pass oracle so you can measure false negatives.
Bad Fit: Zero-Day Discovery
Avoid when: the goal is to discover novel vulnerability classes or exploit chains. This prompt remixes known evasion techniques; it does not invent new attack primitives. Guardrail: use this for regression and coverage testing, not for original vulnerability research.
Required Input: Baseline Payloads and Expected Behavior
Requirement: you must supply a set of known-blocked payloads and the expected WAF/Gateway response per payload. Without a baseline, you cannot distinguish a bypass from a misconfigured rule. Guardrail: validate your baseline against a controlled environment before running evasion variants.
Operational Risk: Production WAF Impact
Risk: running evasion tests against production gateways can trigger rate limiting, IP blacklisting, or incident response alerts. Guardrail: always target staging or isolated test environments with prior notice to SOC and platform teams. Never test against production without explicit approval and a rollback plan.
Operational Risk: Log Absence and False Negatives
Risk: if WAF logs are unavailable or sampled, a pass-through may look like a bypass when the rule actually fired but wasn't recorded. Guardrail: instrument both the WAF decision log and the upstream application response before declaring a bypass. Correlate timestamps and request IDs across layers.
Bad Fit: Uninstrumented Black-Box Targets
Avoid when: you have no visibility into whether the WAF inspected the request, dropped it, or passed it through. Without instrumentation, evasion test results are ambiguous. Guardrail: require access to WAF decision headers, block-page content, or upstream application logs before running the prompt.
Copy-Ready Prompt Template
A reusable prompt template for generating API Gateway and WAF evasion test cases with obfuscated payloads and expected block-vs-pass behavior.
This prompt template is designed to generate a structured set of test cases that probe the resilience of an API Gateway and Web Application Firewall (WAF) against evasion techniques. It takes a target endpoint, a known malicious payload, and a set of evasion tactics as input. The model's job is to systematically apply these tactics to produce obfuscated payload variants, predict whether each variant should be blocked or passed by a correctly configured defense, and specify the exact detection criteria. Use this template when you need to move beyond running a standard vulnerability scanner and want to understand the specific encoding or protocol-level blind spots in your defensive stack.
textYou are a senior application security engineer designing evasion test cases for a Web Application Firewall (WAF) and API Gateway. Your task is to generate a detailed test plan based on the provided inputs. For each evasion technique, you will create one or more obfuscated payload variants of the [BASE_PAYLOAD]. You will then predict the expected behavior of a correctly configured WAF/API Gateway and define the pass/fail criteria for the test. ## INPUTS - **Target Endpoint:** [TARGET_ENDPOINT] - **HTTP Method:** [HTTP_METHOD] - **Base Malicious Payload:** [BASE_PAYLOAD] - **Attack Type:** [ATTACK_TYPE] (e.g., SQLi, XSS, Command Injection) - **Evasion Techniques to Test:** [EVASION_TECHNIQUES_LIST] - **Expected Normal Response (Block):** [BLOCK_INDICATOR] (e.g., HTTP 403, 406, custom error page body text) - **Expected Normal Response (Pass):** [PASS_INDICATOR] (e.g., HTTP 200, 404, expected data returned) - **Output Schema:** [OUTPUT_SCHEMA] - **Constraints:** [CONSTRAINTS] ## INSTRUCTIONS For each evasion technique in [EVASION_TECHNIQUES_LIST], perform the following steps: 1. **Obfuscate:** Apply the technique to the [BASE_PAYLOAD] to create one or more variant payloads. 2. **Predict:** Determine if a well-tuned WAF/API Gateway should block or pass the obfuscated variant. Explain your reasoning based on how the defense parses the request. 3. **Define Detection:** Specify the exact indicator that will determine if the test passed or failed in a real-world test (e.g., HTTP status code, response body content, connection reset). ## OUTPUT FORMAT Output your results as a JSON array of test case objects, strictly conforming to the provided [OUTPUT_SCHEMA]. Do not include any text outside the JSON structure. ## CONSTRAINTS - [CONSTRAINTS]
To adapt this template, replace the square-bracket placeholders with concrete values for your specific test scenario. The [EVASION_TECHNIQUES_LIST] should be a detailed list of tactics, such as "URL-encoding a single quote," "double URL-encoding the payload," "using Unicode normalization (NFKD) on a slash," or "inserting an HTTP header with a mixed-case Content-Type." The [OUTPUT_SCHEMA] placeholder is critical for automation; provide a strict JSON schema that defines the expected fields for each test case, such as test_case_id, technique_applied, obfuscated_payload, expected_behavior (block/pass), reasoning, and detection_criteria. The [CONSTRAINTS] field is where you add crucial safety and scope rules, such as "Do not generate test cases for HTTP Parameter Pollution (HPP) on this specific endpoint" or "All generated payloads must be URL-safe."
Before executing any generated test case against a live environment, you must implement a validation harness that parses the model's JSON output and checks it against the provided [OUTPUT_SCHEMA]. A common failure mode is the model generating a valid-looking test case but with a payload that doesn't actually contain the obfuscated attack string, leading to a false negative in your security assessment. Your harness should include a pre-flight check that verifies the obfuscated_payload field is not identical to the [BASE_PAYLOAD] and contains the core malicious syntax in some form. For high-risk production testing, always route the generated test plan through a human review queue to confirm the safety and accuracy of the predicted block/pass behavior before any request is sent.
Prompt Variables
Inputs the API Gateway and WAF Evasion Test Prompt needs to produce reliable, reproducible test cases. Each placeholder must be resolved before the prompt is sent; unresolved placeholders will cause the model to guess, producing unreliable test scenarios.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TARGET_ENDPOINT] | The base URL and path of the API endpoint under test. Defines the attack surface. | Must be a valid URL. Parse with a URL constructor. Reject if scheme is not https unless internal test environment is explicitly allowed. | |
[AUTH_CONTEXT] | Describes the authentication mechanism and test credentials or token scopes available to the tester. | Bearer token with user-level scope; no admin claims. Refresh token available. | Must not contain production credentials. Validate that tokens are test-only. If null, prompt must generate unauthenticated test cases only. |
[WAF_OR_GATEWAY_TYPE] | The specific technology stack of the gateway or WAF being tested. Drives payload selection and bypass technique relevance. | AWS WAF with Core Rule Set 3.2; CloudFront distribution in front | Must be a recognized product name or 'Unknown'. If 'Unknown', the prompt must include a broader set of encoding and obfuscation techniques and flag lower confidence in expected block behavior. |
[PROTECTED_RESOURCE] | The specific resource, action, or data the attacker would gain by evading the WAF. Focuses the test on impact. | Access to PII fields in the user profile response: email, phone, SSN last 4 | Must be a concrete field name, action, or resource path. Reject vague inputs like 'sensitive data'. This drives the success criteria for the test case. |
[KNOWN_BLOCK_SIGNATURES] | A list of payloads or patterns already known to be blocked by the target WAF. Used as a baseline to measure evasion success. | ['<script>alert(1)</script>', '1 OR 1=1', '../../../etc/passwd'] | Must be a valid JSON array of strings. If empty, the prompt must generate a discovery phase before evasion. Validate array length; warn if more than 20 signatures are provided as it may constrain novelty. |
[EVASION_TECHNIQUES] | A specific list of obfuscation or evasion technique categories to test. Constrains the prompt to a focused test plan. | ['Unicode normalization', 'Header injection', 'HTTP method override', 'Content-Type mismatch'] | Must be a valid JSON array of strings. Validate against an allowed list of technique categories. Reject unknown techniques to prevent prompt injection via this field. |
[OUTPUT_SCHEMA] | The exact JSON schema each test case must conform to. Ensures the output is machine-readable for the test harness. | See output-contract table for full schema definition. | Must be a valid JSON Schema object. Validate with a schema validator before passing to the prompt. Reject if schema does not include required fields: test_id, payload, expected_result. |
Implementation Harness Notes
How to wire the evasion test prompt into a repeatable security testing harness with validation, safety checks, and evidence capture.
This prompt is designed to be called programmatically from a security testing pipeline, not used as a one-off chat interaction. The harness must supply a structured [TARGET_DEFINITION] containing the API endpoint, expected WAF/gateway technology, and the specific security control under test. Because the prompt generates active attack payloads, the harness must enforce a pre-flight safety check that confirms the target environment is a designated test/staging system and not a production endpoint. Implement this as a mandatory boolean flag (production_safety_confirmed: false) that blocks execution unless explicitly overridden with a justification log entry.
The recommended integration pattern is a three-stage pipeline: (1) Generation — call the LLM with the prompt template, target definition, and evasion technique list to produce a batch of obfuscated payload variants and expected block/pass behavior. (2) Validation — before any payload is sent, run a schema validator against the output to ensure every test case includes the required fields: payload, encoding_stack, expected_waf_behavior, and detection_indicators. Reject and re-prompt any test case missing the expected_waf_behavior field, as this is critical for downstream pass/fail evaluation. (3) Execution and Evidence Capture — send each payload through a proxy (such as Burp Suite, mitmproxy, or a custom requests-based harness) and capture the actual HTTP response status, headers, and body. Log the raw response alongside the expected behavior for later comparison. Never execute payloads without a proxy layer that records full request/response pairs; WAF logs alone are insufficient for diagnosing false negatives.
For model choice, prefer models with strong instruction-following and structured output capabilities (GPT-4o, Claude 3.5 Sonnet, or equivalent). Set temperature to 0.2–0.4 to balance payload diversity against format reliability. If the model produces duplicate payloads across a batch, increase temperature slightly or add a [CONSTRAINTS] clause requiring uniqueness. Implement a retry loop with a maximum of 3 attempts: if validation fails, feed the validation error message back into the prompt as additional context and request a corrected output. After 3 failures, log the batch for human review and halt execution for that target. This prevents the harness from silently dropping test cases that the model cannot format correctly.
The most dangerous failure mode is a false negative — the WAF passes a malicious payload that should have been blocked, and the test harness marks it as 'expected pass' due to a misconfigured expectation. Mitigate this by requiring a human review gate for any test case where the actual WAF behavior diverges from the expected behavior. Flag these cases in a review queue with the payload, encoding stack, expected vs. actual response, and a suggested reclassification. Additionally, implement a coverage check after each run: verify that every evasion technique listed in [EVASION_TECHNIQUES] produced at least one test case. If a technique (e.g., Unicode normalization bypass) generated zero payloads, re-prompt with that technique isolated and a higher temperature.
Finally, treat the prompt output as evidence artifacts for audit and regression. Store each generated test case with a unique ID, timestamp, model version, and the full prompt context. When the WAF or gateway is upgraded, re-run the same test cases to detect regressions in blocking behavior. Wire the harness into your CI/CD pipeline as a gated security check that runs after infrastructure changes but before production deployment. Avoid running this prompt against third-party APIs or endpoints you do not own — the generated payloads are active attack attempts, and unauthorized testing may violate terms of service or applicable laws.
Expected Output Contract
Fields, types, and validation rules for each test case generated by the API Gateway and WAF Evasion Test Prompt. Use this contract to parse, validate, and store outputs before executing tests.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
test_id | string (slug) | Must match pattern ^EVADE-[0-9]{4}$ and be unique within the batch | |
evasion_category | enum string | Must be one of: encoding_obfuscation, header_manipulation, protocol_level, http_method_mutation, content_type_spoofing, path_traversal, parameter_pollution | |
target_rule_type | string | Must reference a known WAF rule class (e.g., SQLi, XSS, RCE) or 'generic_block'. Null allowed only if testing default deny behavior. | |
raw_payload | string | Must be non-empty. Length must not exceed 8192 characters. Must be the exact payload before any encoding is applied. | |
obfuscated_request | object (HTTP request fragment) | Must contain method, path, headers (object), and body (string or null). Headers must include the evasion-modified fields. Schema validation required. | |
expected_waf_behavior | enum string | Must be one of: block, pass, rate_limit, log_only, challenge. If 'pass', a risk_justification field must be populated. | |
false_negative_risk | enum string | Must be one of: low, medium, high, critical. If 'high' or 'critical', a human_review_required flag must be set to true. | |
evidence_capture_instructions | string | Must specify which response headers, status codes, or body patterns indicate success. Must include a fallback check if WAF logs are unavailable. |
Common Failure Modes
API gateway and WAF evasion tests fail silently, often because the test itself is malformed or the detection signal is unreliable. These cards cover the most common failure modes and how to guard against them.
False Negatives from Log Silence
What to watch: The WAF or gateway returns a 200 OK, but no access or block log is generated. The test is recorded as 'bypassed' when the payload was actually ignored, truncated, or routed to a default backend. Guardrail: Always pair evasion tests with a positive control payload that is known to be blocked. If the positive control is not logged, the logging pipeline itself is broken and all negative results for that test run are invalid.
Encoding Normalization Before Inspection
What to watch: The application framework or an intermediate proxy normalizes the obfuscated payload (e.g., URL-decoding, Unicode normalization) before it reaches the WAF, causing the WAF to see a clean payload while the backend receives the attack. Guardrail: Include a canary endpoint on the target that echoes back the exact parameter value received. Compare the echoed value against the sent payload to detect normalization before designing the evasion test.
Header Injection vs. Header Override
What to watch: The test attempts to spoof an X-Forwarded-For or X-Real-IP header, but the gateway appends rather than overrides, or the test uses a header name that differs from the gateway's trusted header list. Guardrail: Document the gateway's exact trusted proxy header configuration before generating test cases. Each test case must specify the header name, the injection position, and the expected behavior (override vs. append) based on the gateway's documented logic.
Protocol-Level Bypass Without Backend Reachability
What to watch: The test sends an HTTP/2 downgrade, a chunked transfer encoding trick, or a request smuggling payload, but the backend server or load balancer terminates the connection differently than expected, causing a false pass or a 5xx error mistaken for a block. Guardrail: Run protocol-level tests against a staging environment that mirrors the production hop-by-hop architecture. Log the raw request and response at both the gateway and the backend to confirm the payload survived each hop.
Rate-Limiting Confused with Blocking
What to watch: The WAF rate-limits the test traffic instead of blocking the malicious payload, returning a 429 Too Many Requests. The tester misinterprets the 429 as a successful security block. Guardrail: Each test case must distinguish between a security block (403, 406, or a WAF-specific block page) and a rate-limit response (429 with a Retry-After header). Test scripts should assert the response status code and body pattern explicitly, not just 'non-200'.
Stale WAF Rule Set During Testing
What to watch: The test suite was designed against a known rule set version, but the WAF has since been updated, or the test environment runs a different rule set than production. Evasion tests that pass in staging may fail in production, or vice versa. Guardrail: Tag each test case with the WAF rule set version it was validated against. Include a pre-flight check that queries the WAF's current rule set version and compares it to the expected version before executing the evasion suite.
Evaluation Rubric
Use this rubric to evaluate the quality and safety of generated API Gateway and WAF evasion test cases before executing them or integrating them into a CI/CD pipeline. Each criterion targets a specific failure mode common to security test generation.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Payload Obfuscation Diversity | Generated payloads include at least three distinct encoding or obfuscation techniques (e.g., URL encoding, double encoding, Unicode normalization) for the same base attack vector. | All payload variants use the same encoding method or rely on a single bypass technique. | Manual review of the [OBFUSCATED_PAYLOADS] array to count unique encoding types. |
Expected Behavior Specification | Each test case explicitly states whether the WAF/Gateway should BLOCK, PASS, or LOG the request, with a justification tied to a specific rule or configuration. | Test cases contain ambiguous expected outcomes like 'see what happens' or lack a clear block/pass assertion. | Parse the [EXPECTED_BEHAVIOR] field for each test case and validate it contains a BLOCK, PASS, or LOG keyword. |
False-Negative Risk Assessment | The prompt output includes a [FALSE_NEGATIVE_RISK] flag for each test case where WAF logs might be unavailable, with a recommended alternative detection method. | No mention of observability gaps or alternative detection when the target environment lacks WAF log access. | Check for the presence of the [FALSE_NEGATIVE_RISK] boolean and a non-empty [ALTERNATIVE_DETECTION] string when the flag is true. |
Protocol-Level Attack Coverage | Test cases cover at least two protocol-level tricks (e.g., HTTP request smuggling, header injection, parameter pollution) in addition to payload-based attacks. | All generated test cases focus only on modifying the request body payload without manipulating HTTP headers or request line. | Count the distinct attack categories in the [ATTACK_VECTOR] field across the generated test suite. |
Safe Testing Precondition | Each test case includes a [SAFETY_CHECK] step that verifies the target endpoint is a designated test environment and not a production system. | Test cases lack any pre-flight environment check and could be executed directly against production APIs. | Scan the [PRECONDITIONS] array for each test case to confirm it contains an environment verification step. |
Reproducibility of Steps | Test case steps are specific enough that a junior security tester could execute them without additional research, including exact headers, payloads, and tools. | Steps contain vague instructions like 'try to bypass the WAF' without specifying the exact curl command or request structure. | Validate that the [STEPS] array contains concrete, executable commands or structured request definitions, not natural language suggestions. |
Control Validation Logic | The expected response includes specific HTTP status codes, response body patterns, or header checks that confirm the security control worked as intended. | Expected results only check for a generic 'access denied' message without validating the specific control mechanism. | Parse the [EXPECTED_RESPONSE] schema and confirm it includes at least one of: status code, response header check, or body regex pattern. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single target endpoint and a small set of evasion techniques. Remove the [OUTPUT_SCHEMA] requirement and ask for a plain list of payload variants with expected block/pass behavior. Replace [TARGET_SPEC] with a simple curl command or URL.
Watch for
- Overly broad instructions that generate payloads without specific encoding steps
- Missing detection criteria—prototype outputs often describe intent but not how to confirm bypass
- No distinction between WAF block and upstream application rejection

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us