LiveActive security incident?Get immediate response
CVE Record

CVE-2021-3177: Python 3.x through 3.9.1 has a buffer overflow in PyCArg_repr in _ctypes/callproc.c, which may lead to remo...

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.

CriticalCVSS 9.8Not KEV-listedUpdated
Glexia's TakeAutomated analysiscritical

Security readout for executives and security teams

Plain-English summary

This flaw is in Python's ctypes handling of certain floating-point values. In specific applications that pass untrusted numeric input into vulnerable ctypes paths, memory corruption could lead to code execution. The risk is serious, but exposure depends on application behavior, not merely having Python installed.

Executive priority

Treat as high-priority patching for Python-dependent systems, especially public services. The business urgency is greatest where untrusted input may enter ctypes-based code paths. Broad emergency response is not supported without evidence of active exploitation or confirmed reachability.

Technical view

Python 3.x through 3.9.1 used unsafe sprintf formatting in PyCArg_repr in _ctypes/callproc.c, causing a buffer overflow tied to ctypes floating-point parameter handling. The CVE maps to CWE-120 and carries CVSS 3.1 score 9.8 with potential confidentiality, integrity, and availability impact.

Likely exposure

Exposure is most likely in services running Python 3.x through 3.9.1 or affected downstream packages, where untrusted input can reach ctypes floating-point conversion or representation paths. A generic Python runtime finding needs application-level reachability review.

Exploitation context

The source bundle marks KEV false and provides no cited evidence of active exploitation. The CVSS vector models unauthenticated network exploitation with low complexity, but the description limits practical impact to certain Python applications accepting floating-point input as untrusted data.

Researcher notes

Key evidence is the unsafe sprintf use in PyCArg_repr and the upstream CPython fix reference. The CVE's affected-product metadata is sparse, so researchers should validate against actual Python versions, distro backports, and application reachability rather than relying only on scanner banners.

Mitigation direction

  • Upgrade Python or distro Python packages using vendor security advisories.
  • Prioritize internet-facing services that parse external numeric input.
  • Check Fedora, Gentoo, Debian, and CPython guidance for applicable fixed builds.
  • Reduce exposure by validating untrusted numeric input before ctypes use.
  • Retire unsupported Python versions from production workloads.

Validation and detection

  • Inventory Python runtime versions across servers, containers, and build images.
  • Identify applications using ctypes with externally supplied numeric data.
  • Confirm deployed packages include the CPython fix referenced by PR 24239.
  • Review vendor advisory status for each operating system distribution.
  • Run regression tests around numeric parsing and ctypes integration paths.
Prepared
Confidence
high
Sources
8

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-120: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
description · low confidence lookup

Execution behavior lookup

The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2021-3177 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
Critical
CVSS
9.8 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
0Timeline events
0ADP providers
29Source links

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
9.8CVSS 3.1CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H3.95.9Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

9.8Critical
CVSS 3.1 vector shape for CVE-2021-3177Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone

Source materials

Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
n/an/an/aListed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-120 · source CWE mapping

Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.