Skip to content

Latest commit

 

History

History
293 lines (209 loc) · 10.1 KB

File metadata and controls

293 lines (209 loc) · 10.1 KB

CVE Scanner

A comprehensive tool for scanning and discovering high-severity CVEs (CVSS score >= 8.5) across multiple programming languages and frameworks using the NIST National Vulnerability Database (NVD) API.

Overview

This CVE scanner provides two implementations:

  1. Modular Scanner (cve-scanner.py) - Uses separate scanner modules for each technology
  2. Unified Scanner (cve-scanner-unified.py) - All functionality consolidated into a single file

Both implementations provide the same functionality but differ in architecture. The unified version is self-contained and easier to distribute, while the modular version offers better code organization and maintainability.

Features

  • 🔍 Multi-Technology Support: Scan CVEs for 9 different technologies and their frameworks
  • 📊 High-Severity Focus: Automatically filters for CVEs with CVSS score >= 8.5
  • 🔄 Case-Insensitive Matching: Robust keyword matching regardless of case
  • 📅 Smart Sorting: Results sorted by publication date (newest first) then by CVSS score
  • 📝 Detailed Output: Shows top 20 CVEs with 400-character summaries
  • Rate Limiting: Built-in rate limiting to respect NVD API limits
  • 🎯 Framework-Specific: Filters out general language CVEs to focus on framework vulnerabilities

Supported Technologies

Technology Frameworks & Libraries Covered
React React Server Components, Next.js, React DOM
Python Django, FastAPI, Flask, Celery, Tornado, Bottle, Pyramid, CherryPy
.NET ASP.NET, ASP.NET Core, Entity Framework, Blazor, SignalR, NuGet
Laravel Laravel Framework, Eloquent, Blade, Artisan, Sanctum, Passport, Horizon
Java Spring Framework, Spring Boot, Hibernate, Apache Struts, Log4j, Tomcat, Maven
Node.js Express, Koa, NestJS, Socket.io, Meteor, Sails, Hapi, Fastify, npm, Webpack
Go Gin, Echo, Fiber, Gorilla, Beego, Revel, Buffalo, Iris, Chi
Rust Actix, Rocket, Tokio, Serde, Hyper, Warp, Tide, Axum, Cargo
C/C++ OpenSSL, libcurl, zlib, libpng, Nginx, Apache HTTP Server, glibc, GCC, Boost, Qt

Installation

No installation required! Just ensure you have Python 3.6+ and the requests library:

pip install requests

Usage

Modular Scanner (cve-scanner.py)

The modular scanner uses separate Python files for each technology:

# Show help
python3 cve-scanner.py
python3 cve-scanner.py --help

# Scan for React CVEs
python3 cve-scanner.py react

# Scan for Python framework CVEs
python3 cve-scanner.py python

# Scan for Java framework CVEs
python3 cve-scanner.py java

# Scan for Node.js CVEs
python3 cve-scanner.py nodejs

# Scan for Go CVEs
python3 cve-scanner.py go

# Scan for Rust CVEs
python3 cve-scanner.py rust

# Scan for C/C++ CVEs
python3 cve-scanner.py c

# Scan for .NET CVEs
python3 cve-scanner.py dotnet

# Scan for Laravel CVEs
python3 cve-scanner.py laravel

Unified Scanner (cve-scanner-unified.py)

The unified scanner is a single self-contained file with all functionality:

# Show help
python3 cve-scanner-unified.py
python3 cve-scanner-unified.py --help

# Scan for any technology (same commands as above)
python3 cve-scanner-unified.py react
python3 cve-scanner-unified.py python
python3 cve-scanner-unified.py java
# ... etc

Unified Scanner Details

Architecture

The cve-scanner-unified.py is a consolidated implementation that:

  • Single File: All scanner logic, technology configurations, and CLI handling in one file
  • Configuration-Driven: Uses TECHNOLOGY_CONFIGS dictionary to define search parameters for each technology
  • Reusable Functions: Shared functions for API calls, filtering, and output formatting
  • Self-Contained: No external module dependencies (except requests)

Key Advantages

  1. Easy Distribution: Single file makes it easy to share or deploy
  2. No Module Imports: Doesn't require importing separate scanner modules
  3. Consistent Behavior: All technologies use the same core scanning logic
  4. Easy to Extend: Add new technologies by adding entries to TECHNOLOGY_CONFIGS

Technology Configuration Structure

Each technology in TECHNOLOGY_CONFIGS includes:

'technology_name': {
    'name': 'Display Name',
    'keywords': [...],           # Keywords for initial search
    'filter_keywords': [...],   # Keywords for filtering results
    'exclude_keywords': [...],  # Keywords to exclude
    'exclude_check': lambda,    # Function to exclude false positives
    'main_search': '...',       # Main keyword for broad search
    'additional_searches': [...] # Optional additional searches
}

