Skip to content

Request a 0.13.5 patch release: exponential blowup with ENABLE_WIKILINKS (#1102) and two panics (#1111, #1129) #1179

Closed

Description

@junkdog

The latest release, 0.13.4, has three bugs that a small hostile document can trigger. All three are already fixed on main but not on branch_0.13. We found them by fuzzing a downstream markdown viewer that renders untrusted files. I'm filing this publicly because the repository has no SECURITY.md and private vulnerability reporting is not enabled. The fixes, and the repro tests that go with them, are already public in merged PRs.

1. Exponential event growth with ENABLE_WIKILINKS (fixed on main by #1102)

use pulldown_cmark::{Options, Parser};

for n in [1, 2, 3, 10, 16] {
    let text = "[[a|]] ".repeat(n);
    let events = Parser::new_ext(&text, Options::ENABLE_WIKILINKS).count();
    println!("n={n}: {events} events");
}
n 0.13.4 main (ad1622b)
1 5 5
3 36 13
10 5,116 41
16 (112 bytes) 327,676 65

The event count roughly doubles with each [[a|]], and the duplicated events become duplicated output. In our fuzzer, documents of 2–4 KB drove the process past 16 GB RSS. Any tool/service that renders untrusted markdown with wikilinks enabled can be knocked over this way. Without ENABLE_WIKILINKS, this bug doesn't apply.

2. Panic in handle_wikilink on malformed input (fixed on main by #1111, issue #1108)

" \u{fffd} ![[] ]()]]" with Options::all().

3. Panic in into_offset_iter() on 13 bytes, with no options needed (#1129, still open)

Parser::new("- [o]:u\n \t").into_offset_iter().count() panics at parse.rs:2199. #1129 traces this to edee73b7, which is on main and not in any 0.13.x release, and posts a one-hunk backport for branch_0.13.

Verification

We applied #1102, #1111 and the firstpass.rs hunk of edee73b7 to the 0.13.4 source. Every repro above is then clean, and our test suite passes against the patched crate. main itself isn't a drop-in replacement for 0.13 users: Tag::ContainerBlock and Tag::Highlight break exhaustive matches, and default-features = false now needs features = ["std"].

Ask

  1. A 0.13.5 cut from branch_0.13 with those three cherry-picks. I'm happy to open that PR against branch_0.13 if it would help.
  2. Once a patched version exists, we'd like to file a RustSec advisory for (1), so that cargo audit and Dependabot users learn to upgrade. We'll coordinate the wording and timing with you first.
  3. Please consider turning on GitHub's private vulnerability reporting, or adding a SECURITY.md, for the next report of this kind.

Thanks for the crate, and for the fixes, which were already in main.

Activity

  1. Martin1887 commented on Oct 19, 2026

    @Martin1887
    Collaborator

    Thanks, you are right. But #1129 is still open, fixing it before releasing 0.13.5 would be desirable.

  2. junkdog commented on Oct 19, 2026

    @junkdog
    Author

    Hi, thanks for the response. Sorry, it was a bit sloppy on my part - I should have said that #1129 is already fixed on main with commit edee73b (#997)

    I verified it on branch_0.13: with edee73b cherry-picked, every repro in #1129 and its comments is clean and the test suite passes, and a short, targeted fuzzing session on into_offset_iter came out all clean.

    So all three fixes are ready to backport (once verified).

  3. Martin1887 commented on Oct 21, 2026

    @Martin1887
    Collaborator

    Just released. We will also analyse to introduce a SECURITY.md file or security information in GitHub.

    Thanks!

  4. junkdog commented on Oct 26, 2026

    @junkdog
    Author

    Hi, as mentioend in the original post; here's the draft advisory for the wikilinks blowup (#1102). It Covers 0.13.0–0.13.4, points to 0.13.5, and excludes the other two panics.

    Let me know if the wording needs tweaking before we file. If you'd rather discuss the wording in private, you can email me at: a @ onedaybeard dot net

    The Draft:

    [advisory]
    id = "RUSTSEC-0000-0000"
    package = "pulldown-cmark"
    date = "2026-10-18"
    url = "https://github.com/pulldown-cmark/pulldown-cmark/issues/1179"
    references = ["https://github.com/pulldown-cmark/pulldown-cmark/pull/1102"]
    categories = ["denial-of-service"]
    keywords = ["markdown", "wikilinks", "memory-exhaustion"]
    cvss = "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
    
    [versions]
    patched = [">= 0.13.5"]
    unaffected = ["< 0.13.0"]

    Exponential event growth with ENABLE_WIKILINKS

    When Options::ENABLE_WIKILINKS is enabled, a wikilink with a pipe separator and empty display text, such as [[a|]], leaks its child node's sibling chain into the content that follows it. Each such link roughly doubles the number of events the parser yields for the rest of the document, so output grows exponentially with input size: 16 repetitions of [[a|]] (112 bytes) yield 327,676 events, where the fixed parser yields 65. A document of a few kilobytes is enough to exhaust memory in a process that collects the events or renders them to HTML.

    Applications that parse untrusted Markdown with ENABLE_WIKILINKS set, including through Options::all(), are affected. The option is off by default. Parsing without it is not affected.

    The flaw was fixed in #1102 and released in 0.13.5.

  5. Martin1887 commented on Oct 27, 2026

    @Martin1887
    Collaborator

    It looks good to me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions