mirror of https://github.com/infosecn1nja/HELK.git
138 lines
4.0 KiB
Plaintext
138 lines
4.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Winlogon Helper DLL\n",
|
|
"Winlogon.exe is a Windows component responsible for actions at logon/logoff as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry entries in HKLM\\Software[Wow6432Node]Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage additional helper programs and functionalities that support Winlogon. Malicious modifications to these Registry keys may cause Winlogon to load and execute malicious DLLs and/or executables."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Rule Content\n",
|
|
"```\n",
|
|
"- title: Winlogon Helper DLL\n",
|
|
" id: 851c506b-6b7c-4ce2-8802-c703009d03c0\n",
|
|
" status: experimental\n",
|
|
" description: Winlogon.exe is a Windows component responsible for actions at logon/logoff\n",
|
|
" as well as the secure attention sequence (SAS) triggered by Ctrl-Alt-Delete. Registry\n",
|
|
" entries in HKLM\\Software[Wow6432Node]Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\\n",
|
|
" and HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\ are used to manage\n",
|
|
" additional helper programs and functionalities that support Winlogon. Malicious\n",
|
|
" modifications to these Registry keys may cause Winlogon to load and execute malicious\n",
|
|
" DLLs and/or executables.\n",
|
|
" author: Timur Zinniatullin, oscd.community\n",
|
|
" date: 2019/10/21\n",
|
|
" modified: 2019/11/04\n",
|
|
" references:\n",
|
|
" - https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1004/T1004.yaml\n",
|
|
" logsource:\n",
|
|
" product: windows\n",
|
|
" service: powershell\n",
|
|
" description: Script block logging must be enabled\n",
|
|
" category: null\n",
|
|
" detection:\n",
|
|
" selection:\n",
|
|
" EventID: 4104\n",
|
|
" keyword1:\n",
|
|
" - '*Set-ItemProperty*'\n",
|
|
" - '*New-Item*'\n",
|
|
" keyword2:\n",
|
|
" - '*CurrentVersion\\Winlogon*'\n",
|
|
" condition: selection and ( keyword1 and keyword2 )\n",
|
|
" falsepositives:\n",
|
|
" - Unknown\n",
|
|
" level: medium\n",
|
|
" tags:\n",
|
|
" - attack.persistence\n",
|
|
" - attack.t1004\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-powershell-*', 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:\"4104\" AND \\*.keyword:(*Set\\-ItemProperty* OR *New\\-Item*) AND \"*CurrentVersion\\\\Winlogon*\")')\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
|
|
}
|