![[Report] I Attended the Workshop on Protecting AgentCore Gateway MCP Endpoints with AWS WAF #AWSreInvent #NET321](https://devio2024-media.developers.io/image/upload/f_auto,q_auto/c_limit,w_1200/v1796287757/eyecatch/jdfzhlsdu5jd56s7rl5q.jpg)
[Report] I Attended the Workshop on Protecting AgentCore Gateway MCP Endpoints with AWS WAF #AWSreInvent #NET321
This page has been translated by machine translation. View original
Hello, this is Usuda.
Everyone, are you protecting your MCP servers? (Greeting)
This is a report on the following workshop held at AWS re:Invent 2026.
We will protect the MCP endpoint of Amazon Bedrock AgentCore Gateway by applying AWS WAF to it.
This was a workshop that introduced rules unique to MCP protection, which differ from applying WAF to ordinary web applications, as well as a unique operational approach of using an AI agent to tune the WAF rules themselves!
Session Overview
NET321-R1 | Protect MCP endpoints on Amazon Bedrock AgentCore Gateway with AWS WAF
As enterprises move generative AI agents from prototype to production, securing the Amazon Bedrock AgentCore Gateway becomes a first-class requirement - not an afterthought. In this hands-on workshop, you'll attach AWS WAF natively to a Bedrock AgentCore Gateway with no ALB, no VPC Interface Endpoint, and no Lambda proxy required, enabling managed rule groups, rate-based rules, and IP-based access controls that protect every tool behind the Gateway with a single configuration. We will launch simulated attacks and watch AWS WAF block them in real time. Finally, you'll leverage an agent that pulls signals from AWS WAF, helps you remediate threats, and generates a plain-English incident summary.
Protect MCP endpoints on Amazon Bedrock AgentCore Gateway with AWS WAF
As enterprises move generative AI agents from prototype to production, securing Amazon Bedrock AgentCore Gateway becomes a top-priority requirement that cannot be put off. In this hands-on workshop, you will natively attach AWS WAF to Bedrock AgentCore Gateway without using an ALB, a VPC interface endpoint, or a Lambda proxy. You will enable managed rule groups, rate-based rules, and IP-based access controls, protecting all the tools behind the Gateway with a single configuration. You will run simulated attacks and see AWS WAF block them in real time. Finally, you will use an agent that retrieves signals from AWS WAF, helps remediate threats, and generates an incident summary in plain language.
Report
Overall Summary
To put this workshop simply: "Attach WAF to an MCP endpoint, write rules specific to MCP, observe with Count, and then switch to Block based on evidence. And have an agent help with that decision."

The scenario is a system called PetStore: AgentCore Gateway is placed in front of its REST API (Amazon API Gateway), and each operation is exposed as an MCP tool. Participants play the security engineer, and the only thing you build is the AWS WAF part. The Gateway, authentication, Policy, and the advisor used in the second half are all prepared in advance.
We never touched the PetStore itself directly, which was a little disappointing. I couldn't see any dogs or cats.
Instead, the whole flow could be operated and experienced easily from a portal site for running the workshop, so the content was very easy to follow!
AWS WAF support for AgentCore Gateway went GA at the end of June 2026, so it is a brand-new feature. For anyone who will be publishing MCP servers, this workshop covers the issues you are about to face.
The overall mechanism is as follows. A request passes through three layers in order: WAF, token validation, and Policy. The advisor reads the WAF logs, and only changes approved by a human are applied.

The roles of the three layers are as follows. The response differs depending on which layer stopped the request, so you can isolate where it was stopped.
| Layer | Role | Response |
|---|---|---|
| AWS WAF | How much, how large, from where, and what shape | 403 (429 for rate limiting) |
| Token validation | Who, and whether the token is valid | 401 / 403 |
| Policy (Cedar) | Whether this token can call this tool | 200, with the error inside the response |
Workshop Introduction
First, there was a roughly 10-minute explanation of the background using slides.

Humans call a different URL for each page, but agents call many tools through a single URL, POST /mcp.
This is what makes protecting MCP and AI agents difficult.

In the PetStore used here, guests can call only the four read tools, while the assistant and the partner, who hold agent tokens, can also call the three write tools. deletePet is destructive, and placeOrder moves money.

There are four problems that remain even when authentication passes: saturation attacks, overuse of tools, scraping, and malformed input and sources.

You need to address them in each of the three layers: WAF, token validation, and Policy.

Each of the four problems is matched by one WAF best practice for MCP endpoints.

The lab proceeds in this order: look at the Gateway, attach WAF, write rules, send attacks, and tune with the advisor. The motto is "Count first, Block with evidence." You need to proceed step by step and in a way that fits your environment.

Risks Specific to Agent Environments
From here, I'll summarize the content that was organized in the workshop.
First, let's start with why authentication and authorization alone are not enough.
An access token tells you "who is calling," but not "what they will do afterward." Even with authentication and authorization in place, the following can happen in this environment, for example.
- Saturation attack: Massive access without tokens still reaches the Gateway
- Overuse of tools: Your own assistant loops because of a retry bug and calls
deletePet450 times per minute. All of it uses legitimate tokens - Scraping: A guest copies the entire catalog using read tools. Policy allows it
- Malformed input and sources: Things like putting an SQL-like string into a pet ID, or probing for tool names that have not been published
Compared with conventional web apps, the assumptions behind WAF change as follows.
| Aspect | Conventional Web | MCP / Agents |
|---|---|---|
| Identifying the operation | Determined by URL path and HTTP method (/login, /cart, etc.) |
There is only one URL, POST /mcp. Which tool is called is determined by the JSON-RPC body (in 2026-07-28 it is also in the Mcp-Method and Mcp-Name headers) |
| Where to inspect | Path, query string, form, cookies | Tool arguments inside the JSON body |
| Defining legitimate traffic | Inputs are highly free-form, so you often list bad patterns and block them | The server publishes its tool list and argument schemas, so you can block everything else |
| Origin of requests | Triggered by human actions, so frequency is bound by human speed | Programs decide the next call themselves. With no human involved, retries and loops continue at high frequency with a legitimate token |
| Unit of caller | Each user has a session and cookies, and IP is also a rough guide to the user | There are no sessions, and the unit for counting is the token or IP. Behind a single token or IP sits a company's entire fleet of agents |
| How errors are returned | Often returned as HTTP status (4xx) | JSON-RPC errors are returned in the body. Unknown tools and Policy denials are HTTP 200, so they don't show up in HTTP error monitoring |
| CAPTCHA / Challenge | The browser renders the page and executes scripts to solve it | Agents are not browsers and cannot solve it. The usable actions are effectively only Block and Count |
Another important point is that mistakes and attacks cannot be distinguished from the request alone. A looping assistant and a partner who shipped a buggy release are not malicious. What WAF sees is the request, not the intent.
Organizing WAF Rules for MCP
The workshop included 11 rules. Ten are imported, and one (rule 100) you write yourself.
The list of rules immediately after the import is as follows (it is 10 because rule 100 has not been written yet).

Let's organize what each one looks at.
| Priority | Action | Rule | What it looks at |
|---|---|---|---|
| 20 | Block | BlockDenyListedIps | IPs on the deny list |
| 30 | Count | AmazonIpReputation | AWS managed IP reputation list |
| 40 | Block | KnownBadInputs | AWS managed known attack patterns |
| 50 | Count | BlockUnservedCountries | Countries not served |
| 60 | Block | RateLimitPerIp | About 1,000 requests/minute from a single IP |
| 70 | Count | MCPBodySizePreflight | Body over 8KB |
| 80 | Block | RequireMCPProtocolVersion | Unexpected MCP-Protocol-Version |
| 90 | Block | BlockUnapprovedMCPTools | Anything other than published tools and methods |
| 100 | Block | RateLimitPerTokenSensitiveTools | About 10 requests/minute per token for deletePet and placeOrder |
| 110 | Count | MCPArgsInjectionSignature | Shell- or SQL-like strings in arguments |
| 120 | Count | MCPToolArgumentSchema | petId and orderId that are not numeric |
Of these, the following three felt especially MCP-specific.
- Pinning the protocol version (rule 80): Blocks if the
MCP-Protocol-Versionheader is not2026-07-28 - Blocking anything other than published tools (rule 90): Looks at the
Mcp-MethodandMcp-Nameheaders and returns 403 for anything other than the seven published tools and the necessary methods. Since an MCP server publishes its own tool list, you can build an allowlist rule that "blocks everything except the good things" instead of "listing the bad things" - Per-token rate limiting for destructive tools (rule 100): Narrows the target to two tools with
Mcp-Nameand counts using theauthorizationheader as the key. Since you can't tell them apart by IP, you count by token
There is also a policy for how to split Block and Count. Rules unlikely to cause false positives (your own deny list, the protocol version, the tools you published) are set to Block from the start. Rules where you don't yet know the real traffic (other vendors' IP lists, countries, size, regexes over free-form text) start with Count.
The contrast between rules 110 and 120 was also easy to understand. Rule 110, which is signature-based, catches '; DROP TABLE but misses 1 OR 1=1. Rule 120, which defines the shape of your own data as "petId is numeric," catches both. Defining the correct shape is stronger than enumerating attacks.
The relationship with conventional managed rules was also covered.
- Core rule set: Centered on browser-oriented inspection, and it blocks agents that don't send a User-Agent. The explanation was that if you include it, it should go in a Web ACL on the API side that is also accessed from web and mobile
- SQLi managed rule: The AWS blog this was based on does not use it, for reasons such as it also detecting legitimate SQL, and instead inspects with a custom rule that specifies the JSON path (
/params/arguments) - Be careful with Allow rules: If you write "Allow if it's a known tool," evaluation ends there and the request slips past rate limits and so on. Write it in the form "Block if not allowed"
One point to watch out for is that you hold the list of published tools in WAF as a fixed list as well. There is no mechanism to sync it automatically, so the recommended practice was to generate the rules from the approved tool list and deploy the tools and rules together. The idea is to use the maintenance effort as change management that prevents unapproved tools from being published.
Hands-on Content
I'll skip the detailed steps, but the workshop was very easy to follow. A dedicated portal is provided, and just by pressing buttons you can call tools on behalf of an agent or run attack scenarios.
The portal shows, as a path, how far a call progressed through the layers and where it stopped. For example, when a guest deletes a pet, it passes token validation and is stopped by Policy.

