GHSA-8FGR-WX8P-V6Q7
Dashboard persists unbounded JSON arrays/maps and re-parses them without a size limit in AfterFind
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-8FGR-WX8P-V6Q7 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The Nezha dashboard persists attacker-supplied JSON arrays/maps from
low-privileged members into database columns and re-parses them without any size
bound in GORM AfterFind hooks. A member holding nezha:server:write or
nezha:service:write can store an arbitrarily large ddns_profiles / skip_servers
value; every subsequent dashboard read (server/service list) unmarshals it
fully into memory, causing persistent memory exhaustion. The write endpoints
also bind JSON without a body-size limit.
Details
Read side (unbounded unmarshal):
model/server.go:530 func (s *Server) AfterFind(tx *gorm.DB) error
model/server.go:532 json.Unmarshal([]byte(s.DDNSProfilesRaw), &s.DDNSProfiles)
model/service.go:358 func (m *Service) AfterFind(tx *gorm.DB) error
model/service.go:360 json.Unmarshal([]byte(m.SkipServersRaw), &m.SkipServers)
Write side (unbounded bind + persist):
cmd/dashboard/controller/controller.go:150
auth.PATCH("/server/:id", restScopeMiddleware(model.ScopeServerWrite), ...)
cmd/dashboard/controller/controller.go:171-172
auth.POST("/service", restScopeMiddleware(model.ScopeServiceWrite), ...)
auth.PATCH("/service/:id", restScopeMiddleware(model.ScopeServiceWrite), ...)
model/server_api.go:30 DDNSProfiles []uint64 `json:"ddns_profiles"`
model/service_api.go:20 SkipServers map[uint64]bool `json:"skip_servers"`
No http.MaxBytesReader or equivalent is applied to these routes (the only
max-body code is on MCP/notification endpoints). ShouldBindJSON parses the full
request body, the slice/map is marshalled into the raw column in BeforeSave, and
AfterFind unmarshals it again on every read. Validation has no length/entry
bound for either field.
Proof of concept
Local controlled validation (no live exploitation):
- Run Nezha v2.6.1 with a non-admin member that holds nezha:server:write and/or
- Same-package reproduction: call Server.AfterFind with a ddns_profiles_raw of
- End-to-end: PATCH /server/:id with a ddns_profiles array of ~1M entries (or
Impact
CWE-770 (Allocation of Resources Without Limits or Throttling). Authenticated,
persistent cross-tenant DoS: a low-privilege member can store unbounded JSON
that is re-parsed on every dashboard read, exhausting memory and potentially
crashing the process. Affected: multi-user Nezha deployments with non-admin
members or scoped PATs. Default single-admin deployments are not affected.
Patches
Fixed in v2.6.2 (commit 8bcaf092). The fix also covers related vectors found while triaging this report:
- `skip_servers` / alert rule `ignore`: `false` entries are dropped; unknown servers are dropped from allow-sets, while deny-sets still require every server to exist.
- `ddns_profiles`, `fail_trigger_tasks` / `recover_trigger_tasks` (services and alert rules), and cron `servers` are deduplicated before permission checks, and unknown IDs are dropped. Before the fix, duplicate IDs also amplified work at runtime: `UpdateDDNS` started one outbound DNS update per duplicate profile, and `SendTriggerTasks` fired the same cron once per duplicate.
- `override_ddns_domains` is now limited to bound profiles and goes through the same IDN validation and per-profile limit (256) as profile domains.
- DDNS profile domains are limited to 256 and alert rules to 64 sub-rules.
- All `/api/v1` request bodies are limited to 1 MiB.
- `AfterFind` normalizes the same collections again, so oversized data persisted before the upgrade is collapsed when it is loaded.
Workarounds
Do not grant `nezha:server:write`, `nezha:service:write`, `nezha:cron:write`, `nezha:alertrule:write` or `nezha:ddns:write` to untrusted members or PATs until you upgrade.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
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 |
2.6.2Arsenal 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-8fgr-wx8p-v6q7Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
