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

136 lines
3.3 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Suspicious HWP Sub Processes\n",
"Detects suspicious Hangul Word Processor (Hanword) sub processes that could indicate an exploitation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Suspicious HWP Sub Processes\n",
" id: 023394c4-29d5-46ab-92b8-6a534c6f447b\n",
" description: Detects suspicious Hangul Word Processor (Hanword) sub processes that\n",
" could indicate an exploitation\n",
" status: experimental\n",
" references:\n",
" - https://www.securitynewspaper.com/2016/11/23/technical-teardown-exploit-malware-hwp-files/\n",
" - https://www.hybrid-analysis.com/search?query=context:74940dcc5b38f9f9b1a0fea760d344735d7d91b610e6d5bd34533dd0153402c5&from_sample=5db135000388385a7644131f&block_redirect=1\n",
" - https://twitter.com/cyberwar_15/status/1187287262054076416\n",
" - https://blog.alyac.co.kr/1901\n",
" - https://en.wikipedia.org/wiki/Hangul_(word_processor)\n",
" tags:\n",
" - attack.execution\n",
" - attack.defense_evasion\n",
" - attack.initial_access\n",
" - attack.t1059\n",
" - attack.t1202\n",
" - attack.t1193\n",
" - attack.g0032\n",
" author: Florian Roth\n",
" date: 2019/10/24\n",
" logsource:\n",
" category: process_creation\n",
" product: windows\n",
" service: null\n",
" detection:\n",
" selection:\n",
" ParentImage: '*\\Hwp.exe'\n",
" Image: '*\\gbb.exe'\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_parent_path.keyword:*\\\\Hwp.exe AND process_path.keyword:*\\\\gbb.exe)')\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
}