> Outcome (added when this file was published, 2026-11-13): verified, but lowered from S4

From mnema-talk v3.3.13, rendered on this site.

ID: H-L8-01, lane 8, severity S4, status: reproduced (pending phase 2)

Claim: The in-memory rate limiter and login-failure limiter evict an established, not-currently-locked victim entry when flooded with fresh keys, resetting the victim's count/window; only an active lockout is durable. The existing tests assert the map size and that the newest key survives, nothing about the victim.

Property:

  • Stated/intended: internal/httpx/loginfailure.go makeRoomLocked says it evicts "preferring entries that are not locked, so flooding the map with fresh keys does not cheaply lift a lockout", and the login docstring (internal/auth/authn/handler.go) describes escalating lockouts whose tier is "forgotten after an hour without failures" -- i.e. accumulated failures are meant to persist until they decay or lock. The account-wide guess cap (accountFailures, threshold 100, handler.go:120) is an unlocked, long-lived entry for its entire climb from 0 to 100.
  • Broken: an unlocked entry below its threshold (e.g. accountFailures at 99/100) and an at-limit RateLimiter window are the preferred eviction victims (earliest reset / unlocked+stalest among a random sample of evictSample=32). A flood of fresh keys at the cap (defaultMaxEntries=65536) resets them. This lets a flooder keep a targeted account's failure count from ever reaching the lockout threshold, defeating the account-wide brute-force cap; and lets a party reset a per-IP window on secret-guarding endpoints.
  • Durable half (now guarded): a currently locked entry is NOT evicted (TestLoginFailureLockedVictimSurvivesFlood passes at the full cap).

Repro (clean checkout of msch128/hunt-lane8, commit 0b742e657): go test ./internal/httpx/ -run 'Flood|StalestVictim' -v

deep, production cap 65536:

RL_FLOOD_DEEP=1 go test ./internal/httpx/ -run 'Flood|StalestVictim' -v Expected/actual:

  • TestLoginFailureLockedVictimSurvivesFlood: PASS (locked victim durable).
  • TestLoginFailurePartialVictimEvictedByFlood: 24/24 trials (3/3 deep) evict the 99/100 victim; measured horizon ~cap/evictSample inserts (128 at cap 4096, 2048 at cap 65536).
  • TestRateLimiterStalestVictimEvictedByFlood: 24/24 (3/3 deep) evict the at-limit window; re-insertion yields a fresh budget.

Minimal: At the cap, one fresh-key insert evicts one entry from a sample of 32 preferring the unlocked/earliest-reset one; the stalest unlocked victim is reliably gone after ~cap/32 inserts. evictSampled (internal/httpx/bounded.go:31).

Reach:

  • accountFailures reset (lockout evasion): the flooder must hold 65536 distinct entries in that limiter. Each entry is created only by a failed login against a distinct username, which burns a bcrypt check (global bcrypt_slots, ~NumCPU concurrent with a 2s queue) and draws a loginPerIP slot (60/15min per IPv6 /64). Expensive and distributed, but sustainable for a determined attacker with many /64s; not a casual attack. Anon (no account needed; usernames need only match the pattern, not exist).
  • per-IP window reset: a party controlling a large IPv6 allocation (a /48 gives 65536 /64 keys) can fill a per-IP limiter and steer eviction of an established window. For the attacker's own key this is moot (fresh /64s already give fresh budget); it matters only for resetting another party's established entry.

Effect: The account-wide guess cap -- the control that slows targeted online password guessing once an account is under attack -- can be prevented from ever firing, so guessing is not throttled account-wide. Measured in-process; no production timing measured (not shown).

Not shown:

  • End-to-end reachability through the real HTTP handlers under the bcrypt-slot and per-IP throttles (measured only on the limiter data structures).
  • Whether the per-IP reset is cheaper on any specific endpoint than simply using fresh /64s.

Fix (direction only): Make eviction never prefer a victim that still holds protective state: evict the youngest/idle entries, not the stalest established one; or make an established non-zero count sticky (evict only entries at count 0 / fully-refilled windows), falling back to refuse-rather-than-grow as the TURN limiter does. The locked-is- durable guard (TestLoginFailureLockedVictimSurvivesFlood) already encodes the intent; extend it to any non-zero established count.

Reviews: reproducer -, refuter - (pending phase 2). Files: internal/httpx/limiter_eviction_steering_test.go

Something wrong on this page? Tell us.