elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.7k stars 8.24k forks source link

[Security Solution] Incorrect is_customized Value on Re-Import of Non-Customized Prebuilt Rule #202613

Open pborgonovi opened 21 hours ago

pborgonovi commented 21 hours ago

Describe the bug:

When re-importing a prebuilt rule and overwriting an existing prebuilt rule in the system, the rule is incorrectly marked as "is_customized": true, even though the re-imported rule has not been customized and matches the original prebuilt version.

Kibana/Elasticsearch Stack version:

8.x

Server OS version:

Browser and Browser OS versions:

Elastic Endpoint version:

Original install method (e.g. download page, yum, from source, etc.):

Functional Area (e.g. Endpoint management, timelines, resolver, etc.):

Pre requisites:

  1. prebuiltRulesCustomizationEnabled Feature flag is ON
  2. Have prebuilt rules installed

Steps to reproduce:

  1. Export a prebuilt rule in its original state
  2. Re-import the original rule by overwriting rule_id

Current behavior:

The re-imported rule is flagged as "is_customized": true despite having all fields in original state.

Expected behavior:

The re-imported rule should correctly be flagged as "is_customized": false

Screenshots (if relevant):

https://github.com/user-attachments/assets/51f90c1f-b200-4864-a09d-9e3f14510d86

{
    "id": "2422eb80-eb9b-4ba1-baba-b7139adbd1c9",
    "updated_at": "2024-12-02T23:31:31.127Z",
    "updated_by": "elastic",
    "created_at": "2024-12-02T18:24:46.699Z",
    "created_by": "elastic",
    "name": "Windows Event Logs Cleared",
    "tags": [
        "Domain: Endpoint",
        "OS: Windows",
        "Use Case: Threat Detection",
        "Tactic: Defense Evasion",
        "Resources: Investigation Guide",
        "Data Source: System"
    ],
    "interval": "5m",
    "enabled": false,
    "revision": 1,
    "description": "Identifies attempts to clear Windows event log stores. This is often done by attackers in an attempt to evade detection or destroy forensic evidence on a system.",
    "risk_score": 21,
    "severity": "low",
    "note": "## Triage and analysis\n\n### Investigating Windows Event Logs Cleared\n\nWindows event logs are a fundamental data source for security monitoring, forensics, and incident response. Adversaries can tamper, clear, and delete this data to break SIEM detections, cover their tracks, and slow down incident response.\n\nThis rule looks for the occurrence of clear actions on the `security` event log.\n\n#### Possible investigation steps\n\n- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.\n- Identify the user account that performed the action and whether it should perform this kind of action.\n- Contact the account owner and confirm whether they are aware of this activity.\n- Investigate other alerts associated with the user/host during the past 48 hours.\n  - Verify if any other anti-forensics behaviors were observed.\n- Investigate the event logs prior to the action for suspicious behaviors that an attacker may be trying to cover up.\n\n### False positive analysis\n\n- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.\n\n### Response and remediation\n\n- Initiate the incident response process based on the outcome of the triage.\n  - This activity is potentially done after the adversary achieves its objectives on the host. Ensure that previous actions, if any, are investigated accordingly with their response playbooks.\n- Isolate the involved host to prevent further post-compromise behavior.\n- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.\n- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.\n- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.\n- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).\n",
    "license": "Elastic License v2",
    "output_index": "",
    "timestamp_override": "event.ingested",
    "author": [
        "Elastic",
        "Anabella Cristaldi"
    ],
    "false_positives": [],
    "from": "now-9m",
    "rule_id": "45ac4800-840f-414c-b221-53dd36a5aaf7",
    "max_signals": 100,
    "risk_score_mapping": [],
    "severity_mapping": [],
    "threat": [
        {
            "framework": "MITRE ATT&CK",
            "tactic": {
                "id": "TA0005",
                "name": "Defense Evasion",
                "reference": "https://attack.mitre.org/tactics/TA0005/"
            },
            "technique": [
                {
                    "id": "T1070",
                    "name": "Indicator Removal",
                    "reference": "https://attack.mitre.org/techniques/T1070/",
                    "subtechnique": [
                        {
                            "id": "T1070.001",
                            "name": "Clear Windows Event Logs",
                            "reference": "https://attack.mitre.org/techniques/T1070/001/"
                        }
                    ]
                }
            ]
        }
    ],
    "to": "now",
    "references": [],
    "version": 109,
    "exceptions_list": [],
    "immutable": true,
    "rule_source": {
        "type": "external",
        "is_customized": true
    },
    "related_integrations": [
        {
            "package": "system",
            "version": "^1.6.4"
        },
        {
            "package": "windows",
            "version": "^1.5.0"
        }
    ],
    "required_fields": [
        {
            "name": "event.action",
            "type": "keyword",
            "ecs": true
        },
        {
            "name": "winlog.api",
            "type": "keyword",
            "ecs": false
        },
        {
            "name": "winlog.provider_name",
            "type": "keyword",
            "ecs": false
        }
    ],
    "setup": "",
    "type": "query",
    "language": "kuery",
    "index": [
        "winlogbeat-*",
        "logs-system.*",
        "logs-windows.*"
    ],
    "query": "event.action:(\"audit-log-cleared\" or \"Log clear\") and winlog.api:\"wineventlog\" and\n  not winlog.provider_name:\"AD FS Auditing\"\n",
    "actions": []
}

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Any additional context (logs, chat logs, magical formulas, etc.):

elasticmachine commented 21 hours ago

Pinging @elastic/security-solution (Team: SecuritySolution)

elasticmachine commented 21 hours ago

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

elasticmachine commented 21 hours ago

Pinging @elastic/security-detections-response (Team:Detections and Resp)