CVE-2023-36327

9.8 CRITICAL

📋 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

Products:
  • RELIC cryptographic toolkit
Versions: All versions before commit 421f2e91cf2ba42473d4d54daf24e295679e290e
Operating Systems: All platforms where RELIC is used
Default Config Vulnerable: ⚠️ Yes
Notes: Any application linking against vulnerable RELIC versions is affected when using bn_get_prime function.

📦 What is this software?

⚠️ 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.

🌐 Internet-Facing: HIGH - Cryptographic libraries are often exposed in network services and APIs.
🏢 Internal Only: MEDIUM - Still significant risk for internal applications using RELIC for cryptography.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

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

all

Implement 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

📤 Share & Export