HELK/docker/helk-jupyter/notebooks/sigma/win_overpass_the_hash.ipynb

130 lines
3.1 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Successful Overpass the Hash Attempt\n",
"Detects successful logon with logon type 9 (NewCredentials) which matches the Overpass the Hash behavior of e.g Mimikatz's sekurlsa::pth module."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Successful Overpass the Hash Attempt\n",
" id: 192a0330-c20b-4356-90b6-7b7049ae0b87\n",
" status: experimental\n",
" description: Detects successful logon with logon type 9 (NewCredentials) which matches\n",
" the Overpass the Hash behavior of e.g Mimikatz's sekurlsa::pth module.\n",
" references:\n",
" - https://cyberwardog.blogspot.de/2017/04/chronicles-of-threat-hunter-hunting-for.html\n",
" author: Roberto Rodriguez (source), Dominik Schaudel (rule)\n",
" date: 2018/02/12\n",
" tags:\n",
" - attack.lateral_movement\n",
" - attack.t1075\n",
" - attack.s0002\n",
" logsource:\n",
" product: windows\n",
" service: security\n",
" category: null\n",
" detection:\n",
" selection:\n",
" EventID: 4624\n",
" LogonType: 9\n",
" LogonProcessName: seclogo\n",
" AuthenticationPackageName: Negotiate\n",
" condition: selection\n",
" falsepositives:\n",
" - Runas command-line tool using /netonly parameter\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:\"9\" AND logon_process_name:\"seclogo\" AND logon_authentication_package:\"Negotiate\")')\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
}