1 頁 (共 1 頁)

[建議]官方公佈bbcode漏洞(2.0.4版以後的請注意)

發表於 : 2003-09-13 13:04
zeushuan
原文出處
http://www.phpbb.com/news.php?id=23
http://www.phpbb.com/phpBB/viewtopic.php?t=135116
--------------------------------
我大約翻一下...
----------------------
phpBB小組最近發現近來新的phpBB版本有個嚴重的漏洞,
允許bbcode tag(像是)可以使用xss 影響的版本包括2.0.4、2.0.5、2.0.6 如果你 ... .phpbb.com code..
$patterns[] = "#\[url\]([\w]+?://.*?[^ \"

\t<]*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url1'];

// www.phpbb.com code.. (no xxxx:// prefix).
$patterns[] = "#\[url\]((www|ftp)\.([\w\-]+\.)*?[\w\-]+\.[a-z]{2,4}(:?[0-9]*?/[^ \"

\t<]*)?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url2'];

// [url=xxxx://www.phpbb.com]phpBB[/url] code..
$patterns[] = "#\+?://.*?[^ \"

\t<]*?)\](.*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url3'];

// [url=www.phpbb.com]phpBB
code.. (no xxxx:// prefix).
$patterns[] = "#\+\.)*?[\w\-]+\.[a-z]{2,4}(:?[0-9]*?/[^ \"

\t<]*)?)\](.*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url4'];[/code]

--取代為--

代碼: 選擇全部

// matches a [url]xxxx://www.phpbb.com[/url] code.. 
   $patterns[] = "#\[url\]([\w]+?://[^ \"

\t<]*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url1']; 

   // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). 
   $patterns[] = "#\[url\]((www|ftp)\.[^ \"

\t<]*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url2']; 

   // [url=xxxx://www.phpbb.com]phpBB[/url] code.. 
   $patterns[] = "#\[url=([\w]+?://[^ \"

\t<]*?)\](.*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url3']; 

   // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix). 
   $patterns[] = "#\[url=((www|ftp)\.[^ \"

\t<]*?)\](.*?)\[/url\]#is"; 
   $replacements[] = $bbcode_tpl['url4'];
--尋找--

代碼: 選擇全部

// matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
   // xxxx can only be alpha characters. 
   // yyyy is anything up to the first space, newline, comma, double quote or < 
   $ret = preg_replace("#(^|[
 ])([\w]+?://.*?[^ \"

\t<]*)#is", "\\\1<a href=\"\\\2\" target=\"_blank\">\\\2</a>", $ret); 

   // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
   // Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
   // zzzz is optional.. will contain everything up to the first space, newline, 
   // comma, double quote or <. 
   $ret = preg_replace("#(^|[
 ])((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^ \"\t

<]*)?)#is", "\\\1<a href=\"http://\\\2\" target=\"_blank\">\\\2</a>", $ret);
--取代為--

代碼: 選擇全部

//matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
   // xxxx can only be alpha characters. 
   // yyyy is anything up to the first space, newline, comma, double quote or < 
   $ret = preg_replace("#(^|[
 ])([\w]+?://[^ \"

\t<]*)#is", "\\\1<a href=\"\\\2\" target=\"_blank\">\\\2</a>", $ret); 

   // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
   // Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
   // zzzz is optional.. will contain everything up to the first space, newline, 
   // comma, double quote or <. 
   $ret = preg_replace("#(^|[
 ])((www|ftp)\.[^ \"\t

<]*)#is", "\\\1<a href=\"http://\\\2\" target=\"_blank\">\\\2</a>", $ret);
@@b後面還有好長一串說明...
有興趣的人自己再去看吧

發表於 : 2003-09-13 15:01
Mowd
xss是什麼?
我只知道有人嘗試在我的mowdBB留言版用<xmp>標籤來破壞我的版面,但沒有成功...

發表於 : 2003-09-13 15:40
zeushuan
<xmp>..我記得我在檔免費空間廣告的時候有用到\r
放在<body>前面,好像可以使<body>裡的html語法顯示不出來

