Executive brief
PostgreSQL Anonymizer is a tool used to mask sensitive data in databases for privacy compliance. A security flaw allows a user to hide malicious commands inside a specially crafted JSON configuration file. If a database administrator or an automated high-privilege process imports this file, the hidden commands will execute with full administrative (superuser) privileges, potentially leading to a total takeover of the database server.
Technical details
A SQL injection vulnerability (CWE-89) exists in the 'anon.import_database_rules' and 'anon.import_roles_rules' functions of the PostgreSQL Anonymizer extension. The root cause is the improper interpolation of untrusted strings from JSON input into dollar-quoted SQL literals when building 'SECURITY LABEL' statements. An attacker can craft a JSON document that closes the dollar-quoted string and appends arbitrary SQL commands. While the functions are 'SECURITY INVOKER', the vulnerability results in privilege escalation if a superuser or a privileged automation script processes the malicious JSON. The issue is fixed in version 3.1.1.
Affected products
- Dalibo PostgreSQL Anonymizer versions prior to 3.1.1
Timeline
- 2026-06-11: disclosed
- 2026-06-11: advisory