{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# DHCP Callout DLL installation\n", "Detects the installation of a Callout DLL via CalloutDlls and CalloutEnabled parameter in Registry, which can be used to execute code in context of the DHCP server (restart required)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Rule Content\n", "```\n", "- title: DHCP Callout DLL installation\n", " id: 9d3436ef-9476-4c43-acca-90ce06bdf33a\n", " status: experimental\n", " description: Detects the installation of a Callout DLL via CalloutDlls and CalloutEnabled\n", " parameter in Registry, which can be used to execute code in context of the DHCP\n", " server (restart required)\n", " references:\n", " - https://blog.3or.de/mimilib-dhcp-server-callout-dll-injection.html\n", " - https://technet.microsoft.com/en-us/library/cc726884(v=ws.10).aspx\n", " - https://msdn.microsoft.com/de-de/library/windows/desktop/aa363389(v=vs.85).aspx\n", " date: 2017/05/15\n", " author: Dimitrios Slamaris\n", " tags:\n", " - attack.defense_evasion\n", " - attack.t1073\n", " - attack.t1112\n", " logsource:\n", " product: windows\n", " service: sysmon\n", " category: null\n", " detection:\n", " selection:\n", " EventID: 13\n", " TargetObject:\n", " - '*\\Services\\DHCPServer\\Parameters\\CalloutDlls'\n", " - '*\\Services\\DHCPServer\\Parameters\\CalloutEnabled'\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-sysmon-*', 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:(*\\\\Services\\\\DHCPServer\\\\Parameters\\\\CalloutDlls OR *\\\\Services\\\\DHCPServer\\\\Parameters\\\\CalloutEnabled))')\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 }