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

127 lines
2.9 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Password Dumper Activity on LSASS\n",
"Detects process handle on LSASS process with certain access mask and object type SAM_DOMAIN"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Password Dumper Activity on LSASS\n",
" id: aa1697b7-d611-4f9a-9cb2-5125b4ccfd5c\n",
" description: Detects process handle on LSASS process with certain access mask and\n",
" object type SAM_DOMAIN\n",
" status: experimental\n",
" references:\n",
" - https://twitter.com/jackcr/status/807385668833968128\n",
" tags:\n",
" - attack.credential_access\n",
" - attack.t1003\n",
" logsource:\n",
" product: windows\n",
" service: security\n",
" category: null\n",
" detection:\n",
" selection:\n",
" EventID: 4656\n",
" ProcessName: C:\\Windows\\System32\\lsass.exe\n",
" AccessMask: '0x705'\n",
" ObjectType: SAM_DOMAIN\n",
" condition: selection\n",
" falsepositives:\n",
" - Unkown\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-security-*', 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:\"4656\" AND process_path:\"C\\:\\\\Windows\\\\System32\\\\lsass.exe\" AND object_access_mask_requested:\"0x705\" AND object_type:\"SAM_DOMAIN\")')\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
}