HELK/docker/helk-jupyter/notebooks/sigma/win_hktl_createminidump.ipynb

147 lines
3.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# CreateMiniDump Hacktool\n",
"Detects the use of CreateMiniDump hack tool used to dump the LSASS process memory for credential extraction on the attacker's machine"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- action: global\n",
" title: CreateMiniDump Hacktool\n",
" id: 36d88494-1d43-4dc0-b3fa-35c8fea0ca9d\n",
" description: Detects the use of CreateMiniDump hack tool used to dump the LSASS\n",
" process memory for credential extraction on the attacker's machine\n",
" author: Florian Roth\n",
" references:\n",
" - https://ired.team/offensive-security/credential-access-and-credential-dumping/dumping-lsass-passwords-without-mimikatz-minidumpwritedump-av-signature-bypass\n",
" date: 2019/12/22\n",
" tags:\n",
" - attack.credential_access\n",
" - attack.t1003\n",
" falsepositives:\n",
" - Unknown\n",
" level: high\n",
"- logsource:\n",
" category: process_creation\n",
" product: windows\n",
" detection:\n",
" selection1:\n",
" Image|contains: \\CreateMiniDump.exe\n",
" selection2:\n",
" Imphash: 4a07f944a83e8a7c2525efa35dd30e2f\n",
" condition: 1 of them\n",
"- logsource:\n",
" product: windows\n",
" service: sysmon\n",
" detection:\n",
" selection:\n",
" EventID: 11\n",
" TargetFileName|contains: '*\\lsass.dmp'\n",
" condition: 1 of them\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-*', 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='(process_path.keyword:*\\\\CreateMiniDump.exe* OR hash_imphash:\"4a07f944a83e8a7c2525efa35dd30e2f\")')\n",
"response = s.execute()\n",
"if response.success():\n",
" df = pd.DataFrame((d.to_dict() for d in s.scan()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s = searchContext.query('query_string', query='(event_id:\"11\" AND TargetFileName.keyword:*\\\\lsass.dmp*)')\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
}