成人国产精品久久久网站-国产精品蜜-午夜色播-亚洲经典一区二区三区-性迷宫在线-色资源在线-免费看黄色小视频-男人天堂免费视频-亚洲欧洲精品视频-国产精品超碰-av无遮挡-日韩中文一区二区-亚洲h在线观看-97色伦影院-久久大胆

數據庫被掛馬的ASP處理方法

2012/9/13 13:49:55   閱讀:2909    發布者:2909

第一步:為現有數據庫做好備份。

第二步:

執行如下ASP文件,這樣就可以去掉數據庫當中的JS木馬:
注:conn.asp自己去寫了。

'這里放入JS木馬內容:請記得改為自己數據庫中的JS木馬內容。

 

如果數據庫表很多的話,上面的遍歷數據庫結構未執行完就被IIS給停止了。在這時候可以在

If rstSchema("TABLE_TYPE")="TABLE" Then

當中適當加入k值的范圍,如:

If rstSchema("TABLE_TYPE")="TABLE" k>10 and k<20 Then

這樣的話就一次只操作9個表。

第三步:

根據數據庫JS注入的特性(會包括和http://這樣的字符),
在conn.asp里面放入如下代碼:

Function Cheack_Sqljs()'防止數據庫外鏈JS注入:true為發現外鏈JS注入。
    Dim F_Post,F_Get
    Cheack_Sqljs=False
    If Request.Form<>"" Then'表單提交時的檢測
        For Each F_Post In Request.Form
            If (Instr(LCase(Request.Form(F_Post)),"0 or Instr(LCase(Request.Form(F_Post)),"")<>0) and Instr(LCase(Request.Form(F_Post)),"http://")<>0 Then
                Cheack_Sqljs=True
                Exit For
            End If
        Next
    End If
    If Request.QueryString<>"" Then'QueryString提交時的檢測
        For Each F_Get In Request.QueryString
            If (Instr(LCase(Request.Form(F_Get)),"0 or Instr(LCase(Request.Form(F_Get)),"")<>0) and Instr(LCase(Request.Form(F_Get)),"http://")<>0 Then
                Cheack_Sqljs=True
                Exit For
            End If
        Next
    End If
End Function
Function CheckDataFrom()'檢查提交數據來源:True為數據從站外提交過來的
    CheckDataFrom=True
    server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
    server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
    if mid(server_v1,8,len(server_v2))<>server_v2 then
        CheckDataFrom=False
    end if
End Function
If Cheack_Sqljs or CheckDataFrom Then
   Response.Write " "
   Response.End()
End If