<Vulnerability name="CVE-2026-18447">
    <DocumentDistribution xml:lang="en">Copyright © 2012 Red Hat, Inc. All rights reserved.</DocumentDistribution>
    <ThreatSeverity>Important</ThreatSeverity>
    <PublicDate>2026-11-12T14:15:31</PublicDate>
    <Bugzilla id="2572532" url="https://bugzilla.redhat.com/show_bug.cgi?id=2572532" xml:lang="en:us">
postgresql: postgresql: Arbitrary code execution via type confusion in SQL-language functions
    </Bugzilla>
    <CVSS3 status="verified">
        <CVSS3BaseScore>8.8</CVSS3BaseScore>
        <CVSS3ScoringVector>CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H</CVSS3ScoringVector>
    </CVSS3>
    <CWE>CWE-843</CWE>
    <Details xml:lang="en:us" source="Mitre">
Type confusion in PostgreSQL SQL-language functions allows an object creator to execute arbitrary code as the operating system user running the database, via an output parameter of type "any".  Versions before PostgreSQL 18.7, 17.12, 16.16, 15.20, and 14.25 are affected.
    </Details>
    <Details xml:lang="en:us" source="Red Hat">
A flaw was found in PostgreSQL. An authenticated database user with privileges to create database objects can trigger a type confusion flaw by defining a SQL-language function with an output parameter of type "any". This vulnerability allows the user to execute arbitrary code with the permissions of the operating system user running the database service.
    </Details>
    <Statement xml:lang="en:us">
Red Hat rates this vulnerability as Important because an authenticated user with schema object creation privileges can escape the database engine and execute arbitrary system commands under the postgres host account. Although this issue allows compromise of the database host, exploitation requires valid database credentials and authorization to define custom functions, preventing unauthenticated remote attackers from triggering it directly. In standard Red Hat Enterprise Linux environments, untrusted database accounts are typically restricted from defining schema objects, limiting the attack surface.
    </Statement>
    <Mitigation xml:lang="en:us">
1. Revoke CREATE privileges on public and user schemas from untrusted database roles to prevent unauthorized function creation:

REVOKE CREATE ON SCHEMA public FROM PUBLIC;
REVOKE CREATE ON SCHEMA &lt;schema_name&gt; FROM &lt;role_name&gt;;

2. Restrict network access to the PostgreSQL service to trusted management networks or hosts using firewalld:

firewall-cmd --permanent --remove-service=postgresql
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="&lt;trusted_ip_or_subnet&gt;" service name="postgresql" accept'
firewall-cmd --reload

3. Restrict database client access in /var/lib/pgsql/data/pg_hba.conf to trusted IP addresses only, then reload the database configuration:

systemctl reload postgresql

Caveats:
Revoking schema creation privileges prevents affected database users from creating or altering functions, tables, or other objects, which may disrupt applications that rely on dynamic object definitions. Restricting network access or filtering client subnets prevents connections from unlisted hosts.

Warning:
Applying firewall changes or configuration changes requires reloading the firewall (`firewall-cmd --reload`) or the PostgreSQL service (`systemctl reload postgresql`), which may briefly disrupt active network connections or client sessions.
    </Mitigation>
    <AffectedRelease cpe="cpe:/a:redhat:hummingbird:1">
        <ProductName>Red Hat Hardened Images</ProductName>
        <ReleaseDate>2026-11-13T00:00:00Z</ReleaseDate>
        <Advisory type="RHSA" url="https://access.redhat.com/errata/RHSA-2026:100114">RHSA-2026:100114</Advisory>
        <Package name="postgresql17-main">postgresql17-main-17.12-0.1.hum1</Package>
    </AffectedRelease>
    <AffectedRelease cpe="cpe:/a:redhat:hummingbird:1">
        <ProductName>Red Hat Hardened Images</ProductName>
        <ReleaseDate>2026-11-13T00:00:00Z</ReleaseDate>
        <Advisory type="RHSA" url="https://access.redhat.com/errata/RHSA-2026:100123">RHSA-2026:100123</Advisory>
        <Package name="postgresql18-main">postgresql18-main-18.7-0.1.hum1</Package>
    </AffectedRelease>
    <AffectedRelease cpe="cpe:/a:redhat:hummingbird:1">
        <ProductName>Red Hat Hardened Images</ProductName>
        <ReleaseDate>2026-11-12T00:00:00Z</ReleaseDate>
        <Advisory type="RHSA" url="https://access.redhat.com/errata/RHSA-2026:99821">RHSA-2026:99821</Advisory>
        <Package name="libpq-main">libpq-main-18.7-0.1.hum1</Package>
    </AffectedRelease>
    <References xml:lang="en:us">
https://www.cve.org/CVERecord?id=CVE-2026-18447
https://nvd.nist.gov/vuln/detail/CVE-2026-18447
https://www.postgresql.org/support/security/CVE-2026-18447/
    </References>
</Vulnerability>