GHSA-456H-WW26-F758
Vulnerability from github – Published: 2026-09-22 20:37 – Updated: 2026-09-22 20:37Summary
It's possible to enumerate users through a timing oracle. In other words: I can easily check if a username exists or not by observing the timing differences between logins.
PoC
Setup a tinyauth server with a local user. It can be over the network.
Try to log in with the local user, using an incorrect password: there is a noticeable delay. You know that the user exists.
Now try to log in with a username that does not exist, using an incorrect password: it will complete almost immediately. You know that the user does not exist.
Expected vs actual behavior
Login attempts should take roughly the same amount of time when the user exists vs when the user does not exist. Right now, nonexistent user attempts are way faster, meaning if your login attempt is slow, then the username exists for sure.
Details
Existing usernames will take an extra ~50 milliseconds to respond to login attempts, while non-existing usernames will take only ~50 microseconds (1000x less time) to return an incorrect password response.
Even taking network traffic into consideration, it is trivial to check whether a local user exists or not.
=== Existing user, wrong password === #1: 50.52ms #2: 46.24ms #3: 43.57ms
=== Nonexistent user === #1: 43.03µs #2: 48.45µs #3: 59.33µs
Suggested fix
This can be solved by checking a dummy password hash when a user is not found before returning a query, this will mimic the exact same delay irrelevant of hardware capabilities.
Potential patch:
From ca102773e0303f6025480efb26db379e3570a350 Mon Sep 17 00:00:00 2001
From: Disyer <daniel@tohka.us>
Date: Tue, 14 Jul 2026 12:35:07 +0300
Subject: [PATCH] fix: prevent user enumeration by means of timing attack
---
internal/controller/user_controller.go | 1 +
internal/middleware/context_middleware.go | 1 +
internal/service/auth_service.go | 10 ++++++++++
3 files changed, 12 insertions(+)
diff --git a/internal/controller/user_controller.go b/internal/controller/user_controller.go
index ae6c23b..2ecc996 100644
--- a/internal/controller/user_controller.go
+++ b/internal/controller/user_controller.go
@@ -90,6 +90,7 @@ func (controller *UserController) loginHandler(c *gin.Context) {
if err != nil {
if errors.Is(err, service.ErrUserNotFound) {
+ controller.auth.DummyCheckPassword(req.Password)
controller.log.App.Warn().Str("username", req.Username).Msg("User not found during login attempt")
controller.auth.RecordLoginAttempt(req.Username, false)
controller.log.AuditLoginFailure(req.Username, "unknown", c.ClientIP(), "user not found")
diff --git a/internal/middleware/context_middleware.go b/internal/middleware/context_middleware.go
index f49c85a..f70c9e7 100644
--- a/internal/middleware/context_middleware.go
+++ b/internal/middleware/context_middleware.go
@@ -244,6 +244,7 @@ func (m *ContextMiddleware) basicAuth(username string, password string) (*model.
search, err := m.auth.SearchUser(username)
if err != nil {
+ m.auth.DummyCheckPassword(password)
return nil, nil, fmt.Errorf("error searching for user: %w", err)
}
diff --git a/internal/service/auth_service.go b/internal/service/auth_service.go
index eeb5c8e..9cbc105 100644
--- a/internal/service/auth_service.go
+++ b/internal/service/auth_service.go
@@ -28,6 +28,10 @@ import (
const MaxOAuthPendingSessions = 256
const OAuthCleanupCount = 16
+// a dummy hash to check when a user is not found, to prevent user enumeration
+// hardcoded to prevent having to generate a hash on every startup
+const dummyHash = "$2a$10$iFQ6./j2a.UShYQOzWh4vOlnoze5DmHI3tRY3WU4YMj3zwp.t3TnO"
+
var (
ErrUserNotFound = errors.New("user not found")
)
@@ -204,6 +208,12 @@ func (auth *AuthService) CheckUserPassword(search model.UserSearch, password str
return errors.New("user authentication failed")
}
+func (auth *AuthService) DummyCheckPassword(password string) {
+ // When a user is not found, we still want to perform a password check to prevent
+ // timing attacks that could reveal whether a user exists or not
+ bcrypt.CompareHashAndPassword([]byte(dummyHash), []byte(password))
+}
+
func (auth *AuthService) GetLocalUser(username string) *model.LocalUser {
if auth.runtime.LocalUsers == nil {
return nil
--
2.55.0
After testing the proposed fix, there is no discernible timing difference:
=== Existing user, wrong password === #1: 43.23ms #2: 43.26ms #3: 42.57ms
=== Nonexistent user === #1: 42.45ms #2: 42.11ms #3: 47.71ms
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/tinyauthapp/tinyauth"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.0.1-0.20260714134959-c22925c2fba9"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-77582"
],
"database_specific": {
"cwe_ids": [
"CWE-208"
],
"github_reviewed": true,
"github_reviewed_at": "2026-09-22T20:37:06Z",
"nvd_published_at": "2026-09-21T17:18:53Z",
"severity": "MODERATE"
},
"details": "### Summary\nIt\u0027s possible to enumerate users through a timing oracle. In other words: I can easily check if a username exists or not by observing the timing differences between logins.\n\n### PoC\nSetup a tinyauth server with a local user. It can be over the network.\n\nTry to log in with the local user, using an incorrect password: there is a noticeable delay. You know that the user exists.\n\nNow try to log in with a username that does not exist, using an incorrect password: it will complete almost immediately. You know that the user does not exist.\n\n### Expected vs actual behavior\n\nLogin attempts should take roughly the same amount of time when the user exists vs when the user does not exist.\nRight now, nonexistent user attempts are way faster, meaning if your login attempt is slow, then the username exists for sure.\n\n### Details\n\nExisting usernames will take an extra ~50 milliseconds to respond to login attempts, while non-existing usernames will take only ~50 microseconds (1000x less time) to return an incorrect password response.\n\nEven taking network traffic into consideration, it is trivial to check whether a local user exists or not.\n\n=== Existing user, wrong password ===\n #1: 50.52ms\n #2: 46.24ms\n #3: 43.57ms\n\n=== Nonexistent user ===\n #1: 43.03\u00b5s\n #2: 48.45\u00b5s\n #3: 59.33\u00b5s\n\n### Suggested fix\n\nThis can be solved by checking a dummy password hash when a user is not found before returning a query, this will mimic the exact same delay irrelevant of hardware capabilities.\n\nPotential patch:\n```\nFrom ca102773e0303f6025480efb26db379e3570a350 Mon Sep 17 00:00:00 2001\nFrom: Disyer \u003cdaniel@tohka.us\u003e\nDate: Tue, 14 Jul 2026 12:35:07 +0300\nSubject: [PATCH] fix: prevent user enumeration by means of timing attack\n\n---\n internal/controller/user_controller.go | 1 +\n internal/middleware/context_middleware.go | 1 +\n internal/service/auth_service.go | 10 ++++++++++\n 3 files changed, 12 insertions(+)\n\ndiff --git a/internal/controller/user_controller.go b/internal/controller/user_controller.go\nindex ae6c23b..2ecc996 100644\n--- a/internal/controller/user_controller.go\n+++ b/internal/controller/user_controller.go\n@@ -90,6 +90,7 @@ func (controller *UserController) loginHandler(c *gin.Context) {\n \n if err != nil {\n if errors.Is(err, service.ErrUserNotFound) {\n+ controller.auth.DummyCheckPassword(req.Password)\n controller.log.App.Warn().Str(\"username\", req.Username).Msg(\"User not found during login attempt\")\n controller.auth.RecordLoginAttempt(req.Username, false)\n controller.log.AuditLoginFailure(req.Username, \"unknown\", c.ClientIP(), \"user not found\")\ndiff --git a/internal/middleware/context_middleware.go b/internal/middleware/context_middleware.go\nindex f49c85a..f70c9e7 100644\n--- a/internal/middleware/context_middleware.go\n+++ b/internal/middleware/context_middleware.go\n@@ -244,6 +244,7 @@ func (m *ContextMiddleware) basicAuth(username string, password string) (*model.\n search, err := m.auth.SearchUser(username)\n \n if err != nil {\n+ m.auth.DummyCheckPassword(password)\n return nil, nil, fmt.Errorf(\"error searching for user: %w\", err)\n }\n \ndiff --git a/internal/service/auth_service.go b/internal/service/auth_service.go\nindex eeb5c8e..9cbc105 100644\n--- a/internal/service/auth_service.go\n+++ b/internal/service/auth_service.go\n@@ -28,6 +28,10 @@ import (\n const MaxOAuthPendingSessions = 256\n const OAuthCleanupCount = 16\n \n+// a dummy hash to check when a user is not found, to prevent user enumeration\n+// hardcoded to prevent having to generate a hash on every startup\n+const dummyHash = \"$2a$10$iFQ6./j2a.UShYQOzWh4vOlnoze5DmHI3tRY3WU4YMj3zwp.t3TnO\"\n+\n var (\n ErrUserNotFound = errors.New(\"user not found\")\n )\n@@ -204,6 +208,12 @@ func (auth *AuthService) CheckUserPassword(search model.UserSearch, password str\n return errors.New(\"user authentication failed\")\n }\n \n+func (auth *AuthService) DummyCheckPassword(password string) {\n+ // When a user is not found, we still want to perform a password check to prevent\n+ // timing attacks that could reveal whether a user exists or not\n+ bcrypt.CompareHashAndPassword([]byte(dummyHash), []byte(password))\n+}\n+\n func (auth *AuthService) GetLocalUser(username string) *model.LocalUser {\n if auth.runtime.LocalUsers == nil {\n return nil\n-- \n2.55.0\n```\n\nAfter testing the proposed fix, there is no discernible timing difference:\n\n=== Existing user, wrong password ===\n #1: 43.23ms\n #2: 43.26ms\n #3: 42.57ms\n\n=== Nonexistent user ===\n #1: 42.45ms\n #2: 42.11ms\n #3: 47.71ms",
"id": "GHSA-456h-ww26-f758",
"modified": "2026-09-22T20:37:06Z",
"published": "2026-09-22T20:37:06Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/tinyauthapp/tinyauth/security/advisories/GHSA-456h-ww26-f758"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-77582"
},
{
"type": "WEB",
"url": "https://github.com/tinyauthapp/tinyauth/pull/1004"
},
{
"type": "WEB",
"url": "https://github.com/tinyauthapp/tinyauth/commit/c22925c2fba981875d0a2b09dd3ee41c0ae4c310"
},
{
"type": "PACKAGE",
"url": "https://github.com/tinyauthapp/tinyauth"
},
{
"type": "WEB",
"url": "https://github.com/tinyauthapp/tinyauth/releases/tag/v5.1.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Tinyauth: User enumeration attack by timing oracle"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.