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.
Impact
Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access. Typical impact: data disclosure or modification.
CVE-2025-60542 has a CVSS score of 6.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.3.26); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2025-60542? CVE-2025-60542 is a high-severity SQL injection vulnerability in typeorm (npm), affecting versions < 0.3.26. It is fixed in 0.3.26. Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access.
- How severe is CVE-2025-60542? CVE-2025-60542 has a CVSS score of 6.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of typeorm are affected by CVE-2025-60542? typeorm (npm) versions < 0.3.26 is affected.
- Is there a fix for CVE-2025-60542? Yes. CVE-2025-60542 is fixed in 0.3.26. Upgrade to this version or later.
- Is CVE-2025-60542 exploitable, and should I be worried? Whether CVE-2025-60542 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2025-60542 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2025-60542? Upgrade
typeormto 0.3.26 or later.