Skip to content

fix(deps): bump jackson to 2.18.8 to fix CVE-2025-52999 (high-severity DoS)#221

Merged
joerg84 merged 3 commits into
mainfrom
fix/cve-jackson-dos
Jun 5, 2026
Merged

fix(deps): bump jackson to 2.18.8 to fix CVE-2025-52999 (high-severity DoS)#221
joerg84 merged 3 commits into
mainfrom
fix/cve-jackson-dos

Conversation

@joerg84
Copy link
Copy Markdown
Contributor

@joerg84 joerg84 commented Jun 5, 2026

Summary

Fixes CVE-2025-52999 (HIGH, CVSS v4 8.7) in jackson-core 2.14.2 — a StackOverflowError when parsing deeply nested JSON that allows an unauthenticated remote denial of service. The fix is jackson-core ≥ 2.15.0, which introduces StreamReadConstraints (default max nesting depth = 1000).

Changes

  • Bump com.fasterxml.jackson.core:jackson-core and jackson-databind 2.14.2 → 2.18.8 (kept on the same version to avoid core/databind drift). jackson-annotations follows transitively at 2.18.8.
  • shadowJar: exclude 'META-INF/versions/21/**'.

Why the shadowJar exclude is needed

jackson-core 2.15+ ships as a multi-release JAR that bundles Java 21 (class-file major 65) variants under META-INF/versions/21. The Shadow 8.1.1 plugin relocates com.fasterxml, and its bundled ASM cannot read major version 65, failing the build with Unsupported class file major version 65. This is the same failure that currently blocks the Dependabot bump in #217 (its CI is red on all build jobs).

Dropping the JDK-21-only optimized classes from the fat jar is safe:

  • The fat jar (*-all.jar) is not the published Maven artifact — publishing uses components.java (the thin jar) with a normal dependency POM.
  • The base (Java 8) jackson classes remain, and multi-release fallback covers JDK 17/21 at runtime. versions/9/11/17 are retained.

A more thorough alternative is to modernize the Shadow plugin (com.gradleup.shadow). I kept that out of this CVE fix because the Java-8 CI matrix job constrains us to shadow ≤ 8.3.1 and the upgrade carries package/DSL changes I couldn't validate on a Java 8 build JVM locally. Happy to do it as a follow-up.

Verification

  • ./gradlew clean build jar compileIntegrationTestJavaBUILD SUCCESSFUL, 90/90 unit tests pass (JDK 17, Gradle 8.5).
  • Confirmed in the produced *-all.jar: relocated jackson present, StreamReadConstraints present (the CVE fix), META-INF/versions/21 removed, versions/9/11/17 retained.

Notes

🤖 Generated with Claude Code


Note

Medium Risk
Touches JSON parsing on all Jackson code paths and changes fat-jar contents; behavior change is intended (nesting limits) with a targeted Shadow workaround rather than a plugin upgrade.

Overview
Upgrades Jackson (jackson-core and jackson-databind) from 2.14.2 → 2.21.4 in main and test dependencies, addressing CVE-2025-52999 (high-severity DoS via deeply nested JSON parsing in older jackson-core).

Unblocks the Shadow fat JAR build after the bump: shadowJar now excludes META-INF/versions/21/** so Shadow 8.1.1’s relocation of com.fasterxml no longer hits Java 21 (class major 65) multi-release entries that its ASM cannot process. JDK-21-only optimized classes are omitted from the *-all.jar; the published thin Maven artifact is unchanged.

Reviewed by Cursor Bugbot for commit ed1ef40. Bugbot is set up for automated code reviews on this repo. Configure here.

jackson-core 2.14.2 is vulnerable to CVE-2025-52999 (HIGH, CVSS 8.7): a
StackOverflowError when parsing deeply nested JSON, enabling a remote DoS.
The fix is jackson-core 2.15.0+, which adds StreamReadConstraints with a
default nesting limit of 1000.

- Bump jackson-core and jackson-databind 2.14.2 -> 2.18.8 (kept aligned).
- shadowJar: exclude META-INF/versions/21/** from the (unpublished) fat jar.
  jackson-core 2.15+ is a multi-release JAR carrying Java 21 (class-file
  major 65) classes; the Shadow 8.1.1 plugin relocates com.fasterxml and its
  ASM cannot read major 65 ("Unsupported class file major version 65").
  Dropping the JDK-21-only variants is safe: the base classes remain and
  multi-release fallback applies. This is the same shadowJar failure that
  blocks the dependabot bump in #217.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@rohanshah18 rohanshah18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this! Changes do make sense. Just one question, any particular reason for choosing v2.18.8 instead of the latest version?

Bump jackson-core/databind 2.18.8 -> 2.22.0 (latest 2.x) per review feedback
on #221. 2.22.0 is still Java 8 compatible and has the same multi-release
profile (Java 21 classes under META-INF/versions/21), so the existing shadowJar
exclude is unchanged. jackson 3.x is not an option: it uses new coordinates
(tools.jackson.*) and requires Java 17, while this client targets Java 8.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@joerg84
Copy link
Copy Markdown
Contributor Author

joerg84 commented Jun 5, 2026

Thanks for the review @rohanshah18! No strong reason — I'd initially matched the 2.18.x line from Dependabot #217. Per your suggestion I've bumped to the latest 2.x, 2.22.0 (just pushed).

A couple of notes on the version choice:

  • 2.22.0 is still Java 8 compatible (manifest still declares JavaSE 1.8) and has the same multi-release profile (Java 21 classes under META-INF/versions/21), so the shadowJar exclude is unchanged and the build stays green on the Java 8/11/16/17 matrix.
  • jackson 3.x is intentionally avoided: 3.x ships under new Maven coordinates (tools.jackson.*) and requires Java 17, whereas this client targets Java 8 — so it'd be a breaking change, not a drop-in bump.

CI is re-running on the new commit; I'll keep an eye on it.

Per review: 2.22 is not a long-term-support branch, while 2.21 is an LTS
release (~2-year support window with security backports) — a better fit for a
published client library. 2.21.4 is Java 8 compatible with the same
multi-release profile, so the shadowJar exclude is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@joerg84
Copy link
Copy Markdown
Contributor Author

joerg84 commented Jun 5, 2026

Great call — you're right, 2.22 is non-LTS (short-lived branch) and 2.21 is the LTS line with a ~2-year support window and security backports, which is the better choice for a published library. Switched to the latest 2.21 patch, 2.21.4 (just pushed).

2.21.4 is Java 8 compatible (Build-Jdk-Spec: 1.8) with the same multi-release profile, so the shadowJar exclude is unchanged and the build stays green. Verified locally: 90/90 unit tests pass, jackson resolves to 2.21.4, StreamReadConstraints (the CVE-2025-52999 fix) is present.

@joerg84 joerg84 merged commit 0ecbcf9 into main Jun 5, 2026
13 checks passed
@joerg84 joerg84 deleted the fix/cve-jackson-dos branch June 5, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants