// HackTricks · Web Pentesting

PostgreSQL dblink and loimport Data Exfiltration

PostgreSQL dblink and lo_import Data Exfiltration

In the documented challenge, PostgreSQL’s lo_import function loads a server-side file as a large object and returns its object identifier (OID). When direct access to the imported object’s contents is unavailable, the OID is embedded in a dblink_connect connection string and sent to an attacker-controlled PostgreSQL endpoint as an out-of-band exfiltration channel. This technique requires the relevant function privileges, the dblink extension, and outbound network access from the database server.[1]

The complete challenge solution also explains how to validate each prerequisite and capture the resulting connection.[1]

References

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.