Lucene search

K
osvGoogleOSV:GHSA-XCHQ-W5R3-4WG3
HistoryApr 25, 2024 - 7:53 p.m.

vyper performs incorrect topic logging in raw_log

2024-04-2519:53:10
Google
osv.dev
3
vyper
rawlog
topic logging
incorrect values
vulnerability
client-side applications

5.3 Medium

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

NONE

Integrity Impact

LOW

Availability Impact

NONE

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

0.0004 Low

EPSS

Percentile

9.2%

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.

5.3 Medium

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

NONE

Integrity Impact

LOW

Availability Impact

NONE

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

0.0004 Low

EPSS

Percentile

9.2%

Related for OSV:GHSA-XCHQ-W5R3-4WG3