Ecosyste.ms: Advisories

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

Security Advisories: GSA_kwCzR0hTQS14Z3I3LWpncTMtbWhtY84AA8wu

Contract balance not updating correctly after interchain transaction

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] for security questions

Permalink: https://github.com/advisories/GHSA-xgr7-jgq3-mhmc
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14Z3I3LWpncTMtbWhtY84AA8wu
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 6 months ago
Updated: 5 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-xgr7-jgq3-mhmc, CVE-2024-37153
References: Repository: https://github.com/evmos/evmos
Blast Radius: 3.6

Affected Packages

go:github.com/evmos/evmos/v6
Dependent packages: 25
Dependent repositories: 1
Downloads:
Affected Version Ranges: <= 6.0.4
Fixed in: 18.1.0
All affected versions: 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4
All unaffected versions:
go:github.com/evmos/evmos/v7
Dependent packages: 1
Dependent repositories: 3
Downloads:
Affected Version Ranges: <= 7.0.0
Fixed in: 18.1.0
All affected versions: 7.0.0
All unaffected versions:
go:github.com/evmos/evmos/v8
Dependent packages: 3
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 8.2.3
Fixed in: 18.1.0
All affected versions: 8.0.0, 8.1.0, 8.1.1, 8.2.0, 8.2.2, 8.2.3
All unaffected versions:
go:github.com/evmos/evmos/v9
Dependent packages: 9
Dependent repositories: 1
Downloads:
Affected Version Ranges: <= 9.1.0
Fixed in: 18.1.0
All affected versions: 9.0.0, 9.1.0
All unaffected versions:
go:github.com/evmos/evmos/v10
Dependent packages: 2
Dependent repositories: 1
Downloads:
Affected Version Ranges: <= 10.0.1
Fixed in: 18.1.0
All affected versions: 10.0.0, 10.0.1
All unaffected versions:
go:github.com/evmos/evmos/v11
Dependent packages: 9
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 11.0.2
Fixed in: 18.1.0
All affected versions: 11.0.0, 11.0.1, 11.0.2
All unaffected versions:
go:github.com/evmos/evmos/v12
Dependent packages: 24
Dependent repositories: 3
Downloads:
Affected Version Ranges: <= 12.1.6
Fixed in: 18.1.0
All affected versions: 12.0.0, 12.1.0, 12.1.1, 12.1.2, 12.1.3, 12.1.4, 12.1.5, 12.1.6
All unaffected versions:
go:github.com/evmos/evmos/v13
Dependent packages: 9
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 13.0.2
Fixed in: 18.1.0
All affected versions: 13.0.0, 13.0.1, 13.0.2
All unaffected versions:
go:github.com/evmos/evmos/v14
Dependent packages: 5
Dependent repositories: 1
Downloads:
Affected Version Ranges: <= 14.1.0
Fixed in: 18.1.0
All affected versions: 14.0.0, 14.1.0
All unaffected versions:
go:github.com/evmos/evmos/v15
Dependent packages: 1
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 15.0.0
Fixed in: 18.1.0
All affected versions: 15.0.0
All unaffected versions:
go:github.com/evmos/evmos/v16
Dependent packages: 0
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 16.0.4
Fixed in: 18.1.0
All affected versions: 16.0.0, 16.0.1, 16.0.2, 16.0.3, 16.0.4
All unaffected versions:
go:github.com/evmos/evmos/v17
Dependent packages: 0
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 17.0.1
Fixed in: 18.1.0
All affected versions: 17.0.0, 17.0.1
All unaffected versions:
go:github.com/evmos/evmos/v18
Dependent packages: 0
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 18.0.0
Fixed in: 18.1.0
All affected versions: 18.0.0
All unaffected versions: 18.0.1, 18.1.0