BIT-python-min-2021-3177: Buffer Overflow
Python 3.x through 3.9.1 has a buffer overflow in PyCArgrepr in ctypes/callproc.c, which may lead to remote code execution in certain Python applications that accept floating-point numbers as untrusted input, as demonstrated by a 1e300 argument to cdouble.fromparam. This occurs because sprintf is used unsafely.
Affected Software
Event History
Frequently Asked Questions
What conditions make an application exposed?
Exposure is limited to Python applications that accept floating-point values from untrusted sources and pass them through the affected ctypes path, such as c_double.from_param. Applications that do not process untrusted floating-point input through this path are not described as affected.
Does exploitation require authentication or user interaction?
The supplied severity vector indicates network exploitation with low attack complexity, no privileges required, and no user interaction required. Successful exploitation can affect confidentiality, integrity, and availability.
How can I identify potentially affected deployments?
Identify systems running Python 3.x through 3.9.1, then review applications using ctypes for handling of externally supplied floating-point values. In particular, assess code paths that invoke c_double.from_param with untrusted input, including unusually large values such as 1e300.