elastalert icon indicating copy to clipboard operation
elastalert copied to clipboard

Add MISP Alerter

Open weslambert opened this issue 6 years ago • 13 comments

Similar to HiveAlerter, allows the user to create events within MISP from Elastalert matches using the MISPAlerter class, and alert type of mispalerter.

Rule format should be similar to the following:

es_port: 9200
name: Elastalert2MISP
type: frequency
index: "*:logstash-index*"
num_events: 1
timeframe:
    minutes: 10
buffer_time:
    minutes: 10
allow_buffer_time_overlap: true

filter:
- term:
    event_type: "snort"

alert: mispalerter

misp_connection:
  misp_url: https://192.168.3.14
  misp_key: HF4ZWQJEg1hqfPEZdpLH0rh3fm17PtL9UNoXrJf6

misp_alert_config:
  distribution: 0
  info: "This is an event generated from Elastalert to MISP!"
  analysis: 1
  threat_level_id: 1
  published: True

misp_attribute_data_mapping:
- ip-src: '{match[source_ip]}'
- ip-dst: '{match[destination_ip]}'

weslambert avatar Feb 10 '19 02:02 weslambert

Hi @Qmando ,

Is there anything I can do to improve this, or make this more acceptable? Thanks!

weslambert avatar May 01 '19 15:05 weslambert

Hi, im trying to use this alerter to upload an incident on my MISP server, but my rule keeps showing 1 alert sent even if there is nothing new in my MISP server.

Here is my rule log: INFO:elastalert:Ran MyRule from 2020-02-02 11:43 CST to 2020-02-02 11:54 CST: 42 query hits (33 already seen), 9 matches, 1 alerts sent

My rule .yaml:

es_host: x.x.x.x

es_port: 9200

name: MyRule

type: any

index: myindex

filter: - query_string: query: "myquey"

alert: mispalerter misp_connection: misp_url: https://x.x.x.x misp_key: my admin user authkey

misp_alert_config: distribution: 0 info: "My Elastalert event" analysis: 1 threat_level_id: 1 published: True

misp_attribute_data_mapping: - ip-src: '{match[source_ip]}' - ip-dst: '{match[destination_ip]}'

Im new at this so sorry if im missing something obvious. I use the same configuration with the email alerter and works fine. Thanks

MarkDevelo avatar Feb 07 '20 18:02 MarkDevelo

Hi @MarkDevelo , it's been a minute since I've looked at this, so I will test again and let you know.

weslambert avatar Feb 10 '20 13:02 weslambert

Thanks @weslambert , if it helps in the MISP logs i can see the elastalert successful authentication using the API key, in the "change" column it shows "HTTP method: GET" all HTTP methods are "GET" the "target" is the only one that changes : "Target: /user/view/me" "Target: /attributes/describeTypes.json" "Target: /servers/getVersio.json" "Target: /servers/getPyMISPVersion,json" i have the same PyMISP version installed on both servers, the same pythons, both of them with ubuntu 16.04.6. Thanks for your time.

MarkDevelo avatar Feb 10 '20 15:02 MarkDevelo

■README.md Need to add "MISP" under Zabbix

■ docs/source/ruletypes.rst Need to add explanation about MISP settings

nsano-rururu avatar Jul 25 '20 20:07 nsano-rururu

I haven't tested this recently -- did this work for you, @nsano-rururu ?

weslambert avatar Jul 27 '20 15:07 weslambert

I haven't tested this recently -- did this work for you, @nsano-rururu ?

I haven't moved it yet. The following items are likely to work with docker, so I'll try them. https://github.com/coolacid/docker-misp

nsano-rururu avatar Jul 28 '20 16:07 nsano-rururu

Travis CI build failed From the feeling of seeing the error message, I feel that it will be resolved by just synchronizing the repository forked on GitHub with the master of the fork source repository.

nsano-rururu avatar Jul 28 '20 16:07 nsano-rururu

Yes, I will have a look at it tonight -- will probably end up re-writing some of it anyway. Thanks!

weslambert avatar Jul 28 '20 16:07 weslambert

@weslambert

Any way you could push this PR to https://github.com/jertel/elastalert2 ?

nsano-rururu avatar Apr 23 '21 17:04 nsano-rururu

@nsano-rururu, sure thing -- will do so when I get a chance.

weslambert avatar Apr 23 '21 19:04 weslambert

Here are some things to keep in mind when making a pull request to elastalert2. Please note that the source code structure of the alert is now different from the original yelp / elastalert.

Structure of related files and source code

elastalert
  loaders.py
  schema.yaml
  /alerters
    mispalerter.py
  /tests
    /alerters
      mispalerter_test.py

nsano-rururu avatar May 26 '21 21:05 nsano-rururu

Here are some things to keep in mind when making a pull request to elastalert2. Please note that the source code structure of the alert is now different from the original yelp / elastalert.

Structure of related files and source code

elastalert
  loaders.py
  schema.yaml
  /alerters
    mispalerter.py
  /tests
    /alerters
      mispalerter_test.py

Understood, thanks!

weslambert avatar May 27 '21 02:05 weslambert