{"id":"CVE-2026-18401","aliases":["CVE-2026-18401","GHSA-72hv-8253-57qq"],"related":["CVE-2026-68494"],"kind":"vulnerability","state":"published","title":"jackson-core: Number length constraint bypass in non-blocking (async) JSON parser leads to potential denial of service","summary":"The non-blocking (asynchronous) JSON parser in jackson-core does not enforce the maxNumberLength constraint defined in StreamReadConstraints (default: 1000 characters). An attacker able to submit JSON to an application that uses the async parser API can supply a number token of arbitrary length, leading to excessive memory allocation and potential CPU exhaustion, resulting in a denial of service.\n\n\n\nThe synchronous parser enforces this limit correctly, so the constraint is applied inconsistently depending on which parsing API the application uses.\n\n\n\nRoot cause: the async parsing path in NonBlockingUtf8JsonParserBase and related classes never invokes the number length validation methods. Number parsing methods such as _finishNumberIntegralPart() accumulate digits into the TextBuffer without any length check, then call _valueComplete() to finalize the token. _valueComplete() does not call resetInt() or resetFloat(), which are the methods in ParserBase where validateIntegerLength() and validateFPLength() are performed. Because that validation step is skipped, maxNumberLength is never enforced on the async code path.\n\n\n\nImpact: an attacker sending a JSON document containing an arbitrarily long number to an application using the async parser (for example a Spring WebFlux or other reactive application) can cause unbounded allocation in the TextBuffer and an OutOfMemoryError. If the application subsequently calls getBigIntegerValue() or getDecimalValue(), the JVM may additionally be tied up in O(n^2) BigInteger parsing, causing CPU-based denial of service.\n\n\n\nNo privileges or user interaction beyond the ability to submit data for parsing are required.\n\n\n\nThis issue affects com.fasterxml.jackson.core:jackson-core from version 2.15.0 through 2.18.5 and from 2.19.0 through 2.21.0, and tools.jackson.core:jackson-core from 3.0.0 through 3.0.x.\n\n\n\nVersions prior to 2.15.0 are not affected, because StreamReadConstraints -- which defines the maxNumberLength setting -- was first introduced in jackson-core 2.15.0, so no such constraint exists to be bypassed in earlier releases. Note that GHSA-72hv-8253-57qq records the lower bound of the affected 2.x range as 2.0.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"The non-blocking (asynchronous) JSON parser in jackson-core does not enforce the maxNumberLength constraint defined in StreamReadConstraints (default: 1000 characters). An attacker able to submit JSON to an application that uses the async parser API can supply a number token of arbitrary length, leading to excessive memory allocation and potential CPU exhaustion, resulting in a denial of service.\n\n\n\nThe synchronous parser enforces this limit correctly, so the constraint is applied inconsistently depending on which parsing API the application uses.\n\n\n\nRoot cause: the async parsing path in NonBlockingUtf8JsonParserBase and related classes never invokes the number length validation methods. Number parsing methods such as _finishNumberIntegralPart() accumulate digits into the TextBuffer without any length check, then call _valueComplete() to finalize the token. _valueComplete() does not call resetInt() or resetFloat(), which are the methods in ParserBase where validateIntegerLength() and validateFPLength() are performed. Because that validation step is skipped, maxNumberLength is never enforced on the async code path.\n\n\n\nImpact: an attacker sending a JSON document containing an arbitrarily long number to an application using the async parser (for example a Spring WebFlux or other reactive application) can cause unbounded allocation in the TextBuffer and an OutOfMemoryError. If the application subsequently calls getBigIntegerValue() or getDecimalValue(), the JVM may additionally be tied up in O(n^2) BigInteger parsing, causing CPU-based denial of service.\n\n\n\nNo privileges or user interaction beyond the ability to submit data for parsing are required.\n\n\n\nThis issue affects com.fasterxml.jackson.core:jackson-core from version 2.15.0 through 2.18.5 and from 2.19.0 through 2.21.0, and tools.jackson.core:jackson-core from 3.0.0 through 3.0.x.\n\n\n\nVersions prior to 2.15.0 are not affected, because StreamReadConstraints -- which defines the maxNumberLength setting -- was first introduced in jackson-core 2.15.0, so no such constraint exists to be bypassed in earlier releases. Note that GHSA-72hv-8253-57qq records the lower bound of the affected 2.x range as 2.0.0.","source":"cvelist"},{"lang":"en","text":"### Summary\nThe non-blocking (async) JSON parser in `jackson-core` bypasses the `maxNumberLength` constraint (default: 1000 characters) defined in `StreamReadConstraints`. This allows an attacker to send JSON with arbitrarily long numbers through the async parser API, leading to excessive memory allocation and potential CPU exhaustion, resulting in a Denial of Service (DoS).\n\nThe standard synchronous parser correctly enforces this limit, but the async parser fails to do so, creating an inconsistent enforcement policy.\n\n### Details\nThe root cause is that the async parsing path in `NonBlockingUtf8JsonParserBase` (and related classes) does not call the methods responsible for number length validation.\n\n- The number parsing methods (e.g., `_finishNumberIntegralPart`) accumulate digits into the `TextBuffer` without any length checks.\n- After parsing, they call `_valueComplete()`, which finalizes the token but does **not** call `resetInt()` or `resetFloat()`.\n- The `resetInt()`/`resetFloat()` methods in `ParserBase` are where the `validateIntegerLength()` and `validateFPLength()` checks are performed.\n- Because this validation step is skipped, the `maxNumberLength` constraint is never enforced in the async code path.\n\n### PoC\nThe following JUnit 5 test demonstrates the vulnerability. It shows that the async parser accepts a 5,000-digit number, whereas the limit should be 1,000.\n\n```java\npackage tools.jackson.core.unittest.dos;\n\nimport java.nio.charset.StandardCharsets;\n\nimport org.junit.jupiter.api.Test;\n\nimport tools.jackson.core.*;\nimport tools.jackson.core.exc.StreamConstraintsException;\nimport tools.jackson.core.json.JsonFactory;\nimport tools.jackson.core.json.async.NonBlockingByteArrayJsonParser;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\n/**\n * POC: Number Length Constraint Bypass in Non-Blocking (Async) JSON Parsers\n *\n * Authors: sprabhav7, rohan-repos\n * \n * maxNumberLength default = 1000 characters (digits).\n * A number with more than 1000 digits should be rejected by any parser.\n *\n * BUG: The async parser never calls resetInt()/resetFloat() which is where\n * validateIntegerLength()/validateFPLength() lives. Instead it calls\n * _valueComplete() which skips all number length validation.\n *\n * CWE-770: Allocation of Resources Without Limits or Throttling\n */\nclass AsyncParserNumberLengthBypassTest {\n\n    private static final int MAX_NUMBER_LENGTH = 1000;\n    private static final int TEST_NUMBER_LENGTH = 5000;\n\n    private final JsonFactory factory = new JsonFactory();\n\n    // CONTROL: Sync parser correctly rejects a number exceeding maxNumberLength\n    @Test\n    void syncParserRejectsLongNumber() throws Exception {\n        byte[] payload = buildPayloadWithLongInteger(TEST_NUMBER_LENGTH);\n\t\t\n\t\t// Output to console\n        System.out.println(\"[SYNC] Parsing \" + TEST_NUMBER_LENGTH + \"-digit number (limit: \" + MAX_NUMBER_LENGTH + \")\");\n        try {\n            try (JsonParser p = factory.createParser(ObjectReadContext.empty(), payload)) {\n                while (p.nextToken() != null) {\n                    if (p.currentToken() == JsonToken.VALUE_NUMBER_INT) {\n                        System.out.println(\"[SYNC] Accepted number with \" + p.getText().length() + \" digits — UNEXPECTED\");\n                    }\n                }\n            }\n            fail(\"Sync parser must reject a \" + TEST_NUMBER_LENGTH + \"-digit number\");\n        } catch (StreamConstraintsException e) {\n            System.out.println(\"[SYNC] Rejected with StreamConstraintsException: \" + e.getMessage());\n        }\n    }\n\n    // VULNERABILITY: Async parser accepts the SAME number that sync rejects\n    @Test\n    void asyncParserAcceptsLongNumber() throws Exception {\n        byte[] payload = buildPayloadWithLongInteger(TEST_NUMBER_LENGTH);\n\n        NonBlockingByteArrayJsonParser p =\n            (NonBlockingByteArrayJsonParser) factory.createNonBlockingByteArrayParser(ObjectReadContext.empty());\n        p.feedInput(payload, 0, payload.length);\n        p.endOfInput();\n\n        boolean foundNumber = false;\n        try {\n            while (p.nextToken() != null) {\n                if (p.currentToken() == JsonToken.VALUE_NUMBER_INT) {\n                    foundNumber = true;\n                    String numberText = p.getText();\n                    assertEquals(TEST_NUMBER_LENGTH, numberText.length(),\n                        \"Async parser silently accepted all \" + TEST_NUMBER_LENGTH + \" digits\");\n                }\n            }\n            // Output to console\n            System.out.println(\"[ASYNC INT] Accepted number with \" + TEST_NUMBER_LENGTH + \" digits — BUG CONFIRMED\");\n            assertTrue(foundNumber, \"Parser should have produced a VALUE_NUMBER_INT token\");\n        } catch (StreamConstraintsException e) {\n            fail(\"Bug is fixed — async parser now correctly rejects long numbers: \" + e.getMessage());\n        }\n        p.close();\n    }\n\n    private byte[] buildPayloadWithLongInteger(int numDigits) {\n        StringBuilder sb = new StringBuilder(numDigits + 10);\n        sb.append(\"{\\\"v\\\":\");\n        for (int i = 0; i < numDigits; i++) {\n            sb.append((char) ('1' + (i % 9)));\n        }\n        sb.append('}');\n        return sb.toString().getBytes(StandardCharsets.UTF_8);\n    }\n}\n\n```\n\n\n### Impact\nA malicious actor can send a JSON document with an arbitrarily long number to an application using the async parser (e.g., in a Spring WebFlux or other reactive application). This can cause:\n1.  **Memory Exhaustion:** Unbounded allocation of memory in the `TextBuffer` to store the number's digits, leading to an `OutOfMemoryError`.\n2.  **CPU Exhaustion:** If the application subsequently calls `getBigIntegerValue()` or `getDecimalValue()`, the JVM can be tied up in O(n^2) `BigInteger` parsing operations, leading to a CPU-based DoS.\n\n### Suggested Remediation\n\nThe async parsing path should be updated to respect the `maxNumberLength` constraint. The simplest fix appears to ensure that `_valueComplete()` or a similar method in the async path calls the appropriate validation methods (`resetInt()` or `resetFloat()`) already present in `ParserBase`, mirroring the behavior of the synchronous parsers.\n\n**NOTE:** This research was performed in collaboration with [rohan-repos](https://github.com/rohan-repos)","format":"markdown","source":"ghsa"},{"lang":"es","text":"El analizador JSON no bloqueante (asíncrono) en jackson-core no aplica la restricción maxNumberLength definida en StreamReadConstraints (predeterminado: 1000 caracteres). Un atacante capaz de enviar JSON a una aplicación que utiliza la API del analizador asíncrono puede proporcionar un token numérico de longitud arbitraria, lo que lleva a una asignación excesiva de memoria y un posible agotamiento de la CPU, resultando en una denegación de servicio.\n\nEl analizador síncrono aplica este límite correctamente, por lo que la restricción se aplica de forma inconsistente dependiendo de qué API de análisis utilice la aplicación.\n\nCausa raíz: la ruta de análisis asíncrono en NonBlockingUtf8JsonParserBase y clases relacionadas nunca invoca los métodos de validación de longitud de números. Los métodos de análisis de números como _finishNumberIntegralPart() acumulan dígitos en el TextBuffer sin ninguna verificación de longitud, luego llaman a _valueComplete() para finalizar el token. _valueComplete() no llama a resetInt() ni a resetFloat(), que son los métodos en ParserBase donde se realizan validateIntegerLength() y validateFPLength(). Debido a que ese paso de validación se omite, maxNumberLength nunca se aplica en la ruta de código asíncrono.\n\nImpacto: un atacante que envía un documento JSON que contiene un número arbitrariamente largo a una aplicación que utiliza el analizador asíncrono (por ejemplo, una aplicación Spring WebFlux u otra aplicación reactiva) puede causar una asignación ilimitada en el TextBuffer y un OutOfMemoryError. Si la aplicación posteriormente llama a getBigIntegerValue() o getDecimalValue(), la JVM puede además quedar ocupada en el análisis de BigInteger en O(n^2), causando una denegación de servicio basada en CPU.\n\nNo se requieren privilegios ni interacción del usuario más allá de la capacidad de enviar datos para su análisis.\n\nEste problema afecta a com.fasterxml.jackson.core:jackson-core desde la versión 2.15.0 hasta la 2.18.5 y desde la 2.19.0 hasta la 2.21.0, y a tools.jackson.core:jackson-core desde la 3.0.0 hasta la 3.0.x.\n\nLas versiones anteriores a la 2.15.0 no se ven afectadas, porque StreamReadConstraints -- que define la configuración maxNumberLength -- se introdujo por primera vez en jackson-core 2.15.0, por lo que no existe tal restricción que pueda ser eludida en versiones anteriores. Tenga en cuenta que GHSA-72hv-8253-57qq registra el límite inferior del rango 2.x afectado como 2.0.0.","source":"nvd"}],"published":"2026-02-28T02:01:05.000Z","modified":"2026-10-23T23:10:00.157Z","severity":{"scorer":"HeroDevs","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"HeroDevs","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","rating":"MEDIUM"}],"cwes":["CWE-770"],"affected":[{"ranges":[{"type":"maven","introduced":"2.15.0","lastAffected":"2.18.5","status":"affected"},{"type":"maven","version":"2.18.6","status":"unaffected"},{"type":"maven","introduced":"2.19.0","fixed":"2.21.1","status":"affected"},{"type":"maven","version":"2.21.1","status":"unaffected"}],"vendor":"FasterXML","product":"jackson-core","package":"com.fasterxml.jackson.core:jackson-core","repo":"https://github.com/FasterXML/jackson-core","source":"cvelist"},{"ranges":[{"type":"maven","introduced":"3.0.0","fixed":"3.1.0","status":"affected"},{"type":"maven","version":"3.1.0","status":"unaffected"}],"vendor":"FasterXML","product":"jackson-core","package":"tools.jackson.core:jackson-core","repo":"https://github.com/FasterXML/jackson-core","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"3.0.0","status":"affected","fixed":"3.1.0"}],"ecosystem":"Maven","package":"tools.jackson.core:jackson-core","purl":"pkg:maven/tools.jackson.core/jackson-core","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.19.0","status":"affected","fixed":"2.21.1"}],"ecosystem":"Maven","package":"com.fasterxml.jackson.core:jackson-core","purl":"pkg:maven/com.fasterxml.jackson.core/jackson-core","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.15.0","status":"affected","fixed":"2.18.6"}],"ecosystem":"Maven","package":"com.fasterxml.jackson.core:jackson-core","purl":"pkg:maven/com.fasterxml.jackson.core/jackson-core","source":"ghsa"}],"references":[{"url":"https://github.com/FasterXML/jackson-core/security/advisories/GHSA-72hv-8253-57qq","tags":["exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/FasterXML/jackson-core/pull/1555","tags":["patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/FasterXML/jackson-core/commit/b0c428e6f993e1b5ece5c1c3cb2523e887cd52cf","tags":["patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-18401","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/FasterXML/jackson-core","tags":["package"],"sources":["ghsa"]}],"credits":["sprabhav7","rohan-repos","neilmadden-hazelcast","awsactran","pjfanning (PJ Fanning)","cowtowncoder (Tatu Saloranta)"],"assigner":"HeroDevs","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-08-04T17:58:30.797Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-18401","url":"https://www.cve.org/CVERecord?id=CVE-2026-18401","licence":"CVE Terms of Use","modified":"2026-08-04T17:59:07.408Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-72hv-8253-57qq","url":"https://github.com/advisories/GHSA-72hv-8253-57qq","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:34.318Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-18401","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-18401","licence":"Public domain","modified":"2026-10-23T23:10:00.157Z"}],"updatedAt":"2026-11-25T22:59:30.952Z","epss":{"score":0.00538,"percentile":0.38818,"date":"2026-11-30T12:00:22.000Z"}}