Skip to content

Instantly share code, notes, and snippets.

@pyuysig
Last active June 13, 2026 15:42
Show Gist options
  • Select an option

  • Save pyuysig/50dc365f54f95396bb67532f02b34bb0 to your computer and use it in GitHub Desktop.

Select an option

Save pyuysig/50dc365f54f95396bb67532f02b34bb0 to your computer and use it in GitHub Desktop.
Reference for CVE-2026-50891

Summary

Filestash 0.4.0 exposes its admin configuration API during first-run setup while auth.admin is unset. A remote attacker who reaches the instance before setup completes can set the administrator password hash and take over the admin plane.

Details

The AdminOnly middleware only enforces the admin cookie check when auth.admin is non-empty. During initial setup, auth.admin is empty, so /admin/api/config proceeds without an admin session.

GET /admin/api/session also reports an authenticated state in that setup condition. The configuration update handler accepts JSON, overwrites config.json, and reloads configuration immediately.

The attacker-controlled input is the submitted config JSON, specifically the auth.admin password hash. The missing boundary is external access control around first-run setup before the application has an administrator credential to enforce.

PoC

  1. Start a fresh Filestash 0.4.0 instance where auth.admin is unset and the web interface is reachable.
  2. Send GET /admin/api/config without an admin cookie and retrieve the current configuration JSON.
  3. Replace only the auth.admin value with a bcrypt hash of an attacker-chosen password.
  4. Send POST /admin/api/config with the modified JSON body.
  5. Send POST /admin/api/session with the attacker's cleartext password and observe a valid admin session.

Impact

The observed result is unauthenticated administrative takeover of a reachable uninitialized Filestash instance. The attacker gains control over global configuration, storage definitions, sharing behavior, and secrets managed through the admin console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment