Red Teaming an Internal AI Agent Through Prompt Injection and Social Engineering

block · Finance · 2024 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Internal AI agent red teaming and enterprise endpoint security

Block needed to test whether goose, an internal AI agent with MCP integrations and a developer shell tool, could be turned into an initial-access vector before the tool was open sourced and more widely targeted.

Constraints:

Architecture

Block's offensive security team ran Operation Palefire as an end-to-end red-team exercise. They first targeted Google Calendar MCP by hiding zero-width Unicode prompt injection in calendar invites so goose would ingest it and invoke its developer shell. When calendar context, model variance, and rate limits made the attack unreliable, they pivoted to goose recipes: shareable workflows whose base64 JSON can customize system and user prompts. The successful campaign used a legitimate-looking RTL recipe bug report to get a goose developer to execute a poisoned recipe, triggering an infostealer simulation that existing controls detected.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  A["Malicious calendar invite"] --> B["Google Calendar MCP"]
  B --> C["Internal MCP marketplace"]
  C --> D["goose agent"]
  E["Invisible Unicode payload"] --> A
  E --> F["Recipe URL"]
  F --> G["Recipe runner"]
  G --> D
  D --> H["Developer shell tool"]
  H --> I["Attacker server"]
  H --> J["Employee laptop"]
  J --> K["Detection and response controls"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
goose agent Internal AI agent used by technical and non-technical Block employees. Developer shell tool, Internal MCP marketplace, Recipe runner
Developer shell tool Built-in tool that runs bash commands and created the execution path. goose agent, Attacker server, Employee laptop
Internal MCP marketplace Catalog of integrations such as Google Calendar, Google Drive, and Jira. goose agent, Google Calendar MCP
Google Calendar MCP MCP extension that brought external calendar invite content into goose context. Internal MCP marketplace, Malicious calendar invite
Malicious calendar invite External invite carrying invisible zero-width prompt injection and later a recipe link. Google Calendar MCP, Recipe URL
Invisible Unicode payload Zero-width encoded prompt injection invisible to users but interpreted by goose. Malicious calendar invite, Recipe URL
Recipe URL Shareable goose workflow link containing base64 JSON with hidden prompt instructions. Malicious calendar invite, Recipe runner, Invisible Unicode payload
Recipe runner goose feature that loads recipe instructions and prompts into a session. Recipe URL, goose agent
Attacker server Red-team server hosting the simulated infostealer payload. Developer shell tool
Employee laptop Target endpoint where the payload executed and was detected. Developer shell tool, Detection and response controls
Detection and response controls Blue-team monitoring and controls that detected the infostealer-like activity. Employee laptop

Data flow

The red team surveyed Block's internal MCP marketplace for extensions that could put attacker-controlled text into goose's context. They sent external calendar invites with hidden zero-width prompt injections; if a user asked goose about the calendar, Google Calendar MCP would fetch the event, inject the hidden text into context, and ask goose to run a curl-to-bash developer-shell command. After the calendar path failed, a poisoned recipe URL loaded hidden instructions into goose's system prompt; a targeted developer-support pretext led an employee to run it, the payload contacted the attacker server, and detection controls caught the simulated infostealer activity.

3 supporting quotes
“We surveyed the uh various MCPs on the marketplace just to get a feel for what people might be using.”transcript, stated
“if users ask Goose, "Hey, Goose, what's on my calendar today?" Goose would use the Google calendar MCP”transcript, stated
“The curl was reaching out to our attacker server and and pulling something. That something was an info stealer.”transcript, stated

Why this architecture

The operation attacked goose through realistic enterprise paths rather than toy prompt-injection demos: MCP marketplace integrations, calendar invites, recipe sharing, and shell execution. That made it possible to test whether AI-specific context poisoning could be operationalized into the same endpoint compromise and detection workflow Block uses for traditional red-team operations.

3 supporting quotes
“we were more curious what a full endtoend operation looks like where if you started outside the company”transcript, stated
“we wanted to operationalize a novel prompt injection attack. And I really want to emphasize the word operationalize.”transcript, stated
“We were just trying to get execution on a block laptop. So no real lateral movements outside of like that initial access point.”transcript, stated

Models used: Claude Sonnet 3.5 · Claude Sonnet 3.7 · GPT models

Scale

Alternatives considered (roads not taken)

Calendar-based user prompt injection

Rejected because: It was stealthy but unreliable because calendar context filled the model window, model behavior varied, and the payload had not been tested realistically.

“the update kind of added a lot more context into the context window which was making it fill up really quickly.”transcript, stated
“some models are more resistant to our prompt injection than others.”transcript, stated

Recipe-based system prompt injection

Rejected because: This became the preferred path because recipes allowed injection into the system prompt and gave the payload more influence than user-context injection.

“we decided to actually pivot to campaign 2 with the mindset that we were looking for a system prompt injection”transcript, stated
“recipes allowed us to inject into the system prompt.”transcript, stated

Broad meeting/invite-based recipe campaign

Rejected because: It produced engagement but a typo and rate limits kept it from producing the desired payload execution quickly.

“we unfortunately had a typo in one of our scripts. So, always check your scripts for typos.”transcript, stated
“We were however being hampered down by a rate limit from Google Calendar.”transcript, stated

Patterns

safety-policy-enforcement (security)

Block turned the red-team findings into controls: stripping non-standard Unicode, showing recipe contents before execution, prompt-injection detection, command allowlisting, and calendar policy changes.

“we ended up stripping like the non-standard unicode characters that kind of goes in that can go in via goose input and from recipes itself.”transcript, stated
“we made it so that the recipe content is like thoroughly shown to the user before they execute it.”transcript, stated

tool-use-orchestration (architecture)

The risk and the exploit both depend on goose's tool integrations, especially MCPs and the developer shell tool.

“it automatically ships with a developer shell tool call which in essence runs bash commands.”transcript, stated
“goose can integrate with these MCPs to perform various tasks.”transcript, stated

guardrails-io-filtering (security)

The remediation filtered hidden Unicode and added prompt-injection detection around agent inputs and shell commands.

“we built some like actual detections. We've been playing with like prompt injection detection systems.”transcript, stated
“We also built like this bad bash command detector which is like a B engram classifier”transcript, stated

observability-tracing (operations)

The operation used existing detection controls, logs, and a later purple-team review to identify and improve signals for AI-borne attacks.

“We have a really good detection and response team. They are always on the hunt for malicious activity in the block environment.”transcript, stated
“one of the most interesting things was in the logs, funny enough.”transcript, stated

Tradeoffs

Payload delivery channel

Chose calendar invites and recipes over ordinary email phishing.

Rationale: Calendar invites looked less scrutinized than email and could feed untrusted text into goose through the Google Calendar MCP.

“we felt like calendar didn't get that much scrutiny usually.”transcript, stated
“Fishing is so common now, but like invites are less so.”transcript, stated

Prompt-injection placement

Chose system-prompt injection via recipes over user-context injection via calendar events.

Rationale: System-prompt injection gave the payload more influence and more available context than a calendar event inside user context.

“it doesn't have as much influence as like a system prompt injection would”transcript, stated
“it's injected at a point where maybe there's more context available.”transcript, stated

Post-red-team mitigations

Chose multiple controls across Unicode filtering, recipe transparency, detection, allowlisting, and calendar policy over a single prompt-injection detector.

Rationale: The team acknowledged detector false positives/noise and treated mitigation as layered rather than one-size-fits-all.

“there's a lot of false positives, right? And and too much noise is going to make it impossible to to really deep dive”transcript, stated
“we've worked to do some command allow listing just because you know not everyone needs all the bash commands you would ever need.”transcript, stated

Gotchas (what bit them)

Prompt injections that worked in test did not reliably work in realistic calendars.

Root cause: The test accounts had only two or three events, while real calendars had much denser context windows that diluted the malicious invite.

Resolution: The team identified the need for a realistic automated test harness across models and versions.

“we kind of didn't test in a realistic context window.”transcript, stated
“We also should have built a testing harness. We should have had something automated that tested across all all models, all versions.”transcript, stated

Universal prompt injection was not reliable across model choices.

Root cause: The payload was tuned for Sonnet 3.5, while users could run Sonnet 3.7 or GPT models.

Resolution: The campaign pivoted toward system-prompt injection through recipes for stronger influence.

“Ours was very much tuned for Sonnet 35. And so, if people are running 3-7 or GBT4, like it just wouldn't really work.”transcript, stated
“we felt like it would more reliably get the outcome we wanted.”transcript, stated

A tiny script typo broke an otherwise successful social-engineering campaign.

Root cause: goose fixed the typo in testing but not consistently in production.

Resolution: The team kept the same approach, fixed the bug, and switched to a more targeted phishing vector.

“we unfortunately had a typo in one of our scripts. So, always check your scripts for typos.”transcript, stated
“Goose was actually fixing our typo. When we were testing, it realized, oh, you're you have a typo here. I'll fix this for you.”transcript, stated

Hidden Unicode appeared in logs but required special detection to notice.

Root cause: Zero-width characters were not human-visible in the invite but surfaced as odd characters in logs.

Resolution: Block added detection for those characters and continued work on prompt-injection detection.

“the logs actually like kind of did it. They would show up as like weird characters in the in the logs.”transcript, stated
“hunting for prompt injections as a whole is a tricky subject.”transcript, stated

Evaluation

Block evaluated the attack by running staged red-team campaigns, observing whether goose executed the payload, monitoring attacker-server callbacks, and then relying on detection/response controls and follow-up purple-team analysis to evaluate what signals could have caught the activity.

Metrics: Execution on a Block laptop was the operation objective · Google Calendar campaign limited to roughly 50 invites per day · Calendar context test accounts had two or three events while real calendars had eight to ten · Existing controls eventually caught the simulated infostealer activity

3 supporting quotes
“We were just trying to get execution on a block laptop.”transcript, stated
“We could only send I think like 50 invites a day.”transcript, stated
“we were caught eventually.”transcript, stated

Outcomes

This was an internal red-team exercise with a narrow objective: endpoint execution through goose, not a production benchmark across many organizations.

3 supporting quotes
“And when they were trying to work with us and assist us as part of their workflow, they actually ended up running the recipe.”transcript, stated
“So this went this kicked off and it it ran for a bit but we were caught eventually.”transcript, stated
“The advantage of this also is we can now do email scanning, right?”transcript, stated