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

Update CTI ECS 1.11 fields #113404

Merged
merged 15 commits into from
Oct 14, 2021
Merged

Conversation

nkhristinin
Copy link
Contributor

@nkhristinin nkhristinin commented Sep 29, 2021

Summary

Update CTI ECS 1.11 fields
Reaplcing threatintel.indicator with threat.indicator.

How to test

Check master and check that CTI works with ECS < 1.11

  • Be sure that you have threat intel data in the filebeat index. If you don't have, then try setup threat intel dashboard with data
    Copy value from threatintel.indicator.file.hash.sha256 of first hit of you result. (Later refer as ${SHA256_HASH})
GET filebeat-*/_search
{
  "query": {
    "exists": {
      "field": "threatintel.indicator.file.hash.sha256"
    }
  }
}
  • Create test index
PUT test-filebeat
 {
   "mappings" : {
     "properties" : {
       "@timestamp" : {
         "type" : "date"
       }
     }
   }
 }
  • Create Custom Rule
    Index patterns- test-filebeat
    Custom query * : *

  • Let's create an event in our test-filebeat index

 POST test-filebeat/_doc
 {
   "@timestamp": "${YOUR_DATE}", 
   "file": {
     "hash": {
       "sha256":"${SHA256_HASH}"
     }
   }
 }
  • In our rule alerts table we should have an alert with enrichment.
    Open alert, go to Threat intel tab and check that it has indicators field in Enriched with Threat Intelligence section.
    For example indicator.file.hash.sha256 - ${SHA256_HASH}
image Screenshot 2021-09-30 at 17 13 51
  • Let's create Indicator Match Rule
    Index patterns -test-filebeat
    Custom query - *:*
    Indicator index patterns - filebeat-*
    Indicator index query @timestamp >= "now-30d"
    Indicator mapping file.hash.sha256 MATCHES threatintel.indicator.file.hash.sha256
    Additional look-back time - 24H (to catch alert from the previous step)

  • This rule should catch alerts from the previous step. Open alert, go to Threat intel tab and check that it has indicators field in Threat Match Detected section.

image Screenshot 2021-09-30 at 17 53 04

Check out the branch of this PR

  • Create one more event in test-filebeat index
 POST test-filebeat/_doc
 {
   "@timestamp": "${YOUR_DATE}", 
   "file": {
     "hash": {
       "sha256":"${SHA256_HASH}"
     }
   }
 }

You should see new alert in Indicator math rule, but you shouldn't have any indicators field on Threat intel -> Threat Match Detected section

image Screenshot 2021-09-30 at 19 08 12
  • Check your custom rule, all alert there shouldn't have any Threat Intel enrichments:
image Screenshot 2021-09-30 at 19 13 22
  • Let's create the event in filebeat which match the new ECS 1.11:
Create filebeat event (update ${YOUR_DATE} and ${SHA256_HASH})

POST filebeat-8.0.0/_doc
 {
          "agent" : {
            "name" : "Macbook",
            "id" : "8f59569e-00b5-416d-a19f-94026068ec38",
            "type" : "filebeat",
            "ephemeral_id" : "acb5e630-9d79-497b-9627-080320b30158",
            "version" : "8.0.0"
          },
          "fileset" : {
            "name" : "malwarebazaar"
          },
          "threat" : {
            "malwarebazaar" : {
              "intelligence" : {
                "downloads" : 0,
                "uploads" : 1
              },
              "tags" : [
                "BitRAT",
                "DEU",
                "exe",
                "geo",
                "RAT"
              ],
              "anonymous" : 0,
              "dhash_icon" : "f0b07090cb6468e2",
              "code_sign" : [ ]
            },
            "indicator" : {
              "geo" : {
                "country_iso_code" : "US"
              },
              "first_seen" : "2021-09-27T08:09:33.000Z",
              "file" : {
                "extension" : "exe",
                "size" : 23552,
                "mime_type" : "application/x-dosexec",
                "pe" : {
                  "imphash" : "f34d5f2d4577ed6d9ceec516c1f5a744"
                },
                "name" : "XEROX-ZAHLUNG27.092021.exe",
                "hash" : {
                  "sha1" : "dd0834cdb49932a99491bd59200510c023ae9a5e",
                  "sha384" : "0e4a5d29f00becdc792e94983e812b07aa4c8a636f8b87d37bbba5e0d54cd0f37f365b3b6a827002e71292b8c0aeba1d",
                  "sha256" : "${SHA256_HASH}",
                  "tlsh" : "T188B25476BFD80D55CCF70A3A1CD2BD344D3679CE56A18ABF6888E23E7F101A00969791",
                  "ssdeep" : "384:NkSYhMbVs30Q1TiTPoc3qA5WuDhO4+99y/CMzqTLwzfWntw+synvd3c:SMbVpScXf8c",
                  "md5" : "69c3b568206568200980e419fa392afd"
                },
                "elf" : { }
              },
              "provider" : "abuse_ch",
              "type" : "file"
            }
          },
          "tags" : [
            "threatintel-malwarebazaar",
            "forwarded"
          ],
          "input" : {
            "type" : "httpjson"
          },
          "@timestamp" : "${YOUR_DATE}",
          "ecs" : {
            "version" : "1.10.0"
          },
          "related" : {
            "hash" : [
              "69c3b568206568200980e419fa392afd",
              "2b9e8dc39755d37c2a78fd00f6fa57414205648e65ae6a6c76c102c7d78e2e86",
              "384:NkSYhMbVs30Q1TiTPoc3qA5WuDhO4+99y/CMzqTLwzfWntw+synvd3c:SMbVpScXf8c",
              "f34d5f2d4577ed6d9ceec516c1f5a744",
              "T188B25476BFD80D55CCF70A3A1CD2BD344D3679CE56A18ABF6888E23E7F101A00969791"
            ]
          },
          "service" : {
            "type" : "threatintel"
          },
          "event" : {
            "ingested" : "2021-09-27T08:09:47.206498Z",
            "created" : "2021-09-27T08:09:43.918Z",
            "kind" : "enrichment",
            "module" : "threatintel",
            "category" : "threatintel",
            "type" : "indicator",
            "dataset" : "threat.malwarebazaar"
          }
        }
  • Check your custom rule, all alerts there shouldn't have Threat Intel tab with data and there indicators field in Threat Match Detected section.
