Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 71ae72a

Browse files
committed
Added Proof of Concept exploits from GitHub
1 parent e1d1062 commit 71ae72a

File tree

10 files changed

+101
-16
lines changed

10 files changed

+101
-16
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ python3 cveseeker.py cve-2024 --critical --high --medium --low # include critica
3232
- [www.rapid7.com](https://www.rapid7.com) (WIP)
3333
- [cve.mitre.org](https://cve.mitre.org/cve/search_cve_list.html) (WIP)
3434
- [github.com](https://github.com) (WIP)
35+
- [github.com PoC](https://github.com/nomi-sec/PoC-in-GitHub) (IMPLEMENTED)
3536
- [github.com advisories](https://github.com/advisories) (IMPLEMENTED)
3637
- [github.com/trickest/cve](https://github.com/search?q=repo%3Atrickest%2Fcve%20cve-2024&type=code) (IMPLEMENTED)
3738

config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ enrichment:
1111
sources:
1212
vulners: true
1313
github: true
14-
cisa_kev: true
14+
cisa_kev: true
15+
github_poc: true

services/search/engine/collection.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
import time
33
from typing import List
44
from models.vulnerability import Vulnerability
5-
from models.vulnerability_intelligence import VulnerabilityIntelligence
65
from services.api.source import Source
7-
from services.vulnerability_intelligence.enrichment.vulnerability_intelligence_enrichment_manager import VulnerabilityIntelligenceEnrichmentManager
86

97
def collect_from_source_with_retries(manager, source: Source, keywords: List[str], max_results: int) -> List[Vulnerability]:
108
attempts = 0
@@ -24,13 +22,6 @@ def collect_from_source_with_retries(manager, source: Source, keywords: List[str
2422
time.sleep(retry_delay)
2523
retry_delay *= 2
2624

27-
def is_enrichment_enabled(config: dict) -> bool:
28-
return any(config.get('sources', {}).values())
29-
30-
def perform_enrichment(vulnerabilities: List[VulnerabilityIntelligence], config: dict) -> List[VulnerabilityIntelligence]:
31-
enrichment_manager = VulnerabilityIntelligenceEnrichmentManager(vulnerabilities, config)
32-
return enrichment_manager.enrich()
33-
3425
def collect_results(manager, keywords: List[str], max_results: int) -> List[Vulnerability]:
3526
collected_results = []
3627
with ThreadPoolExecutor(max_workers=256) as executor:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from typing import List
2+
from models.vulnerability_intelligence import VulnerabilityIntelligence
3+
from services.vulnerability_intelligence.enrichment.vulnerability_intelligence_enrichment_manager import VulnerabilityIntelligenceEnrichmentManager
4+
5+
def is_enrichment_enabled(config: dict) -> bool:
6+
return any(config.get('sources', {}).values())
7+
8+
def perform_enrichment(vulnerabilities: List[VulnerabilityIntelligence], config: dict) -> List[VulnerabilityIntelligence]:
9+
enrichment_manager = VulnerabilityIntelligenceEnrichmentManager(vulnerabilities, config)
10+
return enrichment_manager.enrich()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from typing import List
2+
from models.vulnerability import Vulnerability
3+
from services.vulnerability_intelligence.processors.vulnerability_intelligence_processor import VulnerabilityIntelligenceProcessor
4+
5+
def prepare_intelligence_from_vulnerabilities(vulnerabilities: List[Vulnerability], keywords):
6+
return VulnerabilityIntelligenceProcessor.process(vulnerabilities, keywords)

services/search/search_manager.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from typing import List, Dict
22
from models.vulnerability_intelligence import VulnerabilityIntelligence
33
from services.api.source import Source
4-
from services.search.engine.collection import collect_results, is_enrichment_enabled, perform_enrichment
4+
from services.search.engine.collection import collect_results
5+
from services.search.engine.enrichment import is_enrichment_enabled, perform_enrichment
56
from services.search.engine.filtering import filter_by_severity
7+
from services.search.engine.intelligence import prepare_intelligence_from_vulnerabilities
68
from services.search.engine.modifiers import prepare_descriptions
79
from services.search.engine.progress import ProgressManager
8-
from services.vulnerability_intelligence.processors.vulnerability_intelligence_processor import VulnerabilityIntelligenceProcessor
910

1011
class SearchManager:
1112
def __init__(
@@ -25,11 +26,11 @@ def __init__(
2526
def search(self, keywords: List[str], max_results: int, desired_severities=[]) -> List[VulnerabilityIntelligence]:
2627
print(f"[*] Initiating search for: \"{' '.join(keywords)}\" with a maximum of {max_results} results per source.\n")
2728

28-
collected_results = collect_results(self, keywords, max_results)
29+
results = collect_results(self, keywords, max_results)
2930

3031
print("[+] Collection process complete.")
31-
32-
results = VulnerabilityIntelligenceProcessor.process(collected_results, keywords)
32+
33+
results = prepare_intelligence_from_vulnerabilities(results, keywords)
3334

3435
if is_enrichment_enabled(self.enrichment_config):
3536
print("\n[*] Initiating enrichment process.")

services/vulnerabilities/validators/vulnerability_validator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import re
22
from typing import List, Tuple
33
from models.vulnerability import Vulnerability
4-
from services.api.sources.cisa_kev import CISAKEVAPI
54

65
class VulnerabilityValidator:
76
version_pattern = r'\b\d+(\.\d+)*\b'
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import httpx
2+
import logging
3+
from typing import Dict
4+
5+
def fetch_github_poc_data(cve: str) -> Dict:
6+
year = cve.split('-')[1]
7+
url = f"https://raw.githubusercontent.com/nomi-sec/PoC-in-GitHub/refs/heads/master/{year}/{cve}.json"
8+
9+
pocs = []
10+
11+
try:
12+
response = httpx.get(url, timeout=15)
13+
14+
if response.status_code == 200:
15+
json_data = response.json()
16+
17+
18+
for entry in json_data:
19+
data = {
20+
'github_url': 'N/A',
21+
'github_description': None,
22+
'github_date': 'N/A',
23+
'github_tags': [],
24+
'github_stars': 0
25+
}
26+
27+
data['github_url'] = entry["html_url"]
28+
data['github_description'] = entry["description"]
29+
data['github_date'] = entry["updated_at"]
30+
data['github_tags'].extend(entry["topics"])
31+
data['github_stars'] = entry["stargazers_count"]
32+
33+
pocs.append(data)
34+
35+
except Exception as e:
36+
logging.error(f"Error fetching JSON PoC data for CVE {cve}: {e}")
37+
38+
return pocs

services/vulnerability_intelligence/enrichment/vulnerability_intelligence_enrichment_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
from services.vulnerability_intelligence.enrichment.enrichment.cisa_kev import cisa_kev_enrich_vulnerability
66
from services.vulnerability_intelligence.enrichment.enrichment.github import github_fetch_cve_data
7+
from services.vulnerability_intelligence.enrichment.enrichment.github_poc import fetch_github_poc_data
78
from services.vulnerability_intelligence.enrichment.enrichment.vulners import vulners_find_related_cve_data
9+
from services.vulnerability_intelligence.handlers.github_poc_handler import GitHubPoCHandler
810
from services.vulnerability_intelligence.handlers.vulners_handler import VulnersHandler
911
from services.vulnerability_intelligence.handlers.github_handler import GitHubHandler
1012
from services.vulnerability_intelligence.handlers.cisa_kev_handler import CisaKevHandler
@@ -17,12 +19,14 @@ def __init__(self, vulnerability_intelligence_list: List[VulnerabilityIntelligen
1719
self.enrichment_functions = {
1820
"Vulners": vulners_find_related_cve_data,
1921
"GitHub": github_fetch_cve_data,
22+
"GitHubPoc": fetch_github_poc_data,
2023
"CISA KEV": cisa_kev_enrich_vulnerability
2124
}
2225

2326
self.handlers = {
2427
"Vulners": VulnersHandler,
2528
"GitHub": GitHubHandler,
29+
"GitHubPoc": GitHubPoCHandler,
2630
"CISA KEV": CisaKevHandler
2731
}
2832

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from services.vulnerability_intelligence.handlers.base_handler import BaseHandler
2+
from models.vulnerability_intelligence import VulnerabilityIntelligence
3+
import logging
4+
5+
class GitHubPoCHandler(BaseHandler):
6+
def apply(self, vuln_intelligence: VulnerabilityIntelligence):
7+
try:
8+
sorted_data = sorted(self.data, key=lambda entry: entry.get('github_stars', 0), reverse=True)
9+
10+
for entry in sorted_data:
11+
github_url = entry.get('github_url', "N/A")
12+
github_date = entry.get('github_date', "N/A")
13+
github_description = entry.get('github_description')
14+
github_tags = entry.get('github_tags', [])
15+
github_stars = entry.get('github_stars')
16+
17+
if github_description:
18+
vuln_intelligence.descriptions.append({
19+
"source": self.enrich_source_name("GitHub PoC"),
20+
"text": github_description,
21+
"date": github_date
22+
})
23+
24+
vuln_intelligence.urls.append({
25+
"source": self.enrich_source_name(f"GitHub - PoC Exploit [{github_stars} ⭐]"),
26+
"url": github_url,
27+
"date": github_date
28+
})
29+
30+
vuln_intelligence.reference_urls.update([github_url])
31+
vuln_intelligence.tags.update(github_tags)
32+
33+
except Exception as e:
34+
logging.error(f"Error applying GitHub JSON PoC enrichment: {e}")

0 commit comments

Comments
 (0)