CVE-2021-43572
Python Charmers Future 0.18.2 and earlier: Remote attacker causes denial of service via malicious Set-Cookie header
- CVSS 9.8
- CWE-347 Improper Verification of Cryptographic Signature
- Cryptographic
- Remote
The verify function in the Stark Bank Python ECDSA library (aka starkbank-escada or ecdsa-python) before 2.0.1 fails to check that the signature is non-zero, which allows attackers to forge signatures on arbitrary messages.
- CVSS base score
- 9.8
- Published
- 2021-11-09
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Cryptographic
- Subcategory
- Cryptographic Implementation Error
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Fixed by upgrading
- Yes
Solution
Update starkbank-ecdsa to version 2.0.1 or higher.
Vulnerable code sample
from ecdsa import VerifyingKey, BadSignatureError
def verify_signature(public_key: bytes, signature: bytes, message: bytes) -> bool:
vk = VerifyingKey.from_string(public_key)
try:
return vk.verify(signature, message)
except BadSignatureError:
return FalsePatched code sample
from ecdsa import VerifyingKey, BadSignatureError
def verify_signature(public_key: bytes, signature: bytes, message: bytes) -> bool:
vk = VerifyingKey.from_string(public_key)
if all(x == 0 for x in signature):
raise ValueError("Signature cannot be zero")
try:
return vk.verify(signature, message)
except BadSignatureError:
return FalseCite this entry
@misc{vaitp:cve202143572,
title = {{Python Charmers Future 0.18.2 and earlier: Remote attacker causes denial of service via malicious Set-Cookie header}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2021},
note = {VAITP Python Vulnerability Dataset, entry CVE-2021-43572},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2021-43572/}}
}
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 ::
