Ecosyste.ms: Advisories

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

Security Advisories: GSA_kwCzR0hTQS0zZnA1LTJ4d2gtZnhtNs4AA657

Evmos transaction execution not accounting for all state transition after interaction with precompiles

Context

Impact

An external contributor, @iczc, discovered a way to mint arbitrary tokens due to the possibility to have two different states not in sync during the execution of a transaction. The exploit is based on the fact that to sync the Cosmos SDK state and the EVM one, we rely on the stateDB.Commit() method. When we call this method, we iterate though all the dirtyStorage and, if and only if it is different than the originStorage, we set the new state. Setting the new state means we update the Cosmos SDK KVStore.

Below, are described the steps to perform the attack:

If the tx is executed correctly, this is what happens at the store level:

Since the tx executed correctly, the evm calls the commit to persist the dirtyStorage. However, since dirtyStorage is equal to originStorage, nothing will be changed.

To summarize, if a contract storage state that is the same before and after a transaction, but is changed during the transaction and can call an external contract after the change, it can be exploited to make the transaction similar to non-atomic. The vulnerability is critical since this could lead to drain of funds through creative SC interactions.

Severity

Based on ImmuneFi Severity Classification System the severity was evaluated to Critical since the attack could have lead to direct loss of funds.

Patches

The issue has been patched in versions >=V17.0.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-3fp5-2xwh-fxm6
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zZnA1LTJ4d2gtZnhtNs4AA657
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: 8 months ago
Updated: 7 months ago


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

Identifiers: GHSA-3fp5-2xwh-fxm6, CVE-2024-32644
References: Repository: https://github.com/evmos/evmos
Blast Radius: 5.5

Affected Packages

go:github.com/tharsis/evmos/v5
Dependent packages: 0
Dependent repositories: 1
Downloads:
Affected Version Ranges: <= 5.0.1
No known fixed version
All affected versions: 5.0.0, 5.0.1
go:github.com/tharsis/evmos/v4
Dependent packages: 5
Dependent repositories: 4
Downloads:
Affected Version Ranges: <= 4.0.2
No known fixed version
All affected versions: 4.0.0, 4.0.1, 4.0.2
go:github.com/tharsis/evmos/v3
Dependent packages: 3
Dependent repositories: 1
Downloads:
Affected Version Ranges: <= 3.0.3
No known fixed version
All affected versions: 3.0.0, 3.0.1, 3.0.2, 3.0.3
go:github.com/tharsis/evmos/v2
Dependent packages: 0
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 2.0.2
No known fixed version
All affected versions: 2.0.0, 2.0.1, 2.0.2
go:github.com/tharsis/evmos
Dependent packages: 2
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 1.1.3
No known fixed version
All affected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.2.0, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 1.0.0, 1.1.0, 1.1.1, 1.1.2, 1.1.3
go:github.com/evmos/evmos/v5
Dependent packages: 0
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 5.0.0
No known fixed version
All affected versions: 5.0.0
go:github.com/evmos/evmos/v6
Dependent packages: 25
Dependent repositories: 1
Downloads:
Affected Version Ranges: <= 6.0.4
No known fixed version
All affected versions: 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4
go:github.com/evmos/evmos/v7
Dependent packages: 1
Dependent repositories: 3
Downloads:
Affected Version Ranges: <= 7.0.0
No known fixed version
All affected versions: 7.0.0
go:github.com/evmos/evmos/v16
Dependent packages: 0
Dependent repositories: 0
Downloads:
Affected Version Ranges: <= 16.0.4
Fixed in: 17.0.0
All affected versions: 16.0.0, 16.0.1, 16.0.2, 16.0.3, 16.0.4
All unaffected versions: