Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

TypeORM: migration:generate template-literal code injection

0
Medium
Published: 07/21/2026 (07/21/2026, 21:59:23 UTC)
Source: GCVE Database
Product: typeorm

Description

TypeORM's migration:generate command embeds database schema metadata into JavaScript/TypeScript template literals without properly escaping template interpolation syntax `${...}`. This allows an attacker who can write schema metadata such as column comments or defaults to inject arbitrary code that executes when the generated migration file is loaded. The vulnerability affects TypeORM versions before 0.3.31 and versions from 1.0.0 up to but not including 1.1.0.

CVSS v3.1

Attack Vector
Network
Attack Complexity
High
Privileges Required
High
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N

Affected software

npmghsa
typeorm
Affected versions
<0.3.31
npmghsa
typeorm
Affected versions
>=1.0.0 <1.1.0

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 07/22/2026, 00:38:03 UTC

Technical Analysis

The TypeORM migration:generate command constructs migration files by embedding SQL statements inside JS/TS template literals, escaping backticks but not the `${...}` interpolation syntax. Schema metadata from various database drivers (Postgres, MySQL/MariaDB, CockroachDB) such as column comments and defaults are included without escaping `${`, allowing an attacker with write access to schema metadata to inject arbitrary JavaScript code. When the generated migration file is loaded (via migration:run, import, or require), the injected code executes. Confirmed injection vectors include MySQL column COMMENT and DEFAULT fields. The suggested fix is to escape `${` sequences or switch to safer string encoding methods.

Potential Impact

An attacker with the ability to write schema metadata (e.g., column comments or defaults) can achieve arbitrary code execution on the host machine that loads the generated migration file. This can lead to full compromise of the development or CI environment where migrations are generated or run. The vulnerability does not affect runtime database operations but targets the migration generation and execution process.

Mitigation Recommendations

Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until a fix is available, avoid running migration:generate on databases where untrusted users can write schema metadata containing `${...}` sequences. Review and sanitize schema metadata inputs to prevent injection. Monitor official TypeORM repositories and advisories for patches that properly escape `${` in template literals or change the migration generation approach.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-2rp8-mm9q-fp49
Osv Schema Version
1.4.0
Aliases
[]
Ecosystems
["npm"]
Database Specific Severity
MODERATE
Cvss Version
3.1

Threat ID: 6a600aa09c2644c7f8fdfa9b

Added to database: 07/22/2026, 00:11:12 UTC

Last enriched: 07/22/2026, 00:38:03 UTC

Last updated: 07/22/2026, 00:38:03 UTC

Views: 2

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses