GHSA-mj63-m3rc-8ppr: Medium severity composer/league/commonmark vulnerability

Published Aug 6, 2026
·
Updated

Impact

XmlRenderer pretty-prints XML by emitting depth-proportional indentation whitespace for every opening and closing tag. For a tree of depth n, the indentation alone sums to O(n²) bytes of output (and corresponding memory), reachable through MarkdownToXmlConverter — e.g. strrepeat('> ', $depth) . "x\n", a single line of nested blockquotes — or through a direct XmlRenderer::renderDocument() call on an attacker-influenced AST.

This affects applications that convert untrusted Markdown to XML, which is an opt-in output path. The parser's maxnestinglevel bounds the depth of parser-created trees, but its default is high enough to reach damaging sizes, can be raised by the host application, and does not constrain custom or programmatically built ASTs handed straight to the renderer. The result is a memory / output-size amplification rather than a hard crash, which is why this issue is rated Medium rather than High. No confidentiality or integrity impact. XML rendering was introduced in 2.0.0 (first shipped in 2.0.0-beta1, June 2021) and has emitted depth-proportional indentation ever since, so all 2.x releases are affected (verified against 2.8.x, clean upstream 1902f60f). 1.x has no XML renderer and is not affected.

Workarounds

Applications converting untrusted Markdown to XML should:

- Lower maxnestinglevel to a conservative value appropriate to expected content, so the parser refuses to build extremely deep trees. This is the most direct lever for parser-produced ASTs, but does not protect trees built programmatically and passed straight to XmlRenderer. - Cap input size before conversion, since the amplification is driven by input-proportional depth. - Constrain XML consumers with memory / output-size limits (and streaming or size caps on any downstream XML parser or storage) so one request cannot allocate unbounded output. - Prefer HTML rendering for untrusted content where XML is not strictly required — the HTML renderer does not emit depth-proportional indentation and is not subject to this amplification.

Affected Software

1 affected componentFixes available
composer/league/commonmark>=2.0.0<2.9.0
2.9.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/league/commonmark to a version that resolves this vulnerability.

    Fixed in 2.9.0
  2. Configuration

    Lower `max_nesting_level` to a conservative value appropriate to expected content so the parser refuses to build extremely deep trees (this bounds parser-created trees).

    XmlRenderer / MarkdownToXmlConverter max_nesting_level = lower to a conservative value
  3. Configuration

    Cap Markdown input size before conversion, since the amplification is driven by input-proportional depth.

    Input conversion pipeline (Markdown -> XML) max input size before conversion = cap
  4. Configuration

    Prefer HTML rendering for untrusted content where XML is not strictly required, since the HTML renderer does not emit depth-proportional indentation and is not subject to the amplification.

    Rendering choice (Markdown rendering) output format = prefer HTML rendering for untrusted content where XML is not strictly required
  5. Compensating control

    Constrain XML consumers with memory / output-size limits, and use streaming or size caps on any downstream XML parser or storage so one request cannot allocate unbounded output.

Event History

Aug 6, 2026
Advisory Published
via GitHub·08:42 PM
Data Sourced
via GitHub·08:42 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203