Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory Traversal Vulnerability #33

Open
aprilliar13 opened this issue Dec 1, 2024 · 0 comments
Open

Directory Traversal Vulnerability #33

aprilliar13 opened this issue Dec 1, 2024 · 0 comments

Comments

@aprilliar13
Copy link

aprilliar13 commented Dec 1, 2024

Summary:

In the find_by_file function at line 195, the file path is not strictly validated, allowing directory traversal via the ../../ characters. This vulnerability enables attackers to access arbitrary files, such as /etc/passwd.

Vulnerability Type

Directory Traversal

Affected Version

JSFinder commit d70ab9b

Attack Type

Local

Reproduction Steps

  1. Clone the repository locally using: git clone https://github.com/Threezh1/JSFinder.
    image
  2. Enter the JSFinder directory and install the necessary Python dependencies, such as BeautifulSoup, urllib3, and requests.
  3. Run the following command in the test directory to exploit the vulnerability and access the /etc/passwd file: python3 JSFinder.py -f ../../../../etc/passwd. For Windows users, you can replace other files within the program, such as ../../../../win.ini, to demonstrate file access on the Windows system.
    image

Mitigation

  • Path Normalization
    Use os.path.abspath() to resolve absolute paths
    Prevent directory traversal with os.path.commonpath()
  • Input Validation

Reference

http://jsfinder.com/
https://github.com/Threezh1/JSFinder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant