# GHSA-6chw-6frg-f759: Regular Expression Denial of Service in Acorn

> Attackers can cause a denial of service in applications using the Acorn parser by submitting specific invalid UTF-16 strings that trigger an infinite loop.

- **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:** 3 Apr 2020

## What is GHSA-6chw-6frg-f759?

GHSA-6chw-6frg-f759 is a denial of service vulnerability in acorn, published on 3 Apr 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Affected versions of acorn are vulnerable to Regular Expression Denial of Service.
A regex in the form of /[x-\ud800]/u causes the parser to enter an infinite loop.
The string is not valid UTF16 which usually results in it being sanitized before reaching the parser.
If an application processes untrusted input and passes it directly to acorn,
attackers may leverage the vulnerability leading to Denial of Service.

## Which versions are affected by GHSA-6chw-6frg-f759?

6 open source packages ship an affected version, including acorn.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `acorn` | npm | From 5.5.0 | 5.7.4 |
| `acorn` | npm | From 5.5.0 | 5.7.4 |
| `acorn` | npm | From 6.0.0 | 6.4.1 |
| `acorn` | npm | From 6.0.0 | 6.4.1 |
| `acorn` | npm | From 7.0.0 | 7.1.1 |
| `acorn` | npm | From 7.0.0 | 7.1.1 |

## How do I fix GHSA-6chw-6frg-f759?

Upgrade acorn to a fixed version for your release line: 5.7.4, 6.4.1 or 7.1.1.

## Is GHSA-6chw-6frg-f759 being exploited?

There is no known exploitation of GHSA-6chw-6frg-f759 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-6chw-6frg-f759 and fix it if it is affected.

What it is: GHSA-6chw-6frg-f759 is a denial of service vulnerability in acorn, published on 3 Apr 2020. 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-6chw-6frg-f759 in the wild and no public exploit code.

Affected packages and fixed versions:
- acorn (npm): affected from 5.5.0; fixed in 5.7.4
- acorn (npm): affected from 5.5.0; fixed in 5.7.4
- acorn (npm): affected from 6.0.0; fixed in 6.4.1
- acorn (npm): affected from 6.0.0; fixed in 6.4.1
- acorn (npm): affected from 7.0.0; fixed in 7.1.1
- acorn (npm): affected from 7.0.0; fixed in 7.1.1

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-6chw-6frg-f759/ (Markdown: https://insights.sbomify.com/GHSA-6chw-6frg-f759/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-6chw-6frg-f759

---
From sbomify Insights: https://insights.sbomify.com/GHSA-6chw-6frg-f759/
Summaries are generated and may contain mistakes; the official description above is the record.
