Intelligence
highVulnerabilityActive

go-zserio Unbounded Memory Allocation via Untrusted Deserialization

go-zserio trusts size fields during deserialization without validation, allowing attackers to trigger excessive memory allocation (DoS). This PoC demonstrates a fundamental input validation flaw affecting all platforms.

S
Sebastion

CVE References

Affected

woven-by-toyota/go-zserio

Vulnerability Analysis

1. Root Cause & Impact

The go-zserio library implements a serialization/deserialization runtime that fails to validate size parameters before memory allocation. When deserializing arrays, strings, or binary blobs, the library reads a size value and immediately allocates heap memory without sanity checks. This is a classic Unbounded Resource Allocation vulnerability (CWE-770). An attacker crafting malicious zserio-formatted data with artificially large size values can force the runtime to allocate gigabytes of memory, exhausting available system resources and causing denial of service.

2. PoC Significance

This vulnerability is platform-agnostic and affects all implementations consuming go-zserio data. The PoC validates that: (a) size fields are unconditionally trusted, (b) no allocation limits exist, (c) malformed data from any source (local files, network, untrusted APIs) can trigger the condition. The attack has low preconditions—only the ability to provide specially-crafted serialized data to an application using the library.

3. Detection Guidance

Implement detection through: (a) Runtime monitoring: Track process memory growth anomalies during deserialization operations; alert on rapid allocation spikes exceeding baseline; (b) Log analysis: Monitor for zserio deserialization errors, out-of-memory exceptions, or crashes correlating with data ingestion; (c) Network signatures: Detect unusually large size fields in zserio wire protocol data (look for oversized integer values where sizes are encoded); (d) Application-level: Instrument deserialization code paths to log requested allocation sizes before commitment.

4. Mitigation Steps

Immediate actions: (a) Update go-zserio to the patched version (apply commit 39ef1de); (b) Implement strict input validation: add maximum size thresholds before deserialization (e.g., reject arrays/blobs claiming >1GB); (c) Apply defense-in-depth: run applications in containers with memory limits (--memory in Docker); use OOM killers to gracefully terminate processes. Architectural mitigations: (a) Implement timeout-based deserialization with resource quotas; (b) Deserialize untrusted data in isolated processes; (c) Use TLS and authentication to restrict data sources; (d) Implement rate limiting on deserialization endpoints.

5. Risk Assessment

Likelihood: High—this is a trivial attack to execute (craft one malicious file). Threat actor interest: Medium-to-high for adversaries targeting availability or triggering cascading failures (e.g., in microservices). Wild exploitation: Likely targeted at go-zserio users in IoT/automotive contexts (given Toyota affiliation). Blast radius: Significant for services deserializing untrusted zserio data without resource controls. Organizations should prioritize patching and implementing size validation immediately, particularly in network-facing or multi-tenant applications.