--- title: "PostgreSQL dblink and loimport Data Exfiltration" section: "Web Pentesting" sectionSlug: "pentesting-web" sourcePath: "src/pentesting-web/sql-injection/postgresql-injection/dblink-lo_import-data-exfiltration.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/pentesting-web/sql-injection/postgresql-injection/dblink-lo_import-data-exfiltration.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0" --- # 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]](#references) The complete challenge solution also explains how to validate each prerequisite and capture the resulting connection.[[1]](#references) ## References - [1] [PDKT-Team - FBCTF 2019 hr_admin_module writeup](https://github.com/PDKT-Team/ctf/blob/master/fbctf2019/hr-admin-module/README.md)