CVE-2026-53531: Ratex parser Ratex-parser Has Unbounded Parser Recursion Vulnerability

MODERATE
Advisory Identifier: GHSA-4w5h-hx6r-28q7
CWE-400 CWE-674
Published
Advisory Summary

CVE-2026-53531 is a MODERATE ratex-parser has unbounded parser recursion vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Ratex parser libraries in the crates.io ecosystem. The issue involves ratex-parser has unbounded parser recursion that leads to stack overflow (process abort). Remediation is available by upgrading affected packages to version 0.1.11.

CVE-2026-53531 at a Glance

CVE Identifier CVE-2026-53531
GHSA Identifier GHSA-4w5h-hx6r-28q7
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Ratex parser
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix CVE-2026-53531

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

ratex-parser fixed: 0.1.11
Upgrade ratex-parser to 0.1.11
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 ratex-parser

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-53531, inspect your project dependencies for Ratex parser:

inspect dependencies for ratex-parser

Analyze the terminal output to locate any version of Ratex parser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.1.11), 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Ratex parser, 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

### Summary RaTeX’s recursive-descent parser recurses one (or more) native stack frame per nesting level at `{`, `\left`, `\sqrt{`, `^{`, etc, with **no maximum depth limit**. A short, ~10 KB input of nested groups overflows the 8 MB main-thread stack and aborts the process. With `panic = "abort"` (`Cargo.toml:48`), and because a Rust stack overflow is always a fatal `SIGABRT` regardless of panic strategy this is an unrecoverable, whole-process denial of service reachable from a single untrusted LaTeX string. ### Details The mutual recursion has no depth guard (`crates/ratex-parser/src/parser.rs`): ``` parse_expression (:113) -> parse_atom (:281/285) -> parse_group (:451) ^ | | on '{' (:459) recurse | +--------------------------+ ``` `\left` adds another recursive edge: `handle_left` → `parse_expression` (`crates/ratex-parser/src/functions/left_right.rs:47`). The only counters present are unrelated to depth: `leftright_depth` (a `\right`-matching counter, `parser.rs:24`) and the macro expander’s `max_expand = 1000` (`macro_expander.rs:64`), which does **not** gate brace / `\left` recursion (those tokens never pass through `expand_once`). There is no `recursion_limit`/depth parameter on `parse_group`, `parse_expression`, or `parse_atom`. ### PoC <img width="1097" height="158" alt="image" src="https://github.com/user-attachments/assets/29b837a2-c455-4cb6-a055-514b31c999c6" /> ``` $ python3 -c 'import sys;sys.stdout.write("{"*200000+"x"+"}"*200000)' | ./target/release/parse thread 'main' has overflowed its stack fatal runtime error: stack overflow, aborting Aborted (core dumped) # exit 134 ``` (Other nesting forms work equally, e.g. `\left(`×N, `\sqrt{`×N, `^{`×N.) ### Impact A single small request crashes the whole RaTeX process. In a typical server-side math-rendering service this is a reliable, unauthenticated DoS; on smaller worker-thread stacks (e.g. a 512 KB async runtime thread) only a few hundred bytes of nesting are required.

CVE-2026-53531 Affected Ratex parser Versions

1 component(s)
Fixed Versions:
0.1.11
Product / Package Ecosystem Affected Versions Fixed Version
ratex-parser
crates.io
< 0.1.11
0.1.11

References

Frequently Asked Questions

What is CVE-2026-53531?
CVE-2026-53531 is a security vulnerability in Ratex parser involving ratex-parser has unbounded parser recursion that leads to stack overflow (process abort) under CWE-400: Uncontrolled Resource Consumption.
Which Ratex parser versions are affected?
Affected versions include releases prior to 0.1.11 across affected packages: ratex-parser.
What version fixes CVE-2026-53531?
Upgrading to 0.1.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ratex-parser affected?
Yes, ratex-parser is affected in releases prior to 0.1.11. Upgrade your dependency to 0.1.11 or later.
What CWE is associated with CVE-2026-53531?
CVE-2026-53531 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check crates.io dependencies for CVE-2026-53531?
Run the dependency tree command: 'inspect dependencies for ratex-parser'. 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-4w5h-hx6r-28q7",
  "modified" : "2026-07-07T23:39:30Z",
  "published" : "2026-07-07T23:39:30Z",
  "aliases" : [ "CVE-2026-53531" ],
  "summary" : "ratex-parser has unbounded parser recursion that leads to stack overflow (process abort)",
  "details" : "### Summary\n\n\nRaTeX’s recursive-descent parser recurses one (or more) native stack frame per nesting level at `{`, `\\left`, `\\sqrt{`, `^{`, etc, with **no maximum depth limit**. A short, ~10 KB input of nested groups overflows the 8 MB main-thread stack and aborts the process. With `panic = \"abort\"` (`Cargo.toml:48`), and because a Rust stack overflow is always a fatal `SIGABRT` regardless of panic strategy this is an unrecoverable, whole-process denial of service reachable from a single untrusted LaTeX string.\n\n### Details\n\nThe mutual recursion has no depth guard (`crates/ratex-parser/src/parser.rs`):\n\n```\nparse_expression (:113)  ->  parse_atom (:281/285)  ->  parse_group (:451)\n                                  ^                          |\n                                  |   on '{' (:459) recurse  |\n                                  +--------------------------+\n```\n\n`\\left` adds another recursive edge: `handle_left` → `parse_expression` (`crates/ratex-parser/src/functions/left_right.rs:47`). The only counters present are unrelated to depth: `leftright_depth` (a `\\right`-matching counter, `parser.rs:24`) and the macro expander’s `max_expand = 1000` (`macro_expander.rs:64`), which does **not** gate brace / `\\left` recursion (those tokens never pass through `expand_once`). There is no `recursion_limit`/depth parameter on `parse_group`, `parse_expression`, or `parse_atom`.\n\n### PoC\n\n<img width=\"1097\" height=\"158\" alt=\"image\" src=\"https://github.com/user-attachments/assets/29b837a2-c455-4cb6-a055-514b31c999c6\" />\n\n\n```\n$ python3 -c 'import sys;sys.stdout.write(\"{\"*200000+\"x\"+\"}\"*200000)' | ./target/release/parse\nthread 'main' has overflowed its stack\nfatal runtime error: stack overflow, aborting\nAborted (core dumped)            # exit 134\n```\n\n(Other nesting forms work equally, e.g. `\\left(`×N, `\\sqrt{`×N, `^{`×N.)\n\n### Impact\n\nA single small request crashes the whole RaTeX process. In a typical server-side math-rendering service this is a reliable, unauthenticated DoS; on smaller worker-thread stacks (e.g. a 512 KB async runtime thread) only a few hundred bytes of nesting are required.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "ratex-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.11"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/erweixin/RaTeX/security/advisories/GHSA-4w5h-hx6r-28q7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/erweixin/RaTeX"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-674" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-07T23:39:30Z",
    "nvd_published_at" : null
  }
}