Skip to content

fix(plugins): prevent path traversal in wordlist file resolution#449

Open
ionfwsrijan wants to merge 1 commit into
utksh1:mainfrom
ionfwsrijan:fix/issue-445-wordlist-path-traversal
Open

fix(plugins): prevent path traversal in wordlist file resolution#449
ionfwsrijan wants to merge 1 commit into
utksh1:mainfrom
ionfwsrijan:fix/issue-445-wordlist-path-traversal

Conversation

@ionfwsrijan
Copy link
Copy Markdown
Contributor

Description

Adds path traversal protection to the wordlist resolution logic in plugins.py. The change validates that all wordlist paths are contained within settings.wordlists_dir and rejects any path containing parent directory traversal (..), preventing arbitrary file reads.

Related Issues

Closes #445

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Attempted to call the scanner with a wordlist path containing ../ — returns a clear error
  • Called with a path outside settings.wordlists_dir — rejected
  • Called with a valid path inside settings.wordlists_dir — resolves correctly
  • Called with an absolute path that escapes the wordlists directory — rejected

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • My changes generate no new warnings.

- Add _reject_path_traversal() to block parent-directory traversal
- Add _is_path_in_wordlists_dir() to constrain resolved paths to the
  configured wordlists directory
- Raise ValueError when an existing path resolves outside the allowed
  directory, preventing arbitrary filesystem access
- Keep aliases and fallback resolution within wordlists_dir
- Reject absolute paths and '..' traversal by default
@ionfwsrijan
Copy link
Copy Markdown
Contributor Author

@utksh1 You may review and merge

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

Successfully merging this pull request may close these issues.

Plugin wordlist / file-path inputs allow arbitrary local filesystem access (path traversal + sensitive file exposure)

1 participant