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-2025-54365

CVE-2025-54365: Fastapi Guard XSS Vulnerability

CVE-2025-54365 is an XSS flaw in Fastapi Guard that allows attackers to bypass regex patterns by exceeding character limits in script tag attributes. This article covers technical details, affected versions, and mitigation.

Published: April 29, 2026

CVE-2025-54365 Overview

A security bypass vulnerability has been identified in fastapi-guard, a security library for FastAPI that provides middleware for IP control, request logging, and penetration attempt detection. In version 3.0.1, the regular expression patterns designed to mitigate ReDoS (Regular Expression Denial of Service) vulnerabilities contain a flaw that allows attackers to bypass security controls. The patches that were implemented to limit string length fail to properly validate inputs that exceed the defined limits, specifically when script tag attributes exceed 100 characters.

Critical Impact

Attackers can bypass security protections in fastapi-guard by crafting malicious payloads with script tag attributes exceeding 100 characters, allowing potential XSS attacks and penetration attempts to evade detection.

Affected Products

  • fastapi-guard fastapi_guard version 3.0.1
  • Applications using fastapi-guard middleware for security controls
  • FastAPI applications relying on fastapi-guard for input validation and XSS prevention

Discovery Timeline

  • 2025-07-23 - CVE CVE-2025-54365 published to NVD
  • 2025-10-09 - Last updated in NVD database

Technical Details for CVE-2025-54365

Vulnerability Analysis

This vulnerability represents a classic input validation bypass in regex-based security controls. The fastapi-guard library implements regular expression patterns to detect malicious script tags and other penetration attempts. In version 3.0.1, a ReDoS mitigation was applied that attempted to limit the length of matched strings to prevent algorithmic complexity attacks. However, this length limitation contains a critical flaw: it fails to properly handle inputs that exceed the defined character limit.

When an attacker crafts a payload where the attributes of a <script> tag exceed 100 characters, the regex pattern fails to match the input entirely rather than rejecting it. This allows the malicious payload to pass through the security middleware undetected, effectively rendering the XSS and penetration detection capabilities useless against sufficiently long payloads.

Root Cause

The root cause stems from improper regex pattern design (CWE-1333: Inefficient Regular Expression Complexity) combined with improper input validation (CWE-20). The regex patterns were modified to include length limitations as a ReDoS mitigation, but the implementation assumes that limiting the match length would also reject longer inputs. Instead, inputs exceeding the length threshold simply fail to match and are allowed through without triggering security alerts.

Attack Vector

The vulnerability is exploitable over the network without authentication. An attacker can craft HTTP requests containing malicious script tags with attributes exceeding 100 characters. These payloads bypass the regex-based detection mechanisms in fastapi-guard, allowing:

  1. XSS Attack Bypass: Malicious JavaScript payloads embedded in long script tags evade detection
  2. Penetration Detection Bypass: Security monitoring fails to log or block malicious requests
  3. Security Control Circumvention: The entire middleware protection layer becomes ineffective for crafted payloads

The fix implemented in version 3.0.2 addresses this by modifying regex patterns to use appropriate length limitations that properly handle edge cases. As seen in the patch for cloud_handler.py:

python
# Before (vulnerable pattern with implicit length issues)
pattern = r'href=[\"\\'](https://download\\.microsoft\\.com/' r'.*?\\.json)[\"\\']'

# After (fixed pattern with explicit length bounds)
pattern = r'href=[\"\\'](https://download\\.microsoft\\.com/.{1,500}?\\.json)[\"\\']'

Source: GitHub Commit

Detection Methods for CVE-2025-54365

Indicators of Compromise

  • HTTP requests containing unusually long script tag attributes (exceeding 100 characters)
  • Web application logs showing requests with extended attribute strings in HTML tags
  • Failed security alerts where similar shorter payloads would normally trigger detection

Detection Strategies

  • Review fastapi-guard version deployed in production environments and verify version is 3.0.2 or later
  • Implement additional WAF rules to detect script tags with attributes exceeding normal lengths
  • Audit application logs for requests containing suspicious HTML patterns that bypass built-in detection
  • Deploy behavioral analysis to identify anomalous request patterns targeting the middleware

Monitoring Recommendations

  • Enable verbose logging in FastAPI applications to capture all incoming request payloads
  • Monitor for XSS attack patterns in downstream application layers that may indicate bypass
  • Set up alerts for requests with unusual content lengths or patterns matching script injection attempts
  • Correlate web server logs with application-level security events to identify detection gaps

How to Mitigate CVE-2025-54365

Immediate Actions Required

  • Upgrade fastapi-guard to version 3.0.2 or later immediately
  • Review application logs for any evidence of exploitation attempts using long script tag attributes
  • Implement additional input validation at the application layer as defense-in-depth
  • Consider deploying a Web Application Firewall (WAF) with robust XSS detection capabilities

Patch Information

The vulnerability has been fixed in fastapi-guard version 3.0.2. The security patches address the regex pattern bypass by implementing proper length boundary handling. Organizations should update their Python dependencies to include the patched version.

For detailed patch information, refer to the GitHub Security Advisory and the relevant commits:

  • Commit 0829292
  • Commit d9d50e8

Workarounds

  • Implement additional regex patterns at the application level that explicitly check for and reject inputs with script tag attributes exceeding safe lengths
  • Deploy a WAF or reverse proxy with XSS detection capabilities upstream of the FastAPI application
  • Add custom middleware to normalize and truncate suspicious HTML-like content before it reaches fastapi-guard
  • Consider input length validation at the API gateway level to reject abnormally large payloads
bash
# Upgrade fastapi-guard to patched version
pip install --upgrade fastapi-guard>=3.0.2

# Verify installed version
pip show fastapi-guard | grep Version

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

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechFastapi Guard

  • SeverityHIGH

  • CVSS Score7.8

  • EPSS Probability0.19%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:H/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-20

  • CWE-1333
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Commit Update

  • GitHub Security Advisory
  • Related CVEs
  • CVE-2025-53539: Fastapi Guard DOS Vulnerability

  • CVE-2025-46814: FastAPI Guard 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