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

Zeek Intel Framework #20

Closed
mmguero opened this issue Sep 9, 2020 · 7 comments
Closed

Zeek Intel Framework #20

mmguero opened this issue Sep 9, 2020 · 7 comments
Projects

Comments

@mmguero
Copy link
Collaborator

mmguero commented Sep 9, 2020

From Malcolm created by cyamal1b4: cisagov#131

Greetings, so I've been up and down in the docs for Zeek and understand decently well how to create Intel in Zeek, however, that is largely aligned with a normal deployment of Zeek. I have loaded the required policies and pointed zeek (in local.zeek) to my local bro formatted file with an indicator. I tested everything in the TryZeek page with the same pcap, local.zeek changes, as well as the same bro intel file. However, when I replicate I cannot get Malcolm (under the Kibana-Zeek Intel or Notice dashboards) to pick up on my Intel hit. I have noticed some differences in the deployment with Malcolm so I figured it would be best to ask the developer directly. Thanks for your support and contribution!!

@mmguero
Copy link
Collaborator Author

mmguero commented Sep 9, 2020

If you're talking about the various Zeek .log files themselves, currently just the delimited format is supported as that's how the Logstash filters parsing them are expecting them.

Glad you figured it out.

For now I'll leave this issue open and maybe see about making mapping zeek intel files into the containers more automatic as an enhancement.

@mmguero
Copy link
Collaborator Author

mmguero commented Sep 9, 2020

I did look in the reporter log and see it appears to have an issue with the formatting of the file. I’ll dig into that and update. This is what I get as an error in the reporter log:
#separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path reporter
#open 2020-05-21-20-49-55
#fields ts level message location
#types time enum string string
1590094195.785510 Reporter::WARNING /opt/zeek/share/zeek/site/opt/intel-stack-client/frameworks/intel/master-public.dat/Input::READER_ASCII: Init: cannot open /opt/zeek/share/zeek/site/opt/intel-stack-client/frameworks/intel/master-public.dat (empty)
#close 2020-05-21-20-49-57

I did change the file from BroStuff.txt to master.... that is referenced above ^

@mmguero
Copy link
Collaborator Author

mmguero commented Sep 9, 2020

@mmguero figured it out. It was just a docker-ism. Just needed an additional mapping for the intel file as a volume into the container. For reference I am using intel generated by intelstack's client that natively gets it into TSV format. Do you know off hand if Malcolm would support a tune to JSON or would that disturb other modifications? Thanks brother!

@mmguero
Copy link
Collaborator Author

mmguero commented Sep 9, 2020

I haven't really done anything with the intel framework in Malcolm yet, but I can give you a little bit of advice on how local.zeek gets loaded in Malcolm.

The ./zeek/config/local.zeek file gets built into the malcolmnetsec/zeek package, but it can be overriden with a docker volume mount. Depending on which docker-compose file you're using (docker-compose.yml which is more for development and has a lot of local files volume-mounted into the docker container, or docker-compose-standalone.yml which is what you get for docker-compose.yml if you grab it from the Releases artifacts) this may or may not already be happening, but you can check in by looking for the zeek: service in your docker-compose.yml file.

If you see a line in the volumes: section under zeek: that looks like this:

- ./zeek/config/local.zeek:/opt/zeek/share/zeek/site/local.zeek:ro

Then you should be getting your local modifications to local.zeek when you run Malcolm. If you don't, you could try adding that to the volumes: section for zeek: and see if you get different results.

If you still aren't seeing things, check under ./zeek-logs after importing your PCAP and see if the intel file is getting created.

# find ./zeek-logs -type f -name "intel*"

Perhaps it is getting created, but I've got an issue parsing the file?

@mmguero
Copy link
Collaborator Author

mmguero commented Sep 9, 2020

So here is my local.zeek that is a volume on the host for the containers related file. I added the Intel::read_files as well as the 2 policies related to Intel as well below.

#! Zeek local site policy. Customize as appropriate.
##!
##! See https://github.com/zeek/zeekctl
##! https://docs.zeek.org/en/stable/script-reference/scripts.html
##! https://github.com/zeek/zeek/blob/master/scripts/site/local.zeek

redef Broker::default_listen_address = "127.0.0.1";
redef ignore_checksums = T;
redef HTTP::default_capture_password = T;
redef FTP::default_capture_password = T;
redef SOCKS::default_capture_password = T;
redef Intel::read_files += { "/home/sansforensics/Downloads/BroStuff.txt" };

@load tuning/defaults
@load misc/scan
@load frameworks/software/vulnerable
@load frameworks/software/version-changes
@load frameworks/software/windows-version-detection
@load-sigs frameworks/signatures/detect-windows-shells
@load protocols/conn/known-hosts
@load protocols/conn/known-services
@load protocols/dhcp/software
@load protocols/dns/detect-external-names
@load protocols/ftp/detect
@load protocols/ftp/detect-bruteforcing.zeek
@load protocols/ftp/software
@load protocols/http/detect-sqli
@load protocols/http/detect-webapps
@load protocols/http/software
@load protocols/http/software-browser-plugins
@load protocols/mysql/software
@load protocols/ssl/weak-keys
@load protocols/smb/log-cmds
@load protocols/smtp/software
@load protocols/ssh/detect-bruteforcing
@load protocols/ssh/geo-data
@load protocols/ssh/interesting-hostnames
@load protocols/ssh/software
@load protocols/ssl/known-certs
@load protocols/ssl/log-hostcerts-only
@load protocols/ssl/validate-certs
@load tuning/track-all-assets.zeek
@load frameworks/files/hash-all-files
@load policy/protocols/conn/vlan-logging
@load policy/protocols/conn/mac-logging
@load policy/protocols/modbus/track-memmap
@load policy/protocols/modbus/known-masters-slaves
@load policy/protocols/mqtt
@load policy/frameworks/intel/seen
@load policy/integration/collective-intel
@load policy/frameworks/intel/do_notice
--@load frameworks/files/detect-MHR

