atomic-threat-coverage/Atomic_Threat_Coverage/Detection_Rules/sysmon_cmdkey_recon.md
2019-02-12 04:55:11 +01:00

4.0 KiB

Title Cmdkey Cached Credentials Recon
Description Detects usage of cmdkey to look for cached credentials
ATT&CK Tactic
    ATT&CK Technique
      Data Needed
      Trigger There is no Trigger for this technique yet.
      Severity Level low
      False Positives
      • Legitimate administrative tasks.
      Development Status experimental
      References
        Author jmallette

        Detection Rules

        Sigma rule

        title: Cmdkey Cached Credentials Recon
        status: experimental
        description: Detects usage of cmdkey to look for cached credentials
        reference: 
            - https://www.peew.pw/blog/2017/11/26/exploring-cmdkey-an-edge-case-for-privilege-escalation
            - https://technet.microsoft.com/en-us/library/cc754243(v=ws.11).aspx
        author: jmallette
        logsource:
            product: windows
            service: sysmon
        detection:
            selection:
                EventID: 1
                Image: '*\cmdkey.exe'
                CommandLine: '* /list *'
            condition: selection
        fields:
            - CommandLine
            - ParentCommandLine
            - User
        falsepositives:
            - Legitimate administrative tasks.
        level: low
        
        

        Kibana query

        (EventID:"1" AND Image.keyword:*\\\\cmdkey.exe AND CommandLine.keyword:*\\ \\/list\\ *)
        

        X-Pack Watcher

        curl -s -XPUT -H \'Content-Type: application/json\' --data-binary @- localhost:9200/_xpack/watcher/watch/Cmdkey-Cached-Credentials-Recon <<EOF\n{\n  "trigger": {\n    "schedule": {\n      "interval": "30m"\n    }\n  },\n  "input": {\n    "search": {\n      "request": {\n        "body": {\n          "size": 0,\n          "query": {\n            "query_string": {\n              "query": "(EventID:\\"1\\" AND Image.keyword:*\\\\\\\\cmdkey.exe AND CommandLine.keyword:*\\\\ \\\\/list\\\\ *)",\n              "analyze_wildcard": true\n            }\n          }\n        },\n        "indices": []\n      }\n    }\n  },\n  "condition": {\n    "compare": {\n      "ctx.payload.hits.total": {\n        "not_eq": 0\n      }\n    }\n  },\n  "actions": {\n    "send_email": {\n      "email": {\n        "to": null,\n        "subject": "Sigma Rule \'Cmdkey Cached Credentials Recon\'",\n        "body": "Hits:\\n{{#ctx.payload.hits.hits}}Hit on {{_source.@timestamp}}:\\n      CommandLine = {{_source.CommandLine}}\\nParentCommandLine = {{_source.ParentCommandLine}}\\n             User = {{_source.User}}================================================================================\\n{{/ctx.payload.hits.hits}}",\n        "attachments": {\n          "data.json": {\n            "data": {\n              "format": "json"\n            }\n          }\n        }\n      }\n    }\n  }\n}\nEOF\n
        

        Graylog

        (EventID:"1" AND Image:"*\\\\cmdkey.exe" AND CommandLine:"* \\/list *")