CVE-2023-24538: Backticks not treated as string delimiters in html/template

CVE-2023-24538 affects 142 listed versions of Go in the Dawnsentry catalogue.

9.8CVSS critical
None knownexploitation
2%EPSS (next 30 days)
6 April 2023published

Affected products and versions

The versions in the Dawnsentry catalogue this CVE affects, judged from the vendor's own advisory where there is one, otherwise from the CVE record and NVD, as each version's own page says.

Go

142 of 250 listed versions are affected. Fixed in 1.20.3, 1.19.8. The newest release, 1.27.4, is not affected.

1.20.2 1.20.1 1.20.0 1.19.7 1.19.6 1.19.5 1.19.4 1.19.3 1.19.2 1.19.1 1.19.0 1.19.0-rc2 1.18.10 1.18.9 1.18.8 1.18.7 1.18.6 1.18.5 1.18.4 1.18.3 1.18.2 1.18.1 1.18 1.17.13 1.17.12 1.17.11 1.17.10 1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.17.3 1.17.2 1.17.1 1.17 1.16.15 1.16.14 1.16.13 1.16.12 1.16.11 1.16.10 1.16.9 1.16.8 1.16.7 1.16.6 1.16.5 1.16.4 1.16.3 1.16.2 1.16.1 1.15.15 1.15.14 1.15.13 1.15.12 1.15.11 1.15.10 1.15.9 1.15.8 and 82 more

What it is

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.

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (NVD)

Published by Go on 6 April 2023. Last changed 17 June 2026.

Sources

Check one version you run: look CVE-2023-24538 up, or pick a product and version in the quick lookup.

Updated 2 December 2026.