Man-in-the-Prompt Attack: How Browser Extensions Tamper With AI
Man-in-the-Prompt is the name browser security firm LayerX gave in 2025 to attacks where a malicious or compromised browser extension reads, alters or injects prompts on AI chat pages such as ChatGPT and Gemini. It works because the chat runs as an ordinary web page whose content extensions can access; LayerX's proof of concept needed no special permissions. The model is not hacked.
Topic: Generative AI & LLMs in AI & Data · Explainer
Also covers: AI in Cybersecurity, AI Security & Governance, Cyber Threats, Scams & Online Safety
Quick answer: Man-in-the-Prompt is the name browser security firm LayerX gave in 2025 to attacks where a malicious or compromised browser extension reads, alters or injects prompts on AI chat pages such as ChatGPT and Gemini. It works because the chat runs as an ordinary web page whose content extensions can access; LayerX's proof of concept needed no special permissions. The model is not hacked. The fix is browser hygiene: fewer extensions, an enterprise allowlist, separate browser profiles for sensitive work, and keeping secrets out of prompts.
Key takeaways
- The attack lives in the browser, not in the AI model.
- Extensions can read prompts, answers and chat history displayed in the page.
- An extension could silently query an AI tool and send results elsewhere.
- It differs from prompt injection, which hides instructions in content the model reads.
- Organisations should allowlist extensions on managed browsers.
Table of Contents
- What Did the Research Show?
- Why Is It Possible?
- How Is It Different From Prompt Injection?
- Who Is at Risk?
- How Do Organisations Defend Against It?
- What Should Individuals Do?
- References
What Did the Research Show?
According to LayerX's write-up, published 29 July 2025 and now hosted by Akamai, which later acquired LayerX, and SecurityWeek's coverage, a proof-of-concept extension could open a background tab, submit a query to ChatGPT, send the answer to an external server and delete the chat from history. LayerX reported testing several popular assistants and disclosed a Gemini-related case to Google.
Why Is It Possible?
Content scripts in extensions run inside the web pages you visit and can access the page's Document Object Model (DOM). The prompt box and answers on an AI chat page are DOM elements. A simplified view of what any content script with access to a page can do:
// illustrative only: reading what a page shows to the user
const box = document.querySelector("textarea, [contenteditable='true']");
console.log("prompt text visible to the extension:", box && box.innerText);
This is normal extension behaviour, which is why choosing extensions carefully matters.
How Is It Different From Prompt Injection?
| Man-in-the-Prompt | Prompt injection | |
|---|---|---|
| Where | User's browser | Content the model processes |
| Who acts | Malicious extension | Attacker-written text in documents, pages or emails |
| Main defence | Extension control, clean profiles | Input isolation, limited tool permissions |
| OWASP LLM reference | Sensitive information disclosure | LLM01 Prompt injection |
See the OWASP Top 10 for LLM Applications and our guide to prompt injection.
Who Is at Risk?
- Employees who paste code, contracts or customer data into AI chats.
- Internal AI tools trained on company data that are reached through the browser.
- Anyone who installs extensions that later change owner and receive a malicious update.
How Do Organisations Defend Against It?
On managed Chrome, block all extensions by default and allow only approved IDs. An example policy file for Linux (/etc/opt/chrome/policies/managed/extensions.json):
{
"ExtensionInstallBlocklist": ["*"],
"ExtensionInstallAllowlist": [
"aeblfdkhhhdcdjpifhhbdiojplfjncoa",
"cjpalhdlnbpafiamejdnhcphjbkeiagm"
]
}
Replace the IDs with the extensions your organisation has reviewed. Google documents these policies in its Chrome Enterprise help. Also review extension permissions regularly, use enterprise AI accounts with data controls, and monitor for unusual data flows from browsers.
What Should Individuals Do?
- Remove extensions you do not use; fewer is safer.
- Use a separate browser profile with no extensions for banking and AI work.
- Never paste passwords, keys or personal data into AI chats.
- Check chat history for conversations you did not start.
To build secure AI usage skills, talk to a WebAsha training advisor.
References
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0