<Vulnerability name="CVE-2026-142187">
    <DocumentDistribution xml:lang="en">Copyright © 2012 Red Hat, Inc. All rights reserved.</DocumentDistribution>
    <ThreatSeverity>Moderate</ThreatSeverity>
    <PublicDate>2026-12-02T16:51:03</PublicDate>
    <Bugzilla id="2589029" url="https://bugzilla.redhat.com/show_bug.cgi?id=2589029" xml:lang="en:us">
gorm.io/gorm: github.com/go-gorm/gorm: gorm.io/gorm: Information disclosure via SQL injection in database view creation
    </Bugzilla>
    <CVSS3 status="draft">
        <CVSS3BaseScore>6.5</CVSS3BaseScore>
        <CVSS3ScoringVector>CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N</CVSS3ScoringVector>
    </CVSS3>
    <CWE>CWE-89</CWE>
    <Details xml:lang="en:us" source="Mitre">
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.
    </Details>
    <Details xml:lang="en:us" source="Red Hat">
A flaw was found in gorm.io/gorm. This Structured Query Language (SQL) injection vulnerability occurs during database view creation when bound subquery values containing backslashes are improperly escaped. A remote attacker can exploit this issue by supplying crafted inputs to alter view definitions, resulting in unauthorized information disclosure of sensitive database content.
    </Details>
    <Statement xml:lang="en:us">
This vulnerability is rated as Moderate severity because successful exploitation requires an application to execute database view creation routines using unsanitized user input containing backslashes. In typical Red Hat environments, database schema migration functions are restricted to administrative workflows rather than exposed directly to unauthenticated web requests. Additionally, the issue relies on specific SQL logging and subquery handling behavior during view definition, limiting the attack surface under standard runtime configurations.
    </Statement>
    <Mitigation xml:lang="en:us">
Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability.
    </Mitigation>
    <PackageState cpe="cpe:/a:redhat:hummingbird:1">
        <ProductName>Red Hat Hardened Images</ProductName>
        <FixState>Not affected</FixState>
        <PackageName>go-fdo-server</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:hummingbird:1">
        <ProductName>Red Hat Hardened Images</ProductName>
        <FixState>Not affected</FixState>
        <PackageName>grype</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/a:redhat:hummingbird:1">
        <ProductName>Red Hat Hardened Images</ProductName>
        <FixState>Not affected</FixState>
        <PackageName>spire1.16</PackageName>
    </PackageState>
    <References xml:lang="en:us">
https://www.cve.org/CVERecord?id=CVE-2026-142187
https://nvd.nist.gov/vuln/detail/CVE-2026-142187
https://github.com/go-gorm/gorm/blob/v1.31.2/logger/sql.go#L95-L103
https://github.com/go-gorm/gorm/blob/v1.31.2/migrator/migrator.go#L660-L681
https://www.vulncheck.com/advisories/gorm-through-1.31.2-sql-injection-via-migrator-createview-on-mysql-and-mariadb
    </References>
</Vulnerability>