-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Directory traversal with malformed HTTP request #330
Comments
I would suggest the first solution, which is to deny all request path that doesn't have prefix
Meanwhile, this ensures that The second solution cannot mitigate this issue, since the following payload still works.
|
* Directory traversal with malformed HTTP request #330 * bump version * also %2e * Use prefix to check invalid Path --------- Co-authored-by: n0vad3v <[email protected]>
Thank you for your explanation, I've updated PR and got it merged, the fix will be available in 0.11.3 (https://github.com/webp-sh/webp_server_go/releases/tag/0.11.3) Thank you again for helping us to point out this vulnerability, which is very helpful to us! ❤️ |
Describe the bug
By sending a malformed HTTP request directly to
webp_server_go
, attackers can read images (but not files) outsideIMG_PATH
defined in configuration file.To Reproduce
Suppose
webp_server_go
is serving at 127.0.0.1:23333 andIMG_PATH
has been set to/opt/pics
. Send the following HTTP request to the server. Note that the URI part does not start with/
./test.png
will be returned if exists, which is outsideIMG_PATH
.Expected behavior
Images outside
IMG_PATH
should not be accessible.Screenshots and logs
Environment
Additional context
The patch for CVE-2021-46104 is not sufficient.
path.Clean(reqUri)
won't remove all../
ifreqUri
begins with../
.The text was updated successfully, but these errors were encountered: