HELK/docker/helk-jupyter/notebooks/sigma/sysmon_mimikatz_trough_winr...

130 lines
3.0 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Mimikatz through Windows Remote Management\n",
"Detects usage of mimikatz through WinRM protocol by monitoring access to lsass process by wsmprovhost.exe."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Mimikatz through Windows Remote Management\n",
" id: aa35a627-33fb-4d04-a165-d33b4afca3e8\n",
" description: Detects usage of mimikatz through WinRM protocol by monitoring access\n",
" to lsass process by wsmprovhost.exe.\n",
" references:\n",
" - https://pentestlab.blog/2018/05/15/lateral-movement-winrm/\n",
" status: stable\n",
" author: Patryk Prauze - ING Tech\n",
" logsource:\n",
" product: windows\n",
" service: sysmon\n",
" category: null\n",
" detection:\n",
" selection:\n",
" EventID: 10\n",
" TargetImage: C:\\windows\\system32\\lsass.exe\n",
" SourceImage: C:\\Windows\\system32\\wsmprovhost.exe\n",
" condition: selection\n",
" tags:\n",
" - attack.credential_access\n",
" - attack.execution\n",
" - attack.t1003\n",
" - attack.t1028\n",
" - attack.s0005\n",
" falsepositives:\n",
" - low\n",
" level: high\n",
"\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Querying Elasticsearch"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import Libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from elasticsearch import Elasticsearch\n",
"from elasticsearch_dsl import Search\n",
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Initialize Elasticsearch client"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"es = Elasticsearch(['http://helk-elasticsearch:9200'])\n",
"searchContext = Search(using=es, index='logs-endpoint-winevent-sysmon-*', doc_type='doc')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Run Elasticsearch Query"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s = searchContext.query('query_string', query='(event_id:\"10\" AND target_process_path:\"C\\:\\\\windows\\\\system32\\\\lsass.exe\" AND process_path:\"C\\:\\\\Windows\\\\system32\\\\wsmprovhost.exe\")')\n",
"response = s.execute()\n",
"if response.success():\n",
" df = pd.DataFrame((d.to_dict() for d in s.scan()))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Show Results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df.head()"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}