Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat] Improve ECS field mappings in suricata module #16843

Merged
merged 3 commits into from
Mar 12, 2020

Conversation

leehinman
Copy link
Contributor

@leehinman leehinman commented Mar 5, 2020

  • destination.domain
  • dns.question.top_level_domain
  • event.category
  • event.kind
  • event.outcome
  • event.type
  • related.hash
  • related.ip
  • rule.category
  • rule.id
  • rule.name
  • tls.client.server_name
  • tls.resumed
  • tls.server.certificate
  • tls.server.certificate_chain
  • tls.server.hash.sha1
  • tls.server.issuer
  • tls.server.ja3s
  • tls.server.not_after
  • tls.server.not_before
  • tls.server.subject
  • tls.version
  • tls.version_protocol

Closes #16181

@leehinman leehinman added enhancement Filebeat Filebeat needs_backport PR is waiting to be backported to other branches. Team:SIEM ecs labels Mar 5, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/siem (Team:SIEM)

- destination.domain
- dns.question.top_level_domain
- event.category
- event.kind
- event.outcome
- event.type
- related.hash
- related.ip
- rule.category
- rule.id
- rule.name
- tls.client.server_name
- tls.resumed
- tls.server.certificate
- tls.server.certificate_chain
- tls.server.hash.sha1
- tls.server.issuer
- tls.server.ja3s
- tls.server.not_after
- tls.server.not_before
- tls.server.subject
- tls.version
- tls.version_protocol

Closes elastic#16181
Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work!

]
],
"tls.client.server_name": "p33-btmmdns.icloud.com.",
"tls.server.hash.sha1": "6a:ff:ac:a6:5f:8a:05:e7:a9:8c:76:29:b9:08:c7:69:ad:dc:72:47",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ECS we say to use upper-case hex without any colons.

Copy link
Contributor

@webmat webmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@@ -186,16 +221,21 @@
"dns.id": "12308",
"dns.response_code": "NOERROR",
"dns.type": "answer",
"event.category": "network_traffic",
"event.category": "network",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.category should be an array field.

"event.dataset": "suricata.eve",
"event.kind": "event",
"event.module": "suricata",
"event.original": "{\"timestamp\":\"2018-07-05T15:51:20.213418-0400\",\"flow_id\":1684780223079543,\"in_iface\":\"en0\",\"event_type\":\"dns\",\"src_ip\":\"192.168.86.1\",\"src_port\":53,\"dest_ip\":\"192.168.86.85\",\"dest_port\":39464,\"proto\":\"UDP\",\"dns\":{\"type\":\"answer\",\"id\":12308,\"rcode\":\"NOERROR\",\"rrname\":\"clients.l.google.com\",\"rrtype\":\"A\",\"ttl\":299,\"rdata\":\"172.217.13.110\"}}",
"event.type": "protocol",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.type should be an array field

@@ -350,22 +390,31 @@
"destination.address": "17.142.164.13",
"destination.as.number": 714,
"destination.as.organization.name": "Apple Inc.",
"destination.domain": "p33-btmmdns.icloud.com.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trailing period in the DNS name should be removed

"tls.server.subject": "CN=*.icloud.com/OU=management:idms.group.506364/O=Apple Inc./ST=California/C=US",
"tls.version": "1.2",
"tls.version_protocol": "tls",
"url.domain": "p33-btmmdns.icloud.com."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this come from the SNI?

I agree that in most cases, TLS is tunneling http. But I don't think Suricata relays what the next/tunneled protocol is, on TLS events. I'd recommend sticking to putting this in destination.domain only, even if most of the time also putting it in url.domain would be accurate.

evt.AppendTo("event.category", "network");
evt.AppendTo("event.category", "intrusion_detection");
break;
case "anomally":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case "anomally":
case "anomaly":

Typo?

evt.Put("event.kind", "event");
evt.AppendTo("event.category", "network");
break;
case "http":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For http, dns, tls, ftp and a whole lot of other IANA protocols reported by Suricata, I'd recommend setting network.protocol explicitly as well. I've noticed the handling of suricata.eve.app_proto below in the pipeline, but that doesn't seem to fill network.protocol reliably. So when suricata.eve.app_proto is empty, I think we should set it explicitly based on the Suricata event type.

The expectation for event.type:protocol is that these events are a protocol-specific breakdown, and the protocol name should be in a standard field as well.

Examples:

{ "event": { "type": ["protocol", ...], ... },
  "network": { "transport": "udp", "protocol": "dns" ... },
  "dns": { ... }
}
{ "event": { "type": ["protocol", ...], ... },
  "network": { "transport": "tcp", "protocol": "tls" ... },
  "tls": { ... }
}

Note: We haven't defined that many protocols per se in ECS yet, though. So outside "http", "dns" and "tls", the protocol breakdown details are fine in custom fields.

- Uppercase and remove : from hash
- event.category always an array
- event.type always an array
- remove trailing period from dns names
- don't populate url.domain unless protocol is http
- fix "anomally" typo
- set network.protocol if suricata has identified the protocol
  via event_type
Copy link
Contributor

@webmat webmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leehinman leehinman merged commit 7eb2fba into elastic:master Mar 12, 2020
@leehinman leehinman added v7.7.0 and removed needs_backport PR is waiting to be backported to other branches. labels Mar 12, 2020
leehinman added a commit to leehinman/beats that referenced this pull request Mar 12, 2020
* Improve ECS field mappings in suricata module

- destination.domain
- dns.question.top_level_domain
- event.category
- event.kind
- event.outcome
- event.type
- related.hash
- related.ip
- rule.category
- rule.id
- rule.name
- tls.client.server_name
- tls.resumed
- tls.server.certificate
- tls.server.certificate_chain
- tls.server.hash.sha1
- tls.server.issuer
- tls.server.ja3s
- tls.server.not_after
- tls.server.not_before
- tls.server.subject
- tls.version
- tls.version_protocol

Closes elastic#16181

(cherry picked from commit 7eb2fba)
@leehinman leehinman deleted the 16181_suricata_ecs_1.4 branch March 12, 2020 23:28
leehinman added a commit that referenced this pull request Mar 17, 2020
…6990)

* Improve ECS field mappings in suricata module

- destination.domain
- dns.question.top_level_domain
- event.category
- event.kind
- event.outcome
- event.type
- related.hash
- related.ip
- rule.category
- rule.id
- rule.name
- tls.client.server_name
- tls.resumed
- tls.server.certificate
- tls.server.certificate_chain
- tls.server.hash.sha1
- tls.server.issuer
- tls.server.ja3s
- tls.server.not_after
- tls.server.not_before
- tls.server.subject
- tls.version
- tls.version_protocol

Closes #16181

(cherry picked from commit 7eb2fba)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Filebeat] Upgrade suricata module to ECS 1.4
4 participants