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.

Jul 31, 2025 - 12:49
Updated: 
103.6k

Generative AI & LLMs in AI & Data · Explainer

AI in Cybersecurity, AI Security & Governance, Cyber Threats, Scams & Online Safety

Man-in-the-Prompt Attack: How Browser Extensions Tamper With AI

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?

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-PromptPrompt injection
WhereUser's browserContent the model processes
Who actsMalicious extensionAttacker-written text in documents, pages or emails
Main defenceExtension control, clean profilesInput isolation, limited tool permissions
OWASP LLM referenceSensitive information disclosureLLM01 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?

  1. Remove extensions you do not use; fewer is safer.
  2. Use a separate browser profile with no extensions for banking and AI work.
  3. Never paste passwords, keys or personal data into AI chats.
  4. 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

A browser extension reading or altering prompts and answers on AI chat pages, as described by LayerX in 2025.

No. The attack happens in the user’s browser through an extension.

LayerX reported its proof of concept did not need special permissions to access the page.

Prompt injection hides instructions in content the model reads; this attack manipulates the page in your browser.

Any browser-based AI chat can be affected, since the risk lies in extension access to web pages.

Block extensions by default on managed browsers and allow only reviewed ones.

Remove unused extensions, use a clean profile for sensitive work and keep secrets out of prompts.

Yes, if it is sold or its developer account is compromised and it receives a harmful update.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.