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

127 lines
2.9 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# UAC Bypass via sdclt\n",
"Detects changes to HKCU:\\Software\\Classes\\exefile\\shell\\runas\\command\\isolatedCommand"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: UAC Bypass via sdclt\n",
" id: 5b872a46-3b90-45c1-8419-f675db8053aa\n",
" status: experimental\n",
" description: Detects changes to HKCU:\\Software\\Classes\\exefile\\shell\\runas\\command\\isolatedCommand\n",
" references:\n",
" - https://enigma0x3.net/2017/03/17/fileless-uac-bypass-using-sdclt-exe/\n",
" author: Omer Yampel\n",
" logsource:\n",
" product: windows\n",
" service: sysmon\n",
" category: null\n",
" detection:\n",
" selection:\n",
" EventID: 13\n",
" TargetObject: HKEY_USERS\\\\*\\Classes\\exefile\\shell\\runas\\command\\isolatedCommand\n",
" condition: selection\n",
" tags:\n",
" - attack.defense_evasion\n",
" - attack.privilege_escalation\n",
" - attack.t1088\n",
" - car.2019-04-001\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:\"13\" AND registry_key_path.keyword:HKEY_USERS\\\\*\\\\Classes\\\\exefile\\\\shell\\\\runas\\\\command\\\\isolatedCommand)')\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
}