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.0.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.0-py3-none-any.whl (103.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dep_hallucinator-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 de3148db3d02e7ec1d4beb5bfe5acb80f4758974a903251ff527213001239533
MD5 609a96f8a316813e27efff722d93b11b
BLAKE2b-256 12a4d46525e3694707e32f0db3bca0ce125d2538a543998034f2d42ff0d41609

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dep_hallucinator-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4db688db0fb50b0e25fa7e4c862d1258076d5f6f81e38d5b35f26afa0c88d61e
MD5 2ec417676ba0a6dfb37e906a2b7c74eb
BLAKE2b-256 d29ab2a2e18c68911a90b9c33a053f3dc590947f7e659433be3646c30705ad60

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