Logon Scripts via UserInitMprLogonScript

Metadata

Author

Roberto Rodriguez @Cyb3rWard0g

Creation Date

2020/10/19

Modification Date

2020/10/19

Tactics

[‘TA0003’]

Techniques

[‘T1037.001’]

Tags

[‘art.d6042746-07d4-4c92-9ad8-e644c114a231’]

Dataset Description

This dataset represents adversaries leveraging logon initialization scripts to achieve persistence via the UserInitMprLogonScript user environment.

Notebooks

Notebooks created by the community leveraging the mordor datasets

Author

Name

Link

Simulation Plan

Environment

Tool Type

Module

Lab VM

Manual

Cmd

Adversary View

Microsoft Windows [Version 10.0.18363.1139]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\wardog>echo "echo Art Logon Script atomic test was successful. >> %USERPROFILE%\desktop\T1037.001-log.txt" > %temp%\art.bat

C:\Users\wardog>REG.exe ADD HKCU\Environment /v UserInitMprLogonScript /t REG_SZ /d %temp%\art.bat /f
The operation completed successfully.

Explore Mordor Dataset

Initialize Analytics Engine

from openhunt.mordorutils import *
spark = get_spark()

Download & Process Mordor File

mordor_file = "https://raw.githubusercontent.com/OTRF/mordor/master/datasets/small/windows/persistence/host/cmd_userinitmprlogonscript_batch.zip"
registerMordorSQLTable(spark, mordor_file, "mordorTable")
[+] Processing a Spark DataFrame..
[+] DataFrame Returned !
[+] Temporary SparkSQL View: mordorTable 

Get to know your data

df = spark.sql(
'''
SELECT Hostname,Channel,EventID, Count(*) as count
FROM mordorTable
GROUP BY Hostname,Channel,EventID
ORDER BY count DESC
'''
)
df.show(truncate=False)
+------------+------------------------------------+-------+-----+
|Hostname    |Channel                             |EventID|count|
+------------+------------------------------------+-------+-----+
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|10     |65   |
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|13     |19   |
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|7      |11   |
|WORKSTATION5|Security                            |5158   |5    |
|WORKSTATION5|Security                            |5156   |5    |
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|11     |4    |
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|9      |3    |
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|12     |3    |
|WORKSTATION5|Security                            |4688   |1    |
|WORKSTATION5|Security                            |4689   |1    |
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|1      |1    |
|WORKSTATION5|System                              |104    |1    |
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|5      |1    |
|WORKSTATION5|Microsoft-Windows-Sysmon/Operational|24     |1    |
|WORKSTATION5|Security                            |1102   |1    |
+------------+------------------------------------+-------+-----+