CNVD-2019-06255 CatfishCMS远程命令执行-漏洞文库小世界-安全文库-NGC660安全实验室

CNVD-2019-06255 CatfishCMS远程命令执行

CNVD-2019-06255 CatfishCMS远程命令执行

漏洞影响

v4.8.54

复现过程

1、_method=__construct

CatfishCMS基于thinkPHP5开发。

Request类(catfish/library/think/Request.php)用于处理请求。

它的成员函数method用于获取请求的类型。

d4459cb9fd9af6fca40a1fc944fc35dd

application/config.php 中定义了“表单请求类型伪装变量”:

76201a93d805717e1f8857d0b4bffa6e

POST请求参数 “ _method=__construct ”,将__construct 传给了var_method ,在Request类的method函数中执行后,实现了对Request类的 __construct 构造函数的调用;并且将完整的POST参数传给了构造函数。

2、method=*&filter[]=system

catfish/library/think/Request.php模块中的Request类的构造函数:

5ee144a8ccf879643360cd3ccdbcef12

_method=__construct 使得 method 函数调用了 __construct 构造函数, 并且将完整的POST参数传递过去。实现了对本类中的 $method 和 $filter 两个全局变量的覆盖。

508f88bb7eca4c702ab5b03b74dd6a01

a2b95584c58b7260527751edaf0d0496

filter[]=system 的补充说明: filter[]=system 或者 filter=system都可以,[]符号可有可无;system意为执行系统命令。

Method=* 的补充说明:

method参数的取值限定为:catfish/library/think/Route.php 模块中定义的路由规则。如:GET、POST、PUT、* 等任何一个值都可以;如果值不在此表或为空,都会报错。

1201eea6956c215af02f9b7b9ab3520c

3、s=dir

application/config.php 中定义PATHINFO变量名为’ s ’。可用s传入需要执行的命令,如s=dir

最终的的payload:

s=dir&_method=__construct&method=*&filter[]=system

_method=__construct 使得 Request类的method函数调用 __construct 构造函数,并且将完整的payload传递给构造函数;构造函数中对 method 和filter 两个全局变量进行覆盖,method=&filter[]=system ;参数s=dir传入需要执行的系统命令 dir 。

s=echo "shell" >shell.php&filter[]=system&method=*&_method=__construct
请登录后发表评论

    请登录后查看回复内容