llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/nezhahq/nezha

GHSA-8JHQ-G4GW-RV5F

Authenticated users can read their own bcrypt password hash via GET /api/v1/profile

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
3.1
Baja
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición144 dDesde la divulgación, 27 jun 2026, 8:30 p. m.
Detección144 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
28 jun 26
19 nov 26
28 jun 26
3 ago 26
8 sept 26
14 oct 26
19 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-8JHQ-G4GW-RV5F divulgada · CVSS 3.1 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

The `GET /api/v1/profile` endpoint returns the bcrypt-hashed `Password` field of the authenticated user. While bcrypt hashes are computationally expensive to crack, exposing them over the API violates minimal disclosure and provides an attacker offline cracking capability with no rate limiting, no lockout, and no audit trail — inconsistent with the admin `listUser` endpoint which correctly omits passwords.

Details

`Password` field carries a serializable JSON tag:

`model/user.go:27`

Password string `json:"password,omitempty" gorm:"type:char(72)"`

No `json:"-"` tag is present. `omitempty` does not suppress a non-empty bcrypt hash (which always starts with `$2a$` and is 60 characters).

The `identityHandler` loads all columns (as shown in Finding 1):

`cmd/dashboard/controller/jwt.go:161`

var user model.User
if err := singleton.DB.First(&user, sess.UserID).Error; err != nil {
    return nil
}

`getProfile` embeds the full user struct:

`cmd/dashboard/controller/user.go:37-41`

return &model.Profile{
    User:    *auth.(*model.User),   // Password hash included
    ...
}, nil

Contrast with `listUser` (admin endpoint) which deliberately omits the password:

`cmd/dashboard/controller/user.go:111`

singleton.DB.Omit("password").Find(&users)

The `Omit("password")` in `listUser` proves the team is aware passwords should not be serialized, but the same protection was not applied to `getProfile`.

PoC
1. Any authenticated user sends:
   GET /api/v1/profile  (Cookie: nz-jwt=<token>)

2. Response includes:
   {"password": "$2a$10$...<bcrypt-hash>...", "agent_secret": "...", ...}

3. Attacker feeds the hash to hashcat:
   hashcat -m 3200 hash.txt wordlist.txt

4. On success, attacker recovers the plaintext password and can log in from any IP,
   bypassing rate-limiting and 2FA, or access other services where the password is reused.
Impact

Every authenticated user can extract their own bcrypt-hashed password without any special privilege. Combined with weak or reused passwords, offline cracking requires no further network interaction and bypasses all server-side rate limiting. The `bcrypt.DefaultCost` (cost factor 10) used is moderately slow but modern GPUs can crack common passwords.

Fix

Add `json:"-"` to the `Password` field in `model/user.go`:

Password string `json:"-" gorm:"type:char(72)"`

Also ensure the `identityHandler` DB query uses a column-selective query:

singleton.DB.Select("id", "username", "role", "reject_password", "token_version").First(&user, sess.UserID)

If possible, please apply for a CVE number when posting.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:H
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:L
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
github.com/nezhahq/nezha≤ 2.2.6
v1.14.14
2.2.6
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/nezhahq/nezha
Sin parche — — v1.14.14 afectada
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/nezhahq/nezha/security/advisories/GHSA-8jhq-g4gw-rv5f

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.