CVE-2026-142187: GORM through 1.31.2 SQL Injection via Migrator.CreateView on MySQL and MariaDB
GORM through 1.31.2 contains an sql injection vulnerability in Migrator.CreateView that allows attackers to inject SQL by supplying bound subquery values containing backslashes. Because logger.ExplainSQL inlines values without escaping backslashes, a backslash-quote sequence terminates the literal early, letting attackers alter view definitions to expose columns like password hashes.
Affected Software
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Applications using GORM through 1.31.2 with MySQL or MariaDB are affected when they use Migrator.CreateView with bound subquery values. The issue concerns creation of database views rather than general query execution.
What must an attacker control to exploit it?
An attacker must be able to supply a bound subquery value used by Migrator.CreateView. A value containing a backslash-quote sequence can cause the inlined SQL literal to terminate early and permit alteration of the view definition.
What is the likely impact of successful exploitation?
An attacker can alter view definitions, potentially exposing data that the intended view should not reveal. The reported example includes disclosure of columns such as password hashes.