Skip to content

Integer overflow in cmark-gfm table parsing extension leads to heap memory corruption

High severity GitHub Reviewed Published Mar 3, 2022 in gjtorikian/commonmarker • Updated Jan 8, 2024

Package

bundler commonmarker (RubyGems)

Affected versions

< 0.23.4

Patched versions

0.23.4

Description

Impact

CommonMarker uses cmark-gfm for rendering Github Flavored Markdown. An integer overflow in cmark-gfm's table row parsing may lead to heap memory corruption when parsing tables who's marker rows contain more than UINT16_MAX columns. The impact of this heap corruption ranges from Information Leak to Arbitrary Code Execution.

If affected versions of CommonMarker are used for rendering remote user controlled markdown, this vulnerability may lead to Remote Code Execution (RCE).

Patches

This vulnerability has been patched in the following CommonMarker release:

  • v0.23.4

Workarounds

The vulnerability exists in the table markdown extensions of cmark-gfm. Disabling any use of the table extension will prevent this vulnerability from being triggered.

References

Acknowledgements

We would like to thank Felix Wilhelm of Google's Project Zero for reporting this vulnerability

For more information

If you have any questions or comments about this advisory:

References

@gjtorikian gjtorikian published to gjtorikian/commonmarker Mar 3, 2022
Published to the GitHub Advisory Database Mar 3, 2022
Reviewed Mar 3, 2022
Last updated Jan 8, 2024

Severity

High
8.8
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

EPSS score

0.423%
(75th percentile)

Weaknesses

CVE ID

CVE-2024-22051

GHSA ID

GHSA-fmx4-26r3-wxpf
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.