CVE-2026-77936
Unauthenticated API, default DB superuser, remote code exec via /v1/tools/run.
- CVSS 9.3
- CWE-1188
- Authentication, Authorization, and Session Management
- Remote
Letta through 0.16.8 ships a compose.yaml that does not enable LETTA_SERVER_SECURE, so the password middleware is never added and all API routes are unauthenticated, and it exposes a superuser PostgreSQL port with default credentials. Remote attackers can execute arbitrary Python via POST /v1/tools/run, manage /v1/admin users, or run OS commands via COPY PROGRAM.
- CWE
- CWE-1188
- CVSS base score
- 9.3
- Published
- 2026-10-20
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Insecure Authentication Mechanisms
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Letta
Solution
Upgrade Letta to version 0.16.9 or later, which enables LETTA_SERVER_SECURE and removes the exposed PostgreSQL superuser credentials.
Vulnerable code sample
import os
from fastapi import FastAPI, Request, HTTPException
from starlette.middleware.base import BaseHTTPMiddleware
app = FastAPI()
class PasswordAuthMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request: Request, call_next):
auth = request.headers.get("Authorization")
if not auth or auth != f"Bearer {os.getenv('LETTA_API_TOKEN')}":
raise HTTPException(status_code=401, detail="Unauthorized")
return await call_next(request)
# VULNERABLE: authentication middleware never added because LETTA_SERVER_SECURE is false by default
if os.getenv("LETTA_SERVER_SECURE") == "true":
app.add_middleware(PasswordAuthMiddleware)
@app.post("/v1/tools/run")
async def run_tool(request: Request):
data = await request.json()
# vulnerable: directly eval user-provided code
exec(data["code"])
return {"status": "executed"}Patched code sample
import os
from fastapi import FastAPI, Request, HTTPException
from starlette.middleware.base import BaseHTTPMiddleware
app = FastAPI()
class PasswordAuthMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request: Request, call_next):
auth = request.headers.get("Authorization")
if not auth or auth != f"Bearer {os.getenv('LETTA_API_TOKEN')}":
raise HTTPException(status_code=401, detail="Unauthorized")
return await call_next(request)
# FIX: enforce secure mode and always add authentication middleware
if os.getenv("LETTA_SERVER_SECURE", "true") == "true":
app.add_middleware(PasswordAuthMiddleware)
else:
raise RuntimeError("LETTA_SERVER_SECURE must be enabled for production")
@app.post("/v1/tools/run")
async def run_tool(request: Request):
data = await request.json()
# vulnerable: directly eval user-provided code
exec(data["code"])
return {"status": "executed"}Cite this entry
@misc{vaitp:cve202677936,
title = {{Unauthenticated API, default DB superuser, remote code exec via /v1/tools/run.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-77936},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-77936/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
