Feature exclude tactic name#4593
Conversation
|
👋 Thanks for the PR and suggestion! A few other things that we should think about and/or address is that we have a unit test that our users would want to bypass if this approach. This can be done if adding the following bypass line to the Additionally, even with this test we have a warning message as part of the loading of rules in a RuleCollection that will warn that the name does not match. To test this, you can use any of the commands that load our rules into a RulesCollection, but for DaC testing specifically you can use something like the following: You may want to consider adding this as a configuration option that will disable this warning if used. Also, we should add this functionality to |
3403612 to
24041fa
Compare
|
Thank you very much for the swift reply and suggestions. I really appreciate it 🙂 I added some commits to also implement the same flag for the import to prevent the warning. Moreover, I adjusted the help texts and the CLI.md to include the info about the unit test. About the parity with import-rules-to-repo. I guess they dont use the tactic at all so far or am I wrong, here the code. So I would just keep it as it is. I hope I got all your points :) |
|
@frederikb96 Happy to, this is a great PR 🚀 A few notes, could you bump the patch version in the pyproject.toml? And yes you are correct with the parity that field is not available so you would already have achived parity 🙂, so there is no need to have an argument for import-rules-to-repo. Also, the multi-collection cli argument may not be needed, but that would depend on the implementation to allow for config support. Typically, for broader changes like this we would have an value in detection-rules/detection_rules/config.py Lines 175 to 195 in 753e8d8 Additionally, we would need to update the One last thing, if you could add the functionality to disable the warning message that would be great! (see below for where it checks for the naming convention) detection-rules/detection_rules/cli_utils.py Lines 103 to 106 in 753e8d8 Also, to check for linting issues (there appear to be some) you can use |
|
@eric-forte-elastic Thanks again, that was a great hint. Way nicer with the config option 👍 I adjusted again:
|
|
@eric-forte-elastic Anything else or would it be ready to merge? :) |
This looks really good, will run some tests and put results here, but otherwise looks good to me 👍 |
|
@frederikb96 I think you may need to update the pyproject toml for the required patch version bump. |
|
@eric-forte-elastic Ah yes, already bumped it once, but in the meantime there was an update on main, so bumped it again now 🙂 |
Mikaayenson
left a comment
There was a problem hiding this comment.
👋 Thanks for the contribution!
eric-forte-elastic
left a comment
There was a problem hiding this comment.
This looks very good! Going to go head and merge this on your behalf @frederikb96 so that we can get this in without having to go back and forth bumping the toml version again 😂
Yes nice, thanks 😊 😄 |
* Temporaily Disable Changed FIles Workflow (elastic#4538) * Temporaily Disable Changed FIles Workflow * bump version * Add new ML detection rules for Privileged Access Detection (elastic#4516) Add detection-rules for privileged access detection integration * Revert "Add new ML detection rules for Privileged Access Detection (elastic#4516)" (elastic#4548) This reverts commit 2ff8d1b. * Min stack rules from 4516 (elastic#4549) * Update defense_evasion_posh_assembly_load.toml (elastic#4543) Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com> * Change description and name of problemchild ML detection-rules (elastic#4545) Changed description and name of problemchild ML detection-rules * Prep for Release 9.0 (elastic#4550) * [ci] Add new docs-builder automation. (elastic#4507) * Add new docs automation * Add path-pattern filters for documentation folders * Update .github/workflows/docs-build.yml Co-authored-by: Jan Calanog <nejcalanog@gmail.com> --------- Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> Co-authored-by: Jan Calanog <nejcalanog@gmail.com> Co-authored-by: Sergey Polzunov <traut@users.noreply.github.com> * [FR] Bump changed-files Version to Patched Version (elastic#4542) * Bump changed-files Version to Patched Version * patch bump * reenable workflow * Use full length commit hash * Bump 44 to 46 --------- Co-authored-by: shashank-elastic <91139415+shashank-elastic@users.noreply.github.com> * [New Rule] Adding Coverage for DynamoDB Exfiltration Behaviors (elastic#4535) * new rules for AWS DynamoDB data exfiltration * bumping patch version * adjusting investigation guide * updating patch version * updating patch version * updating patch version --------- Co-authored-by: Colson Wilhoit <48036388+DefSecSentinel@users.noreply.github.com> * fix: removing outdated code in Kibana client auth (elastic#4495) * Simplify kibana session management * Drop removed options from `kibana_args` set * Style fix * Patch version bump * Bumping kibana lib version * Relax CLI requirement, making `api_key` optional, to allow `help` to run * Create new detection rule set documentation to be included in the new docs. (elastic#4508) * move docs folder to docs-dev * Add new docs folder * update docset.yml to reflect latest usage * Add rules_building_block folder * revert changes to docs-dev/experimental-machine-learning/url-spoof.md * bump patch versions * revert bump --------- Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> * fixing double header in investigation notes (elastic#4490) * [Bug] Update Custom Rules Markdown Location (elastic#4565) * Update to custom-rules markdown location * bump version * Update link reference * Prep main for 9.1 (elastic#4555) * Prep for Release 9.1 * Update Patch Version * Update Patch version * Update Patch version * [Rule Tuning] Added OWA (outlook for web) new AppID (elastic#4568) * Added OWA (outlook for web) new AppID **Title:** Add new Outlook for Web AppID to abnormal Microsoft 365 ClientAppID rule **Description:** This pull request updates the `initial_access_microsoft_365_abnormal_clientappid` rule to include the newly introduced Outlook for Web AppID: - **New AppID**: `9199bf20-a13f-4107-85dc-02114787ef48` ### Context Outlook for Web (OWA) is migrating to a new authentication platform using MSAL and a Single Page Application (SPA) auth model. As part of this backend change, Microsoft is replacing the existing OWA AppID with a new one. This change is being rolled out during the first half of calendar year 2024, with full deployment expected by Q4 2024. - **Old OWA AppID**: `00000002-0000-0ff1-ce00-000000000000` - **New OWA AppID**: `9199bf20-a13f-4107-85dc-02114787ef48` Although no action is required for tenant administrators, this new AppID may show up in logs and should be accounted for in detections relying on known legitimate ClientAppIDs. ### Why this change? The rule `initial_access_microsoft_365_abnormal_clientappid` flags potentially suspicious or unauthorized client applications accessing Microsoft 365 services. To prevent false positives caused by this official change from Microsoft, this PR adds the new OWA AppID to the allowlist. ### References - Microsoft 365 Message Center notice (ref: MC715025) - [MSAL documentation](https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-overview) * Update initial_access_microsoft_365_abnormal_clientappid.toml Updated updated_date * Update Max signals value to supported limits (elastic#4556) * Update ATT&CK coverage URL(s) in docs-dev/ATT&CK-coverage.md (elastic#4571) * deprecating 'Azure Virtual Network Device Modified or Deleted' (elastic#4559) * tuning 'Azure Conditional Access Policy Modified' (elastic#4558) * [Rule Tuning] Tuning Illicit Grant Consent Detections in Azure and M365 (elastic#4557) * tuning Azure rule for illicit grant activity; creating new rule for M365 * Update rules/integrations/o365/initial_access_microsoft_365_illicit_consent_grant_via_registered_application.toml * Update rules/integrations/azure/initial_access_entra_illicit_consent_grant_via_registered_application.toml * adjusted tags * Update rules/integrations/azure/initial_access_entra_illicit_consent_grant_via_registered_application.toml * Update defense_evasion_microsoft_defender_tampering.toml (elastic#4573) Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com> * [Rule Tuning] O365 Exchange Suspicious Mailbox Right Delegation (elastic#4589) * Update docset.yml (elastic#4590) Remove diagnostic hint * [New] Unusual Network Connection to Suspicious Web Service (elastic#4569) * [New] Unusual Network Connection to Suspicious Web Service * Update rule threat order --------- Co-authored-by: Eric Forte <119343520+eric-forte-elastic@users.noreply.github.com> Co-authored-by: eric-forte-elastic <eric.forte@elastic.co> Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> * [New] Unusual Network Connection to Suspicious Top Level Domain (elastic#4563) * [Rule Tuning] Add Host Metadata to ES|QL Aggregation Rules (elastic#4592) Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> * Add investigation guides (elastic#4600) * [Rule Tuning] Suspicious Execution via Scheduled Task (elastic#4599) * Lock versions for releases: 8.14,8.15,8.16,8.17,8.18,9.0 (elastic#4601) * [FN Tuning] Shared Object Created or Changed by Previously Unknown Pr… (elastic#4529) * [FN Tuning] Shared Object Created or Changed by Previously Unknown Process * Update process exclusions in TOML file --------- Co-authored-by: Colson Wilhoit <48036388+DefSecSentinel@users.noreply.github.com> Co-authored-by: shashank-elastic <91139415+shashank-elastic@users.noreply.github.com> Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> Co-authored-by: Eric Forte <119343520+eric-forte-elastic@users.noreply.github.com> * [D4C Conversion] Converting Compatible D4C Rules to DR (elastic#4532) * [D4C Conversion] Converting Compatible D4C Rules to DR * added host.os.type * Rename * Update rules/linux/execution_container_management_binary_launched_inside_container.toml Co-authored-by: Isai <59296946+imays11@users.noreply.github.com> * Update rules/linux/privilege_escalation_debugfs_launched_inside_container.toml Co-authored-by: Isai <59296946+imays11@users.noreply.github.com> * Update rules/linux/privilege_escalation_debugfs_launched_inside_container.toml Co-authored-by: Isai <59296946+imays11@users.noreply.github.com> * Update rules/linux/privilege_escalation_mount_launched_inside_container.toml Co-authored-by: Isai <59296946+imays11@users.noreply.github.com> * Update rules/linux/privilege_escalation_mount_launched_inside_container.toml Co-authored-by: Isai <59296946+imays11@users.noreply.github.com> --------- Co-authored-by: Isai <59296946+imays11@users.noreply.github.com> Co-authored-by: shashank-elastic <91139415+shashank-elastic@users.noreply.github.com> Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> * Remove Task List reference (elastic#4605) * [FR] Update Detection Rules MITRE Workflow to SHA Pin (elastic#4581) * Update to pinned hash * version bump * [FR] Add Kibana Action Connector Error to Exception List Workaround (elastic#4583) * Add error catch for workaround * Switch to set for efficiency * Patch version bump --------- Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> * [Rule Tuning] SSH Authorized Keys File Deletion (elastic#4591) Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> * [Rule Tuning] Suspicious WMI Event Subscription Created (elastic#4618) * [Rule Tuning] Suspicious Execution via Scheduled Task * [Rule Tuning] Suspicious WMI Event Subscription Created * [Rule Tuning] Adjusting `Microsoft Entra ID Rare Authentication Requirement for Principal User` (elastic#4562) * tuning 'Microsoft Entra ID Rare Authentication Requirement for Principal User' * updated MITRE ATT&CK mappings * updated index target * updated patch version * updating patch version * bumping patch version * updating patch version * [Rule Tuning] Tuning `Azure Service Principal Credentials Added` (elastic#4570) * tuning 'Azure Service Principal Credentials Added' * updated patch version * added investigation guide * updating patch version * updating patch version * [FR] Add Support for Local Dates Flag (elastic#4582) * Add support for local dates flag * Use two variables * Add support for import-rules-to-repo * Revert arg formatting * Update comment * Pass Rule Path as Path Object * Update to rule loader function * Streamline metadata function * Also support dictionaries * Bump patch version * Reduce complexity * Add if path exists check * Fix version bump * Feature exclude tactic name (elastic#4593) * Added new cli flag to exclude tactic name in rule file name * added a shortcut for the flag and adjusted CLI readme * Add no tactic flag also to import to prevent warnings * Added info about unit test * version bump * Added no_tactic_filename as config option + fixed linting * pyproject version bump --------- Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> Co-authored-by: Eric Forte <119343520+eric-forte-elastic@users.noreply.github.com> --------- Co-authored-by: Eric Forte <119343520+eric-forte-elastic@users.noreply.github.com> Co-authored-by: Kirti Sodhi <109447885+sodhikirti07@users.noreply.github.com> Co-authored-by: Samirbous <64742097+Samirbous@users.noreply.github.com> Co-authored-by: Jonhnathan <26856693+w0rk3r@users.noreply.github.com> Co-authored-by: shashank-elastic <91139415+shashank-elastic@users.noreply.github.com> Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com> Co-authored-by: Mika Ayenson, PhD <Mikaayenson@users.noreply.github.com> Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> Co-authored-by: Jan Calanog <nejcalanog@gmail.com> Co-authored-by: Sergey Polzunov <traut@users.noreply.github.com> Co-authored-by: Colson Wilhoit <48036388+DefSecSentinel@users.noreply.github.com> Co-authored-by: M. Visser <BugOrFeature@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: eric-forte-elastic <eric.forte@elastic.co> Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com> Co-authored-by: Isai <59296946+imays11@users.noreply.github.com> Co-authored-by: Frederik Berg <83548283+frederikb96@users.noreply.github.com>
Pull Request
Summary - What I changed
The adjustment was straightforward, check the code diff :)
How To Test
Filenames are just the rule name now 🚀
Checklist
bug,enhancement,schema,maintenance,Rule: New,Rule: Deprecation,Rule: Tuning,Hunt: New, orHunt: Tuningso guidelines can be generatedmeta:rapid-mergelabel if planning to merge within 24 hoursContributor checklist