Skip to content

[bug] A burst of failed sign-ins can keep every CPU core busy hashing passwords #2902

Closed

Description

@Quick104

What happened

Nothing limits how many bcrypt password checks run at once. A burst of failed sign-ins keeps every CPU core busy hashing, and the rest of the server slows down until the burst stops.

Every password sign-in costs one bcrypt comparison, including sign-ins for names with no account (since #2105, so response time doesn't reveal which names exist). The comparison runs on the request goroutine with no limit, so the number of hashes in flight grows with the number of concurrent sign-in requests. The per-address sign-in budget doesn't help when the requests come from many addresses, and the server-wide budget (1000 requests per second by default) is far above what a small server can hash.

On a Silo dev deployment running current main, limited to 4 CPUs, a 30-second burst of 128 concurrent failed sign-ins for unknown names:

Before the burst During the burst
Server CPU use 0.1 cores 4.0 cores (the whole limit)
Goroutines inside bcrypt (sampled each second) 0 up to 83
Unrelated admin request (GET /api/v2/admin/system/build) 4 ms median 4.2 s median, 6.3 s worst
Sign-in with the correct password 63 ms 7.5 s median, 8.2 s worst

All 2,180 failed sign-ins answered 401. Transcodes share the same cores, so they compete with the hashing too.

The same unbounded hashing exists at every other bcrypt call: password changes, resets, temporary passwords, account creation, and profile PIN set and check.

Steps to reproduce

  1. Run current main with a small CPU allotment (4 cores here).
  2. Send a sustained burst of concurrent failed password sign-ins (about 100 in flight) from more addresses than the per-address budget covers. On a test deployment, raising the login and per-address rate-limit budgets stands in for many addresses.
  3. During the burst, time any unrelated API request and a sign-in with a correct password.

Expected behavior

Password and PIN hashing should use a bounded share of the CPU, so a sign-in burst can't stall API requests or streams. When the server is too busy to check a password within a reasonable wait, the sign-in should get a retryable answer (503 with Retry-After), never a false "wrong password".

Silo version / commit

main at d004620

Deployment

Local dev build

Area

Performance

Clients affected

  • Web UI
  • Android
  • iOS/tvOS/macOS
  • Jellyfin-compat client (Infuse, Findroid, ...)
  • Other/not client-specific

Relevant logs

Request log lines from the burst (client address redacted):

time=2026-10-22T12:52:00.500Z level=INFO msg="apiv2 request" component=apiv2 request_id=841fbaaab587d121fbfbb068 api_major=2 operation_id=getAdminBuildInfo method=GET path_pattern=/api/v2/admin/system/build status=200 status_class=2xx error_code=none auth_class=session duration_ms=6221 body_bytes=89 client_ip=<redacted> user_id=1
time=2026-10-22T12:52:05.346Z level=INFO msg="apiv2 request" component=apiv2 request_id=821afecb6e87b1e02f93536e api_major=2 operation_id=getAdminBuildInfo method=GET path_pattern=/api/v2/admin/system/build status=200 status_class=2xx error_code=none auth_class=session duration_ms=4302 body_bytes=89 client_ip=<redacted> user_id=1

The same request took 1–2 ms before the burst.

Technical notes

  • Password sign-in compares in checkLocalPassword (internal/auth/provider.go), against the placeholder hash when the name has no local password (internal/auth/password_hash.go).
  • Other direct bcrypt calls: internal/auth/repository.go (create user, update user, change password), internal/auth/password_reset.go, internal/auth/local_login_policy.go (temporary password), and profile PINs in internal/userstore/pgstore/profiles.go, internal/userdb/profiles.go and internal/api/handlers/profiles.go.
  • Already in the right order: a password-reset link is claimed, and an invite code redeemed, before the new password is hashed, in the same transaction. An invalid link or code costs no hash, and a failed hash rolls the claim back.
  • A per-name sign-in budget ([bug] Sign-in has no per-name attempt limit, and each IPv6 address gets its own budget #2901) limits guessing at one account but not the CPU cost of many names.

Source: internal code audit.

AI harness

Claude Code

AI tool(s)

Claude Code (bash, file read and search), GitHub CLI

AI model(s)

claude-opus-5-5

AI involvement

Fully AI-generated, human verified

Independent or adversarial review

n/a

Confirmations

  • I searched open and recently closed issues and pull requests, and this is not already reported
  • I reproduced this myself on a real deployment
  • Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above

Activity

  1. added
    bug
    on Oct 22, 2026
  2. self-assigned this
    on Oct 22, 2026
  3. Quick104 commented on Oct 22, 2026

    @Quick104
    ContributorAuthor

    🤖 AI agent claim. Claude Code (claude-opus-5-5) is working on a fix for this issue on behalf of @Quick104, who is assigned.

    A pull request will link here when the fix is ready. If the work stops without a fix, the assignment and this comment are removed.

    Planning to work on this, or have context to add? Reply here and mention @Quick104.

  4. added a commit that references this issue on Oct 22, 2026
    db95c13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions