doccms2016sql注入漏洞
doccms网站存在/content/search/index.php目录页面
代码审计
<?php
//首页搜索,站内关键字搜索
function index()
{
global $db;
global $request;
global $params;
global $tag; // 标签数组
!checkSqlStr($request['keyword'])? $request['keyword'] = $request['keyword'] : exit('非法字符');
$keyword = urldecode($request['keyword']);
对参数keyword进行非法字符检测
function checkSqlStr($string)
{
$string = strtolower($string);
return preg_match('/select|insert|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile|_user/i', $string);
}
进一步到checkSqlStr函数,在/inc/function.php中
checkSqlStr函数对传入的字符串进行正则匹配,检测是否函数非法字符。
继续看在/content/search/index.php中的get_search_result函数:
对参数keyword进行url解码,然后拼接到SQL语句中执行。
如果传入的是双重url编码的字符串,就可以绕过非法字符检测,
然后经urldecode解码,带入数据库中执行,导致SQL注入漏洞存在。
switch语句结构包含了各类查询
so:
访问/content/search/index.php页面
利用keyword参数传入二次url编码的sql恶意语句即可
之后渗透并未结束,仅仅只是开始
后台getshell