-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix SimpleWeb arbitrary file read vulnurability #829
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
Fix SimpleWeb arbitrary file read vulnurability #829
Conversation
src/confighttp.cpp
Outdated
response->write(SimpleWeb::StatusCode::success_ok, in, headers); | ||
else if(!isChildPath(filePath, nodeModulesPath)) { | ||
BOOST_LOG(warning) << "Someone requested a path " << filePath << " that is outside the node_modules folder"; | ||
response->write(SimpleWeb::StatusCode::client_error_bad_request, "Not Authorized"); |
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 still log the attempt, but give 404 nevertheless. The attacker shouldn't know if the file exists or not
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.
How about a straight up 400 with no other info. We can do the 400 in the case that the path is outside the node modules even if it doesn't exist. That way there would be no way to map out the user's computer.
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.
Ok I've made that change in my latest commit and it seems to work as expected. Lemme know your thoughts.
Description
Fix for this using std::filesystem and computing relative paths.
Type of Change
.github/...
)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.