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

[ti_opencti] OpenCTI integration #7385

Merged
merged 100 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
e9990c4
Initial commit of ti_opencti.
chrisberkhout Jun 29, 2023
8ca51ce
Fix cel program, add sys test, show vars.
chrisberkhout Jul 5, 2023
89b097d
Note about CEL encode_json() workaround.
chrisberkhout Jul 5, 2023
be482cc
Update graphql query.
chrisberkhout Aug 1, 2023
c8422a1
Add some initial field config.
chrisberkhout Aug 1, 2023
de760ba
Older start to ingest pipeline.
chrisberkhout Aug 1, 2023
4bb2110
Basic ingest pipeline.
chrisberkhout Aug 2, 2023
bca0014
A working pipeline.
chrisberkhout Aug 4, 2023
3ddb5e6
Basic mappings done, for indicator and observables and each observabl…
chrisberkhout Aug 14, 2023
51d9673
Delete obsolete system test data.
chrisberkhout Aug 14, 2023
22b5c62
Update CODEOWNERS.
chrisberkhout Aug 15, 2023
fafb2ab
Add responses for system test.
chrisberkhout Aug 22, 2023
e701440
Add pipeline tests.
chrisberkhout Aug 22, 2023
0b481e5
Fixes to make tests run without error.
chrisberkhout Aug 22, 2023
f0be31d
Rename pipeline test files to have test- prefix.
chrisberkhout Aug 23, 2023
0d90423
Rename input.yml.hbs to cel.yml.hbs.
chrisberkhout Aug 23, 2023
49ec839
Tidy whitespace.
chrisberkhout Aug 23, 2023
648da1a
Move state section with GraphQL query to the end.
chrisberkhout Aug 23, 2023
dfc3226
Switch to dynamic ECS mappings.
chrisberkhout Aug 24, 2023
0a79eef
Override expected values for some ECS fields, so validation passes du…
chrisberkhout Aug 24, 2023
f4868a7
Remove not necessary and not allowed expected_values fields.
chrisberkhout Aug 24, 2023
bfd2fc5
Match threat.indicator.confidence value to ECS expectations (Med->Med…
chrisberkhout Aug 24, 2023
9c2859b
Remove LICENSE.txt, to fall back to the default at the repo root.
chrisberkhout Aug 25, 2023
1744d75
Replace placeholder logo with OpenCTI logo.
chrisberkhout Aug 25, 2023
a8eedbb
Correct ecs.version field value.
chrisberkhout Aug 25, 2023
92375ea
Add a link to the GraphQL schema.
chrisberkhout Aug 25, 2023
72e1b0c
Remove commented-out fields from GraphQL query.
chrisberkhout Aug 25, 2023
c4901a0
Update pipeline tests expected results for correct ecs.version.
chrisberkhout Aug 25, 2023
c0953c6
For ECS, remove any subnet mask from IP values arriving in CIDR notat…
chrisberkhout Aug 25, 2023
e2c846e
Add descriptions for opencti fields.
chrisberkhout Aug 25, 2023
c5b909e
Update package manifest format version.
chrisberkhout Aug 28, 2023
cbf6d7a
Fill out draft PR number in changelog.
chrisberkhout Aug 28, 2023
ed020fe
Expanded GraphQL API info comment.
chrisberkhout Aug 28, 2023
598b115
Update field types for opencti fields.
chrisberkhout Aug 28, 2023
e1c840f
Move additional hash fields to ECS file since they're nested under th…
chrisberkhout Aug 28, 2023
3550e16
Fix related.hash to be one array, not separated out by hash algorithm.
chrisberkhout Aug 28, 2023
c9bef0c
Move opencti.* field definitions to their own file.
chrisberkhout Aug 28, 2023
9bd6fd8
Tolerate URLs that can't be parsed. e.g. '127.0.0.1:8080/path/'.
chrisberkhout Aug 29, 2023
17934ca
Extract file extensions from file names.
chrisberkhout Aug 30, 2023
a106737
Don't extract a drive_letter or directory from a directory path.
chrisberkhout Aug 30, 2023
0763152
Revert "Replace placeholder logo with OpenCTI logo."
chrisberkhout Aug 31, 2023
cba4aaf
Replace placeholder logo with OpenCTI logo (this time as an SVG).
chrisberkhout Aug 31, 2023
961490a
Remove config variable preserve_duplicate_custom_fields.
chrisberkhout Sep 1, 2023
b223a18
Update some fields.
chrisberkhout Sep 1, 2023
eda8b15
Combine and test kill chain fields.
chrisberkhout Sep 1, 2023
9a2b7fb
Merge opencti.observable.process.startup_info into one object, index …
chrisberkhout Sep 4, 2023
70f438c
Clean up createdBy after renaming the fields it contains.
chrisberkhout Sep 4, 2023
a37bf66
Don't keep description if it's empty or null.
chrisberkhout Sep 4, 2023
21eaaaa
Clean up related.* lists properly.
chrisberkhout Sep 4, 2023
d4ac86f
Set threat.indicator.reference using _conf.url.
chrisberkhout Sep 5, 2023
dd1298f
Clean up temporary variable usage: put them at the root with a _tmp p…
chrisberkhout Sep 5, 2023
126054d
Tidy.
chrisberkhout Sep 6, 2023
f90374c
Handle preserve_original_event in the CEL expression.
chrisberkhout Sep 6, 2023
9d8575f
Fix tags in pipeline tests.
chrisberkhout Sep 6, 2023
641f911
Rename placeholder screenshot.
chrisberkhout Sep 7, 2023
59ca00f
Tidy up manifest.yml files, options and option handling.
chrisberkhout Sep 7, 2023
201b7e6
Remove the workout for CEL's encode_json() on nested data, since the …
chrisberkhout Sep 7, 2023
64d7989
Improve CEL program.
chrisberkhout Sep 7, 2023
eb4b91e
Fix formatting.
chrisberkhout Sep 7, 2023
72334a7
Fix mix up of handlebars vs CEL variables.
chrisberkhout Sep 7, 2023
947be81
Bring back the CEL encode_json() workaround.
chrisberkhout Sep 8, 2023
2db6bc0
Remove the CEL encode_json() workaround.
chrisberkhout Sep 8, 2023
8877c7c
Remove handlebars template logic from CEL expression.
chrisberkhout Sep 11, 2023
39a0b57
Include generated sample event.
chrisberkhout Sep 11, 2023
e025dc9
README.
chrisberkhout Sep 13, 2023
aff28f1
Set the threat.indicator.url.full field.
chrisberkhout Sep 14, 2023
ea2c0f7
Allow Kibana 8.9.0 (also 8.9.0 is the minimum beats for CEL encode_js…
chrisberkhout Sep 14, 2023
40817b3
Add pipeline step to set ecs-indicator-detail tag.
chrisberkhout Sep 22, 2023
a42e050
Set value for threat.feed.dashboard_id.
chrisberkhout Sep 22, 2023
382caab
Bring back expected_values overrides for threat.indicator.{name,type}…
chrisberkhout Sep 22, 2023
c841ba6
Add dashboards.
chrisberkhout Sep 22, 2023
03c4150
Add screenshots (wide versions).
chrisberkhout Sep 25, 2023
6f95b15
Screenshots - narrow versions.
chrisberkhout Sep 25, 2023
6738c88
Screenshot of the "Add Integration" page on Fleet added.
chrisberkhout Sep 27, 2023
8a2ba3d
New expected_values workaround.
chrisberkhout Sep 28, 2023
e96705e
README: ECS fields doc.
chrisberkhout Sep 29, 2023
94b9706
Map created to event.created and leave @timestamp to receive its defa…
chrisberkhout Sep 29, 2023
9a269dc
Clean up timestamp documentation.
chrisberkhout Sep 29, 2023
b7949dc
Update dashboards to use logs-* and bring back controls.
chrisberkhout Sep 29, 2023
1e86a5d
Improve URL for linking to OpenCTI documentation.
chrisberkhout Sep 29, 2023
868c79e
README: Additional info about data models and approach to mapping.
chrisberkhout Sep 29, 2023
d72daab
Populate threat.indicator.url.* fields for domain-name and hostname i…
chrisberkhout Sep 29, 2023
21e55ba
Mark as secret the vars for api_key, oauth2 and ssl.
chrisberkhout Oct 2, 2023
c99c773
Version bump.
chrisberkhout Oct 2, 2023
2085e86
Update package manifest.yml to format_version 3.0.0.
chrisberkhout Oct 2, 2023
dd11be4
Ignore error 'expected filter in dashboard: no filter found', since i…
chrisberkhout Oct 2, 2023
6f6020b
Avoid failing pipeline benchmarks due to missing _conf.url field.
chrisberkhout Oct 2, 2023
43983e1
Revert "Mark as secret the vars for api_key, oauth2 and ssl."
chrisberkhout Oct 4, 2023
b3dab9d
ECS 8.10
chrisberkhout Oct 4, 2023
04fd9a7
Relocate redact config.
chrisberkhout Oct 4, 2023
6b6e0f9
Use triple curly brackets to access field values in template snippets.
chrisberkhout Oct 4, 2023
4caa5a8
Single-quote string to avoid escaping.
chrisberkhout Oct 4, 2023
daebeaf
Improved failure handler.
chrisberkhout Oct 5, 2023
6ec056a
Don't keep empty hash fields.
chrisberkhout Oct 5, 2023
a8499b6
Remove unused ad-hoc data views from dashboards.
chrisberkhout Oct 5, 2023
35b02f6
Switch opencti field definitions to be nested rather than flattened.
chrisberkhout Oct 6, 2023
1fcf229
Fix field type for hash group.
chrisberkhout Oct 9, 2023
c7bd854
Do clean up observable fieldsets and observable itself at the end of …
chrisberkhout Oct 9, 2023
ac3c516
Comment on which validation is excluded.
chrisberkhout Oct 12, 2023
50c5039
Fix typos.
chrisberkhout Oct 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
/packages/ti_cybersixgill @elastic/security-external-integrations
/packages/ti_maltiverse @elastic/security-external-integrations
/packages/ti_misp @elastic/security-external-integrations
/packages/ti_opencti @elastic/security-external-integrations
/packages/ti_otx @elastic/security-external-integrations
/packages/ti_rapid7_threat_command @elastic/security-external-integrations
/packages/ti_recordedfuture @elastic/security-external-integrations
Expand Down
2 changes: 2 additions & 0 deletions links_table.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ links:
observability-ingest-splunk: https://www.elastic.co/guide/en/observability/current/ingest-splunk.html
observability-monitor-azure: https://www.elastic.co/guide/en/observability/current/monitor-azure.html
packetbeat-exported-fields-tls: https://www.elastic.co/guide/en/beats/packetbeat/current/exported-fields-tls_detailed.html
security: https://www.elastic.co/guide/en/security/current/es-overview.html
security-detection-engine: https://www.elastic.co/guide/en/security/current/detection-engine-overview.html
security-ti-integrations: https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html
4 changes: 4 additions & 0 deletions packages/ti_opencti/_dev/build/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
ecs:
reference: [email protected]
import_mappings: true
68 changes: 68 additions & 0 deletions packages/ti_opencti/_dev/build/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# OpenCTI

The OpenCTI integration allows you to ingest data from the [OpenCTI](https://filigran.io/solutions/products/opencti-threat-intelligence/) threat intelligence platform.

Use this integration to get indicator data from OpenCTI. You can monitor and explore the ingested data on the OpenCTI dashboard or in Kibana's Discover tab. Indicator match rules in {{ url "security" "Elastic Security" }} can then use the ingested indicator data to generate alerts about detected threats.

## Data streams

The OpenCTI integration collects one type of data stream: logs.

**Logs** are lists of records created over time.
Each event in the log data stream collected by the OpenCTI integration is an indicator that can be used to detect suspicious or malicious cyber activity. The data is fetched from [OpenCTI's GraphQL API](https://docs.opencti.io/latest/deployment/integrations/#graphql-api).

## Requirements

This integration requires Filebeat version 8.9.0, or later.

It was developed using OpenCTI version 5.10.1.

## Setup

For additional information about threat intelligence integrations, including the steps required to add an integration, please refer to the {{ url "security-ti-integrations" "Enable threat intelligence integrations" }} page of the Elastic Security documentation.

When adding the OpenCTI integration, you will need to provide a base URL for the target OpenCTI instance. It should be just the base URL (e.g. `https://demo.opencti.io`) and not include an additional path for the API or UI.

The simplest authentication method to use is an API key (bearer token). You can find a value for the API key on your profile page in the OpenCTI user interface. Advanced integration settings can be used to configure various OAuth2-based authentication arrangements, and to enter SSL settings for mTLS authentication and for other purposes. For information on setting up the OpenCTI side of an authentication strategy, please refer to [OpenCTI's authentication documentation](https://docs.opencti.io/latest/deployment/authentication/).

## Logs

### Indicator

The `indicator` data stream includes indicators of the following types (`threat.indicator.type`): `artifact`, `autonomous-system`, `bank-account`, `cryptocurrency-wallet`, `cryptographic-key`, `directory`, `domain-name`, `email-addr`, `email-message`, `email-mime-part-type`, `hostname`, `ipv4-addr`, `ipv6-addr`, `mac-addr`, `media-content`, `mutex`, `network-traffic`, `payment-card`, `phone-number`, `process`, `software`, `file`, `text`, `url`, `user-account`, `user-agent`, `windows-registry-key`, `windows-registry-value-type`, `x509-certificate`, `unknown`.

OpenCTI's data model closely follows the [STIX standard](https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html). It supports complex indicators defined using STIX patterns or other languages, and each indicator can be related to one or more observables. In the [ECS threat fields](https://www.elastic.co/guide/en/ecs/current/ecs-threat.html) the focus is on atomic indicators. This integration fetches as much data as possible about indicators and their related observables, and populates relevant ECS fields wherever possible. It uses related observables rather than the indicator pattern as the data source for type-specific indicator fields.

#### Example

Here is an example `indicator` event:

{{event "indicator"}}

#### Exported fields

Fields for indicators of any type are mapped to ECS fields when possible (primarily `threat.indicator.*`) and otherwise stored with a vendor prefix (`opencti.indicator.*`).

Fields for related observables of the various types are always stored under `opencti.observable.<type>.*` and when possible their values will be copied into corresponding ECS fields.

The `related.*` fields will also be populated with any relevant data.

Timestamps are mapped as follows:

| Source | Destination | Description |
|-------------|-------------------------------|-------------|
| - | @timestamp | Time the event was received by the pipeline |
| - | event.ingested | Time the event arrived in the central data store |
| created | event.created | Time of the indicator's creation |
| modified | threat.indicator.modified_at | Time of the indicator's last modification |
| valid_from | opencti.indicator.valid_from | Time from which this indicator is considered a valid indicator of the behaviors it is related to or represents |
| valid_until | opencti.indicator.valid_until | Time at which this indicator should no longer be considered a valid indicator of the behaviors it is related to or represents |

The table below lists all `opencti.*` fields.

The documentation for ECS fields can be found at:
- [ECS Event Fields](https://www.elastic.co/guide/en/ecs/current/ecs-event.html)
- [ECS Threat Fields](https://www.elastic.co/guide/en/ecs/current/ecs-threat.html)
- [ECS Related Fields](https://www.elastic.co/guide/en/ecs/current/ecs-related.html)

{{fields "indicator"}}
14 changes: 14 additions & 0 deletions packages/ti_opencti/_dev/deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "2.3"
services:
opencti_stub:
image: docker.elastic.co/observability/stream:v0.10.0
ports:
- 8080
volumes:
- ./files:/files:ro
environment:
PORT: 8080
command:
- http-server
- --addr=:8080
- --config=/files/config.yml
Loading