This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
Wrongly closed: Fixed path traversal vulnerability when symlinking directories #4
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 *
Still valid as it fixes a Vulnerability after proposed fix #2
Creating a symlink to a directory could allow acces to system files, proposed fix handles symlinked files but not directories
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
馃憤 User Acceptance Testing (UAT)
Original functionality unafected