CVE-2021-3177
JSON

9.8critical

ctypes: Buffer overflow in PyCArg_repr

Severity
9.8critical CVSS:3.1 by CISA-ADP
Exploit likelihood
24.0% (higher than 97% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
PSF-2021-3BIT-LIBPYTHON-2021-3177BIT-PYTHON-2021-3177BIT-PYTHON-MIN-2021-3177

Description

Python 3.x through 3.9.1 has a buffer overflow in PyCArg_repr 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 c_double.from_param. This occurs because sprintf is used unsafely.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
https://github.com/python/cpythonbefore 34df10a9a16b38d54421eeeaf73ec89828563be7, before 916610ef90a0d0761f08747f7b0905541f0977c7, before c347cbe694743cee120457aa6626712f7799a932, before d9b8f138b7df3b455b54653ca59f491b4840d6fa, before ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5fPython Software Foundation
python pythonfrom 3.6.0 up to 3.6.12, from 3.7.0 up to 3.7.9, from 3.8.0 up to 3.8.7, from 3.9.0 up to 3.9.1NVD
fedoraproject fedora32, 33NVD
netapp active_iq_unified_managerNot specifiedNVD
netapp ontap_select_deploy_administration_utilityNot specifiedNVD
debian debian_linux9.0NVD
oracle communications_cloud_native_core_network_function_cloud_native_environment22.2.0NVD
oracle communications_offline_mediation_controller12.0.0.3.0NVD
oracle communications_pricing_design_center12.0.0.3.0NVD
oracle enterprise_manager_ops_center12.4.0.0NVD
oracle zfs_storage_appliance_kit8.8NVD

All scores

CISA-ADP9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD7.5high CVSS:2.0AV:N/AC:L/Au:N/C:P/I:P/A:P
Bitnami Vulnerability Databasecritical rating

Classification

CWE-120

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.

What each source says

CVE List

Python 3.x through 3.9.1 has a buffer overflow in PyCArg_repr 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 c_double.from_param. This occurs because sprintf is used unsafely.

NVD (es)

Python versiones 3.x hasta 3.9.1, presenta un desbordamiento de búfer en la función PyCArg_repr en el archivo _ctypes/callproc.c, que puede conllevar a una ejecución de código remota en determinadas aplicaciones de Python que aceptan números de punto flotante como entrada no confiable, como es demostrado por un argumento 1e300 para c_double.from_param. Esto ocurre porque sprintf es usado de manera no segura

References

https://bugs.python.org/issue42938advisory, exploit, issue-tracking, patch, report, vendor-advisory
https://github.com/python/cpython/pull/24239advisory, patch, third-party-advisory
https://python-security.readthedocs.io/vuln/ctypes-buffer-overflow-pycarg_repr.htmladvisory, patch, third-party-advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/MGSV6BJQLRQ6RKVUXK7JGU7TP4QFGQXC/vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NQPARTLNSFQVMMQHPNBFOCOZOO3TMQNA/vendor-advisory, web
https://security.gentoo.org/glsa/202101-18advisory, third-party-advisory, vendor-advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/Z7GZV74KM72O2PEJN2C4XP3V5Q5MZUOO/vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CCFZMVRQUKCBQIG5F2CBVADK63NFSE4A/vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BRHOCQYX3QLDGDQGTWQAUUT2GGIZCZUO/vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NXSMBHES3ANXXS2RSO5G6Q24BR4B2PWK/vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/V6XJAULOS5JVB2L67NCKKMJ5NTKZJBSD/vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YDTZVGSXQ7HR7OCGSUHTRNTMBG43OMKU/vendor-advisory, web

Sources

SourceRecordLicence
CVE ListCVE-2021-3177 changed 2026-10-14CVE Terms of Use
Python Software FoundationPSF-2021-3 changed 2025-10-09CC-BY-4.0
NVDCVE-2021-3177 changed 2026-10-14Public domain
Bitnami Vulnerability DatabaseBIT-LIBPYTHON-2021-3177 changed 2026-09-08Apache-2.0
Bitnami Vulnerability DatabaseBIT-PYTHON-2021-3177 changed 2026-09-08Apache-2.0
Bitnami Vulnerability DatabaseBIT-PYTHON-MIN-2021-3177 changed 2026-09-08Apache-2.0