Summary
Hickory DNS's zone file parser can panic when it encounters a token that is 4096 bytes or longer. An attacker who can get an application to parse a crafted, untrusted zone file may trigger the panic and cause a denial of service.
Affected context
The issue affects applications using the zone file parser in the hickory-proto crate in the described Hickory DNS versions. It becomes a concern when an application parses zone files that an attacker can supply or influence, because a token at or above the parser's length threshold can cause a panic.
Exploit preconditions
- Attack surface: Zone file parsing by an application using the affected parser
- Required access: Ability to supply or influence a zone file that the application parses
- Trigger point: Parsing a token that is 4096 bytes or longer
- Why exploitation is possible: The parser panics on the oversized token instead of handling the input safely
Why this happens
The parser does not safely handle a token that exceeds its supported length, allowing specially sized input to trigger a panic. This is an input validation weakness mapped to CWE-20: Improper Input Validation. Robust parsers should reject or safely process out-of-range input without terminating the process.
Potential impact
- The affected process may terminate or become unavailable
- Zone file processing may be interrupted
- Services that depend on the parser may experience degraded availability
General mitigation guidance
Defensive patterns include:
- Use parser behavior that safely rejects tokens beyond documented limits
- Apply input size and structure checks before parsing untrusted zone files
- Handle parser errors and panics at appropriate process boundaries
- Limit the privileges and resources available to parsing workloads
- Reduce trust in externally supplied files through controlled ingestion and validation
How teams detect issues like this
- Review parser code and dependencies for unchecked length assumptions and panic paths
- Add boundary-focused tests for tokens at, below, and above accepted size limits
- Use static analysis and code review to identify input-dependent panics
- Enforce file-size and token-length policies at ingestion boundaries
- Monitor parsing services for unexpected process exits or repeated parsing failures

