# GHSA-qx4v-6gc5-f2vv: Regular Expression Denial of Service

> An attacker can cause a denial of service in applications using the esm library by triggering an infinite loop via crafted input.

- **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:** 20 Jun 2019

## What is GHSA-qx4v-6gc5-f2vv?

GHSA-qx4v-6gc5-f2vv is a denial of service vulnerability in esm, published on 20 Jun 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A Regular Expression Denial of Service vulnerability was discovered in esm before 3.1.0. The issue is that esm's find-indexes is using the unescaped identifiers in a regex, which, in this case, causes an infinite loop.

## Which versions are affected by GHSA-qx4v-6gc5-f2vv?

2 open source packages ship an affected version, including esm.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `esm` | npm | All versions | 3.1.0 |
| `esm` | npm | All versions | 3.1.0 |

## How do I fix GHSA-qx4v-6gc5-f2vv?

Upgrade esm to 3.1.0 or later.

## Is GHSA-qx4v-6gc5-f2vv being exploited?

There is no known exploitation of GHSA-qx4v-6gc5-f2vv in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-qx4v-6gc5-f2vv and fix it if it is affected.

What it is: GHSA-qx4v-6gc5-f2vv is a denial of service vulnerability in esm, published on 20 Jun 2019. 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-qx4v-6gc5-f2vv in the wild and no public exploit code.

Affected packages and fixed versions:
- esm (npm): affected all versions; fixed in 3.1.0
- esm (npm): affected all versions; fixed in 3.1.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/GHSA-qx4v-6gc5-f2vv/ (Markdown: https://insights.sbomify.com/GHSA-qx4v-6gc5-f2vv/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-qx4v-6gc5-f2vv

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