CVE-2024-37153: Github.com/evmos/evmos/v18 Contract Balance Not Updating Correctly Vulnerability

HIGH
Advisory Identifier: GHSA-xgr7-jgq3-mhmc
CVSS 7.5
CWE-670
Published
Advisory Summary

CVE-2024-37153 is a HIGH (CVSS 7.5) contract balance not updating correctly vulnerability (CWE-670: Always-Incorrect Control Flow Implementation) affecting Github.com/evmos/evmos/v18 libraries in the Go ecosystem. The issue involves contract balance not updating correctly after interchain transaction. Remediation is available by upgrading affected packages to version 18.1.0.

CVE-2024-37153 at a Glance

CVE Identifier CVE-2024-37153
GHSA Identifier GHSA-xgr7-jgq3-mhmc
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-670: Always-Incorrect Control Flow Implementation
Affected Product Github.com/evmos/evmos/v18
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2024-37153

To remediate this vulnerability, upgrade all affected Github.com/evmos/evmos/v18 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/evmos/evmos/v18 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v18 to 18.1.0
github.com/evmos/evmos/v17 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v17 to 18.1.0
github.com/evmos/evmos/v16 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v16 to 18.1.0
github.com/evmos/evmos/v15 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v15 to 18.1.0
github.com/evmos/evmos/v14 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v14 to 18.1.0
github.com/evmos/evmos/v13 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v13 to 18.1.0
github.com/evmos/evmos/v12 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v12 to 18.1.0
github.com/evmos/evmos/v11 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v11 to 18.1.0
github.com/evmos/evmos/v10 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v10 to 18.1.0
github.com/evmos/evmos/v9 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v9 to 18.1.0
github.com/evmos/evmos/v8 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v8 to 18.1.0
github.com/evmos/evmos/v7 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v7 to 18.1.0
github.com/evmos/evmos/v6 fixed: 18.1.0
Upgrade github.com/evmos/evmos/v6 to 18.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/evmos/evmos/v18

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-37153, inspect your project dependencies for Github.com/evmos/evmos/v18:

inspect dependencies for github.com/evmos/evmos/v18

Analyze the terminal output to locate any version of Github.com/evmos/evmos/v18 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 18.1.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-670: Always-Incorrect Control Flow Implementation, where the code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated. In Github.com/evmos/evmos/v18, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 ```solidity // 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](https://immunefisupport.zendesk.com/hc/en-us/articles/13332717597585-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](https://discord.gg/evmos) Open a discussion in [evmos/evmos](https://github.com/evmos/evmos/discussions) Email us at [security@evmos.org](mailto:security@evmos.org) for security questions

CVE-2024-37153 Affected Github.com/evmos/evmos/v18 Versions

13 component(s)
Fixed Versions:
18.1.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/evmos/evmos/v18
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v17
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v16
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v15
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v14
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v13
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v12
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v11
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v10
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v9
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v8
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v7
Go
< 18.1.0
18.1.0
github.com/evmos/evmos/v6
Go
< 18.1.0
18.1.0

References

Frequently Asked Questions

What is CVE-2024-37153?
CVE-2024-37153 is a security vulnerability in Github.com/evmos/evmos/v18 involving Contract balance not updating correctly after interchain transaction under CWE-670: Always-Incorrect Control Flow Implementation.
Which Github.com/evmos/evmos/v18 versions are affected?
Affected versions include releases prior to 18.1.0 across affected packages: github.com/evmos/evmos/v18, github.com/evmos/evmos/v17, github.com/evmos/evmos/v16, github.com/evmos/evmos/v15, github.com/evmos/evmos/v14, github.com/evmos/evmos/v13, github.com/evmos/evmos/v12, github.com/evmos/evmos/v11, github.com/evmos/evmos/v10, github.com/evmos/evmos/v9, github.com/evmos/evmos/v8, github.com/evmos/evmos/v7, github.com/evmos/evmos/v6.
What version fixes CVE-2024-37153?
Upgrading to 18.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/evmos/evmos/v18 affected?
Yes, github.com/evmos/evmos/v18 is affected in releases prior to 18.1.0. Upgrade your dependency to 18.1.0 or later.
Is github.com/evmos/evmos/v17 affected?
Yes, github.com/evmos/evmos/v17 is affected in releases prior to 18.1.0. Upgrade your dependency to 18.1.0 or later.
What is the CVSS score of CVE-2024-37153?
CVE-2024-37153 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2024-37153?
CVE-2024-37153 is classified under CWE-670: Always-Incorrect Control Flow Implementation (The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.).
How can I check Go dependencies for CVE-2024-37153?
Run the dependency tree command: 'inspect dependencies for github.com/evmos/evmos/v18'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xgr7-jgq3-mhmc",
  "modified" : "2024-06-17T15:23:41Z",
  "published" : "2024-06-06T18:51:25Z",
  "aliases" : [ "CVE-2024-37153" ],
  "summary" : "Contract balance not updating correctly after interchain transaction",
  "details" : "### Summary\n_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._\n\n### Details\nWe 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\n\n### Proof of Concept\n```solidity\n// This function does not reduce the contract balance correctly but liquid stakes correctly \nfunction transfer(\n        string memory sourcePort,\n        string memory sourceChannel,\n        string memory denom,\n        uint256 amount,\n        string memory receiver,\n        string memory evmosReceiver\n    ) external returns (uint64 nextSequence) {\n        counter += 1; # Only happens when there is a local state update together with an ICS20 Transfer\n        Height memory timeoutHeight =  Height(100, 100);\n        string memory memo = buildLiquidStakeMemo(receiver, evmosReceiver);\n        return ICS20_CONTRACT.transfer(\n            sourcePort, \n            sourceChannel,\n            denom,\n            amount,\n            address(this), # this is the sender address which is the contract\n            receiver,\n            timeoutHeight,\n            0,\n            memo\n        );\n    }\n```\n\n### Impact\nThis is in essence the \"infinite money glitch\" allowing contracts to double the supply of Evmos after each transaction.\n\n### Severity\n\nBased on [ImmuneFi Severity Classification System](https://immunefisupport.zendesk.com/hc/en-us/articles/13332717597585-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.\n\n### Patches\n\nThe issue has been patched in versions >=V18.1.0. \n\n## For more information\nIf you have any questions or comments about this advisory:\n\nReach out to the Core Team in [Discord](https://discord.gg/evmos)\nOpen a discussion in [evmos/evmos](https://github.com/evmos/evmos/discussions)\nEmail us at [security@evmos.org](mailto:security@evmos.org) for security questions\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v18"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 18.0.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v17"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 17.0.1"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v16"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 16.0.4"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v15"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 15.0.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v14"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 14.1.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v13"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 13.0.2"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v12"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 12.1.6"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v11"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 11.0.2"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v10"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 10.0.1"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v9"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 9.1.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v8"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 8.2.3"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v7"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.0.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/evmos/evmos/v6"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "18.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.0.4"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/evmos/evmos/security/advisories/GHSA-xgr7-jgq3-mhmc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-37153"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/evmos/evmos/commit/478b7a62e7af57a70cf3a01126c7f5a89bee69d7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/evmos/evmos"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-2903"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-670" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-06T18:51:25Z",
    "nvd_published_at" : "2024-06-06T19:15:58Z"
  }
}