CVE-2024-24785

published 5 Mar 2024 · updated 16 Nov 2026

Errors returned from JSON marshaling may break template escaping in html/template

5.4MediumCVSS 5.4EPSS 1%

No exploitation in the wild has been reported. EPSS puts the chance of exploitation in the next 30 days at 1%. Fixed in 1.21.8 and 1.22.1.

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

Vendors, products and packages with version ranges

VendorProductVersionsFixed
Go standard library<1.21.8, >=1.22.0-0 <1.22.11.21.8, 1.22.1

Timeline

Every event on this vulnerability

Embed

A live severity badge for an advisory, README or ticket

CVE-2024-24785 severity on Zeptric[![CVE-2024-24785](https://zeptric.io/badge/cve/CVE-2024-24785.svg)](https://zeptric.io/cve/CVE-2024-24785)