Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Network timing oracle requiring no privileges; the 1,000,000:1 ratio justifies AC:L; impact is username enumeration only, so C:L and I/A:N.
Primary rating from Vendor (https://github.com/gofiber/fiber).
CVSS VectorVendor: https://github.com/gofiber/fiber
Lifecycle Timeline
1DescriptionCVE.org
Summary
The default Authorizer function in GoFiber's BasicAuth middleware uses short-circuit evaluation that skips password hash comparison for non-existent usernames. With bcrypt-hashed passwords (the primary use case), the timing difference between a valid and invalid username is approximately 1,000,000:1 (~100ms vs ~100ns), enabling reliable remote username enumeration.
Vulnerable Code
File: middleware/basicauth/config.go, lines 126-138
if cfg.Authorizer == nil {
verifiers := make(map[string]func(string) bool, len(cfg.Users))
for u, hpw := range cfg.Users {
v, err := parseHashedPassword(hpw)
if err != nil {
panic(err)
}
verifiers[u] = v
}
cfg.Authorizer = func(user, pass string, _ fiber.Ctx) bool {
verify, ok := verifiers[user]
return ok && verify(pass) // line 137: short-circuit skips verify() if user unknown
}
}Data Flow
- Attacker sends
Authorization: Basic <base64(candidate:wrongpass)> - BasicAuth middleware decodes credentials and calls
cfg.Authorizer(user, pass, c) - Map lookup
verifiers[user]returnsok=falsefor non-existent users - Go
&&short-circuit:false && verify(pass)returns immediately without callingverify() - For valid users,
verify(pass)executesbcrypt.CompareHashAndPassword()(line 167: ~100ms at default cost 10) - Timing difference: ~100ns (invalid user) vs ~100ms (valid user) = 1,000,000:1 ratio
Timing comparison by hash type:
| Hash Type | Valid User | Invalid User | Ratio |
|---|---|---|---|
| bcrypt ($2) | ~100 ms | ~100 ns | 1,000,000:1 |
| SHA-512 | ~1-5 us | ~100 ns | 10-50:1 |
| SHA-256 | ~1-5 us | ~100 ns | 10-50:1 |
Impact
- Username enumeration: Attacker reliably determines which usernames exist by measuring response latency
- Targeted brute force: After enumerating valid usernames, password brute force is focused only on real accounts
- Account discovery: In applications where usernames are sensitive (internal tools, admin panels), leaking their existence is itself a security issue
Notes
- Password hash comparisons themselves are timing-safe:
subtle.ConstantTimeCompareis used correctly for SHA-256 (line 185), SHA-512 (line 176), and bcrypt uses its own constant-time comparison - The fix is to always execute a dummy hash comparison for unknown users:
bcrypt.CompareHashAndPassword(dummyHash, []byte(pass))and discard the result - This pattern matches CVE-2023-36456 (Authentik timing oracle) and similar findings in other auth libraries
AnalysisAI
Remote username enumeration in GoFiber fiber v3's default BasicAuth middleware exploits a timing side-channel caused by Go's short-circuit && evaluation, producing a ~1,000,000:1 response-time ratio between valid and invalid usernames when bcrypt hashing is in use. Any GoFiber v3 application relying on the default Authorizer with hashed credentials is affected; an unauthenticated remote attacker can enumerate valid usernames by measuring HTTP response latency, then focus credential brute-force exclusively on confirmed accounts. No public exploit code has been identified at time of analysis, and this vulnerability has not been added to the CISA KEV catalog.
Technical ContextAI
The flaw resides in middleware/basicauth/config.go lines 126-138 of GoFiber fiber v3 (CPE: pkg:go/github.com_gofiber_fiber_v3). The root cause is CWE-203 (Observable Discrepancy - timing oracle): the default Authorizer performs a Go map lookup for the username, then uses short-circuit && evaluation (ok && verify(pass)). For unknown usernames, ok=false causes the operator to return immediately without invoking verify(), completing in ~100ns. For valid usernames, verify() calls bcrypt's CompareHashAndPassword(), which takes ~100ms at the default cost factor of 10, yielding a 1,000,000:1 timing ratio. The same structural gap produces a 10-50:1 ratio for SHA-256 and SHA-512 paths. Critically, the password comparison path itself uses correctly constant-time functions - subtle.ConstantTimeCompare for SHA-256/SHA-512 and bcrypt's own constant-time comparison - but the missing dummy-hash execution for unknown users defeats these protections entirely.
RemediationAI
No vendor-released patched version has been independently confirmed at time of analysis; monitor the advisory at https://github.com/gofiber/fiber/security/advisories/GHSA-g5vh-55hw-rxm8 and the upstream repository at https://github.com/gofiber/fiber for a patched fiber v3 release. The canonical fix is to always execute a dummy hash comparison when a username is not found - for example, calling bcrypt.CompareHashAndPassword(dummyHash, []byte(pass)) and discarding the result before returning false - ensuring the response time is uniform regardless of username validity. As an immediate compensating control, application developers can supply a custom Authorizer function that implements this dummy-comparison pattern; this accepts the ~100ms latency cost on all failed requests but eliminates the timing oracle. Rate-limiting the BasicAuth-protected endpoints will not prevent enumeration but slows the attack speed. Restricting access to those endpoints via an IP allowlist fully eliminates remote exploitation at the cost of reduced accessibility.
Same weakness CWE-203 – Observable Discrepancy
View allSame technique Information Disclosure
View allVendor StatusVendor
SUSE
Severity: ModerateShare
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-42358
GHSA-g5vh-55hw-rxm8