CVE-2024-22419 concat built-in can corrupt memory in vyper

High 7.3 Published Updated

The Vyper compiler's concat built-in can corrupt memory, potentially altering smart contract semantics or enabling code execution.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-22419?

CVE-2024-22419 is a high-severity memory corruption vulnerability in vyperlang vyper, published on 18 Jan 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine. The `concat` built-in can write over the bounds of the memory buffer that was allocated for it and thus overwrite existing valid data. The root cause is that the `build_IR` for `concat` doesn't properly adhere to the API of copy functions (for `>=0.3.2` the `copy_bytes` function). A contract search was performed and no vulnerable contracts were found in production. The buffer overflow can result in the change of semantics of the contract. The overflow is length-dependent and thus it might go unnoticed during contract testing. However, certainly not all usages of concat will result in overwritten valid data as we require it to be in an internal function and close to the return statement where other memory allocations don't occur. This issue has been addressed in 0.4.0.

Weakness: CWE-787, CWE-120

Which versions are affected by CVE-2024-22419?

3 open source packages ship an affected version, including vyper. It affects 1 product.

PackageAffectedFixed in
vyper PyPIAll versions0.4.0b1
vyper PyPIFrom 0.3.00.4.0
vyper PyPIFrom 0.3.00.4.0

Products include Vyperlang Vyper.

How do I fix CVE-2024-22419?

Upgrade vyper to a fixed version for your release line: 0.4.0b1 or 0.4.0.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2024-22419 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-22419 exists.

Sources

Also known as GHSA-2q8v-3gqq-4f8p, PYSEC-2024-103.

Is CVE-2024-22419 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free