-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🐛 [Bug]: internal error on static path prefix ending with ".." #3238
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
This behavior was also seen when adding more tests to #3105 |
I have tested and confirmed that this returns @simonbrandhof You are using v2.5.x right ? |
@gaby exact, v2.52.5 |
I would like to work on this @gaby |
@rishavch2104 Go for it. The branch name is |
Hi @gaby from what I understand, static files with path /css will always be /css/123 unless its a wildcard. it can never be /cssab/123. From the code we are passing /css to fasthttp.FS as prefix. But in case of non root and non wildcard paths, it should be /css/ . Please let me know if this sounds fine, I will make the changes accordingly |
@rishavch2104 I believe so, yes |
Bug Description
A request to a path handled by a static router generates an internal server error if the requested path matches the router "prefix" suffixed with
..
.For example if the router prefix is
/css
, the requests to/css../*
return the 500 error code.That could be considered as a vulnerability:
How to Reproduce
Steps to reproduce the behavior:
./css
http://localhost:3000/css../whatever
. The 500 error code is returned instead of the expected 404.Expected Behavior
The static router should always return 404 if the requested path does not exist.
A workaround is to explicitly exclude the buggy path:
Fiber Version
v2.52.5
Code Snippet (optional)
No response
Checklist:
The text was updated successfully, but these errors were encountered: