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

131 lines
3.1 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# LSASS Memory Dump\n",
"Detects process LSASS memory dump using procdump or taskmgr based on the CallTrace pointing to dbghelp.dll or dbgcore.dll for win10"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: LSASS Memory Dump\n",
" id: 5ef9853e-4d0e-4a70-846f-a9ca37d876da\n",
" status: experimental\n",
" description: Detects process LSASS memory dump using procdump or taskmgr based on\n",
" the CallTrace pointing to dbghelp.dll or dbgcore.dll for win10\n",
" author: Samir Bousseaden\n",
" references:\n",
" - https://blog.menasec.net/2019/02/threat-hunting-21-procdump-or-taskmgr.html\n",
" tags:\n",
" - attack.t1003\n",
" - attack.s0002\n",
" - attack.credential_access\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",
" GrantedAccess: '0x1fffff'\n",
" CallTrace:\n",
" - '*dbghelp.dll*'\n",
" - '*dbgcore.dll*'\n",
" condition: selection\n",
" falsepositives:\n",
" - unknown\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_granted_access:\"0x1fffff\" AND process_call_trace.keyword:(*dbghelp.dll* OR *dbgcore.dll*))')\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
}