Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
I found a neat little directory traversal bug in the webadmin code.
What the server does is that if the requested URL isn't "/", "/webadmin" or "/~webadmin" it will just try to fetch the corresponding file and send it back. The URL is sanitized before that: since we only want to serve files that are in the
webadmin/files/directory, we search for../in the URL and remove it.The problem here is that this sanitization doesn't work: if an attacker sends
....//file.foothe sanitizer will transform it into../file.fooand they will have successfully bypassed the filter. For example if I go tolocalhost:8080/....//....//webadmin.iniI get the webadmin.ini file containing all the user passwords in plaintext.I see three ways of fixing this:
..instead of../. I think this fixes the bug but it might be less robust than the other two solutions (the first being probably the most robust but also the most complicated since we need to support Windows and Unix paths)