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-2021-23899

CVE-2021-23899: OWASP Json-Sanitizer XSS Vulnerability

CVE-2021-23899 is a cross-site scripting flaw in OWASP json-sanitizer that enables attackers to inject arbitrary HTML or XML into documents. This article covers the technical details, affected versions, and mitigation.

Published: February 25, 2026

CVE-2021-23899 Overview

CVE-2021-23899 is a critical injection vulnerability affecting OWASP json-sanitizer versions prior to 1.2.2. The vulnerability allows an attacker to inject arbitrary HTML or XML content into embedding documents through crafted input that causes the sanitizer to emit closing SCRIPT tags and CDATA section delimiters. This improper neutralization of special elements can lead to Cross-Site Scripting (XSS) attacks and other injection-based exploits when the sanitized JSON is embedded in HTML or XML documents.

Critical Impact

Attackers can inject arbitrary HTML or XML content into documents that embed json-sanitizer output, potentially leading to XSS attacks, session hijacking, and unauthorized data access.

Affected Products

  • OWASP json-sanitizer versions prior to 1.2.2

Discovery Timeline

  • 2021-01-13 - CVE-2021-23899 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-23899

Vulnerability Analysis

The OWASP json-sanitizer library is designed to sanitize JSON content to make it safe for embedding in HTML and XML documents. However, versions before 1.2.2 contain a flaw in how certain special character sequences are processed. When handling crafted input, the library may inadvertently emit closing </SCRIPT> tags or CDATA section delimiters (]]>) within the output.

This behavior is particularly dangerous because the json-sanitizer is specifically intended to produce output safe for embedding in script contexts. When closing script tags or CDATA delimiters escape sanitization, an attacker can break out of the intended context and inject malicious content directly into the hosting document.

The vulnerability is classified under CWE-611 (Improper Restriction of XML External Entity Reference), though the attack surface extends beyond pure XXE to include HTML injection scenarios common in web applications that embed JSON data within script tags.

Root Cause

The root cause lies in insufficient handling of special delimiter sequences within the json-sanitizer's output encoding logic. The library failed to properly escape or neutralize character sequences that function as context terminators in HTML (</SCRIPT>) and XML (]]>) documents. When malicious input containing these sequences is processed, they pass through to the output, allowing attackers to prematurely close the embedding context.

Attack Vector

This vulnerability is exploitable over the network without any authentication or user interaction requirements. An attacker can submit specially crafted JSON input to an application using a vulnerable version of json-sanitizer. When the sanitized output is embedded in an HTML page within a <script> tag or in an XML document within a CDATA section, the attacker-controlled closing delimiters terminate the legitimate context.

From that point, the attacker can inject arbitrary HTML elements, JavaScript code, or XML content. In a typical web application scenario, this could lead to stored or reflected XSS attacks, enabling session hijacking, credential theft, defacement, or malware distribution to end users.

The attack requires no special privileges and can be executed by any user capable of submitting input that will be processed by the vulnerable sanitizer and subsequently embedded in a document served to victims.

Detection Methods for CVE-2021-23899

Indicators of Compromise

  • Unusual JSON responses containing </script> or ]]> sequences in unexpected locations
  • Web application logs showing crafted input strings designed to break out of script or CDATA contexts
  • Client-side errors or unexpected script termination in pages embedding sanitized JSON
  • Reports of XSS attacks originating from JSON-embedded content

Detection Strategies

  • Review application dependencies to identify usage of OWASP json-sanitizer versions prior to 1.2.2
  • Implement Web Application Firewall (WAF) rules to detect attempts to inject </script> or ]]> sequences in JSON input
  • Deploy Content Security Policy (CSP) headers to mitigate the impact of successful injection attacks
  • Monitor application logs for patterns indicative of injection attempts targeting JSON handling

Monitoring Recommendations

  • Enable verbose logging for JSON processing components to capture suspicious input patterns
  • Implement real-time alerting on WAF detections related to script injection attempts
  • Establish baseline behavior for JSON endpoints and alert on anomalous input patterns
  • Utilize Software Composition Analysis (SCA) tools to continuously monitor for vulnerable dependencies

How to Mitigate CVE-2021-23899

Immediate Actions Required

  • Upgrade OWASP json-sanitizer to version 1.2.2 or later immediately
  • Audit all applications using json-sanitizer to identify vulnerable deployments
  • Implement additional output encoding when embedding sanitized JSON in HTML or XML as a defense-in-depth measure
  • Review application logs for evidence of exploitation attempts

Patch Information

OWASP has released version 1.2.2 of json-sanitizer which addresses this vulnerability. The fix ensures that closing SCRIPT tags and CDATA section delimiters are properly escaped in the output. The patch can be reviewed in the GitHub commit and the full changes between versions are available in the version comparison.

For Maven-based projects, update your pom.xml to specify version 1.2.2 or later. For Gradle projects, update your dependency declaration accordingly.

Workarounds

  • If immediate upgrade is not possible, implement additional server-side output encoding that specifically targets </script> and ]]> sequences before embedding json-sanitizer output
  • Use Content Security Policy headers with strict script-src directives to limit the impact of successful injections
  • Consider isolating JSON data in separate endpoints rather than embedding directly in HTML documents
  • Implement input validation to reject or sanitize input containing suspicious delimiter sequences before processing
bash
# Maven dependency update example
# Update pom.xml to use patched version
mvn versions:use-latest-releases -Dincludes=com.mikesamuel:json-sanitizer
mvn dependency:tree | grep json-sanitizer
# Verify version is 1.2.2 or later

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

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechOwasp Json Sanitizer

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability0.44%

  • 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-611
  • Technical References
  • Google Groups Support Discussion
  • Vendor Resources
  • GitHub Commit Reference

  • GitHub Version Comparison
  • Latest CVEs
  • CVE-2026-35467: Browser API Key Information Disclosure

  • CVE-2026-35466: cveInterface.js XSS Vulnerability

  • CVE-2026-30252: ZenShare Suite XSS Vulnerability

  • CVE-2026-30251: ZenShare Suite v17.0 XSS 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