-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unrestricted directory traversal with @fs
(Bypass)
#8498
Comments
@fs
(Bypass)@fs
(Bypass)
Good |
Do you guys have plans to add security advisory for this? |
@stypr we think that a CVE is the best here, as we don't have another way to reach everybody. Please move ahead with the request, and thanks for the report. Timeline:
Users should avoid using exposing the network (as with [email protected] also includes the fix |
I checked it sometime today and I think it's still* possible to bypass with the latest version...
|
Describe the bug
The vulnerability found at #2820 was found to be not fixed properly, which leads to the unrestricted directory traversal.
Currently the
@fs
directory does check for the allowed path, but it does not check for encoded paths.For example, assuming that
/@fs/home/test/
is the only allowed path, this can be bypassed by accessing/@fs/home/test/%2e%2e%2f%2e%2e%2f
, which translates to/@fs/home/test/../../
internally.Since this way of access through the browser may output an inconsistent result,
curl --path-as-is
can be used as an alternative way to reproduce such issue.Reproduction
Any vite project is affected by this vulnerability.
npm init @vitejs/app app cd app npm install npm run dev
Reproduction in Windows
Accessing
C:/Windows/System32/drivers/etc/hosts
is blocked since the allow list only containsC:/Users/stypr/Desktop/development/q/vite-project
.What if we access like
C:/Users/stypr/Desktop/development/q/vite-project/../../../../../../Windows/System32/drivers/etc/hosts
? In typical cases, this doesn't workHowever, if we replace the path
../
as%2e%2e%2f
and replace every trailing slashes to%2f
, the check is bypassed and the path traversal becomes successful.Reproduction in Linux
Linux is also pretty much the same, you can first get the whitelist path (
/srv/q/app
) by accessing a random path(/@fs/...
), and then do a path traversal based on the given whitelist.System Info
Windows
Linux
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: