mirror of https://github.com/infosecn1nja/HELK.git
164 lines
3.7 KiB
Plaintext
164 lines
3.7 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Ursnif Malware Download URL Pattern\n",
|
|
"Detects download of Ursnif malware done by dropper documents."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Rule Content\n",
|
|
"```\n",
|
|
"- title: Ursnif Malware Download URL Pattern\n",
|
|
" id: a36ce77e-30db-4ea0-8795-644d7af5dfb4\n",
|
|
" status: stable\n",
|
|
" description: Detects download of Ursnif malware done by dropper documents.\n",
|
|
" author: Thomas Patzke\n",
|
|
" logsource:\n",
|
|
" category: proxy\n",
|
|
" product: null\n",
|
|
" service: null\n",
|
|
" detection:\n",
|
|
" selection:\n",
|
|
" c-uri: '*/*.php?l=*.cab'\n",
|
|
" sc-status: 200\n",
|
|
" condition: selection\n",
|
|
" fields:\n",
|
|
" - c-ip\n",
|
|
" - c-uri\n",
|
|
" - sc-bytes\n",
|
|
" - c-ua\n",
|
|
" falsepositives:\n",
|
|
" - Unknown\n",
|
|
" level: critical\n",
|
|
"- title: Ursnif Malware C2 URL Pattern\n",
|
|
" id: 932ac737-33ca-4afd-9869-0d48b391fcc9\n",
|
|
" status: stable\n",
|
|
" description: Detects Ursnif C2 traffic.\n",
|
|
" references:\n",
|
|
" - https://www.fortinet.com/blog/threat-research/ursnif-variant-spreading-word-document.html\n",
|
|
" author: Thomas Patzke\n",
|
|
" logsource:\n",
|
|
" category: proxy\n",
|
|
" detection:\n",
|
|
" b64encoding:\n",
|
|
" c-uri:\n",
|
|
" - '*_2f*'\n",
|
|
" - '*_2b*'\n",
|
|
" urlpatterns:\n",
|
|
" c-uri|all:\n",
|
|
" - '*.avi'\n",
|
|
" - '*/images/*'\n",
|
|
" condition: b64encoding and urlpatterns\n",
|
|
" fields:\n",
|
|
" - c-ip\n",
|
|
" - c-uri\n",
|
|
" - sc-bytes\n",
|
|
" - c-ua\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-*', 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='(c-uri.keyword:*\\/*.php?l\\=*.cab AND sc-status:\"200\")')\n",
|
|
"response = s.execute()\n",
|
|
"if response.success():\n",
|
|
" df = pd.DataFrame((d.to_dict() for d in s.scan()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"s = searchContext.query('query_string', query='(c-uri.keyword:(*_2f* OR *_2b*) AND c-uri.keyword:*.avi AND c-uri.keyword:*\\/images\\/*)')\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
|
|
}
|