# GHSA-4qw4-jpp4-8gvp: Unbounded resource exhaustion in cmark-gfm autolink extension may lead to denial of service

> Attackers can cause denial of service via resource exhaustion in the cmark-gfm autolink extension used by CommonMarker.

- **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:** 21 Sep 2022

## What is GHSA-4qw4-jpp4-8gvp?

GHSA-4qw4-jpp4-8gvp is a denial of service vulnerability in commonmarker, published on 21 Sep 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

CommonMarker uses `cmark-gfm` for rendering [Github Flavored Markdown](https://github.github.com/gfm/). A polynomial time complexity issue in cmark-gfm's autolink extension may lead to unbounded resource exhaustion and subsequent denial of service.

### Patches

This vulnerability has been patched in the following CommonMarker release:

- v0.23.6

### Workarounds

Disable use of the autolink extension.

### References

https://github.com/gjtorikian/commonmarker/pull/190
https://github.com/github/cmark-gfm/security/advisories/GHSA-cgh3-p57x-9q7q
https://en.wikipedia.org/wiki/Time_complexity

### For more information
If you have any questions or comments about this advisory:
* Open an issue in [github/cmark-gfm](https://github.com/github/cmark-gfm)

### Acknowledgements

We would like to thank [Legit Security](https://www.legitsecurity.com) for reporting this vulnerability.

## Which versions are affected by GHSA-4qw4-jpp4-8gvp?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `commonmarker` | RubyGems | All versions | 0.23.6 |
| `commonmarker` | RubyGems | All versions | 0.23.6 |

## How do I fix GHSA-4qw4-jpp4-8gvp?

Upgrade commonmarker to 0.23.6 or later.

## Is GHSA-4qw4-jpp4-8gvp being exploited?

There is no known exploitation of GHSA-4qw4-jpp4-8gvp in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-4qw4-jpp4-8gvp and fix it if it is affected.

What it is: GHSA-4qw4-jpp4-8gvp is a denial of service vulnerability in commonmarker, published on 21 Sep 2022. 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-4qw4-jpp4-8gvp in the wild and no public exploit code.

Affected packages and fixed versions:
- commonmarker (RubyGems): affected all versions; fixed in 0.23.6
- commonmarker (RubyGems): affected all versions; fixed in 0.23.6

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-4qw4-jpp4-8gvp/ (Markdown: https://insights.sbomify.com/GHSA-4qw4-jpp4-8gvp/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-4qw4-jpp4-8gvp

---
From sbomify Insights: https://insights.sbomify.com/GHSA-4qw4-jpp4-8gvp/
Summaries are generated and may contain mistakes; the official description above is the record.
