Advisory

GHSA-4v9q-cgpw-cf38

Also known as: CVE-2022-29255, PYSEC-2022-43053

Summary

Multiple evaluation of contract address in call in vyper

Details

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

Severity

High Basis: The source's own band: HIGH

Dates

Published
2022-06-06 21:23 UTC
Modified
2024-11-19 16:22 UTC

Affected packages and fixes

vyper

PyPI · All systems

Affected

  • introduced 0, fixed 0.3.4 (ecosystem)

Fixed versions

0.3.4

Fix

  • Fixed version 0.3.4
    pip install --upgrade vyper==0.3.4

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences