[H-1] Rate limiter collapses to one shared bucket behind Caddy — remote lockout DoS of /login and /oauth/token #5
Labels
No labels
architecture
code-quality
correctness
critical
docs
high
low
medium
ops
performance
privacy
security
tests
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
antrapol/CA-MDID-eMudhra#5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
Rate limiting keys on
conn.remote_ip(the TCP peer). There is no RemoteIp/X-Forwarded-For handling anywhere, so in the shipped Docker topology every external request arrives from the Caddy container IP: one shared bucket per client_id.Evidence
lib/mdid_ws/auth/rate_limiter.ex:122-131—get_remote_ipreturnsconn.remote_iplib/mdid_ws_web/endpoint.ex— no trusted-proxy/forwarded-header plug (grep-verified)Impact
5 bad secrets from one attacker → 30-minute lockout for every legitimate user of that client on both /oauth/token and /login; repeatable forever = sustained remote DoS of the CA's token issuance. (Silver lining: XFF spoofing is impossible since the header is never read.)
Fix
Retry-Afteron 429Line numbers refer to the initial import commit
282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).