HELK/docker/helk-jupyter/notebooks/sigma/win_susp_rundll32_activity....

141 lines
4.0 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Suspicious Rundll32 Activity\n",
"Detects suspicious process related to rundll32 based on arguments"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Suspicious Rundll32 Activity\n",
" id: e593cf51-88db-4ee1-b920-37e89012a3c9\n",
" description: Detects suspicious process related to rundll32 based on arguments\n",
" status: experimental\n",
" references:\n",
" - http://www.hexacorn.com/blog/2017/05/01/running-programs-via-proxy-jumping-on-a-edr-bypass-trampoline/\n",
" - https://twitter.com/Hexacorn/status/885258886428725250\n",
" - https://gist.github.com/ryhanson/227229866af52e2d963cf941af135a52\n",
" tags:\n",
" - attack.defense_evasion\n",
" - attack.execution\n",
" - attack.t1085\n",
" author: juju4\n",
" logsource:\n",
" category: process_creation\n",
" product: windows\n",
" service: null\n",
" detection:\n",
" selection:\n",
" CommandLine:\n",
" - '*\\rundll32.exe* url.dll,*OpenURL *'\n",
" - '*\\rundll32.exe* url.dll,*OpenURLA *'\n",
" - '*\\rundll32.exe* url.dll,*FileProtocolHandler *'\n",
" - '*\\rundll32.exe* zipfldr.dll,*RouteTheCall *'\n",
" - '*\\rundll32.exe* Shell32.dll,*Control_RunDLL *'\n",
" - '*\\rundll32.exe javascript:*'\n",
" - '* url.dll,*OpenURL *'\n",
" - '* url.dll,*OpenURLA *'\n",
" - '* url.dll,*FileProtocolHandler *'\n",
" - '* zipfldr.dll,*RouteTheCall *'\n",
" - '* Shell32.dll,*Control_RunDLL *'\n",
" - '* javascript:*'\n",
" - '*.RegisterXLL*'\n",
" condition: selection\n",
" falsepositives:\n",
" - False positives depend on scripts and administrative tools used in the monitored\n",
" environment\n",
" level: medium\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_command_line.keyword:(*\\\\rundll32.exe*\\ url.dll,*OpenURL\\ * OR *\\\\rundll32.exe*\\ url.dll,*OpenURLA\\ * OR *\\\\rundll32.exe*\\ url.dll,*FileProtocolHandler\\ * OR *\\\\rundll32.exe*\\ zipfldr.dll,*RouteTheCall\\ * OR *\\\\rundll32.exe*\\ Shell32.dll,*Control_RunDLL\\ * OR *\\\\rundll32.exe\\ javascript\\:* OR *\\ url.dll,*OpenURL\\ * OR *\\ url.dll,*OpenURLA\\ * OR *\\ url.dll,*FileProtocolHandler\\ * OR *\\ zipfldr.dll,*RouteTheCall\\ * OR *\\ Shell32.dll,*Control_RunDLL\\ * OR *\\ javascript\\:* OR *.RegisterXLL*)')\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
}