CVE-2025-60542

6.5 MEDIUM

📋 TL;DR

This SQL injection vulnerability in TypeORM allows attackers to execute arbitrary SQL commands by crafting malicious requests to repository.save or repository.update methods. The vulnerability affects TypeORM users with MySQL/MariaDB databases due to improper parameter handling in sqlstring. Applications using TypeORM before version 0.3.26 are vulnerable.

💻 Affected Systems

Products:
  • TypeORM
Versions: All versions before 0.3.26
Operating Systems: All operating systems running TypeORM
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects MySQL/MariaDB database drivers; PostgreSQL, SQLite, and other database drivers are not vulnerable. Requires using repository.save() or repository.update() methods with untrusted input.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full database compromise including data theft, modification, deletion, and potential privilege escalation to execute operating system commands via database functions.

🟠

Likely Case

Data exfiltration, unauthorized data modification, and potential authentication bypass by manipulating database queries.

🟢

If Mitigated

Limited impact with proper input validation, parameterized queries, and database user privilege restrictions in place.

🌐 Internet-Facing: HIGH - Web applications exposing TypeORM endpoints directly to the internet are highly vulnerable to automated scanning and exploitation.
🏢 Internal Only: MEDIUM - Internal applications still vulnerable but attack surface reduced; risk from insider threats or compromised internal systems.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires understanding of TypeORM's API and ability to send crafted requests to vulnerable endpoints. No public exploit code available at this time.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.3.26

Vendor Advisory: https://github.com/typeorm/typeorm/releases/tag/0.3.26

Restart Required: No

Instructions:

1. Update TypeORM dependency in package.json to '^0.3.26'. 2. Run 'npm update typeorm' or 'yarn upgrade typeorm'. 3. Test application functionality after update. 4. No server restart required for Node.js applications.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Implement strict input validation and sanitization for all user inputs passed to repository.save() and repository.update() methods.

Use QueryBuilder with Parameters

all

Replace vulnerable repository methods with TypeORM QueryBuilder using parameterized queries for database operations.

🧯 If You Can't Patch

  • Implement Web Application Firewall (WAF) rules to block SQL injection patterns in requests
  • Restrict database user permissions to minimum required privileges and implement network segmentation

🔍 How to Verify

Check if Vulnerable:

Check package.json or package-lock.json for TypeORM version. If version is less than 0.3.26 and using MySQL/MariaDB, the application is vulnerable.

Check Version:

npm list typeorm | grep typeorm OR yarn list typeorm | grep typeorm

Verify Fix Applied:

Verify TypeORM version is 0.3.26 or higher by checking package.json and running 'npm list typeorm' or 'yarn list typeorm'.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL query patterns in database logs
  • Multiple failed login attempts followed by successful authentication
  • Unexpected database schema changes or new table creations

Network Indicators:

  • HTTP requests with SQL keywords in parameters (UNION, SELECT, INSERT, etc.)
  • Abnormal database connection patterns from application servers

SIEM Query:

source="web_logs" AND (method="POST" OR method="PUT") AND (uri="*/save" OR uri="*/update") AND (query="*UNION*" OR query="*SELECT*" OR query="*INSERT*")

🔗 References

📤 Share & Export