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.
Published: 2026-08-13
Score: 5.7 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

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.

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

Remediation

No vendor fix or workaround currently provided.

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

Sat, 15 Aug 2026 00:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-917
References
Metrics threat_severity

None

threat_severity

Moderate


Fri, 14 Aug 2026 19:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

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


Thu, 13 Aug 2026 20:00:00 +0000

Type Values Removed Values Added
First Time appeared Typeorm
Typeorm typeorm
Vendors & Products Typeorm
Typeorm typeorm

Thu, 13 Aug 2026 18:30:00 +0000

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'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-08-14T18:09:07.215Z

Reserved: 2026-08-13T14:04:09.604Z

Link: CVE-2026-73651

cve-icon Vulnrichment

Updated: 2026-08-14T17:53:45.107Z

cve-icon NVD

Status : Received

Published: 2026-08-13T19:17:38.617

Modified: 2026-08-14T19:18:01.140

Link: CVE-2026-73651

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-08-13T18:11:14Z

Links: CVE-2026-73651 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-08-15T02:45:17Z

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')