# DoS via markdown API from unauthenticated user

Polynomial-time complexity in cmark-gfm autolink extension let an unauthenticated user exhaust resources via crafted markdown, causing DoS on GitHub's markdown API.

- Payout: $4,000
- Severity: medium
- Program: GitHub
- Found by: legit-security
- Disclosed: 2022-12-13
- CVE: CVE-2022-39209
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1619604
- Library page: https://bugbountylibrary.com/r/h1%3A1619604
- Tags: area:oss domain:oss domain:web impact:dos kind:bounty platform:hackerone sev:medium tech:rest technique:fuzzing vuln:dos

**Target:** cmark-gfm autolink extension (markdown rendering API)
**Root cause:** Polynomial time complexity in the autolink extension of cmark-gfm causes unbounded resource exhaustion when parsing crafted markdown input.
**Steps:**
1. Craft input with many nested image/link openers: `python3 -c 'print("![l"* 100000 + "\n")'`
2. Pipe to unpatched parser: `... | ./cmark-gfm -e autolink`
3. Observe resource exhaustion on unpatched vs correct render on patched 0.29.0.gfm.6
**Exploitation:** Submit crafted markdown (repeated `![l` sequences) to the markdown rendering API as an unauthenticated user; the autolink extension consumes excessive CPU/memory, denying service.
**Insight:** Autolink extensions that scan for URLs can hit quadratic/polynomial backtracking on repeated unterminated link/image openers; fuzz parsers with long runs of `![` or `[` prefixes to trigger complexity blowups.

## Proof of concept (copied exactly from the original report)

**Command generating pathological markdown input**

```
python3 -c 'print("![l"* 100000 + "\n")' | ./cmark-gfm -e autolink
```

