fix(deps): update dependency @fastify/middie to v9 [security]#151
Open
renovate[bot] wants to merge 1 commit intomainfrom
Open
fix(deps): update dependency @fastify/middie to v9 [security]#151renovate[bot] wants to merge 1 commit intomainfrom
renovate[bot] wants to merge 1 commit intomainfrom
Conversation
c19945d to
e5e448a
Compare
4b32d03 to
3d5ee2b
Compare
3d5ee2b to
ead228a
Compare
f8ff144 to
6c9bf06
Compare
6c9bf06 to
bb82706
Compare
bb82706 to
99b5930
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^8.3.0→^9.0.0GitHub Vulnerability Alerts
CVE-2026-22031
Summary
A security vulnerability exists in
@fastify/middiewhere middleware registered with a specific path prefix can be bypassed using URL-encoded characters (e.g.,/%61dmininstead 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.Details
The vulnerability is caused by how
middiematches requests against registered middleware paths.middieusespath-to-regexpto generate a regular expression for the path/admin.middieexecutes this regular expression againstreq.url(orreq.originalUrl).req.urlin Fastify contains the raw, undecoded path string./admin)./%61dmin, the regex comparison fails (/^\/admin/does not match/%61dmin).middieassumes the middleware does not apply and callsnext()./%61dminas/adminand executes the corresponding route handler.Incriminated Source Code:
In the provided
middiesource:PoC
Step 1: Run the following Fastify application (save as
app.js):Step 2: Execute the attack.
curl http://localhost:3008/admin # Output: Forbidden: Access to /admin is blockedcurl http://localhost:3008/%61dmin # Output: {"message":"Admin panel"}Impact
@fastify/middieto apply security controls (auth, rate limiting, IP filtering) to specific route prefixes.Severity
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:LCVE-2026-2880
Summary
A path normalization inconsistency in
@fastify/middiecan result in authentication/authorization bypass when using path-scoped middleware (for example,app.use('/secret', auth)).When Fastify router normalization options are enabled (such as
ignoreDuplicateSlashes,useSemicolonDelimiter, and related trailing-slash behavior), crafted request paths may bypass middleware checks while still being routed to protected handlers.Impact
An unauthenticated remote attacker can access endpoints intended to be protected by middleware-based auth/authorization controls by sending specially crafted URL paths (for example,
//secretor/secret;foo=bar), depending on router option configuration.This may lead to unauthorized access to protected functionality and data exposure.
Affected versions
@fastify/middie@9.1.0Patched versions
Details
The issue is caused by canonicalization drift between:
@fastify/middiepath matching forapp.use('/prefix', ...), andBecause middleware and router did not always evaluate the same normalized path, auth middleware could be skipped while route resolution still succeeded.
Workarounds
Until patched version is deployed:
Resources
Credits
Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:NCVE-2026-33804
Impact
@fastify/middiev9.3.1 and earlier does not read the deprecated (but still functional) top-levelignoreDuplicateSlashesoption, only reading fromrouterOptions. This creates a normalization gap: Fastify's router normalizes duplicate slashes but middie does not, allowing middleware bypass via URLs with duplicate leading slashes (e.g.,//admin/secret).This only affects applications using the deprecated top-level configuration style (
fastify({ ignoreDuplicateSlashes: true })). Applications usingrouterOptions: { ignoreDuplicateSlashes: true }are not affected.This is distinct from GHSA-8p85-9qpw-fwgw (CVE-2026-2880), which was patched in v9.2.0.
Patches
Upgrade to
@fastify/middie>= 9.3.2.Workarounds
Migrate from deprecated top-level
ignoreDuplicateSlashes: truetorouterOptions: { ignoreDuplicateSlashes: true }.Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:NCVE-2026-6270
Impact
@fastify/middiev9.3.1 and earlier incorrectly re-prefixes middleware paths when propagating them to child plugin scopes. When a child plugin is registered with a prefix that overlaps with a parent-scoped middleware path, the middleware path is modified during inheritance and silently fails to match incoming requests.This results in complete bypass of middleware security controls for all routes defined within affected child plugin scopes, including nested (grandchild) scopes. Authentication, authorization, rate limiting, and any other middleware-based security mechanisms are skipped. No special request crafting or configuration is required.
This is the same vulnerability class as GHSA-hrwm-hgmj-7p9c (CVE-2026-33807) in
@fastify/express.Patches
Upgrade to
@fastify/middiev9.3.2 or later.Workarounds
None. Upgrade to the patched version.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:NRelease Notes
fastify/middie (@fastify/middie)
v9.3.2Compare Source
This fixes CVE CVE-2026-6270 GHSA-72c6-fx6q-fr5w.
This fixes CVE CVE-2026-33804 GHSA-v9ww-2j6r-98q6.
What's Changed
Full Changelog: fastify/middie@v9.3.1...v9.3.2
v9.3.1Compare Source
What's Changed
Full Changelog: fastify/middie@v9.3.0...v9.3.1
v9.3.0Compare Source
What's Changed
New Contributors
Full Changelog: fastify/middie@v9.2.0...v9.3.0
v9.2.0Compare Source
Fixes GHSA-8p85-9qpw-fwgw
What's Changed
New Contributors
Full Changelog: fastify/middie@v9.1.0...v9.2.0
v9.1.0Compare Source
What's Changed
New Contributors
Full Changelog: fastify/middie@v9.0.3...v9.1.0
v9.0.3Compare Source
What's Changed
varwithletby @Fdawgs in #218node:prefix for builtins by @Fdawgs in #223Full Changelog: fastify/middie@v9.0.2...v9.0.3
v9.0.2Compare Source
What's Changed
Full Changelog: fastify/middie@v9.0.1...v9.0.2
v9.0.1Compare Source
Security
path-to-regexpis updated to 8.1.0 to prevent ReDOS attack, it is recommended to use the latest version of this package.What's Changed
Full Changelog: fastify/middie@v9.0.0...v9.0.1
v9.0.0Compare Source
What's Changed
nextintomasterby @jsumners in #203New Contributors
Full Changelog: fastify/middie@v8.3.1...v9.0.0
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.