Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS00djlxLWNncHctY2YzOM4AArZb

Multiple evaluation of contract address in call in vyper

Impact

when a calling an external contract with no return value, the contract address could be evaluated twice. this is usually only an efficiency problem, but if evaluation of the contract address has side effects, it could result in double evaluation of the side effects.

in the following example, Foo(msg.sender).bar() is the contract address for the following call (to .foo()), and could get evaluated twice

interface Foo:
    def foo(): nonpayable
    def bar() -> address: nonpayable

@external
def do_stuff():
    Foo(Foo(msg.sender).bar()).foo()

Patches

6b4d8ff185de071252feaa1c319712b2d6577f8d

Workarounds

assign contract addresses to variables. the above example would change to

@external
def do_stuff():
    t: Foo = Foo(msg.sender).bar()
    t.foo()

References

For more information

Permalink: https://github.com/advisories/GHSA-4v9q-cgpw-cf38
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00djlxLWNncHctY2YzOM4AArZb
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: almost 2 years ago
Updated: 8 months ago


CVSS Score: 7.5
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Identifiers: GHSA-4v9q-cgpw-cf38, CVE-2022-29255
References: Repository: https://github.com/vyperlang/vyper
Blast Radius: 17.8

Affected Packages

pypi:vyper
Dependent packages: 3
Dependent repositories: 236
Downloads: 40,650 last month
Affected Version Ranges: < 0.3.4
Fixed in: 0.3.4
All affected versions: 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.2.10, 0.2.11, 0.2.12, 0.2.13, 0.2.14, 0.2.15, 0.2.16, 0.3.0, 0.3.1, 0.3.2, 0.3.3
All unaffected versions: 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.3.9, 0.3.10