CVE-2026-61657 — Ndsev Zserio (< 2.18.2) — CWE-789
Zserio is a framework for serializing structured data with a compact and efficient way with low overhead. The fix for GHSA-cwq5-8pvq-j65j shipped in zserio-runtime 2.18.1 is incomplete. Prior to version 2.18.2, the new bounds check in Array.read() is gated on arrayTraits.isBitSizeOfConstant(), which returns false for variable-size element types including strings and complex structs. For those types the check is never reached, rawArray.reset(readSize) executes unconditionally with an attacker-controlled value, and a 5-byte payload declaring Integer.MAX_VALUE elements causes an attempted ~16 GB heap allocation that crashes any process parsing untrusted zserio data — with no authentication required. This issue has been patched in version 2.18.2.
Zserio is a framework for serializing structured data with a compact and efficient way with low overhead. The fix for GHSA-cwq5-8pvq-j65j shipped in zserio-runtime 2.18.1 is incomplete. Prior to version 2.18.2, the new bounds check in Array.read() is gated on arrayTraits.isBitSizeOfConstant(), which returns false for variable-size element types including strings and complex structs. For those types the check is never reached, rawArray.reset(readSize) executes unconditionally with an attacker-controlled value, and a 5-byte payload declaring Integer.MAX_VALUE elements causes an attempted ~16 GB heap allocation that crashes any process parsing untrusted zserio data — with no authentication required. This issue has been patched in version 2.18.2.
🎯 What is this vulnerability?
CVE‑2026‑61657 – “Zserio array‑size OOM”
| Attribute | Value |
|---|---|
| CWE | CWE‑789 *Out‑of‑bounds Write / Improper Input Validation* |
| CVSS 3.1 | AV:N / AC:L / PR:N / UI:N / S:U / C:N / I:N / A:H → 7.5 (HIGH) |
| Affected component | Array.read() in the zserio‑runtime library (≤ 2.18.1) |
| Root cause | The newly‑added bounds‑check that should prevent an attacker‑controlled readSize from being used to allocate a raw array is only executed when arrayTraits.isBitSizeOfConstant() returns true. For variable‑size element types (e.g., string, nested structs, any type whose bit‑size is not a compile‑time constant) this method returns false, so the guard is skipped. The code then unconditionally executes rawArray.reset(readSize), where readSize is taken directly from the serialized payload. Supplying a maliciously large readSize (e.g., Integer.MAX_VALUE) forces the runtime to attempt a ~16 GiB heap allocation, which on a typical JVM results in an Out‑of‑Memory (OOM) crash of the process that is parsing the untrusted Zserio data.
Why the CVSS vector looks the way it does
- AV:N – The attack can be launched remotely; the attacker only needs to supply a crafted Zserio binary (e.g., via a network service, file upload, or any API that deserialises Zserio data).
- AC:L – No special privileges, timing, or computational effort are required; the payload is a few bytes.
- PR:N / UI:N – No authentication or user interaction is needed.
- S:U – The vulnerability does not depend on a particular privilege level of the victim process; any process that loads the vulnerable runtime is affected.
- C:N / I:N – The flaw does not expose data or allow modification of data directly.
- A:H – The impact is a complete denial of service (process crash) because the JVM runs out of heap memory.
In short: a missing bounds‑check for variable‑size array elements leads to an uncontrolled heap allocation → guaranteed OOM → denial‑of‑service.
⚡ Attack Chain
Below is a realistic, end‑to‑end exploitation flow. All code snippets are illustrative; the exact network endpoint that consumes Zserio data is not disclosed in the CVE, so replace http://target/api/deserialize with the real service URL.
1. Discovery & Reconnaissance
| Step | Technique | What the attacker learns |
|---|---|---|
| a. Identify the library | Passive fingerprinting (e.g., examining HTTP User‑Agent, X‑Powered‑By, or Java stack traces in error pages) or active probing (sending a benign Zserio payload and observing the response). | Detects that the target runs zserio‑runtime and extracts the version from the error message or from a pom.xml/build.gradle file that is sometimes exposed in public repositories. |
| b. Version enumeration | Query a public artifact repository (Maven Central) for the exact version used, or leverage a known “leak” (e.g., a META-INF/MANIFEST.MF containing Implementation-Version). | Confirms the runtime version is < 2.18.2 (e.g., 2.17.5). This version is vulnerable. |
| c. Verify vulnerability | Send a minimal Zserio payload that triggers the OOM path (see PoC below) and watch for a java.lang.OutOfMemoryError or a process termination. | Confirms the presence of CVE‑2026‑61657. |
2. Exploitation
Goal: Force the vulnerable process to allocate ~16 GiB and crash.
2.1. Payload construction
The vulnerable code path is Array.read() for an array of a variable‑size element (e.g., string). The serialized format for a Zserio array (simplified) is:
[uint32] elementCount // number of elements
[<element data> ...] // repeated `elementCount` timesArray.read() reads elementCount into readSize and then calls rawArray.reset(readSize). The fix in 2.18.1 added a check only when arrayTraits.isBitSizeOfConstant() is true. For string this flag is false, so the check is bypassed.
A 5‑byte malicious payload is enough:
| Offset | Bytes (hex) | Meaning |
|---|---|---|
| 0‑3 | FF FF FF 7F | Integer.MAX_VALUE (0x7FFFFFFF) – the element count |
| 4 | 00 | First byte of the first (non‑existent) string length – the parser will never get that far because the allocation fails first. |
2.2. PoC (illustrative)
# Bash + curl example – replace the URL with the actual endpoint that deserialises Zserio data
# The payload is written to a temporary file (payload.bin)
printf '\xFF\xFF\xFF\x7F\x00' > payload.bin
curl -X POST "http://target.example.com/api/deserialize" \
-H "Content-Type: application/octet-stream" \
--data-binary @payload.bin \
-o /dev/null -s -w "%{http_code}\n"What happens on the server
1. The endpoint reads the incoming bytes into a ByteArrayInputStream.
2. Array.read() extracts readSize = 0x7FFFFFFF.
3. Because the element type is a string, arrayTraits.isBitSizeOfConstant() returns false.
4. The bounds‑check (if (readSize > MAX_ELEMENTS) throw …) is skipped.
5. rawArray.reset(readSize) attempts to allocate an internal int[] (or Object[]) of length 2 147 483 647.
6. The JVM tries to reserve ~16 GiB of heap → OutOfMemoryError → the process aborts (or is killed by the OS OOM killer).
Result: The service becomes unavailable for all users until it is restarted.
3. Post‑exploitation
Because the CVSS vector indicates Availability‑only impact, the attacker’s end‑goal is simply Denial‑of‑Service. However, in a multi‑tenant environment the crash can be leveraged for secondary effects:
| Scenario | How the crash helps the attacker |
|---|---|
| a. Service disruption | Repeated OOM crashes force the operator to restart the service, causing downtime and possibly SLA penalties. |
| b. Resource exhaustion | If the service runs inside a container orchestrator (Kubernetes), the OOM kill may trigger a pod restart loop, exhausting cluster resources. |
| c. Crash‑dump analysis | If the process is configured to write core dumps, an attacker who can retrieve the dump (e.g., via a mis‑configured log‑aggregation endpoint) may gain memory snapshots that contain sensitive data. |
| d. Lateral impact | In a monolithic Java application that also hosts authentication or business‑logic code, the crash can be used as a cover for other attacks (e.g., timing‑based side‑channel, or to force a fallback to an insecure component). |
No direct privilege escalation, code execution, or data leakage is guaranteed by the vulnerability itself.
🌍 Real‑World Impact
| CIA Triad | Impact (derived from CVSS) |
|---|---|
| Confidentiality (C) | None – the flaw does not expose data. |
| Integrity (I) | None – the attacker cannot modify persisted data. |
| Availability (A) | High – the attacker can reliably crash any process that parses untrusted Zserio data, leading to full service outage. |
Practical consequences
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade | Move to zserio‑runtime ≥ 2.18.2. The fix removes the isBitSizeOfConstant() gating and always validates readSize against a safe upper bound before allocation. |
| Version range | All versions < 2.18.2 (including 2.18.1, 2.18.0, 2.17.x, …) are vulnerable. |
2. Workarounds (if immediate upgrade is not possible)
| Workaround | How to apply | Effectiveness | ||
|---|---|---|---|---|
| Input size validation at the application layer | Before passing any byte stream to Zserio deserialization, read the first 4 bytes (the array element count) and reject values larger than a sane threshold (e.g., 10 000). Example in Java: <br><br>``java<br>DataInputStream dis = new DataInputStream(inStream);<br>int count = dis.readInt();<br>if (count < 0 | count > 10_000) { throw new IllegalArgumentException("Array size too large"); }<br>// rewind stream or reconstruct a new InputStream that includes the 4 bytes again<br>` | Partial – mitigates the specific OOM path but does not protect against other malformed Zserio structures. | |
| JVM heap limits | Run the vulnerable service with a strict maximum heap (e.g., -Xmx512m). The OOM will still happen, but the process will be killed quickly, limiting the amount of memory the attacker can force the JVM to request. | Low – still a denial‑of‑service, but reduces collateral impact on the host. | ||
| Network‑level throttling | Deploy a WAF or reverse‑proxy rule that caps the request body size for the endpoint that consumes Zserio data. Example ModSecurity rule (illustrative): <br><br>SecRule REQUEST_HEADERS:Content-Type "application/octet-stream" "phase:2,ctl:requestBodyProcessor=XML,ctl:requestBodyAccess=On,ctl:requestBodyLimit=4096,log,deny,status:413" | Effective if the endpoint only ever receives small Zserio messages. The rule must be tuned to the legitimate maximum size. | ||
| Container / orchestration limits | Set memory limits (memory: "1Gi"` in a Kubernetes pod spec) and enable OOM‑score‑adj to ensure the vulnerable container is the first to be killed, preserving other workloads. | Mitigates impact on the overall cluster but does not stop the crash. |
3. Detection
| Indicator | Where it appears | Example log line |
|---|---|---|
| Java OOM exception | Application logs, stderr, or container logs | java.lang.OutOfMemoryError: Java heap space |
| Process termination | Systemd journal, Docker/K8s events | systemd[1]: zserio-service.service: Main process exited, code=exited, status=134/FAILURE |
| Sudden increase in request body size | Reverse‑proxy (NGINX, Apache) access logs | POST /api/deserialize 200 0 "-" "curl/7.88.1" 5242880 (5 MiB payload, far above normal) |
| Core dump generation (if enabled) | Filesystem under /var/crash/ or container volume | core.zserio-service.12345 |
| Repeated restarts | Kubernetes kubectl get pods shows CrashLoopBackOff | zserio-service-5d9f7c9d9f-abcde 0/1 CrashLoopBackOff 5m30s |
SIEM rule (pseudo‑SQL)
SELECT *
FROM logs
WHERE message LIKE '%OutOfMemoryError%'
OR message LIKE '%CrashLoopBackOff%'
OR (request_path = '/api/deserialize' AND request_body_bytes > 4096)⚠️ Urgency
| Environment | Recommended action |
|---|---|
| Production services exposed to the Internet | Immediate – Deploy version ≥ 2.18.2 or apply the input‑validation workaround and enforce strict request‑size limits. |
| Internal micro‑services | High – Upgrade within the next maintenance window; in the meantime, add size checks and memory limits. |
| Embedded / offline devices | Medium – If the device cannot be patched quickly, consider disabling any feature that accepts external Zserio payloads or enforce a hard‑coded maximum element count in the firmware. |
Given the triviality of the exploit and the certainty of a denial‑of‑service, organizations should treat CVE‑2026‑61657 as a critical operational risk and prioritize remediation accordingly.
[🤖 CVE Professor AI Security Engine]
FOFA Query