CVE-2022-33171
Description
TypeORM before 0.3.0 allows SQL injection via the findOne function when a crafted FindOneOptions object is supplied instead of an id string.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
TypeORM before 0.3.0 allows SQL injection via the findOne function when a crafted FindOneOptions object is supplied instead of an id string.
The vulnerability resides in the findOne function of TypeORM versions prior to 0.3.0. According to the official description [2], this function can accept either a string identifier or a FindOneOptions object. When the input is a user-controlled parsed JSON object, an attacker can supply a crafted FindOneOptions instead of a plain string, leading to SQL injection. The root cause is that the library does not sufficiently validate or sanitize the type of input when a JSON object is provided, allowing arbitrary database queries to be constructed.
Exploitation does not require authentication if the application exposes the findOne function to user-supplied JSON. An attacker with network access to an endpoint that passes unsanitized user input to findOne can inject SQL operators or conditions within the FindOneOptions object. The attack surface is broad because many web applications using TypeORM rely on this API to look up records based on user input.
The impact of successful exploitation is high, as an attacker can execute arbitrary SQL commands against the database backend. This could lead to unauthorized data access, data modification, or complete database compromise. The SQL injection is direct and does not require complex chaining, making it a significant threat.
The project addressed this issue in version 0.3.0, as indicated by the changelog and commits [1]. Users are strongly advised to upgrade to 0.3.0 or later. The vendor notes that the user's application is responsible for input validation [2], but the library's change in behavior (removing the acceptance of arbitrary objects) provides a defense-in-depth fix.
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
typeormnpm | < 0.3.0 | 0.3.0 |
Affected products
2Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
6- github.com/advisories/GHSA-fx4w-v43j-vc45ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-33171ghsaADVISORY
- packetstormsecurity.com/files/168096/TypeORM-0.3.7-Information-Disclosure.htmlghsax_refsource_MISCWEB
- seclists.org/fulldisclosure/2022/Aug/7ghsamailing-listx_refsource_FULLDISCWEB
- github.com/typeorm/typeorm/compare/0.2.45...0.3.0ghsax_refsource_MISCWEB
- seclists.org/fulldisclosure/2022/Jun/51ghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.