/

CVE-2026-64678

Severity:

CRITICAL RISK

(9.8)

Unsafe Java Deserialization (CWE-502) in Nitrite DB

CVE-2026-64678

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Potential remote code execution in the embedding application process

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Nitrite can deserialize stored database values with Java ObjectInputStream during automatic migration of a legacy-format database, without restricting which Serializable classes may be instantiated. If an attacker can cause an application to open a crafted database and a suitable gadget class is available on its classpath, this may enable code execution in the application process.

Affected context

The issue affects Nitrite database opening and migration behavior before version 4.4.1. When the database-opening process detects a legacy v1-format store—or encounters a compatibility error that triggers the migration path—it deserializes stored values. The risk depends on whether an attacker can influence the database contents and whether compatible gadget classes are present in the embedding application's classpath.

Exploit preconditions

  • Attack surface: Opening a Nitrite database file and entering the automatic legacy-migration path
  • Required access: Ability to supply, replace, or modify a database file that the application will open
  • Trigger point: Deserialization of stored values during migration
  • Additional condition for code execution: A suitable gadget class must be reachable on the application's classpath
  • Why exploitation is possible: Deserialization uses ObjectInputStream without an effective class allowlist, blocklist, or ObjectInputFilter

Why this happens

Nitrite's custom ObjectInputStream subclass remaps some legacy class descriptors but does not constrain which classes may be deserialized. Consequently, Java serialization callbacks such as readObject(), readExternal(), or readResolve() may run for classes available on the application classpath. This is unsafe deserialization, classified as CWE-502, because data is converted into objects without sufficient controls over the types and behavior involved.

Potential impact

  • An attacker who meets the required conditions may execute code in the embedding application's process.
  • The attacker could gain access to data and resources available to that process.
  • Database contents or application state may be altered.
  • Compromise could extend to connected systems, depending on the application's privileges and environment.

General mitigation guidance

Defensive approaches focus on avoiding unrestricted native Java deserialization and reducing trust in database files.

  • Prefer data formats and parsing APIs that do not instantiate arbitrary application classes.
  • Where Java serialization is unavoidable, apply strict class filtering and explicit allowlists, with limits on object depth and size.
  • Validate database provenance and integrity before opening files, and avoid automatically migrating untrusted stores.
  • Keep database file access restricted and run embedding applications with least privilege.
  • Use classpath and dependency hygiene to reduce exposure to unnecessary gadget-capable libraries.

How teams detect issues like this

  • Use static analysis to identify ObjectInputStream.readObject() calls and custom stream implementations without class filtering.
  • Review database-opening and migration flows for deserialization that occurs before validation or trust checks.
  • Add code-review and CI policies requiring approved serialization filters or safer data formats.
  • Monitor for unexpected legacy-format database files and investigate database files from untrusted sources.
  • Automated code review tools can help flag unrestricted deserialization patterns.

Sources

SourceLink
github.comgithub.com/nitrite/nitrite-java/releases/tag/v4.4.1
github.comgithub.com/nitrite/nitrite-java/security/advisories/GHSA-9297-g93h-86gg

Frequently asked

questions

Not necessarily. Exploitation requires the application to open a database containing attacker-influenced data; a network-facing workflow that accepts or retrieves such files could provide a route to that condition.

The attacker must be able to supply, replace, or modify a database file that the application will process. For code execution, a suitable gadget class must also be available on the application's classpath.

Avoid unrestricted Java object deserialization. Prefer non-executable data formats, or enforce a strict class filter and validate data before migration.

Treat database files as untrusted input, restrict who can modify them, minimize unnecessary dependencies, and use automated checks and code review to detect unrestricted deserialization.

Find out what's already
exploitable in your codebase.