mirror of https://github.com/infosecn1nja/HELK.git
146 lines
4.3 KiB
Plaintext
146 lines
4.3 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Executables Started in Suspicious Folder\n",
|
|
"Detects process starts of binaries from a suspicious folder"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Rule Content\n",
|
|
"```\n",
|
|
"- title: Executables Started in Suspicious Folder\n",
|
|
" id: 7a38aa19-86a9-4af7-ac51-6bfe4e59f254\n",
|
|
" status: experimental\n",
|
|
" description: Detects process starts of binaries from a suspicious folder\n",
|
|
" author: Florian Roth\n",
|
|
" date: 2017/10/14\n",
|
|
" modified: 2019/02/21\n",
|
|
" references:\n",
|
|
" - https://github.com/mbevilacqua/appcompatprocessor/blob/master/AppCompatSearch.txt\n",
|
|
" - https://www.secureworks.com/research/bronze-butler-targets-japanese-businesses\n",
|
|
" - https://www.crowdstrike.com/resources/reports/2019-crowdstrike-global-threat-report/\n",
|
|
" - https://github.com/ThreatHuntingProject/ThreatHunting/blob/master/hunts/suspicious_process_creation_via_windows_event_logs.md\n",
|
|
" tags:\n",
|
|
" - attack.defense_evasion\n",
|
|
" - attack.t1036\n",
|
|
" logsource:\n",
|
|
" category: process_creation\n",
|
|
" product: windows\n",
|
|
" service: null\n",
|
|
" detection:\n",
|
|
" selection:\n",
|
|
" Image:\n",
|
|
" - C:\\PerfLogs\\\\*\n",
|
|
" - C:\\$Recycle.bin\\\\*\n",
|
|
" - C:\\Intel\\Logs\\\\*\n",
|
|
" - C:\\Users\\Default\\\\*\n",
|
|
" - C:\\Users\\Public\\\\*\n",
|
|
" - C:\\Users\\NetworkService\\\\*\n",
|
|
" - C:\\Windows\\Fonts\\\\*\n",
|
|
" - C:\\Windows\\Debug\\\\*\n",
|
|
" - C:\\Windows\\Media\\\\*\n",
|
|
" - C:\\Windows\\Help\\\\*\n",
|
|
" - C:\\Windows\\addins\\\\*\n",
|
|
" - C:\\Windows\\repair\\\\*\n",
|
|
" - C:\\Windows\\security\\\\*\n",
|
|
" - '*\\RSA\\MachineKeys\\\\*'\n",
|
|
" - C:\\Windows\\system32\\config\\systemprofile\\\\*\n",
|
|
" - C:\\Windows\\Tasks\\\\*\n",
|
|
" - C:\\Windows\\System32\\Tasks\\\\*\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-*', 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_path.keyword:(C\\:\\\\PerfLogs\\\\* OR C\\:\\\\$Recycle.bin\\\\* OR C\\:\\\\Intel\\\\Logs\\\\* OR C\\:\\\\Users\\\\Default\\\\* OR C\\:\\\\Users\\\\Public\\\\* OR C\\:\\\\Users\\\\NetworkService\\\\* OR C\\:\\\\Windows\\\\Fonts\\\\* OR C\\:\\\\Windows\\\\Debug\\\\* OR C\\:\\\\Windows\\\\Media\\\\* OR C\\:\\\\Windows\\\\Help\\\\* OR C\\:\\\\Windows\\\\addins\\\\* OR C\\:\\\\Windows\\\\repair\\\\* OR C\\:\\\\Windows\\\\security\\\\* OR *\\\\RSA\\\\MachineKeys\\\\* OR C\\:\\\\Windows\\\\system32\\\\config\\\\systemprofile\\\\* OR C\\:\\\\Windows\\\\Tasks\\\\* OR C\\:\\\\Windows\\\\System32\\\\Tasks\\\\*)')\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
|
|
}
|