Rust advisories / pest_grammars
Vulnerability LowRUSTSEC-2026-0366 · pest_grammars
RUSTSEC-2026-0366: Stack overflow when parsing deeply nested input in pest_grammars
Short answerA security vulnerability in the pest_grammars crate: Stack overflow when parsing deeply nested input in pest_grammars. Low severity (CVSS 3.3). Fixed in 2.9.3: update to a fixed version.
| Crate | pest_grammars |
|---|---|
| Type | Vulnerability (denial-of-service) |
| Affected versions | Before 2.9.3. |
| Fixed in | 2.9.3 |
| Severity | Low, CVSS 3.3 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L |
| Published | 2026-10-16 |
| Last changed | 2026-10-16 |
| Also known as | GHSA-7632-4q2x-hvjw |
| Affected functions | pest_grammars::json::JsonParser::parse |
What to do
- See which version you have:
cargo tree -i pest_grammars(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p pest_grammars. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplepest_grammars = "2.9.3") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
Impact
In affected versions, parsing deeply nested input with pest_grammars::json::JsonParser can exhaust the native stack and abort the hosting process. Applications that accept attacker-controlled JSON without suitable resource limits may therefore be vulnerable to denial of service.
The reported reproduction demonstrates this behavior with deeply nested JSON arrays. The nesting required to trigger an overflow depends on the platform, available stack space, and build configuration; there is no portable safe nesting threshold.
Patches
Upgrade to pest_grammars 2.9.3 or later.
Version 2.9.3 requires the updated pest runtime and includes regression tests for deeply nested JSON with the optional call budget disabled. Supported std builds automatically check available native stack headroom at parser checkpoints and return a handled stack limit reached error when insufficient space is detected. This protection operates independently of pest::set_call_limit(). See the 2.9.3 dependencies and deep-nesting regression tests.
These checks are best-effort. They do not provide universal stack-overflow protection, apply when stack bounds cannot be determined, or provide native-stack protection in no_std builds.
Workarounds and defense in depth
Applications unable to upgrade should reject excessive nesting before invoking the affected parser or configure a suitably conservative pest::set_call_limit() budget. A call budget is not a portable stack-depth guarantee.
Even after upgrading, applications parsing untrusted input should enforce workload-appropriate input, work, memory, and concurrency limits. Stack checks and call budgets do not enforce elapsed-time deadlines. Where a hard deadline or cancellation is required, use supervised parsing as described in the security policy: Parsing Untrusted Input.
References
- Package: crates.io/crates/pest_grammars
- Advisory: rustsec.org/advisories/RUSTSEC-2026-0366.html
- Web: github.com/pest-parser/pest/pull/1212
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?