Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

9.5 KB
Raw Blame

MSO Security Audit — 2026-08-24

Point-in-time evidence, not a standing implementation contract. This audit targets main at 0402234d7a9da7e1fd0db601ff29e855401c09c5 and records the remediation prepared from that snapshot. Current behavior is authoritative in code, SECURITY.md, and the live descriptors.

Executive result

Release gate after remediation: PASS. The audit found 0 Critical / 0 High, three confirmed vulnerability classes (2 Medium, 1 Low) and several hardening observations. All three confirmed classes were reproduced against the audited snapshot, fixed, and pinned by regression tests before release.

The highest-value negative result is also explicit: no auth bypass, unauthenticated host access, OAuth/MCP scope bypass, filesystem-root escape, managed-app origin break, or SSRF was confirmed in this pass.

Method

The review used two independent lanes and required reproducible evidence before a candidate could block release:

  1. Claude Fable 5 + Ultracode, read-only against the unchanged snapshot. The workflow actually fan-out to 8 workstreams / 27 sub-agents: seven domain finders plus twenty adversarial verifiers whose job was to disprove candidate findings. Fable reported 20 candidates: 2 confirmed, 15 downgraded, 3 rejected.
  2. Manual + dynamic verification against the same checkout: security-relevant Vitest selection, dependency audit, route/auth inventory, source review of trust boundaries, unauthenticated loopback HTTP probes against the running service, and purpose-built race / state-churn reproducers.

The review covered authentication/session/device approval, OAuth 2.1 + PKCE, MCP bearer scope and token lifecycle, filesystem/zip/upload boundaries, command/PTY execution, managed-app proxy/origin/CSP, Camoufox exposure, server input/CSRF/XSS/SSRF boundaries, installer/supply-chain posture, secrets/logging/audit state, skills/project discovery, and security-state concurrency.

No real credentials were used in test fixtures and no secret values are recorded here.

Confirmed findings

SEC-2026-08-24-01 — MEDIUM — nested private-key denylist / recursive ZIP escape

Affected: lib/host/paths.ts, lib/host/fs-zip.ts.

The loose SSH key names id_rsa, id_ed25519, id_ecdsa, and id_dsa were represented as fixed $HOME/<name> entries. A same-named key deeper in an otherwise readable root, e.g. ~/projects/app/id_rsa, therefore passed the per-path credential gate. Recursive ZIP also validated only the selected top-level entry before invoking zip -r; its forced excludes covered fixed sensitive locations but not basename-anywhere id_* or *.pem descendants. A read-scope MCP bearer uses the same host reader, so this weakened the intended credential-defense boundary even without write/exec scope.

Pre-fix proof with dummy fixtures: nested id_rsa resolved as readable and appeared in the ZIP central directory. No private key material was used.

Remediation: classify private-key basenames anywhere in a legal root, retain the existing OS_FS_ALLOW_SENSITIVE=1 behavior for id_*, retain the existing hard block for *.pem, and force matching exclusions into recursive ZIP.

Post-fix proof: nested id_rsa and deploy.pem are both blocked by resolveReadable; both are absent from a recursive archive while readme.txt remains present.

SEC-2026-08-24-02 — MEDIUM — security-state lost-update races weaken kill switches

Affected: lib/mcp/store.ts, lib/auth/device-store.ts, scripts/approve-device.js.

The MCP and device allowlist stores used atomic tmp -> rename writes, but each mutation was a multi-step read → modify → write transaction with no transaction serialization. Atomic rename prevents a torn individual write; it does not stop two callers from reading the same stale state and later overwriting each other's security decision. The shared temp filename also caused write collisions. The local device CLI is a separate process, so an in-process promise queue alone would not be sufficient.

Dynamic stress on the audited snapshot confirmed all relevant failure modes:

Reproducer Pre-fix result
200 OAuth-code double-consume races 4 runs returned the same single-use code to both consumers; 196 write races
200 pairs of concurrent MCP token mints token state lost in 200/200 iterations; 199 write races
300 MCP revoke-vs-touch races 125 cases where revoke returned success but the token still validated
300 device revoke-vs-login-touch races 42 cases ended with the device approved

That evidence is why the release classification here is Medium even though the Fable synthesis downgraded the races to Low/hardening based on timing and credential preconditions. A revocation control that reports success but can be overwritten by a live request is a kill-switch integrity defect.

