CVE-2023-36327
📋 TL;DR
This integer overflow vulnerability in RELIC cryptographic library allows attackers to execute arbitrary code or cause denial of service by exploiting the bn_get_prime function. It affects all systems using vulnerable versions of RELIC before commit 421f2e91cf2ba42473d4d54daf24e295679e290e.
💻 Affected Systems
- RELIC cryptographic toolkit
📦 What is this software?
Relic by Relic Project
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise, data theft, or persistent backdoor installation.
Likely Case
Denial of service causing application crashes or instability in cryptographic operations.
If Mitigated
Limited impact if proper input validation and bounds checking are implemented at application layer.
🎯 Exploit Status
Integer overflow vulnerabilities typically require specific input conditions but can be reliably exploited once understood.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Commit 421f2e91cf2ba42473d4d54daf24e295679e290e and later
Vendor Advisory: https://groups.google.com/g/relic-discuss/c/A_J2-ArVIAo/m/qgFiXsUJBQAJ
Restart Required: Yes
Instructions:
1. Update RELIC to commit 421f2e91cf2ba42473d4d54daf24e295679e290e or later. 2. Rebuild and reinstall RELIC. 3. Rebuild any applications using RELIC. 4. Restart affected services.
🔧 Temporary Workarounds
Input validation wrapper
allImplement application-level validation for inputs to bn_get_prime function
// Add bounds checking before calling bn_get_prime
// Validate 'pos' parameter is within safe integer range
🧯 If You Can't Patch
- Isolate systems using RELIC behind network segmentation
- Implement strict input validation and sanitization for all RELIC function calls
🔍 How to Verify
Check if Vulnerable:
Check RELIC git commit hash: git log --oneline -1
Check Version:
git log --oneline -1 | grep -q '421f2e91cf2ba42473d4d54daf24e295679e290e' && echo 'Patched' || echo 'Vulnerable'
Verify Fix Applied:
Verify commit hash includes 421f2e91cf2ba42473d4d54daf24e295679e290e or later
📡 Detection & Monitoring
Log Indicators:
- Application crashes during cryptographic operations
- Memory corruption errors in system logs
- Unexpected process termination
Network Indicators:
- Unusual network traffic to/from cryptographic services
- Protocol anomalies in TLS/SSL handshakes
SIEM Query:
process_name:relic AND (event_type:crash OR memory_violation)
🔗 References
- https://github.com/relic-toolkit/relic/commit/421f2e91cf2ba42473d4d54daf24e295679e290e
- https://groups.google.com/g/relic-discuss/c/A_J2-ArVIAo/m/qgFiXsUJBQAJ?utm_medium=email&utm_source=footer
- https://github.com/relic-toolkit/relic/commit/421f2e91cf2ba42473d4d54daf24e295679e290e
- https://groups.google.com/g/relic-discuss/c/A_J2-ArVIAo/m/qgFiXsUJBQAJ?utm_medium=email&utm_source=footer