CVE-2022-23535 — Vulnerability in LiteDB — CVE Details
CRITICAL
LiteDB may deserialize bad JSON on object type using _type
Published February 24, 2023Updated November 8, 2023Source: osv
Summary
### Impact
LiteDB use a special field in JSON documents to cast diferent types from `BsonDocument` do POCO classes. When instance 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 in your model.
If your end-user can send to your app a plain JSON string, deserialization can load an unsafe object to fit in your model.
### Patches
Version >= 5.0.13 add some basic fixes to avoid this, but is not 100% guaranteed when using `Object` type
Next major version will contains a allow-list to select what king of Assembly can be loaded
### Workarounds
- Avoid users send to your app a JSON string to be direct insert/update into database
- Avoid use classes with `Object` type - try use an interface when possible
If your app send a plain JSON string to be insert/update into database, prefer this:
```
// Bad
public class Customer {
public int Id { get; set; }
public string Name { get; set; }
public Object AnyData { get; set; } // <= Avoid use `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
}
```
### References
See this workaround fix on this commit:
https://github.com/mbdavid/LiteDB/commit/4382ff4dd0dd8b8b16a4e37dfd29727c5f70f93f
Advisory Timeline
- First published February 24, 2023 (1326 days ago).
- Last revised November 8, 2023 — 256 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
NuGet
Update LiteDB to 5.0.13 or laterdotnet add package LiteDB --version 5.0.13
After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: nuget (1).
| Package | Ecosystem | Affected | Fixed In |
|---|---|---|---|
| LiteDB | nuget | 0.5.0, 0.6.0, 0.8.0, 0.9.0 (+50 more) | 5.0.13 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-502Deserialization of Untrusted DataMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/mbdavid/LiteDB/security/advisories/GHSA-3x49-g6rc-c284WEB
- https://nvd.nist.gov/vuln/detail/CVE-2022-23535ADVISORY
- https://github.com/mbdavid/LiteDB/commit/4382ff4dd0dd8b8b16a4e37dfd29727c5f70f93fWEB
- https://github.com/mbdavid/LiteDB/commit/d72c6774e6a13de2cfcd7d477d3575efeb75c8f2WEB
- https://github.com/mbdavid/LiteDBPACKAGE
- https://github.com/mbdavid/LiteDB/releases/tag/v5.0.13WEB
Frequently Asked Questions
- What is CVE-2022-23535?
- LiteDB may deserialize bad JSON on object type using _type This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2022-23535?
- CVE-2022-23535 affects LiteDB. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2022-23535 and 200,000+ other known vulnerabilities.
Severity & Exploitability
CVSS Score
9.8
Exploitation is straightforward and causes maximum impact. Patch immediately.
Also Known As
GHSA-3x49-g6rc-c284
Related CVEs
- CVE-2026-75513CRITICAL
Marten's LINQ provider has SQL injection via unescaped string literals
- CVE-2026-105794CRITICAL
MsQuic: Improper Certificate Validation in Microsoft.Native.Quic.MsQuic.OpenSSL
Check if you're affected
Scan your dependencies to see if this vulnerability affects your projects.
Scan Your Dependencies