Scanning Strategy

The unified scanner uses a multi-strategy approach:

  1. Strategy 1: Keyword searches with Critical severity filter (CVSS >= 9.0)
  2. Strategy 2: Broad search without severity filter, then filter for score >= 8.5
  3. Strategy 3+: Additional framework-specific searches (for technologies like Python)

This ensures comprehensive coverage while respecting API rate limits.

Output Format

Both scanners provide the same output format:

Found X Technology Vulnerabilities (CVSS score >= 8.5). Showing Top 20:

================================================================================
1. CVE-YYYY-XXXXX | Score: 9.8 (Critical)
   Published: YYYY-MM-DD
   Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
   Summary: Detailed description of the vulnerability...
--------------------------------------------------------------------------------
...

File Structure

cve-scanner/
├── README.md                    # This file
├── cve-scanner.py               # Modular scanner (CLI entry point)
├── cve-scanner-unified.py       # Unified scanner (single file)
├── scan-react.py                # React scanner module
├── scan-python.py               # Python scanner module
├── scan-dotnet.py               # .NET scanner module
├── scan-laravel.py              # Laravel scanner module
├── scan-java.py                 # Java scanner module
├── scan-nodejs.py               # Node.js scanner module
├── scan-go.py                   # Go scanner module
├── scan-rust.py                 # Rust scanner module
└── scan-c.py                    # C/C++ scanner module

How It Works

  1. API Connection: Connects to NIST NVD API v2.0
  2. Keyword Search: Searches for CVEs using technology-specific keywords
  3. Severity Filtering: Filters for CVEs with CVSS score >= 8.5
  4. Framework Filtering: Ensures results are framework-related, not just general language CVEs
  5. Deduplication: Removes duplicate CVEs found through multiple searches
  6. Sorting: Sorts by date (newest first) then by CVSS score
  7. Output: Displays top 20 results with detailed information

Rate Limiting

The scanner implements rate limiting to respect NVD API limits:

  • 0.6-0.8 seconds between requests
  • Automatic retry on rate limit errors (HTTP 403)
  • Longer delays after larger searches

Note: For production use, consider obtaining a free API key from NIST for higher rate limits: https://nvd.nist.gov/developers/request-an-api-key

Error Handling

  • Graceful handling of API errors
  • Continues scanning even if individual keyword searches fail
  • Clear error messages for invalid inputs
  • Keyboard interrupt handling (Ctrl+C)

Examples

Example 1: Scan React CVEs

$ python3 cve-scanner.py react

Fetching data from NIST NVD... (This may take a moment)
Searching for React-related CVEs with multiple strategies...

Strategy 1: Keyword searches (CVSS score >= 8.5)
  Searching: 'React Server Components'...
  Searching: 'react-server-dom-webpack'...
  ...

Found 32 React Vulnerabilities (CVSS score >= 8.5). Showing Top 20:

================================================================================
1. CVE-2025-55182 | Score: 10.0 (Critical)
   Published: 2025-12-03
   Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
   Summary: A pre-authentication remote code execution vulnerability exists in React Server Components...

Example 2: Scan Python Framework CVEs

$ python3 cve-scanner-unified.py python

Fetching data from NIST NVD... (This may take a moment)
Searching for Python-related CVEs with multiple strategies...

Strategy 1: Keyword searches (CVSS score >= 8.5)
  Searching: 'Django'...
  Searching: 'FastAPI'...
  ...

Found 25 Python Framework Vulnerabilities (CVSS score >= 8.5). Showing Top 20:
...

Choosing Between Modular and Unified

Use Modular Scanner (cve-scanner.py) if:

  • You want better code organization
  • You're modifying individual technology scanners
  • You prefer modular architecture
  • You're working in a team environment

Use Unified Scanner (cve-scanner-unified.py) if:

  • You want a single file to distribute
  • You need a self-contained solution
  • You're deploying to environments with limited file access
  • You prefer configuration-driven approach

Requirements

  • Python 3.6 or higher
  • requests library (pip install requests)
  • Internet connection (for NVD API access)

Limitations

  • NVD API rate limits may slow down scanning
  • Some CVEs may not be immediately available in NVD
  • Keyword-based search may miss some CVEs if they don't match search terms
  • Results limited to top 20 CVEs per technology

Contributing

To add support for a new technology:

  1. For Modular Scanner: Create a new scan-<technology>.py file following the pattern of existing scanners
  2. For Unified Scanner: Add a new entry to TECHNOLOGY_CONFIGS dictionary

License

This tool is provided for educational and security research purposes. Use responsibly and only on systems you own or have explicit permission to test.

References

Disclaimer

This tool is for authorized security testing and research purposes only. The authors are not responsible for any misuse of this code. Always ensure you have proper authorization before scanning or testing any systems.