Commit Graph

159 Commits

Author SHA1 Message Date
Justin Ibarra 1b32a137f7 Update elasticsearch dependency to 8.1 (#1911)
(cherry picked from commit ad99c6b489)
2022-04-06 19:54:55 +00:00
Justin Ibarra 3311168e28 Expand timestamp override tests (#1907)
* Expand timestamp_override tests
* removed timestamp_override from eql sequence rules
* add config entry for eql rules with beats index and t_o
* add timestamp_override to missing fields

Removed changes from:
- rules/cross-platform/impact_hosts_file_modified.toml
- rules/windows/credential_access_lsass_memdump_file_created.toml
- rules/windows/defense_evasion_adding_the_hidden_file_attribute_with_via_attribexe.toml
- rules/windows/defense_evasion_execution_lolbas_wuauclt.toml
- rules/windows/defense_evasion_suspicious_certutil_commands.toml
- rules/windows/execution_command_shell_started_by_svchost.toml

(selectively cherry picked from commit 6bdfddac8e)
2022-04-01 23:29:22 +00:00
Terrance DeJesus 4d9124aaf7 Prep for Creation of 8.3 Branch (#1906)
* updating with changes for 8.3 prep
* adding updates
* adjusted version in packages.yml

Removed changes from:
- etc/packages.yml

(selectively cherry picked from commit 648daf1237)
2022-04-01 21:35:45 +00:00
Terrance DeJesus 16fa48b56d added comprehensive timeline template definitions (#1905)
(cherry picked from commit e72031a71a)
2022-04-01 16:54:20 +00:00
Justin Ibarra 1dc901ba09 reset evasion rules (#1902)
(cherry picked from commit 5214209f8d)
2022-03-29 23:50:21 +00:00
Justin Ibarra 22945ed97b [Bug] Fix bug in version_lock.py (#1880)
(cherry picked from commit 17ef6c558c)
2022-03-24 23:43:37 +00:00
Justin Ibarra 37419d94e7 Prevent changes to rule type for locked rules (#1855)
* add rule type to the rule lock_info
* add check in VersionLock; add type to version.lock
* print changes only on save

(cherry picked from commit 11ec9c230e)
2022-03-24 19:58:51 +00:00
Justin Ibarra 742c3c49c8 [Bug] Version bump with previous (#1870)
* save changes to top level for route C; verbose prints
* update top level on forked rule without overriding min_stack_version
* add check to ensure previous version !> current

(cherry picked from commit f4c94af994)
2022-03-24 19:14:36 +00:00
Mika Ayenson 4e97631893 1554 update eql schemas to fail validation on text fields (#1866)
* Ensure kql2eql conversion doesnt support `text` fields

* Add unit test cases for`text` not supported in eql

* test `field not recognized` in the rule_validator and output a verbose message.

* use elasticsearch_type_family to lookup text mappings

Co-authored-by: Justin Ibarra <brokensound77@users.noreply.github.com>

(cherry picked from commit 1f015ebe85)
2022-03-23 20:28:03 +00:00
Mika Ayenson a951b99c13 update beats master branch ref to main (#1853)
* update beats master branch ref to main

* update filename of master beat schema to main

* delete old main beats schema

* rebuilt main beats archive

(cherry picked from commit 84b7ce6582)
2022-03-18 14:09:10 +00:00
Justin Ibarra 6120265ba4 [Github Workflows] Only generate navigator files on push to main (#1814)
* [Github Workflows] Only generate navigator files on push to main

* fix workflow logic syntax

(cherry picked from commit 6653acb21c)
2022-03-04 18:57:38 +00:00
Justin Ibarra 2faed44215 Replace * in navigator filenames (#1813)
(cherry picked from commit bb105a3c43)
2022-03-04 17:48:46 +00:00
Justin Ibarra 5a630dd61d Generate ATT&CK navigator layer files and links (#1787)
* Generate attack layer files and build with package
* add update-navigator-gists command
* add workflow to update navigator gists on pushes to main
* Add coverage readme
* fix keys for links
* update navigator layer names
* purge gist files prior to update; add badge
* Update how the navigator links are displayed
* moved navigator code to dedicated and refactored to dataclasses
* convert gist links to permalink versions
* alphabetize; catch 404 for gist update

(cherry picked from commit 254b4eb23f)
2022-03-04 17:23:14 +00:00
Justin Ibarra 4397244f73 Refresh ATT&CK to v10.1 (#1791)
(cherry picked from commit a5eb02ac28)
2022-02-25 01:40:49 +00:00
Justin Ibarra ca5f2d4018 Ensure github module is installed before running PR commands (#1777)
* Ensure github module is installed before running PR commands

* move go and elastic-package assertions to top of command

* update error msg for missing pkg

* remove redundant github assertion

Co-authored-by: Colson Wilhoit <48036388+DefSecSentinel@users.noreply.github.com>

(cherry picked from commit d373db7659)
2022-02-24 23:51:24 +00:00
Mika Ayenson 775779c756 [Bug] Fix toml-lint ordering of Mitre metadata #1249 (#1774)
* Order the MITRE metadata by recursively sorting the rule object before writing.

* Refactor order_rule into the rule_formatter module.

* sort test_toml.json according to rule_formatter spec

* rename var to obj since this will traverse all data in the rule

Co-authored-by: Justin Ibarra <brokensound77@users.noreply.github.com>

(cherry picked from commit 0aeb7399d4)
2022-02-22 19:00:16 +00:00
Colson Wilhoit 04f1a08824 Prep for creation of 8.2 branch (#1762)
Removed changes from:
- etc/packages.yml

(selectively cherry picked from commit e0dda91f26)
2022-02-09 03:46:26 +00:00
Justin Ibarra bd826ceeb3 [Bug] Fix AttributeError in RuleCollection dupe check (#1747)
(cherry picked from commit 2828633919)
2022-02-01 01:00:08 +00:00
Justin Ibarra 71ac505580 Autogenerate docs for integration package releases (#1567)
* Autogenerate docs for integration package releases
* add parameter to bypass query validation in git loader
* strip space and - from normalized name

(cherry picked from commit 1f216d12aa)
2022-01-27 06:21:17 +00:00
Justin Ibarra bcdadbeabc Update base branch in integrations-pr command (#1733)
(cherry picked from commit e26374cb40)
2022-01-27 05:54:34 +00:00
Justin Ibarra 8b66823350 (manually cherry picked from commit 2e78da5c9a) 2022-01-25 18:49:15 -09:00
Justin Ibarra d753ecb8d8 Add pattern for "name" in rule schema (#1669) 2022-01-25 12:03:27 -09:00
Justin Ibarra bd9e33e761 [bug] Current stack version in deprecation lock missing parens (#1618)
The function was not being properly called, leading to `null` values
2021-11-16 00:18:27 -09:00
Justin Ibarra 76503e8bcd Fix kibana-pr command (#1616) 2021-11-15 23:55:05 -09:00
Justin Ibarra 95d7e9b6f5 Prepare for creation of 7.16 release branch (#1611) 2021-11-15 09:39:34 -09:00
Justin Ibarra 0efae3a52e Move version lock code to object for portability (#1553)
* Move version lock code to object for portability
* use cached_property to bypass frozen dataclass and set property
* replace load_versions function
2021-11-15 08:46:12 -09:00
Justin Ibarra 5e6a58ebab Add index as a required field to rule_prompt (#1595) 2021-11-14 17:05:42 -09:00
Justin Ibarra d12c04761f Add support for eql-wildcard and kql-match_only_text (#1583)
* Add support for eql-wildcard and kql-match_only_text
* bump kql version
* lookup elasticsearch type family prior to getting type hint
Co-authored-by: David French <56409778+threat-punter@users.noreply.github.com>
2021-10-28 08:57:43 -05:00
Justin Ibarra ab17dfcc28 [Bug] Tighten definitions validation patterns (#1396)
* [Bug] Anchor validation patterns
* Deprecate rule with invalid rule_id and duplicate as new one

Co-authored-by: Ross Wolf <31489089+rw-access@users.noreply.github.com>
2021-10-26 10:26:20 -05:00
Justin Ibarra 5a69ceb0c5 Add test for improper rule demotion (released production -> development) (#1555) 2021-10-19 21:47:36 -08:00
Justin Ibarra 5bdf70e72c Add min_stack_comments to metadata schema (#1573)
* Add min_stack_comments to metadata schema
2021-10-19 20:52:53 -08:00
Justin Ibarra 7179942be3 Allow CLi config to be multiple formats (#1485) 2021-09-15 20:12:39 -08:00
Justin Ibarra 5b24eca0bc [Bug] CLI Fixes (#1073)
* add support for self-signed certs in es and kibana
* allow Kibana to auth against any providerType
* fix export-rules command
* fix kibana upload-rule command
* fix view-rule command
* fix validate-rule command
* fix search-rules command
* fix dev kibana-diff command
* fix dev package-stats command
* fix dev search-rule-prs command
* fix dev deprecate-rule command
* replace toml with pytoml to fix import-rules command
* use no_verify in get_kibana_client
* use Path for rule-file type in view-rule
* update schemas to resolve additionalProperties type bug
* fix missing unique_fields in package rule filter
* fix github pr loader
* Load gh rules as TOMLRule instead of dict
* remove unnecessary version insertion
2021-09-10 10:06:04 -08:00
David French 90aa65aed3 Generate detection rule to alert on traffic to typosquatting/homonym domains (#1199)
* create new cli commands

* add kibana object to create_dnstwist_rule

* Adding code for index-dnstwist-results

* Changed es to es_client

* Tested. it works!

* flake8-ed

* Adding timestamps

* use eql.utils.load_dump to load json file

* rename data to dnstwist_data

* start working on create-dnstwist-rule command

* add print statements for user

* tweak formatting for line length

* add template threat match rule file

* continue working on threat match rule creation

* create rule using TomlRuleContents

* save rule to toml file

* Moving rule creation to eswrap.py

* Moving create dnstwist rule stuff to eswrap

* Fixed imports

* flake8 fixes

* More flake8 fixes

* fix usage of @add_client('kibana')

* use ctx.invoke to upload rule

* cleanup record assembly and use bulk api

* swap order of notes in `note` for sample rule

* small modifications

* move command to root click group

* remove unused click group

* Update detection_rules/main.py

Co-authored-by: Justin Ibarra <brokensound77@users.noreply.github.com>

* remove rule upload and convert template to ndjson

* Adding docs for typosquatting rule

* renaming the file

* Adding a note

* separate index and rule prep commands

* Final changes

Co-authored-by: Apoorva <appujo@gmail.com>
Co-authored-by: brokensound77 <brokensound77@users.noreply.github.com>
Co-authored-by: Apoorva Joshi <30438249+ajosh0504@users.noreply.github.com>
2021-09-03 13:35:59 -07:00
Justin Ibarra 7710e2b798 Add DeprecatedCollection to RuleCollection to bypass validation (#1454)
* Add DeprecatedCollection to RuleCollection to bypass validation
* use DeprecatedRule properties in RuleCollection
* use RuleCollection filter for max/min filtering in Package
2021-09-01 15:29:53 -08:00
Justin Ibarra 9d10458be4 [Bug] RuleTOMLContents.to_dict serialize with proper schema (#1460) 2021-08-31 21:06:14 -08:00
Ross Wolf 7b8b18cb20 Update main to point to 7.16 (#1457)
* Update main to point to 7.16
* Add 7.16 -> 7.15 migration
* Update stack-schema-map
* Update conditions.kibana.version
2021-08-26 14:23:55 -06:00
Ross Wolf 4adad703fc [CI] Add GitHub actions workflow to lock versions across branches (#1456)
* Start job to lock versions
* Update lock-versions workflow
* Call lock-multiple script
* Fix script
* Add the lock file to staging
* pass branches to the job
* Fetch all branches and tags
* Push the branch first
* Push with upstream
* Change PR params
* Remove protections machine token
* Add 7.14.0 to the lock for min_stack_version=7.14.0
* Fix branch prefix
* Add trailing newline
* Trailing newline
* Restrict to main branch
2021-08-26 14:17:34 -06:00
Ross Wolf 0d47cb324a Track multiple stacks in lock (#1434)
* Save the stack versions in the lock file
* Support tracking of multiple stacks in the lock
* Update the version locking logic
* Fix bugs and test lock file
* Restore version lock
* Fix lint errors
* Call both click.echo and verbose echo separately
* Change when the change_rules message is output
2021-08-24 16:56:11 -06:00
Ross Wolf 11c443ba26 Fix encoding of 'Any' type in jsonschema (#1438) 2021-08-19 10:15:21 -06:00
Justin Ibarra 2d517432e3 Bump package versions (#1418)
* Bump package versions
* Add 7.14 migration; use master schema map if one does not exist
* add test to ensure an entry exists in the stack-schema-map for the current package version

Co-authored-by: Ross Wolf <31489089+rw-access@users.noreply.github.com>
2021-08-18 21:25:53 -08:00
Ross Wolf d647c7b809 Skip etc/packages.yml from backport: auto (#1437) 2021-08-18 16:55:21 -06:00
Christian Clauss ddec37b731 Fix typos discovered by codespell (#1430) 2021-08-14 20:29:10 -08:00
Justin Ibarra 95486ecfdf [Bug] Flatten method improperly added subtechniques (#1404) 2021-08-05 11:15:07 -08:00
Ross Wolf 17bf3c1e16 Add RuleCollection.load_git_branch (#1403) 2021-08-05 01:15:39 -06:00
Ross Wolf 92937a1ad1 [CI] Fix kibana PR command again (#1386) 2021-07-27 16:29:50 -06:00
Ross Wolf 64977b01bd Fix kibana_pr for click.Context (#1385) 2021-07-27 16:03:28 -06:00
Justin Ibarra 7759fa2500 Ensure EQL rules with maxspan have a long enough lookback window (#1361)
* Add the following properties to EQLRuleData:
   - max_span
   - look_back
   - interval_ratio

* Add the following tests:
   - test_eql_lookback
   - test_eql_interval_to_maxspan

Co-authored-by: Ross Wolf <31489089+rw-access@users.noreply.github.com>
2021-07-22 13:53:13 -08:00
Ross Wolf 5ba1c26cf1 Fix metadata.extended (#1377) 2021-07-22 10:29:30 -06:00
Ross Wolf 1882f4456c [Fleet] Track integrations in folder and metadata (#1372)
* Track integrations in folder and metadata
* Remove duplicate entry
* Update note and tests
2021-07-21 15:24:56 -06:00