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-2026-22031

CVE-2026-22031: Fastify Middie Auth Bypass Vulnerability

CVE-2026-22031 is an authentication bypass flaw in @fastify/middie allowing attackers to circumvent middleware protections using URL-encoded paths. This article covers technical details, affected versions, and mitigations.

Published: January 23, 2026

CVE-2026-22031 Overview

A security vulnerability exists in @fastify/middie, the plugin that adds middleware support to Fastify web framework. This authorization bypass vulnerability allows attackers to circumvent middleware-based access controls by exploiting inconsistent URL decoding between the middleware engine and the underlying Fastify router.

The vulnerability enables attackers to bypass path-based middleware protections using URL-encoded characters. For example, a protected /admin endpoint can be accessed using /%61dmin (where %61 is the URL-encoded form of 'a'). The middleware engine fails to match the encoded path and skips execution, while Fastify's router correctly decodes the path and routes the request to the protected handler.

Critical Impact

Attackers can bypass authentication and authorization middleware to access protected endpoints, potentially exposing sensitive administrative functions and data without proper security constraints.

Affected Products

  • @fastify/middie versions prior to 9.1.0
  • Fastify applications using path-based middleware protection
  • Node.js web applications relying on @fastify/middie for access control

Discovery Timeline

  • 2026-01-19 - CVE CVE-2026-22031 published to NVD
  • 2026-01-19 - Last updated in NVD database

Technical Details for CVE-2026-22031

Vulnerability Analysis

This vulnerability stems from a path matching inconsistency between the middleware engine and Fastify's routing layer. When middleware is registered with a specific path prefix (such as /admin), the middleware engine performs path matching against the raw, encoded URL. However, Fastify's internal router (find-my-way) decodes URL-encoded characters before matching routes.

This creates a security gap where an attacker can craft a request with URL-encoded path segments that bypass middleware checks while still being correctly routed to the intended handler. The attack requires network access and low privileges, but can result in unauthorized access to protected resources with potential cross-scope impact.

Root Cause

The root cause is classified under CWE-177 (Improper Handling of URL Encoding). The middleware engine was not decoding URL-encoded paths before performing prefix matching, creating an inconsistency with Fastify's router behavior. This allowed encoded paths to slip through middleware checks while still being recognized by the underlying route handlers.

Attack Vector

The attack vector is network-based and exploits the URL encoding inconsistency. An attacker identifies a protected endpoint (e.g., /admin) and crafts a request using URL-encoded equivalents of path characters. For instance, /admin becomes /%61dmin, /%2561dmin, or other encoding variations. The middleware sees /%61dmin and determines it doesn't match the /admin prefix, allowing the request to pass without executing the middleware. Fastify's router then decodes the path and correctly routes it to the /admin handler, bypassing any authentication or authorization middleware.

javascript
// Security patch in lib/engine.js - fix: decode paths before matching (#245)
 
const reusify = require('reusify')
const { pathToRegexp } = require('path-to-regexp')
+const FindMyWay = require('find-my-way')

function middie (complete) {
  const middlewares = []

Source: GitHub Commit Update

The fix introduces find-my-way to ensure consistent path decoding before matching, aligning the middleware engine's behavior with Fastify's router.

Detection Methods for CVE-2026-22031

Indicators of Compromise

  • HTTP requests containing URL-encoded path segments targeting protected endpoints (e.g., /%61dmin, /%2Fadmin)
  • Successful responses from administrative or protected routes without corresponding authentication middleware execution
  • Unusual access patterns to sensitive endpoints from unexpected sources
  • Log entries showing encoded paths that decode to protected routes

Detection Strategies

  • Implement request logging that captures both raw and decoded URL paths for comparison
  • Monitor for requests containing percent-encoded characters in path segments that would normally require authentication
  • Deploy web application firewalls (WAF) with rules to detect and alert on URL-encoded path bypass attempts
  • Review application access logs for successful requests to protected endpoints without accompanying authentication events

Monitoring Recommendations

  • Enable detailed access logging on all Fastify applications using @fastify/middie
  • Configure alerting for requests with unusual URL encoding patterns targeting sensitive paths
  • Implement anomaly detection for access to administrative endpoints
  • Correlate authentication logs with endpoint access logs to identify potential bypass attempts

How to Mitigate CVE-2026-22031

Immediate Actions Required

  • Upgrade @fastify/middie to version 9.1.0 or later immediately
  • Audit all path-based middleware configurations for sensitive endpoints
  • Review recent access logs for signs of exploitation using URL-encoded paths
  • Consider implementing additional authentication checks at the route handler level as defense-in-depth

Patch Information

The vulnerability is fixed in @fastify/middie version 9.1.0. The patch introduces proper path decoding using find-my-way before middleware matching, ensuring consistency with Fastify's router behavior. Upgrade using npm:

bash
npm update @fastify/middie

For detailed patch information, see the GitHub Security Advisory, GitHub Pull Request #245, and GitHub Release v9.1.0.

Workarounds

  • Implement URL decoding normalization at the application entry point before middleware execution
  • Add duplicate authorization checks directly within route handlers for critical endpoints
  • Deploy a reverse proxy that normalizes URL-encoded paths before forwarding to the application
  • Use route-level hooks (preHandler) for authentication instead of relying solely on path-based middleware
bash
# Configuration example - Upgrade to patched version
npm install @fastify/middie@^9.1.0

# Verify installed version
npm list @fastify/middie

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

  • Vulnerability Details
  • TypeAuth Bypass

  • Vendor/TechFastify

  • SeverityHIGH

  • CVSS Score8.4

  • EPSS Probability0.06%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • CWE-177
  • Technical References
  • GitHub Commit Update

  • GitHub Pull Request

  • GitHub Release v9.1.0

  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-3635: Fastify Authentication Bypass Vulnerability

  • CVE-2026-3419: Fastify Auth Bypass Vulnerability

  • CVE-2026-2880: Fastify Middie Auth Bypass Vulnerability

  • CVE-2026-25223: Fastify Auth Bypass 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