CVE-2022-23535 LiteDB contains Deserialization of Untrusted Data
An attacker can execute arbitrary code by sending malicious JSON to a LiteDB application that deserializes untrusted data into POCO classes.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-23535?
CVE-2022-23535 is a high-severity unsafe deserialization vulnerability in mbdavid LiteDB, published on 24 Feb 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
LiteDB is a small, fast and lightweight .NET NoSQL embedded database. Versions prior to 5.0.13 are subject to Deserialization of Untrusted Data. LiteDB uses a special field in JSON documents to cast different types from `BsonDocument` to POCO classes. When instances of an object are not the same of class, `BsonMapper` use a special field `_type` string info with full class name with assembly to be loaded and fit into your model. If your end-user can send to your app a plain JSON string, deserialization can load an unsafe object to fit into your model. This issue is patched in version 5.0.13 with some basic fixes to avoid this, but is not 100% guaranteed when using `Object` type. The next major version will contain an allow-list to select what kind of Assembly can be loaded. Workarounds are detailed in the vendor advisory.
Weakness: CWE-502
Which versions are affected by CVE-2022-23535?
2 open source packages ship an affected version, including LiteDB. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
LiteDB NuGet | All versions | 5.0.13 |
LiteDB NuGet | All versions | 5.0.13 |
Products include Litedb Litedb.
How do I fix CVE-2022-23535?
Upgrade LiteDB to 5.0.13 or later.
Upgrade, and only deserialise data from trusted sources or with an allow-list of types. More about Unsafe deserialization.
Is CVE-2022-23535 being exploited?
There is no known exploitation of CVE-2022-23535 in the wild and no public exploit code.
Sources
Also known as GHSA-3x49-g6rc-c284.