# CVE-2023-42449: Business logic in hydra

> A malicious Hydra head initializer can steal participant tokens, locking funds or spoofing commitments to force financial losses.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 4 Oct 2023
- **Updated:** 20 Sep 2024
- **Also known as:** GHSA-9m8q-7wxv-v65p

## What is CVE-2023-42449?

CVE-2023-42449 is a high-severity vulnerability in input-output-hk hydra, published on 4 Oct 2023. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Hydra is the two-layer scalability solution for Cardano. Prior to version 0.13.0, it is possible for a malicious head initializer to extract one or more PTs for the head they are initializing due to incorrect data validation logic in the head token minting policy which then results in an flawed check for burning the head ST in the `initial` validator. This is possible because it is not checked in `HeadTokens.hs` that the datums of the outputs at the `initial` validator are equal to the real head ID, and it is also not checked in the `off-chain code`.

During the `Initial` state of the protocol, if the malicious initializer removes a PT from the Hydra scripts it becomes impossible for any other participant to reclaim any funds they have attempted to commit into the head, as to do so the Abort transaction must burn all the PTs for the head, but they cannot burn the PT which the attacker controls and so cannot satisfy this requirement. That means the initializer can lock the other participants committed funds forever or until they choose to return the PT (ransom).

The malicious initializer can also use the PT to spoof that they have committed a particular TxO when progressing the head into the `Open` state. For example, they could say they committed a TxO residing at their address containing 100 ADA, but in fact this 100 ADA was not moved into the head, and thus in order for an other participant to perform the fanout they will be forced to pay the attacker the 100 ADA out of their own funds, as the fanout transaction must pay all the committed TxOs (even though the attacker did not really commit that TxO). They can do this by placing the PT in a UTxO with a well-formed `Commit` datum with whatever contents they like, then use this UTxO in the `collectCom` transaction. There may be other possible ways to abuse having control of a PT.

Version 0.13.0 fixes this issue.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2023-42449?

It affects 1 product.


Products: Iohk Hydra.

## How do I fix CVE-2023-42449?

No fix has been published for CVE-2023-42449 yet. Limit exposure of the affected software until one is available.

## Is CVE-2023-42449 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-42449 exists.

## Other vulnerabilities in input-output-hk hydra

- [CVE-2023-38701](https://insights.sbomify.com/CVE-2023-38701/): Hydra's committed UTxOs at Commit validator and UTxOs at Initial validator can be spent arbitrarily by anyone (critical 9.1)
- [CVE-2023-42448](https://insights.sbomify.com/CVE-2023-42448/): Business logic in hydra (high 8.1)
- [CVE-2023-42806](https://insights.sbomify.com/CVE-2023-42806/): Snapshot signature not including HeadID will allow replay attacks (medium 6.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-42449 and fix it if it is affected.

What it is: CVE-2023-42449 is a high-severity vulnerability in input-output-hk hydra, published on 4 Oct 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-42449 exists.

Affected product: input-output-hk hydra. No package-level version data is available, so check the vendor advisory linked from the reference page.

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/CVE-2023-42449/ (Markdown: https://insights.sbomify.com/CVE-2023-42449/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-42449
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-42449
- OSV: https://osv.dev/vulnerability/CVE-2023-42449

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-42449/
Summaries are generated and may contain mistakes; the official description above is the record.
