CVE-2023-24538Golang Go
Critical 9.8 No auth needed
Follow: this CVE · Golang · Golang Go We alert you by email or Slack (account required).
- Priority
- 74
- CVSS 3.1
- 9.8
- EPSS
- 2.4% probability of exploitation in 30 days · percentile 85
- Auth required
- No
- Published
- Apr 6, 2023
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-94
- SSVC (CISA)
- Exploitation: none · Automatable: no · Technical impact: total
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
What happens
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.
What to do
- Apply the vendor's security update for Go.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| Go | stdlib |
< 1.19.8 |
1.19.8 |
go get stdlib@v1.19.8 |
| Go | stdlib |
≥ 1.20.0-0 < 1.20.3 |
1.20.3 |
go get stdlib@v1.20.3 |
Per OSV / GitHub Advisories (GO-2023-1703). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| golang | go | < 1.19.8 |
| golang | go | ≥ 1.20.0 < 1.20.3 |
Official advisories
- Red Hat Security Advisory: container-tools:4.0 security and bug fix update · Red Hat · RHSA-2023:6938 · Oct 21, 2024 Medium
- Red Hat Security Advisory: container-tools:rhel8 security and bug fix update · Red Hat · RHSA-2023:6939 · Oct 21, 2024 Medium
- Red Hat Security Advisory: Red Hat OpenStack Platform 16.2.5 (collectd-libpod-stats) security update · Red Hat · RHSA-2023:5964 · Oct 2, 2024 High
Also: Red Hat (+9)
Vendor, CERT and distribution advisories that name this CVE. Original titles.
Official sources
References
Links published by the sources. Open them with care.
- go.dev Patch
- go.dev Issue Tracking Patch
- groups.google.com Mailing List
- pkg.go.dev Vendor Advisory
- security.gentoo.org
- security.netapp.com