# CVE-2024-43367: Boa has an uncaught exception when transitioning the state of `AsyncGenerator` objects

> An attacker can cause a denial of service in applications using the Boa JavaScript engine by triggering an uncaught exception via crafted async generator scripts.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 Aug 2024
- **Updated:** 20 Aug 2024
- **Also known as:** GHSA-f67q-wr6w-23jq, RUSTSEC-2024-0444

## What is CVE-2024-43367?

CVE-2024-43367 is a high-severity denial of service vulnerability in boa-dev boa, published on 15 Aug 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Boa is an embeddable and experimental Javascript engine written in Rust. Starting in version 0.16 and prior to version 0.19.0, a wrong assumption made when handling ECMAScript's `AsyncGenerator` operations can cause an uncaught exception on certain scripts. Boa's implementation of `AsyncGenerator` makes the assumption that the state of an `AsyncGenerator` object cannot change while resolving a promise created by methods of `AsyncGenerator` such as `%AsyncGeneratorPrototype%.next`, `%AsyncGeneratorPrototype%.return`, or `%AsyncGeneratorPrototype%.throw`. However, a carefully constructed code could trigger a state transition from a getter method for the promise's `then` property, which causes the engine to fail an assertion of this assumption, causing an uncaught exception. This could be used to create a Denial Of Service attack in applications that run arbitrary ECMAScript code provided by an external user. Version 0.19.0 is patched to correctly handle this case. Users unable to upgrade to the patched version would want to use `std::panic::catch_unwind` to ensure any exceptions caused by the engine don't impact the availability of the main application.

Weakness: CWE-248 (Uncaught Exception)

## Which versions are affected by CVE-2024-43367?

3 open source packages ship an affected version, including boa_engine.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `boa_engine` | crates.io | From 0.16 | 0.19.0 |
| `boa_engine` | crates.io | From 0.16 | 0.19.0 |
| `boa_engine` | crates.io | From 0.16.0 | 0.19.0 |

## How do I fix CVE-2024-43367?

Upgrade boa_engine to 0.19.0 or later.

## Is CVE-2024-43367 being exploited?

There is no known exploitation of CVE-2024-43367 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-43367 and fix it if it is affected.

What it is: CVE-2024-43367 is a high-severity denial of service vulnerability in boa-dev boa, published on 15 Aug 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 CVE-2024-43367 in the wild and no public exploit code.

Affected packages and fixed versions:
- boa_engine (crates.io): affected from 0.16; fixed in 0.19.0
- boa_engine (crates.io): affected from 0.16; fixed in 0.19.0
- boa_engine (crates.io): affected from 0.16.0; fixed in 0.19.0

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

## Sources

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

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