Wolves Security Team

Unfortunately no one can be told what W.S.T is - you have to see it for yourself.

You are not logged in.

Announcement

欢迎cnryan同学加入狼族:-)

Follow Wolves Security Team Official Google Buzz!

#1 2009-07-25 15:45:51

jackal
Moderator
Registered: 2008-10-05
Posts: 15

Bypass Magic Quote&Xss?

BY Jackal
http://www.wolvez.org
http://www.delover.net
2009-07-25

在此感谢下黑病毒:)

看跨站的时候出现的一段代码:

demo.php

<?php

$message=$_GET['c'];
echo "<ul><li>".$message."</li>";
if(strpos($message, '[/c]') !== FALSE) {
    $message1 = preg_replace("/\[c](.+?)\[\/c\]/is", "\\1", $message);
}

echo "<li>".$message1."</li>";

if(strpos($message, '[/c]') !== FALSE) {
    $message2 = preg_replace("/\[c](.+?)\[\/c\]/ies", "parse_c('\\1')", $message);
}


echo "<li>".$message2."</li></ul>";

function parse_c($text) {
        return $text;
}

?>

提交:demo.php?c=[c]test"[/c]
开启Magic的情况下:

返回数据:

  1. [c]test\"[/c]

  2. test\"

  3. test\\"

最后一个出现了问题.


再来就是跨站了:

<a href=\\"http://delover.net onmouseover=alert(/xss/) \\">Xss</a>
<a href=\"http://delover.net onmouseover=alert(/xss/) \">Xss</a>

用UBB这玩意很容易出现问题.

Offline

#2 2009-07-25 19:31:10

jackal
Moderator
Registered: 2008-10-05
Posts: 15

Re: Bypass Magic Quote&Xss?

沙发我坐着先

Last edited by jackal (2009-07-25 19:43:49)

Offline

#3 2009-07-25 21:36:37

puret_t
Administrator
Registered: 2008-10-05
Posts: 86

Re: Bypass Magic Quote&Xss?

http://www.80vul.com/pch/pch-003.txt

可以看下里面关于preg_replace()的部分,就可以清楚产生这个问题的原因了

Offline

Board footer

Powered by FluxBB