CVE-2020-14350
📋 TL;DR
This CVE describes a PostgreSQL vulnerability where certain extensions don't properly secure their installation scripts against search_path manipulation. Attackers with sufficient database privileges can trick administrators into executing malicious scripts during extension installation or updates. This affects PostgreSQL versions before specific security releases.
💻 Affected Systems
- PostgreSQL
📦 What is this software?
Leap by Opensuse
Leap by Opensuse
Postgresql by Postgresql
Postgresql by Postgresql
Postgresql by Postgresql
Postgresql by Postgresql
Postgresql by Postgresql
Ubuntu Linux by Canonical
Ubuntu Linux by Canonical
Ubuntu Linux by Canonical
⚠️ Risk & Real-World Impact
Worst Case
An attacker could execute arbitrary code with database administrator privileges, potentially leading to full database compromise, data exfiltration, or lateral movement to the underlying operating system.
Likely Case
Privileged database users could escalate privileges, manipulate data, or install backdoors within the PostgreSQL environment.
If Mitigated
With proper access controls and monitoring, impact is limited to the database layer with no operating system compromise.
🎯 Exploit Status
Exploitation requires: 1) Attacker with CREATE privilege or higher, 2) Administrator installing/updating vulnerable extensions, 3) Ability to influence search_path during installation.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: PostgreSQL 12.4, 11.9, 10.14, 9.6.19, 9.5.23
Vendor Advisory: https://www.postgresql.org/support/security/
Restart Required: Yes
Instructions:
1. Backup your PostgreSQL database. 2. Stop PostgreSQL service. 3. Upgrade to patched version using your distribution's package manager or PostgreSQL binaries. 4. Restart PostgreSQL service. 5. Verify upgrade completed successfully.
🔧 Temporary Workarounds
Restrict extension installation
allLimit who can install PostgreSQL extensions and monitor extension installation activities
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
CREATE ROLE extension_installer;
GRANT CREATE ON SCHEMA public TO extension_installer;
Secure search_path for administrators
allSet secure search_path for database administrators during extension operations
ALTER ROLE admin_user SET search_path = "\"$user\", public";
🧯 If You Can't Patch
- Implement strict access controls: Only allow trusted administrators to install/update extensions
- Monitor and audit all extension installation activities and review installation scripts before execution
🔍 How to Verify
Check if Vulnerable:
Check PostgreSQL version: SELECT version(); If version is earlier than patched versions listed above, system is vulnerable.
Check Version:
psql -c 'SELECT version();'
Verify Fix Applied:
After patching, verify version shows patched release and test extension installation procedures.
📡 Detection & Monitoring
Log Indicators:
- Unusual extension installation activities
- Multiple failed extension installation attempts
- Administrator account performing unexpected CREATE operations
Network Indicators:
- Unusual database connection patterns during maintenance windows
SIEM Query:
source="postgresql.log" AND ("CREATE EXTENSION" OR "ALTER EXTENSION") AND NOT user IN (allowed_admin_users)
🔗 References
- http://lists.opensuse.org/opensuse-security-announce/2020-08/msg00043.html
- http://lists.opensuse.org/opensuse-security-announce/2020-08/msg00044.html
- http://lists.opensuse.org/opensuse-security-announce/2020-08/msg00049.html
- http://lists.opensuse.org/opensuse-security-announce/2020-08/msg00050.html
- http://lists.opensuse.org/opensuse-security-announce/2020-09/msg00003.html
- http://lists.opensuse.org/opensuse-security-announce/2020-09/msg00008.html
- https://bugzilla.redhat.com/show_bug.cgi?id=1865746
- https://lists.debian.org/debian-lts-announce/2020/08/msg00028.html
- https://security.gentoo.org/glsa/202008-13
- https://security.netapp.com/advisory/ntap-20200918-0002/
- https://usn.ubuntu.com/4472-1/
- http://lists.opensuse.org/opensuse-security-announce/2020-08/msg00043.html
- http://lists.opensuse.org/opensuse-security-announce/2020-08/msg00044.html
- http://lists.opensuse.org/opensuse-security-announce/2020-08/msg00049.html
- http://lists.opensuse.org/opensuse-security-announce/2020-08/msg00050.html
- http://lists.opensuse.org/opensuse-security-announce/2020-09/msg00003.html
- http://lists.opensuse.org/opensuse-security-announce/2020-09/msg00008.html
- https://bugzilla.redhat.com/show_bug.cgi?id=1865746
- https://lists.debian.org/debian-lts-announce/2020/08/msg00028.html
- https://security.gentoo.org/glsa/202008-13
- https://security.netapp.com/advisory/ntap-20200918-0002/
- https://usn.ubuntu.com/4472-1/