Remediation: serialize each in-process security-store transaction, use per-process temp files, add a fail-closed cross-process lock for security state, make the operator device CLI participate in the same lock protocol, and make corrupt CLI store reads fail closed rather than treating corruption as an empty allowlist.

Post-fix stress: 100 OAuth-code race sets had exactly one consumer; 100 token-mint race sets lost no rows; 100 token revoke/touch sets had zero resurrection; 200 cross-process CLI revoke vs server-touch iterations had zero re-approval; no operation errors were observed. Focused concurrency tests are now permanent.

SEC-2026-08-24-03 — LOW — shared rate-limit table overflow reset live privileged buckets

Affected: lib/host/rate-limit.ts.

The shared fixed-window limiter pruned expired buckets when its Map exceeded 4,096 keys, then called buckets.clear() if the table remained large. Pre-auth MCP IP keys and privileged/authenticated MCP + host-action keys share this Map. Sufficient attacker-chosen key churn could therefore erase an already-blocked token/action bucket. This is not an authorization bypass by itself, but it weakens a defense used around exec-capable surfaces.

Pre-fix proof: a max=1 victim was blocked; after 4,100 unique churn keys the same victim was allowed again.

Remediation: split public/pre-auth IP buckets from authenticated/privileged buckets. Each pool is independently bounded and uses cold-key eviction after pruning expired rows. Unauthenticated key churn therefore cannot reset/evict a token or owner-action decision, and table pressure does not become a global 429 for new privileged actors.

Post-fix proof: after >4,200 public churn keys, the privileged victim remains blocked while fresh public keys still enter their own bounded pool. Regression tests pin both the isolation and bounded-eviction behavior.

Controls independently verified

  • Session cookies are HttpOnly, Secure and SameSite=Strict; HMAC verification is length-safe and device approval is rechecked.
  • Correct password on an unapproved device creates pending state but no session.
  • Mutating /api traffic is protected by the same-origin/Fetch-Metadata gate; unauthenticated filesystem/device/MCP-token routes returned 401 and forged-origin exec calls returned 403 in loopback probes.
  • OAuth uses authorization-code + PKCE S256, binds code/client/redirect/challenge and MCP tool scope is filtered in discovery and rechecked at call time.
  • Filesystem reads/writes realpath before bounds checks; upload/ZIP guards reject traversal and ZIP stores symlinks as links instead of following targets.
  • Managed-app upstreams are loopback-only; the split-origin proxy strips ambient authorization, constrains redirects/headers and intersects upstream CSP.
  • No runtime eval() / new Function() sink or shell: true child-process path was found.
  • The dependency audit was clean at high/critical and returned no advisory records in the subsequent JSON check.
  • API inventory found 57 route modules: 53 with direct session verification; the remaining login, logout, health and service-worker routes are intentionally public surfaces.

Rejected / non-blocking candidates

The adversarial Fable lane rejected or downgraded candidates involving /api/skills untrusted content, managed-app CSP external exfiltration, custom-provider DNS rebinding, MCP max-scope reclamping, X-Forwarded-* trust, backup retention, memory persistence, audit registry availability, and untrusted-skill descriptions. Where real assumptions exist, they match documented owner-operated/deployment boundaries rather than a newly demonstrated release-blocking exploit.

Two operational risks remain intentional and should stay visible rather than be mislabeled as bugs: exec/PTY is full owner-level host power after its authorization boundary, and some operator-initiated installers ultimately trust remote package/vendor infrastructure. Those are supply-chain / operator-trust decisions, not an unauthenticated MSO RCE found by this audit.

Tests added by this audit

  • OAuth single-use code under concurrent consumption.
  • Concurrent MCP token persistence and revoke-vs-touch kill-switch integrity.
  • Device revoke-vs-touch integrity plus CLI corrupt-store fail-closed behavior.
  • Cross-process device-store locking exercised dynamically against CLI + server module.
  • Nested id_* / *.pem credential classification and recursive ZIP exclusion.
  • Shared limiter overflow/churn cannot reset an established blocked bucket.

The final release gate is bun run verify plus post-ship service/HTTP checks. This document must not be used as evidence that a future commit is secure without rerunning those gates.