Invisible text in Gmail: how a contact form hijacks your AI summary
Trace hidden email instructions from contact form to AI summary. Screen the submitted context, escape HTML, and authorize any resulting replies or tool actions.
Key points
Email and contact-form text can carry instructions that redirect an AI summary. Whether hidden HTML reaches the model depends on your rendering and extraction pipeline. Screen the submitted content before forwarding it, check later inbox context before inference, and authorize replies or tool actions separately.
Your contact form can deliver attacker-written instructions to an inbox summarizer. The illustrative submission below asks the AI to replace an order summary with a false security warning. That outcome depends on what your backend sends and what the summarizer receives.
A changed summary and an unauthorized refund are different failures. Test the summary for invented instructions, and require server authorization before an inbox assistant sends a reply or triggers a business action.
Quick Facts
The attack, in four sentences
An attacker can place hidden instructions in a submitted field. If the backend renders that HTML in an email and the summarizer retains its text, the payload reaches the model. A successful attempt changes the summary away from the authorized order question.
This is an indirect injection when the instruction arrives inside content the AI was asked to read. A link or attachment is not required for that entry path.
What do the email disclosures establish?
A form, forwarded email or CRM note can become an external context source. Trace the fields your assistant actually reads. The cited disclosures establish specific research outcomes; they do not certify current Gmail, Copilot or Apple Mail behavior.
The cited research reports specific email-context outcomes:
- July 2025: Mozilla's 0din program published Marco Figueroa’s account of a researcher submission demonstrating Gmail Gemini prompt injection, hiding instructions in email HTML that Gemini summarized.
- CVE-2025-32711 (“EchoLeak”): the Microsoft-sourced NVD record describes AI command injection allowing unauthorized information disclosure over a network. Microsoft’s CNA CVSS 3.1 score is 9.3; NVD’s own score is 7.5.
0din’s demonstration required the recipient to request an email summary. That user trigger is part of the reported attack path.
EchoLeak concerns information disclosure in M365 Copilot. The published case study describes the crafted-email exfiltration path. That is a different outcome from the false-summary warning in 0din’s July 2025 demonstration.
What the attack looks like
The following illustrative field includes HTML intended to hide its instruction. It is not a transcript of a current Gmail or Copilot test. Check whether your backend preserves, escapes or removes the markup before the AI reads it.
A backend that escapes this field sends visible literal markup rather than a hidden HTML block. A parser can also strip styles or retain text in a different way. Test the final email representation and the model’s actual summary; the malicious wording alone does not prove success.
Screen the accepted submission before forwarding it
The route factory below accepts exactly four string fields, assembles their labeled content and screens it before sending mail. Supply a trusted IP resolver and a mail adapter that treats the checked string as plain text or escapes it before rendering. Recheck later inbox context at its model handoff.
A false verdict returns 403 without sending mail. HTTP failures, invalid JSON or a non-boolean verdict return 503. A valid true verdict forwards the same checked context. The prevention guide covers additional model handoffs.
What SafePrompt covers
SafePrompt screens the submitted instruction attempts. Your server enforces the result before mail delivery or inference. Rate limits and authenticated action permissions remain part of the application.
| What happens at your form | SafePrompt | Your job |
|---|---|---|
| Hidden zero-size or white-on-white instructions in a field | Screen the submitted attempt | |
| Injection split across name, subject, and message | Screen the assembled submission | |
| One IP firing thousands of submissions | Application rate limits | |
| Spam flooding the form with valid-looking entries | Rate limiting | |
| The AI inbox tool acting on a summary automatically | Human-in-the-loop on actions |
A detector miss must still face your record and action permissions. An assistant should not turn a summary into a refund or credential disclosure without an authorized operation.
What do HTML handling and content moderation cover?
Escape user markup when producing email HTML and inspect your extraction path. Pattern rules cover their matched phrases; test reworded variants to find their limits. OpenAI moderation reports harmful-content categories. A content-policy verdict is a separate signal from whether an instruction redirected your app’s task.
The three-question test for your forms
- Does any form on your site get emailed to an inbox a person or AI reads? That is the attack surface.
- Would a hidden zero-size instruction in a field reach that inbox today? Inspect the actual forwarded content.
- Can your inbox AI take an action on a summary without a human? That part is on you to gate.
Run an ordinary order inquiry through the same route as the attack. The ordinary case should send mail and summarize correctly. The attack test fails if the summary invents the warning or triggers an unauthorized action, regardless of its screening verdict.
Wire SafePrompt in first
Inspect a submitted-text verdict in the playground, then test the actual email pipeline. The free plan includes 10,000 validations a month with no card; Starter is $29/mo.
References
- Mozilla 0din: Phishing for Gemini (Gmail prompt injection disclosure, Marco Figueroa), July 2025.
- CVE-2025-32711 (EchoLeak), Microsoft 365 Copilot information disclosure, NIST NVD, 2025.
- Mitigating prompt injection attacks, Google, June 2025.