When you call the unpublished tool exportOrders, before the rules are added the Gateway responds with 200 saying "there is no such tool."

After the rules are added, WAF stops it with a 403 before it reaches the Gateway.

In the attack simulation, you run six scenarios. The looping assistant, the probing for nonexistent tools, and the tokenless crowd were blocked, while the two injection ones passed because they are in Count.

The reveal on the slides was interesting. The injection signature (rule 110) had recorded 8 hits, and the question posed was whether it is OK to switch it to Block as is.

Five of the eight were from the buggy release of the best partner. A pet's name simply contained a note: "Rex; drop-off Tuesday." If we had set it to Block based on the count alone, we would have silently blocked a business partner.

A Mechanism for Tuning WAF in Dialogue with an Agent
The last part was the one I found most unique in this workshop. You switch the rules that were in Count to Block while consulting an agent (the AWS WAF advisor).
The configuration is as follows. The advisor only reads the configuration and logs and makes suggestions; it has no permission to change WAF.

When you press "Ask the advisor" in the portal, the review proceeds in the following order.
- The portal's code gathers evidence from WAF logs and metrics
- The advisor reads the Web ACL rules and the evidence, and asks the log analyst (the agent that reads logs) about anything missing
- The advisor gives a verdict and a proposed change for each rule
- The log analyst verifies the claims in the proposed changes against the evidence
- The code checks that the cited evidence actually exists and checks the confidence level. Only proposals that pass become candidates for application
Progress is displayed in the portal. This time, verdicts for two rules came out in just under 3 minutes.

The verdict for the injection signature (rule 110) was "tune, don't block it yet." Since it also hit the partner's legitimate calls, it was not simply switched to Block; instead, a rule narrowed to the tools to be inspected was proposed.

When you review the diff and approve it, only that change is applied automatically while remaining in Count, and the portal reruns the scenarios and even confirms the results.
Isn't this a really great mechanism?
I wish they would offer this mechanism as a managed service (hint hint).
Impressions
This was a workshop about protecting MCP using AWS WAF.
There were many perspectives different from conventional WAF, and they were organized clearly, making for good content.
The workshop itself was easy to follow, which is a big plus! Please try it once it is released!
