sql过滤优化增加|sleep|union|load_file函数的过滤
This commit is contained in:
@@ -263,7 +263,7 @@ public class EncodeUtils {
|
|||||||
// 预编译SQL过滤正则表达式
|
// 预编译SQL过滤正则表达式
|
||||||
private static Pattern sqlPattern = Pattern.compile(
|
private static Pattern sqlPattern = Pattern.compile(
|
||||||
"(?:')|(?:--)|(/\\*(?:.|[\\n\\r])*?\\*/)|((extractvalue|updatexml)([\\s]*?)\\()|"
|
"(?:')|(?:--)|(/\\*(?:.|[\\n\\r])*?\\*/)|((extractvalue|updatexml)([\\s]*?)\\()|"
|
||||||
+ "(\\b(select|update|and|or|delete|insert|trancate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute|case when)\\b)",
|
+ "(\\b(select|update|and|or|delete|insert|trancate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute|case when|sleep|union|load_file)\\b)",
|
||||||
Pattern.CASE_INSENSITIVE);
|
Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -286,8 +286,8 @@ public class EncodeUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// int i = 0;
|
int i = 0;
|
||||||
// xssFilter((++i)+"你好,<script>alert(document.cookie)</script>我还在。");
|
// xssFilter((++i)+"你好,<script>alert(document.cookie)</script>我还在。");
|
||||||
// xssFilter((++i)+"你好,<strong>加粗文字</strong>我还在。");
|
// xssFilter((++i)+"你好,<strong>加粗文字</strong>我还在。");
|
||||||
// xssFilter("<!--HTML-->"+(++i)+"你好,\"><strong>加粗文字</strong>我还在。");
|
// xssFilter("<!--HTML-->"+(++i)+"你好,\"><strong>加粗文字</strong>我还在。");
|
||||||
@@ -313,10 +313,11 @@ public class EncodeUtils {
|
|||||||
// xssFilter("<!--HTML-->"+(++i)+"你好,<a href='javascript:alert(\"abc\");'>hello</a>我还在。");
|
// xssFilter("<!--HTML-->"+(++i)+"你好,<a href='javascript:alert(\"abc\");'>hello</a>我还在。");
|
||||||
// xssFilter("<!--HTML-->"+(++i)+"你好,?abc=def&hello=123&world={\"a\":1}我还在。");
|
// xssFilter("<!--HTML-->"+(++i)+"你好,?abc=def&hello=123&world={\"a\":1}我还在。");
|
||||||
// xssFilter("<!--HTML-->"+(++i)+"你好,?abc=def&hello=123&world={'a':1}我还在。");
|
// xssFilter("<!--HTML-->"+(++i)+"你好,?abc=def&hello=123&world={'a':1}我还在。");
|
||||||
// sqlFilter((++i)+"你好,select * from xxx where abc=def and 1=1我还在。");
|
sqlFilter((++i)+"你好,select * from xxx where abc=def and 1=1我还在。");
|
||||||
// sqlFilter((++i)+"你好,insert into xxx values(1,2,3,4,5)我还在。");
|
sqlFilter((++i)+"你好,insert into xxx values(1,2,3,4,5)我还在。");
|
||||||
// sqlFilter((++i)+"你好,delete from xxx我还在。");
|
sqlFilter((++i)+"你好,delete from xxx我还在。");
|
||||||
// sqlFilter((++i)+"a.audit_result asc,case when 1 like case when length(database())=6 then 1 else exp(11111111111111111) end then 1 else 1/0 end");
|
sqlFilter((++i)+"你好,a.audit_result asc,case when 1 like case when length(database())=6 then 1 else exp(11111111111111111) end then 1 else 1/0 end");
|
||||||
// }
|
sqlFilter((++i)+"你好,if(1=2,1,SLEEP(10))");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user