CVE-2023-24538
CVE-2023-24538 is a critical-severity vulnerability in Golang Go with a CVSS 3.x base score of 9.8. It is not currently listed as actively exploited by CISA, and its EPSS exploit-prediction score is low. The underlying weakness is classified as CWE-94.
Key facts
- Severity: Critical (CVSS 3.x base score 9.8)
- EPSS exploit prediction: 2% (84th percentile)
- Actively exploited: Not listed in CISA KEV
- Weakness: CWE-94
- Affected product: Golang Go
- Published:
- Last 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.
Frequently asked questions
- What is CVE-2023-24538?
- 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.
- How severe is CVE-2023-24538?
- CVE-2023-24538 has a CVSS 3.x base score of 9.8, rated critical severity. It is exploitable over network with low attack complexity, requires no privileges and no user interaction. Impact on confidentiality is high, integrity high, and availability high.
- Is CVE-2023-24538 being actively exploited?
- It is not currently listed in CISA's KEV catalog. Its EPSS exploit-prediction score is 2% (84th percentile), an estimate of the probability of exploitation in the next 30 days.
- What products are affected by CVE-2023-24538?
- CVE-2023-24538 affects Golang Go. See the affected-products list for the exact vulnerable versions.
- How do I fix CVE-2023-24538?
- Review the linked vendor and NVD advisories for patched versions and mitigations, then upgrade or apply the recommended workaround. Given its critical severity, prioritise patching exposed systems.
- When was CVE-2023-24538 published?
- CVE-2023-24538 was published on 2023-04-06 and last updated on 2026-06-17.
References
- https://go.dev/cl/482079
- https://go.dev/issue/59234
- https://groups.google.com/g/golang-announce/c/Xdv6JL9ENs8
- https://pkg.go.dev/vuln/GO-2023-1703
- https://security.gentoo.org/glsa/202311-09
- https://security.netapp.com/advisory/ntap-20241115-0007/
Affected products (1)
- cpe:2.3:a:golang:go:*:*:*:*:*:*:*:*
More vulnerabilities in Golang Go
- CVE-2025-68121 — Critical (CVSS 10.0): During session resumption in crypto/tls, if the underlying Config has its ClientCAs or RootCAs fields mutated between…
- CVE-2026-27143 — Critical (CVSS 9.8): Arithmetic over induction variables in loops were not correctly checked for underflow or overflow. As a result, the…
- CVE-2024-24790 — Critical (CVSS 9.8): The various Is methods (IsPrivate, IsLoopback, etc) did not work as expected for IPv4-mapped IPv6 addresses, returning…
- CVE-2023-39320 — Critical (CVSS 9.8): The go.mod toolchain directive, introduced in Go 1.21, can be leveraged to execute scripts and binaries relative to the…
- CVE-2023-29405 — Critical (CVSS 9.8): The go command may execute arbitrary code at build time when using cgo. This may occur when running "go get" on a…
- CVE-2023-29404 — Critical (CVSS 9.8): The go command may execute arbitrary code at build time when using cgo. This may occur when running "go get" on a…
All CVEs affecting Golang Go →
Other CWE-94 (Code Injection) vulnerabilities
- CVE-2026-71499 — Critical (CVSS 10.0): cf-manager is an all-in-one dashboard for managing multiple Cloudflare accounts and services. Prior to 1.1.2,…
- CVE-2026-78287 — Critical (CVSS 10.0): Improper Control of Generation of Code ('Code Injection') vulnerability in Staggs STAGGS staggs allows Remote Code…
- CVE-2026-115252 — Critical (CVSS 10.0): The Confection WordPress Cable WordPress plugin from 0.4.0 to 0.4.7 does not perform any capability or nonce checks…
- CVE-2026-120338 — Critical (CVSS 10.0): Prefab UI's Generative UI sandbox runs caller-supplied Python inside Pyodide, Python compiled to WebAssembly, in a Deno…
- CVE-2026-61991 — Critical (CVSS 10.0): Unauthenticated Remote Code Execution (RCE) in AjaxLoadMore Cache <= 3.1.1 versions.
- CVE-2026-61564 — Critical (CVSS 10.0): AVideo is a video-sharing Platform. Prior to 8.1.0, the unauthenticated installer endpoint…