@@ -869,7 +869,7 @@ def processHttpMessage(self, _, messageIsRequest, base_request_response):
869
869
870
870
# As the matcher was now triggered, we can remove it as it should not trigger again,
871
871
# because every attack defines its own matcher
872
- self.dl_matchers.remove (url, matcher)
872
+ self.dl_matchers.remove_reported (url, matcher)
873
873
874
874
# At maximum there will be 1 scan issue per message, as it is unlikely that there is more than 1
875
875
# download in a HTTP message. Therefore we can use "return" after adding a scan issue.
@@ -4123,7 +4123,9 @@ def _send_sleep_based(self, injector, basename, content, types, sleep_time, issu
4123
4123
resp = self._make_http_request(injector, req, throttle=False)
4124
4124
if resp and time.time() - start > timeout_detection_time:
4125
4125
# found a timeout, let's confirm with a changed request so it doesn't get a cached response
4126
- print "TIMEOUT DETECTED! Now checking if really a timeout or just a random timeout"
4126
+ print "TIMEOUT DETECTED! Now checking if really a timeout or just a random timeout. " \
4127
+ "Request leading to first timeout was:"
4128
+ print repr(req)
4127
4129
if randomize:
4128
4130
number = str(i) + ''.join(random.sample(string.ascii_letters, 3))
4129
4131
else:
@@ -4146,6 +4148,8 @@ def _send_sleep_based(self, injector, basename, content, types, sleep_time, issu
4146
4148
self._add_scan_issue(csi)
4147
4149
# Returning here is an option, but actually knowing all different kind of injections is nicer
4148
4150
# return
4151
+ else:
4152
+ print "Unfortunately, this seems to be a false positive... not reporting"
4149
4153
4150
4154
def _create_issue_template(self, base_request_response, name, detail, confidence, severity):
4151
4155
service = base_request_response.getHttpService()
@@ -6839,10 +6843,16 @@ def _create_globals(self):
6839
6843
dl_matcher = DownloadMatcher(issue, filecontent="tEXtdate:create")
6840
6844
self._global_matchers.add(dl_matcher)
6841
6845
6842
- def with_global(self, matchers):
6846
+ def with_global(self, name, matchers):
6843
6847
g = set()
6844
6848
g.update(matchers)
6845
- g.update(self._global_matchers)
6849
+ for m in self._global_matchers:
6850
+ if not name in m.reported_for:
6851
+ for alt_name in self._scope_mapping[name]:
6852
+ if alt_name in m.reported_for:
6853
+ break
6854
+ else:
6855
+ g.add(m)
6846
6856
return g
6847
6857
6848
6858
def add_scope(self, brr_url, url):
@@ -6865,12 +6875,12 @@ def get_matchers_for_url(self, url):
6865
6875
with self._thread_lock:
6866
6876
if hostport in self._collection:
6867
6877
# print "Found DownloadMatchers", hostport, "that correspond to", url
6868
- return self.with_global(self._collection[hostport])
6878
+ return self.with_global(hostport, self._collection[hostport])
6869
6879
6870
6880
name = self.get_scope(hostport)
6871
6881
if name:
6872
6882
# print "Found DownloadMatchers for", name, "that can be used for", url
6873
- return self.with_global(self._collection[name])
6883
+ return self.with_global(name, self._collection[name])
6874
6884
return []
6875
6885
6876
6886
def get_scope(self, hostport):
@@ -6879,17 +6889,22 @@ def get_scope(self, hostport):
6879
6889
if name in self._collection:
6880
6890
return name
6881
6891
6882
- def remove (self, url, matcher):
6892
+ def remove_reported (self, url, matcher):
6883
6893
with self._thread_lock:
6884
6894
hostport = self._get_host(url)
6895
+ if matcher in self._global_matchers:
6896
+ matcher.reported_for.append(hostport)
6897
+ return
6885
6898
if hostport in self._collection:
6886
6899
if matcher in self._collection[hostport]:
6887
6900
self._collection[hostport].remove(matcher)
6901
+ return
6888
6902
else:
6889
6903
name = self.get_scope(hostport)
6890
6904
if name and name in self._collection:
6891
6905
if matcher in self._collection[name]:
6892
6906
self._collection[name].remove(matcher)
6907
+ return
6893
6908
6894
6909
def _get_host(self, url):
6895
6910
if not url:
@@ -6980,6 +6995,9 @@ def __init__(self, issue,
6980
6995
self.content_type_header_marker = "content-type:"
6981
6996
self.content_disposition_header_marker = "content-disposition: attachment"
6982
6997
6998
+ # Special case to keep track where global matchers were reported already
6999
+ self.reported_for = []
7000
+
6983
7001
def __hash__(self):
6984
7002
return hash((self.issue.name,
6985
7003
self.issue.urlPy,
0 commit comments