Integer Overflow in cmark-gfm Table Parsing Extension Leads to Heap Memory Corruption in CommonMarker

commonmarker Updated 02 Oct 2025

Summary

03/03/2022
Yes i
High
8.8

CVE-2022-24724: Integer overflow in cmark-gfm table parsing extension leads to heap memory corruption. Affects commonmarker versions < 0.23.4. Fixed in 0.23.4. How to fix ↓

Also tracked for

The same CVE-2022-24724 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

CommonMarker is a RubyGem package used for rendering Github Flavored Markdown (GFM). It utilizes the cmark-gfm library for this purpose. GFM is a variant of Markdown that includes additional features specific to GitHub, such as tables. The table parsing extension in cmark-gfm allows the rendering of tables in GFM. However, a vulnerability has been discovered in the table parsing extension that can lead to heap memory corruption. This vulnerability affects CommonMarker versions prior to v0.23.4.

Vulnerability Detail

The vulnerability in the cmark-gfm table parsing extension is caused by an integer overflow. When parsing tables with marker rows containing more than UINT16_MAX (65535) columns, an integer overflow occurs. This overflow can result in heap memory corruption. The impact of this corruption can range from information leakage to arbitrary code execution. If CommonMarker is used to render remote user-controlled markdown, this vulnerability can potentially lead to remote code execution (RCE).

How To Fix

Minimum fixed version

0.23.4

This is the first release that contains the fix.

gem install commonmarker -v 0.23.4

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating CommonMarker is not immediately feasible, a workaround is available. The vulnerability specifically affects the table markdown extensions of cmark-gfm. Disabling the use of the table extension will prevent the vulnerability from being triggered. However, this workaround may impact the rendering of tables in GFM.

Conclusion

In conclusion, CommonMarker versions prior to v0.23.4 are vulnerable to an integer overflow in the cmark-gfm table parsing extension. This vulnerability can lead to heap memory corruption and potentially remote code execution (RCE) if CommonMarker is used to render remote user-controlled markdown. It is recommended to update CommonMarker to version v0.23.4 or later to mitigate this vulnerability. Alternatively, disabling the table extension can serve as a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for commonmarker →

Share this vulnerability

FAQ

CommonMarker is a RubyGem package used for rendering Github Flavored Markdown (GFM). It provides a simple and efficient way to parse and render markdown content.

cmark-gfm is a library used by CommonMarker to parse and render GFM. It includes extensions specifically designed for GFM, such as table parsing.

The impact of this vulnerability can range from information leakage to arbitrary code execution. If CommonMarker is used to render remote user-controlled markdown, this vulnerability can potentially lead to remote code execution (RCE).

To fix this vulnerability, update CommonMarker to version v0.23.4 or later. This version includes a patch that addresses the integer overflow issue in the cmark-gfm table parsing extension.

Yes, a workaround is available. The vulnerability specifically affects the table markdown extensions of cmark-gfm. Disabling the use of the table extension will prevent the vulnerability from being triggered. However, this workaround may impact the rendering of tables in GFM.

Related vulnerabilities

Recent vulnerabilities recorded for commonmarker.

How To Fix

Minimum fixed version

0.23.4

This is the first release that contains the fix.

gem install commonmarker -v 0.23.4

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback