NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · PyPI

CVE-2024-32645: vyper performs incorrect topic logging in raw_log

mediumCVSS 3.1 5.3GHSA-xchq-w5r3-4wg3

Summary Incorrect values can be logged when rawlog builtin is called with memory or storage arguments to be used as topics. A contract search was performed and no vulnerable contracts were found in production. In particular, no uses of rawlog() were found at all in production; it is apparently not a well-known function.

Published Apr 25, 2024 · Updated Jan 21, 2025

Affected packages

vyper

Ecosystem
PyPI
Affected
< 0.4.0
Fixed in
0.4.0
Check
pip show vyper

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

Summary

Incorrect values can be logged when raw_log builtin is called with memory or storage arguments to be used as topics.

A contract search was performed and no vulnerable contracts were found in production. In particular, no uses of raw_log() were found at all in production; it is apparently not a well-known function.

Details

The build_IR function of the RawLog class fails to properly unwrap the variables provided as topics. Consequently, incorrect values are logged as topics.

PoC

x: bytes32

@external
def f():
    self.x = 0x1234567890123456789012345678901234567890123456789012345678901234
    raw_log([self.x], b"") # LOG1(offset:0x60, size:0x00, topic1:0x00)

    y: bytes32 = 0x1234567890123456789012345678901234567890123456789012345678901234
    raw_log([y], b"") # LOG1(offset:0x80, size:0x00, topic1:0x40)

Patches

Fixed in https://github.com/vyperlang/vyper/pull/3977.

Impact

Incorrect values can be logged which may result in unexpected behavior in client-side applications relying on these logs.

Credited to chen-robert.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More PyPI vulnerabilities

All PyPI entries