Описание
go-viper's mapstructure May Leak Sensitive Information in Logs When Processing Malformed Data
Summary
Use of this library in a security-critical context may result in leaking sensitive information, if used to process sensitive fields.
Details
OpenBao (and presumably HashiCorp Vault) have surfaced error messages from mapstructure as follows:
where this calls mapstructure.WeakDecode(...): https://github.com/openbao/openbao/blob/98c3a59c040efca724353ca46ca79bd5cdbab920/sdk/framework/field_data.go#L181-L193
Notably, WeakDecode(...) eventually calls one of the decode helpers, which surfaces the original value via strconv helpers:
& more. These are different code paths than are fixed in the previous iteration at https://github.com/go-viper/mapstructure/security/advisories/GHSA-fv92-fjc5-jj9h.
PoC
To reproduce with OpenBao:
and in a new tab:
Impact
This is an information disclosure bug with little mitigation. See https://discuss.hashicorp.com/t/hcsec-2025-09-vault-may-expose-sensitive-information-in-error-logs-when-processing-malformed-data-with-the-kv-v2-plugin/74717 for a previous version. That version was fixed, but this is in the second part of that error message (starting at '' expected a map, got 'string' -- when the field type is string and a map is provided, we see the above information leak -- the previous example had a map type field with a string value provided).
This was rated 4.5 Medium by HashiCorp in the past iteration.
Ссылки
- https://github.com/go-viper/mapstructure/security/advisories/GHSA-2464-8j7c-4cjm
- https://nvd.nist.gov/vuln/detail/CVE-2025-11065
- https://github.com/go-viper/mapstructure/commit/742921c9ba2854d27baa64272487fc5075d2c39c
- https://access.redhat.com/security/cve/CVE-2025-11065
- https://bugzilla.redhat.com/show_bug.cgi?id=2391829
- https://pkg.go.dev/vuln/GO-2025-3900
Пакеты
github.com/go-viper/mapstructure/v2
<= 2.3.0
2.4.0
Связанные уязвимости
A flaw was found in github.com/go-viper/mapstructure/v2, in the field processing component using mapstructure.WeakDecode. This vulnerability allows information disclosure through detailed error messages that may leak sensitive input values via malformed user-supplied data processed in security-critical contexts.
A flaw was found in github.com/go-viper/mapstructure/v2, in the field ...
Уязвимость библиотеки Go для декодирования общих значений карт в структуры и наоборот mapstructure, связанная с неправильной обработкой выходных данных для журналов регистрации, позволяющая нарушителю получить доступ к конфиденциальной информации