Vulnerabilities in pkg:gem/commonmarker

PACKAGE
Advisory Identifier: GHSA-fmx4-26r3-wxpf
Advisory Summary

CVE-2024-22051 is a HIGH (CVSS 8.8) integer overflow vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Commonmarker libraries in the RubyGems ecosystem. The issue involves integer overflow in cmark-gfm table parsing extension leads to heap memory corruption. Remediation is available by upgrading affected packages to version 0.23.4.

6 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/commonmarker

6 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/commonmarker. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-fmx4-26r3-wxpf CVE-2024-22051 HIGH Integer overflow in cmark-gfm table parsing extension leads to heap memory corruption
GHSA-c2v4-chx5-vff6 - HIGH Duplicate Advisory: Integer overflow in cmark-gfm table parsing extension leads to heap memory corruption
GHSA-7vh7-fw88-wj87 - MODERATE Several quadratic complexity bugs may lead to denial of service in Commonmarker
GHSA-48wp-p9qv-4j64 - MODERATE Commonmarker vulnerable to to several quadratic complexity bugs that may lead to denial of service
GHSA-636f-xm5j-pj9m - MODERATE Several quadratic complexity bugs may lead to denial of service in Commonmarker
GHSA-4qw4-jpp4-8gvp - MODERATE Unbounded resource exhaustion in cmark-gfm autolink extension may lead to denial of service

CVE-2024-22051 at a Glance

CVE Identifier CVE-2024-22051
GHSA Identifier GHSA-fmx4-26r3-wxpf
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-190: Integer Overflow or Wraparound
Affected Product Commonmarker
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-22051

To remediate this vulnerability, upgrade all affected Commonmarker dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

commonmarker fixed: 0.23.4
Upgrade commonmarker to 0.23.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for commonmarker

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-22051, inspect your project dependencies for Commonmarker:

inspect dependencies for commonmarker

Analyze the terminal output to locate any version of Commonmarker in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.23.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Commonmarker, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact CommonMarker uses `cmark-gfm` for rendering [Github Flavored Markdown](https://github.github.com/gfm/). An [integer overflow in `cmark-gfm`'s table row parsing](https://github.com/github/cmark-gfm/security/advisories/GHSA-mc3g-88wq-6f4x) 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 - https://github.com/github/cmark-gfm/security/advisories/GHSA-mc3g-88wq-6f4x ### 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: * Open an issue in [CommonMarker](http://github.com/gjtorikian/commonmarker)

CVE-2024-22051 Affected Commonmarker Versions

1 component(s)
Fixed Versions:
0.23.4
Product / Package Ecosystem Affected Versions Fixed Version
commonmarker
RubyGems
< 0.23.4
0.23.4

References

Frequently Asked Questions

What is CVE-2024-22051?
CVE-2024-22051 is a security vulnerability in Commonmarker involving Integer overflow in cmark-gfm table parsing extension leads to heap memory corruption under CWE-190: Integer Overflow or Wraparound.
Which Commonmarker versions are affected?
Affected versions include releases prior to 0.23.4 across affected packages: commonmarker.
What version fixes CVE-2024-22051?
Upgrading to 0.23.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is commonmarker affected?
Yes, commonmarker is affected in releases prior to 0.23.4. Upgrade your dependency to 0.23.4 or later.
What is the CVSS score of CVE-2024-22051?
CVE-2024-22051 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-22051?
CVE-2024-22051 is classified under CWE-190: Integer Overflow or Wraparound (The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.).
How can I check RubyGems dependencies for CVE-2024-22051?
Run the dependency tree command: 'inspect dependencies for commonmarker'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fmx4-26r3-wxpf",
  "modified" : "2026-05-14T20:48:53Z",
  "published" : "2022-03-03T20:28:47Z",
  "aliases" : [ "CVE-2024-22051" ],
  "summary" : "Integer overflow in cmark-gfm table parsing extension leads to heap memory corruption",
  "details" : "### Impact\n\nCommonMarker uses `cmark-gfm` for rendering [Github Flavored Markdown](https://github.github.com/gfm/). An [integer overflow in `cmark-gfm`'s table row parsing](https://github.com/github/cmark-gfm/security/advisories/GHSA-mc3g-88wq-6f4x) 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.\n\nIf affected versions of CommonMarker are used for rendering remote user controlled markdown, this vulnerability may lead to Remote Code Execution (RCE).\n\n### Patches\n\nThis vulnerability has been patched in the following CommonMarker release:\n\n- v0.23.4\n\n### Workarounds\n\nThe vulnerability exists in the table markdown extensions of `cmark-gfm`. Disabling any use of the table extension will prevent this vulnerability from being triggered.\n\n### References\n\n- https://github.com/github/cmark-gfm/security/advisories/GHSA-mc3g-88wq-6f4x\n\n### Acknowledgements\n\nWe would like to thank Felix Wilhelm of Google's Project Zero for reporting this vulnerability\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* Open an issue in [CommonMarker](http://github.com/gjtorikian/commonmarker)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "commonmarker"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.23.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/github/cmark-gfm/security/advisories/GHSA-mc3g-88wq-6f4x"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gjtorikian/commonmarker/security/advisories/GHSA-fmx4-26r3-wxpf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-22051"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gjtorikian/commonmarker/commit/ab4504fd17460627a6ab255bc3c63e8e5fc6aed3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gjtorikian/commonmarker"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/commonmarker/CVE-2024-22051.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-190" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-03T20:28:47Z",
    "nvd_published_at" : null
  }
}