{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Usage of Sysinternals Tools\n", "Detects the usage of Sysinternals Tools due to accepteula key being added to Registry" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Rule Content\n", "```\n", "- action: global\n", " title: Usage of Sysinternals Tools\n", " id: 25ffa65d-76d8-4da5-a832-3f2b0136e133\n", " status: experimental\n", " description: Detects the usage of Sysinternals Tools due to accepteula key being\n", " added to Registry\n", " references:\n", " - https://twitter.com/Moti_B/status/1008587936735035392\n", " date: 2017/08/28\n", " author: Markus Neis\n", " detection:\n", " condition: 1 of them\n", " falsepositives:\n", " - Legitimate use of SysInternals tools\n", " - Programs that use the same Registry Key\n", " level: low\n", "- logsource:\n", " product: windows\n", " service: sysmon\n", " detection:\n", " selection1:\n", " EventID: 13\n", " TargetObject: '*\\EulaAccepted'\n", "- logsource:\n", " category: process_creation\n", " product: windows\n", " detection:\n", " selection2:\n", " CommandLine: '* -accepteula*'\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:*\\\\EulaAccepted)')\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='process_command_line.keyword:*\\ \\-accepteula*')\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 }