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

130 lines
2.9 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Suspicious Parent of Csc.exe\n",
"Detects a suspicious parent of csc.exe, which could by a sign of payload delivery"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Suspicious Parent of Csc.exe\n",
" id: b730a276-6b63-41b8-bcf8-55930c8fc6ee\n",
" description: Detects a suspicious parent of csc.exe, which could by a sign of payload\n",
" delivery\n",
" status: experimental\n",
" references:\n",
" - https://twitter.com/SBousseaden/status/1094924091256176641\n",
" author: Florian Roth\n",
" date: 2019/02/11\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: '*\\csc.exe*'\n",
" ParentImage:\n",
" - '*\\wscript.exe'\n",
" - '*\\cscript.exe'\n",
" - '*\\mshta.exe'\n",
" condition: selection\n",
" falsepositives:\n",
" - Unkown\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:*\\\\csc.exe* AND process_parent_path.keyword:(*\\\\wscript.exe OR *\\\\cscript.exe OR *\\\\mshta.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
}