{"answers":{"affected":"4 open source packages ship an affected version, including github.com/go-viper/mapstructure/v2 and github.com/go-viper/mapstructure.","exploited":"There is no known exploitation of GHSA-fv92-fjc5-jj9h in the wild and no public exploit code.","fix":"Upgrade github.com/go-viper/mapstructure/v2 to 2.3.0 or later.","what":"GHSA-fv92-fjc5-jj9h is a vulnerability in github.com/go-viper/mapstructure, published on 27 Jun 2025. An attacker needs administrator access to exploit it, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-fv92-fjc5-jj9h and fix it if it is affected.\n\nWhat it is: GHSA-fv92-fjc5-jj9h is a vulnerability in github.com/go-viper/mapstructure, published on 27 Jun 2025. An attacker needs administrator access to exploit it, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-fv92-fjc5-jj9h in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- github.com/go-viper/mapstructure/v2 (Go): affected all versions; fixed in 2.3.0\n- github.com/go-viper/mapstructure/v2 (Go): affected all versions; fixed in 2.3.0\n- github.com/go-viper/mapstructure/v2 (Go): affected all versions; fixed in 2.3.0\n- github.com/go-viper/mapstructure (Go): affected all versions; no fix listed\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-fv92-fjc5-jj9h/ (Markdown: https://insights.sbomify.com/GHSA-fv92-fjc5-jj9h/index.md)","id":"GHSA-fv92-fjc5-jj9h","markdown":"https://insights.sbomify.com/GHSA-fv92-fjc5-jj9h/index.md","name":"GHSA-fv92-fjc5-jj9h","record":{"aliases":["GO-2025-3787"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["data_read"],"network_reachable":"yes","non_default_config":false,"product_category":"Go mapstructure library","requires_auth":"high_privilege","summary":"The mapstructure library may leak sensitive input values in error logs when processing malformed data, potentially exposing secrets to attackers with log access.","user_interaction":"not_required","vuln_class":"information_disclosure"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Summary\n\nUse of this library in a security-critical context may result in leaking sensitive information, if used to process sensitive fields.\n\n### Details\n\nOpenBao (and presumably HashiCorp Vault) have surfaced error messages from `mapstructure` as follows:\n\nhttps://github.com/openbao/openbao/blob/98c3a59c040efca724353ca46ca79bd5cdbab920/sdk/framework/field_data.go#L43-L50\n\n```go\n\t\t\t_, _, err := d.getPrimitive(field, schema)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error converting input for field %q: %w\", field, err)\n\t\t\t}\n```\n\nwhere this calls `mapstructure.WeakDecode(...)`: https://github.com/openbao/openbao/blob/98c3a59c040efca724353ca46ca79bd5cdbab920/sdk/framework/field_data.go#L181-L193\n\n```go\n\nfunc (d *FieldData) getPrimitive(k string, schema *FieldSchema) (interface{}, bool, error) {\n\traw, ok := d.Raw[k]\n\tif !ok {\n\t\treturn nil, false, nil\n\t}\n\n\tswitch t := schema.Type; t {\n\tcase TypeBool:\n\t\tvar result bool\n\t\tif err := mapstructure.WeakDecode(raw, \u0026result); err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\treturn result, true, nil\n```\n\nNotably, `WeakDecode(...)` eventually calls one of the decode helpers, which surfaces the original value:\n\nhttps://github.com/go-viper/mapstructure/blob/1a66224d5e54d8757f63bd66339cf764c3292c21/mapstructure.go#L679-L686\n\nhttps://github.com/go-viper/mapstructure/blob/1a66224d5e54d8757f63bd66339cf764c3292c21/mapstructure.go#L726-L730\n\nhttps://github.com/go-viper/mapstructure/blob/1a66224d5e54d8757f63bd66339cf764c3292c21/mapstructure.go#L783-L787\n\n\u0026 more.\n\n### PoC\n\nTo reproduce with OpenBao:\n\n```\n$ podman run -p 8300:8300 openbao/openbao:latest server -dev -dev-root-token-id=root -dev-listen-address=0.0.0.0:8300\n```\n\nand in a new tab:\n\n```\n$ BAO_TOKEN=root BAO_ADDR=http://localhost:8300 bao auth enable userpass\nSuccess! Enabled userpass auth method at: userpass/\n$ curl -X PUT -H \"X-Vault-Request: true\" -H \"X-Vault-Token: root\" -d '{\"password\":{\"asdf\":\"my-sensitive-value\"}}' \"http://localhost:8300/v1/auth/userpass/users/adsf\"\n{\"errors\":[\"error converting input for field \\\"password\\\": '' expected type 'string', got unconvertible type 'map[string]interface {}', value: 'map[asdf:my-sensitive-value]'\"]}\n```\n\n### Impact\n\nThis 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).\n\nThis was rated 4.5 Medium by HashiCorp in the past iteration.","ecosystems":["Go"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"mapstructure May Leak Sensitive Information in Logs When Processing Malformed Data","id":"GHSA-fv92-fjc5-jj9h","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"Go","product":null,"products":[],"type":"information_disclosure","year":"2025"},"n_packages":4,"n_references":null,"packages":[{"ecosystem":"Go","fixed":[],"introduced":["0"],"last_affected":[],"package":"github.com/go-viper/mapstructure","purl":"pkg:golang/github.com/go-viper/mapstructure","source":"GO-2025-3787"},{"ecosystem":"Go","fixed":["2.3.0"],"introduced":["0"],"last_affected":[],"package":"github.com/go-viper/mapstructure/v2","purl":null,"source":"GHSA-fv92-fjc5-jj9h"},{"ecosystem":"Go","fixed":["2.3.0"],"introduced":["0"],"last_affected":[],"package":"github.com/go-viper/mapstructure/v2","purl":"pkg:golang/github.com/go-viper/mapstructure/v2","source":"GHSA-fv92-fjc5-jj9h"},{"ecosystem":"Go","fixed":["2.3.0"],"introduced":["0"],"last_affected":[],"package":"github.com/go-viper/mapstructure/v2","purl":"pkg:golang/github.com/go-viper/mapstructure/v2","source":"GO-2025-3787"}],"products":null,"published":"2025-06-27","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"The mapstructure library may leak sensitive input values in error logs when processing malformed data, potentially exposing secrets to attackers with log access.","url":"https://insights.sbomify.com/GHSA-fv92-fjc5-jj9h/"}