CVE-2026-73651

TypeORM: migration:generate template-literal code injection

Published Aug 13, 2026 CVSS 3.1 · 5.7 Medium EPSS < 1% KEV · Not listed
Description
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.

Analysis

AI-generated

Technical impact

The vulnerability in TypeORM’s migration:generate command allows an attacker who can write to the database schema to embed a payload in metadata fields such as COMMENT or DEFAULT. The command places schema details inside JavaScript or TypeScript template literals but fails to escape the ${...} interpolation syntax. When the generated migration is subsequently run, imported, or required, the JavaScript engine evaluates the payload, enabling the attacker to execute arbitrary code with the privileges of the running process.

Affected Systems

TypeORM, versions earlier than 0.3.31 and 1.1.0, are affected. Any installation of the ORM that uses migration:generate before either of those release points and does not prohibit schema write access to untrusted actors is vulnerable.

Risk and Exploitability

The CVSS score of 5.7 indicates a medium severity risk from the point of view of the affected application. Exposure requires that an attacker have the ability to modify the database schema and that the generated migration file be executed in the application context—conditions that are typical in environments that automatically apply migrations or allow privileged users to trigger them. The EPSS score is < 1%, indicating a very low probability of exploitation, and the vulnerability is not listed in the CISA KEV catalog, but the attack path remains feasible on any system that does not isolate schema modifications and execution of migration scripts.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade TypeORM to version 0.3.31 or 1.1.0 or later, which removes the injection flaw.
  • Limit database schema write permissions to trusted administrators and prevent insertion of arbitrary text into schema metadata such as COMMENT or DEFAULT fields.
  • Before executing any migration generated by migration:generate, review the file for unexpected ${...} interpolation and remove or escape it; treat such migrations as untrusted and consider running them in a sandbox or after sanitization.

Generated by OpenCVE AI on August 15, 2026 at 02:35 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-2rp8-mm9q-fp49 TypeORM: migration:generate template-literal code injection
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Typeorm
Typeorm typeorm
Vendors & Products Typeorm
Typeorm typeorm
Type Values Removed Values Added
Description 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.
Title TypeORM: migration:generate template-literal code injection
Weaknesses CWE-94
References
Metrics cvssV3_1

{'score': 5.7, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N'}

Weaknesses
  • CWE-917

    Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')

  • CWE-94

    Improper Control of Generation of Code ('Code Injection')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Aug 14, 2026, 6:09 PM
Reserved
Aug 13, 2026, 2:04 PM
Status
Awaiting Analysis
Published
Aug 13, 2026, 7:17 PM
Modified
Sep 18, 2026, 8:05 PM
Severity
Moderate
Public date
Aug 13, 2026, 6:11 PM