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

139 lines
3.2 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Suspicious File Characteristics due to Missing Fields\n",
"Detects Executables without FileVersion,Description,Product,Company likely created with py2exe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Suspicious File Characteristics due to Missing Fields\n",
" id: 9637e8a5-7131-4f7f-bdc7-2b05d8670c43\n",
" description: Detects Executables without FileVersion,Description,Product,Company\n",
" likely created with py2exe\n",
" status: experimental\n",
" references:\n",
" - https://securelist.com/muddywater/88059/\n",
" - https://www.virustotal.com/#/file/276a765a10f98cda1a38d3a31e7483585ca3722ecad19d784441293acf1b7beb/detection\n",
" author: Markus Neis\n",
" date: 2018/11/22\n",
" modified: 2019/11/09\n",
" tags:\n",
" - attack.defense_evasion\n",
" - attack.execution\n",
" - attack.t1064\n",
" logsource:\n",
" product: windows\n",
" service: sysmon\n",
" category: null\n",
" detection:\n",
" selection1:\n",
" Description: \\?\n",
" FileVersion: \\?\n",
" selection2:\n",
" Description: \\?\n",
" Product: \\?\n",
" selection3:\n",
" Description: \\?\n",
" Company: \\?\n",
" condition: 1 of them\n",
" fields:\n",
" - CommandLine\n",
" - ParentCommandLine\n",
" falsepositives:\n",
" - Unknown\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-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='(file_description:\"\\?\" AND (file_version:\"\\?\" OR file_product:\"\\?\" OR file_company:\"\\?\"))')\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
}