Skip to content
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

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

alromh87
Copy link

@alromh87 alromh87 commented Sep 17, 2020

馃搳 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

Copy link

@Mik317 Mik317 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 馃槃 馃帀
Please consider it's not a bypass of #2 since it was a fix referred to another bounty (npm-superstatic-1) 馃槈

Cheers,
Mik

Copy link

@mufeedvh mufeedvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ghost ghost requested a review from JamieSlome October 9, 2020 14:50
@JamieSlome JamieSlome merged commit a818437 into 418sec:master Oct 9, 2020
@huntr-helper
Copy link
Member

Congratulations alromh87 - your fix has been selected! 馃帀

Thanks for being part of the community & helping secure the world's open source code.
If you have any questions, please respond in the comments section, or hit us up on Discord. Your bounty is on its way - keep hunting!

Come join us on Discord

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
7 participants