Stop Rogue Tool Calls Before They Land: Zenity Brings Inline Prevention to Amazon Bedrock AgentCore

G
Gilad Shahar
•

In Inside the Agent Stack: Securing Agents in Amazon Bedrock AgentCore, we showed how a single MCP server registered on a shared AgentCore Gateway can exfiltrate a CFO's financial data and poison an agent's long-term memory. We outlined five layers of defense: visibility, risk assessment, threat detection, automatic response and inline prevention.

In this post we zoom in on the last layer. Zenity stops a malicious tool call at the AgentCore Gateway before the target runs, using Boundaries, the same policy engine security teams already use to detect and block agent risk on every platform Zenity covers.

We cover where enforcement sits in AgentCore, how it plays out against a real attack (an injected MCP tool that drives an agent to delete Salesforce records), and the controls you can enforce with Boundaries at the gateway.

Why the Tool Call Is the Moment That Matters

An agent with legitimate access to a tool can still be steered into misusing it. Prompt injection rarely needs to escalate privileges. It borrows the ones the agent already holds: a delete permission granted for cleanup, an export tool granted for reporting, an email action granted for follow-ups.

Amazon Bedrock AgentCore makes this easy to set up and hard to contain. Gateway turns APIs, Lambda functions and remote MCP servers into tools that any connected agent discovers at runtime, with no code change or redeployment. One new target on a shared gateway reaches every agent behind it. Its tool descriptions and responses land directly in the model's context.

Logs record the delete within minutes, after the records are gone. AWS's native controls each see part of the picture: IAM scopes what an agent's role can reach, Bedrock Guardrails screen content, and AgentCore Policy enforces hard limits on gateway requests. None of them knows the agent's posture, its relationships, or what it has already done in the session.

Zenity complements these controls with a security context layer none of them holds on its own: the agent's inventory and relationships, its posture, the user it acts for, and the history of gateway activity in the session, backed by intent analysis. Boundaries enforce on each tool call before the target executes, and every decision is tied back to that context.

How Zenity Enforces at the AgentCore Gateway

Zenity sits on the one path every gateway tool call already takes. AgentCore Gateway can invoke a Lambda interceptor before it forwards a request to a target and again before it returns the response. Zenity's interceptor sends each tool call to the Zenity Evaluate API, which checks it against the organization's Boundaries and returns allow or block.

content image
  • Policy lives outside the agent. Security writes a Boundary once in Zenity. Developers ship no SDK, no wrapper and no code change.
  • Every tool call, every agent behind the gateway. The REQUEST interceptor evaluates each tool call before the target runs, including tools that agents discover at runtime. The RESPONSE interceptor sends Zenity what comes back from the tool, so Boundaries also run on tool results and detect a prompt injection or sensitive data in the response, which can serve downstream in a later tool request in the session.

In Practice: Stopping an Injected Mass Delete

A CFO's assistant on AgentCore reads Salesforce leads through a shared gateway. Someone adds a new MCP server to that gateway. Its tool carries a hidden instruction, and when the agent calls it, the tool's response tells the agent to delete three leads.

content image

The attack, and where it stops

Security has one Boundary in place, Block mass destructive action. It forbids any delete-style tool call that targets three or more records, and it lives in Zenity, outside the agent's code.

content image

When the agent sends deleteMultipleRecords with three Lead IDs, the gateway asks Zenity for a verdict. The Boundary matches, and the gateway returns an error instead of calling Salesforce. The finding lands in Zenity marked Prevented, with the blocked request as evidence.

content image

Nothing was deleted. The same rule keeps running on every tool call through that gateway, for every agent behind it.

What You Can Enforce With Boundaries at the Gateway

AgentCore's flexibility shapes its risks, and each one maps to a Boundary that runs at the gateway.

  • Shared gateways, tools discovered at runtime. One gateway serves many agents, and a newly registered target is live for all of them with no redeploy. A Boundary that allows MCP calls only to servers in {{approved_mcp_servers}} turns a rogue target into a dead end the moment it appears, for every agent behind the gateway.
  • Existing APIs turned into tools. Gateway exposes Lambda functions, REST APIs and SaaS connectors such as Salesforce as agent tools, often with bulk write operations. A mass-destructive Boundary, the one in the demo, caps the damage a single hijacked call can do.
  • Outbound targets as exfiltration paths. Email, Slack, webhook and HTTP targets let an agent send data out. Boundaries block calls whose arguments point to a domain in {{denied_domains}} or carry a confidential project codename.

Each rule starts in Detect, with replay against the agent's recorded activity, and moves to Prevent once the matches look right.

Full-session context, out of band. Zenity also evaluates the full AgentCore session from telemetry: every user prompt, agent response, tool call and result. Taints, scanners and intent analysis catch multi-step attacks, such as sensitive data read in one step and sent out in another, and those findings land in the same incident as the inline block.

More Than a Checkpoint at the Gateway

A gateway interceptor is a place to enforce. What makes the verdict right is everything Zenity already knows about the agent behind the call.

  • Prevention is part of the agent's full picture. Zenity inventories AgentCore agents, gateways, targets, memory, workload identities and Cognito users, and maps them into one graph. A blocked call is tied to that graph and to the agent's posture violations, findings and incidents, so the SOC sees why it mattered, not just that it happened.
  • Readable, auditable decisions. Zedar extends Cedar, the open policy language behind AgentCore Policy, with agent semantics: the acting agent, the user it acts for, taints and scanner signals. Every block traces to a rule a reviewer can read.
  • Posture closes the door first. An allowlist of approved MCP servers flags a rogue target like hubspot-mcp as soon as it is registered. Automatic playbooks can remove it from the gateway, and the risk never reaches runtime.
  • One policy model across agent platforms. The same Boundaries govern agents in Microsoft Copilot Studio and Foundry, Cursor, Anthropic Claude suite, and other platforms Zenity secures. AgentCore becomes one more place the organization's AI agent policy is enforced, not a separate rule set to maintain.

Zenity works alongside AWS controls. IAM scopes what an agent can reach, Bedrock Guardrails screen content, and AgentCore Policy holds hard limits per gateway. Zenity adds the security context across all of them. With Zenity Boundaries on the AgentCore Gateway, your agents keep their autonomy, and the risky tool calls never land.

All Articles

Secure Your Agents

We’d love to chat with you about how your team can secure and govern AI Agents everywhere.

Get a Demo