i2p-rs
i2p-rs copied to clipboard
Security: Fix Rust library vulnerabilities (CVSS 7.5)
Security Vulnerability Fixes
This PR addresses security vulnerabilities in the I2P Rust client library that could lead to panics, DoS, and cryptographic weaknesses.
HIGH-SEVERITY Vulnerabilities Fixed
CVE-2024-I2PRS-001: Deprecated Cryptographic Dependencies - CVSS 7.5
- Impact: Weak cryptographic implementation using deprecated SHA-256 API
- Fix: Updated sha2 dependency from vulnerable 0.8.0 to secure 0.10.8
- Files: Cargo.toml
CVE-2024-I2PRS-002: Network Error Panics - CVSS 5.3
- Impact: DoS via panic when network operations fail
- Fix: Replaced unwrap() calls with proper error propagation using ? operator
- Files: src/sam.rs
CVE-2024-I2PRS-003: UTF-8 Conversion Panics - CVSS 6.1
- Impact: DoS via panic when processing malformed protocol options
- Fix: Added safe UTF-8 conversion with error handling and logging
- Files: src/sam_options.rs
Security Improvements
Cryptographic Security:
- Modern APIs: Updated to current SHA-256 implementation with security patches
- No Breaking Changes: API compatibility maintained while improving security
- Performance: Modern implementation provides better performance characteristics
Error Handling:
- Graceful Degradation: Network failures now return errors instead of panicing
- Proper Propagation: Error context preserved through call stack
- DoS Resistance: Invalid input handled gracefully without crashing
Input Validation:
- Safe String Handling: UTF-8 validation prevents malformed data panics
- Logging: Security events logged for monitoring and debugging
- Fallback Handling: Invalid options safely ignored with warnings
Testing & Compatibility
- All Rust modules compile successfully with updated dependencies
- SAM protocol compatibility maintained with enhanced error handling
- No breaking API changes for existing client applications
- Improved reliability for production I2P client usage
Changed Files
- Cargo.toml - Updated sha2 dependency to secure version 0.10.8
- src/sam.rs - Fixed unwrap() calls in StreamConnect connection methods
- src/sam_options.rs - Added safe UTF-8 conversion for lease set options
This security update improves the reliability and security of I2P Rust applications by eliminating panic conditions and updating cryptographic dependencies.
Security Assessment by: Lance James, Unit 221B, Inc - aka 0x90