CVE-2024-26149: Vyper _abi_decode Memory Overflow

Published Feb 26, 2024
·
Updated

Summary

If an excessively large value is specified as the starting index for an array in abidecode, it can cause the read position to overflow. This results in the decoding of values outside the intended array bounds, potentially leading to bugs in contracts that use arrays within abidecode. The advisory has been assigned low severity, because it is only observable if there is a memory write between two invocations of abidecode on the same input.

Proof of Concept

vyper event Pwn: pass

@external def f(x: Bytes[32 3]): a: Bytes[32] = b"foo" y: Bytes[32 3] = x

decodedy1: Bytes[32] = abidecode(y, Bytes[32]) a = b"bar" decodedy2: Bytes[32] = abidecode(y, Bytes[32])

if decodedy1 != decodedy2: log Pwn()

Sending the following calldata results in Pwn being emitted.

0xd45754f8 0000000000000000000000000000000000000000000000000000000000000020 0000000000000000000000000000000000000000000000000000000000000060 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0

Patches Patched in https://github.com/vyperlang/vyper/pull/3925, https://github.com/vyperlang/vyper/pull/4091, https://github.com/vyperlang/vyper/pull/4144, https://github.com/vyperlang/vyper/pull/4060.

Other sources

Vyper is a pythonic Smart Contract Language for the ethereum virtual machine. If an excessively large value is specified as the starting index for an array in abidecode, it can cause the read position to overflow. This results in the decoding of values outside the intended array bounds, potentially leading to exploitations in contracts that use arrays within abidecode. This vulnerability affects 0.3.10 and earlier versions.

— MITRE

Affected Software

2 affected componentsFixes available
pip/vyper<0.4.0
0.4.0
vyperlang Vyper Python<=0.3.10

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/vyper to a version that resolves this vulnerability.

    Fixed in 0.4.0
  2. Upgrade

    Upgrade vyper to a version that resolves this vulnerability.

    Patch 0xd45754f8
  3. Upgrade

    Upgrade vyper to a version that resolves this vulnerability.

    Fixed in 0.3.10

Event History

Feb 26, 2024
Advisory Published
via GitHub·08:11 PM
CVE Published
via MITRE·08:16 PM
Data Sourced
via MITRE·08:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:19 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-26149?

CVE-2024-26149 has a high severity due to potential overflow when decoding array values.

2

How do I fix CVE-2024-26149?

To fix CVE-2024-26149, upgrade to Vyper version 0.4.0 or higher.

3

What types of software are affected by CVE-2024-26149?

CVE-2024-26149 affects Vyper versions up to and including 0.3.10.

4

Can CVE-2024-26149 lead to security risks?

Yes, CVE-2024-26149 can lead to bugs in smart contracts, resulting in potential security vulnerabilities.

5

What impact does CVE-2024-26149 have on decentralized applications?

CVE-2024-26149 can undermine the reliability of decentralized applications by causing unintended behavior in array handling.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203