{"id":"CVE-2026-53530","aliases":["CVE-2026-53530","GHSA-4hgp-59h5-gvrj"],"related":[],"kind":"vulnerability","state":"published","title":"ratex-parser panics on `\\verb` with a multibyte delimiter (UTF-8 byte-boundary slice)","summary":"RaTeX is a KaTeX-compatible math rendering engine written in Rust. Prior to version 0.1.11, the public parser entrypoint `ratex_parser::parse(&str)` panics on the 9-byte input `\\verbéxé` (i.e. `\\verb` followed by the non-ASCII delimiter `é`). When handling a `\\verb` command, the parser slices the verbatim argument with byte indices (`arg[1..arg.len() - 1]`); if the delimiter character is multibyte UTF-8, index `1` lands inside that character and Rust panics with *“byte index 1 is not a char boundary”*. Because RaTeX’s release profile sets `panic = \"abort\"` (`Cargo.toml:48`), the panic aborts the entire process — not just the current request/thread — making this a hard denial of service for any service that renders untrusted LaTeX. Version 0.1.11 fixes the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"RaTeX is a KaTeX-compatible math rendering engine written in Rust. Prior to version 0.1.11, the public parser entrypoint `ratex_parser::parse(&str)` panics on the 9-byte input `\\verbéxé` (i.e. `\\verb` followed by the non-ASCII delimiter `é`). When handling a `\\verb` command, the parser slices the verbatim argument with byte indices (`arg[1..arg.len() - 1]`); if the delimiter character is multibyte UTF-8, index `1` lands inside that character and Rust panics with *“byte index 1 is not a char boundary”*. Because RaTeX’s release profile sets `panic = \"abort\"` (`Cargo.toml:48`), the panic aborts the entire process — not just the current request/thread — making this a hard denial of service for any service that renders untrusted LaTeX. Version 0.1.11 fixes the issue.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nThe public parser entrypoint `ratex_parser::parse(&str)` panics on the **9-byte** input `\\verbéxé` (i.e. `\\verb` followed by the non-ASCII delimiter `é`). When handling a `\\verb` command, the parser slices the verbatim argument with **byte** indices (`arg[1..arg.len() - 1]`); if the delimiter character is multibyte UTF-8, index `1` lands inside that character and Rust panics with *“byte index 1 is not a char boundary”*. Because RaTeX’s release profile sets `panic = \"abort\"` (`Cargo.toml:48`), the panic aborts the **entire process** — not just the current request/thread — making this a hard denial of service for any service that renders untrusted LaTeX.\n\n\n\n### Details\n\n\n## Affected code\n\n`crates/ratex-parser/src/parser.rs`, `parse_symbol_inner`:\n\n```rust\nif let Some(stripped) = text.strip_prefix(\"\\\\verb\") {       // parser.rs:901\n    self.consume();\n    let arg = stripped.to_string();                         // e.g. \"éxé\"\n    let star = arg.starts_with('*');\n    let arg = if star { &arg[1..] } else { &arg };          // parser.rs:905  (also byte-sliced)\n    if arg.len() < 2 {                                      // byte length\n        return Err(ParseError::new(\"\\\\verb assertion failed\", Some(&nucleus)));\n    }\n    let body = arg[1..arg.len() - 1].to_string();           // parser.rs:910  <-- PANIC on multibyte delimiter\n    ...\n}\n```\n\nFor input `\\verbéxé`: `arg = \"éxé\"`, where `é` = `U+00E9` (bytes `C3 A9`). `arg.len()` is the **byte** length (5), the `< 2` guard passes, and `arg[1..4]` starts at byte index 1 — inside the first `é` (bytes 0..2) — so the slice panics. The lexer groups `\\verb<delim>…<delim>` correctly with char semantics (`lexer.rs` `lex_verb`); only the parser mishandles it.\n\n### PoC\n\n<img width=\"1109\" height=\"205\" alt=\"image\" src=\"https://github.com/user-attachments/assets/cd4bc6ae-23dd-458f-826c-6ce4e85c7005\" />\n\n\n```\n$ printf '\\\\verb\\xc3\\xa9x\\xc3\\xa9\\n' | ./target/release/parse\nthread 'main' panicked at crates/ratex-parser/src/parser.rs:910:27:\nstart byte index 1 is not a char boundary; it is inside 'é' (bytes 0..2 of string)\nAborted (core dumped)            # exit 134 — panic=abort kills the whole process\n```\n\n### Impact\n\nAny application that renders untrusted LaTeX through RaTeX (web “render this math” endpoint, WASM in-browser use, the FFI embedded in another app) can be crashed by a tiny string. With `panic = \"abort\"` in release builds, the crash takes down the whole process / server, so a single malicious formula causes a full-service DoS (and, in batch pipelines, drops all queued work).\n\n## Remediation\n\nSlice by character boundaries instead of byte indices, mirroring the UTF-8-correct logic the lexer already uses. For example:\n\n```rust\nlet chars: Vec<char> = arg.chars().collect();\nif chars.len() < 2 { return Err(ParseError::new(\"\\\\verb assertion failed\", Some(&nucleus))); }\nlet body: String = chars[1..chars.len() - 1].iter().collect();\n```\n\n(Apply the same char-aware handling to the `*` strip at `parser.rs:905`.) More broadly, consider not using `panic = \"abort\"` for builds embedded in long-running services, and/or wrapping parsing in `catch_unwind` at the FFI/WASM boundary — but the byte-slice fix is the direct correction.","format":"markdown","source":"ghsa"},{"lang":"es","text":"RaTeX es un motor de renderizado de matemáticas compatible con KaTeX escrito en Rust. Antes de la versión 0.1.11, el punto de entrada del analizador público 'ratex_parser::parse(&str)' entra en pánico con la entrada de 9 bytes '\\verbéxé' (es decir, '\\verb' seguido por el delimitador no ASCII 'é'). Al manejar un comando '\\verb', el analizador segmenta el argumento verbatim con índices de bytes ('arg[1..arg.len() - 1]'); si el carácter delimitador es UTF-8 multibyte, el índice '1' cae dentro de ese carácter y Rust entra en pánico con 'byte index 1 is not a char boundary'. Debido a que el perfil de lanzamiento de RaTeX establece 'panic = “abort”' ('Cargo.toml:48'), el pánico aborta todo el proceso - no solo la solicitud/hilo actual - haciendo de esto una dura denegación de servicio para cualquier servicio que renderice LaTeX no confiable. La versión 0.1.11 corrige el problema.","source":"nvd"}],"published":"2026-07-07T23:39:12.000Z","modified":"2026-10-12T16:10:00.220Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"}],"cwes":["CWE-248","CWE-400","CWE-1285"],"affected":[{"ranges":[{"version":"< 0.1.11","status":"affected"}],"vendor":"erweixin","product":"RaTeX","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.1.11"}],"ecosystem":"crates.io","package":"ratex-parser","purl":"pkg:cargo/ratex-parser","source":"ghsa"}],"references":[{"url":"https://github.com/erweixin/RaTeX/security/advisories/GHSA-4hgp-59h5-gvrj","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/erweixin/RaTeX","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-08-24T20:04:54.916Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-53530","url":"https://www.cve.org/CVERecord?id=CVE-2026-53530","licence":"CVE Terms of Use","modified":"2026-08-24T20:05:00.628Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-4hgp-59h5-gvrj","url":"https://github.com/advisories/GHSA-4hgp-59h5-gvrj","licence":"CC-BY-4.0","modified":"2026-07-07T23:56:32.324Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-53530","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-53530","licence":"Public domain","modified":"2026-10-12T16:10:00.220Z"}],"updatedAt":"2026-11-25T22:59:34.846Z","epss":{"score":0.00314,"percentile":0.26268,"date":"2026-12-01T12:00:22.000Z"}}