image Screenshot 2021-09-30 at 19 26 41
  • Let's update our Indicator Math rule like that:
image Screenshot 2021-09-30 at 19 27 47
  • Create one more event in test-filebeat index
 POST test-filebeat/_doc
 {
   "@timestamp": "${YOUR_DATE}", 
   "file": {
     "hash": {
       "sha256":"${SHA256_HASH}"
     }
   }
 }
  • Check the last alert for the Indicator Math rule, it should have 2 enrichments in Threat Match Detected section.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@nkhristinin nkhristinin added auto-backport Deprecated - use backport:version if exact versions are needed release_note:breaking Team: CTI Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.16.0 v8.0.0 labels Sep 30, 2021
@nkhristinin nkhristinin marked this pull request as ready for review September 30, 2021 18:11
@nkhristinin nkhristinin requested a review from a team as a code owner September 30, 2021 18:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@nkhristinin
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@ecezalp
Copy link
Contributor

ecezalp commented Oct 4, 2021

@elasticmachine merge upstream

Copy link
Contributor

@ecezalp ecezalp left a comment

Choose a reason for hiding this comment

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

LGTM

I was able to confirm that once I check out the PR and create a new alert, there were no investigation time enrichments on it. Once I posted some data to my filebeat index with a matching sha256 hash under the "threat" field, I was able to see the enrichment as expected.

Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

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

Code looks good, although I have not tested this e2e as Ece did. There are some cypress failures around the enrichment e2e tests; I haven't verified whether these are legitimate failures or just outdated tests, but let me know if you need help debugging or fixing them!

@nkhristinin
Copy link
Contributor Author

@elasticmachine merge upstream

@nkhristinin
Copy link
Contributor Author

@elasticmachine merge upstream

@nkhristinin
Copy link
Contributor Author

@elasticmachine merge upstream

@nkhristinin
Copy link
Contributor Author

@elasticmachine merge upstream

@nkhristinin
Copy link
Contributor Author

@elasticmachine merge upstream

@@ -56,7 +56,7 @@
"module": "threatintel",
"category": "threat",
"type": "indicator",
"dataset": "threatintel.abusemalware"
"dataset": "ti_abusech.malware"
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't look like this archive was updated; I think that's at least part of the cause of Cypress failures.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 4.6MB 4.6MB -162.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 104.1KB 104.1KB -5.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nkhristinin nkhristinin merged commit 1929f88 into elastic:master Oct 14, 2021
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

To backport manually run:
node scripts/backport --pr 113404

nkhristinin added a commit to nkhristinin/kibana that referenced this pull request Oct 14, 2021
* Update threatintel to threat

* Remove CTI mappings

* Update CTI_DATASET_KEY_MAP

* Update default threat index

* Change mapping to dataset

* Fix tests

* Fix tests

* Fix test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	x-pack/plugins/security_solution/server/plugin.ts
nkhristinin added a commit that referenced this pull request Oct 14, 2021
* Update threatintel to threat

* Remove CTI mappings

* Update CTI_DATASET_KEY_MAP

* Update default threat index

* Change mapping to dataset

* Fix tests

* Fix tests

* Fix test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	x-pack/plugins/security_solution/server/plugin.ts
ecezalp added a commit that referenced this pull request Oct 29, 2021
* Revert "Update CTI ECS 1.11 fields (#113404)"
ecezalp pushed a commit to ecezalp/kibana that referenced this pull request Nov 15, 2021
* Update threatintel to threat

* Remove CTI mappings

* Update CTI_DATASET_KEY_MAP

* Update default threat index

* Change mapping to dataset

* Fix tests

* Fix tests

* Fix test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 1929f88)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:breaking Team: CTI Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants