Pgcli is a fast, feature-rich CLI for PostgreSQL. It’s loved for smart autocompletion, syntax highlighting, and speed. But if misconfigured, it can open paths an attacker can abuse. Privilege escalation here means taking a low-permission database user and exploiting gaps to gain higher privileges—often the postgres role itself.
The common vector is unsafe connection setups. When Pgcli stores database credentials in plaintext or connects over unencrypted channels, those credentials can be hijacked. An attacker with shell access can dump saved connections from .pgclirc or environment variables. If those credentials belong to a high-privilege role, escalation is instant.
Another risk is indirect SQL injection. Pgcli passes queries straight to PostgreSQL. If an attacker feeds crafted queries, they can exploit insecure functions, SEARCH_PATH manipulation, or role inheritance. Mismanagement of pg_hba.conf and trust-based authentication rules only make this faster.