Dependency Confusion Checker is a Python-based tool for identifying potential dependency confusion vulnerabilities in JavaScript (package.json
) and Python (requirements.txt
) projects. Dependency confusion occurs when there is an overlap between private and public package names, which can allow attackers to inject malicious packages.
- Checks for potential dependency confusion vulnerabilities in both JavaScript (
package.json
) and Python (requirements.txt
) dependencies. - Parses dependency files and checks for package availability in public registries.
- Flags dependencies that may cause dependency confusion based on version inconsistencies between private and public repositories.
- Python 3.6+
- Internet connection (to check against public registries)
-
Clone the repository:
git clone https://github.com/yourusername/dependency-confusion-checker.git cd dependency-confusion-checker
-
Install the required dependencies:
pip install -r requirements.txt
This tool is designed to take input from stdin
and expects a requirements.txt
file (for Python) or package.json
(for JavaScript) in the URL. The main script check.py
reads the input and processes each dependency to detect potential dependency confusion vulnerabilities.
To run the tool, use the following command:
cat urls.txt | python check.py
Or, for a JavaScript project:
cat urls.txt | python check.py
The tool will output a list of dependencies that may be vulnerable to dependency confusion:
[VULN] https://redacted-js.com/package.json [package-notfound|404|js]
[VULN] https://redacted-py.com/requirements.txt [package-notfound|404|python]
0
: No issues found.1
: Potential dependency confusion vulnerabilities detected.
-
The
check.py
script reads fromstdin
to receive the list of dependencies. -
For each dependency, it:
- Checks if the package exists on public registries such as PyPI (for Python) or npm (for JavaScript).
- Compares versions to identify inconsistencies.
- Flags any packages that may lead to dependency confusion.
-
Results are printed in the console, listing any vulnerable packages found.
This project is licensed under the MIT License.
Note: This tool is intended for security analysis purposes. Always use responsibly and only on projects for which you have authorization.