Headline
GHSA-v432-7f47-9g94: PostQuantum-Feldman-VSS'S Dependency Vulnerability in gmpy2 Leading to Interpreter Crash
Summary
PostQuantum-Feldman-VSS, in versions ≤0.7.6b0, is vulnerable due to its dependency on gmpy2, which can crash the Python interpreter if memory allocation fails. This can be exploited for denial-of-service attacks, impacting the availability of systems using the library.
Description
The vulnerability arises from gmpy2’s behavior, as noted in its documentation:
gmpy2 can crash the Python interpreter in case of memory allocation failure (gmpy2 Overview)
This stems from gmpy2’s reliance on the GMP library, which terminates the program when memory allocation fails (GMP Memory Management). An attacker can exploit this by crafting inputs that exhaust memory, causing the interpreter to crash and disrupting service for legitimate users.
Impact
- Availability: High impact, as the interpreter crash leads to complete denial of service.
- Confidentiality and Integrity: No direct impact, as the vulnerability does not allow unauthorized access or data modification.
Affected Versions
- All versions of PostQuantum-Feldman-VSS ≤0.7.6b0
Patched Versions
- Versions >0.7.6b0 (e.g., 0.7.7 or later, once released with the
SafeGMPy2
implementation)
Workarounds (For Vulnerable Versions)
For users unable to upgrade to a patched version:
- Estimate Memory Usage: Manually estimate memory requirements before operations and ensure sufficient resources.
- Monitor System Resources: Implement monitoring to detect and respond to memory exhaustion attempts.
- Custom Memory Allocation: Use GMP’s custom allocation functions to handle failures gracefully (GMP Custom Allocation).
Mitigation Details
The fix introduces a SafeGMPy2
wrapper that:
- Checks input sizes against configurable limits (e.g.,
DEFAULT_MAX_BITS_POWMOD = 20000
). - Estimates output sizes to prevent excessive memory use (e.g., in multiplication and powmod).
- Wraps critical gmpy2 functions (mpz, powmod, invert) with try-except blocks to raise
MemorySafetyError
instead of crashing. - Monkey-patches gmpy2 to enforce these safety checks globally.
This has been integrated into key classes like
CyclicGroup
andFeldmanVSS
, ensuring memory-safe cryptographic operations.
References
Summary
PostQuantum-Feldman-VSS, in versions ≤0.7.6b0, is vulnerable due to its dependency on gmpy2, which can crash the Python interpreter if memory allocation fails. This can be exploited for denial-of-service attacks, impacting the availability of systems using the library.
Description
The vulnerability arises from gmpy2’s behavior, as noted in its documentation:
gmpy2 can crash the Python interpreter in case of memory allocation failure (gmpy2 Overview)
This stems from gmpy2’s reliance on the GMP library, which terminates the program when memory allocation fails (GMP Memory Management). An attacker can exploit this by crafting inputs that exhaust memory, causing the interpreter to crash and disrupting service for legitimate users.
Impact
- Availability: High impact, as the interpreter crash leads to complete denial of service.
- Confidentiality and Integrity: No direct impact, as the vulnerability does not allow unauthorized access or data modification.
Affected Versions
- All versions of PostQuantum-Feldman-VSS ≤0.7.6b0
Patched Versions
- Versions >0.7.6b0 (e.g., 0.7.7 or later, once released with the SafeGMPy2 implementation)
Workarounds (For Vulnerable Versions)
For users unable to upgrade to a patched version:
- Estimate Memory Usage: Manually estimate memory requirements before operations and ensure sufficient resources.
- Monitor System Resources: Implement monitoring to detect and respond to memory exhaustion attempts.
- Custom Memory Allocation: Use GMP’s custom allocation functions to handle failures gracefully (GMP Custom Allocation).
Mitigation Details
The fix introduces a SafeGMPy2 wrapper that:
- Checks input sizes against configurable limits (e.g., DEFAULT_MAX_BITS_POWMOD = 20000).
- Estimates output sizes to prevent excessive memory use (e.g., in multiplication and powmod).
- Wraps critical gmpy2 functions (mpz, powmod, invert) with try-except blocks to raise MemorySafetyError instead of crashing.
- Monkey-patches gmpy2 to enforce these safety checks globally.
This has been integrated into key classes like CyclicGroup and FeldmanVSS, ensuring memory-safe cryptographic operations.
References
- gmpy2 Overview Documentation
- GMP Memory Management Documentation
- GMP Custom Allocation Documentation
References
- GHSA-v432-7f47-9g94