CVE-2022-23535: LiteDB Deserialization of Bad JSON

LiteDB Updated 02 Oct 2025

Summary

24/02/2023
Yes i
Critical
9.8

CVE-2022-23535: LiteDB may deserialize bad JSON on object type using _type. Affects LiteDB versions < 5.0.13. Fixed in 5.0.13. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

LiteDB is a lightweight embedded NoSQL database for .NET. It allows developers to store and retrieve data using a simple document-oriented approach. LiteDB utilizes a special field in JSON documents to cast different types from BsonDocument to POCO classes. This feature enables the mapping of JSON data to object properties. However, when an instance of an object does not match the class, LiteDB uses a special field called _type to load and fit the object into the model. This vulnerability arises when deserialization attempts to load an unsafe object from a plain JSON string, potentially leading to security issues.

Vulnerability Detail

The vulnerability in LiteDB arises from the deserialization of bad JSON on object types using the _type field. If an end-user can send a plain JSON string to the application, the deserialization process may load an unsafe object that can fit into the model. This can result in various security risks, such as remote code execution or data manipulation. While version 5.0.13 of LiteDB includes some basic fixes to mitigate this vulnerability, it is not guaranteed to be 100% effective when using the Object type. A future major version of LiteDB will introduce an allow-list to control the loading of assemblies. To address this vulnerability, it is recommended to avoid direct insertion or update of plain JSON strings into the database and to refrain from using classes with the Object type. Instead, consider using interfaces or specific data structures to ensure safer deserialization.

How To Fix

Latest published version: 5.0.21 as of 22 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.0.13

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

To mitigate the vulnerability, consider the following workarounds:

  • Avoid allowing users to directly insert or update plain JSON strings into the database.
  • Refrain from using classes with the Object type. Instead, use interfaces or specific data structures.

For example:

// Bad

public class Customer { public int Id { get; set; } public string Name { get; set; } public Object AnyData { get; set; } // Avoid using Object base type

}

// Good

public class Customer { public int Id { get; set; } public string Name { get; set; } public IDictionary<string, string> AnyData { get; set; } // Will accept only key/value strings

}

Conclusion

The vulnerability in LiteDB related to the deserialization of bad JSON on object types using the _type field can have severe security implications. It is crucial to update LiteDB to version 5.0.13 or later and follow the recommended workarounds to mitigate the risk. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for LiteDB →

Share this vulnerability

FAQ

LiteDB is a lightweight embedded NoSQL database for .NET. It provides a document-oriented approach for storing and retrieving data.

LiteDB uses a special field called _type in JSON documents to cast different types from BsonDocument to POCO classes. This allows mapping of JSON data to object properties.

The vulnerability in LiteDB can lead to the deserialization of unsafe objects from plain JSON strings. This can result in security risks such as remote code execution or data manipulation.

Version 5.0.13 of LiteDB includes some basic fixes to mitigate this vulnerability. However, it is not guaranteed to be 100% effective when using the Object type. A future major version of LiteDB will introduce an allow-list to control the loading of assemblies.

To mitigate this vulnerability, it is recommended to avoid direct insertion or update of plain JSON strings into the database. Additionally, refrain from using classes with the Object type and consider using interfaces or specific data structures instead.

How To Fix

Latest published version: 5.0.21 as of 22 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.0.13

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback