CVE-2015-3167

7.5 HIGH

📋 TL;DR

This vulnerability in PostgreSQL's pgcrypto extension leaks information through different error responses when incorrect encryption keys are used. Attackers can exploit this timing side-channel to perform brute-force attacks and potentially recover encryption keys. Affects PostgreSQL installations using pgcrypto with vulnerable versions.

💻 Affected Systems

Products:
  • PostgreSQL
Versions: PostgreSQL before 9.0.20, 9.1.x before 9.1.16, 9.2.x before 9.2.11, 9.3.x before 9.3.7, and 9.4.x before 9.4.2
Operating Systems: All operating systems running affected PostgreSQL versions
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects installations using the pgcrypto extension for encryption operations. Systems not using pgcrypto are not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers recover encryption keys, decrypt sensitive data stored in PostgreSQL, and potentially access other systems using compromised credentials.

🟠

Likely Case

Attackers with database access perform offline brute-force attacks against encrypted data, potentially decrypting sensitive information over time.

🟢

If Mitigated

With network isolation and proper access controls, risk is limited to authenticated attackers with database access performing time-consuming attacks.

🌐 Internet-Facing: MEDIUM - Requires database access, but internet-facing PostgreSQL instances with weak authentication are vulnerable to key recovery attacks.
🏢 Internal Only: MEDIUM - Internal attackers with database credentials can exploit this to recover encryption keys from stored data.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires database access and ability to perform encryption operations. The timing attack is well-understood and could be automated.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: PostgreSQL 9.0.20, 9.1.16, 9.2.11, 9.3.7, or 9.4.2

Vendor Advisory: http://www.postgresql.org/about/news/1587/

Restart Required: Yes

Instructions:

1. Backup your PostgreSQL database. 2. Stop PostgreSQL service. 3. Upgrade to patched version using your distribution's package manager. 4. Restart PostgreSQL service. 5. Verify pgcrypto functions correctly.

🔧 Temporary Workarounds

Disable pgcrypto extension

all

Remove or disable the pgcrypto extension if not required

DROP EXTENSION pgcrypto;

Network isolation

all

Restrict database access to trusted networks only

Configure pg_hba.conf to restrict connections
Use firewall rules to limit PostgreSQL port access

🧯 If You Can't Patch

  • Implement strong authentication and limit database access to essential users only
  • Monitor for unusual database activity and failed authentication attempts

🔍 How to Verify

Check if Vulnerable:

Check PostgreSQL version: SELECT version(); and verify if using affected version with pgcrypto extension

Check Version:

psql -c 'SELECT version();'

Verify Fix Applied:

Verify PostgreSQL version is 9.0.20, 9.1.16, 9.2.11, 9.3.7, 9.4.2 or later

📡 Detection & Monitoring

Log Indicators:

  • Multiple failed encryption/decryption operations
  • Unusual pgcrypto function usage patterns

Network Indicators:

  • Repeated database connections with encryption operations
  • Unusual timing patterns in database responses

SIEM Query:

source="postgresql" AND (message="*pgcrypto*" OR message="*encrypt*" OR message="*decrypt*") AND count > threshold

🔗 References

📤 Share & Export