GHSA-8wpr-639p-ccrj

Suggest an improvement
Source
https://github.com/advisories/GHSA-8wpr-639p-ccrj
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/12/GHSA-8wpr-639p-ccrj/GHSA-8wpr-639p-ccrj.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-8wpr-639p-ccrj
Aliases
Published
2025-12-30T15:32:44Z
Modified
2025-12-30T15:42:33Z
Severity
  • 6.9 (Medium) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N/E:U CVSS Calculator
Summary
Nest has a Fastify URL Encoding Middleware Bypass (TOCTOU)
Details

A NestJS application is vulnerable if it meets all of the following criteria:

  1. Platform: Uses @nestjs/platform-fastify.
  2. Security Mechanism: Relies on NestMiddleware (via MiddlewareConsumer) for security checks (authentication, authorization, etc.), or through app.use()
  3. Routing: Applies middleware to specific routes using string paths or controllers (e.g., .forRoutes('admin')). Example Vulnerable Config:
// app.module.ts
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer
      .apply(AuthMiddleware) // Security check
      .forRoutes('admin');   // Vulnerable: Path-based restriction
  }
}

Attack Vector:

  • Target Route: /admin
  • Middleware Path: admin
  • Attack Request: GET /%61dmin
  • Result: Middleware is skipped (no match on %61dmin), but controller for /admin is executed.

Consequences:

  • Authentication Bypass: Unauthenticated users can access protected routes.
  • Authorization Bypass: Restricted administrative endpoints become accessible to lower-privileged users.
  • Input Validation Bypass: Middleware performing sanitization or validation can be skipped.

Patches

Patched in @nestjs/platform-fastify@11.1.11

Resources

Credit goes to Hacktron AI for reporting this issue.

Database specific
{
    "cwe_ids":  [
        "CWE-367"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2025-12-30T15:32:44Z",
    "nvd_published_at":  "2025-12-29T16:15:44Z",
    "severity":  "MODERATE"
}
References

Affected packages

npm / @nestjs/platform-fastify

Package

Name
@nestjs/platform-fastify
View open source insights on deps.dev
Purl
pkg:npm/%40nestjs/platform-fastify

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
11.1.11

Database specific

last_known_affected_version_range
"< 11.1.10"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/12/GHSA-8wpr-639p-ccrj/GHSA-8wpr-639p-ccrj.json"