-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Clean path from containing backslashes in the webserver #18625
Clean path from containing backslashes in the webserver #18625
Conversation
After path is cleaned the following check should work properly and deny access outside webui root folder qBittorrent/src/webui/webapplication.cpp Lines 154 to 156 in 927732f
|
This will prevent the webserver from serving files outside of the webui folder. Closes qbittorrent#18618
cacc439
to
5e48d8a
Compare
Was about to say, |
👍 |
Tested with 5e48d8a
Against a Linux qbit, I am getting Still, the error code being 500 is a bit weird, it suggests some error is not getting handled properly. |
The qBittorrent/src/webui/webapplication.cpp Lines 155 to 156 in 927732f
Still raises the question of where the 404 comes from, then. |
Ah, nvm, I need the I was getting the 404 because it was looking inside the public folder directly... |
@@ -39,6 +39,7 @@ | |||
#include <QUrlQuery> | |||
|
|||
#include "base/global.h" | |||
#include "base/path.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover?
// Convert all '\' to '/' | ||
// This helps the server down the line to guard against path traversal using '.' or '..' | ||
m_request.path = QString::fromUtf8(QByteArray::fromPercentEncoding(pathComponent)) | ||
.replace(u"\\"_qs, u"/"_qs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use another overload: https://doc.qt.io/qt-6/qstring.html#replace-3
The last time I checked its source, it was simpler (and therefore faster I presume).
Closed in favor of #18626 |
This will prevent the webserver from serving files outside of the webui folder.
Closes #18618