Note Mark: Username Enumeration via Login Endpoint Timing Side-Channel

Description

Summary

A timing side-channel in the login endpoint allows unauthenticated attackers to determine whether a username exists by measuring response time differences. Requests for valid usernames take noticeably longer because the server performs bcrypt password verification, while requests for nonexistent usernames return much faster. This enables reliable remote username enumeration and increases the risk of targeted credential attacks.

Details

The issue affects the login endpoint:

  • POST /api/auth/token

The root cause is that authentication processing takes different code paths depending on whether the supplied username exists. When the username is found, the server performs bcrypt.CompareHashAndPassword, which adds substantial latency. When the username does not exist, the server returns immediately without performing an equivalent bcrypt operation.

Vulnerable flow:

user, err := db.Where("username = ?", username).First(&user)
if err != nil {
    return ErrUnauthorized
}
err = bcrypt.CompareHashAndPassword(user.PasswordHash, []byte(password))

This creates a measurable timing discrepancy between:
- existing username + wrong password requests, which incur bcrypt cost
- nonexistent username + any password requests, which avoid bcrypt entirely

Because no constant-time equalization is performed, the endpoint leaks account existence through timing behavior.

The measurements provided show a large and consistent gap between the two cases across repeated trials, making the difference distinguishable without requiring especially high request volume. In the supplied test results:
- existing user requests averaged about 0.0616s
- nonexistent user requests averaged about 0.0027s

That gap is large enough to support reliable username enumeration under typical testing conditions.

PoC

The issue can be reproduced by sending repeated authentication attempts to the login endpoint using the same invalid password while alternating between a known valid username and a nonexistent username, then comparing average response times. Valid usernames consistently take longer because bcrypt verification is performed.

Impact

  • Type: Timing side-channel / username enumeration
  • Who is impacted: Any deployment exposing the affected login endpoint
  • Security impact: Unauthenticated attackers can confirm valid usernames one at a time, improving the effectiveness of credential stuffing, password spraying, phishing, and other targeted account attacks
  • Attack preconditions: None beyond network access to the login endpoint
  • Confidentiality impact: Low to moderate, depending on the sensitivity of account existence in the target environment

Basic information

Type
reviewed
Severity
low
Advisory on GitHub
Open advisory ↗
Repository advisory
Open repository advisory ↗
Source code
Browse source ↗
Published (advisory)
2026-04-13 19:31:50 UTC
Updated
2026-04-24 20:37:10 UTC
GitHub reviewed
2026-04-13 19:31:50 UTC
NVD published
2026-04-17 01:17:40 UTC

EPSS Score

Score Percentile
0.04% 11.27%

CVSS Scores

Base score Version Severity Vector
3.7 3.1
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:H)
Even with access, the exploit needs extra luck, timing, or a fussy environment to actually work.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:N)
Nobody has to click “OK” or open a trap file; it can work without a victim helping.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:L)
Some sensitive info could get out, but not a total data dump.
Integrity (I:N)
Data isn’t meaningfully altered or forged.
Availability (A:N)
Service keeps running; no real outage angle.

Identifiers

CWEs

CWE id Name
CWE-208 Observable Timing Discrepancy

Credits

  • QiaoNPC (reporter)
  • Across-Verticals-Malaysia (reporter)
  • enchant97 (remediation_developer)

Affected packages (1)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
go github.com/enchant97/note-mark/backend < 0.19.2-0.20260411145025-cf4c6f6acf70 0.19.2-0.20260411145025-cf4c6f6acf70

References

cvelogic Threat Intelligence