This repository was archived by the owner on Dec 19, 2023. It is now read-only.
Fixed path traversal vulnerability when symlinking directories #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.
📊 Metadata *
Creating a symlink to a directory could allow acces to system files
Bounty URL: https://www.huntr.dev/bounties/2-npm-superstatic/
⚙️ Description *
Path is tested for symlinked directories, in case it is request is denied
💻 Technical Description *
If symlink filter is enabled and file is not symlink every directory in the path, starting from base directory, is tested to be symlink, in positive case request is denied
🐛 Proof of Concept (PoC) *
1)Install the Superstatic module
$ npm install -g superstatic
2)Make a directory
$ mkdir test
3)Go to 'test' directory
$ cd test
4)create a symlink file to directory
ln -s /etc/ 'dirname'
5)Run Superstatic module
Superstatic
6)Request the file within browser
http://localhost:3474/'dirname'/'regularfile'
http://localhost:3474/poc/passwd
7)Content of file is returned to browser
🔥 Proof of Fix (PoF) *
After fix error page is shown, any symlink in the path will be recognized
👍 User Acceptance Testing (UAT)
Original functionality unafected
