# GHSA-2V5M-57PQ-R9J3: PraisonAI claw: authentication middleware guards only the /api/ prefix while the same handlers are served unprefixed

- Database: GitHub
- Severity: CVSS 9.1 (Critical)
- Published: 2026-11-16
- Modified: 2026-11-16

## Affected versions

- aiui (PyPI): through 0.3.154

## Description

## One-screen summary

**What is wrong.** `AuthEnforcementMiddleware` at `src/praisonaiui/server.py:2849` tests `path.startswith("/api/")` at `:2872`, while the same request handlers are also mounted unprefixed at `:3164-3181` — `/agents` (`:3164`), `/sessions` (`:3170-3171`), `/run` (`:3176`) and `/teams` (`:3181`).

**Who can exploit it.** An unauthenticated client that can reach the port, on a deployment that sets `AUTH_ENFORCE=true` and follows the guidance that it protects a publicly exposed instance.

**What happens.** The client reads the deployment's configuration through `/agents` and `/teams`, lists and creates sessions through `/sessions`, and executes the configured agents through `/run`, which returns the model's reply, without any credential.

**What to change.** Apply the middleware to every mount of these handlers rather than to a path prefix — attach it as a dependency on the routers themselves, or mount the authenticated and unauthenticated route sets from one registration point — and add a regression test asserting 401 on the unprefixed `/sessions`, `/run`, `/agents` and `/teams` with `AUTH_ENFORCE=true`.

The two mounts and the unauthenticated responses are under `## Proof of Concept` below.

## Details

`praisonai claw` serves the PraisonAIUI application through `praisonaiui.server.create_app()` (`src/praisonai-bot/praisonai_bot/integration/host_app.py:259-265`, reached from `src/praisonai-bot/praisonai_bot/claw/default_app.py` and `src/praisonai/praisonai/integration/__init__.py`). That application's `AuthEnforcementMiddleware` enforces authentication only on paths under `/api/`, while the same request handlers are also mounted at the root.

- `AuthEnforcementMiddleware` is defined at `src/praisonaiui/server.py:2849` and tests `path.startswith("/api/")` at `:2872` in `praisonaiui` HEAD; the released `aiui==0.3.153` (class at `:2834`, test at `:2857`) and `aiui==0.3.154` (class at `:2849`, test at `:2872`) both carry the same test.
- The same handlers are registered unprefixed at `:3164-3181`: `/sessions` (`:3170-3171`), `/run` (`:3176`), `/agents` (`:3164`), `/teams` (`:3181`).
- `docs/features/deployment.md:73,229` states that all `/api/*` routes require a valid Bearer token and that `AUTH_ENFORCE=true` is the control for public exposure.

## Proof of Concept

```text
$ pip install aiui==0.3.154
$ AUTH_ENFORCE=true uvicorn praisonaiui.server:create_app --factory --port 8010 &
$ curl -s -o /dev/null -w '%{http_code}\n' localhost:8010/api/config      # 401
$ curl -s -o /dev/null -w '%{http_code}\n' localhost:8010/api/sessions    # 401
$ curl -s -o /dev/null -w '%{http_code}\n' localhost:8010/sessions        # 200
$ curl -s -X POST localhost:8010/sessions -H 'content-type: application/json' -d '{}'   # creates a session
$ curl -s -X POST localhost:8010/run -H 'content-type: application/json' \
    -d '{"session_id":"<id>","message":"say hi"}'                                        # runs the agent, returns its reply
```

All of the last three succeed with no `Authorization` header, on the release that is current at the time of this report. `GET /api/config` and `GET /api/sessions` return 401 on the same server with the same setting, so the middleware is active and its scope is the defect.

## Impact

An unauthenticated client that can reach the port reads the deployment's configuration through `/agents` and `/teams`, lists and creates sessions through `/sessions`, and executes the configured agents through `/run`, which returns the model's reply. The deployment guidance says `AUTH_ENFORCE=true` protects a publicly exposed instance; it does not, because the handlers are mounted twice and only one mount is checked.

## Remediation

Apply the middleware to every mount of these handlers rather than to a path prefix — for example, attach it as a dependency on the routers themselves, or mount the authenticated and unauthenticated route sets from one registration point so a second prefix cannot bypass the check. A regression test that asserts 401 on the unprefixed `/sessions`, `/run`, `/agents` and `/teams` with `AUTH_ENFORCE=true` covers the class.

## Disclosure Notes

Reported to `MervinPraison/PraisonAIUI` first as `MervinPraison/PraisonAIUI#355` on 2026-11-11; Private Vulnerability Reporting is disabled on that repository, so that report carries no technical specifics per its `SECURITY.md`. This report carries the detail because the same application, and the same defect, ships from this repository. No public disclosure has been made.

## References

- https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-2v5m-57pq-r9j3

Page: https://cve.now/GHSA-2V5M-57PQ-R9J3

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
