CVE-2023-24538
Backticks not treated as string delimiters in html/template
Also known as BIT-golang-2023-24538, GO-2023-1703
Mitigation
- Upgrade stdlib to one of 1.19.8, 1.20.3 (or later in the same release line).
Who should check
- Projects that depend on Go package stdlib (< 1.19.8; >= 1.20.0-0, < 1.20.3)
- Anyone running Go standard library html/template < 1.19.8; >= 1.20.0-0, < 1.20.3
Vulnerability facts
- Affected
- stdlib < 1.19.8; >= 1.20.0-0, < 1.20.3
- Fixed in
- 1.19.8, 1.20.3
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 9.8 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: None
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: High
- EPSS
- 2.37% chance of exploitation in 30 days (percentile 85, 2026-11-26)
- CWE
- CWE-94
- Modified
Description
Templates do not properly consider backticks (`) as Javascript string delimiters, and do not escape them as expected. Backticks are used, since ES6, for JS template literals. If a template contains a Go template action within a Javascript template literal, the contents of the action can be used to terminate the literal, injecting arbitrary Javascript code into the Go template. As ES6 template literals are rather complex, and themselves can do string interpolation, the decision was made to simply disallow Go template actions from being used inside of them (e.g. "var a = {{.}}"), since there is no obviously safe way to allow this behavior. This takes the same approach as github.com/google/safehtml. With fix, Template.Parse returns an Error when it encounters templates like this, with an ErrorCode of value 12. This ErrorCode is currently unexported, but will be exported in the release of Go 1.21. Users who rely on the previous behavior can re-enable it using the GODEBUG flag jstmpllitinterp=1, with the caveat that backticks will now be escaped. This should be used with caution.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| Go stdlib | < 1.19.8; >= 1.20.0-0, < 1.20.3 | 1.19.8, 1.20.3 | osv |
| Go standard library html/template | < 1.19.8; >= 1.20.0-0, < 1.20.3 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2023-24538. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2023-24538.md Affected: stdlib < 1.19.8; >= 1.20.0-0, < 1.20.3 Fixed in: 1.19.8, 1.20.3 Steps: 1. Search this machine and project for stdlib (Go), Go standard library html/template: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
FAQ
Is CVE-2023-24538 being exploited?
There is no confirmed exploitation: CVE-2023-24538 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 2.37% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2023-24538?
Critical: CVSS 9.8 (v3.1, scored by CNA). Remote, no login needed.
Which versions are affected by CVE-2023-24538?
stdlib < 1.19.8; >= 1.20.0-0, < 1.20.3.
Is there a fix for CVE-2023-24538?
Yes. Fixed in 1.19.8, 1.20.3. Upgrade stdlib to one of 1.19.8, 1.20.3 (or later in the same release line).
How do I check if I'm affected by CVE-2023-24538?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.