CVE-2021-23214 SQL injection in postgresql

High 8.1 Published Updated

Man-in-the-middle attackers can inject arbitrary SQL queries during connection establishment in PostgreSQL when using specific trust or cert authentication modes.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-23214?

CVE-2021-23214 is a high-severity SQL injection vulnerability in Fedoraproject Fedora, published on 4 Mar 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

When the server is configured to use trust authentication with a clientcert requirement or to use cert authentication, a man-in-the-middle attacker can inject arbitrary SQL queries when a connection is first established, despite the use of SSL certificate verification and encryption.

Weakness: CWE-89

Which versions are affected by CVE-2021-23214?

1 open source package ship an affected version, including postgresql. It affects 6 products.

PackageAffectedFixed in
postgresql BitnamiAll versions9.6.24, 10.19.0, 11.14.0, 12.9.0, 13.5.0, 14.0.1
Linux distribution packages (39)
postgresql AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-contrib AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-docs AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-plperl AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-plpython3 AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-pltcl AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-server AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-server-devel AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-static AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-test AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-test-rpm-macros AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-upgrade AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql-upgrade-devel AlmaLinux:8All versions10.19-1.module_el8.6.0+2744+ce3fc19a
postgresql Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-contrib Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-contrib-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-debugsource Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-docs Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-docs-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-plperl Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-plperl-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-plpython3 Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-plpython3-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-pltcl Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-pltcl-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-server Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-server-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-server-devel Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-server-devel-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-static Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-test Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-test-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-test-rpm-macros Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-upgrade Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-upgrade-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-upgrade-devel Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql-upgrade-devel-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:10.19-1.module+el8.6.0+13642+78853f5a
postgresql Rocky Linux:8All versions0:10.19-1.module+el8.6.0+802+f92d3c38

Products include Fedoraproject Fedora, Postgresql Postgresql, Redhat Enterprise Linux, Redhat Enterprise Linux for Ibm Z Systems, Redhat Enterprise Linux for Power Little Endian, Redhat Software Collections.

How do I fix CVE-2021-23214?

Upgrade postgresql to a fixed version for your release line: 9.6.24, 10.19.0, 11.14.0 or 12.9.0.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2021-23214 being exploited?

There is no known exploitation of CVE-2021-23214 in the wild and no public exploit code.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as ALPINE-CVE-2021-23214, ALSA-2022:1830, AZL-8973, BIT-postgresql-2021-23214, CLEANSTART-2026-WT68849, CLSA-2022-1657814447 and 8 more.

Is CVE-2021-23214 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free