- Getting Started
- Installation
- Basic Usage
- Advanced Features
- API Reference
- Examples
- Best Practices
- Troubleshooting
CVE Explorer Pro is a comprehensive Rust library and CLI tool designed for deep vulnerability analysis. Whether you're a security researcher, penetration tester, or developer, this tool provides sophisticated capabilities for understanding and analyzing Common Vulnerabilities and Exposures (CVEs).
- Enhanced Code Quality: Removed mock-up code for improved reliability
- Better Error Handling: More robust error management and edge case handling
- Performance Improvements: Optimized analysis algorithms
- Comprehensive Documentation: Complete API documentation and examples
cargo install cve_explorer_proAdd to your Cargo.toml:
[dependencies]
cve_explorer_pro = "0.1.1"- Rust 1.70.0 or later
- Internet connection for NVD API access
- Optional: NVD API key for higher rate limits
The CLI provides three analysis modes:
cve-explorer --cve CVE-2021-34527Provides:
- Root cause analysis
- Vulnerability categorization
- Basic severity assessment
- Prevention recommendations
cve-explorer --cve CVE-2021-34527 --mode exploitationProvides:
- Attack surface mapping
- Entry point identification
- Privilege escalation analysis
- Proof-of-concept templates
cve-explorer --cve CVE-2021-34527 --mode fullCombines both basic and exploitation analysis for comprehensive insights.
cve-explorer --cve CVE-2021-34527 --format jsonPerfect for automation and integration with other tools.
cve-explorer --cve CVE-2021-34527 --format summaryConcise overview with key findings.
cve-explorer --cve CVE-2021-34527 --format detailedHuman-readable comprehensive report.
For enhanced rate limits (50 requests/30 seconds vs 5 requests/30 seconds):
cve-explorer --cve CVE-2021-34527 --api-key YOUR_NVD_API_KEYGet your free API key at: https://nvd.nist.gov/developers/request-an-api-key
use cve_explorer_pro::{CVEFetcher, RootCauseAnalyzer};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize fetcher
let fetcher = CVEFetcher::new(Some("your_api_key".to_string()));
// Fetch CVE data
let cve = fetcher.fetch_cve("CVE-2021-34527").await?;
// Analyze vulnerability
let analyzer = RootCauseAnalyzer;
let analysis = analyzer.analyze_vulnerability(&cve);
println!("CVE ID: {}", cve.id);
println!("Severity: {:?}", cve.cvss.as_ref().unwrap().severity);
println!("Primary Cause: {:?}", analysis.primary_cause);
Ok(())
}use cve_explorer_pro::{CVEFetcher, ExploitationPathAnalyzer};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fetcher = CVEFetcher::new(None);
let cve = fetcher.fetch_cve("CVE-2021-34527").await?;
// Perform exploitation analysis
let exploit_analyzer = ExploitationPathAnalyzer;
let exploitation = exploit_analyzer.analyze_exploitation_path(&cve);
println!("Attack Complexity: {:.1}/10", exploitation.exploitation_complexity.overall_score);
println!("Entry Points: {}", exploitation.attack_surface.entry_points.len());
// Access proof-of-concept template
if let Some(poc) = &exploitation.poc_template {
println!("PoC Language: {}", poc.language);
println!("Target Environment: {}", poc.target_environment);
}
Ok(())
}use cve_explorer_pro::{CVEFetcher, RootCauseAnalyzer, ExploitationPathAnalyzer, display_json_output};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fetcher = CVEFetcher::new(None);
let cve = fetcher.fetch_cve("CVE-2021-34527").await?;
// Perform both analyses
let analyzer = RootCauseAnalyzer;
let analysis = analyzer.analyze_vulnerability(&cve);
let exploit_analyzer = ExploitationPathAnalyzer;
let exploitation = exploit_analyzer.analyze_exploitation_path(&cve);
// Output as JSON
display_json_output(&cve, Some(&analysis), Some(&exploitation))?;
Ok(())
}The main data structure representing a vulnerability:
id: CVE identifier (e.g., "CVE-2021-34527")description: Detailed vulnerability descriptioncvss: CVSS scoring informationexploitability: Exploitation characteristicsremediation: Patch and mitigation information
Results of vulnerability root cause analysis:
primary_cause: Main vulnerability categorycontributing_factors: Additional factorsarchitectural_flaws: Design-level issuesprevention_recommendations: Remediation advice
Results of exploitation path analysis:
attack_surface: Entry points and interfacesexploitation_complexity: Difficulty scoringprivilege_escalation_chain: Attack progressionpoc_template: Proof-of-concept code template
Creates a new CVE fetcher with optional API key.
Fetches CVE data from the NVD API.
Performs root cause analysis on a CVE.
Analyzes exploitation paths and attack surfaces.
use cve_explorer_pro::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let cves = vec!["CVE-2021-34527", "CVE-2020-1472", "CVE-2019-0708"];
let fetcher = CVEFetcher::new(None);
let analyzer = RootCauseAnalyzer;
for cve_id in cves {
println!("\n=== Analyzing {} ===", cve_id);
match fetcher.fetch_cve(cve_id).await {
Ok(cve) => {
let analysis = analyzer.analyze_vulnerability(&cve);
println!("Severity: {:?}", cve.cvss.as_ref().unwrap().severity);
println!("Primary Cause: {:?}", analysis.primary_cause);
println!("Contributing Factors: {}", analysis.contributing_factors.len());
// Check if high-risk
if cve.cvss.as_ref().unwrap().base_score >= 7.0 {
println!("⚠️ HIGH RISK vulnerability detected!");
}
}
Err(e) => eprintln!("Error analyzing {}: {}", cve_id, e),
}
}
Ok(())
}use cve_explorer_pro::*;
use std::fs::File;
use std::io::Write;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fetcher = CVEFetcher::new(None);
let cve = fetcher.fetch_cve("CVE-2021-34527").await?;
let analyzer = RootCauseAnalyzer;
let analysis = analyzer.analyze_vulnerability(&cve);
let exploit_analyzer = ExploitationPathAnalyzer;
let exploitation = exploit_analyzer.analyze_exploitation_path(&cve);
// Generate report
let mut report = File::create("vulnerability_report.txt")?;
writeln!(report, "CVE ANALYSIS REPORT")?;
writeln!(report, "===================")?;
writeln!(report, "CVE ID: {}", cve.id)?;
writeln!(report, "Severity: {:?}", cve.cvss.as_ref().unwrap().severity)?;
writeln!(report, "CVSS Score: {:.1}", cve.cvss.as_ref().unwrap().base_score)?;
writeln!(report, "Primary Cause: {:?}", analysis.primary_cause)?;
writeln!(report, "Exploitation Complexity: {:.1}/10", exploitation.exploitation_complexity.overall_score)?;
writeln!(report, "Attack Surface Entry Points: {}", exploitation.attack_surface.entry_points.len())?;
println!("Report generated: vulnerability_report.txt");
Ok(())
}use cve_explorer_pro::*;
use serde_json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let fetcher = CVEFetcher::new(std::env::var("NVD_API_KEY").ok());
// Monitor specific CVEs
let watch_list = vec!["CVE-2021-34527", "CVE-2020-1472"];
for cve_id in watch_list {
match fetcher.fetch_cve(cve_id).await {
Ok(cve) => {
let analyzer = RootCauseAnalyzer;
let analysis = analyzer.analyze_vulnerability(&cve);
// Create alert payload
let alert = serde_json::json!({
"cve_id": cve.id,
"severity": cve.cvss.as_ref().unwrap().severity,
"score": cve.cvss.as_ref().unwrap().base_score,
"primary_cause": analysis.primary_cause,
"timestamp": chrono::Utc::now(),
"requires_attention": cve.cvss.as_ref().unwrap().base_score >= 7.0
});
println!("Alert payload: {}", serde_json::to_string_pretty(&alert)?);
// Here you would send to your monitoring system
// send_alert_to_monitoring_system(&alert).await?;
}
Err(e) => eprintln!("Failed to fetch {}: {}", cve_id, e),
}
}
Ok(())
}- Always use environment variables for API keys
- Never hardcode API keys in source code
- Consider rate limiting in production applications
let api_key = std::env::var("NVD_API_KEY").ok();
let fetcher = CVEFetcher::new(api_key);- Always handle potential network failures
- Implement retry logic for critical applications
- Log errors appropriately
match fetcher.fetch_cve(cve_id).await {
Ok(cve) => {
// Process CVE
}
Err(CVEError::NetworkError(e)) => {
eprintln!("Network error: {}. Retrying...", e);
// Implement retry logic
}
Err(CVEError::NotFound) => {
eprintln!("CVE {} not found", cve_id);
}
Err(e) => {
eprintln!("Unexpected error: {}", e);
}
}- Cache CVE data when analyzing multiple related vulnerabilities
- Use batch processing for large datasets
- Consider async processing for concurrent analysis
- Validate CVE IDs before processing
- Sanitize output when displaying analysis results
- Be cautious when executing generated proof-of-concept code
Problem: Getting rate limited by NVD API
Solution:
- Obtain and use an API key
- Implement proper delays between requests
- Use exponential backoff for retries
Problem: Network timeouts or connection failures
Solution:
- Check internet connectivity
- Verify firewall settings allow HTTPS traffic
- Implement timeout and retry mechanisms
Problem: CVE not found errors
Solution:
- Verify CVE ID format (CVE-YYYY-NNNN)
- Check if CVE exists in NVD database
- Ensure CVE is published (not reserved)
Problem: Failed to parse NVD response
Solution:
- Check if NVD API format has changed
- Verify network response is complete
- Update to latest library version
Enable debug logging for troubleshooting:
env_logger::init();
log::debug!("Fetching CVE: {}", cve_id);- Issues: Report bugs at GitHub Issues
- Documentation: Visit docs.rs
- Examples: Check the
examples/directory in the repository
CVE Explorer Pro v0.1.1 - Enhanced security analysis for the modern threat landscape