CVE-2026-137162: Quadratic CPU consumption in mdex auto-close block quote prefix expansion

Published Nov 30, 2026
·
Updated

Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who supplies Markdown to exhaust CPU via a long run of block quote markers when auto-close is enabled.

When Markdown is rendered with autoclose: true or through MDEx.stream/2, MDEx.FragmentParser checks whether the last paragraph ends in an incomplete link reference definition. If that paragraph contains >, each line's leading quote prefix is expanded by expandquoteprefix/2 in lib/mdex/fragmentparser.ex. That function is body-recursive and prepends each character to the prefix built so far, copying it again for every leading space, tab or >, so a line of N such bytes costs O(N²). The prefix length is not bounded. A single line of a few hundred kilobytes of > ties up a scheduler for seconds, while the same input renders in milliseconds with auto-close off.

This issue affects mdex: from 0.14.2 before 0.15.0.

Affected Software

1 affected component
hex/mdex>=0.14.2<0.15.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 0.15.0
  2. Configuration

    Set auto_close to false when rendering Markdown to avoid the affected block-quote prefix expansion.

    mdex auto_close = false

Event History

Nov 30, 2026
CVE Published
via MITRE·06:43 PM
Data Sourced
via MITRE·06:43 PM
DescriptionWeakness

Frequently Asked Questions

1

Which deployments are exposed to this issue?

Deployments using mdex versions 0.14.2 through versions before 0.15.0 are affected when rendering attacker-controlled Markdown with auto_close: true. Calls through MDEx.stream/2 also use the affected auto-close path.

2

What input does an attacker need to provide?

The attacker needs to supply Markdown containing a very long run of leading block quote prefix characters, such as >, spaces, or tabs, in the last paragraph. The costly path is reached when fragment parsing checks for an incomplete link reference definition.

3

Is the default rendering configuration known to be affected?

The available information only identifies rendering with auto_close: true and MDEx.stream/2 as affected. It does not state whether auto-close is enabled by default.

4

What can be done before upgrading?

If possible, render untrusted Markdown with auto_close disabled, since the same input renders in milliseconds with auto-close off. Avoid processing untrusted content through MDEx.stream/2 until the affected mdex version is replaced.

5

How can I determine whether a service is currently at risk?

Check whether the service uses mdex 0.14.2 or a later version below 0.15.0, and whether it accepts untrusted Markdown through auto_close: true or MDEx.stream/2. Inputs with extremely long leading quote-prefix runs can cause CPU exhaustion and tie up a scheduler for seconds.

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