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

127 lines
2.8 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Ursnif\n",
"Detects new registry key created by Ursnif malware."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Ursnif\n",
" id: 21f17060-b282-4249-ade0-589ea3591558\n",
" status: experimental\n",
" description: Detects new registry key created by Ursnif malware.\n",
" references:\n",
" - https://blog.yoroi.company/research/ursnif-long-live-the-steganography/\n",
" - https://blog.trendmicro.com/trendlabs-security-intelligence/phishing-campaign-uses-hijacked-emails-to-deliver-ursnif-by-replying-to-ongoing-threads/\n",
" tags:\n",
" - attack.execution\n",
" - attack.t1112\n",
" author: megan201296\n",
" date: 2019/02/13\n",
" logsource:\n",
" product: windows\n",
" service: sysmon\n",
" category: null\n",
" detection:\n",
" selection:\n",
" EventID: 13\n",
" TargetObject: '*\\Software\\AppDataLow\\Software\\Microsoft\\\\*'\n",
" condition: selection\n",
" falsepositives:\n",
" - Unknown\n",
" level: critical\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:*\\\\Software\\\\AppDataLow\\\\Software\\\\Microsoft\\\\*)')\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
}