{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Detect Prohibited Applications Spawning cmd exe Unit Test\n", "\n", "#### This search looks for executions of cmd.exe spawned by a process that is often abused by attackers and that does not typically launch cmd.exe. This is a SPL2 implementation of the rule `Detect Prohibited Applications Spawning cmd.exe`\n", "\n", "Source: https://github.com/splunk/security-content/blob/develop/detections/endpoint/prohibited_apps_spawning_cmdprompt___ssa.yml" ] }, { "cell_type": "code", "execution_count": 92, "metadata": { "execution": { "iopub.execute_input": "2020-10-15T00:21:43.611728Z", "iopub.status.busy": "2020-10-15T00:21:43.611411Z", "iopub.status.idle": "2020-10-15T00:21:43.615239Z", "shell.execute_reply": "2020-10-15T00:21:43.614712Z", "shell.execute_reply.started": "2020-10-15T00:21:43.611700Z" } }, "outputs": [], "source": [ "import json\n", "data='{\"process_path\":\"c:\\\\\\windows\\\\\\system32\",\"process_name\":\"cmd.exe\",\"process\":\"C:\\\\\\Windows\\\\\\system32\\\\\\cmd.exe\",\"parent_process_name\":\"C:\\\\\\Program Files\\\\\\Microsoft Office\\\\\\winword.exe\",\"dest_user_id\":\"eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZmFjdCI6ImFkbWluaXN0cmF0b3IiLCJwcmltYXJ5QXJ0aWZhY3RUeXBlIjoiV0lORE9XU19BQ0NPVU5UX05BTUUifQ\",\"dest_device_id\":\"eyJlbnRpdHlUeXBlIjoiREVWSUNFIiwicHJpbWFyeUFydGlmYWN0Ijoid2luLWRjLTY1NjUwNzEiLCJwcmltYXJ5QXJ0aWZhY3RUeXBlIjoiRE5TIn0\",\"_time\":\"1602004409000\"}'\n", "json.loads(data)\n", "with open(\"detect_prohibited_applications_spawning_cmd_exe.json\", \"w\") as outfile:\n", " outfile.write(data)" ] }, { "cell_type": "code", "execution_count": 94, "metadata": { "execution": { "iopub.execute_input": "2020-10-15T00:22:58.225618Z", "iopub.status.busy": "2020-10-15T00:22:58.225357Z", "iopub.status.idle": "2020-10-15T00:22:59.362013Z", "shell.execute_reply": "2020-10-15T00:22:59.361508Z", "shell.execute_reply.started": "2020-10-15T00:22:58.225596Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c2d2b32468a04f8a8bb7eafd174e5c5d", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(HTML(value=''), FloatProgress(value=0.0, max=5.0), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " Finished. " ] }, { "data": { "text/html": [ "
| \n", " | start_time | \n", "dest_device_id | \n", "field0 | \n", "entities | \n", "process_name | \n", "end_time | \n", "dest_user_id | \n", "parent_process | \n", "body | \n", "value | \n", "input_event | \n", "timestamp | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "2020-10-06 17:13:29 | \n", "eyJlbnRpdHlUeXBlIjoiREVWSUNFIiwicHJpbWFyeUFydG... | \n", "winword.exe | \n", "[eyJlbnRpdHlUeXBlIjoiREVWSUNFIiwicHJpbWFyeUFyd... | \n", "cmd.exe | \n", "2020-10-06 17:13:29 | \n", "eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZm... | \n", "c:\\program files\\microsoft office\\winword.exe | \n", "TBD | \n", "{\"process_path\":\"c:\\\\windows\\\\system32\",\"proce... | \n", "{'process_path': 'c:\\windows\\system32', 'proce... | \n", "2020-10-06 17:13:29 | \n", "