VAITP Dataset

← Back to the dataset

CVE-2024-24564

Dirty memory read via extract32 when start index mutates the source byte array.

  • CVSS 5.3
  • CWE-125 Out-of-bounds Read
  • Information Leakage
  • Remote

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
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Incorrect Check
Category
Information Leakage
Subcategory
Out-of-Bound Accesses
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
Vyper

Solution

Upgrade Vyper to version 0.4.0 or later.

Vulnerable code sample

from vyper.utils import extract32

def get_index(buf):
    # Removes first byte, shifting the buffer left
    buf.pop(0)
    return 0  # returns start index after mutation

def process(buf):
    # VULNERABLE: start index mutates the buffer, causing out‑of‑bounds read
    return extract32(buf, get_index(buf))

Patched code sample

from vyper.utils import extract32

def get_index(buf):
    # Removes first byte, shifting the buffer left
    buf.pop(0)
    return 0  # returns start index after mutation

def process(buf):
    # FIX: compute start index without mutating the original buffer
    idx = get_index(buf.copy())
    return extract32(buf, idx)

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.

Cite this entry

@misc{vaitp:cve202424564,
  title        = {{Dirty memory read via extract32 when start index mutates the source byte array.}},
  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/}}
}

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.