Rapid7’s 2026 Global Cybersecurity Summit is now available on-demand.Watch sessions.
Rapid7

module

PostgreSQL for Microsoft Windows Payload Execution

Disclosed
Apr 10, 2009
Created
May 30, 2018

Description

On default Microsoft Windows installations of PostgreSQL the postgres
service account may write to the current directory (which is usually
"C:\Program Files\PostgreSQL\\data" where is the
major.minor version of PostgreSQL). UDF DLL's may be sourced from
there as well.

This module uploads a Windows DLL file via the pg_largeobject method
of binary injection and creates a UDF (user defined function) from
that DLL. Because the payload is run from DllMain, it does not need to
conform to specific Postgres API versions.

Authors

Bernardo Damele A. G. [email protected]
todb [email protected]

Platform

Windows

Architectures

x86, x64

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':


msf > use exploit/windows/postgres/postgres_payload
msf exploit(postgres_payload) > show targets
...targets...
msf exploit(postgres_payload) > set TARGET < target-id >
msf exploit(postgres_payload) > show options
...show and set options...
msf exploit(postgres_payload) > exploit

Title
Rapid7 Labs

2026 Global Threat Landscape Report

The predictive window has collapsed. Exploitation follows disclosure in days. See how attackers are accelerating and how to stay ahead.