數(shù)據(jù)庫被掛馬的ASP處理方法

2022-06-24    分類: 網(wǎng)站建設(shè)

第一步:為現(xiàn)有數(shù)據(jù)庫做好備份。

第二步:

執(zhí)行如下ASP文件,這樣就可以去掉數(shù)據(jù)庫當(dāng)中的JS木馬:
注:conn.asp自己去寫了。

'這里放入JS木馬內(nèi)容:請記得改為自己數(shù)據(jù)庫中的JS木馬內(nèi)容。


如果數(shù)據(jù)庫表很多的話,上面的遍歷數(shù)據(jù)庫結(jié)構(gòu)未執(zhí)行完就被IIS給停止了。在這時候可以在

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

當(dāng)中適當(dāng)加入k值的范圍,如:

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

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

第三步:

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

Function Cheack_Sqljs()'防止數(shù)據(jù)庫外鏈JS注入:true為發(fā)現(xiàn)外鏈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()'檢查提交數(shù)據(jù)來源:True為數(shù)據(jù)從站外提交過來的
    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

名稱欄目:數(shù)據(jù)庫被掛馬的ASP處理方法
標(biāo)題URL:http://www.muchs.cn/news36/170986.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄網(wǎng)站改版、動態(tài)網(wǎng)站、網(wǎng)站排名手機網(wǎng)站建設(shè)、全網(wǎng)營銷推廣

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計