Back to services
database5432/tcp

PostgreSQL

PostgreSQLPostgresPG

PostgreSQL is an advanced open-source database. Weak passwords, exposed trust authentication, and RCE via COPY statement are common vectors.

Ports

PortProtocolDescription
5432tcpPostgreSQL

Fingerprints

Banner / ProbeExpected Response
nmap -sV -p <port> <target>Service banner and version info
nc -nv <target> <port>Raw banner grab

Key Files

PathDescription
/etc/mysql/mysql.cnfMySQL client configuration
/var/lib/mysql/mysql/user.MYDMySQL user table data
postgresql.confPostgreSQL configuration file
pg_hba.confPostgreSQL client authentication rules
mongod.confMongoDB daemon configuration

Default Credentials

UsernamePasswordContext
postgrespostgresDefault superuser

Known CVEs

IdentifierTypeDescription
Authtrust authentication misconfiguration

Exploitation Primitives

TechniqueTool / CommandResult
Read File (superuser)SELECT pg_read_file('/etc/passwd');Read server files
COPY RCECOPY (select 'rev') TO PROGRAM 'id';RCE via COPY TO PROGRAM

Notes

Always start with full port scan: `nmap -sV -sC -p- <target>`.

Check for default credentials before brute-forcing.

Use service-specific NSE scripts: `nmap --script <service>-* -p <port> <target>`.

Remember to check both IPv4 and IPv6 if applicable.

Seen on

ShodanCensysFOFAZoomEye

References