Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/visma-prodsec/confused
Tool to check for dependency confusion vulnerabilities in multiple package management systems
https://github.com/visma-prodsec/confused
confusion-detection infosec java javascript maven namespaces npm php pypi python
Last synced: 10 days ago
JSON representation
Tool to check for dependency confusion vulnerabilities in multiple package management systems
- Host: GitHub
- URL: https://github.com/visma-prodsec/confused
- Owner: visma-prodsec
- License: mit
- Created: 2021-02-10T09:06:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-29T02:05:04.000Z (8 months ago)
- Last Synced: 2024-04-26T00:23:03.391Z (7 months ago)
- Topics: confusion-detection, infosec, java, javascript, maven, namespaces, npm, php, pypi, python
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 650
- Watchers: 12
- Forks: 89
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs-security - confused - Tool to check for dependency confusion vulnerabilities in multiple package management systems. See [Dependency Confusion: How I Hacked Into Apple, Microsoft and Dozens of Other Companies](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610) for reference on the reasoning for this tool. (Vulnerabilities and Security Advisories)
- WebHackersWeapons - confused - prodsec/confused?label=%20)|[`dependency-confusion`](/categorize/tags/dependency-confusion.md)|![linux](/images/linux.png)![macos](/images/apple.png)![windows](/images/windows.png)[![Go](/images/go.png)](/categorize/langs/Go.md)| (Weapons / Tools)
README
# Confused
A tool for checking for lingering free namespaces for private package names referenced in dependency configuration
for Python (pypi) `requirements.txt`, JavaScript (npm) `package.json`, PHP (composer) `composer.json` or MVN (maven) `pom.xml`.## What is this all about?
On 9th of February 2021, a security researcher Alex Birsan [published an article](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610)
that touched different resolve order flaws in dependency management tools present in multiple programming language ecosystems.Microsoft [released a whitepaper](https://azure.microsoft.com/en-gb/resources/3-ways-to-mitigate-risk-using-private-package-feeds/)
describing ways to mitigate the impact, while the root cause still remains.## Interpreting the tool output
`confused` simply reads through a dependency definition file of an application and checks the public package repositories
for each dependency entry in that file. It will proceed to report all the package names that are not found in the public
repositories - a state that implies that a package might be vulnerable to this kind of attack, while this vector has not
yet been exploited.This however doesn't mean that an application isn't already being actively exploited. If you know your software is using
private package repositories, you should ensure that the namespaces for your private packages have been claimed by a
trusted party (typically yourself or your company).### Known false positives
Some packaging ecosystems like npm have a concept called "scopes" that can be either private or public. In short it means
a namespace that has an upper level - the scope. The scopes are not inherently visible publicly, which means that `confused`
cannot reliably detect if it has been claimed. If your application uses scoped package names, you should ensure that a
trusted party has claimed the scope name in the public repositories.## Installation
- [Download](https://github.com/visma-prodsec/confused/releases/latest) a prebuilt binary from [releases page](https://github.com/visma-prodsec/confused/releases/latest), unpack and run!
_or_
- If you have recent go compiler installed: `go get -u github.com/visma-prodsec/confused` (the same command works for updating)_or_
- git clone https://github.com/visma-prodsec/confused ; cd confused ; go get ; go build## Usage
```
Usage:
confused [-l LANGUAGENAME] depfilename.extUsage of confused:
-l string
Package repository system. Possible values: "pip", "npm", "composer", "mvn", "rubygems" (default "npm")
-s string
Comma-separated list of known-secure namespaces. Supports wildcards
-v Verbose output```
## Example
### Python (PyPI)
```
./confused -l pip requirements.txtIssues found, the following packages are not available in public package repositories:
[!] internal_package1```
### JavaScript (npm)
```
./confused -l npm package.jsonIssues found, the following packages are not available in public package repositories:
[!] internal_package1
[!] @mycompany/internal_package1
[!] @mycompany/internal_package2# Example when @mycompany private scope has been registered in npm, using -s
./confused -l npm -s '@mycompany/*' package.jsonIssues found, the following packages are not available in public package repositories:
[!] internal_package1
```### Maven (mvn)
```
./confused -l mvn pom.xmlIssues found, the following packages are not available in public package repositories:
[!] internal
[!] internal/package1
[!] internal/_package2```
### Ruby (rubygems)
```
./confused -l rubygems Gemfile.lockIssues found, the following packages are not available in public package repositories:
[!] internal
[!] internal/package1
[!] internal/_package2
```