CVE-2025-5690

6.5 MEDIUM

📋 TL;DR

PostgreSQL Anonymizer versions 2.0-2.1 contain a data exposure vulnerability where users with masked access can bypass masking rules and read original sensitive data using database cursors or pg_dump's --insert option. This affects organizations using PostgreSQL Anonymizer's dynamic masking feature (not enabled by default) to protect sensitive data like PII, financial records, or healthcare information.

💻 Affected Systems

Products:
  • PostgreSQL Anonymizer
Versions: 2.0 through 2.1
Operating Systems: All platforms running PostgreSQL with Anonymizer extension
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when dynamic masking is enabled (not default). Static masking and other features are unaffected.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers with masked user credentials could extract complete unmasked sensitive datasets, leading to data breaches, regulatory violations, and reputational damage.

🟠

Likely Case

Authorized users with legitimate masked access could accidentally or intentionally bypass masking to view sensitive data they shouldn't see.

🟢

If Mitigated

With proper access controls and monitoring, impact is limited to authorized users who might view some unmasked records before detection.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: HIGH

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires database credentials with masked access and knowledge of cursor operations or pg_dump usage.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.2.1

Vendor Advisory: https://gitlab.com/dalibo/postgresql_anonymizer/-/issues/531

Restart Required: No

Instructions:

1. Backup your database. 2. Connect to PostgreSQL as superuser. 3. Run: ALTER EXTENSION anonymizer UPDATE TO '2.2.1'; 4. Verify update with: SELECT extversion FROM pg_extension WHERE extname='anonymizer';

🔧 Temporary Workarounds

Disable dynamic masking

all

Temporarily disable the vulnerable dynamic masking feature until patching

-- Remove dynamic masking policies
SELECT anon.remove_masks_for_table('schema_name.table_name');
-- Or disable all dynamic masking
SELECT anon.disable_dynamic_masking();

Restrict cursor and pg_dump usage

all

Revoke permissions for masked users to use cursors or pg_dump

-- Revoke cursor usage
REVOKE USAGE ON SCHEMA pg_catalog FROM masked_user;
-- Revoke pg_dump access
REVOKE CONNECT ON DATABASE your_db FROM masked_user;

🧯 If You Can't Patch

  • Disable dynamic masking entirely and use static masking instead
  • Implement strict database activity monitoring for cursor operations and pg_dump usage by masked users

🔍 How to Verify

Check if Vulnerable:

Check if using PostgreSQL Anonymizer 2.0 or 2.1 with dynamic masking enabled: SELECT extversion FROM pg_extension WHERE extname='anonymizer'; and check if dynamic masking policies exist.

Check Version:

SELECT extversion FROM pg_extension WHERE extname='anonymizer';

Verify Fix Applied:

Confirm version is 2.2.1 or higher: SELECT extversion FROM pg_extension WHERE extname='anonymizer'; should return '2.2.1' or higher.

📡 Detection & Monitoring

Log Indicators:

  • Database logs showing DECLARE CURSOR or FETCH operations by masked users
  • pg_dump connections from masked user accounts
  • Unusual data export patterns

Network Indicators:

  • Large data transfers from PostgreSQL to unexpected destinations
  • pg_dump network traffic from unauthorized sources

SIEM Query:

source="postgresql_logs" AND ("DECLARE CURSOR" OR "FETCH") AND user="masked_user"

🔗 References

📤 Share & Export