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

CVE-2021-20323: Redhat Keycloak XSS Vulnerability

CVE-2021-20323 is a POST-based reflected Cross Site Scripting vulnerability in Redhat Keycloak that allows attackers to inject malicious scripts. This article covers technical details, affected versions, and mitigation.

Published: February 25, 2026

CVE-2021-20323 Overview

A POST-based reflected Cross-Site Scripting (XSS) vulnerability has been identified in Red Hat Keycloak, a popular open-source identity and access management solution. This vulnerability allows attackers to inject malicious scripts through POST requests, which are then reflected back to users in the application's response. When a victim interacts with a crafted malicious request, the injected script executes within their browser context, potentially leading to session hijacking, credential theft, or unauthorized actions on behalf of the authenticated user.

Critical Impact

This XSS vulnerability in Keycloak can be exploited to steal authentication tokens, hijack user sessions, and compromise the security of applications relying on Keycloak for identity management across the network.

Affected Products

  • Red Hat Keycloak (all versions prior to patch)

Discovery Timeline

  • 2022-03-25 - CVE CVE-2021-20323 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-20323

Vulnerability Analysis

This vulnerability is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation), commonly known as Cross-Site Scripting. The flaw exists in how Keycloak processes and reflects user-supplied input from POST request parameters back to the client without proper sanitization or encoding.

Unlike traditional GET-based XSS attacks where malicious payloads are embedded in URL parameters, this POST-based variant requires attackers to craft forms or leverage techniques like cross-site request forgery (CSRF) to trick victims into submitting malicious POST requests. The reflected nature means the payload is not stored on the server but is immediately echoed back in the response, making it exploitable through social engineering or by embedding malicious forms on attacker-controlled websites.

The network-based attack vector combined with the requirement for user interaction means that successful exploitation typically involves phishing or similar techniques to lure victims into triggering the malicious request.

Root Cause

The root cause of this vulnerability is insufficient input validation and output encoding in Keycloak's request handling logic. When processing POST parameters, the application fails to properly sanitize user-supplied data before including it in HTML responses. This allows specially crafted input containing JavaScript code or HTML markup to be rendered as executable content in the victim's browser rather than being displayed as plain text.

Attack Vector

The attack is conducted over the network and requires user interaction. An attacker would typically:

  1. Identify the vulnerable POST endpoint in Keycloak
  2. Craft a malicious HTML form containing XSS payload in the POST parameters
  3. Host this form on an attacker-controlled website or embed it in a phishing email
  4. Trick the victim into visiting the page and submitting the form (potentially through auto-submit techniques)
  5. When the victim's browser sends the POST request to Keycloak, the malicious script is reflected back and executes in the user's session context

The vulnerability allows the attacker to execute arbitrary JavaScript in the context of the authenticated user's session, potentially accessing sensitive data, modifying page content, or performing actions on behalf of the user. Due to the changed scope indicated in the vulnerability characteristics, the impact can extend beyond the vulnerable component to affect other applications in the Keycloak ecosystem.

For technical details on the specific vulnerable endpoints and attack patterns, refer to the Red Hat Bug Report #2013577.

Detection Methods for CVE-2021-20323

Indicators of Compromise

  • Unusual POST requests to Keycloak endpoints containing encoded JavaScript or HTML tags in parameter values
  • Web server logs showing requests with suspicious payloads like <script>, javascript:, or event handlers (onerror, onload)
  • Browser-based detection of unexpected JavaScript execution originating from Keycloak domains
  • Session tokens or cookies being exfiltrated to external domains

Detection Strategies

  • Implement Web Application Firewall (WAF) rules to detect and block XSS payloads in POST request bodies
  • Enable detailed logging on Keycloak instances to capture full POST request parameters for analysis
  • Deploy Content Security Policy (CSP) headers to restrict script execution and detect policy violations
  • Monitor for anomalous authentication patterns that may indicate session hijacking following XSS exploitation

Monitoring Recommendations

  • Review Keycloak access logs for POST requests containing suspicious character sequences and encoding patterns
  • Implement real-time alerting on CSP violation reports from client browsers
  • Monitor for unusual session activity following user interactions with external links
  • Track authentication token usage patterns to detect potential token theft scenarios

How to Mitigate CVE-2021-20323

Immediate Actions Required

  • Update Red Hat Keycloak to the latest patched version as soon as available from the vendor
  • Implement strong Content Security Policy (CSP) headers to mitigate script execution even if XSS payloads are injected
  • Deploy or configure Web Application Firewall rules to filter known XSS attack patterns in POST requests
  • Review and audit any Keycloak customizations or themes for additional input handling vulnerabilities

Patch Information

Organizations should consult the Red Hat Bug Report #2013577 for official patch information and updates from Red Hat. Apply security updates through official Red Hat channels or upgrade to a Keycloak version that addresses this vulnerability.

Workarounds

  • Deploy a reverse proxy or WAF with XSS filtering capabilities in front of Keycloak instances
  • Implement strict Content Security Policy headers including script-src 'self' to prevent inline script execution
  • Enable HTTP-Only and Secure flags on all session cookies to reduce the impact of potential token theft
  • Consider network segmentation to limit exposure of Keycloak administrative interfaces
bash
# Example CSP header configuration for Apache/Nginx to mitigate XSS impact
# Apache httpd.conf or .htaccess
Header set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors 'self';"

# Nginx configuration
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors 'self';";

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

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechRedhat Keycloak

  • SeverityMEDIUM

  • CVSS Score6.1

  • EPSS Probability66.05%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-79
  • Technical References
  • Red Hat Bug Report #2013577
  • Related CVEs
  • CVE-2023-0091: Redhat Keycloak Auth Bypass Vulnerability

  • CVE-2023-0105: Redhat Keycloak Auth Bypass Vulnerability

  • CVE-2022-3782: Keycloak Path Traversal Vulnerability

  • CVE-2023-6927: Redhat Keycloak Auth Bypass Vulnerability
Default Legacy - Prefooter | 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