CVE-2023-28626: Comrak vulnerable to quadratic runtime issues when parsing Markdown (GHSL-2023-047)
5.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.48676%
CWE
Published
3/28/2023
Updated
5/1/2023
KEV Status
No
Technology
Rust
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
comrak | rust | < 0.17.0 | 0.17.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from multiple quadratic parsing issues inherited from cmark. Key areas identified:
- Emphasis handling (process_emphasis) had O(n²) behavior due to delimiter stack mismanagement, as seen in CVE-2023-28626's reference to cmark#389.
- HTML block parsing lacked state tracking (skip_html_cdata/etc flags added in commit), addressing issues like cmark#299.
- Email autolink validation allowed excessive domain checks (addressed via position constraints).
- Table parsing improvements (table_visited flag) prevent redundant cell scans. The commit diff shows critical optimizations in these areas, replacing pest-based parsing with re2c scanners for linear-time lexing.