目录
环境搭建
Kioptrix: Level 1.3 (#4) ~ VulnHub
下载这个镜像

但是这个镜像缺少了vmx文件

搭建的时候需要自己创建vmx文件,文件如下
.encoding = "windows-1252"
config.version = "8"
virtualHW.version = "4"
memsize = "512"
MemAllowAutoScaleDown = "FALSE"
displayName = "Kioptrix4_vmware"
guestOS = "other"
ide0:0.present = "TRUE"
ide0:0.fileName = "Kioptrix4_vmware.vmdk"
ide1:0.present = "TRUE"
ide1:0.autodetect = "TRUE"
ide1:0.filename = "auto detect"
ide1:0.deviceType = "cdrom-raw"
extendedConfigFile = "Kioptrix4_vmware.vmxf"
virtualHW.productCompatibility = "hosted"
tools.syncTime = "FALSE"
ethernet0.connectionType = "nat"
ethernet0.addressType = "generated"
ethernet0.present = "TRUE"
vmxstats.filename = "Kioptrix4_vmware.scoreboard"
numa.autosize.cookie = "10001"
numa.autosize.vcpu.maxPerVirtualNode = "1"
uuid.bios = "56 4d 65 0f a1 e6 c4 da-87 32 44 4f 05 2f 49 af"
uuid.location = "56 4d 65 0f a1 e6 c4 da-87 32 44 4f 05 2f 49 af"
ide0:0.redo = ""
svga.vramSize = "134217728"
vmotion.checkpointFBSize = "134217728"
ethernet0.generatedAddress = "00:0c:29:2f:49:af"
ethernet0.generatedAddressOffset = "0"
monitor.phys_bits_used = "36"
cleanShutdown = "TRUE"
softPowerOff = "FALSE"
ide1:0.startConnected = "FALSE"
checkpoint.vmState = ""
(注:外面的vmdk文件名需要与下面配置相同)

直接启动即可
开始渗透
信息收集
扫一下存活主机
老规矩先扫一下存活主机
nmap -sn 192.168.11.0/24
扫描端口
nmap -p- 192.168.11.134

扫一下服务
nmap -sV -A 192.168.11.134

看一下web界面,找一下突破口
这里由一个登陆框,首先尝试了admin和root两个用户名和万能密码,但是报错
再次进行信息收集,扫描目录

扫描出来了一个sql文件,打开看一下,里面有用户名和密码

尝试使用上面找到的用户进行登陆,显示密码或用户名错误,发现报错与使用admin和root用户时报错不同,合理猜测无admin和root用户

然后尝试使用john和万能密码,进入后显示出了用户名和正确密码

|----------|---|--------------|
| Username | : | john |
| Password | : | MyNameIsJohn |
根据提示使用?或者help查看可以使用命令

可以使用的命令

我们可以看到可以使用的命令只有上面显示的那么多,推测他是rbash,我们百度逃逸方式
尝试echo $SHELL,shell会被直接杀掉
然后使用echo os.system("/bin/bash")获取了完整shell

然后尝试sudo提权

提权成功