CVE-2022-33171 SQL injection in typeORM
Attackers can execute arbitrary SQL commands via crafted FindOneOptions objects in TypeORM, potentially reading or modifying database contents.
- 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-33171?
CVE-2022-33171 is a critical SQL injection vulnerability in n/a, published on 4 Jul 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
The findOne function in TypeORM before 0.3.0 can either be supplied with a string or a FindOneOptions object. When input to the function is a user-controlled parsed JSON object, supplying a crafted FindOneOptions instead of an id string leads to SQL injection. NOTE: the vendor's position is that the user's application is responsible for input validation
Weakness: CWE-89
Which versions are affected by CVE-2022-33171?
2 open source packages ship an affected version, including typeorm. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
typeorm npm | All versions | 0.3.0 |
typeorm npm | All versions | 0.3.0 |
Products include Typeorm Typeorm.
How do I fix CVE-2022-33171?
Upgrade typeorm to 0.3.0 or later.
Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.
Is CVE-2022-33171 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-33171 exists.
Public exploit code: 1 proofs of concept on GitHub.
Other vulnerabilities in n/a
Sources
Also known as GHSA-fx4w-v43j-vc45.