# GHSA-8wcc-m6j2-qxvm: ASA-2024-0012, ASA-2024-0013: CosmosSDK: Transaction decoding may result in a stack overflow or resource exhaustion

> Attackers can cause network halts or node crashes via maliciously formed transactions with deep nesting or exponential resource consumption.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 16 Dec 2024
- **Also known as:** GO-2024-3339

## What is GHSA-8wcc-m6j2-qxvm?

GHSA-8wcc-m6j2-qxvm is a denial of service vulnerability in cosmossdk.io/x/tx, published on 16 Dec 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

## Summary 

### ASA-2024-0012
Name: ASA-2024-0012,  Transaction decoding may result in a stack overflow
Component: Cosmos SDK
Criticality: High (Considerable Impact, and Possible Likelihood per [ACMv1.2](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md))
Affected versions: cosmos-sdk versions <= v0.50.10, <= v0.47.14
Affected users: Chain Builders + Maintainers, Validators, node operators

### ASA-2024-0013
Name: ASA-2024-0013: CosmosSDK: Transaction decoding may result in resource exhaustion  
Component: Cosmos SDK
Criticality: High (Considerable Impact, and Possible Likelihood per [ACMv1.2](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md))
Affected versions: cosmos-sdk versions <= v0.50.10, <= v0.47.14
Affected users: Chain Builders + Maintainers, Validators, node operators

### Impact

### ASA-2024-0012

When decoding a maliciously formed packet with a deeply-nested structure, it may be possible for a stack overflow to occur and result in a network halt. This was addressed by adding a recursion limit while decoding the packet.

### ASA-2024-0013

Nested messages in a transaction can consume exponential cpu and memory on `UnpackAny` calls.  The`max_tx_bytes` sets a limit for external TX but is not applied for internal messages emitted by wasm contracts or a malicious validator block. This may result in a node crashing due to resource exhaustion.  This was addressed by adding additional validation to prevent this condition.

### Patches

The issues above are resolved in Cosmos SDK versions v0.47.15 or v0.50.11.
Please upgrade ASAP.

### Timeline for ASA-2024-0012

* October 1, 2024, 12:29pm UTC: Issue reported to the Cosmos Bug Bounty program
* October 1, 2024, 2:47pm UTC: Issue triaged by Amulet on-call, and distributed to Core team
* December 9, 2024, 11:13am UTC: Core team completes patch for issue
* Dec 14, 2024,16:00 UTC: Pre-notification delivered
* Dec 16, 2024, 16:00 UTC: Patch made available

This issue was reported to the Cosmos Bug Bounty Program on HackerOne on October 1, 2024.

### Timeline for ASA-2024-0013

* October 19, 2024, 8:12pm UTC: Issue reported to the Cosmos Bug Bounty program
* October 19, 2024, 8:28pm UTC: Issue triaged by Amulet on-call, and distributed to Core team
* December 11, 2024, 3:31pm UTC: Core team completes patch for issue
* Dec 14, 2024, 16:00 UTC: Pre-notification delivered
* Dec 16, 2024, 16:00 UTC: Patch made available

This issue was reported by LonelySloth to the Cosmos Bug Bounty Program on HackerOne on October 19, 2024. 

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.

If you have questions about Interchain security efforts, please reach out to our official communication channel at [security@interchain.io](mailto:security@interchain.io).  For more information about the Interchain Foundation’s engagement with Amulet, and to sign up for security notification emails, please see https://github.com/interchainio/security.

## Which versions are affected by GHSA-8wcc-m6j2-qxvm?

8 open source packages ship an affected version, including cosmossdk.io/x/tx and github.com/cosmos/cosmos-sdk.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `cosmossdk.io/x/tx` | Go | All versions | 0.13.7 |
| `cosmossdk.io/x/tx` | Go | All versions | 0.13.7 |
| `cosmossdk.io/x/tx` | Go | All versions | 0.13.7 |
| `github.com/cosmos/cosmos-sdk` | Go | All versions | 0.47.15, 0.50.11 |
| `github.com/cosmos/cosmos-sdk` | Go | All versions | 0.47.15 |
| `github.com/cosmos/cosmos-sdk` | Go | All versions | 0.47.15 |
| `github.com/cosmos/cosmos-sdk` | Go | From 0.50.0-alpha.0 | 0.50.11 |
| `github.com/cosmos/cosmos-sdk` | Go | From 0.50.0-alpha.0 | 0.50.11 |

## How do I fix GHSA-8wcc-m6j2-qxvm?

Upgrade cosmossdk.io/x/tx to 0.13.7 or later.

## Is GHSA-8wcc-m6j2-qxvm being exploited?

There is no known exploitation of GHSA-8wcc-m6j2-qxvm in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-8wcc-m6j2-qxvm and fix it if it is affected.

What it is: GHSA-8wcc-m6j2-qxvm is a denial of service vulnerability in cosmossdk.io/x/tx, published on 16 Dec 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-8wcc-m6j2-qxvm in the wild and no public exploit code.

Affected packages and fixed versions:
- cosmossdk.io/x/tx (Go): affected all versions; fixed in 0.13.7
- cosmossdk.io/x/tx (Go): affected all versions; fixed in 0.13.7
- cosmossdk.io/x/tx (Go): affected all versions; fixed in 0.13.7
- github.com/cosmos/cosmos-sdk (Go): affected all versions; fixed in 0.47.15, 0.50.11
- github.com/cosmos/cosmos-sdk (Go): affected all versions; fixed in 0.47.15
- github.com/cosmos/cosmos-sdk (Go): affected all versions; fixed in 0.47.15
- github.com/cosmos/cosmos-sdk (Go): affected from 0.50.0-alpha.0; fixed in 0.50.11
- github.com/cosmos/cosmos-sdk (Go): affected from 0.50.0-alpha.0; fixed in 0.50.11

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-8wcc-m6j2-qxvm/ (Markdown: https://insights.sbomify.com/GHSA-8wcc-m6j2-qxvm/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-8wcc-m6j2-qxvm

---
From sbomify Insights: https://insights.sbomify.com/GHSA-8wcc-m6j2-qxvm/
Summaries are generated and may contain mistakes; the official description above is the record.
