Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
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
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • 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-2026-27166

CVE-2026-27166: Discourse XSS Vulnerability

CVE-2026-27166 is an XSS vulnerability in Discourse that allows attackers to manipulate page URLs via Codepen iframes. This article covers the technical details, affected versions, security impact, and mitigation.

Published: March 20, 2026

CVE-2026-27166 Overview

Discourse, a widely-used open source discussion platform, contains an input validation vulnerability in its iframe sanitization logic. Prior to versions 2026.3.0-latest.1, 2026.2.1, and 2026.1.2, insufficient cleanup in the default Codepen allowed iframes value enables an attacker to trick users into changing the URL of the main page. This vulnerability is classified as CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS).

Critical Impact

Attackers can manipulate iframe URL handling through URL-encoded path traversal, potentially redirecting users to malicious sites or manipulating page content through the trusted Codepen iframe integration.

Affected Products

  • Discourse versions prior to 2026.3.0-latest.1
  • Discourse versions prior to 2026.2.1
  • Discourse versions prior to 2026.1.2

Discovery Timeline

  • 2026-03-19 - CVE CVE-2026-27166 published to NVD
  • 2026-03-19 - Last updated in NVD database

Technical Details for CVE-2026-27166

Vulnerability Analysis

The vulnerability stems from improper handling of URL-encoded values in iframe source attributes within Discourse's content sanitizer. The original implementation performed path traversal checks (/\.+/) directly on the raw URL value without first decoding URL-encoded characters. This oversight allowed attackers to bypass the security check by encoding path traversal sequences (such as %2F%2E%2E%2F for /../) which would pass the pattern match but resolve to malicious paths after browser decoding.

The attack leverages the trusted Codepen iframe allowlist, as Codepen iframes are permitted by default in Discourse installations. By crafting specially encoded URLs that satisfy the allowlist regex check but decode to unauthorized destinations, an attacker could manipulate where users are directed.

Root Cause

The root cause is insufficient input sanitization in the sanitizer.js module. The security check against path traversal patterns was applied to the URL-encoded value rather than the decoded value. Modern browsers automatically decode URL-encoded characters when resolving iframe sources, creating a discrepancy between what the sanitizer validates and what the browser actually loads.

Attack Vector

This is a network-based attack requiring user interaction. An attacker needs to craft a malicious post or embed containing a specially-formed iframe with URL-encoded path traversal sequences. When a victim views the content, the improperly sanitized iframe URL is processed by their browser, potentially redirecting them to an attacker-controlled page or manipulating the parent page's URL. The attack requires low privileges (an authenticated user account) to craft the malicious content.

javascript
            hrefAllowed(value, extraHrefMatchers)) ||
           (tag === "iframe" &&
             name === "src" &&
-            !value.match(/\/\.+\//) &&
-            allowedIframes.some((i) => {
-              const regex = i
-                // escape regex, keeping *
-                .replace(/[.+?^${}()|[\]\\]/g, "\\$&")
-                .replace(/\*/g, "[^/]+");
-              return new RegExp(`^${regex}.*$`, "i").test(value);
-            }))
+            (() => {
+              let decoded;
+              try {
+                decoded = decodeURIComponent(value);
+              } catch {
+                return false;
+              }
+              return (
+                !decoded.match(/\/\.+\//) &&
+                allowedIframes.some((i) => {
+                  const regex = i
+                    // escape regex, keeping *
+                    .replace(/[.+?^${}()|[\]\\]/g, "\\$&")
+                    .replace(/\*/g, "[^/]+");
+                  return new RegExp(`^${regex}.*$`, "i").test(decoded);
+                })
+              );
+            })())
         ) {

Source: GitHub Commit Update

Detection Methods for CVE-2026-27166

Indicators of Compromise

  • Unusual iframe tags with URL-encoded path sequences (e.g., %2F%2E%2E%2F, %2F%2E%2F) in post content or user submissions
  • Posts containing Codepen iframes with abnormally long or obfuscated URLs
  • User reports of unexpected redirects when viewing specific discussion threads

Detection Strategies

  • Implement content scanning rules to detect URL-encoded path traversal patterns in iframe src attributes
  • Monitor web application logs for posts containing suspicious iframe patterns matching known exploitation techniques
  • Deploy Web Application Firewall (WAF) rules to detect encoded path traversal sequences in request payloads

Monitoring Recommendations

  • Enable detailed logging on the Discourse application to capture all iframe-related content submissions
  • Set up alerts for posts containing iframes with unusual URL patterns or multiple encoding layers
  • Review moderation queues for posts flagged with embedded content from external sources

How to Mitigate CVE-2026-27166

Immediate Actions Required

  • Upgrade Discourse to version 2026.3.0-latest.1, 2026.2.1, or 2026.1.2 immediately
  • Review existing posts for potentially malicious iframe content
  • Consider temporarily disabling Codepen embeds if immediate patching is not possible

Patch Information

The vulnerability has been addressed in Discourse versions 2026.3.0-latest.1, 2026.2.1, and 2026.1.2. The fix introduces proper URL decoding before performing path traversal checks and allowlist validation. The patch ensures that the decodeURIComponent() function is applied to iframe URLs before security checks, and any decoding failures result in the iframe being rejected. For complete patch details, refer to the GitHub Commit Update and the GitHub Security Advisory GHSA-h653-cq78-vjj2.

Workarounds

  • Remove Codepen from the list of allowed iframes in Discourse settings until the patch can be applied
  • Implement server-side URL decoding and validation for all iframe sources as an additional security layer
  • Use Content Security Policy (CSP) headers to restrict iframe sources to explicitly trusted domains
bash
# Configuration example - Remove Codepen from allowed iframes
# Navigate to Admin > Settings > Content Security
# Remove 'codepen.io' from the 'allowed iframes' setting
# Or via Rails console:
SiteSetting.allowed_iframes = SiteSetting.allowed_iframes.split('|').reject { |i| i.include?('codepen') }.join('|')

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

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechDiscourse

  • SeverityMEDIUM

  • CVSS Score4.1

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:N/I:L/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-80
  • Technical References
  • GitHub Commit Update

  • GitHub Security Advisory GHSA-h653-cq78-vjj2
  • Related CVEs
  • CVE-2026-32243: Discourse XSS Vulnerability

  • CVE-2026-32273: Discourse XSS Vulnerability

  • CVE-2026-32607: Discourse XSS Vulnerability

  • CVE-2026-33411: Discourse Stored XSS 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