Back to Projects

Syntecxhub_Project_cve-vulnerability-scanner

No description provided

0
Stars
0
Forks
0
Watchers
0
Open Issues

README.md

## ⚠️ **Ethical Use & Responsible Disclosure:**

### **Included in Report:**
```
📝 REMEDIATION RECOMMENDATIONS:

1. IMMEDIATE ACTIONS:
   • Review all CRITICAL and HIGH severity vulnerabilities
   • Patch affected services to latest versions
   • Disable unnecessary services

2. RESPONSIBLE DISCLOSURE:
   • Do NOT exploit these vulnerabilities
   • Notify the security team immediately
   • Follow coordinated disclosure (90 days)

3. VERIFICATION:
   • Re-scan after patching
   • Monitor CVE databases




🚀 Quick Start:
Step 1: Install Dependencies
pip install requests packaging

Step 2: Run Scanner
# Scan localhost
python cve_scanner.py -t localhost

# Scan specific ports
python cve_scanner.py -t 192.168.1.1 -p 80,443,22

# Scan port range
python cve_scanner.py -t example.com -p 1-1024
```

---

## 💡 **How It Works:**

### **Step 1: Banner Grabbing**
```
Port 80 → Send HTTP request → Receive: "Server: Apache/2.4.41"
Port 22 → Connect → Receive: "SSH-2.0-OpenSSH_7.4"
Port 3306 → Connect → Receive: "5.7.33-MariaDB"
```

### **Step 2: Service Parsing**
```
Banner: "Apache/2.4.41 (Ubuntu)"
↓
Extracted: Product = "Apache", Version = "2.4.41"
```

### **Step 3: CVE Lookup**
```
Query NVD API: "Apache 2.4.41"
↓
Results: CVE-2021-40438 (CRITICAL, Score 9.0)
         CVE-2020-35452 (HIGH, Score 7.5)

Step 3: Report Generation
{
  "vulnerabilities": [
    {
      "cve_id": "CVE-2021-40438",
      "severity": "CRITICAL",
      "cvss_score": 9.0,
      "product": "Apache",
      "version": "2.4.41"
    }
  ]
}
```

---

## 📊 **Sample Output:**
```
🔍 Scanning 192.168.1.1 for services...
Ports to scan: 15
============================================================
✅ Port 22: SSH - OpenSSH 7.4
✅ Port 80: HTTP - Apache 2.4.41
✅ Port 443: HTTPS - Apache 2.4.41
✅ Port 3306: MySQL - MySQL 5.7.33

📊 Found 4 open services

🔎 Checking for known vulnerabilities...
============================================================

🔍 Checking Apache 2.4.41... Found 3 CVEs
🔍 Checking OpenSSH 7.4... Found 5 CVEs
🔍 Checking MySQL 5.7.33... Found 2 CVEs

⚠️  Total vulnerabilities found: 10

============================================================
📋 CVE VULNERABILITY SCAN REPORT
============================================================
Target: 192.168.1.1
Scan Date: 2026-02-12 18:30:45
Services Found: 4
Vulnerabilities Found: 10
============================================================

⚠️  VULNERABILITIES BY SEVERITY:
--------------------------------------------------------------------

🔴 CRITICAL (2 CVEs)
--------------------------------------------------------------------

  CVE ID: CVE-2021-40438
  CVSS Score: 9.0
  Product: Apache 2.4.41
  Port: 80
  Published: 2021-09-16
  Description: Server-Side Request Forgery (SSRF) in Apache...

🟠 HIGH (3 CVEs)
--------------------------------------------------------------------
...
```

---

## 🎯 **Key Features:**

### **1. Service Detection**
Identifies:
- Apache / nginx
- OpenSSH
- MySQL / PostgreSQL
- FTP servers
- And more...

### **2. Version Extraction**
Parses banners to find exact versions:
- `Apache/2.4.41`
- `OpenSSH_7.4`
- `MySQL 5.7.33`

### **3. CVE Database Integration**
- Queries NVD API automatically
- Returns CVE IDs, descriptions, scores
- Categorizes by severity

### **4. Severity Scoring**
```
🔴 CRITICAL: 9.0-10.0 (Immediate action required)
🟠 HIGH:     7.0-8.9  (Urgent patching needed)
🟡 MEDIUM:   4.0-6.9  (Should be addressed)
🟢 LOW:      0.1-3.9  (Monitor and plan)



💻 Usage Examples:
Example 1: Basic Scan
python cve_scanner.py -t localhost

Example 2: Specific Ports
python cve_scanner.py -t 192.168.1.1 -p 80,443,22,3306

Example 3: Port Range
python cve_scanner.py -t example.com -p 1-1024

Example 4: Custom Output
python cve_scanner.py -t 10.0.0.1 -p 21-25 -o my_scan.json

Example 5: Verbose Mode
python cve_scanner.py -t localhost -v




🔧 Configuration:

Adjust Timeout:
python cve_scanner.py -t target --timeout 5

Custom Port Range:
# Web services
python cve_scanner.py -t target -p 80,443,8080,8443

# Databases
python cve_scanner.py -t target -p 3306,5432,27017,6379

# Common services
python cve_scanner.py -t target -p 21,22,23,25,80,443


📊 Output Files:
1. JSON Report (cve_report.json)

{
  "scan_info": {
    "target": "192.168.1.1",
    "timestamp": "2026-02-11T18:30:45",
    "services_found": 4,
    "vulnerabilities_found": 10
  },
  "services": [...],
  "vulnerabilities": [...],
  "summary": {
    "by_severity": {
      "CRITICAL": 2,
      "HIGH": 3,
      "MEDIUM": 4,
      "LOW": 1
    }
  }
}
```

### **2. Log File (cve_scan.log)**
```
2026-02-11 18:30:45 - INFO - CVE Scanner initialized
2026-02-11 18:30:46 - INFO - Detected service on port 80: HTTP
2026-02-11 18:30:47 - INFO - Found 3 CVEs for Apache 2.4.41



💡 Pro Tips:

Test on localhost first - Safe and quick
Start with common ports - 80,443,22,3306
Use verbose mode - See what's happening (-v)
Review JSON report - Machine-readable output
Check CVE details - Visit nvd.nist.gov for full info


⚠️ Important Notes:
NVD API Rate Limits:

Free tier: Limited requests
For production use: Get API key from NVD
Scanner handles rate limits gracefully

Authorized Testing Only:

Only scan your own systems
Get written permission
Follow responsible disclosure
Document everything