不過...xss..好像跟這個沒關係耶...

發表於 : 2003-09-13 16:04
Martinet
幫你註明一下....
要改的檔案 : includes/bbcode.php

不然很多新手就不知道啦

發表於 : 2003-09-15 23:44
j433463
XSS 是指一個跨網站指令碼Cross Site Scripting, 可以參考

http://www.microsoft.com/taiwan/securit ... 03-028.asp

內的常見問題集, 有一些簡單的說明.

也就是說, 要是沒有作修正, 別人可以利用 bbcode 的 URL 標籤, 在其 = 後面加一些語法參數來抓取 cookie 資料, 後果就可能很糟了.

發表於 : 2003-09-16 04:59
Artemas
怪了..我除了有第一段能改以外
後面二段不一樣ㄝ..那到底要不要改 :-o

代碼: 選擇全部

	// [url]xxxx://www.phpbb.com[/url] code..
	$patterns[] = "#\[url\]([a-z0-9]+?://){1}([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"

\t<]*)?)\[/url\]#is";
	$replacements[] = $bbcode_tpl['url1'];

	// [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
	$patterns[] = "#\[url\]((www|ftp)\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"

\t<]*?)?)\[/url\]#si";
	$replacements[] = $bbcode_tpl['url2'];

	// [url=xxxx://www.phpbb.com]phpBB[/url] code..
	$patterns[] = "#\[url=([a-z0-9]+://)([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"
\
\t<]*?)?)\](.*?)\[/url\]#si";
	$replacements[] = $bbcode_tpl['url3'];

	// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
	$patterns[] = "#\[url=(([\w\-]+\.)*?[\w]+(:[0-9]+)?(/[^ \"

\t<]*)?)\](.*?)\[/url\]#si";
	$replacements[] = $bbcode_tpl['url4'];

代碼: 選擇全部

	// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
	// xxxx can only be alpha characters.
	// yyyy is anything up to the first space, newline, comma, double quote or <
	$ret = preg_replace("#([\t
 ])([a-z0-9]+?){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"

\t<]*)?)#i", '\1<a href="\2://\3" target="_blank">\2://\3</a>', $ret);

	// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
	// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
	// zzzz is optional.. will contain everything up to the first space, newline, 
	// comma, double quote or <.
	$ret = preg_replace("#([\t
 ])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"

\t<]*)?)#i", '\1<a href="http://\2.\3" target="_blank">\2.\3</a>', $ret);

[問題]我也是啊???

發表於 : 2003-09-27 18:52
mdtt999
我是用的CNPHPBB的204版本,也只有第一段相同,后两段不一样,不知道需要修改吗???

该如何修改???

Re: [問題]我也是啊???

發表於 : 2003-09-27 21:03
動感超人
mdtt999 寫:我是用的CNPHPBB的204版本,也只有第一段相同,后两段不一样,不知道需要修改吗???

该如何修改???
竹貓這邊只支援官方釋出的版本喔!因為大多數人還是使用官方版本的。
如果您使用CNPHPBB應該到他們的支持論壇發問。

發表於 : 2003-10-31 13:29
io_oi
我是使用2.0.4
9月底於phpbb官網某鏡射下載處下載的
我比對需要修改的這三大段都很不一樣.....

發表於 : 2003-11-21 06:33
a_yu
Artemas 寫:怪了..我除了有第一段能改以外
後面二段不一樣ㄝ..那到底要不要改 :-o
後兩段一開頭的內容被自動判定成超連結了,所以看起來會有點不同(原本URL被自動隱藏了),其實是一樣的。不知這樣您明白嗎?

發表於 : 2003-11-21 07:19
Artemas
那那那...到底是改還是不改勒.... :roll:

發表於 : 2003-12-01 21:48
Sirius Black
還好我是用Mac的...好像不會有影響

發表於 : 2003-12-17 03:01
PCHANG
請教!
我是使用主機商所內製主機就有套裝(phpBB2.06)
現已掛上貴站提供中文語系包(2003/10/下載的)
是否也會有此種問題?
謝謝指導!