CVE-2023-24538

Backticks not treated as string delimiters in html/template

Critical · published April 6, 2023

CVSS v3.1
9.8
EPSS
2%
Percentile
83.0
In the wild
Unconfirmed
What it is

🚨 A sneaky JavaScript vulnerability lurks in Go templates, allowing attackers to inject arbitrary code through backticks! 🔥 Think of this as a restaurant where the chef mistakenly accepts orders written in shorthand. If an ingredient is misinterpreted, they could accidentally serve a dish with a dangerous allergen that was implied but never listed — it's unsafe and unexpected! An attacker can exploit this by injecting their own JavaScript into the Go template, leading to full control over the affected application. This could result in data theft, unauthorized actions, or a complete compromise of the server's security. It's as serious as a chef serving food that could harm diners!

Put simply

Think of this as a restaurant where the chef mistakenly accepts orders written in shorthand. If an ingredient is misinterpreted, they could accidentally serve a dish with a dangerous allergen that was implied but never listed — it's unsafe and unexpected! This vulnerability occurs because Go templates do not escape backticks correctly within JavaScript template literals, allowing arbitrary code execution. Essentially, the contents of a Go template action can terminate the JavaScript string, leading to injection attacks.

What to do

An attacker can exploit this by injecting their own JavaScript into the Go template, leading to full control over the affected application. This could result in data theft, unauthorized actions, or a complete compromise of the server's security. It's as serious as a chef serving food that could harm diners! To remediate this, update to Go 1.21 where the fix is included, and avoid using Go template actions inside JavaScript template literals. If you must use the old behavior for compatibility, proceed with caution and set the GODEBUG flag to re-enable it. You've got this! Follow the steps to secure your application and keep those backticks in check! 🛡️

The record
Technical detail
CVSS v3.1
9.8 · CRITICAL
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.02281 · 83.0th percentile
Published
2023-04-06T15:50Z
EPSS history
Timeline
  • 06 APR 15:50Z
    Backticks not treated as string delimiters in html/template
    cvelistv5