Track vulnerabilities like this one. Sign up free to get alerted when software you use is affected.
3.3

pest_grammars can crash on deeply nested JSON

published 2 days ago
Summary

The pest_grammars library used for parsing JSON can run out of memory stack when it processes very deeply nested data, causing the program to stop working. This can be triggered by specially crafted JSON from an attacker, leading to a denial of service. Update to pest_grammars version 2.9.3 or later, or add checks to reject overly nested input if you cannot upgrade.

What to do
  • Update dragostis pest_grammars to version 2.9.3.
Affected software
Ecosystem VendorProductAffected versions
crates.io dragostis pest_grammars >= 0.0.0-0, < 2.9.3
Fix: upgrade to 2.9.3
Original advisory text
Stack overflow when parsing deeply nested input in pest_grammars
## 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](https://github.com/pest-parser/pest/blob/v2.9.3/grammars/Cargo.toml#L16-L18) and [deep-nesting regression tests](https://github.com/pest-parser/pest/blob/v2.9.3/grammars/src/lib.rs#L94-L215).

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](https://github.com/pest-parser/pest/security/policy#parsing-untrusted-input).
Fix within
Internet-facing 60 days
Internal At next upgrade
  • Not known to be exploited
  • Needs hands-on effort to exploit (estimated)
  • Gives an attacker partial control (estimated)
Severity
3.3 Low
Timeline
Published16 Oct 2026
Updated17 Oct 2026
First seen17 Oct 2026
Sources
Track software like this
Free during beta