DBLINK_CONNECT_U(3)
π DBLINK_CONNECT_U β the "yes bestie, ANY auth method" one π
ok so this page lives in the PostgreSQL 18.6 Documentation, section 3 (that's the C library functions girlies, iykyk) β¨
πΈ NAME πΈ
dblink_connect_u β opens a persistent connection to a remote database, insecurely π
π SYNOPSIS π
dblink_connect_u(text connstr) returns text
dblink_connect_u(text connname, text connstr) returns text
π DESCRIPTION π
okay so dblink_connect_u() is literally identical to dblink_connect(), with exactly one difference and it's a big one: it will let non-superusers connect using any authentication method. any. at all. no cap π«Ά
and like⦠bestie, that's why it's giving chaos energy, because:
- If the remote server picks an authentication method that does not involve a password, then impersonation and subsequent escalation of privileges can occur π β because the session will appear to have originated from the user as which the local PostgreSQL server runs.
- And even if the remote server does demand a password, it's possible for the password to be supplied from the server environment, such as a
~/.pgpassfile belonging to the server's user. π³
so yeah, that opens up not only a risk of impersonation, but also the possibility of exposing a password to an untrustworthy remote server. it's giving nightmare fuel fr fr π
therefore,dblink_connect_u()is initially installed with all privileges revoked fromPUBLIC, making it un-callable except by superusers. periodt. π
in some situations it may be appropriate to grant EXECUTE permission for dblink_connect_u() to specific users who are considered trustworthy, but this should be done with care. it is also recommended that any ~/.pgpass file belonging to the server's user not contain any records specifying a wildcard host name. π
for further details see dblink_connect(). π
mwah π that's the whole page, bestie β go read dblink_connect() next, she's the well-behaved sibling.
postgres 18.6, dated 2026, source-version-and-date girlies, slay π¦β¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql18-docs 18.6-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms