支持本站 — 捐款将帮助我们持续运营

目标:1000 元,已筹:736

73.6%
一、 漏洞 CVE-2026-22031 基础信息
漏洞信息
                                        # Fastify Middie 路径绕过漏洞

## 概述
`@fastify/middie` 是为 Fastify 提供增强型中间件支持的插件。在版本 9.1.0 之前存在一个安全漏洞,攻击者可通过使用 URL 编码字符绕过中间件的路径匹配机制。

## 影响版本
版本 9.1.0 之前的 `@fastify/middie`。

## 细节
当注册带有特定路径前缀的中间件时,若请求路径中包含 URL 编码字符(例如 `/%61dmin` 代表 `/admin`),`@fastify/middie` 的中间件引擎未能正确匹配该路径,导致中间件被跳过。然而,Fastify 路由器在后续处理中会正确解码路径并匹配相应路由处理器。

## 影响
攻击者可利用此漏洞绕过本应执行的安全中间件(如身份验证或权限检查),直接访问受保护的端点,从而导致未授权访问。
                                        
神龙判断

是否为 Web 类漏洞: 未知

判断理由:

N/A
提示
尽管我们采用了先进的大模型技术,但其输出仍可能包含不准确或过时的信息。
神龙会尽力确保数据准确,但也请结合实际情况进行甄别与判断。
神龙祝您一切顺利!
漏洞标题
Fastify Middie Middleware Path Bypass
来源:美国国家漏洞数据库 NVD
漏洞描述信息
@fastify/middie is the plugin that adds middleware support on steroids to Fastify. A security vulnerability exists in @fastify/middie prior to version 9.1.0 where middleware registered with a specific path prefix can be bypassed using URL-encoded characters (e.g., `/%61dmin` instead of `/admin`). While the middleware engine fails to match the encoded path and skips execution, the underlying Fastify router correctly decodes the path and matches the route handler, allowing attackers to access protected endpoints without the middleware constraints. Version 9.1.0 fixes the issue.
来源:美国国家漏洞数据库 NVD
CVSS信息
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:L
来源:美国国家漏洞数据库 NVD
漏洞类别
URL编码处理不恰当(Hex编码)
来源:美国国家漏洞数据库 NVD
二、漏洞 CVE-2026-22031 的公开POC
#POC 描述源链接神龙链接
三、漏洞 CVE-2026-22031 的情报信息
  • 标题: fix: decode paths before matching by kamilmysliwiec · Pull Request #245 · fastify/middie · GitHub -- 🔗来源链接

    标签:x_refsource_MISC

    神龙速读:
                                            ### 关键信息
    
    - **漏洞描述**
      - 漏洞涉及 `NestJS` 与 `Fastify` 的路径匹配问题。
      - 示例代码演示了在 URL 路径解码不当时,虽然指定的路由处理器会被执行,但中间件逻辑可能不会被触发。
    
    - **问题影响**
      - 如果调用 `your-api:3000/%61dmin` 这样的编码路径,尽管 `/admin` 路由的 handler 会被执行,但中间件逻辑(如权限检查)不会被触发,从而可能绕过安全控制。
    
    - **发现者与报告**
      - 漏洞由 Hacktron AI 发现并报告。
    
    - **修复行动**
      - 该问题在 fastify/middie 项目中通过 pull request #245 修复。
      - 中间件在路由匹配前进行路径解码,以确保路径解析正确。
      - 修改了代码并通过相关测试验证。
    
    - **安全建议**
      - 未来应通过私密渠道报告安全漏洞, Everett suggested.
      - 遵循 fastify FASTY 项目的安全公告要求,允许在 90 天内私下通报。
                                            
    fix: decode paths before matching by kamilmysliwiec · Pull Request #245 · fastify/middie · GitHub
  • 标题: Release v9.1.0 · fastify/middie · GitHub -- 🔗来源链接

    标签:x_refsource_MISC

    神龙速读:
                                            根据提供的GitHub发布说明,关于v9.1.0版本的关键信息如下:
    
    1. **CI/CD相关变更**:
        - 缩减了npm依赖项的更新频率至每月一次,在PR#228中实施。
        - 将master分支重命名为main分支,相关变更在PR#230中提交。
        - 在PR#231中调整了持续集成中的任务权限。
        - 将测试迁移到node:test套件,在PR#229中完成。
        - 移除原有的.taprc配置文件,变更在PR#232中施行。
        - 在PR#233中调整了CI的权限设置,以工作流层面取代任务层面的权限设定,并在PR#234中恢复任务级别的权限。
        - 在PR#244中新增了并发配置。
    
    2. **依赖版本更新**:
        - 更新了`serve-static`依赖包的版本从1.16.2至2.2.0,在PR#235中实现。
        - 将`tsd`的版本从0.31.2升级至0.32.0,变更在PR#236中落地。
        - 更新`@types/node`依赖项至24.0.8版本,在PR#238中执行,后在PR#246中进一步至25.0.3版本。
    
    3. **其他项目更新**:
        - 标准化声明文件日期范围,在PR#237中施行。
        - 在PR#239中移除了`simple-get`测试用组件。
        - 在PR#245中实现了路径解码前匹配的修复,由`@kamilmysliwiec`贡献。
    
    4. **新贡献者**:
        - `@matteo-gobbo`在PR#229中提交了原始贡献。
        - `@ilteooood`在PR#239中贡献了代码。
        - `@kamilmysliwiec`通过PR#245进入项目贡献者名单。
    
    5. **说明文档**:
        - 全部的变更记录可以在[v9.0.3...v9.1.0](v9.0.3...v9.1.0)链接中查阅。
    
    以上信息主要围绕版本更新、CI/CD流程优化及依赖项版本升级展开,并不直接涉及软件安全漏洞的披露或修复。若存在安全问题,通常会在Markdown文档的说明中公开提及或单独列出,或在“Security”标签下有所体现,但当前截图中未见此类信息直接展示。对于软件漏洞的识别,还应关注是否有安全公告或相关安全团队的评估报告发布。
                                            
    Release v9.1.0 · fastify/middie · GitHub
  • 标题: Fastify Middie Middleware Path Bypass · Advisory · fastify/middie · GitHub -- 🔗来源链接

    标签:x_refsource_CONFIRM

    神龙速读:
                                            ## Key Information on Vulnerability from the Screenshot
    
    ### Summary
    - **Vulnerability**: Fastify `middie` Middleware Path Bypass
    - **Package**: `@fastify/middie`
    - **Affected Versions**: <=9.0.3
    - **Patched Versions**: 9.1.0
    - **Severity**: High (8.4/10)
    
    ### Description
    - **Summary**: 
      - A security vulnerability exists in `@fastify/middie` where middleware registered with a specific path prefix can be bypassed using URL-encoded characters (e.g., `%61dmin` instead of `admin`).
      - The middleware engine fails to match the encoded path and skips execution, but the Fastify router decodes the path and matches the route handler, allowing attackers to access protected endpoints.
    
    ### Details
    1. **Regex Generation**: `middie` generates a regex for the path using `path-to-regexp`.
    2. **Request Matching**: The regex is matched against `req.url` (or `req.originalUrl`).
    3. **The Flaw**: `req.url` contains the raw, undecoded path string.
       - Generated regex expects a decoded path.
       - If a request is sent to `%61dmin`, the regex comparison fails.
       - `middie` assumes the middleware does not apply and calls `next()`.
    4. **Route Execution**: Request proceeds to Fastify’s internal router, decodes the URL, and executes the route handler.
    
    ### Impact
    - **Type**: Authentication/Authorization Bypass
    - **Affected Components**: Applications using `@fastify/middie` for security controls on specific route prefixes.
    - **Severity**: High; attackers can bypass security middleware to access protected admin or sensitive endpoints.
    
    ### CVSS Metrics
    - **Severity**: High (8.4/10)
    - **Base Metrics**: 
      - Attack Vector: Network
      - Attack Complexity: High
      - Privileges Required: Low
      - User Interaction: None
      - Scope: Changed
      - Confidentiality: High
      - Integrity: High
      - Availability: Low
    
    ### CVE ID
    - **CVE-2026-22031**
    
    ### Weaknesses
    - **CWE-177**
    
    ### Credits
    - **Reporter**: rootxharsh
    - **Remediation Developers**: kamilmysliwiec, Eomm
    - **Coordinator**: mcollina
                                            
    Fastify Middie Middleware Path Bypass · Advisory · fastify/middie · GitHub
  • 标题: fix: decode paths before matching (#245) · fastify/middie@d44cd56 · GitHub -- 🔗来源链接

    标签:x_refsource_MISC

    神龙速读:
                                            # 漏洞关键信息
    
    - **Commit Message**: `fix: decode paths before matching (#245)`
    - **Commit Purpose**: 解码路径在匹配之前进行处理
    - **相关文件更改**
        - `lib/engine.js`: 引入 `FindMyWay` 库并使用 `FindMyWay.sanitizeUrlPath(url)` 在正则表达式匹配之前解码URL。
        - `package.json`: 添加对 `find-my-way` 库的依赖。
        - `test/middleware.test.js`: 新增测试用例以确保路径编码和解码处理的正确性。
    - **潜在漏洞点**:
        - 原始代码可能因为未对URL进行正确解码导致路径匹配错误,引起路径遍历或注入等安全问题。通过引入 `FindMyWay.sanitizeUrlPath(url)` 确保URL在匹配前正确解码,从而避免潜在的安全风险。
                                            
    fix: decode paths before matching (#245) · fastify/middie@d44cd56 · GitHub
  • https://nvd.nist.gov/vuln/detail/CVE-2026-22031
四、漏洞 CVE-2026-22031 的评论

暂无评论


发表评论