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-24540

CVE-2023-24540: Golang Go XSS Vulnerability

CVE-2023-24540 is a cross-site scripting flaw in Golang Go caused by improper whitespace sanitization in JavaScript templates. This vulnerability allows malicious code execution in web applications.

Published: February 11, 2026

CVE-2023-24540 Overview

CVE-2023-24540 is a critical command injection vulnerability affecting Golang's html/template package. The vulnerability exists because not all valid JavaScript whitespace characters are considered to be whitespace during template sanitization. Templates containing whitespace characters outside of the character set \t\n\f\r\\u0020\\u2028\\u2029 in JavaScript contexts that also contain actions may not be properly sanitized during execution.

Critical Impact

This vulnerability enables attackers to bypass template sanitization controls, potentially leading to arbitrary script injection in applications using Go's html/template package for rendering user-controlled content in JavaScript contexts.

Affected Products

  • Golang Go (multiple versions)

Discovery Timeline

  • 2023-05-11 - CVE-2023-24540 published to NVD
  • 2025-01-24 - Last updated in NVD database

Technical Details for CVE-2023-24540

Vulnerability Analysis

The vulnerability stems from an incomplete character set definition for JavaScript whitespace characters within Go's template sanitization logic. When the html/template package processes templates that embed actions within JavaScript contexts, it relies on identifying whitespace boundaries to properly sanitize potentially dangerous content.

However, the sanitization routine only recognizes a subset of valid JavaScript whitespace characters (\t, \n, \f, \r, \\u0020, \\u2028, \\u2029). JavaScript actually recognizes additional whitespace characters as defined in the ECMAScript specification. By using these unrecognized whitespace characters, an attacker can craft malicious template content that bypasses the sanitization process entirely.

This bypass can lead to the injection of arbitrary JavaScript code into web pages generated by affected Go applications, resulting in cross-site scripting (XSS) attacks or other script-based exploits.

Root Cause

The root cause is an input validation error in Go's html/template package where the whitespace character set used for parsing JavaScript contexts does not align with the complete set of whitespace characters defined in the ECMAScript specification. This character set mismatch creates a gap in the sanitization logic that can be exploited to inject unsanitized content.

Attack Vector

An attacker can exploit this vulnerability remotely over the network by providing specially crafted input to a Go web application that uses html/template for rendering content in JavaScript contexts. The attack requires no authentication or user interaction.

The exploitation involves embedding malicious JavaScript code separated by whitespace characters that are valid in JavaScript but not recognized by Go's template sanitizer. When the template is rendered, the sanitizer fails to properly escape or neutralize the malicious content because it doesn't recognize the unusual whitespace as a token boundary.

For technical details on the vulnerability mechanism, refer to the Go.dev Issue #59721 and the Go.dev Vulnerability Report GO-2023-1752.

Detection Methods for CVE-2023-24540

Indicators of Compromise

  • Unusual Unicode whitespace characters (outside the standard set) appearing in application logs or request data
  • JavaScript execution errors in browser consoles that may indicate malformed injected scripts
  • Web application firewall alerts for XSS-like payloads containing non-standard whitespace sequences
  • Unexpected JavaScript behavior in pages rendered by Go applications using html/template

Detection Strategies

  • Deploy web application firewall (WAF) rules to detect and block requests containing suspicious Unicode whitespace characters in JavaScript contexts
  • Monitor application logs for template rendering errors or unusual character encoding patterns
  • Implement static code analysis to identify Go applications using html/template with user-controlled JavaScript contexts
  • Use SentinelOne's Singularity platform to detect anomalous process behavior indicative of successful exploitation

Monitoring Recommendations

  • Enable verbose logging for Go applications using html/template to capture template rendering details
  • Monitor web server access logs for requests containing encoded Unicode whitespace characters
  • Set up alerts for unexpected script execution patterns in client-side monitoring tools
  • Review network traffic for responses containing suspicious JavaScript patterns from Go-based services

How to Mitigate CVE-2023-24540

Immediate Actions Required

  • Update Golang to the latest patched version that addresses CVE-2023-24540
  • Audit Go applications for usage of html/template with JavaScript contexts containing user-controlled data
  • Implement additional input validation to strip or reject non-standard whitespace characters before template processing
  • Consider using Content Security Policy (CSP) headers to mitigate potential XSS impact

Patch Information

The Go team has released patches to address this vulnerability. The fix expands the whitespace character set recognized during template sanitization to include all valid JavaScript whitespace characters.

For detailed patch information, see:

  • Go.dev Changelist #491616
  • Go.dev Vulnerability Report GO-2023-1752
  • Golang Announcement Group Post

Organizations using NetApp products should also refer to NetApp Security Advisory ntap-20241115-0008.

Workarounds

  • Avoid passing user-controlled input directly into JavaScript contexts within Go templates
  • Implement strict input validation to filter out non-standard Unicode whitespace characters before template processing
  • Use the text/template package instead of html/template for non-HTML output, with manual escaping
  • Apply defense-in-depth measures such as CSP headers to limit the impact of any successful injection
bash
# Check Go version and update
go version
# Update to latest patched Go version
go install golang.org/dl/go1.20.4@latest
go1.20.4 download

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.24%

  • 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
  • NVD-CWE-noinfo

  • CWE-77
  • Technical References
  • Golang Announcement Group Post

  • NetApp Security Advisory ntap-20241115-0008
  • Vendor Resources
  • Go.dev Cl #491616

  • Go.dev Issue #59721

  • Go.dev Vulnerability Report GO-2023-1752
  • Related CVEs
  • CVE-2023-24538: Golang Go Template 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