This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
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 *
Bounty URL: https://www.huntr.dev/bounties/1-npm-superstatic
鈿欙笍 Description *
The
superstatic
server was vulnerable against apath traversal
issue which occurred becausesymlink
files where showed, leading todangerous scenario
which could be exploitable.馃捇 Technical Description *
In order to avoid the issue, I added the possibility to simply check if the
symlink
option flag has been set when starting the server. Ifsymlink
flag is passed when invoking thesuperstatic
command, the symlinks are showed and fetched successfully, whereas whensymlink
flag is missed, it's showed a404
error.The added
flag
makes possible switching really simply between the 2 options, and I added a bit of doc in theREADME
to be sure people aware of the options it-self and risks.Finally, the
default
value of thesymlink
flag isfalse
(security reason, shares the same concept of other webserver likeNginx
) and if devs are using thelib version
, it's necessary just switching thedefault
value totrue
in case they want to serve alsosymlink
files.馃悰 Proof of Concept (PoC) *
bin
dir./server
symlink
likeln -s /etc/passwd test
/etc/passwd
showed馃敟 Proof of Fix (PoF) *
Same steps with fixed version
Using the
symlink
flag:Without
symlink
flag:馃憤 User Acceptance Testing (UAT)
Seems all OK 馃憤