PJBlog 170版本重要安全補丁(2009-04-22)所有PJ170用戶必須更新此補丁
[重要通告]如您遇疑難雜癥,本站支持知識付費業務,掃右邊二維碼加博主微信,可節省您寶貴時間哦!
4.22補丁:
增加 Checkxss()重要函數。
代碼安全由安全小組測試通過。
升級包請下載后直接覆蓋
'==============================================
'補丁修改方法
'==============================================
Action.asp
request("cname") 改成 Checkxss(request.QueryString("cname"))
request("mainurl") 改成 Checkxss(request.QueryString("mainurl"))
request("main") 改成 Checkxss(request.QueryString("main"))
common/function.asp中增加函數
[code]
'*************************************
'防XSS注入函數 更新于2009-04-21 by evio
'與checkstr()相比, checkxss更加安全
'*************************************
Function Checkxss(byVal ChkStr)
Dim Str
Str = ChkStr
If IsNull(Str) Then
CheckStr = ""
Exit Function
End If
Str = Replace(Str, "&", "&")
Str = Replace(Str, "'", "´")
Str = Replace(Str, """", """)
Str = Replace(Str, "<", "<") Str = Replace(Str, ">", ">")
Str = Replace(Str, "/", "/")
Str = Replace(Str, "*", "*")
Dim re
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern = "(w)(here)"
Str = re.Replace(Str, "$1here")
re.Pattern = "(s)(elect)"
Str = re.Replace(Str, "$1elect")
re.Pattern = "(i)(nsert)"
Str = re.Replace(Str, "$1nsert")
re.Pattern = "(c)(reate)"
Str = re.Replace(Str, "$1reate")
re.Pattern = "(d)(rop)"
Str = re.Replace(Str, "$1rop")
re.Pattern = "(a)(lter)"
Str = re.Replace(Str, "$1lter")
re.Pattern = "(d)(elete)"
Str = re.Replace(Str, "$1elete")
re.Pattern = "(u)(pdate)"
Str = re.Replace(Str, "$1pdate")
re.Pattern = "(\s)(or)"
Str = re.Replace(Str, "$1or")
re.Pattern = "(\n)"
Str = re.Replace(Str, "$1or")
'----------------------------------
re.Pattern = "(java)(script)"
Str = re.Replace(Str, "$1script")
re.Pattern = "(j)(script)"
Str = re.Replace(Str, "$1script")
re.Pattern = "(vb)(script)"
Str = re.Replace(Str, "$1script")
'----------------------------------
If Instr(Str, "expression") > 0 Then
Str = Replace(Str, "expression", "e­xpression", 1, -1, 0) '防止xss注入
End If
Set re = Nothing
Checkxss = Str
End Function
[/code]
class/cls_logAction.asp中找到
[code]
oldcname = request.form("oldcname")
oldcate = request.form("oldcate")
oldctype = request.form("oldtype")
[/code]
改成
[code]
oldcname = Checkxss(request.form("oldcname"))
oldcate = Checkxss(request.form("oldcate"))
oldctype = Checkxss(request.form("oldtype"))
[/code]
GetArticle.asp
blog_postFile = request("blog_postFile") 改成 blog_postFile = Cint(Checkxss(request.QueryString("blog_postFile")))
問題未解決?付費解決問題加Q或微信 2589053300 (即Q號又微信號)右上方掃一掃可加博主微信
所寫所說,是心之所感,思之所悟,行之所得;文當無敷衍,落筆求簡潔。 以所舍,求所獲;有所依,方所成!