fix(deps): update dependency @fastify/express to v4.0.5 [security]#872
Open
renovate[bot] wants to merge 1 commit intodevelopfrom
Open
fix(deps): update dependency @fastify/express to v4.0.5 [security]#872renovate[bot] wants to merge 1 commit intodevelopfrom
renovate[bot] wants to merge 1 commit intodevelopfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #872 +/- ##
============================================
+ Coverage 19.22% 44.67% +25.45%
============================================
Files 954 1923 +969
Lines 97042 215448 +118406
Branches 1428 5846 +4418
============================================
+ Hits 18654 96252 +77598
- Misses 78381 119164 +40783
- Partials 7 32 +25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
이 PR에 의한 api.json 차이 |
a79af62 to
01fccd7
Compare
097c5cc to
abf5c7b
Compare
abf5c7b to
364ef67
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:
4.0.2→4.0.5@fastify/express vulnerable to Improper Handling of URL Encoding (Hex Encoding)
CVE-2026-22037 / GHSA-g6q3-96cp-5r5m
More information
Details
Summary
A security vulnerability exists in
@fastify/expresswhere 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
@fastify/expressmatches requests against registered middleware paths.PoC
Step 1: Run the following Fastify application (save as
app.js):Step 2: Execute the attack.
It differs from CVE-2026-22031 because this is a different npm module with its own code.
Severity
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
@fastify/express's middleware path doubling causes authentication bypass in child plugin scopes
CVE-2026-33807 / GHSA-hrwm-hgmj-7p9c
More information
Details
Summary
@fastify/expressv4.0.4 contains a path handling bug in theonRegisterfunction that causes middleware paths to be doubled when inherited by child plugins. This results in complete bypass of Express middleware security controls for all routes defined within child plugin scopes that share a prefix with parent-scoped middleware. No special configuration is required — this affects the default Fastify configuration.Details
The vulnerability exists in the
onRegisterfunction atindex.jslines 92-101. When a child plugin is registered with a prefix, theonRegisterhook copies middleware from the parent scope and re-registers it usinginstance.use(...middleware). However, the middleware paths stored inkMiddlewaresare already prefixed from their original registration.The call flow demonstrates the problem:
app.use('/admin', authFn)—use()calculates path as'' + '/admin' = '/admin'— stores['/admin', authFn]inkMiddlewares{ prefix: '/admin' }— triggersonRegister(instance)onRegistercopies parent middleware and callsinstance.use('/admin', authFn)on childuse()function calculates path as'/admin' + '/admin' = '/admin/admin'— registers middleware with doubled path/admin/admin/admin/secretdon't match/admin/admin— middleware is silently skippedThe root cause is in the
use()function at lines 25-26, which always prependsthis.prefixto string paths, combined withonRegisterre-callinguse()with already-prefixed paths.PoC
Actual output:
Impact
Complete bypass of Express middleware security controls for all routes defined in child plugin scopes. Authentication, authorization, rate limiting, CSRF protection, audit logging, and any other middleware-based security mechanisms are silently skipped for affected routes.
Applications using
@fastify/expresswith path-scoped middleware and child plugins with matching prefixes are vulnerable in default configurations.Affected Versions
@fastify/expressv4.0.4 (latest at time of discovery)ignoreDuplicateSlashesnot needed)/) due to special case handlingVariant Testing
/admin/root-data/admin/admin/secret/admin/admin/api/data/api/api/admin/sub/data/admin/admin/sub/admin/sub/admin/with any child//apipath === '/' && prefix.length > 0special caseSuggested Fix
The
onRegisterfunction should store and re-use the original unprefixed middleware paths, or avoid re-calling theuse()function entirely. Options include:kMiddlewaresbefore prefixingSeverity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
@fastify/express vulnerable to Improper Handling of URL Encoding (Hex Encoding)
CVE-2026-22037 / GHSA-g6q3-96cp-5r5m
More information
Details
Summary
A security vulnerability exists in
@fastify/expresswhere 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
@fastify/expressmatches requests against registered middleware paths.PoC
Step 1: Run the following Fastify application (save as
app.js):Step 2: Execute the attack.
It differs from CVE-2026-22031 because this is a different npm module with its own code.
Severity
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:LReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
@fastify/express has a middleware authentication bypass via URL normalization gaps (duplicate slashes and semicolons)
CVE-2026-33808 / GHSA-6hw5-45gm-fj88
More information
Details
Summary
@fastify/expressv4.0.4 fails to normalize URLs before passing them to Express middleware when Fastify router normalization options are enabled. This allows complete bypass of path-scoped authentication middleware via two vectors://admin/dashboard) whenignoreDuplicateSlashes: trueis configured/admin;bypass) whenuseSemicolonDelimiter: trueis configuredIn both cases, Fastify's router normalizes the URL and matches the route, but
@fastify/expresspasses the original un-normalized URL to Express middleware, which fails to match and is skipped.Note: This is distinct from GHSA-g6q3-96cp-5r5m (CVE-2026-22037), which addressed URL percent-encoding bypass and was patched in v4.0.3. These normalization gaps remain in v4.0.4. A similar class of normalization issue was addressed in
@fastify/middievia GHSA-8p85-9qpw-fwgw (CVE-2026-2880), but@fastify/expressdoes not include the equivalent fixes.Details
The vulnerability exists in
@fastify/express'senhanceRequestfunction (index.jslines 43-46):The
decodeURI()function only handles percent-encoding — it does not normalize duplicate slashes or strip semicolon-delimited parameters. When Fastify's router options are enabled,find-my-wayapplies these normalizations during route matching, but@fastify/expresspasses the original URL to Express middleware.Vector 1: Duplicate Slashes
When
ignoreDuplicateSlashes: trueis set, Fastify'sfind-my-wayrouter normalizes//admin/dashboardto/admin/dashboardfor route matching. However, Express middleware receives//admin/dashboard. Express'sapp.use('/admin', authMiddleware)expects paths to start with/admin/, but//admindoes not match the/adminprefix pattern.The attack sequence:
GET //admin/dashboard/admin/dashboardand finds a matching routeenhanceRequestsetsreq.raw.url = "//admin/dashboard"(preserves double slash)app.use('/admin', authMiddleware)does not match//adminprefixVector 2: Semicolon Delimiters
When
useSemicolonDelimiter: trueis configured, the router usesfind-my-way'ssafeDecodeURI()which treats semicolons as query string delimiters, splitting/admin;bypassinto path/adminand querystringbypassfor route matching. However,@fastify/expresspasses the full URL/admin;bypassto Express middleware.Express uses path-to-regexp v0.1.12 internally, which compiles middleware paths like
/adminto the regex/^\/admin\/?(?=\/|$)/i. A semicolon character does not satisfy the lookahead condition, causing the middleware match to fail.The attack flow:
GET /admin;bypassarrives;— matches routeGET /admin/^\/admin\/?(?=\/|$)/ifails against/admin;bypass— middleware skippedPoC
Duplicate Slash Bypass
Save as
server.jsand run withnode server.js:Multiple variants work:
///admin,/.//admin,//admin//dashboard, etc.Semicolon Bypass
Actual output:
The semicolon bypass works with any text after it:
/admin;,/admin;x,/admin;jsessionid=123.Impact
Complete authentication bypass for applications using Express middleware for path-based access control. An unauthenticated attacker can access protected routes (admin panels, APIs, user data) by manipulating the URL path.
Duplicate slash vector affects applications that:
@fastify/expresswithignoreDuplicateSlashes: trueapp.use('/admin', authMiddleware)Semicolon vector affects applications that:
@fastify/expresswithuseSemicolonDelimiter: true(commonly enabled for Java application server compatibility, e.g., handling;jsessionid=parameters)app.use('/admin', authMiddleware)The bypass works against all Express middleware that uses prefix path matching, including popular packages like
express-basic-auth, custom authentication middleware, and rate limiting middleware.The
ignoreDuplicateSlashesanduseSemicolonDelimiteroptions are documented as convenience features, not marked as security-sensitive, so developers would not expect them to impact middleware security.Affected Versions
@fastify/expressv4.0.4 (latest) with Fastify 5.xignoreDuplicateSlashes: trueoruseSemicolonDelimiter: truein Fastify configuration (via top-level option orrouterOptions)Variant Testing
Duplicate slashes:
GET /admin/dashboardGET //admin/dashboardGET ///admin/dashboardGET /.//admin/dashboardGET //admin//dashboardGET /admin//dashboardSemicolons:
/admin/admin;/admin;bypass/admin;x=1/admin;/dashboard/admin/dashboard;xThe semicolon bypass is effective when the semicolon appears immediately after the middleware prefix boundary. For sub-paths where the prefix is already matched (e.g.,
/admin/dashboard;x), Express's prefix regex succeeds because the/admin/part matches before the semicolon appears.Suggested Fix
@fastify/expressshould normalize URLs before passing them to Express middleware, respecting the router normalization options that are enabled. Specifically:ignoreDuplicateSlashesis enabled, applyFindMyWay.removeDuplicateSlashes()toreq.raw.urlbefore middleware executionuseSemicolonDelimiteris enabled, strip semicolon-delimited parameters from the URL before passing to ExpressThis would match the normalization behavior that
@fastify/middiealready implements viasanitizeUrlPath()andnormalizePathForMatching().Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
@fastify/express's middleware path doubling causes authentication bypass in child plugin scopes
CVE-2026-33807 / GHSA-hrwm-hgmj-7p9c
More information
Details
Summary
@fastify/expressv4.0.4 contains a path handling bug in theonRegisterfunction that causes middleware paths to be doubled when inherited by child plugins. This results in complete bypass of Express middleware security controls for all routes defined within child plugin scopes that share a prefix with parent-scoped middleware. No special configuration is required — this affects the default Fastify configuration.Details
The vulnerability exists in the
onRegisterfunction atindex.jslines 92-101. When a child plugin is registered with a prefix, theonRegisterhook copies middleware from the parent scope and re-registers it usinginstance.use(...middleware). However, the middleware paths stored inkMiddlewaresare already prefixed from their original registration.The call flow demonstrates the problem:
app.use('/admin', authFn)—use()calculates path as'' + '/admin' = '/admin'— stores['/admin', authFn]inkMiddlewares{ prefix: '/admin' }— triggersonRegister(instance)onRegistercopies parent middleware and callsinstance.use('/admin', authFn)on childuse()function calculates path as'/admin' + '/admin' = '/admin/admin'— registers middleware with doubled path/admin/admin/admin/secretdon't match/admin/admin— middleware is silently skippedThe root cause is in the
use()function at lines 25-26, which always prependsthis.prefixto string paths, combined withonRegisterre-callinguse()with already-prefixed paths.PoC
Actual output:
Impact
Complete bypass of Express middleware security controls for all routes defined in child plugin scopes. Authentication, authorization, rate limiting, CSRF protection, audit logging, and any other middleware-based security mechanisms are silently skipped for affected routes.
Applications using
@fastify/expresswith path-scoped middleware and child plugins with matching prefixes are vulnerable in default configurations.Affected Versions
@fastify/expressv4.0.4 (latest at time of discovery)ignoreDuplicateSlashesnot needed)/) due to special case handlingVariant Testing
/admin/root-data/admin/admin/secret/admin/admin/api/data/api/api/admin/sub/data/admin/admin/sub/admin/sub/admin/with any child//apipath === '/' && prefix.length > 0special caseSuggested Fix
The
onRegisterfunction should store and re-use the original unprefixed middleware paths, or avoid re-calling theuse()function entirely. Options include:kMiddlewaresbefore prefixingSeverity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Release Notes
fastify/fastify-express (@fastify/express)
v4.0.5Compare Source
This fixes CVE CVE-2026-33807 GHSA-hrwm-hgmj-7p9c.
This fixes CVE CVE-2026-33808 GHSA-6hw5-45gm-fj88.
What's Changed
New Contributors
Full Changelog: fastify/fastify-express@v4.0.4...v4.0.5
v4.0.4Compare Source
What's Changed
New Contributors
Full Changelog: fastify/fastify-express@v4.0.3...v4.0.4
v4.0.3Compare Source
What's Changed
New Contributors
Full Changelog: fastify/fastify-express@v4.0.2...v4.0.3
Configuration
📅 Schedule: (in timezone Asia/Tokyo)
🚦 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.