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

129 lines
2.9 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# OpenWith.exe executes specified binary\n",
"The OpenWith.exe executes other binary"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: OpenWith.exe executes specified binary\n",
" id: cec8e918-30f7-4e2d-9bfa-a59cc97ae60f\n",
" status: experimental\n",
" description: The OpenWith.exe executes other binary\n",
" references:\n",
" - https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/LOLUtilz/OSBinaries/Openwith.yml\n",
" - https://twitter.com/harr0ey/status/991670870384021504\n",
" author: Beyu Denis, oscd.community (rule), @harr0ey (idea)\n",
" date: 2019/10/12\n",
" modified: 2019/11/04\n",
" tags:\n",
" - attack.defense_evasion\n",
" - attack.execution\n",
" - attack.t1218\n",
" level: high\n",
" logsource:\n",
" category: process_creation\n",
" product: windows\n",
" service: null\n",
" detection:\n",
" selection:\n",
" Image|endswith: \\OpenWith.exe\n",
" CommandLine|contains: /c\n",
" condition: selection\n",
" falsepositives:\n",
" - Legitimate use of OpenWith.exe by legitimate user\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:*\\\\OpenWith.exe AND process_command_line.keyword:*\\/c*)')\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
}