Skip to main content

Advanced security scanner for detecting AI-generated dependency confusion vulnerabilities with signature verification support

Project description

Dep-Hallucinator

Security scanner that detects AI-generated dependency confusion vulnerabilities in software projects.

Problem

AI code assistants sometimes suggest packages that don't exist. Attackers can register these hallucinated package names with malicious code. When developers install the suggested dependency, they execute the attacker's payload.

Solution

Dep-Hallucinator detects these non-existent packages and suspicious packages that may be malicious registrations.

Features

  • Registry scanning: Checks PyPI, npm, Maven Central, Crates.io, and Go Modules
  • ML detection: Identifies AI-generated naming patterns
  • Heuristic analysis: Analyzes package age, downloads, and metadata
  • Risk classification: HIGH/MEDIUM/LOW risk levels with explanations
  • Multi-language support: Python, JavaScript, Java, Rust, Go
  • SBOM generation: Creates Software Bill of Materials
  • CI/CD integration: Exit codes and JSON output

Supported Ecosystems

Language Registry File Types
Python PyPI requirements.txt, poetry.lock, Pipfile.lock
JavaScript npm package.json, yarn.lock
Java Maven Central pom.xml, build.gradle
Rust Crates.io Cargo.toml, Cargo.lock
Go Go Modules go.mod, go.sum

Installation

pip install dep-hallucinator

Usage

# Basic scan
dep-hallucinator scan requirements.txt

# With options
dep-hallucinator scan requirements.txt --rate-limit 5.0 --max-concurrent 10

# JSON output
dep-hallucinator scan requirements.txt --output-format json

# Generate SBOM
dep-hallucinator scan requirements.txt --generate-sbom

# Batch scan
dep-hallucinator batch requirements.txt package.json pom.xml

Example Output

🔍 Scanning 8 dependencies...

📊 Scan Summary           
🚨 CRITICAL │   2   │ VULNERABLE
🔶 HIGH     │   1   │ SUSPICIOUS  
✅ LOW      │   5   │     OK     

🚨 CRITICAL VULNERABILITIES

📦 ai-powered-data-processor (==1.0.0)
   Suspicion Score: 100% (CRITICAL) | ML: 95%
   Reasons:
   • Package does not exist in the registry
   • Vulnerable to dependency confusion attacks
   • ML models indicate high probability of AI generation
   Recommendations:
   → Do not install this package
   → Check if this was generated by an AI assistant

Configuration

Create .dep-hallucinator.json:

{
  "scan": {
    "rate_limit": 10.0,
    "max_concurrent": 20,
    "timeout_seconds": 30
  },
  "security": {
    "max_file_size_mb": 10
  }
}

Development

git clone https://github.com/serhanwbahar/dep-hallucinator.git
cd dep-hallucinator
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,test]"
make test

Exit Codes

  • 0: No critical vulnerabilities
  • 1: Critical vulnerabilities found
  • 2: High risk packages found (with --fail-on-high)
  • 3: Scan errors

License

MIT License. See LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dep_hallucinator-1.0.1.tar.gz (104.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dep_hallucinator-1.0.1-py3-none-any.whl (103.5 kB view details)

Uploaded Python 3

File details

Details for the file dep_hallucinator-1.0.1.tar.gz.

File metadata

  • Download URL: dep_hallucinator-1.0.1.tar.gz
  • Upload date:
  • Size: 104.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for dep_hallucinator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 eb669a2298f2336e3e5bb00f7b241d59902c0655b6334424292db6bab290913e
MD5 6606d92c7092ca267c5b813b98d75d5d
BLAKE2b-256 e2b7198f7358b044dda8be0c8cc48084b0b7fd9308bbed1dd9de98907210f9f4

See more details on using hashes here.

File details

Details for the file dep_hallucinator-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dep_hallucinator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d31588bd1614d77c1b4b7037fcf7be124581b8a597dd910b7ff765f5baf31b9
MD5 7e5fcd821b232ab6192c937f56975c1b
BLAKE2b-256 e1ac52a07bd23abd436c6ecb9312eb79f0245a44c65c6771ce94bbb7f87af17d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page