GHSA-xgr7-jgq3-mhmc

Suggest an improvement
Source
https://github.com/advisories/GHSA-xgr7-jgq3-mhmc
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/06/GHSA-xgr7-jgq3-mhmc/GHSA-xgr7-jgq3-mhmc.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-xgr7-jgq3-mhmc
Aliases
Related
Published
2024-06-06T18:51:25Z
Modified
2024-06-17T15:23:41Z
Severity
  • 7.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N CVSS Calculator
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 security@evmos.org for security questions

Database specific
{
    "nvd_published_at": "2024-06-06T19:15:58Z",
    "cwe_ids": [
        "CWE-670"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2024-06-06T18:51:25Z"
}
References

Affected packages

Go / github.com/evmos/evmos/v18

Package

Name
github.com/evmos/evmos/v18
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v18

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 18.0.0"
}

Go / github.com/evmos/evmos/v17

Package

Name
github.com/evmos/evmos/v17
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v17

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 17.0.1"
}

Go / github.com/evmos/evmos/v16

Package

Name
github.com/evmos/evmos/v16
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v16

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 16.0.4"
}

Go / github.com/evmos/evmos/v15

Package

Name
github.com/evmos/evmos/v15
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v15

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 15.0.0"
}

Go / github.com/evmos/evmos/v14

Package

Name
github.com/evmos/evmos/v14
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v14

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 14.1.0"
}

Go / github.com/evmos/evmos/v13

Package

Name
github.com/evmos/evmos/v13
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v13

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 13.0.2"
}

Go / github.com/evmos/evmos/v12

Package

Name
github.com/evmos/evmos/v12
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v12

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 12.1.6"
}

Go / github.com/evmos/evmos/v11

Package

Name
github.com/evmos/evmos/v11
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v11

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 11.0.2"
}

Go / github.com/evmos/evmos/v10

Package

Name
github.com/evmos/evmos/v10
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v10

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 10.0.1"
}

Go / github.com/evmos/evmos/v9

Package

Name
github.com/evmos/evmos/v9
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v9

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 9.1.0"
}

Go / github.com/evmos/evmos/v8

Package

Name
github.com/evmos/evmos/v8
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v8

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 8.2.3"
}

Go / github.com/evmos/evmos/v7

Package

Name
github.com/evmos/evmos/v7
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v7

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 7.0.0"
}

Go / github.com/evmos/evmos/v6

Package

Name
github.com/evmos/evmos/v6
View open source insights on deps.dev
Purl
pkg:golang/github.com/evmos/evmos/v6

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
18.1.0

Database specific

{
    "last_known_affected_version_range": "<= 6.0.4"
}