AegisAI Perspectives · 046

How to protect AI email assistants from prompt injection

The team deploying Copilot or Gemini in the inbox owns the tool scopes per assistant type, the approval line, content isolation, logs and red team tests.

How to protect AI email assistants from prompt injection

To protect an AI email assistant from prompt injection, assume some injected emails will get through8 and limit what the assistant can reach and do, as OWASP LLM01:2025 sets out in 7 prevention strategies15. AegisAI inspects incoming mail for concealed payloads written to manipulate an inbox assistant, and acts on a message that carries one at delivery. Its post on hidden instructions in Gemini and Copilot explains that attack. Least privilege and human approval, owned by the team that deploys the assistant, limit what an injection can do; content isolation lowers the odds it works; logging and red teaming show when it did.

What you can do by the end

  • Write a scope list per assistant type that gives a read-only assistant no send tool.
  • Set the approval line: which assistant actions wait for a person, enforced in code outside the model.
  • Log every tool call against its source email and keep a regression set of injection tests.

How to protect an AI email assistant from prompt injection in eight steps

Build the controls around the assistant, because the model cannot keep instructions and email text apart. The NCSC states that current LLMs do not enforce a security boundary between instructions and data inside a prompt19. Microsoft's guidance is to design on the expectation that some attacks will succeed, since no single solution is sufficient8.

  1. Screen inbound mail before the assistant reads it.

    Microsoft Defender for Office 365 Plan 2 detects prompt injection content in inbound email before it reaches a user or an AI assistant1. Detections are filed under the High confidence phishing verdict with the detection technology value Prompt injection protection. Verify: search for that value in your email reports.

  2. Keep the assistant's own safeguards on.

    Microsoft says runtime safeguards in Copilot or another assistant remain important for attempts that depend on its instructions, permissions, grounded data or tools. In Google Workspace, Gemini applies six layered defenses12.

  3. Grant least privilege per tool.

    Give the agent only the minimal number of short-lived privileges its task needs. Scope each tool as read-only or write and to specific resources, and fail closed for any tool the policy does not know17.

  4. Drop the assistant to the sender's privilege level.

    The NCSC rule is that an LLM processing information from a party has that party's privileges, so an assistant reading external email should not have privileged tools25.

  5. Mark email text as data.

    Wrap each external message body in clear delimiters or metadata tags that label it as provided content11. Apply the same wrapper to quoted replies and attachment text. Spotlighting adds data marking and metaprompting to isolate external content7. Both lower the odds the model obeys the email; neither creates the missing boundary.

  6. Require approval for risky actions.

    Microsoft calls verifying risky actions with the user the last line of defense6. Google's user confirmation framework asks for explicit confirmation before operations such as deleting calendar events. Bind each approval to the exact action18, and run the check in code outside the model.

  7. Log every decision and tool call.

    Log prompts and model outputs, and send them to Microsoft Sentinel or another log analytics tool to find repeated injection attempts10. MITRE ATLAS lists AML.M0024 AI Telemetry Logging as a mitigation for prompt injection.

  8. Red team the assistant on a schedule.

    NIST AI 600-1 action MS-2.7-007 calls for AI red-teaming to assess resilience against attacks such as prompt injection21. Keep every attack that worked as a regression test.

Which scopes and approvals does each AI email assistant type need?

Each assistant type gets the narrowest mailbox scope and tool set its job needs, and every step up in power adds an approval. Use the table as the starting scope list for a deployment in Microsoft 365 or Google Workspace.

Assistant typeMailbox scopeTools it getsWaits for a person
Summarize and triageRead the user's own mailboxNone that write, send or shareNothing, since it cannot act
Draft repliesRead the mailbox, write to DraftsCreate draftThe user sends every draft
Sends mailRead, write drafts, send as the userSend, forwardAny send to an external address, any forward
Changes rules or filesRead, write, mailbox rules, file linksRule edit, delete, shareEvery rule change, delete or share
Acts on the calendarRead and write the user's calendarCreate, move, delete eventsEvery delete, any invite to an external address

A summarizer gets no send tool because the email it reads comes from an outside party. An assistant that sends on a person's behalf is a tool the email's author can try to steer, so each send to an external address carries an approval.

Follow one injected email through the controls

Illustrative example, figures are fictional. A 400 person firm turns on an assistant that summarizes mail and drafts replies. On one Tuesday, 3 messages arrive with hidden text telling the assistant to forward the last 20 invoices to an outside address. Inbound screening quarantines 2 of them. The third reaches a mailbox, and the assistant proposes a forward. The scope list gives a drafting assistant no forward tool, so the call fails closed and is logged with the source message id. The alert on refused tool calls fires within the hour. The security lead pulls the message and adds its text to the regression set.

Can prompt injection be fully prevented in an AI email assistant?

No. The NCSC says the best that can be hoped for is reducing the likelihood or impact of attacks20, because the model draws no boundary between instructions and data.

Screening detects injected emails before the assistant reads them. Scopes and approvals cap what one successful injection can do. Logs and tests show when a layer slipped.

Write the failure case down for each assistant. Name the worst action it can take with its current scopes. If that action is not acceptable without a person, remove the tool or add the approval.

