Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
40a97f7
Temporaily Disable Changed FIles Workflow (#4538)
eric-forte-elastic Mar 15, 2025
2ff8d1b
Add new ML detection rules for Privileged Access Detection (#4516)
sodhikirti07 Mar 19, 2025
5b3dc4a
Revert "Add new ML detection rules for Privileged Access Detection (#…
eric-forte-elastic Mar 20, 2025
5ccb7ed
Min stack rules from 4516 (#4549)
eric-forte-elastic Mar 20, 2025
28a06fd
Update defense_evasion_posh_assembly_load.toml (#4543)
Samirbous Mar 20, 2025
955e973
Change description and name of problemchild ML detection-rules (#4545)
sodhikirti07 Mar 20, 2025
059d7ef
Prep for Release 9.0 (#4550)
shashank-elastic Mar 20, 2025
cd9ec78
[ci] Add new docs-builder automation. (#4507)
Mpdreamz Mar 20, 2025
75b2b5c
[FR] Bump changed-files Version to Patched Version (#4542)
eric-forte-elastic Mar 20, 2025
db78756
[New Rule] Adding Coverage for DynamoDB Exfiltration Behaviors (#4535)
terrancedejesus Mar 21, 2025
65170c3
fix: removing outdated code in Kibana client auth (#4495)
traut Mar 24, 2025
3bbe24d
Create new detection rule set documentation to be included in the new…
Mpdreamz Mar 24, 2025
5e12f05
fixing double header in investigation notes (#4490)
terrancedejesus Mar 25, 2025
2d2c5b4
[Bug] Update Custom Rules Markdown Location (#4565)
eric-forte-elastic Mar 26, 2025
e8c5416
Prep main for 9.1 (#4555)
shashank-elastic Mar 26, 2025
63c1f47
[Rule Tuning] Added OWA (outlook for web) new AppID (#4568)
BugOrFeature Mar 26, 2025
2b3095a
Update Max signals value to supported limits (#4556)
shashank-elastic Mar 27, 2025
51826ed
Update ATT&CK coverage URL(s) in docs-dev/ATT&CK-coverage.md (#4571)
github-actions[bot] Mar 27, 2025
2f3f4fb
deprecating 'Azure Virtual Network Device Modified or Deleted' (#4559)
terrancedejesus Mar 27, 2025
2801406
tuning 'Azure Conditional Access Policy Modified' (#4558)
terrancedejesus Mar 27, 2025
c6e37d6
[Rule Tuning] Tuning Illicit Grant Consent Detections in Azure and M3…
terrancedejesus Mar 27, 2025
6d8cfda
Update defense_evasion_microsoft_defender_tampering.toml (#4573)
Samirbous Apr 1, 2025
e7806fc
[Rule Tuning] O365 Exchange Suspicious Mailbox Right Delegation (#4589)
w0rk3r Apr 2, 2025
8bb5e24
Update docset.yml (#4590)
Mikaayenson Apr 3, 2025
d4b2a35
[New] Unusual Network Connection to Suspicious Web Service (#4569)
DefSecSentinel Apr 3, 2025
753e8d8
[New] Unusual Network Connection to Suspicious Top Level Domain (#4563)
DefSecSentinel Apr 3, 2025
9577d53
[Rule Tuning] Add Host Metadata to ES|QL Aggregation Rules (#4592)
w0rk3r Apr 7, 2025
3966981
Add investigation guides (#4600)
shashank-elastic Apr 7, 2025
a5d9d64
[Rule Tuning] Suspicious Execution via Scheduled Task (#4599)
w0rk3r Apr 7, 2025
fbddc2e
Lock versions for releases: 8.14,8.15,8.16,8.17,8.18,9.0 (#4601)
github-actions[bot] Apr 8, 2025
05c9f6b
[FN Tuning] Shared Object Created or Changed by Previously Unknown Pr…
Aegrah Apr 8, 2025
3b1f780
[D4C Conversion] Converting Compatible D4C Rules to DR (#4532)
Aegrah Apr 10, 2025
595d204
Remove Task List reference (#4605)
shashank-elastic Apr 15, 2025
108b64f
[FR] Update Detection Rules MITRE Workflow to SHA Pin (#4581)
eric-forte-elastic Apr 15, 2025
ea7de82
[FR] Add Kibana Action Connector Error to Exception List Workaround (…
eric-forte-elastic Apr 15, 2025
3eed0f5
[Rule Tuning] SSH Authorized Keys File Deletion (#4591)
w0rk3r Apr 15, 2025
e11fe78
[Rule Tuning] Suspicious WMI Event Subscription Created (#4618)
w0rk3r Apr 16, 2025
1a6669e
[Rule Tuning] Adjusting `Microsoft Entra ID Rare Authentication Requi…
terrancedejesus Apr 16, 2025
ba16e27
[Rule Tuning] Tuning `Azure Service Principal Credentials Added` (#4570)
terrancedejesus Apr 16, 2025
033c828
[FR] Add Support for Local Dates Flag (#4582)
eric-forte-elastic Apr 16, 2025
9b682b7
Feature exclude tactic name (#4593)
frederikb96 Apr 16, 2025
4cbf010
Merge remote-tracking branch 'upstream/main' into upstream_merge_16_a…
r0ot Apr 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/new_meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ body:
- type: textarea
attributes:
label: Tasking
value: "```[tasklist]\n### Meta Tasks\n- [ ] Provide Week 1 Update Comment\n- [ ] Provide Week 2 Update or Closeout Comment\n```"
value: "\n### Meta Tasks\n- [ ] Provide Week 1 Update Comment\n- [ ] Provide Week 2 Update or Closeout Comment\n"
render:

- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/attack-coverage-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
git add docs-dev/"ATT\&CK-coverage.md"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.3
uses: peter-evans/create-pull-request@6cd32fd93684475c31847837f87bb135d40a2b79 # v7.0.3
with:
assignees: '${{github.actor}}'
delete-branch: true
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: docs-build

on:
push:
branches:
- main
pull_request_target: ~

jobs:
preview:
uses: elastic/docs-builder/.github/workflows/preview-build.yml@main
with:
continue-on-error: false
strict: true
path-pattern: |
docs/**
rules/**
rules_building_block/**
permissions:
deployments: write
id-token: write
contents: read
pull-requests: read
14 changes: 14 additions & 0 deletions .github/workflows/docs-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: docs-cleanup

on:
pull_request_target:
types:
- closed

jobs:
preview:
uses: elastic/docs-builder/.github/workflows/preview-cleanup.yml@main
permissions:
contents: none
id-token: write
deployments: write
2 changes: 1 addition & 1 deletion .github/workflows/kibana-mitre-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Get MITRE Attack changed files
id: changed-attack-files
uses: tj-actions/changed-files@v44
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
with:
files: detection_rules/etc/attack-v*.json.gz

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lock-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
description: 'List of branches to lock versions (ordered, comma separated)'
required: true
# 7.17 was intentionally skipped because it was added late and was bug fix only
default: '8.12,8.13,8.14,8.15,8.16,8.17'
default: '8.14,8.15,8.16,8.17,8.18,9.0'

jobs:
pr:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Unit Tests

on:
push:
branches: [ "main", "7.*", "8.*" ]
branches: [ "main", "7.*", "8.*", "9.*" ]
pull_request:
branches: [ "*" ]

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/react-tests-dispatcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
- '!rules/integrations/o365/*.toml'
- '!rules/integrations/okta/*.toml'
- '!rules/integrations/problemchild/*.toml'
- '!rules/integrations/pad/*.toml'

jobs:
dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version-code-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
git push origin "dev-v$version"

- name: Run Release Drafter
uses: release-drafter/release-drafter@v6
uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
with:
config-name: release-drafter.yml
env:
Expand Down
4 changes: 3 additions & 1 deletion CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ Options:
-e, --overwrite-exceptions Overwrite exceptions in existing rules
-ac, --overwrite-action-connectors
Overwrite action connectors in existing rules
-nt, --no-tactic-filename Allow rule filenames without tactic prefix. Use this if rules have been exported with this flag.
-h, --help Show this message and exit.
```

Expand Down Expand Up @@ -481,7 +482,7 @@ Options:

### Exporting rules

This command should be run with the `CUSTOM_RULES_DIR` envvar set, that way proper validation is applied to versioning when the rules are downloaded. See the [custom rules docs](docs-dev/custom-rules.md) for more information.
This command should be run with the `CUSTOM_RULES_DIR` envvar set, that way proper validation is applied to versioning when the rules are downloaded. See the [custom rules docs](docs-dev/custom-rules-management.md) for more information.

```
python -m detection_rules kibana export-rules -h
Expand Down Expand Up @@ -520,6 +521,7 @@ Options:
-e, --export-exceptions Include exceptions in export
-s, --skip-errors Skip errors when exporting rules
-sv, --strip-version Strip the version fields from all rules
-nt, --no-tactic-filename Exclude tactic prefix in exported filenames for rules. Use same flag for import-rules to prevent warnings and disable its unit test.
-h, --help Show this message and exit.

```
Expand Down
27 changes: 15 additions & 12 deletions detection_rules/cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
dict_filter)
from .schemas import definitions
from .utils import clear_caches, rulename_to_filename
from .config import parse_rules_config

RULES_CONFIG = parse_rules_config()


def single_collection(f):
Expand Down Expand Up @@ -66,11 +69,15 @@ def multi_collection(f):
@click.option("--directory", "-d", multiple=True, type=click.Path(file_okay=False), required=False,
help="Recursively load rules from a directory")
@click.option("--rule-id", "-id", multiple=True, required=False)
@click.option("--no-tactic-filename", "-nt", is_flag=True, required=False,
help="Allow rule filenames without tactic prefix. "
"Use this if rules have been exported with this flag.")
@functools.wraps(f)
def get_collection(*args, **kwargs):
rule_id: List[str] = kwargs.pop("rule_id", [])
rule_files: List[str] = kwargs.pop("rule_file")
directories: List[str] = kwargs.pop("directory")
no_tactic_filename: bool = kwargs.pop("no_tactic_filename", False)

rules = RuleCollection()

Expand Down Expand Up @@ -99,7 +106,10 @@ def get_collection(*args, **kwargs):
for rule in rules:
threat = rule.contents.data.get("threat")
first_tactic = threat[0].tactic.name if threat else ""
rule_name = rulename_to_filename(rule.contents.data.name, tactic_name=first_tactic)
# Check if flag or config is set to not include tactic in the filename
no_tactic_filename = no_tactic_filename or RULES_CONFIG.no_tactic_filename
tactic_name = None if no_tactic_filename else first_tactic
rule_name = rulename_to_filename(rule.contents.data.name, tactic_name=tactic_name)
if rule.path.name != rule_name:
click.secho(
f"WARNING: Rule path does not match required path: {rule.path.name} != {rule_name}", fg="yellow"
Expand Down Expand Up @@ -210,18 +220,11 @@ def rule_prompt(path=None, rule_type=None, required_only=True, save=True, verbos
# DEFAULT_PREBUILT_RULES_DIRS[0] is a required directory just as a suggestion
suggested_path = Path(DEFAULT_PREBUILT_RULES_DIRS[0]) / contents['name']
path = Path(path or input(f'File path for rule [{suggested_path}]: ') or suggested_path).resolve()
# Inherit maturity from the rule already exists
maturity = "development"
if path.exists():
rules = RuleCollection()
rules.load_file(path)
if rules:
maturity = rules.rules[0].contents.metadata.maturity

# Inherit maturity and optionally local dates from the rule if it already exists
meta = {
"creation_date": creation_date,
"updated_date": creation_date,
"maturity": maturity,
"creation_date": kwargs.get("creation_date") or creation_date,
"updated_date": kwargs.get("updated_date") or creation_date,
"maturity": "development" or kwargs.get("maturity"),
}

try:
Expand Down
5 changes: 5 additions & 0 deletions detection_rules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class RulesConfig:
exception_dir: Optional[Path] = None
normalize_kql_keywords: bool = True
bypass_optional_elastic_validation: bool = False
no_tactic_filename: bool = False

def __post_init__(self):
"""Perform post validation on packages.yaml file."""
Expand Down Expand Up @@ -311,6 +312,10 @@ def parse_rules_config(path: Optional[Path] = None) -> RulesConfig:
if contents['bypass_optional_elastic_validation']:
set_all_validation_bypass(contents['bypass_optional_elastic_validation'])

# no_tactic_filename
contents['no_tactic_filename'] = loaded.get('no_tactic_filename', False)

# return the config
try:
rules_config = RulesConfig(test_config=test_config, **contents)
except (ValueError, TypeError) as e:
Expand Down
2 changes: 1 addition & 1 deletion detection_rules/custom_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .utils import ROOT_DIR, get_etc_path, load_etc_dump

DEFAULT_CONFIG_PATH = Path(get_etc_path('_config.yaml'))
CUSTOM_RULES_DOC_PATH = Path(ROOT_DIR).joinpath(REPO_DOCS_DIR, 'custom-rules.md')
CUSTOM_RULES_DOC_PATH = Path(ROOT_DIR).joinpath(REPO_DOCS_DIR, 'custom-rules-management.md')


@root.group('custom-rules')
Expand Down
5 changes: 5 additions & 0 deletions detection_rules/etc/_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ normalize_kql_keywords: False
# If set in this file, the path should be relative to the location of this config. If passed as an environment variable,
# it should be the full path
# Note: Using the `custom-rules setup-config <name>` command will generate a config called `test_config.yaml`

# To prevent the tactic prefix from being added to the rule filename, set the line below to True
# This config line can be used instead of specifying the `--no-tactic-filename` flag in the CLI
# Mind that for unit tests, you also want to disable the filename test in the test_config.yaml
# no_tactic_filename: True
Loading
Loading