mirror of https://github.com/infosecn1nja/HELK.git
140 lines
3.5 KiB
Plaintext
140 lines
3.5 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# CMSTP UAC Bypass via COM Object Access\n",
|
|
"Detects UAC Bypass Attempt Using Microsoft Connection Manager Profile Installer Autoelevate-capable COM Objects"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Rule Content\n",
|
|
"```\n",
|
|
"- title: CMSTP UAC Bypass via COM Object Access\n",
|
|
" id: 4b60e6f2-bf39-47b4-b4ea-398e33cfe253\n",
|
|
" status: stable\n",
|
|
" description: Detects UAC Bypass Attempt Using Microsoft Connection Manager Profile\n",
|
|
" Installer Autoelevate-capable COM Objects\n",
|
|
" tags:\n",
|
|
" - attack.defense_evasion\n",
|
|
" - attack.privilege_escalation\n",
|
|
" - attack.execution\n",
|
|
" - attack.t1088\n",
|
|
" - attack.t1191\n",
|
|
" - attack.g0069\n",
|
|
" - car.2019-04-001\n",
|
|
" author: Nik Seetharaman\n",
|
|
" modified: 2019/07/31\n",
|
|
" references:\n",
|
|
" - http://www.endurant.io/cmstp/detecting-cmstp-enabled-code-execution-and-uac-bypass-with-sysmon/\n",
|
|
" - https://twitter.com/hFireF0X/status/897640081053364225\n",
|
|
" logsource:\n",
|
|
" category: process_creation\n",
|
|
" product: windows\n",
|
|
" service: null\n",
|
|
" detection:\n",
|
|
" selection1:\n",
|
|
" ParentCommandLine: '*\\DllHost.exe'\n",
|
|
" selection2:\n",
|
|
" ParentCommandLine:\n",
|
|
" - '*{3E5FC7F9-9A51-4367-9063-A120244FBEC7}'\n",
|
|
" - '*{3E000D72-A845-4CD9-BD83-80C07C3B881F}'\n",
|
|
" condition: selection1 and selection2\n",
|
|
" fields:\n",
|
|
" - CommandLine\n",
|
|
" - ParentCommandLine\n",
|
|
" - Hashes\n",
|
|
" falsepositives:\n",
|
|
" - Legitimate CMSTP use (unlikely in modern enterprise environments)\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-*', 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_parent_command_line.keyword:*\\\\DllHost.exe AND process_parent_command_line.keyword:(*\\{3E5FC7F9\\-9A51\\-4367\\-9063\\-A120244FBEC7\\} OR *\\{3E000D72\\-A845\\-4CD9\\-BD83\\-80C07C3B881F\\}))')\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
|
|
}
|