@@ -35,6 +35,7 @@ def __init__(self):
35
35
self .taint_link_size = 0
36
36
self .edge_code = 1
37
37
self .taint_value = ''
38
+ self .vul_type = None
38
39
39
40
@property
40
41
def method_pool (self ):
@@ -103,7 +104,8 @@ def method_pool_signatures(self):
103
104
signatures .add (f"{ method .get ('className' ).replace ('/' , '.' )} .{ method .get ('methodName' )} " )
104
105
return signatures
105
106
106
- def search (self , method_pool , vul_method_signature ):
107
+ def search (self , method_pool , vul_method_signature , vul_type = None ):
108
+ self .vul_type = vul_type
107
109
self .prepare (method_pool , vul_method_signature )
108
110
size = len (self .method_pool )
109
111
for index in range (size ):
@@ -122,6 +124,35 @@ def search(self, method_pool, vul_method_signature):
122
124
logger .info (f'==> current taint hash: { self .pool_value } ' )
123
125
if self .loop (index , size , current_link ):
124
126
break
127
+ self .vul_filter ()
128
+
129
+ def vul_filter (self ):
130
+ # 分析是否存在过滤条件,排除误报
131
+ # 根据漏洞类型,查询filter方法
132
+ # 检查vul_
133
+ if self .vul_source_signature :
134
+ # mark there has a vul
135
+ # if vul_type has filter, do escape
136
+ stack_count = len (self .vul_stack )
137
+ for index in range (0 , stack_count ):
138
+ stack = self .vul_stack [index ]
139
+ for item in stack :
140
+ if 'java.net.URL.<init>' == item ["signature" ]:
141
+ url = item ['sourceValues' ]
142
+ origin_source = stack [0 ]['targetValues' ]
143
+ from urllib .parse import urlparse
144
+ o = urlparse (url )
145
+ if origin_source not in f'{ o .scheme } ://{ o .netloc } { o .path } ' :
146
+ print (origin_source , url )
147
+ self .vul_stack [index ] = []
148
+ break
149
+ vul_source_signature = self .vul_source_signature
150
+ self .vul_source_signature = None
151
+ for index in range (0 , stack_count ):
152
+ if self .vul_stack [index ]:
153
+ self .vul_source_signature = vul_source_signature
154
+ else :
155
+ continue
125
156
126
157
@staticmethod
127
158
def copy_method (method_detail , sink = False , source = False , propagator = False , filter = False ):
0 commit comments