第 1 頁 (共 3 頁)
[外掛] 虛擬股市錯誤,兩項修正!
發表於 : 2005-09-19 21:10
由 w2812451
哈摟!X版的作者~
我發現當我們直接執行
sm_volume.php
會直接發生錯誤,
這樣很容易被攻擊
我說明一下好了
如果我今天在我的論壇,看了一家公司的資料
http://bnb.twbbs.org/sm_volume.php?id=1
可是當我把?id=1(id=1的這家公司去除,變成直接瀏覽)
http://bnb.twbbs.org/sm_volume.php
發生錯誤了@@
這很正常,因為並沒有這家公司的ID!
這應該沒什麼好錯的,可是下面有一句\r
代碼: 選擇全部
你可以使用 225000 元來收購這間公司 (已計算 10 手續費,不足一角以整元算),如果你成功收購這一間公司,你就可以對這間公司進行董事長的動作,就是說你就是這間公司的董事長。
如果我哪一天,會員誤闖了,他買了這家公司?
你知道會怎麼樣嗎?
錢花了!沒看到公司耶~
錢白花了~
我是想說
利用根檢閱個人資料一樣的功能\r
當我們直接執行profile.php
會直接跳回首頁
在虛擬股市也做一樣的規定!
這樣就可以防止(會員白花錢,防止被攻擊~)
發表於 : 2005-09-19 22:00
由 小竹子
請直接聯絡開發者好嗎?
發表於 : 2005-09-19 22:05
由 chsa
這外掛版權有點亂說~
啥沒 X 標誌的是藍天做的
不過最近推出了啥 X 修正板 (笑~ 作者好像是 *tystim*?
發表於 : 2005-09-19 22:31
由 233062306
你是在sql刪除公司嗎???
我用sql刪除...
什麼事也沒有= =.......
我是在volume加了符號bug的語法....
而其他的就是t大了....
我想想辦法找t大^^
發表於 : 2005-09-20 17:01
由 御津闇慈
我覺得要找源頭還比較好吧\r
不過寫的還真是一堆怪異\r
看看有控要不要改~
發表於 : 2005-09-20 18:53
由 w2812451
針對這個方法,自己做了解決了!
如果是Stock Market的使用者,請作以下修正!
開啟
搜尋
代碼: 選擇全部
//
// End session management
//
在之後加入\r
代碼: 選擇全部
if ( $id == 0 )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
修正結束
發表於 : 2005-09-20 19:23
由 ~倉木麻衣~
w2812451 寫:針對這個方法,自己做了解決了!
在之後加入\r
代碼: 選擇全部
if ( $id == 0 )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
修正結束
這樣子還是會有問題的
因為這種寫法只能預防id值為0、空白或是沒指定id, 但卻無法預防使用者代入負數的數值\r
ex:
http://bnb.twbbs.org/sm_volume.php?id=-1
發表於 : 2005-09-20 19:38
由 w2812451
ˊˋ頭大了~
找方法中.........
預防負數很簡單啦\r
if ( $id <= 0 )
可是還有其它亂數都還無法防止
像是\r
http://bnb.twbbs.org/sm_volume.php?id=2
發表於 : 2005-09-20 19:43
由 *tytsim*
~倉木麻衣~ 寫:w2812451 寫:針對這個方法,自己做了解決了!
在之後加入\r
代碼: 選擇全部
if ( $id == 0 )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
修正結束
這樣子還是會有問題的
因為這種寫法只能預防id值為0、空白或是沒指定id, 但卻無法預防使用者代入負數的數值\r
ex:
http://bnb.twbbs.org/sm_volume.php?id=-1
應該是:
#
#-----[ 找尋 ]-----
#
$view_company = intval($HTTP_GET_VARS['id']);
$id = $view_company;
#
#-----[ 改做 ]-----
#
if ( isset($HTTP_GET_VARS['id']) || isset($HTTP_POST_VARS['id']) )
{
$view_company = intval($HTTP_GET_VARS['id']);
$id = $view_company;
}else{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
發表於 : 2005-09-20 19:49
由 w2812451
更慘了!沒有用處
發表於 : 2005-09-20 19:53
由 *tytsim*
w2812451 寫:更慘了!沒有用處
這樣用:
#
#-----[ FIND ]-----
#
$template->assign_vars(array(
'L_COMPANY_VOLUME' => $lang['SM_Company_info'],
#
#-----[ BEFOR,ADD ]-----
#
if($company_row['company_id'] >< "")
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
發表於 : 2005-09-20 20:04
由 w2812451
*tytsim* 寫:if($company_row['company_id'] >< "")
還真的很>< ""
Parse error: parse error in c:\appserv\www\sm_volume.php on line 821
嘿嘿ˊˋ
發表於 : 2005-09-20 20:08
由 *tytsim*
w2812451 寫:*tytsim* 寫:if($company_row['company_id'] >< "")
還真的很>< ""
Parse error: parse error in c:\appserv\www\sm_volume.php on line 821
嘿嘿ˊˋ
是\r
"<>"
不是\r
"><"
=w=
>.<
很亂
><
發表於 : 2005-09-20 20:13
由 w2812451
可否完整的說一遍?
代碼: 選擇全部
if( $company_row['company_id'] "<>" )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
ERROR
代碼: 選擇全部
if( $company_row['company_id'] "^^" )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
ERROR
代碼: 選擇全部
if( $company_row['company_id'] "><" )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
ERROR
看無ˊˋ
發表於 : 2005-09-20 20:40
由 ~倉木麻衣~
#
#--------[ OPEN ]----------------
#
#
#--------[ FIND ]----------------
#
代碼: 選擇全部
$company_row = $db->sql_fetchrow($result);
#
#--------[ REPLACE WITH ]----------------
#
代碼: 選擇全部
if (!($company_row = $db->sql_fetchrow($result)))
{
message_die(GENERAL_ERROR, 'invalid company_id');
}
#
#--------[ SAVE/CLOSE FILE ]----------------
#
# EoM
這裡的作法是直接結束程式並show出錯誤訊息\r
你也可以自己改成重新導向轉回首頁