mirror of https://github.com/infosecn1nja/HELK.git
153 lines
4.0 KiB
Plaintext
153 lines
4.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# NetNTLM Downgrade Attack\n",
|
|
"Detects post exploitation using NetNTLM downgrade attacks"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Rule Content\n",
|
|
"```\n",
|
|
"- action: global\n",
|
|
" title: NetNTLM Downgrade Attack\n",
|
|
" id: d67572a0-e2ec-45d6-b8db-c100d14b8ef2\n",
|
|
" description: Detects post exploitation using NetNTLM downgrade attacks\n",
|
|
" references:\n",
|
|
" - https://www.optiv.com/blog/post-exploitation-using-netntlm-downgrade-attacks\n",
|
|
" author: Florian Roth\n",
|
|
" date: 2018/03/20\n",
|
|
" tags:\n",
|
|
" - attack.credential_access\n",
|
|
" - attack.t1212\n",
|
|
" detection:\n",
|
|
" condition: 1 of them\n",
|
|
" falsepositives:\n",
|
|
" - Unknown\n",
|
|
" level: critical\n",
|
|
"- logsource:\n",
|
|
" product: windows\n",
|
|
" service: sysmon\n",
|
|
" detection:\n",
|
|
" selection1:\n",
|
|
" EventID: 13\n",
|
|
" TargetObject:\n",
|
|
" - '*SYSTEM\\\\*ControlSet*\\Control\\Lsa\\lmcompatibilitylevel'\n",
|
|
" - '*SYSTEM\\\\*ControlSet*\\Control\\Lsa\\NtlmMinClientSec'\n",
|
|
" - '*SYSTEM\\\\*ControlSet*\\Control\\Lsa\\RestrictSendingNTLMTraffic'\n",
|
|
"- logsource:\n",
|
|
" product: windows\n",
|
|
" service: security\n",
|
|
" definition: 'Requirements: Audit Policy : Object Access > Audit Registry (Success)'\n",
|
|
" detection:\n",
|
|
" selection2:\n",
|
|
" EventID: 4657\n",
|
|
" ObjectName: \\REGISTRY\\MACHINE\\SYSTEM\\\\*ControlSet*\\Control\\Lsa\n",
|
|
" ObjectValueName:\n",
|
|
" - LmCompatibilityLevel\n",
|
|
" - NtlmMinClientSec\n",
|
|
" - RestrictSendingNTLMTraffic\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='(event_id:\"13\" AND registry_key_path.keyword:(*SYSTEM\\\\*ControlSet*\\\\Control\\\\Lsa\\\\lmcompatibilitylevel OR *SYSTEM\\\\*ControlSet*\\\\Control\\\\Lsa\\\\NtlmMinClientSec OR *SYSTEM\\\\*ControlSet*\\\\Control\\\\Lsa\\\\RestrictSendingNTLMTraffic))')\n",
|
|
"response = s.execute()\n",
|
|
"if response.success():\n",
|
|
" df = pd.DataFrame((d.to_dict() for d in s.scan()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"s = searchContext.query('query_string', query='(event_id:\"4657\" AND object_name.keyword:\\\\REGISTRY\\\\MACHINE\\\\SYSTEM\\\\*ControlSet*\\\\Control\\\\Lsa AND object_value_name:(\"LmCompatibilityLevel\" OR \"NtlmMinClientSec\" OR \"RestrictSendingNTLMTraffic\"))')\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
|
|
}
|