What permissions should an AI email assistant have?

The minimum its task needs. Grant it per tool and only for a short time.

Give it read access to the user's mailbox and nothing else. Mark each tool read-only or write against named resources, and refuse any tool the policy does not list. Review the permissions the assistant's app holds in Microsoft 365 or Google Workspace, and remove any write or send scope the job does not use.

An assistant that reads mail from external senders runs at those senders' privilege level, so privileged tools stay out of its reach. Where a workflow needs both, split it in two. One assistant reads and summarizes external mail. A second acts only on instructions a signed-in user types.

Which AI assistant actions need human approval?

Any action that moves data outside the organisation or cannot be undone waits for a person. Microsoft names verifying risky actions with the user as the last line of defense. OWASP LLM01 lists human approval for high risk actions among its 7 strategies.

In an inbox, that means any send to an external address, forward, delete, shared file or link, mailbox rule change or calendar delete. Gemini already asks for explicit confirmation before operations such as deleting calendar events.

Bind the approval to the exact action, so approving a reply to one colleague does not also approve an attachment the model added. Enforce it in code outside the model, because the model itself enforces no boundary between instructions and data. Show the person the recipients and arguments the tool will receive as raw values.

How do you test an AI assistant for prompt injection?

Run red-team tests against every channel the assistant reads, and keep the attacks as a regression set. NIST AI 600-1 action MS-2.7-007 calls for AI red-teaming against attacks such as prompt injection. OWASP's seventh strategy is adversarial testing and attack simulation.

Cover the message body, hidden HTML text, quoted replies in long threads and attachment text. NIST describes indirect injection as prompts placed in data likely to be retrieved22, and every one of those parts is retrieved.

Write each test as an email plus the action it tries to trigger. Record whether screening, the scope list or the approval step stopped it. A test passes only when the attempted action never runs. Re-run the set after every model, prompt or tool change.

How do attackers exploit AI email assistants through prompt injection?

They write instructions into an email and wait for the assistant to read it. NIST defines indirect prompt injection as adversaries exploiting LLM-integrated applications by injecting prompts into data likely to be retrieved. An inbox is that data, and the same inbox also receives AI-written phishing lures.

OWASP's Scenario #5 records one case in an LLM-powered email assistant, CVE-2024-518416.

The AegisAI post linked in the opening describes how AegisAI inspects incoming mail for concealed payloads aimed at inbox assistants.

How to measure it in 30 days

Track three numbers from logs the assistant and the mail platform already keep.

  • Refused tool calls per week, from the assistant's tool call log. A rise points at an injection campaign or at a scope set too tight.
  • Approval decline rate: approvals a person rejected, divided by approvals asked for, from the approval service's records. Each decline is a candidate regression test.
  • Prompt injection detections: messages with the detection technology value Prompt injection protection in Defender for Office 365, or the matching alert in Microsoft Sentinel.

Questions people ask

Does Microsoft Defender for Office 365 detect prompt injection in email?

Yes. Defender for Office 365 Plan 2 detects prompt injection content in inbound email before it reaches a user or an AI assistant, and files it under High confidence phishing. Microsoft says runtime safeguards in the assistant remain important next to it.

Where does inbound email screening fit?

It is the first layer. AegisAI keeps hidden regions of the email body in scope, so an instruction written for Gemini or Copilot is judged before either assistant sees it. Scopes and approvals then limit what any message that still gets through can do.

Can a Google Workspace admin configure Gemini's prompt injection defenses?

No. Google lists six layered defenses for Gemini, from content classifiers to a user confirmation framework. The controls a Workspace team owns are the assistant's scopes, approvals, logs and tests.

How do you protect AI email assistants from prompt injection in one sentence?

Assume some injected emails will reach the assistant, then cap the damage with least privilege and approval before risky actions, and keep logs plus red team tests.

Do delimiters stop prompt injection?

No. Delimiters and metadata tags make the model less likely to treat email text as instructions. They do not create a security boundary, which current models lack. Use them together with scopes and approvals.

What should an AI email assistant log?

For every action, log the source message id and the tool called. Add its arguments, the outcome, plus the approver. OWASP says to log every agent decision and tool call along with its outcome. Microsoft points to Microsoft Sentinel or another log analytics tool to find repeated injection attempts.

Sources

  1. OWASP Gen AI Security Project, LLM01:2025 Prompt Injection
  2. OWASP Cheat Sheet Series, AI Agent Security Cheat Sheet
  3. UK NCSC, Prompt injection is not SQL injection
  4. NIST AI 600-1, Generative Artificial Intelligence Profile
  5. Microsoft Learn, Prompt injection protection in Defender for Office 365
  6. Microsoft Learn, Defend against indirect prompt injection attacks
  7. Microsoft Learn, Prompt injection (direct and indirect) in the AI attack techniques catalog
  8. Google Workspace Admin Help, Indirect prompt injections & Google's layered defense strategy for Gemini
  9. AegisAI, The Inbox Has a Second Reader: Prompt Injection in Gemini and Copilot

Recent posts

Every email, investigated.