The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2023-24538

CVE-2023-24538: Golang Go Template XSS Vulnerability

CVE-2023-24538 is a cross-site scripting flaw in Golang Go templates involving improper handling of JavaScript backticks. Attackers can inject arbitrary code via template literals. This article covers technical details, affected versions, impact, and mitigation strategies.

Published: February 11, 2026

CVE-2023-24538 Overview

CVE-2023-24538 is a critical code injection vulnerability affecting the Go programming language's html/template and text/template packages. The vulnerability stems from improper handling of backtick characters (`) which are used as JavaScript string delimiters in ES6 template literals. When a Go template contains an action within a JavaScript template literal, attackers can exploit this flaw to terminate the literal prematurely and inject arbitrary JavaScript code.

Critical Impact

This vulnerability allows remote attackers to inject arbitrary JavaScript code into web applications built with Go templates, potentially leading to complete compromise of user sessions, data theft, and full application takeover through Cross-Site Scripting (XSS) attacks.

Affected Products

  • Golang Go (versions prior to the security patch)
  • Applications using Go's html/template or text/template packages with JavaScript template literals
  • Web applications that dynamically generate JavaScript code using Go templates

Discovery Timeline

  • 2023-04-06 - CVE-2023-24538 published to NVD
  • 2025-02-12 - Last updated in NVD database

Technical Details for CVE-2023-24538

Vulnerability Analysis

This vulnerability exists in Go's template engine, which fails to recognize backticks as JavaScript string delimiters. Since the introduction of ES6, backticks have been used for template literals in JavaScript, allowing for multi-line strings and string interpolation. The Go template engine's escaping mechanism does not account for this syntax, creating a dangerous security gap.

When a Go template action (denoted by {{.}}) is placed within a JavaScript template literal, the action's output is not properly escaped. This allows an attacker to craft input containing backticks that terminate the JavaScript template literal, followed by arbitrary JavaScript code that will be executed in the victim's browser context.

The complexity of ES6 template literals, which themselves support string interpolation via ${expression} syntax, made implementing safe escaping impractical. The Go team's solution was to disallow Go template actions entirely within JavaScript template literals, following the same approach taken by github.com/google/safehtml.

Root Cause

The root cause is an incomplete escaping implementation in Go's template packages. The html/template package was designed to automatically escape content based on the surrounding context (HTML, JavaScript, CSS, etc.), but it failed to account for the ES6 backtick syntax introduced in modern JavaScript. This oversight means that while single and double quotes were properly escaped within JavaScript contexts, backticks were not recognized as string delimiters requiring special handling.

Attack Vector

The attack vector is network-based, requiring no privileges or user interaction. An attacker can exploit this vulnerability by:

  1. Identifying a Go-based web application that uses templates to generate JavaScript code
  2. Injecting user-controlled data that contains backticks followed by malicious JavaScript
  3. When the template is rendered, the backtick terminates the JavaScript template literal
  4. The subsequent attacker-controlled content is interpreted as executable JavaScript

The vulnerability is particularly dangerous because the injected JavaScript code executes in the context of the victim's browser session, providing access to cookies, session tokens, and the ability to perform actions on behalf of the authenticated user.

Detection Methods for CVE-2023-24538

Indicators of Compromise

  • Unexpected JavaScript syntax errors in server-generated pages containing Go template actions
  • Detection of backtick characters in user input being reflected in JavaScript contexts
  • Web application firewall logs showing attempts to inject backtick characters followed by JavaScript code
  • Anomalous client-side JavaScript execution patterns in browser security monitoring

Detection Strategies

  • Scan Go application source code for patterns like var a = {{.}} within JavaScript template literal contexts
  • Implement Content Security Policy (CSP) headers to detect and report inline script injection attempts
  • Deploy web application firewalls with rules to detect JavaScript injection patterns containing backticks
  • Monitor application logs for template parsing errors with ErrorCode 12 (introduced in the fix)

Monitoring Recommendations

  • Enable verbose logging for template parsing operations to capture error codes
  • Implement client-side JavaScript error monitoring to detect unexpected syntax errors
  • Configure security information and event management (SIEM) rules to alert on potential XSS patterns
  • Regularly audit application code for unsafe template patterns using static analysis tools

How to Mitigate CVE-2023-24538

Immediate Actions Required

  • Upgrade Go to version 1.19.8, 1.20.3, or later which contain the security fix
  • Audit all Go templates for patterns that place template actions within JavaScript template literals
  • Implement input validation to sanitize user-controlled data before template rendering
  • Deploy Content Security Policy headers to mitigate the impact of any successful injection

Patch Information

The Go team has released patches addressing this vulnerability. With the fix applied, Template.Parse returns an error when it encounters templates containing Go actions within JavaScript template literals. The error includes an ErrorCode of value 12, which is exported starting with Go 1.21.

For detailed patch information, see the Go.dev Code Review and the Go.dev Vulnerability Report. Additional vendor advisories are available from Gentoo GLSA 202311-09 and NetApp Security Advisory.

Workarounds

  • Use the GODEBUG flag jstmpllitinterp=1 to re-enable the previous behavior with backticks now being escaped (use with caution as noted in the advisory)
  • Refactor templates to avoid placing Go template actions within JavaScript template literals entirely
  • Move dynamic data injection from inline JavaScript to data attributes or JSON endpoints
  • Implement strict output encoding for all user-controlled data rendered in JavaScript contexts

If upgrading is not immediately possible, the recommended approach is to restructure templates to separate Go template actions from JavaScript template literals entirely. For example, instead of embedding template actions directly in JavaScript, pass data through HTML data attributes and access them via JavaScript DOM methods.

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechGolang

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability0.65%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-94
  • Technical References
  • Golang Announcement Group

  • Gentoo GLSA 202311-09

  • NetApp Security Advisory ntap-20241115-0007
  • Vendor Resources
  • Go.dev Code Review

  • Go.dev Issue Tracker

  • Go.dev Vulnerability Report
  • Related CVEs
  • CVE-2023-24540: Golang Go XSS Vulnerability

  • CVE-2023-3978: Golang Networking XSS Vulnerability

  • CVE-2025-68121: Golang Go Auth Bypass Vulnerability

  • CVE-2025-47911: Go html.Parse DoS Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English