VAITP Dataset

← Back to the dataset

CVE-2019-14853

Python-ecdsa < 0.13.3: Flaw in handling malformed DER signatures can lead to denial of service

  • CVSS 7.5
  • CWE-755
  • Input Validation and Sanitization
  • Remote

An error-handling flaw was found in python-ecdsa before version 0.13.3. During signature decoding, malformed DER signatures could raise unexpected exceptions (or no exceptions at all), which could lead to a denial of service.

CVSS base score
7.5
Published
2019-11-26
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
python-ecdsa
Fixed by upgrading
Yes

Solution

Update python-ecdsa to version 0.13.3 or higher.

Vulnerable code sample

from ecdsa import VerifyingKey

def verify_signature(public_key_bytes, signature, message):
    vk = VerifyingKey.from_string(public_key_bytes)
    vk.verify(signature, message)

Patched code sample

from ecdsa import VerifyingKey, BadSignatureError

def verify_signature(public_key_bytes, signature, message):
    try:
        vk = VerifyingKey.from_string(public_key_bytes)
        vk.verify(signature, message)
    except BadSignatureError:
        print("Invalid signature.")
    except Exception as e:
        print(f"An error occurred: {e}")

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • Backport signature decode (warner/python-ecdsa)
    ecdsa/der.py · read_length, ecdsa/der.py · remove_integer, ecdsa/der.py · remove_sequence, ecdsa/keys.py, ecdsa/keys.py · SigningKey.from_secret_exponent, ecdsa/keys.py · SigningKey.from_string, ecdsa/keys.py · VerifyingKey.from_der, ecdsa/keys.py · VerifyingKey.from_string, ecdsa/keys.py · VerifyingKey.verify_digest, ecdsa/util.py, ecdsa/util.py · sigdecode_string, ecdsa/util.py · sigdecode_strings and 1 more

Cite this entry

@misc{vaitp:cve201914853,
  title        = {{Python-ecdsa < 0.13.3: Flaw in handling malformed DER signatures can lead to denial of service}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2019},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2019-14853},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-14853/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.