The advances in AI pose new security threats. The phenomenon of MCP prompt hijacking represents a concerning vulnerability, threatening the integrity of systems. Protecting data and connections becomes essential. The interconnection of AI tools exposes businesses to unprecedented risks, requiring increased vigilance. Protocols like MCP are revealing exploitable flaws. Technology leaders must reassess their strategies to counter this emerging threat.
MCP Prompt Hijacking and Its Implications
Security experts at JFrog recently highlighted a major threat known as prompt hijacking. This vulnerability exploits communication weaknesses between artificial intelligence systems using the Model Context Protocol (MCP). While companies seek to integrate their data and tools to optimize AI efficiency, they often overlook the new security risks associated with these connections.
The Security Risks Associated with MCP
AI models, whether hosted on platforms like Google and Amazon or run on local devices, face a fundamental problem. These systems have no knowledge of real-time events. Their understanding is limited to the data they have been trained on. The MCP, developed by Anthropic, was designed to address this gap, allowing AI to access local data and online services securely.
However, JFrog’s research reveals that a certain usage of the MCP presents a prompt hijacking vulnerability, turning this AI tool into a genuine security nightmare. For example, a programmer asking an AI assistant to recommend a Python library for image processing might be provided with a fraudulent tool due to a flaw in the oatpp-mcp system. This poses a serious threat to the software supply chain.
How Prompt Hijacking Works
This type of attack alters the communication of the system using the MCP rather than affecting the artificial intelligence itself. The vulnerability lies within the configuration of the Oat++ system in C++, which connects various programs to the MCP standard. The downside is in managing connections through server-sent events (SSE).
When a real user connects, the server assigns a session ID. The flawed method uses the device’s memory address as the ID, contradicting the specificity of IDs meant to be unique and cryptographically secure. This faulty design exploits the frequent reuse of memory addresses by computers.
Exploitation of the Vulnerability
An attacker could in this case create and close numerous sessions to record predictable session IDs. Once a valid ID is obtained, the attacker could send malicious requests to the server. The server, unable to differentiate between the legitimate user and the attacker, returns harmful responses to the actual connected user. Programs, although only accepting certain responses, can be manipulated by multiple messages until a response is validated.
Required Security Measures
This discovery serves as a warning for technology leaders, especially CISOs and CTOs, building or using AI assistants. With the growing adoption of AI in workflows, the new risks associated with protocols like MCP require sustained attention. Maintaining the security of the AI operational environment becomes a top priority.
To counter prompt hijacking, adopting strict measures is essential. All AI services must use a secure session management. Development teams should ensure that servers generate session IDs from strong random generators, thereby minimizing the risks of predictable IDs.
Strengthening Client Defense
Client programs must be designed to reject any event that does not comply with the expected IDs and types. Simple and incremental event IDs pose a risk of spraying-type attacks, necessitating the use of unpredictable IDs. Additionally, implementing zero-trust principles within AI protocols is essential to secure the entire system.
For more information on preventing risks related to generative AIs, check out this article on Qualys. Additional concerns also arise, such as the incident noted on the unauthorized changes to Musk’s chatbot, addressed here: DiA.
Common Questions about MCP Prompt Hijacking
What is MCP prompt hijacking?
MCP prompt hijacking is a vulnerability that exploits flaws in the Model Context Protocol (MCP) communication protocol used by AI systems, allowing an attacker to manipulate requests and inject false information.
Why is the MCP protocol considered vulnerable?
The vulnerability lies in how sessions are managed. By using predictable session IDs based on memory addresses, an attacker can create malicious sessions and deceive the system into thinking it is a legitimate user.
What types of attacks can be carried out via MCP prompt hijacking?
Attacks may include injecting malicious code, stealing sensitive data, and executing unauthorized commands, posing a significant risk to the software supply chain.
Who is most at risk of being affected by MCP prompt hijacking attacks?
All companies using AI systems that integrate the MCP protocol, especially those relying on Oat++-based applications and other similar technologies, are particularly vulnerable.
How can companies protect themselves against MCP prompt hijacking?
Companies should implement secure session management, enhance defenses for client programs, and apply “zero-trust” security principles to ensure that AI protocols are properly protected.
What are the best practices for session management in AI systems?
It is essential that servers generate session IDs using secure random generators, and that client programs reject any response that does not match the expected IDs and event types.
How can an ongoing MCP prompt hijacking attack be identified?
Signs of an attack may include inappropriate AI suggestions, unexpected application behaviors, or requests that appear to come from legitimate users but generate incorrect or malicious results.
Can regular security updates help mitigate this risk?
Yes, keeping software up to date with the latest security patches is crucial to protect against known vulnerabilities, including those related to the MCP protocol.
What is CVE-2025-6515 in relation to MCP prompt hijacking?
CVE-2025-6515 is a flaw identified in the oatpp-mcp system, which exposes users to prompt hijacking attacks by allowing an attacker to access predictable session IDs.
Why is it important for data security leaders to pay attention to MCP prompt hijacking?
With the increasing integration of AI into workflows, these leaders need to understand the new risks associated with the use of protocols like MCP to effectively protect data and systems.