GHSA-j496-crgh-34mx: ibc-go Potential Reentrancy Using Timeout Callbacks Vulnerability

CRITICAL
CVSS 9.1
CWE-696
Published
Advisory Summary

GHSA-j496-crgh-34mx is a CRITICAL (CVSS 9.1) potential reentrancy using timeout callbacks vulnerability (CWE-696: Incorrect Behavior Order) affecting ibc-go libraries in the Go ecosystem. The issue involves potential reentrancy using timeout callbacks in ibc-hooks. Remediation is available by upgrading affected packages to version 4.6.0, 5.4.0, 6.3.0, 7.4.0, 8.2.0.

GHSA-j496-crgh-34mx at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-j496-crgh-34mx
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-696: Incorrect Behavior Order
Affected Product ibc-go
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.1

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:H).

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 High (A:H)

How to Fix GHSA-j496-crgh-34mx

To remediate this vulnerability, upgrade all affected ibc-go 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/cosmos/ibc-go/v4 fixed: 4.6.0
Upgrade github.com/cosmos/ibc-go/v4 to 4.6.0
github.com/cosmos/ibc-go/v5 fixed: 5.4.0
Upgrade github.com/cosmos/ibc-go/v5 to 5.4.0
github.com/cosmos/ibc-go/v6 fixed: 6.3.0
Upgrade github.com/cosmos/ibc-go/v6 to 6.3.0
github.com/cosmos/ibc-go/v7 fixed: 7.4.0
Upgrade github.com/cosmos/ibc-go/v7 to 7.4.0
github.com/cosmos/ibc-go/v8 fixed: 8.2.0
Upgrade github.com/cosmos/ibc-go/v8 to 8.2.0
github.com/cosmos/ibc-go/v3 fixed: Latest secure release
Upgrade github.com/cosmos/ibc-go/v3 to Latest secure release
github.com/cosmos/ibc-go/v2 fixed: Latest secure release
Upgrade github.com/cosmos/ibc-go/v2 to Latest secure release
github.com/cosmos/ibc-go fixed: Latest secure release
Upgrade github.com/cosmos/ibc-go to Latest secure release
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/cosmos/ibc-go/v4

How to Check if You Are Affected

To determine whether your application is affected by GHSA-j496-crgh-34mx, inspect your project dependencies for ibc-go:

inspect dependencies for github.com/cosmos/ibc-go/v4

Analyze the terminal output to locate any version of ibc-go in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.6.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-696: Incorrect Behavior Order, where the product performs multiple related behaviors, but the behaviors are performed in the wrong order in ways that may produce resultant weaknesses. In ibc-go, 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

**Name**: ASA-2024-007: Potential Reentrancy using Timeout Callbacks in ibc-hooks **Component**: ibc-go **Criticality**: Critical ([ACMv1](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md): I:Critical; L:AlmostCertain) **Affected versions**: < v4.6.0, < v5.4.0, < v6.3.0, < v7.4.0, < v8.2.0 **Affected users**: Chain Builders + Maintainers # Summary Through the deployment and subsequent use of a malicious CosmWasm contract via IBC interactions, an attacker could potentially execute the same `MsgTimeout` inside the IBC hook for the `OnTimeout` callback before the packet commitment is deleted. On chains where ibc-hooks wraps ICS-20, this vulnerability may allow for the logic of the `OnTimeout` callback of the transfer application to be recursively executed, leading to a condition that may present the opportunity for the loss of funds from the escrow account or unexpected minting of tokens. # Affected Configurations Chains which satisfy all of the following requirements are considered to be impacted by this vulnerability: * Chain is IBC-enabled and uses a vulnerable version of ibc-go * Chain is CosmWasm-enabled and allows code uploads for wasm contracts by anyone, or by authorized parties (to a lesser extent) * Chain utilizes the ibc-hooks middleware and wraps ICS-20 transfer application # Next Steps for Impacted Chain Builders and Maintainers It is advised to immediately upgrade to the latest patch fix version of ibc-go for your chain. If you have already applied a soft-patch through private coordination, we recommend additionally updating to the latest ibc-go version via normal software upgrade governance. If you have not upgraded your chain yet, and you desire to mitigate exposure to this vulnerability in the meantime, it is advisable to limit code uploading for contracts to trusted parties on your chain. **If your chain only allows permissioned, access-controlled contract uploads, it is still strongly recommended to update to the latest patched ibc-go version for your chain per your normal software upgrade process.** # Preparing for future coordination If your chain would like to be included in future coordination efforts, please ensure your chain has a prominently displayed or otherwise easily available up-to-date email address for technical security contact available. A security.md file in the root of your projects’ code repository should contain this information. Additionally, please test this security contact with an unaffiliated email to ensure it works as expected and can receive emails from outside of your domain. To ensure that your chain is included in future impact assessments, please keep your chain information up to date in the [Cosmos Chain Registry](https://github.com/cosmos/chain-registry) with code location, network name, and public RPC and API endpoints in the details. We recommend that all chains configure and practice the use of the [Circuit Breaker module](https://docs.cosmos.network/main/build/modules/circuit) in the Cosmos SDK, as future vulnerability notifications may require the use of this mechanism as a mitigation against exploitation. # Recognition This issue was reported to the Cosmos Bug Bounty Program on HackerOne on 3/26/24 by Maxwell Dulin (Strikeout) at [Asymmetric Research](https://www.asymmetric.re/). If you believe you have found a bug in the Interchain Stack or would like to contribute to the program by reporting a bug, please see https://hackerone.com/cosmos. # Notes Due to the critical nature of this issue, both the ibc-go team and Amulet independently performed impact assessments for the ecosystem, which informed a risk-driven private patching effort that preceded this public release. This private patching effort significantly reduced the exposure of the ecosystem to this vulnerability. We appreciate the diligence and professionalism of all chains and validators involved with this effort – your ability to move quickly while maintaining confidentiality was instrumental in protecting the wider Interchain Ecosystem. If you ever have questions about security coordination efforts, public or private, please reach out to our official communication channel at [security@interchain.io](mailto:security@interchain.io). For more information about ibc-go, please see https://ibc.cosmos.network/main. For more information about the Interchain Foundation’s engagement with Amulet, please see https://github.com/interchainio/security.

