Repository navigation
Description
Three unauthenticated information disclosures in Octop
Product: Octop (TencentCloud/Octop)
Version tested: main @ 1.0.3b8 (commit at time of audit, 2026-11-27)
Platform: Linux 6.8.0, Python 3.12, SQLite (default config)
Severity: Low (information disclosure; no authentication bypass)
Summary
The JWT middleware in Octop is structurally sound — all business routes are mounted
under /api/*, and every JWT-exempt endpoint implements its own verification. I did
not find an authentication bypass, and I am not reporting one.
However, three JWT-exempt endpoints return more information than they should to
unauthenticated callers. The most notable is GET /api/setup/status, which
discloses the absolute filesystem path of the setup wizard's plaintext password
file. I traced whether this can be converted into a token or an authenticated
session; it cannot (see Finding 1), so all three findings are Low severity and
none enables authentication bypass.
All findings were reproduced against a real instance (octop init + octop run --host 0.0.0.0), accessed from a non-loopback LAN address so middleware behaviour
matched a production deployment. 31 test vectors were run; the full matrix is
available on request.
Finding 1 (Low) — /api/setup/status discloses absolute path of the setup wizard password file
Endpoint: GET /api/setup/status (JWT-exempt)
Location: src/octop/api/routers/setup.py:329
Unauthenticated response on a fully set-up instance:
{
"setup_required": false,
"local_account": false,
"wizard_password_required": true,
"wizard_password_exists": true,
"wizard_password_path": "/home/ubuntu/octop-audit/octop-home/octop-login.txt",
"database_driver": "sqlite",
"database_bound": true
}What the file actually contains
octop-login.txt holds the setup wizard password in plaintext
(src/octop/infra/setup/password_file.py, generated via
secrets.token_urlsafe, written with os.write(pw + "\n"), mode 0600).
This is not a user password and not the JWT signing key — it is the
CLI-printed password that gates the first-run wizard only.
Why this is Low and not higher
I traced the full chain from "holds this password" to "authenticated access" and it
is blocked at three independent points. Recording this here so the impact is not
overestimated:
- Path is disclosed, not content. Reading the file still requires a separate
file-read primitive, which I did not find in Octop. - Even holding the password, the wizard is closed.
POST /setup/verify-password
(setup.py:421) compares the password in plaintext and issues a wizard token, but
its first statement is_enforce_wizard_open(server), which raises410whenever
user_manager.count() != 0(setup.py:153-156).POST /setup/beginand
POST /setup/initial-adminare gated the same way. The only bypass,
_desktop_local_account(setup.py:142-151), requires desktop shell and
require_setup_password == Falseand a loopback peer — and the password file
only exists whenrequire_setup_password == True, so those conditions are
mutually exclusive. - A wizard token is not a JWT.
WizardTokenStore.issue()
(infra/setup/wizard_tokens.py:33) stores an opaque token in an in-memory dict
with a TTL, cleared on restart. It is a different system from
sign_token(PURPOSE_ACCESS)and cannot be used as aBeareron any/api/*
business endpoint.
Net effect: this finding does not enable authentication bypass or token
acquisition. Its value is reconnaissance only.
Root cause
# src/octop/api/routers/setup.py:311-329
wizard_path = str(_wizard.resolve_password_path(server.paths.root, legacy_home=Path.home()))
password_required = _setup_password_required(server)
...
return {
...
"wizard_password_path": wizard_path if password_required else None,
...
}The guard shows the author already considered the path sensitive — it is
suppressed when password_required is false. But the condition is inverted
relative to risk: require_setup_password defaults to true, and it stays true
after setup completes. So the normal production state is exactly the state that
discloses the path. Only desktop builds (which turn the gate off) get the
suppression.
Note the leak is unconditional whenever the gate is on — it does not depend on the
file existing. wizard_password_path is populated regardless of
wizard_password_exists.
Suggested fix
Return the path only while the wizard is actually open (i.e. when the caller could
legitimately need it), and only to a caller who has proven they hold the wizard
token. Two options:
# Option A (minimal): only disclose when setup is genuinely incomplete
"wizard_password_path": wizard_path if (password_required and setup_required) else None,# Option B (better): drop the path from this response entirely. The dashboard does
# not need it — it needs the boolean. Operators find the file via `octop` CLI output
# or the docs, not via an HTTP response.
"wizard_password_exists": password_required and ...,
# no wizard_password_path keyIf the intent is that a local operator can discover the path from the dashboard,
gate it behind the wizard token:
@router.get("/setup/status")
async def status(server=Depends(get_server),
authorization: str | None = Header(default=None)):
...
include_path = (
password_required
and setup_required
and authorization is not None
and server.wizard_tokens.validate(authorization.removeprefix("Bearer ").strip())
)
"wizard_password_path": wizard_path if include_path else None,Note that _enforce_wizard_token_phase (setup.py:168) raises 410 once
setup_wizard_completed(settings_repo) is true, so a token-gated variant would have
to capture the path before calling that guard. That ordering constraint is the
main argument for Option B (drop the field) over Option C (gate it) — the field has
no legitimate consumer in the completed state, so gating it costs complexity to
preserve a value nobody should read.
Finding 2 (Low) — /api/health discloses user count, uptime, and per-channel health
Endpoint: GET /api/health (JWT-exempt, intentionally — it is a liveness probe)
Location: src/octop/api/routers/health.py:14-35
{
"ok": true,
"started_at": 1764251XXX.XXX,
"db": true,
"users_loaded": 1,
"agents_running": 2,
"channels": [ { "channel": "...", "reconnect_count": 0, "dropped_duplicate": 0,
"last_inbound_at": ... } ]
}Why this matters
users_loaded and agents_running reveal whether the instance is in use and how
large it is — useful for choosing a target. started_at reveals uptime, letting an
attacker infer patch cadence and whether a restart (e.g. after an attempted
exploit) succeeded. channels exposes IM integration health, including
reconnect_count, dropped_duplicate, and last_inbound_at, which discloses
which IM platforms are connected and their traffic patterns.
I understand a liveness probe must be unauthenticated and should not touch the DB,
so this is a design trade-off rather than a mistake. The recommendation is to
narrow the payload, not to add auth:
- Keep
{"ok": true}public — that is all a load balancer needs. - Move the diagnostic fields (
started_at,users_loaded,agents_running,
channels) behind authentication, at a separate path such as
GET /api/health/detailswithDepends(current_user). - If a non-auth monitoring system needs them, gate on a health token or restrict by
source IP, mirroring how/api/internal/mcp/*already requires a token.
Note that the unauthenticated db and users_loaded fields also make this
endpoint an oracle for "is the instance initialised", which overlaps with the
purpose of /api/setup/status.
Finding 3 (Low) — /api/setup/presets discloses the built-in provider catalog
Endpoint: GET /api/setup/presets (JWT-exempt)
Location: src/octop/api/routers/setup.py:288-291
@router.get("/setup/presets", summary="List provider presets")
async def setup_presets() -> list[dict[str, Any]]:
return load_provider_presets()Returns all 46 built-in provider presets, including internal endpoint defaults such
as http://127.0.0.1:3425/v1.
Why this matters
This is mostly public information (the presets ship in the package), so severity is
low. The concern is that it is exposed on a fully set-up instance where the
setup wizard is no longer reachable — the response has no legitimate consumer once
setup_required is false. It also advertises the local gateway port, which tells an
attacker what to aim at if they later reach the loopback interface.
Suggested fix
Gate on setup_required, consistent with the other wizard endpoints:
@router.get("/setup/presets", summary="List provider presets")
async def setup_presets(server: Any = Depends(get_server)) -> list[dict[str, Any]]:
_enforce_wizard_open(server) # already 410s once setup is complete
return load_provider_presets()What I checked and found sound
Reporting these three is not a comment on the auth design, which I consider solid.
For context, the following were tested and held up:
| Vector | Result |
|---|---|
Routes outside /api/ prefix |
None — all routers use /api/...; only /.well-known/acme-challenge/{token} is mounted outside |
Path traversal via exempt prefixes (/api/setup/../agents, %2e%2e, //api, .//, case, ;) |
12 variants, all rejected (404/401) — Starlette normalises before routing |
JWT algorithm confusion (none, RS256 against HS256 key) |
Rejected — algorithms=["HS256"] is pinned |
| JWT secret guessability | os.urandom(32) = 256-bit |
Forged tokens, empty bearer, ?access_token= |
All 401 |
purpose-less token fail-open branch |
Present, but every sign_token call site passes purpose=PURPOSE_ACCESS; not exploitable |
| WebSocket auth | All 10 WS endpoints validate the token inside the handler |
| Setup wizard with an admin already present | /setup/begin and /setup/initial-admin → 410 |
21 /api/internal/mcp/* endpoints |
Every handler requires token: str = Query(...) |
| Share / download links | token_urlsafe(24) (192-bit) + TTL |
| OAuth callbacks | consume_oauth_state() is single-use |
| CORS | Default cors_origins=[] |
| Extension-registered public paths | Forced to start with /api/, else ValueError |
The one structural note worth flagging: jwt_auth.py:44 uses
if not path.startswith("/api/"), a pattern that is a real vulnerability in
codebases where something is mounted outside that prefix. Octop is currently safe
only because nothing is. If a future router is ever mounted at the root, that
pattern will silently exempt it. A positive allowlist (enumerate exempt paths,
default-deny everything else) would make the invariant structural rather than
incidental. Same comment applies to setup_lockdown.py.
Reproduction
python3.12 -m venv .venv && ./.venv/bin/pip install -e . -i https://pypi.org/simple
export PATH=$PWD/.venv/bin:$PATH OCTOP_HOME=$PWD/octop-home
octop init --admin-username admin --admin-password 'AuditPass123!' --yes
octop run --host 0.0.0.0 --port 18090Then, without any Authorization header:
# Finding 1 — absolute path of plaintext credential file
curl -s http://<host>:18090/api/setup/status
# Finding 2 — user count, uptime, channel health
curl -s http://<host>:18090/api/health
# Finding 3 — provider catalog on a set-up instance
curl -s http://<host>:18090/api/setup/presetsControl check — these must return 401:
for p in /api/agents /api/users /api/plugins /api/envs; do
printf '%s -> ' $p; curl -s -o /dev/null -w '%{http_code}\n' http://<host>:18090$p
done
Activity