What’s Vulnerable › Vulnerabilities
CVE-2024-24785: Errors returned from JSON marshaling may break template escaping in html/template
- Severity: medium (CVSS 5.4 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 0.8% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2024-03-05 · updated 2026-06-17
Description
If errors returned from MarshalJSON methods contain user controlled data, they may be used to break the contextual auto-escaping behavior of the html/template package, allowing for subsequent actions to inject unexpected content into templates.
Affected products
- Go standard library html/template: before 1.21.8; from 1.22.0-0 before 1.22.1 — fixed in 1.21.8, 1.22.1
How to fix
Upgrade to a fixed version: Go standard library html/template 1.21.8, 1.22.1. Check the vendor advisory for mitigations.
References
- http://www.openwall.com/lists/oss-security/2024/03/08/4
- https://go.dev/cl/564196
- https://go.dev/issue/65697
- https://groups.google.com/g/golang-announce/c/5pwGVUPoMbg
- https://pkg.go.dev/vuln/GO-2024-2610
- https://security.netapp.com/advisory/ntap-20240329-0008/
- http://www.openwall.com/lists/oss-security/2024/03/08/4
- https://go.dev/cl/564196
- https://go.dev/issue/65697
- https://groups.google.com/g/golang-announce/c/5pwGVUPoMbg
- https://pkg.go.dev/vuln/GO-2024-2610
- https://security.netapp.com/advisory/ntap-20240329-0008/
Get alerted when CVE-2024-24785 or the next vulnerability affects your stack