mirror of https://github.com/infosecn1nja/HELK.git
131 lines
3.0 KiB
Plaintext
131 lines
3.0 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# RottenPotato Like Attack Pattern\n",
|
||
|
"Detects logon events that have characteristics of events generated during an attack with RottenPotato and the like"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Rule Content\n",
|
||
|
"```\n",
|
||
|
"- title: RottenPotato Like Attack Pattern\n",
|
||
|
" id: 16f5d8ca-44bd-47c8-acbe-6fc95a16c12f\n",
|
||
|
" status: experimental\n",
|
||
|
" description: Detects logon events that have characteristics of events generated\n",
|
||
|
" during an attack with RottenPotato and the like\n",
|
||
|
" references:\n",
|
||
|
" - https://twitter.com/SBousseaden/status/1195284233729777665\n",
|
||
|
" author: '@SBousseaden, Florian Roth'\n",
|
||
|
" date: 2019/11/15\n",
|
||
|
" tags:\n",
|
||
|
" - attack.privilege_escalation\n",
|
||
|
" - attack.credential_access\n",
|
||
|
" - attack.t1171\n",
|
||
|
" logsource:\n",
|
||
|
" product: windows\n",
|
||
|
" service: security\n",
|
||
|
" category: null\n",
|
||
|
" detection:\n",
|
||
|
" selection:\n",
|
||
|
" EventID: 4624\n",
|
||
|
" LogonType: 3\n",
|
||
|
" TargetUserName: ANONYMOUS_LOGON\n",
|
||
|
" WorkstationName: '-'\n",
|
||
|
" SourceNetworkAddress: 127.0.0.1\n",
|
||
|
" condition: selection\n",
|
||
|
" falsepositives:\n",
|
||
|
" - Unknown\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-endpoint-winevent-security-*', 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='(event_id:\"4624\" AND logon_type:\"3\" AND TargetUserName:\"ANONYMOUS_LOGON\" AND src_host_name:\"\\-\" AND SourceNetworkAddress:\"127.0.0.1\")')\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
|
||
|
}
|