react-ssr-starter
                                
                                
                                
                                    react-ssr-starter copied to clipboard
                            
                            
                            
                        🚨 [security] Update webpack-dev-middleware 5.3.1 → 5.3.4 (patch)
🚨 Your current dependencies have known security vulnerabilities 🚨
This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request.
What changed?
✳️ webpack-dev-middleware (5.3.1 → 5.3.4) · Repo · Changelog
Security Advisories 🚨
🚨 Path traversal in webpack-dev-middleware
Summary
The webpack-dev-middleware middleware does not validate the supplied URL address sufficiently before returning the local file. It is possible to access any file on the developer's machine.
Details
The middleware can either work with the physical filesystem when reading the files or it can use a virtualized in-memory memfs filesystem.
If writeToDisk configuration option is set to true, the physical filesystem is used:
webpack-dev-middleware/src/utils/setupOutputFileSystem.js
Line 21 in 7ed24e0
The getFilenameFromUrl method is used to parse URL and build the local file path.
The public path prefix is stripped from the URL, and the unsecaped path suffix is appended to the outputPath:
webpack-dev-middleware/src/utils/getFilenameFromUrl.js
Line 82 in 7ed24e0
As the URL is not unescaped and normalized automatically before calling the midlleware, it is possible to use %2e and %2f sequences to perform path traversal attack.PoC
A blank project can be created containing the following configuration file webpack.config.js:
module.exports = { devServer: { devMiddleware: { writeToDisk: true } } };When started, it is possible to access any local file, e.g. /etc/passwd:
$ curl localhost:8080/public/..%2f..%2f..%2f..%2f../etc/passwdroot:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologinImpact
The developers using webpack-dev-server or webpack-dev-middleware are affected by the issue. When the project is started, an attacker might access any file on the developer's machine and exfiltrate the content (e.g. password, configuration files, private source code, ...).
If the development server is listening on a public IP address (or 0.0.0.0), an attacker on the local network can access the local files without any interaction from the victim (direct connection to the port).
If the server allows access from third-party domains (CORS, Allow-Access-Origin: * ), an attacker can send a malicious link to the victim. When visited, the client side script can connect to the local server and exfiltrate the local files.
Recommendation
The URL should be unescaped and normalized before any further processing.
Release Notes
5.3.4
5.3.4 (2024-03-20)
Bug Fixes
5.3.3
5.3.3 (2022-05-18)
Bug Fixes
5.3.2
5.3.2 (2022-05-17)
Bug Fixes
Does any of this look wrong? Please let us know.
Commits
See the full diff on Github. The new version differs by 74 commits:
chore(release): 5.3.4fix(security): do not allow to read files above (#1779)chore(release): 5.3.3fix: types for `Request` and `Response` (#1271)chore(release): 5.3.2chore(deps): memfs force update (#1269)chore: update deps and ci (#1260)chore(deps-dev): bump @commitlint/clici: update `checkout`, `setup-node`, and `codecov` actions (#1267)chore(deps-dev): bump @babel/preset-envchore(deps-dev): bump del from 6.0.0 to 6.1.0 (#1264)chore(deps-dev): bump standard-versionchore(deps-dev): bump @types/nodefix: node types (#1195)chore(deps-dev): bump @babel/clichore(deps-dev): bump eslint from 8.14.0 to 8.15.0 (#1258)chore(deps-dev): bump webpack from 5.72.0 to 5.72.1 (#1259)chore(deps-dev): bump express from 4.18.0 to 4.18.1 (#1254)chore(deps-dev): bump @babel/corechore(deps-dev): bump @babel/preset-envchore(deps-dev): bump @commitlint/clichore(deps-dev): bump @commitlintchore(deps-dev): bump lint-staged from 12.4.0 to 12.4.1 (#1249)chore(deps-dev): bump supertest from 6.2.2 to 6.2.3 (#1248)chore(deps-dev): bump eslint from 8.13.0 to 8.14.0 (#1246)chore(deps-dev): bump express from 4.17.3 to 4.18.0 (#1247)chore(deps-dev): bump lint-staged from 12.3.8 to 12.4.0 (#1243)chore(deps-dev): bump lint-staged from 12.3.7 to 12.3.8 (#1242)chore(deps-dev): bump eslint from 8.12.0 to 8.13.0 (#1241)chore(deps-dev): bump webpack from 5.71.0 to 5.72.0 (#1240)chore(deps-dev): bump @babel/corechore(deps-dev): bump eslint-plugin-importchore(deps-dev): bump webpack from 5.70.0 to 5.71.0 (#1236)chore(deps-dev): bump prettier from 2.6.1 to 2.6.2 (#1237)chore(deps-dev): bump prettier from 2.6.0 to 2.6.1 (#1232)chore(deps): bump minimist from 1.2.5 to 1.2.6 (#1234)chore(deps-dev): bump eslint from 8.11.0 to 8.12.0 (#1233)chore(deps-dev): bump @babel/corerefactor: replace deprecated `String.prototype.substr()` (#1227)chore(deps-dev): bump lint-staged from 12.3.6 to 12.3.7 (#1228)chore(deps-dev): bump @babel/corechore(deps-dev): bump @commitlint/cli from 16.2.1 to 16.2.3 (#1224)chore(deps-dev): bump lint-staged from 12.3.5 to 12.3.6 (#1225)chore(deps-dev): bump prettier from 2.5.1 to 2.6.0 (#1226)chore(deps): bump mime-types from 2.1.34 to 2.1.35 (#1220)chore(deps-dev): bump eslint from 8.10.0 to 8.11.0 (#1219)chore(deps-dev): bump lint-staged from 12.3.4 to 12.3.5 (#1218)chore(deps-dev): bump webpack from 5.69.1 to 5.70.0 (#1216)chore(deps-dev): bump eslint-config-prettierci: add job to check types (#1213)chore(deps-dev): bump eslint from 8.9.0 to 8.10.0 (#1214)chore(deps-dev): bump @babel/clichore(deps-dev): bump eslint-config-prettierchore(deps-dev): bump @babel/corechore(deps-dev): bump webpack from 5.69.0 to 5.69.1 (#1210)chore(deps-dev): bump commitlintchore(deps-dev): bump express from 4.17.2 to 4.17.3 (#1208)chore(deps-dev): bump @babel/corechore(deps-dev): bump webpack from 5.68.0 to 5.69.0 (#1205)chore(deps-dev): bump @babel/cli from 7.17.0 to 7.17.3 (#1206)chore(deps-dev): bump @commitlint/clichore(deps-dev): bump eslint from 8.8.0 to 8.9.0 (#1204)chore(deps-dev): bump lint-staged from 12.3.3 to 12.3.4 (#1203)chore(deps-dev): bump jestchore(deps-dev): bump babel-jestchore(deps-dev): bump @babel/corechore(deps-dev): bump babel-jestchore(deps-dev): bump jest from 27.4.7 to 27.5.0 (#1196)chore: udpate `webpack` (#1193)docs: fix typo in BUG.md (#1192)chore(deps-dev): bump @babel/clichore(deps-dev): bump @babel/coreci: update workflow strategy (#1189)chore(deps-dev): bump lint-staged from 12.3.2 to 12.3.3 (#1188)
Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.
All Depfu comment commands
- @depfu rebase
 - Rebases against your default branch and redoes this update
 - @depfu recreate
 - Recreates this PR, overwriting any edits that you've made to it
 - @depfu merge
 - Merges this PR once your tests are passing and conflicts are resolved
 - @depfu cancel merge
 - Cancels automatic merging of this PR
 - @depfu close
 - Closes this PR and deletes the branch
 - @depfu reopen
 - Restores the branch and reopens this PR (if it's closed)
 - @depfu pause
 - Ignores all future updates for this dependency and closes this PR
 - @depfu pause [minor|major]
 - Ignores all future minor/major updates for this dependency and closes this PR
 - @depfu resume
 - Future versions of this dependency will create PRs again (leaves this PR as is)