Skip to content

Commit ac13666

Browse files
authored
Merge pull request #1127 from stratosphereips/alya/fix_multiple_reconnection_attempts
Fix problem setting multiple reconnection attempts evidence
2 parents 0ae0e61 + a13c1b6 commit ac13666

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{"ts":79.681977,"uid":"Cw6JBU12nYsbZElIpa","id.orig_h":"10.0.2.15","id.orig_p":546,"id.resp_h":"123.22.123.22","id.resp_p":547,"proto":"tcp","duration":63.02690299999995,"orig_bytes":588,"resp_bytes":0,"conn_state":"REJ","local_orig":false,"local_resp":false,"missed_bytes":0,"history":"D","orig_pkts":7,"orig_ip_bytes":924,"resp_pkts":0,"resp_ip_bytes":0,"orig_l2_addr":"08:00:27:ef:ee:34","resp_l2_addr":"33:33:00:01:00:02"}
2+
{"ts":79.681977,"uid":"Cw6JBU12nYsbZElIpa","id.orig_h":"10.0.2.15","id.orig_p":546,"id.resp_h":"123.22.123.22","id.resp_p":547,"proto":"tcp","duration":63.02690299999995,"orig_bytes":588,"resp_bytes":0,"conn_state":"REJ","local_orig":false,"local_resp":false,"missed_bytes":0,"history":"D","orig_pkts":7,"orig_ip_bytes":924,"resp_pkts":0,"resp_ip_bytes":0,"orig_l2_addr":"08:00:27:ef:ee:34","resp_l2_addr":"33:33:00:01:00:02"}
3+
{"ts":79.681977,"uid":"Cw6JBU12nYsbZElIpa","id.orig_h":"10.0.2.15","id.orig_p":546,"id.resp_h":"123.22.123.22","id.resp_p":547,"proto":"tcp","duration":63.02690299999995,"orig_bytes":588,"resp_bytes":0,"conn_state":"REJ","local_orig":false,"local_resp":false,"missed_bytes":0,"history":"D","orig_pkts":7,"orig_ip_bytes":924,"resp_pkts":0,"resp_ip_bytes":0,"orig_l2_addr":"08:00:27:ef:ee:34","resp_l2_addr":"33:33:00:01:00:02"}
4+
{"ts":79.681977,"uid":"Cw6JBU12nYsbZElIpa","id.orig_h":"10.0.2.15","id.orig_p":546,"id.resp_h":"123.22.123.22","id.resp_p":547,"proto":"tcp","duration":63.02690299999995,"orig_bytes":588,"resp_bytes":0,"conn_state":"REJ","local_orig":false,"local_resp":false,"missed_bytes":0,"history":"D","orig_pkts":7,"orig_ip_bytes":924,"resp_pkts":0,"resp_ip_bytes":0,"orig_l2_addr":"08:00:27:ef:ee:34","resp_l2_addr":"33:33:00:01:00:02"}
5+
{"ts":79.681977,"uid":"Cw6JBU12nYsbZElIpa","id.orig_h":"10.0.2.15","id.orig_p":546,"id.resp_h":"123.22.123.22","id.resp_p":547,"proto":"tcp","duration":63.02690299999995,"orig_bytes":588,"resp_bytes":0,"conn_state":"REJ","local_orig":false,"local_resp":false,"missed_bytes":0,"history":"D","orig_pkts":7,"orig_ip_bytes":924,"resp_pkts":0,"resp_ip_bytes":0,"orig_l2_addr":"08:00:27:ef:ee:34","resp_l2_addr":"33:33:00:01:00:02"}

modules/flowalerts/conn.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,19 +267,19 @@ def check_multiple_reconnection_attempts(self, profileid, twid, flow):
267267
reconnections, uids = current_reconnections[key]
268268
reconnections += 1
269269
uids.append(flow.uid)
270-
current_reconnections[key] = (reconnections, uids)
271270
except KeyError:
272-
current_reconnections[key] = (1, [flow.uid])
271+
uids = [flow.uid]
273272
reconnections = 1
274273

274+
current_reconnections[key] = (reconnections, uids)
275275
if reconnections < self.multiple_reconnection_attempts_threshold:
276276
self.db.set_reconnections(profileid, twid, current_reconnections)
277277
return
278278

279279
self.set_evidence.multiple_reconnection_attempts(
280-
twid, flow, reconnections
280+
twid, flow, reconnections, uids
281281
)
282-
# reset the reconnection attempts of this src->dst
282+
# reset the reconnection counter of this src->dst
283283
current_reconnections[key] = (0, [])
284284

285285
self.db.set_reconnections(profileid, twid, current_reconnections)

tests/integration_tests/test_zeek_dataset.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"Suspicious user-agent:",
4747
"Download of an executable",
4848
"GRE tunnel",
49+
"Multiple reconnection attempts to Destination IP: 123.22.123.22 from IP: 10.0.2.15",
4950
],
5051
"test14-malicious-zeek-dir/",
5152
6670,

0 commit comments

Comments
 (0)