CVE-2023-24538
CRITICAL 9.8CVSS 3.1Backticks not treated as string delimiters in html/template
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.
- Published
- 6 Apr 2023
- Last modified
- 17 Jun 2026
- Assigned by
- security@golang.org
- NVD status
- Modified
- Weakness
- CWE-94
- Also known as
- BIT-golang-2023-24538GO-2023-1703
- Sources
- NVDJSONOSV GO-2023-1703JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | CRITICAL 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 134c704f-9b21-4f2e-91b3-4a467353bcc0 (Secondary) | CVSS 3.1 | CRITICAL 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | golang | gocpe:2.3:a:golang:go:*:*:*:*:*:*:*:* |
< 1.19.8 | 1.19.8 |
| NVD | golang | gocpe:2.3:a:golang:go:*:*:*:*:*:*:*:* |
>= 1.20.0, < 1.20.3 | 1.20.3 |
| OSV | Go | stdlib | < 1.19.8; >= 1.20.0-0, < 1.20.3 | 1.19.8, 1.20.3 |
References
- https://go.dev/cl/482079 · Patch, FIX
- https://go.dev/issue/59234 · Issue Tracking, Patch, REPORT
- https://groups.google.com/g/golang-announce/c/Xdv6JL9ENs8 · Mailing List, WEB
- https://pkg.go.dev/vuln/GO-2023-1703 · Vendor Advisory
- https://security.gentoo.org/glsa/202311-09
- https://security.netapp.com/advisory/ntap-20241115-0007/
History
- 25 Nov 2026 20:36 UTC · NVD: first stored (published 6 Apr 2023)
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 5 Apr 2023)