[security] Path traversal due to incorrect input sanitization. #3
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.
Suggestion cannot be applied right now. Please check back later.
Vulnerability Report
Summary
There exists a path traversal vulnerability in the
/<path:url>/<path:filename>
route. This occurs as attacker controlled values are used directly in thesend_from_directory
call.The vulnerability can be attributed to the following block of code.
BaiduWenkuSpider_flaskWeb/GetAll.py
Lines 697 to 700 in 1247944
os.path.join
call is not safe when used with untrusted input. It does not behave well when linux and windows file schemes are mixed and can lead to path traversal vulnerabilities.Remediation
The code in this PR should fix the underlying issue.
GitHub Security Advisories
If possible, please could you create a GitHub Security Advisory for these findings?
When you use a GitHub Security Advisory, you can request a CVE identification number from GitHub. GitHub usually reviews the request within 72 hours, and the CVE details will be published after you make your security advisory public. Publishing a GitHub Security Advisory and a CVE will help notify the downstream consumers of your project, so they can update to the fixed version.