Skip to content

Commit 0517543

Browse files
authored
[cisco_meraki] Fix handling of security events without dhost and with action. (#8384)
* Fix handling of security events without dhost and with action. * Add changelog PR * Trim values
1 parent 7d1faf9 commit 0517543

File tree

5 files changed

+97
-38
lines changed

5 files changed

+97
-38
lines changed

packages/cisco_meraki/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "1.18.1"
3+
changes:
4+
- description: Fix handling of security events without dhost and with action.
5+
type: bugfix
6+
link: https://github.com/elastic/integrations/pull/8384
27
- version: "1.18.0"
38
changes:
49
- description: Simplify IPflows pipeline to cover ICMP events.

packages/cisco_meraki/data_stream/log/_dev/test/pipeline/test-security-events.log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<134>1 1637691198.348361125 MX84 security_event ids_alerted signature=1:29708:4 priority=1 timestamp=1637691198.330873 dhost=D0:AB:D5:7B:43:73 direction=ingress protocol=tcp/ip src=67.43.156.12:80 dst=10.0.3.162:56391 decision=allowed message: BROWSER-IE Microsoft Internet Explorer CSS uninitialized object access attempt detected
2+
<134>1 1698065891.323413683 MX84 security_event ids_alerted signature=1:45749:2 priority=1 timestamp=1698065891.322786 direction=ingress protocol=tcp/ip src=67.43.156.12:80 dst=10.0.3.162:56391 decision=blocked action=allow message: SERVER-WEBAPP PHPUnit PHP remote code execution attempt
23
<134>1 1637691298.984398273 MX84 security_event security_filtering_file_scanned url=http://www.eicar.org/download/eicar.com.txt src=192.168.128.2:53150 dst=67.43.156.15:80 mac=98:5A:EB:E1:81:2F name='EICAR:EICAR_Test_file_not_a_virus-tpd' sha256=275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f disposition=malicious action=block
34
<134>1 1637783435.239819833 MX84 security_event security_filtering_disposition_change name=EICAR:EICAR_Test_file_not_a_virus-tpd sha256=275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f disposition=malicious action=allow
45
<134>1 1637783891.345984502 MX84 ids-alerts signature=129:4:1 priority=3 timestamp=1637783891.512569 direction=ingress protocol=tcp/ip src=67.43.156.15:80

packages/cisco_meraki/data_stream/log/_dev/test/pipeline/test-security-events.log-expected.json

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,76 @@
6060
],
6161
"threat": {
6262
"indicator": {
63-
"description": " BROWSER-IE Microsoft Internet Explorer CSS uninitialized object access attempt detected",
63+
"description": "BROWSER-IE Microsoft Internet Explorer CSS uninitialized object access attempt detected",
6464
"last_seen": "2021-11-23T18:13:18.330Z"
6565
}
6666
}
6767
},
68+
{
69+
"@timestamp": "2023-10-23T12:58:11.323Z",
70+
"cisco_meraki": {
71+
"event_subtype": "ids_alerted",
72+
"event_type": "security_event",
73+
"security": {
74+
"action": "allow",
75+
"decision": "blocked",
76+
"priority": "1",
77+
"signature": "1:45749:2"
78+
}
79+
},
80+
"destination": {
81+
"ip": "10.0.3.162",
82+
"port": 56391
83+
},
84+
"ecs": {
85+
"version": "8.10.0"
86+
},
87+
"event": {
88+
"action": "ids-signature-matched",
89+
"category": [
90+
"network",
91+
"threat"
92+
],
93+
"original": "<134>1 1698065891.323413683 MX84 security_event ids_alerted signature=1:45749:2 priority=1 timestamp=1698065891.322786 direction=ingress protocol=tcp/ip src=67.43.156.12:80 dst=10.0.3.162:56391 decision=blocked action=allow message: SERVER-WEBAPP PHPUnit PHP remote code execution attempt",
94+
"type": [
95+
"info",
96+
"indicator"
97+
]
98+
},
99+
"network": {
100+
"direction": "ingress",
101+
"protocol": "tcp/ip"
102+
},
103+
"observer": {
104+
"hostname": "MX84"
105+
},
106+
"source": {
107+
"as": {
108+
"number": 35908
109+
},
110+
"geo": {
111+
"continent_name": "Asia",
112+
"country_iso_code": "BT",
113+
"country_name": "Bhutan",
114+
"location": {
115+
"lat": 27.5,
116+
"lon": 90.5
117+
}
118+
},
119+
"ip": "67.43.156.12",
120+
"port": 80
121+
},
122+
"tags": [
123+
"forwarded",
124+
"preserve_original_event"
125+
],
126+
"threat": {
127+
"indicator": {
128+
"description": "SERVER-WEBAPP PHPUnit PHP remote code execution attempt",
129+
"last_seen": "2023-10-23T12:58:11.322Z"
130+
}
131+
}
132+
},
68133
{
69134
"@timestamp": "2021-11-23T18:14:58.984Z",
70135
"cisco_meraki": {

packages/cisco_meraki/data_stream/log/elasticsearch/ingest_pipeline/security.yml

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,44 @@ processors:
1010
target_field: cisco_meraki.event_subtype
1111

1212
# scan event based on event type
13-
- dissect:
14-
field: event.original
15-
pattern: "%{} ids_alerted %{*sig}=%{&sig} %{*pri}=%{&pri} %{*ts}=%{&ts} %{*dhost}=%{&dhost} %{*dir}=%{&dir} %{*prot}=%{&prot} %{*src}=%{&src} %{*dst}=%{&dst} %{}"
16-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
17-
- dissect:
18-
field: event.original
19-
pattern: "%{} security_filtering_file_scanned %{*url}=%{&url} %{*src}=%{&src} %{*dst}=%{&dst} %{*mac}=%{&mac} %{*name}='%{&name}' %{*sha256}=%{&sha256} %{*disp}=%{&disp} %{*action}=%{&action}"
20-
if: ctx?.cisco_meraki?.event_subtype == 'security_filtering_file_scanned'
21-
- dissect:
13+
- grok:
2214
field: event.original
23-
pattern: "%{} security_filtering_disposition_change %{*name}=%{&name} %{*sha256}=%{&sha256} %{*disp}=%{&disp} %{*action}=%{&action}"
24-
if: ctx?.cisco_meraki?.event_subtype == 'security_filtering_disposition_change'
15+
patterns:
16+
- ^%{DATA} (security_event|ids-alerts) (%{WORD}\s)?%{DATA:_temp.kvs}(\smessage:\s?%{DATA:message})?$
17+
- kv:
18+
field: _temp.kvs
19+
field_split: " "
20+
value_split: "="
21+
trim_value: " '\""
2522

2623
# handle fields of ids_alerted type
2724
- rename:
2825
field: priority
2926
target_field: cisco_meraki.security.priority
30-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
27+
ignore_missing: true
3128
- rename:
3229
field: signature
3330
target_field: cisco_meraki.security.signature
34-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
31+
ignore_missing: true
3532
- date:
3633
field: timestamp
3734
target_field: threat.indicator.last_seen
3835
formats: ['UNIX']
39-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
36+
if: ctx.timestamp != null
4037
- gsub:
4138
field: dhost
4239
target_field: cisco_meraki.security.dhost
4340
pattern: '[-:.]'
4441
replacement: '-'
45-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
42+
ignore_missing: true
4643
- rename:
4744
field: direction
4845
target_field: network.direction
49-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
46+
ignore_missing: true
5047
- lowercase:
5148
field: protocol
5249
target_field: network.protocol
53-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
54-
# Process the remaining after dst=. It can have "decision=<word> message: *" or just "message: *"
55-
- dissect:
56-
field: event.original
57-
pattern: "%{} dst=%{?ignore} %{*decision}=%{&decision} %{*message}:%{&message}"
58-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
59-
ignore_failure: true
60-
- dissect:
61-
field: event.original
62-
pattern: "%{} dst=%{?ignore} %{*message}:%{&message}"
63-
if: ctx?.decision == null && ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
50+
ignore_missing: true
6451
- rename:
6552
field: message
6653
target_field: threat.indicator.description
@@ -70,35 +57,34 @@ processors:
7057
field: decision
7158
target_field: cisco_meraki.security.decision
7259
ignore_missing: true
73-
if: ctx?.cisco_meraki?.event_subtype == 'ids_alerted'
7460

7561
# handle fields of security_filtering_file_scanned or security_filtering_disposition_change type
7662
- rename:
7763
field: url
7864
target_field: threat.indicator.reference
79-
if: ctx?.cisco_meraki?.event_subtype == 'security_filtering_file_scanned'
65+
ignore_missing: true
8066
- gsub:
8167
field: mac
8268
target_field: cisco_meraki.security.mac
8369
pattern: '[-:.]'
8470
replacement: '-'
85-
if: ctx?.cisco_meraki?.event_subtype == 'security_filtering_file_scanned'
71+
ignore_missing: true
8672
- rename:
8773
field: name
8874
target_field: threat.indicator.file.name
89-
if: ctx?.cisco_meraki?.event_subtype == 'security_filtering_file_scanned' || ctx?.cisco_meraki?.event_subtype == 'security_filtering_disposition_change'
75+
ignore_missing: true
9076
- rename:
9177
field: sha256
9278
target_field: threat.indicator.file.hash.sha256
93-
if: ctx?.cisco_meraki?.event_subtype == 'security_filtering_file_scanned' || ctx?.cisco_meraki?.event_subtype == 'security_filtering_disposition_change'
79+
ignore_missing: true
9480
- rename:
9581
field: disposition
9682
target_field: cisco_meraki.disposition
9783
ignore_missing: true
9884
- rename:
9985
field: action
10086
target_field: cisco_meraki.security.action
101-
if: ctx?.cisco_meraki?.event_subtype == 'security_filtering_file_scanned' || ctx?.cisco_meraki?.event_subtype == 'security_filtering_disposition_change'
87+
ignore_missing: true
10288
# fields common to more than one event type
10389
# src processing
10490
- grok:
@@ -117,13 +103,14 @@ processors:
117103
type: ip
118104
field: _temp.src_ip
119105
target_field: source.ip
120-
if: ctx?.cisco_meraki?.event_subtype != 'security_filtering_disposition_change'
106+
ignore_missing: true
121107
- convert:
122108
field: sport
123109
target_field: source.port
124110
type: long
125-
if: ctx?.sport != "0" && ctx?.cisco_meraki?.event_subtype != 'security_filtering_disposition_change'
111+
ignore_missing: true
126112
ignore_failure: true
113+
if: ctx?.sport != "0"
127114
# dst processing
128115
- grok:
129116
field: dst
@@ -142,13 +129,14 @@ processors:
142129
field: _temp.dst_ip
143130
target_field: destination.ip
144131
ignore_failure: true
145-
if: ctx?.cisco_meraki?.event_subtype != 'security_filtering_disposition_change'
132+
ignore_missing: true
146133
- convert:
147134
field: dport
148135
target_field: destination.port
149136
type: long
150137
if: ctx?.dport != "0" && ctx?.cisco_meraki?.event_subtype != 'security_filtering_disposition_change'
151138
ignore_failure: true
139+
ignore_missing: true
152140
on_failure:
153141
- set:
154142
field: event.kind

packages/cisco_meraki/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format_version: "3.0.0"
22
name: cisco_meraki
33
title: Cisco Meraki
4-
version: "1.18.0"
4+
version: "1.18.1"
55
description: Collect logs from Cisco Meraki with Elastic Agent.
66
type: integration
77
categories:

0 commit comments

Comments
 (0)