/为什么最新一直被走小厂商? 累觉不爱。/ 本来还以为能够直接前台getshell的。 能直接把代码写入文件。 但是最后也都败给了转义符。 还是来注入把。
0x01 失败的Getshell。 \app\mail\action\admin\do.php 访问这里 无需登录。
$arrData = array(
'appname' => trim($_POST['appname']),
'appdesc' => trim($_POST['appdesc']),
'isenable' => trim($_POST['isenable']),
'mailhost' => trim($_POST['mailhost']),
'mailport' => trim($_POST['mailport']),
'mailuser' => trim($_POST['mailuser']),
'mailpwd' => trim($_POST['mailpwd']),
);
foreach ($arrData as $key => $val){
$db->query("UPDATE ".dbprefix."mail_options SET optionvalue='$val' where optionname='$key'");
}
//更新缓存
$arrOptions = $db->fetch_all_assoc("select optionname,optionvalue from ".dbprefix."mail_options");
foreach($arrOptions as $item){
$arrOption[$item['optionname']] = $item['optionvalue'];
}
fileWrite('mail_options.php','data',$arrOption);
$tsMySqlCache->set('mail_options',$arrOption);
qiMsg("邮件配置更新成功,并重置了缓存文件^_^");
很多可控 但是在query执行语句的时候 单引号会被转义。 再继续看看。 然后就带入了filewrite
function fileWrite($file, $dir, $data, $isphp = 1) {
global $TS_CF, $TS_MC;
$dfile = $dir . '/' . $file;
// 支持memcache
if ($TS_CF ['memcache'] && extension_loaded ( 'memcache' )) {
$TS_MC->delete ( md5 ( $dfile ) );
$TS_MC->set ( md5 ( $dfile ), $data, 0, 172800 );
}
$a = var_export ($data, false);
// 同时保存文件
! is_dir ( $dir ) ? mkdir ( $dir, 0777 ) : '';
if (is_file ( $dfile ))
unlink ( $dfile );
if ($isphp == 1) {
$data = "<?php\ndefined('IN_TS') or die('Access Denied.');\nreturn " . var_export ( $data, true ) . ";";
}
file_put_contents ( $dfile, $data );
return true;
直接写到php文件里面里。 $dfile 不可控 但是是一个php文件 $data可控。 在var_export 之前输出$data Array ( [appname] => a' [appdesc] => [isenable] => [mailhost] => [mailport] => [mailuser] => [mailpwd] => ) 可以看到是没有转义的。 但是在经过var_export后 跟var_dump差不多 不同就是就是他会把这个弄成php格式。 也把a'转义了。 至此 Getshell 无望。 mail options.php文件中
<?php
defined('IN_TS') or die('Access Denied.');
return array (
'appname' => 'a\'',
'appdesc' => '',
'isenable' => '',
'mailhost' => '',
'mailport' => '',
'mailuser' => '',
'mailpwd' => '',
);
0x02 注入。 还是这个文件。 虽然进入query的转义了 但是还有其他的查询。
[](https://images.seebug.org/upload/201402/212135484fe95a3535cf1e3c05489ee54788c604.jpg)
暂无临时解决方案
暂无官方解决方案
暂无防护方案
※本站提供的任何内容、代码与服务仅供学习,请勿用于非法用途,否则后果自负
暂无评论