mirror of https://github.com/infosecn1nja/HELK.git
139 lines
3.3 KiB
Plaintext
139 lines
3.3 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Data Compressed - rar.exe\n",
|
|
"An adversary may compress data (e.g., sensitive documents) that is collected prior to exfiltration in order to make it portable and minimize the amount of data sent over the network"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Rule Content\n",
|
|
"```\n",
|
|
"- title: Data Compressed - rar.exe\n",
|
|
" id: 6f3e2987-db24-4c78-a860-b4f4095a7095\n",
|
|
" status: experimental\n",
|
|
" description: An adversary may compress data (e.g., sensitive documents) that is\n",
|
|
" collected prior to exfiltration in order to make it portable and minimize the\n",
|
|
" amount of data sent over the network\n",
|
|
" author: Timur Zinniatullin, oscd.community\n",
|
|
" date: 2019/10/21\n",
|
|
" modified: 2019/11/04\n",
|
|
" references:\n",
|
|
" - https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1002/T1002.yaml\n",
|
|
" logsource:\n",
|
|
" category: process_creation\n",
|
|
" product: windows\n",
|
|
" service: null\n",
|
|
" detection:\n",
|
|
" selection:\n",
|
|
" Image|endswith: \\rar.exe\n",
|
|
" CommandLine|contains|all:\n",
|
|
" - ' a '\n",
|
|
" - -r\n",
|
|
" condition: selection\n",
|
|
" fields:\n",
|
|
" - Image\n",
|
|
" - CommandLine\n",
|
|
" - User\n",
|
|
" - LogonGuid\n",
|
|
" - Hashes\n",
|
|
" - ParentProcessGuid\n",
|
|
" - ParentCommandLine\n",
|
|
" falsepositives:\n",
|
|
" - highly likely if rar is default archiver in the monitored environment\n",
|
|
" level: low\n",
|
|
" tags:\n",
|
|
" - attack.exfiltration\n",
|
|
" - attack.t1002\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:*\\\\rar.exe AND process_command_line.keyword:*\\ a\\ * AND process_command_line.keyword:*\\-r*)')\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
|
|
}
|