GHSA-j496-crgh-34mx Affected ibc-go Versions

8 component(s)
Fixed Versions:
4.6.05.4.06.3.07.4.08.2.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cosmos/ibc-go/v4
Go
< 4.6.0
4.6.0
github.com/cosmos/ibc-go/v5
Go
< 5.4.0
5.4.0
github.com/cosmos/ibc-go/v6
Go
< 6.3.0
6.3.0
github.com/cosmos/ibc-go/v7
Go
< 7.4.0
7.4.0
github.com/cosmos/ibc-go/v8
Go
< 8.2.0
8.2.0
github.com/cosmos/ibc-go/v3
Go
github.com/cosmos/ibc-go/v2
Go
github.com/cosmos/ibc-go
Go

References

Frequently Asked Questions

What is GHSA-j496-crgh-34mx?
GHSA-j496-crgh-34mx is a security vulnerability in ibc-go involving Potential Reentrancy using Timeout Callbacks in ibc-hooks under CWE-696: Incorrect Behavior Order.
Which ibc-go versions are affected?
Affected versions include releases prior to 4.6.0, 5.4.0, 6.3.0, 7.4.0, 8.2.0 across affected packages: github.com/cosmos/ibc-go/v4, github.com/cosmos/ibc-go/v5, github.com/cosmos/ibc-go/v6, github.com/cosmos/ibc-go/v7, github.com/cosmos/ibc-go/v8, github.com/cosmos/ibc-go/v3, github.com/cosmos/ibc-go/v2, github.com/cosmos/ibc-go.
What version fixes GHSA-j496-crgh-34mx?
Upgrading to 4.6.0, 5.4.0, 6.3.0, 7.4.0, 8.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/cosmos/ibc-go/v4 affected?
Yes, github.com/cosmos/ibc-go/v4 is affected in releases prior to 4.6.0. Upgrade your dependency to 4.6.0 or later.
Is github.com/cosmos/ibc-go/v5 affected?
Yes, github.com/cosmos/ibc-go/v5 is affected in releases prior to 5.4.0. Upgrade your dependency to 5.4.0 or later.
What is the CVSS score of GHSA-j496-crgh-34mx?
GHSA-j496-crgh-34mx has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H.
What CWE is associated with GHSA-j496-crgh-34mx?
GHSA-j496-crgh-34mx is classified under CWE-696: Incorrect Behavior Order (The product performs multiple related behaviors, but the behaviors are performed in the wrong order in ways that may produce resultant weaknesses.).
How can I check Go dependencies for GHSA-j496-crgh-34mx?
Run the dependency tree command: 'inspect dependencies for github.com/cosmos/ibc-go/v4'. 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-j496-crgh-34mx",
  "modified" : "2024-04-05T17:16:01Z",
  "published" : "2024-04-05T17:16:01Z",
  "aliases" : [ ],
  "summary" : "ibc-go: Potential Reentrancy using Timeout Callbacks in ibc-hooks",
  "details" : "**Name**: ASA-2024-007: Potential Reentrancy using Timeout Callbacks in ibc-hooks\n**Component**: ibc-go\n**Criticality**: Critical ([ACMv1](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md): I:Critical; L:AlmostCertain)\n**Affected versions**: < v4.6.0, < v5.4.0, < v6.3.0, < v7.4.0, < v8.2.0\n**Affected users**: Chain Builders + Maintainers\n\n# Summary\n\nThrough the deployment and subsequent use of a malicious CosmWasm contract via IBC interactions, an attacker could potentially execute the same `MsgTimeout` inside the IBC hook for the `OnTimeout` callback before the packet commitment is deleted. On chains where ibc-hooks wraps ICS-20, this vulnerability may allow for the logic of the `OnTimeout` callback of the transfer application to be recursively executed, leading to a condition that may present the opportunity for the loss of funds from the escrow account or unexpected minting of tokens.\n\n# Affected Configurations\n\nChains which satisfy all of the following requirements are considered to be impacted by this vulnerability:\n* Chain is IBC-enabled and uses a vulnerable version of ibc-go\n* Chain is CosmWasm-enabled and allows code uploads for wasm contracts by anyone, or by authorized parties (to a lesser extent)\n* Chain utilizes the ibc-hooks middleware and wraps ICS-20 transfer application\n\n# Next Steps for Impacted Chain Builders and Maintainers\n\nIt is advised to immediately upgrade to the latest patch fix version of ibc-go for your chain. If you have already applied a soft-patch through private coordination, we recommend additionally updating to the latest ibc-go version via normal software upgrade governance.\n\nIf you have not upgraded your chain yet, and you desire to mitigate exposure to this vulnerability in the meantime, it is advisable to limit code uploading for contracts to trusted parties on your chain.\n\n**If your chain only allows permissioned, access-controlled contract uploads, it is still strongly recommended to update to the latest patched ibc-go version for your chain per your normal software upgrade process.**\n\n# Preparing for future coordination\n\nIf your chain would like to be included in future coordination efforts, please ensure your chain has a prominently displayed or otherwise easily available up-to-date email address for technical security contact available. A security.md file in the root of your projects’ code repository should contain this information. Additionally, please test this security contact with an unaffiliated email to ensure it works as expected and can receive emails from outside of your domain.\n\nTo ensure that your chain is included in future impact assessments, please keep your chain information up to date in the [Cosmos Chain Registry](https://github.com/cosmos/chain-registry) with code location, network name, and public RPC and API endpoints in the details.\n\nWe recommend that all chains configure and practice the use of the [Circuit Breaker module](https://docs.cosmos.network/main/build/modules/circuit) in the Cosmos SDK, as future vulnerability notifications may require the use of this mechanism as a mitigation against exploitation.\n\n# Recognition\n\nThis issue was reported to the Cosmos Bug Bounty Program on HackerOne on 3/26/24 by Maxwell Dulin (Strikeout) at [Asymmetric Research](https://www.asymmetric.re/). If you believe you have found a bug in the Interchain Stack or would like to contribute to the program by reporting a bug, please see https://hackerone.com/cosmos.\n\n# Notes\n\nDue to the critical nature of this issue, both the ibc-go team and Amulet independently performed impact assessments for the ecosystem, which informed a risk-driven private patching effort that preceded this public release. This private patching effort significantly reduced the exposure of the ecosystem to this vulnerability. We appreciate the diligence and professionalism of all chains and validators involved with this effort – your ability to move quickly while maintaining confidentiality was instrumental in protecting the wider Interchain Ecosystem. \n\nIf you ever have questions about security coordination efforts, public or private, please reach out to our official communication channel at [security@interchain.io](mailto:security@interchain.io).\n\nFor more information about ibc-go, please see https://ibc.cosmos.network/main.\n\nFor more information about the Interchain Foundation’s engagement with Amulet, please see https://github.com/interchainio/security.\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cosmos/ibc-go/v4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.6.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cosmos/ibc-go/v5"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.4.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cosmos/ibc-go/v6"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.3.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cosmos/ibc-go/v7"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.4.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cosmos/ibc-go/v8"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.2.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cosmos/ibc-go/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 4.6.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cosmos/ibc-go/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 4.6.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cosmos/ibc-go"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 4.6.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cosmos/ibc-go/security/advisories/GHSA-j496-crgh-34mx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cosmos/ibc-go/commit/04275aa77644dec97fb91b749d963c992591b7f7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cosmos/ibc-go/commit/278fa89f192af04af32d82fd5ef41f84f82edd97"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cosmos/ibc-go/commit/5e2e9ebc2f67df324028dd36a1837ffcc8e6b0dd"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cosmos/ibc-go/commit/a0185df3953070ba5ebcb66735925449d1dbe729"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cosmos/ibc-go/commit/e78b3a2b9c9ce80a67d6b1c2b7f9abcb225cc219"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cosmos/ibc-go"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-696" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-04-05T17:16:01Z",
    "nvd_published_at" : null
  }
}