PraisonAI MCP Server Origin Validation Bypass
The PraisonAI MCP HTTP server is vulnerable to unauthenticated cross-site request forgery due to an insecure prefix-based Origin header validation, allowing attackers to perform persistent prompt injection via state-changing tool calls.
The PraisonAI MCP HTTP-stream transport (used via praisonai mcp serve) implements Origin header validation using a startswith prefix match instead of an exact comparison. This flaw allows an attacker to host a malicious page on a domain that starts with http://localhost or http://127.0.0.1 (e.g., http://localhost.attacker.com), bypassing the security check. Since the default configuration does not require an API key and the server processes text/plain requests without preflight checks, an attacker can perform blind cross-site request forgery (CSRF) against a developer's local instance. By exploiting the praisonai.rules.create tool, an attacker can inject malicious prompt instructions into the ~/.praison/rules directory. Because the agent runtime automatically loads all files in this directory with "always" activation, this leads to persistent prompt injection, causing the victim's agent to execute attacker-controlled instructions during all future sessions, including potential exfiltration of SSH keys and API credentials.
Attack Chain
- Attacker hosts a malicious webpage on a domain starting with a whitelisted prefix (e.g.,
http://localhost.attacker.com). - The victim, who is running the local PraisonAI MCP server, visits the attacker-controlled page in their browser.
- The malicious page sends an asynchronous
POSTrequest tohttp://127.0.0.1:8080/mcpwith a forgedOrigin: http://localhost.attacker.comheader. - The server's
_validate_originfunction incorrectly returnsTruedue to thestartswithlogic, allowing the request. - The request uses
Content-Type: text/plain, which the browser treats as a CORS simple request, bypassing the requirement for anOPTIONSpreflight check. - The MCP server processes the request as a JSON-RPC payload without authentication, as the
--api-keydefaults toNone. - The
praisonai.rules.createtool writes an attacker-controlled Markdown file to the victim's~/.praison/rulesdirectory. - The victim's agent runtime loads the malicious rule, which is applied to all subsequent agent tasks, resulting in persistent unauthorized execution.
Impact
Successful exploitation results in a persistent compromise of the local agent runtime. By injecting malicious rule files, the attacker can silently alter the agent's behavior to exfiltrate sensitive local files such as ~/.ssh/id_rsa or environment-stored API keys, delete the user's existing rules, or manipulate scheduled agent tasks. This vulnerability represents a drive-by, unauthenticated, and no-direct-network-access compromise of developer environments.
Recommendation
- Upgrade PraisonAI to version 4.6.58 or later, where the Origin validation logic has been hardened.
- Implement explicit Origin header checks using
urllib.parseto ensure exact scheme, host, and port matching. - Enforce API key authentication by default for the HTTP-stream transport to prevent unauthenticated requests.
- Restrict
Content-Typefor the MCP dispatcher toapplication/jsonto ensure browsers require a CORS preflight for state-changing requests.
Immediate actions
Patch all PraisonAI installations to 4.6.58 or higher.
Threat Hunt
Search web logs for POST requests to /mcp containing suspicious Origin headers.
Data: webserver_logs
Mitigations
Enable API key authentication for the PraisonAI MCP server.
CVE-2026-55532
Detection coverage 1
Detect Potential CSRF against PraisonAI MCP Server
highDetects unauthorized HTTP POST requests to the PraisonAI MCP endpoint where the Origin header does not exactly match expected local loopback addresses.
Detection queries are available on the platform. Get full rules →