GHSA-j95f-988m-3j2f: Npm/@tiptap/core vulnerability

Published Sep 8, 2026
·
Updated

Summary

@tiptap/core contains two quadratic regular-expression denial-of-service paths in its default Markdown attribute parsers. Pandoc-style block attributes use two unanchored greedy expressions that rescan repeated QUOTED0 prefixes. Inline shortcode attributes use another unanchored greedy key expression that rescans a long word-character run when no equals sign follows.

The public createAtomBlockMarkdownSpec and createBlockMarkdownSpec helpers call the vulnerable Pandoc-style parser; createInlineMarkdownSpec calls the separately vulnerable shortcode parser. Using unmodified npm 3.29.2, a complete 20,508-byte atom-block token took approximately 1.40 seconds while an equal-length control took 0.29 ms. A complete 32,776-byte inline token took approximately 2.21 seconds while its equal-length control took 0.19 ms. Current repository main commit 5158212970344952dd9918b6a44bfb400d7fb6c1 retains both expressions.

Block attribute root cause

packages/core/src/utilities/markdown/attributeUtils.ts uses both matchAll and replace with /([a-zA-Z][\w-])\s=\s(QUOTED\d+)/g. The candidate is 'QUOTED0'.repeat(n) + 'QUOTED0'. There are no quotes, so the preceding replacement leaves it unchanged. At each Q, the greedy key-name expression consumes the remaining word-character run, the required equals sign fails, and the unanchored engine restarts at the next Q. This yields O(n^2) work, and the cleanup pass repeats it.

A complete public-API proof is:

js import { createAtomBlockMarkdownSpec } from '@tiptap/core' const tokenizer = createAtomBlockMarkdownSpec({ nodeName: 'probe' }).markdownTokenizer const attack = 'QUOTED0'.repeat(2048) + 'QUOTED0' const source = :::probe {${attack}} :::\n const started = performance.now() tokenizer.tokenize(source, [], {}) console.log(performance.now() - started)

Measured complete-tokenizer timings were 6.23, 23.12, 88.93, 369.10, and 1,400.17 ms at 1,308, 2,588, 5,148, 10,268, and 20,508 bytes. Equal-length controls took 0.07 to 0.29 ms. The directly exported parser took 5,645.71 ms at 40,972 bytes while its control took 0.64 ms.

Inline attribute root cause

packages/core/src/utilities/markdown/createInlineMarkdownSpec.ts uses /(\w+)=(?:"([^"])"|'([^'])')/g. For a long word-character run without an equals sign, \w+ consumes the remaining suffix, = fails, and the unanchored engine restarts at the next character. The default inline tokenizer extracts this attacker string directly from a syntactically complete [shortcode attributes] token.

js import { createInlineMarkdownSpec } from '@tiptap/core' const tokenizer = createInlineMarkdownSpec({ nodeName: 'probe', selfClosing: true }).markdownTokenizer const source = [probe ${'0'.repeat(32768)}] const started = performance.now() tokenizer.tokenize(source, [], {}) console.log(performance.now() - started)

At 1,032, 2,056, 4,104, 8,200, 16,392, and 32,776 bytes, candidates took 3.24, 12.88, 54.82, 136.91, 557.83, and 2,209.47 ms. Equal-length hyphen controls took 0.02 to 0.19 ms.

Impact

Applications parsing attacker-controlled Markdown with these helpers can have a browser main thread, server event loop, or worker blocked by a small input. Persisted documents can repeatedly freeze clients; repeated requests can exhaust server-side parsing capacity. Editors that only consume validated ProseMirror JSON and never invoke the Markdown parsing path are not directly affected through document content.

History and remediation

Commit 35645d94ae9cd73448a564104c2e08f64e9564bc introduced both parsers on 14 October 2025, first released in 3.7.0. Versions 3.7.0 through current 3.29.2 and current main remain affected. Official issue, PR, and repository-advisory searches found no duplicate.

Require a start-of-string or whitespace boundary before both key-value parsers, and preferably replace the multi-pass placeholder and shortcode regex designs with deterministic single-pass tokenizers. Keep quoted values out-of-band so attacker input cannot collide with predictable QUOTEDn placeholders. Add complete block and inline Markdown-tokenizer scaling regressions with equal-length controls.

Please credit GitHub user joostgrunwald as finder/reporter.

Affected Software

1 affected componentFixes available
npm/@tiptap/core>=3.7.0<3.30.5
3.30.5

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/@tiptap/core to a version that resolves this vulnerability.

    Fixed in 3.30.5
  2. Configuration

    Update the default Markdown attribute parsing logic to require a start-of-string or whitespace boundary before both key-value parsers, and replace the current multi-pass placeholder/shortcode regex designs with deterministic single-pass tokenizers to prevent unanchored greedy rescans (O(n^2) ReDoS).

    @tiptap/core Markdown attribute parsers Regex parsing design for Pandoc-style and inline shortcode attributes = Use start-of-string or whitespace boundary before both key-value parsers; replace multi-pass placeholder and shortcode regex designs with deterministic single-pass tokenizers

Event History

Sep 8, 2026
Advisory Published
via GitHub·09:24 PM
Data Sourced
via GitHub·09:24 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Which application paths are exposed to the slow regular-expression processing?

Applications using createAtomBlockMarkdownSpec or createBlockMarkdownSpec reach the vulnerable Pandoc-style block-attribute parser. Applications using createInlineMarkdownSpec reach the separately vulnerable inline shortcode-attribute parser.

2

Does this affect the default Markdown attribute parsing behavior?

Yes. The affected paths are described as default Markdown attribute parsers, so applications using these public helpers can invoke them without replacing the parser implementation.

3

What input would trigger the issue?

The block path is triggered by repeated __QUOTED_0 prefixes ending in __QUOTED_0__. The inline path is triggered by a long word-character run where no equals sign follows, causing the greedy key expression to rescan the input.

4

How can I determine whether my deployment may be affected?

Unmodified npm version 3.29.2 is confirmed affected. The repository main commit 5158212970344952dd9918b6a44bfb400d7fb6c1 is also reported to retain both vulnerable expressions.

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