mirror of https://github.com/infosecn1nja/HELK.git
137 lines
3.3 KiB
Plaintext
137 lines
3.3 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Mimikatz DC Sync\n",
|
|
"Detects Mimikatz DC sync security events"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Rule Content\n",
|
|
"```\n",
|
|
"- title: Mimikatz DC Sync\n",
|
|
" id: 611eab06-a145-4dfa-a295-3ccc5c20f59a\n",
|
|
" description: Detects Mimikatz DC sync security events\n",
|
|
" status: experimental\n",
|
|
" date: 2018/06/03\n",
|
|
" modified: 2019/10/08\n",
|
|
" author: Benjamin Delpy, Florian Roth\n",
|
|
" references:\n",
|
|
" - https://twitter.com/gentilkiwi/status/1003236624925413376\n",
|
|
" - https://gist.github.com/gentilkiwi/dcc132457408cf11ad2061340dcb53c2\n",
|
|
" tags:\n",
|
|
" - attack.credential_access\n",
|
|
" - attack.s0002\n",
|
|
" - attack.t1003\n",
|
|
" logsource:\n",
|
|
" product: windows\n",
|
|
" service: security\n",
|
|
" category: null\n",
|
|
" detection:\n",
|
|
" selection:\n",
|
|
" EventID: 4662\n",
|
|
" Properties:\n",
|
|
" - '*Replicating Directory Changes All*'\n",
|
|
" - '*1131f6ad-9c07-11d1-f79f-00c04fc2dcd2*'\n",
|
|
" filter1:\n",
|
|
" SubjectDomainName: Window Manager\n",
|
|
" filter2:\n",
|
|
" SubjectUserName:\n",
|
|
" - NT AUTHORITY*\n",
|
|
" - '*$'\n",
|
|
" condition: selection and not filter1 and not filter2\n",
|
|
" falsepositives:\n",
|
|
" - Valid DC Sync that is not covered by the filters; please report\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:\"4662\" AND object_properties.keyword:(*Replicating\\ Directory\\ Changes\\ All* OR *1131f6ad\\-9c07\\-11d1\\-f79f\\-00c04fc2dcd2*)) AND (NOT (SubjectDomainName:\"Window\\ Manager\"))) AND (NOT (SubjectUserName.keyword:(NT\\ AUTHORITY* OR *$))))')\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
|
|
}
|