VAITP Dataset

← Back to the dataset

CVE-2024-24564

  • CVSS 5.3
  • CWE-125 Out-of-bounds Read

Vyper is a pythonic Smart Contract Language for the ethereum virtual machine. When using the built-in `extract32(b, start)`, if the `start` index provided has for side effect to update `b`, the byte array to extract `32` bytes from, it could be that some dirty memory is read and returned by `extract32`. This vulnerability is fixed in 0.4.0.

CVSS base score
5.3
Published
2024-02-26
Subcategory
Out-of-Bound Accesses

Vulnerable code sample

def vulnerable_function(user_input):
    """Vulnerable function that processes user input unsafely."""
    # VULNERABLE: Unsafe processing of user input
    result = eval(user_input)  # Never use eval with untrusted input!
    return result

Patched code sample

# Example of a safe implementation of extract32 in Vyper

def safe_extract32(b: bytes, start: int) -> bytes:
    """Secure function that fixes the vulnerability."""
    # Ensure that the start index is valid and does not modify the original byte array
    assert start >= 0 and start + 32 <= len(b), "Invalid start index"
    return b[start:start + 32]

Cite this entry

@misc{vaitp:cve202424564,
  title        = {{}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2024},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2024-24564},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-24564/}}
}
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 ::