Port 5432/tcp: PostgreSQL
Category: Databases. Range: registered. Status: iana registered.
What runs here
The IANA-registered default port for the PostgreSQL database server's connection listener, carrying PostgreSQL's own frontend/backend wire protocol. The port choice dates back to the original Berkeley POSTGRES project and has stayed the de facto standard through every subsequent PostgreSQL release.
Why it matters
An exposed 5432 is routinely scanned for weak or trust-based authentication (pg_hba.conf misconfigured to trust connections it shouldn't), and a compromised superuser session can reach the OS via features like COPY ... TO/FROM PROGRAM, making database access a direct path to remote code execution. Cloud-hosted PostgreSQL instances left open with default/no passwords have been targeted in the same opportunistic ransom-wipe campaigns that hit other exposed databases.
Where you see it
Legitimately: application connection pools, logical/streaming replication between primary and standby servers, and admin tools (psql, pgAdmin). Anomalously/maliciously: authentication attempts against default accounts (e.g. postgres) from unfamiliar hosts, or a session invoking COPY ... TO/FROM PROGRAM shortly after login.
What to look for
| Signal | What it means |
|---|---|
| COPY ... PROGRAM usage | The COPY command's PROGRAM option executes an arbitrary shell command on the server: its use by a session is a strong pivot point from database access to OS command execution. |
| pg_hba.conf trust/md5 exposure | A pg_hba.conf entry trusting a broad network range, or still using the weaker legacy md5 auth method for internet-facing connections, is worth confirming during triage of any suspected compromise. |