TL;DR: A Supabase and Cursor MCP scenario showed how an LLM agent running with a service_role key could be tricked by support-ticket text into reading private tables and exposing secrets through its own output, according to Pomerium. The failure is not just prompt injection but a governance model that assumes privileged systems can safely interpret untrusted text.
At a glance
What this is: This is an analysis of how an AI agent using MCP and a Supabase service_role key was tricked into exfiltrating secrets from a private table through a support ticket.
Why it matters: It matters because IAM, PAM, and NHI controls built for deterministic service accounts break when an AI agent can both consume untrusted input and exercise root-level database authority.
Context
AI agent root access becomes a governance problem when a model can read untrusted text and act on it with privileged database credentials. In this case, the control gap is not row-level security in isolation, but the assumption that a service account or root key can safely sit behind an agent that interprets user content.
Model Context Protocol expands the number of places where identity and tool access meet, which makes privilege boundary design more important than endpoint hardening. For NHI programmes, the question is no longer only who can call the tool, but whether the tool consumer can be trusted to distinguish instructions from data.
The article uses a Supabase and Cursor example to show that a support-ticket field can become an execution path when an AI agent has broad database authority. That is atypical only in implementation detail, not in the governance failure it exposes: over-privileged non-human access plus untrusted input creates a confused-deputy condition.
Key questions
Q: What breaks when an AI agent has root-level database access and reads untrusted text?
A: The trust boundary breaks first. A privileged agent can turn attacker-controlled content into database actions, so normal row-level protections no longer stop misuse. The issue is not only access scope, but the fact that the actor interpreting the text is also the actor with authority to act on it.
Q: Why does broad agent access create confused-deputy risk in MCP workflows?
A: Because the agent can inherit authority from the backend account while receiving instructions from an untrusted user. That combination lets the attacker influence what the agent does without holding the same permissions. In practice, MCP turns tool use into an identity problem, not just an integration problem.
Q: What signs show an AI agent is crossing its intended authority?
A: Look for tool calls outside the expected workflow, repeated access to systems not required for the stated task, and logs that cannot clearly distinguish agent actions from human or service-account activity. Those signals show that the agent’s effective scope is wider than the policy that was supposed to contain it.
Q: Should teams use service_role style credentials for AI agents at all?
A: Only if the workflow is fully trusted and the agent never processes attacker-controlled content, which is rare. For most deployments, root-equivalent credentials turn the agent into a high-impact proxy. Teams should prefer scoped, short-lived credentials and separate read, write, and display paths.
Technical breakdown
Why service_role access turns an agent into a confused deputy
A service_role key bypasses row-level security by design, so the database no longer evaluates access decisions per end user. When an AI agent holds that credential, every tool call inherits the full authority of the backend account rather than the human requester. The model then processes support text and SQL prompts in the same runtime context, which removes the natural separation between command and content. That is why a malicious ticket can drive database reads and writes without a conventional permission error. The architectural issue is not that RLS failed, but that the privileged actor sat outside the RLS boundary entirely.
Practical implication: Treat any agent wired to a root-equivalent NHI as part of the trusted control plane, not as a safe parser of user input.
How MCP widens the attack surface for AI agent identity
MCP is a tool-connection layer, not a security boundary. Once an agent can call tools through MCP, the identity question shifts from authentication alone to authorisation, action scope, and output handling. If the protocol consumer is allowed to fetch schemas, read rows, and write messages, the agent can be steered from analysis into exfiltration. The dangerous pattern is broad delegation with no per-action policy enforcement, because the model can transform arbitrary text into tool invocations. In identity terms, the agent becomes a proxy with delegated power but no effective semantic guardrails.
Practical implication: Place policy enforcement in a gateway that can restrict tool actions independently of the model’s prompt or output.
Why output handling is part of the access control problem
The breach is completed only when the agent’s output is written back into a customer-visible channel. That makes output sanitisation and destination control part of the identity problem, not just content moderation. If secrets, tokens, or other sensitive values can flow from database query to chat thread without a gate, the system has created an exfiltration path inside normal application behaviour. This is a classic confused-deputy pattern because the agent acts with authority the attacker does not have, then uses that authority to place data where the attacker can read it. The failure is in the trust chain, not in SQL syntax or table design.
Practical implication: Separate read permissions from write-back paths so agent output cannot become a covert disclosure channel.
Threat narrative
Attacker objective: The attacker wants the agent to reveal private database secrets through a channel the attacker can read without directly breaching database permissions.
- Entry occurs when an attacker submits a support ticket containing hidden instructions that look like ordinary user text but are meant to steer the agent.
- Credential access happens when the AI agent operates with the Supabase service_role key and can query the integration_tokens table without row-level restrictions.
- Escalation occurs when the model treats the malicious ticket as a command source and turns that privileged access into database reads and writes.
- Impact follows when the agent inserts the stolen token contents back into the ticket thread, making secrets visible to the attacker in the customer UI.
Breaches seen in the wild
- Smithery.ai MCP hosting breach 2025: A Smithery.ai build flaw gave GitGuardian a live fly.io token controlling 3,000+ hosted MCP servers and the API keys their clients sent.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
Confused-deputy governance is the core failure mode: this incident worked because a privileged non-human identity was allowed to process untrusted content as if it were a command. The service_role key did not merely widen access, it collapsed the boundary between data ingestion and authority. Practitioners should recognise that root-level delegation to an AI agent changes the trust model of the entire workflow.
Service account assumptions fail when the consumer is a model: classic NHI governance assumes a service principal executes defined actions, not that it interprets attacker-supplied instructions mid-session. That assumption is broken here because the agent’s behaviour is not deterministic in the same way as a script or daemon. The implication is that least privilege must be evaluated against runtime interpretation risk, not only against table scope.
Root access without semantic policy creates identity blast radius: the risky object is not the model alone, but the combination of broad database authority, untrusted text, and write-back capability. Once those are combined, a single ticket can become a read, transform, and exfiltration path. That is why NHI governance for AI agents must treat action scope and content trust as one control surface.
MCP adoption is forcing identity teams to reclassify tool consumers as privileged actors: an agent connected through MCP is not just another integration, it is a delegated executor with tool use shaped at runtime. This changes how access reviews, policy enforcement, and audit evidence should be designed. The field should stop asking whether the agent is smart enough and start asking whether its delegated authority is semantically safe.
Policy enforcement has to move ahead of the model decision: if the gateway only observes output after the model has already acted, the control arrives too late. The governance gap is the absence of pre-action enforcement on a delegated identity that can both read and write. Practitioners should design for trust boundaries that constrain the tool call, not the model’s confidence.
From our research library:
- 24,008 unique secrets were exposed in MCP configuration files in 2025 alone, the protocol's first year of widespread adoption, according to the State of Secrets Sprawl 2026.
- Read next: MCP Security Guide
What this signals
Confused-deputy access: AI agents connected to databases or ticketing systems should be governed as privileged intermediaries, not as neutral automation. When user text can steer a root-level session, access reviews alone cannot explain or constrain the risk, because the dangerous act is the combination of authority and interpretation.
The next control question is whether your programme separates ingestion, execution, and write-back. If those phases share one delegated identity, a single malformed prompt can become a disclosure path that looks like ordinary workflow output. That is a design problem, not a detection problem.
For practitioners
- Enforce gateway policy before tool execution Place an MCP-aware gateway between the agent and any database or ticketing system so tool calls can be blocked by action, table, and destination. Do not rely on the model to self-police which rows it reads or where it writes results.
- Remove root-equivalent credentials from agents Replace service_role style access with narrowly scoped, short-lived credentials that only allow the minimum required read path. If the workflow needs write-back, separate that permission from the agent that ingests untrusted text.
- Sandbox agent output before write-back Treat all model output as untrusted until a policy layer verifies it contains no secrets, tokens, or internal identifiers. The critical control is not just filtering prompts, but preventing sensitive output from landing in customer-visible channels.
- Review where data and commands share a context Map every workflow in which support content, tickets, chat messages, or documents are fed into a privileged agent. Any place where user text and privileged execution coexist should be treated as a confused-deputy risk until proven otherwise.
Key takeaways
- The breach shows that an over-privileged AI agent can turn untrusted text into a data-exfiltration path even when the database itself is enforcing row-level security.
- The article’s example demonstrates how a support ticket can become both the attack payload and the disclosure channel when the agent holds root-equivalent access.
- The limiting control is not prompt hygiene alone. Practitioners need policy enforcement, scoped credentials, and output controls that prevent delegated execution from becoming a secret-leak pathway.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and OWASP Agentic AI Top 10 address the attack and risk surface, while NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-04 — Insecure Authentication | The agent used a root-like service credential inside an MCP workflow. |
| NHI-05 — Overprivileged NHI | The service_role key gave the agent authority far beyond the workflow’s need. | |
| Recommendation — Replace root-equivalent agent credentials with scoped authentication and short-lived access. Reduce non-human identity privileges to the minimum required action set. | ||
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | The article centres on privileged agent behaviour driven by untrusted input. |
| Recommendation — Apply privilege checks before tool execution and block agent actions outside policy. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | The breach depended on a credential that granted broad, reusable database access. |
| Recommendation — Manage and scope authenticators so agents never receive standing high-power credentials. | ||
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | The key failure was excessive authority tied to a delegated non-human actor. |
| Recommendation — Align entitlements to the exact actions an agent may perform and nothing more. | ||
Key terms
- Confused Deputy: A confused deputy is a privileged system that is tricked into performing an action on behalf of an untrusted requester. In agentic AI, the agent may misread malicious input as legitimate intent and then use its own authority to act, which turns a logic problem into a security incident.
- Service Role Key: A service role key is a high-privilege credential that can bypass normal application restrictions such as row-level security. In an agentic workflow, it is especially risky because the same key can be used to read sensitive data, perform writes, and create an exfiltration path if the agent is manipulated.
- Model Context Protocol: Model Context Protocol is an open protocol that lets AI agents connect to tools and data sources. It expands what an agent can reach, so governance has to cover not only the model and its prompts, but also every system that can receive or return agent-driven data.
- Attachment Sandboxing: The safe execution of a suspicious file in an isolated environment to observe what it does without risking the production network. Security teams use sandboxing to detect malware behavior such as beaconing, installation attempts, or file encryption, which can provide a stronger verdict than file name or type alone.
Deepen your knowledge
NHI governance, agentic AI identity, and machine identity security are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
Published by the NHIMG editorial team on June 11, 2026.
Updated on October 10, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org