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

[Tuning] SDH - Possible Consent Grant Attack via Azure-Registered Application #4283

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

imays11
Copy link
Contributor

@imays11 imays11 commented Dec 5, 2024

Pull Request

Issue link(s):
https://github.com/elastic/sdh-protections/issues/538

Summary - What I changed

o365 integration had a field pipeline change that renamed the o365.audit.Operation field as event.action. Because of this the rule as it exists does not trigger for o365.audit data stream. I'm adding the event.action field as an additional OR clause which should correct the false negative. This is a simple tuning that should work as expected below is a screenshot from @arturmouraa with the working query in his test environment as I do not have one set up for this at the moment and would like to push the change in time for our upcoming release.

How To Test

target event provided in SDH ticket

{
  "_index": ".ds-logs-o365.audit-default-2024.11.04-000012",
  "_id": "vl440zYeEpalgR8UR1CV0hQKN8o=",
  "_version": 1,
  "_score": 0,
  "_source": {
    "agent": {
      "name": "<redacted>",
      "id": "e2217be3-95df-428e-a88f-7aa92434b2df",
      "ephemeral_id": "bbbee566-5893-4453-a4e3-b5bc29e0f308",
      "type": "filebeat",
      "version": "8.14.3"
    },
trimmed
"event": {
      "agent_id_status": "verified",
      "ingested": "2024-11-25T22:15:23Z",
      "code": "AzureActiveDirectory",
      "provider": "AzureActiveDirectory",
      "kind": "event",
      "action": "Consent to application.",
      "id": "443457b8-1942-4b60-98f5-a7c643e25c0d",
      "type": [
        "info"
      ],
      "category": [
        "web"
      ],
      "dataset": "o365.audit",
      "outcome": "success"
    },
"o365.audit.ModifiedProperties.ConsentContext_IsAdminConsent.NewValue": [
      "False"
    ],
    "o365.audit.ModifiedProperties.ConsentContext_IsAppOnly.OldValue": [
      ""
    ],
    "o365.audit.ModifiedProperties.TargetId_ServicePrincipalNames.NewValue": [
      "https://<redacted>"
    ],
    "event.action": [
      "Consent to application."
    ],
    "event.ingested": [
      "2024-11-25T22:15:23.000Z"
    ],
    "o365.audit.ResultStatus": [
      "Success"
    ],

SCREENSHOTS

Here is the screenshot of the alert after changing the rule query.

Image

And here is the rule cloned and changed:

Image

SDH related rule tuning for o365.audit dataset
@protectionsmachine
Copy link
Collaborator

Rule: Tuning - Guidelines

These guidelines serve as a reminder set of considerations when tuning an existing rule.

Documentation and Context

  • Detailed description of the suggested changes.
  • Provide example JSON data or screenshots.
  • Provide evidence of reducing benign events mistakenly identified as threats (False Positives).
  • Provide evidence of enhancing detection of true threats that were previously missed (False Negatives).
  • Provide evidence of optimizing resource consumption and execution time of detection rules (Performance).
  • Provide evidence of specific environment factors influencing customized rule tuning (Contextual Tuning).
  • Provide evidence of improvements made by modifying sensitivity by changing alert triggering thresholds (Threshold Adjustments).
  • Provide evidence of refining rules to better detect deviations from typical behavior (Behavioral Tuning).
  • Provide evidence of improvements of adjusting rules based on time-based patterns (Temporal Tuning).
  • Provide reasoning of adjusting priority or severity levels of alerts (Severity Tuning).
  • Provide evidence of improving quality integrity of our data used by detection rules (Data Quality).
  • Ensure the tuning includes necessary updates to the release documentation and versioning.

Rule Metadata Checks

  • updated_date matches the date of tuning PR merged.
  • min_stack_version should support the widest stack versions.
  • name and description should be descriptive and not include typos.
  • query should be inclusive, not overly exclusive. Review to ensure the original intent of the rule is maintained.

Testing and Validation

  • Validate that the tuned rule's performance is satisfactory and does not negatively impact the stack.
  • Ensure that the tuned rule has a low false positive rate.

@imays11 imays11 merged commit 511c108 into main Dec 6, 2024
9 checks passed
@imays11 imays11 deleted the sdh_azure_tuning branch December 6, 2024 22:27
protectionsmachine pushed a commit that referenced this pull request Dec 6, 2024
…lication (#4283)

* [Tuning] Possible Consent Grant Attack via Azure-Registered Application

SDH related rule tuning for o365.audit dataset

* removing renamed field from query

(cherry picked from commit 511c108)
protectionsmachine pushed a commit that referenced this pull request Dec 6, 2024
…lication (#4283)

* [Tuning] Possible Consent Grant Attack via Azure-Registered Application

SDH related rule tuning for o365.audit dataset

* removing renamed field from query

(cherry picked from commit 511c108)
protectionsmachine pushed a commit that referenced this pull request Dec 6, 2024
…lication (#4283)

* [Tuning] Possible Consent Grant Attack via Azure-Registered Application

SDH related rule tuning for o365.audit dataset

* removing renamed field from query

(cherry picked from commit 511c108)
protectionsmachine pushed a commit that referenced this pull request Dec 6, 2024
…lication (#4283)

* [Tuning] Possible Consent Grant Attack via Azure-Registered Application

SDH related rule tuning for o365.audit dataset

* removing renamed field from query

(cherry picked from commit 511c108)
protectionsmachine pushed a commit that referenced this pull request Dec 6, 2024
…lication (#4283)

* [Tuning] Possible Consent Grant Attack via Azure-Registered Application

SDH related rule tuning for o365.audit dataset

* removing renamed field from query

(cherry picked from commit 511c108)
protectionsmachine pushed a commit that referenced this pull request Dec 6, 2024
…lication (#4283)

* [Tuning] Possible Consent Grant Attack via Azure-Registered Application

SDH related rule tuning for o365.audit dataset

* removing renamed field from query

(cherry picked from commit 511c108)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants