GHSA-8JHQ-G4GW-RV5F
Authenticated users can read their own bcrypt password hash via GET /api/v1/profile
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| 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 |
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
...
}, nilContrast 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.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/nezhahq/nezha |
Sin parche | — | — | v1.14.14 afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/nezhahq/nezha/security/advisories/GHSA-8jhq-g4gw-rv5fLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
