{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Credential Extraction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### FGdump" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2020-10-21T18:06:20.305699Z", "iopub.status.busy": "2020-10-21T18:06:20.305420Z", "iopub.status.idle": "2020-10-21T18:06:35.431304Z", "shell.execute_reply": "2020-10-21T18:06:35.430703Z", "shell.execute_reply.started": "2020-10-21T18:06:20.305672Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "ce9b4b5a9ad04012bca3a6f99f1650b5", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
start_timecmd_lineentitiesprocess_nameparent_process_nameend_timeprocess_pathinput_eventtimestamp
02020-09-14 20:57:28-v[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...cachedump64.exeC:\\Users\\Administrator\\Downloads\\fgdump-2.1.0-...2020-09-14 20:57:28c:\\users\\admini~1\\appdata\\local\\temp{'_tenant': 'test', '_time': '1600117048000', ...2020-09-14 20:57:28
\n", "
" ], "text/plain": [ " start_time ... timestamp\n", "0 2020-09-14 20:57:28 ... 2020-09-14 20:57:28\n", "\n", "[1 rows x 9 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logFgdump.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null),\n", " process_path=ucast(map_get(input_event, \"process_path\"), \"string\", null),\n", " parent_process_name=ucast(map_get(input_event, \"parent_process_name\"), \"string\", null)\n", "| where cmd_line != null AND\n", " match_regex(parent_process_name, /(?i)fgdump.exe/)=true\n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "execution": { "iopub.execute_input": "2020-10-19T07:31:33.752874Z", "iopub.status.busy": "2020-10-19T07:31:33.752605Z", "iopub.status.idle": "2020-10-19T07:31:36.961722Z", "shell.execute_reply": "2020-10-19T07:31:36.960969Z", "shell.execute_reply.started": "2020-10-19T07:31:33.752852Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8ed2f12e58284468be940ca472904ca6", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
start_timecmd_lineentitiesprocess_nameparent_process_nameend_timeprocess_pathinput_eventtimestamp
02020-09-14 20:57:28\"\"C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\cachedu...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...cachedump64.exeC:\\Windows\\System32\\services.exe2020-09-14 20:57:28c:\\users\\admini~1\\appdata\\local\\temp{'_tenant': 'test', '_time': '1600117048000', ...2020-09-14 20:57:28
\n", "
" ], "text/plain": [ " start_time ... timestamp\n", "0 2020-09-14 20:57:28 ... 2020-09-14 20:57:28\n", "\n", "[1 rows x 9 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logFgdump.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null),\n", " process_path=ucast(map_get(input_event, \"process_path\"), \"string\", null),\n", " parent_process_name=ucast(map_get(input_event, \"parent_process_name\"), \"string\", null)\n", "| where cmd_line != null AND process_name != null AND parent_process_name != null AND\n", " match_regex(parent_process_name, /(?i)System32\\\\services.exe/)=true AND\n", " match_regex(process_name, /(?i)cachedump\\d{0,2}.exe/)=true AND\n", " match_regex(process_path, /(?i)\\\\Temp/)=true AND\n", " match_regex(cmd_line, /(?i)\\-s/)=true \n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2020-10-19T06:43:38.657607Z", "iopub.status.busy": "2020-10-19T06:43:38.657338Z", "iopub.status.idle": "2020-10-19T06:43:43.943417Z", "shell.execute_reply": "2020-10-19T06:43:43.942731Z", "shell.execute_reply.started": "2020-10-19T06:43:38.657582Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "f54e0d67a72f4885b5728174656682dc", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
start_timecmd_lineentitiesprocess_nameend_timeprocess_pathinput_eventtimestamp
02020-09-14 20:57:28-v[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...cachedump64.exe2020-09-14 20:57:28c:\\users\\admini~1\\appdata\\local\\temp{'_tenant': 'test', '_time': '1600117048000', ...2020-09-14 20:57:28
\n", "
" ], "text/plain": [ " start_time ... timestamp\n", "0 2020-09-14 20:57:28 ... 2020-09-14 20:57:28\n", "\n", "[1 rows x 8 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logFgdump.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null),\n", " process_path=ucast(map_get(input_event, \"process_path\"), \"string\", null)\n", "| where cmd_line != null AND process_name != null AND process_path != null AND\n", " match_regex(process_name, /(?i)cachedump\\d{0,2}.exe/)=true AND\n", " match_regex(process_path, /(?i)\\\\Temp/)=true AND\n", " match_regex(cmd_line, /(?i)\\-v/)=true \n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### LaZagne" ] }, { "cell_type": "code", "execution_count": 209, "metadata": { "execution": { "iopub.execute_input": "2020-10-16T11:11:37.602675Z", "iopub.status.busy": "2020-10-16T11:11:37.602388Z", "iopub.status.idle": "2020-10-16T11:11:38.897829Z", "shell.execute_reply": "2020-10-16T11:11:38.897200Z", "shell.execute_reply.started": "2020-10-16T11:11:37.602651Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "ea6d405d5dbb45fbbdcccd118a5a74fa", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
end_timestart_timeentitiesprocess_nameinput_eventtimestamp
02020-09-12 01:25:412020-09-12 01:25:41[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...lazagne.exe{'_tenant': 'test', '_time': '1599873941000', ...2020-09-12 01:25:41
12020-09-12 01:25:412020-09-12 01:25:41[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...lazagne.exe{'_tenant': 'test', '_time': '1599873941000', ...2020-09-12 01:25:41
\n", "
" ], "text/plain": [ " end_time ... timestamp\n", "0 2020-09-12 01:25:41 ... 2020-09-12 01:25:41\n", "1 2020-09-12 01:25:41 ... 2020-09-12 01:25:41\n", "\n", "[2 rows x 6 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 209, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logLazagneCredDump.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null)\n", "| where process_name != null AND\n", " match_regex(process_name, /(?i)lazagne.exe/)=true \n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2020-10-19T06:44:15.842408Z", "iopub.status.busy": "2020-10-19T06:44:15.842154Z", "iopub.status.idle": "2020-10-19T06:44:17.835759Z", "shell.execute_reply": "2020-10-19T06:44:17.835188Z", "shell.execute_reply.started": "2020-10-19T06:44:15.842387Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d20cc7f7621b4e449419b4216187807c", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
end_timestart_timecmd_lineentitiesinput_eventtimestamp
02020-09-12 01:25:412020-09-12 01:25:41lazagne all -oA -output lazDump.txt[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1599873941000', ...2020-09-12 01:25:41
12020-09-12 01:25:412020-09-12 01:25:41lazagne all -oA -output lazDump.txt[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1599873941000', ...2020-09-12 01:25:41
\n", "
" ], "text/plain": [ " end_time ... timestamp\n", "0 2020-09-12 01:25:41 ... 2020-09-12 01:25:41\n", "1 2020-09-12 01:25:41 ... 2020-09-12 01:25:41\n", "\n", "[2 rows x 6 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logLazagneCredDump.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null)\n", "| where cmd_line != null AND\n", " match_regex(cmd_line, /(?i)all\\s+\\-oA\\s+\\-output/)=true \n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### PowerSploit/DSInternals" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2020-10-19T06:44:32.330847Z", "iopub.status.busy": "2020-10-19T06:44:32.330579Z", "iopub.status.idle": "2020-10-19T06:44:34.317758Z", "shell.execute_reply": "2020-10-19T06:44:34.317168Z", "shell.execute_reply.started": "2020-10-19T06:44:32.330825Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "55e657aa20074cbaa58dfbcc45ca5ec0", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
end_timestart_timecmd_lineentitiesinput_eventtimestamp
02020-09-17 18:59:052020-09-17 18:59:05powershell -command \"\"Get-ADDBAccount -All -D...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1600369145000', ...2020-09-17 18:59:05
\n", "
" ], "text/plain": [ " end_time ... timestamp\n", "0 2020-09-17 18:59:05 ... 2020-09-17 18:59:05\n", "\n", "[1 rows x 6 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logPowerShellModule.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null)\n", "| where cmd_line != null AND\n", " match_regex(cmd_line, /(?i)Get-ADDBAccount/)=true AND\n", " match_regex(cmd_line, /(?i)\\-dbpath[\\s;:\\.\\|]+/)=true\n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "markdown", "metadata": { "execution": { "iopub.execute_input": "2020-10-16T18:40:38.543645Z", "iopub.status.busy": "2020-10-16T18:40:38.543331Z", "iopub.status.idle": "2020-10-16T18:40:38.546643Z", "shell.execute_reply": "2020-10-16T18:40:38.545902Z", "shell.execute_reply.started": "2020-10-16T18:40:38.543617Z" } }, "source": [ "### Windows-native debuggers: NTKD, LiveKD" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2020-10-19T06:44:40.113042Z", "iopub.status.busy": "2020-10-19T06:44:40.112773Z", "iopub.status.idle": "2020-10-19T06:44:42.191978Z", "shell.execute_reply": "2020-10-19T06:44:42.191344Z", "shell.execute_reply.started": "2020-10-19T06:44:40.113019Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "71f723f491ba4ba29302108a6b3119b8", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
start_timecmd_lineentitiesprocess_nameend_timeinput_eventtimestamp
02020-09-14 17:31:20\"C:\\Program Files (x86)\\Windows Kits\\10\\Debugg...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...ntkd.exe2020-09-14 17:31:20{'_tenant': 'test', '_time': '1600104680000', ...2020-09-14 17:31:20
\n", "
" ], "text/plain": [ " start_time ... timestamp\n", "0 2020-09-14 17:31:20 ... 2020-09-14 17:31:20\n", "\n", "[1 rows x 7 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logNtkdDump.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null)\n", "| where cmd_line != null AND process_name != null AND \n", " ( \n", " match_regex(process_name, /^(?i)ntkd\\.exe/)=true OR\n", " match_regex(process_name, /^(?i)kd\\.exe/)=true \n", " ) AND \n", " match_regex(cmd_line, /(?i)\\-z\\s+/)=true\n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "------------------------------------------------\n", "SAME DETECTION ON LiveKD's DATASET\n", "------------------------------------------------" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "execution": { "iopub.execute_input": "2020-10-19T06:44:58.570342Z", "iopub.status.busy": "2020-10-19T06:44:58.570056Z", "iopub.status.idle": "2020-10-19T06:44:59.753230Z", "shell.execute_reply": "2020-10-19T06:44:59.752699Z", "shell.execute_reply.started": "2020-10-19T06:44:58.570317Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "ef72e8a6d72d41b3b8f3c231d0c74e24", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
start_timecmd_lineentitiesprocess_nameend_timeinput_eventtimestamp
02020-09-12 23:25:47kd.exe -z C:\\Windows\\livekd.dmp[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...kd.exe2020-09-12 23:25:47{'_tenant': 'test', '_time': '1599953147000', ...2020-09-12 23:25:47
\n", "
" ], "text/plain": [ " start_time ... timestamp\n", "0 2020-09-12 23:25:47 ... 2020-09-12 23:25:47\n", "\n", "[1 rows x 7 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logLiveKDFullKernelDump.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null)\n", "| where cmd_line != null AND process_name != null AND \n", " ( \n", " match_regex(process_name, /^(?i)ntkd\\.exe/)=true OR\n", " match_regex(process_name, /^(?i)kd\\.exe/)=true \n", " ) AND \n", " match_regex(cmd_line, /(?i)\\-z\\s+/)=true \n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "execution": { "iopub.execute_input": "2020-10-19T06:45:22.643424Z", "iopub.status.busy": "2020-10-19T06:45:22.643152Z", "iopub.status.idle": "2020-10-19T06:45:23.764872Z", "shell.execute_reply": "2020-10-19T06:45:23.764356Z", "shell.execute_reply.started": "2020-10-19T06:45:22.643401Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "83fc3507d11841139f30b4ff3d3fcf6c", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
start_timecmd_lineentitiesprocess_nameparent_process_nameend_timeinput_eventtimestamp
02020-09-12 23:25:44\\??\\C:\\Windows\\system32\\conhost.exe 0xffffffff...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...conhost.exeC:\\Program Files (x86)\\Windows Kits\\10\\Debugge...2020-09-12 23:25:44{'_tenant': 'test', '_time': '1599953144000', ...2020-09-12 23:25:44
\n", "
" ], "text/plain": [ " start_time ... timestamp\n", "0 2020-09-12 23:25:44 ... 2020-09-12 23:25:44\n", "\n", "[1 rows x 8 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logLiveKDFullKernelDump.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null),\n", " parent_process_name=ucast(map_get(input_event, \"parent_process_name\"), \"string\", null)\n", "| where cmd_line != null AND parent_process_name != null AND process_name != null AND \n", " ( match_regex(parent_process_name, /(?i)ntkd\\.exe/)=true OR\n", " match_regex(parent_process_name, /(?i)livekd\\.exe/)=true\n", " ) AND\n", " match_regex(process_name, /(?i)conhost\\.exe/)=true AND\n", " match_regex(cmd_line, /(?i)0xffffffff/)=true AND\n", " match_regex(cmd_line, /(?i)\\-ForceV1/)=true\n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### PowerSploit modules" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2020-10-21T18:29:40.267475Z", "iopub.status.busy": "2020-10-21T18:29:40.267191Z", "iopub.status.idle": "2020-10-21T18:29:45.564872Z", "shell.execute_reply": "2020-10-21T18:29:45.564202Z", "shell.execute_reply.started": "2020-10-21T18:29:40.267450Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b33e383c863940a1968742c8886d5a37", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
end_timestart_timecmd_lineentitiesinput_eventtimestamp
02020-09-17 18:59:052020-09-17 18:59:05powershell -command \"\"Import-Module PowerSplo...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1600369145000', ...2020-09-17 18:59:05
12020-09-17 18:59:042020-09-17 18:59:04powershell -command \"\"Install-SSP; Install-Se...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1600369144000', ...2020-09-17 18:59:04
22020-09-17 18:59:032020-09-17 18:59:03powershell -command \"\"Get-IPAddress; Convert-...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1600369143000', ...2020-09-17 18:59:03
\n", "
" ], "text/plain": [ " end_time ... timestamp\n", "0 2020-09-17 18:59:05 ... 2020-09-17 18:59:05\n", "1 2020-09-17 18:59:04 ... 2020-09-17 18:59:04\n", "2 2020-09-17 18:59:03 ... 2020-09-17 18:59:03\n", "\n", "[3 rows x 6 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logAllPowerSploitModulesWithOldNames.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null)\n", "| where cmd_line != null AND\n", " ( match_regex(cmd_line, /(?i)Get-ApplicationHost/)=true OR\n", " match_regex(cmd_line, /(?i)Get-CachedGPPPassword/)=true OR\n", " match_regex(cmd_line, /(?i)Get-GPPAutologon/)=true OR\n", " match_regex(cmd_line, /(?i)Get-GPPPassword/)=true OR\n", " match_regex(cmd_line, /(?i)Get-RegistryAutoLogon/)=true OR\n", " match_regex(cmd_line, /(?i)Get-SiteListPassword/)=true OR\n", " match_regex(cmd_line, /(?i)Get-SPNTicket/)=true OR\n", " match_regex(cmd_line, /(?i)Request-SPNTicket/)=true OR\n", " match_regex(cmd_line, /(?i)Get-VaultCredential/)=true OR\n", " match_regex(cmd_line, /(?i)Invoke-Kerberoast/)=true \n", " )\n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### DSInternals" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2020-10-21T18:29:49.499740Z", "iopub.status.busy": "2020-10-21T18:29:49.499462Z", "iopub.status.idle": "2020-10-21T18:29:50.727426Z", "shell.execute_reply": "2020-10-21T18:29:50.726855Z", "shell.execute_reply.started": "2020-10-21T18:29:49.499716Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d1d8d5a4f8184b47a32e8d3fa710d245", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
start_timecmd_lineentitiesprocess_nameparent_process_nameend_timeprocess_pathinput_eventtimestamp
02020-09-17 18:59:02powershell -command \"\"Install-Module DSIntern...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...powershell.exeC:\\Windows\\System32\\cmd.exe2020-09-17 18:59:02c:\\windows\\system32\\windowspowershell\\v1.0{'_tenant': 'test', '_time': '1600369142000', ...2020-09-17 18:59:02
\n", "
" ], "text/plain": [ " start_time ... timestamp\n", "0 2020-09-17 18:59:02 ... 2020-09-17 18:59:02\n", "\n", "[1 rows x 9 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logAllDSInternalsModules.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null),\n", " process_path=ucast(map_get(input_event, \"process_path\"), \"string\", null),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null),\n", " parent_process_name=ucast(map_get(input_event, \"parent_process_name\"), \"string\", null)\n", "| where cmd_line != null AND ( \n", " match_regex(cmd_line, /(?i)Get-ADDBBackupKey/)=true OR\n", " match_regex(cmd_line, /(?i)Get-ADDBDomainController/)=true OR\n", " match_regex(cmd_line, /(?i)Get-ADDBKdsRootKey/)=true OR\n", " match_regex(cmd_line, /(?i)Get-ADDBSchemaAttribute/)=true OR\n", " match_regex(cmd_line, /(?i)Get-ADKeyCredential/)=true OR\n", " match_regex(cmd_line, /(?i)Get-ADReplAccount/)=true OR\n", " match_regex(cmd_line, /(?i)Get-ADReplBackupKey/)=true OR\n", " match_regex(cmd_line, /(?i)Get-ADSIAccount/)=true OR\n", " match_regex(cmd_line, /(?i)Get-AzureADUserEx/)=true OR\n", " match_regex(cmd_line, /(?i)Get-BootKey/)=true OR\n", " match_regex(cmd_line, /(?i)Get-LsaBackupKey/)=true OR\n", " match_regex(cmd_line, /(?i)Get-LsaPolicyInformation/)=true OR\n", " match_regex(cmd_line, /(?i)Get-SamPasswordPolicy/)=true\n", " ) \n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "------------------------------------------------\n", "DSInternals credential converters and decryptors\n", "------------------------------------------------" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2020-10-21T18:29:54.881202Z", "iopub.status.busy": "2020-10-21T18:29:54.880838Z", "iopub.status.idle": "2020-10-21T18:29:58.846049Z", "shell.execute_reply": "2020-10-21T18:29:58.845520Z", "shell.execute_reply.started": "2020-10-21T18:29:54.881168Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "f130a73e8b384980ac1998d2fea445f7", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(HTML(value=''), FloatProgress(value=0.0, max=4.0), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " Finished. " ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
start_timecmd_lineentitiesprocess_nameparent_process_nameend_timeprocess_pathinput_eventtimestamp
02020-09-17 18:59:02powershell -command \"\"Install-Module DSIntern...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...powershell.exeC:\\Windows\\System32\\cmd.exe2020-09-17 18:59:02c:\\windows\\system32\\windowspowershell\\v1.0{'_tenant': 'test', '_time': '1600369142000', ...2020-09-17 18:59:02
\n", "
" ], "text/plain": [ " start_time ... timestamp\n", "0 2020-09-17 18:59:02 ... 2020-09-17 18:59:02\n", "\n", "[1 rows x 9 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logAllDSInternalsModules.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " process_name=ucast(map_get(input_event, \"process_name\"), \"string\", null),\n", " process_path=ucast(map_get(input_event, \"process_path\"), \"string\", null),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null),\n", " parent_process_name=ucast(map_get(input_event, \"parent_process_name\"), \"string\", null)\n", "| where cmd_line != null AND ( \n", " match_regex(cmd_line, /(?i)ConvertFrom-ADManagedPasswordBlob/)=true OR\n", " match_regex(cmd_line, /(?i)ConvertFrom-GPPrefPassword/)=true OR\n", " match_regex(cmd_line, /(?i)ConvertFrom-UnicodePassword/)=true OR\n", " match_regex(cmd_line, /(?i)ConvertTo-GPPrefPassword/)=true OR\n", " match_regex(cmd_line, /(?i)ConvertTo-KerberosKey/)=true OR\n", " match_regex(cmd_line, /(?i)ConvertTo-LMHash/)=true OR\n", " match_regex(cmd_line, /(?i)ConvertTo-NTHash/)=true OR\n", " match_regex(cmd_line, /(?i)ConvertTo-OrgIdHash/)=true OR\n", " match_regex(cmd_line, /(?i)ConvertTo-UnicodePassword/)=true\n", " ) \n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Mimikatz" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2020-10-21T18:30:01.383334Z", "iopub.status.busy": "2020-10-21T18:30:01.383060Z", "iopub.status.idle": "2020-10-21T18:30:03.190514Z", "shell.execute_reply": "2020-10-21T18:30:03.189720Z", "shell.execute_reply.started": "2020-10-21T18:30:01.383303Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "04cf984d9740472dba04265122bc549d", "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", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
end_timestart_timecmd_lineentitiesinput_eventtimestamp
02020-09-11 23:45:192020-09-11 23:45:19mimikatz \"\"kerberos::ptt kerberos::golden ker...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1599867919000', ...2020-09-11 23:45:19
12020-09-11 23:45:212020-09-11 23:45:21mimikatz \"\"crypto::capi crypto::cng crypto::c...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1599867921000', ...2020-09-11 23:45:21
22020-09-11 23:45:172020-09-11 23:45:17mimikatz \"\"lsadump::sam lsadump::secrets lsa...[eyJlbnRpdHlUeXBlIjoiVVNFUiIsInByaW1hcnlBcnRpZ...{'_tenant': 'test', '_time': '1599867917000', ...2020-09-11 23:45:17
\n", "
" ], "text/plain": [ " end_time ... timestamp\n", "0 2020-09-11 23:45:19 ... 2020-09-11 23:45:19\n", "1 2020-09-11 23:45:21 ... 2020-09-11 23:45:21\n", "2 2020-09-11 23:45:17 ... 2020-09-11 23:45:17\n", "\n", "[3 rows x 6 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%spl2 --parallelism=7\n", "| from read_text(\"s3://smle-experiments/datasets/ssa/misko_ssa_detections/logAllMimikatzModules.log\")\n", "| select from_json_object(value) as input_event\n", "| eval timestamp=parse_long(ucast(map_get(input_event, \"_time\"), \"string\", null)),\n", " cmd_line=ucast(map_get(input_event, \"process\"), \"string\", null)\n", "| where cmd_line != null AND (\n", " match_regex(cmd_line, /(?i)CRYPTO::Certificates/)=true OR\n", " match_regex(cmd_line, /(?i)CRYPTO::keys/)=true OR\n", " match_regex(cmd_line, /(?i)kerberos::list/)=true OR\n", " match_regex(cmd_line, /(?i)kerberos::tgt/)=true OR\n", " match_regex(cmd_line, /(?i)lsadump::sam/)=true OR\n", " match_regex(cmd_line, /(?i)lsadump::secrets/)=true OR\n", " match_regex(cmd_line, /(?i)lsadump::cache/)=true OR\n", " match_regex(cmd_line, /(?i)lsadump::lsa/)=true OR\n", " match_regex(cmd_line, /(?i)lsadump::trust/)=true OR\n", " match_regex(cmd_line, /(?i)lsadump::backupkeys/)=true \n", " )\n", "| eval start_time = timestamp,\n", " end_time = timestamp,\n", " entities = mvappend( ucast(map_get(input_event, \"dest_user_id\"), \"string\", null), \n", " ucast(map_get(input_event, \"dest_device_id\"), \"string\", null));" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SPL2", "language": "SPL", "name": "spl2" }, "language_info": { "mimetype": "text/spl", "name": "SPL" } }, "nbformat": 4, "nbformat_minor": 4 }