REDHAT-BUG-2539084: High severity fasterxml jackson-core vulnerability
UTF8DataInputJsonParser.reportInvalidToken() in FasterXML jackson-core builds the offending-token text for its error message by appending Java identifier characters to a StringBuilder in a loop that has no upper bound. Unlike the three sibling parser implementations, including UTF8StreamJsonParser, it never consults ErrorReportConfiguration.getMaxErrorTokenLength() (default 256). A malformed token supplied to a parser created through JsonFactory.createParser(DataInput) is therefore accumulated in full. No StreamReadConstraints setting mitigates this: maxDocumentLength cannot be applied to DataInput sources at all, and maxStringLength does not cover this path because the accumulation bypasses ReadConstrainedTextBuffer. The reporter measured a 20,000,109-character exception message from a 20-million-character malformed token on the DataInput path, against 367 characters for identical input on the InputStream path. Scaling the payload drives the StringBuilder, which also incurs byte-to-char expansion and internal array doubling, to many times the raw payload size and can trigger OutOfMemoryError for the whole JVM. UTF8DataInputJsonParser was introduced in 2.8.0 together with createParser(DataInput); releases before 2.8.0 do not contain the affected class.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Avoid JsonFactory.createParser(DataInput) for untrusted input; use the InputStream parser path instead, where malformed-token error text is bounded by ErrorReportConfiguration.getMaxErrorTokenLength().
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications are exposed when they parse attacker-controlled or otherwise untrusted JSON through JsonFactory.createParser(DataInput). The affected parser is UTF8DataInputJsonParser, which was introduced in jackson-core 2.8.0.
Does the default error-token limit protect the DataInput parser path?
No. Although ErrorReportConfiguration.getMaxErrorTokenLength() defaults to 256, UTF8DataInputJsonParser does not consult that setting when constructing this error message.
Can StreamReadConstraints limit the impact if patching is not immediately possible?
No. maxDocumentLength cannot be applied to DataInput sources, and maxStringLength does not cover this accumulation path because it bypasses ReadConstrainedTextBuffer.
What input is needed to trigger the resource exhaustion?
An attacker needs to provide a malformed token containing a very long sequence of Java identifier characters to a parser created from DataInput. The parser accumulates the full offending token into the exception message, potentially causing an OutOfMemoryError for the JVM.