--custom packages installed manually
@load Corelight/PE_XOR
@load Salesforce/GQUIC
@load ./bzar
--custom packages managed by zkg via packages/packages.zeek
@load ./packages/packages.zeek
--and apparently some installed packages (BRO::LDAP) are loaded automatically

Here is the BroStuff.txt file generated from cifv5 that supposedly puts it into the correct bro tab separated format.

#fields indicator indicator_type meta.desc meta.confidence meta.source meta.do_notice
23.15.54.44 Intel::ADDR proxy|tor 4 check.torproject.org T

That IP (23.15.54.44) is in my instance from a malicious pcap I have. However as a test its not actually on that list as malicious in the wild.

I checked in the logs and it isn't creating the intel log file. Either. I feel its a parsing issue as well but not sure yet.

@mmguero mmguero added this to To do in Malcolm Sep 9, 2020
@mmguero mmguero moved this from To do to In progress in Malcolm Jan 11, 2022
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jan 11, 2022
…lly under ./zeek/intel/ and it will be bind-mounted in without having to manually modify local.zeek) and fix some zeek log fields
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jan 11, 2022
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jan 11, 2022
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jan 11, 2022
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jan 11, 2022
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jan 12, 2022
@mmguero
Copy link
Collaborator Author

mmguero commented Jan 12, 2022

with the v5.2.0 release Malcolm's made it easier to drop intel files in ./zeek/intel and have them get picked up automatically. See the README.md. Leaving the issue open though until I've got it done in hedgehog too.

mmguero added a commit to cisagov/Malcolm that referenced this issue Jan 21, 2022
v5.2.0 release development

* New features
    * Zeek Intelligence Framework (see idaholab#20)
        * To quote Zeek's Intelligence Framework documentation, "The goals of Zeek’s Intelligence Framework are to consume intelligence data, make it available for matching, and provide infrastructure to improve performance and memory utilization. Data in the Intelligence Framework is an atomic piece of intelligence such as an IP address or an e-mail address. This atomic data will be packed with metadata such as a freeform source field, a freeform descriptive field, and a URL which might lead to more information about the specific item." Zeek intelligence indicator types include IP addresses, URLs, file names, hashes, email addresses, and more.
        * Malcolm doesn't come bundled with intelligence files from any particular feed, but they can be easily included into your local instance. On startup, Malcolm's `malcolmnetsec/zeek` docker container enumerates the subdirectories under `./zeek/intel` (which is bind mounted into the container's runtime) and configures Zeek so that those intelligence files will be automatically included in its local policy. Subdirectories under `./zeek/intel` which contain their own `__load__.zeek` file will be `@load`-ed as-is, while subdirectories containing "loose" intelligence files will be loaded automatically with a `redef Intel::read_files` directive.
    * New [**OPCUA Binary** protocol parser](https://github.com/cisagov/icsnpp-opcua-binary) for Zeek and corresponding dashboard.

* Improvements
    * set `ecs.provider` to `arkime` for logs from Arkime's `capture` to make categorizing logs by source easier
    * API
        * allow bucketing multiple fields from `/agg/` API
        * added `/fields/` API to list fields
        added documentation
    * ECS normalization to [`related.hosts`](https://www.elastic.co/guide/en/ecs/current/ecs-related.html#field-related-hosts) field for all applicable protocols
    * updated documentation, screenshots and slides
    * spreadsheet mapping STIX v1.2 fields to Zeek fields and Malcolm normalized fields
    * updated MITRE ATT&CK mappings for Capa hits
    * added a pseudo-read-only NGINX configuration

* Version bumps
    * Arkime to [v3.3.0](https://github.com/arkime/arkime/blob/496ec1e5cd89d79e22ab1a0cddb9a7a2f301cd14/CHANGELOG#L25-L50)
    * OpenSearch to [v1.2.4](https://github.com/opensearch-project/opensearch-build/blob/main/release-notes/opensearch-release-notes-1.2.4.md)
    * Capa to [v3.1.0](https://github.com/mandiant/capa/releases/tag/v3.1.0)
    * [cve-2021-44228 Log4Shell detector plugin](https://github.com/corelight/cve-2021-44228) for Zeek to v0.5.3 (see corelight/cve-2021-44228#46)

* Bug Fixes
    * fix idaholab#71 (type mismatch for network.vlan.id between Malcolm and Arkime definitions) which prevented vlan traffic from indexing correctly from Arkime's `capture` with Malcolm's field template
    * fix for ethernet/IP traffic which could lead to Zeek runaway memory allocation until crash: "Fixed bug with Request Paths containing Port Segments" (cisagov/icsnpp-enip@4696a43)
@mmguero
Copy link
Collaborator Author

mmguero commented Jan 21, 2022

done in v5.2.1

@mmguero mmguero closed this as completed Jan 21, 2022
@mmguero mmguero moved this from In progress to Done in Malcolm Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Malcolm
  
Done
Development

No branches or pull requests

1 participant