Branch was auto-updated.

This commit is contained in:
Bhavin Patel
2021-11-24 23:36:24 -08:00
committed by GitHub
9 changed files with 150 additions and 13 deletions
@@ -0,0 +1,123 @@
11/24/2021 02:28:14 AM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4688
EventType=0
Type=Information
ComputerName=win-dc-725.attackrange.local
TaskCategory=Process Creation
OpCode=Info
RecordNumber=257876
Keywords=Audit Success
Message=A new process has been created.
Creator Subject:
Security ID: ATTACKRANGE\Administrator
Account Name: Administrator
Account Domain: ATTACKRANGE
Logon ID: 0x55E621
Target Subject:
Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0
Process Information:
New Process ID: 0xca4
New Process Name: C:\Windows\System32\cmd.exe
Token Elevation Type: %%1936
Mandatory Label: Mandatory Label\High Mandatory Level
Creator Process ID: 0x13a4
Creator Process Name: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Process Command Line: "C:\Windows\system32\cmd.exe" /c "pypykatz live registry"
Token Elevation Type indicates the type of token that was assigned to the new process in accordance with User Account Control policy.
Type 1 is a full token with no privileges removed or groups disabled. A full token is only used if User Account Control is disabled or if the user is the built-in Administrator account or a service account.
Type 2 is an elevated token with no privileges removed or groups disabled. An elevated token is used when User Account Control is enabled and the user chooses to start the program using Run as administrator. An elevated token is also used when an application is configured to always require administrative privilege or to always require maximum privilege, and the user is a member of the Administrators group.
Type 3 is a limited token with administrative privileges removed and administrative groups disabled. The limited token is used when User Account Control is enabled, the application does not require administrative privilege, and the user does not choose to start the program using Run as administrator.
11/24/2021 02:28:15 AM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4688
EventType=0
Type=Information
ComputerName=win-dc-725.attackrange.local
TaskCategory=Process Creation
OpCode=Info
RecordNumber=257875
Keywords=Audit Success
Message=A new process has been created.
Creator Subject:
Security ID: ATTACKRANGE\Administrator
Account Name: Administrator
Account Domain: ATTACKRANGE
Logon ID: 0x55E621
Target Subject:
Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0
Process Information:
New Process ID: 0x62c
New Process Name: C:\Windows\System32\reg.exe
Token Elevation Type: %%1936
Mandatory Label: Mandatory Label\High Mandatory Level
Creator Process ID: 0xf6c
Creator Process Name: C:\Windows\System32\cmd.exe
Process Command Line: reg save HKLM\security C:\Users\ADMINI~1\AppData\Local\Temp\security
Token Elevation Type indicates the type of token that was assigned to the new process in accordance with User Account Control policy.
Type 1 is a full token with no privileges removed or groups disabled. A full token is only used if User Account Control is disabled or if the user is the built-in Administrator account or a service account.
Type 2 is an elevated token with no privileges removed or groups disabled. An elevated token is used when User Account Control is enabled and the user chooses to start the program using Run as administrator. An elevated token is also used when an application is configured to always require administrative privilege or to always require maximum privilege, and the user is a member of the Administrators group.
Type 3 is a limited token with administrative privileges removed and administrative groups disabled. The limited token is used when User Account Control is enabled, the application does not require administrative privilege, and the user does not choose to start the program using Run as administrator.
11/24/2021 02:28:16 AM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4688
EventType=0
Type=Information
ComputerName=win-dc-725.attackrange.local
TaskCategory=Process Creation
OpCode=Info
RecordNumber=257874
Keywords=Audit Success
Message=A new process has been created.
Creator Subject:
Security ID: ATTACKRANGE\Administrator
Account Name: Administrator
Account Domain: ATTACKRANGE
Logon ID: 0x55E621
Target Subject:
Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0
Process Information:
New Process ID: 0x1258
New Process Name: C:\Windows\System32\reg.exe
Token Elevation Type: %%1936
Mandatory Label: Mandatory Label\High Mandatory Level
Creator Process ID: 0xf6c
Creator Process Name: C:\Windows\System32\cmd.exe
Process Command Line: reg save HKLM\system C:\Users\ADMINI~1\AppData\Local\Temp\system
Token Elevation Type indicates the type of token that was assigned to the new process in accordance with User Account Control policy.
Type 1 is a full token with no privileges removed or groups disabled. A full token is only used if User Account Control is disabled or if the user is the built-in Administrator account or a service account.
Type 2 is an elevated token with no privileges removed or groups disabled. An elevated token is used when User Account Control is enabled and the user chooses to start the program using Run as administrator. An elevated token is also used when an application is configured to always require administrative privilege or to always require maximum privilege, and the user is a member of the Administrators group.
Type 3 is a limited token with administrative privileges removed and administrative groups disabled. The limited token is used when User Account Control is enabled, the application does not require administrative privilege, and the user does not choose to start the program using Run as administrator.
@@ -6,7 +6,12 @@ import fileinput
import os
import re
import io
import logging
# Logger
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
LOGGER = logging.getLogger(__name__)
class DataManipulation:
def manipulate_timestamp(self, file_path, sourcetype, source):
@@ -50,4 +55,5 @@ class DataManipulation:
new_time = self.difference + event_time
return new_time.strftime("%m/%d/%Y %I:%M:%S %p")
except Exception as e:
LOGGER.error("Error in timestamp replacement occured: " + str(e))
return match.group()
@@ -20,7 +20,7 @@ SLEEP_TIME_SEND_DATA = 30
WAIT_CYCLE = 20
MAX_EXECUTION_TIME_LIMIT = 600 # per detection test
TEST_DATASET = 'windows-security_small.txt'
TEST_DATASET = 'windows-security_debug.txt'
class SSADetectionTesting:
+12 -8
View File
@@ -108,23 +108,27 @@ def read_data(file_path):
data_manipulation = DataManipulation()
modified_file = data_manipulation.manipulate_timestamp(file_path, 'xmlwineventlog', 'WinEventLog:Security')
data = []
event = ""
date_rex = r'\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2} [AP]M'
count = len(open(modified_file).readlines())
i = 0
tmp_counter = 0
for line in fileinput.input(files=modified_file):
file = fileinput.input(files=modified_file)
event = file[0]
start_position = 0
for i in range(1, count):
line = file[i]
i = i + 1
if event.strip() != "" and re.match(date_rex, line):
if re.match(date_rex, line):
data.append(event)
tmp_counter = 0
start_position = i
event = line
else:
tmp_counter = tmp_counter + 1
event = event + line
if i == count and tmp_counter > 10:
data.append(event)
data.append(event)
fileinput.close()
return data
@@ -67,11 +67,11 @@ def main(args):
ssa_detection_testing = SSADetectionTesting(env, tenant, token)
if not fast:
test_result_passed = ssa_detection_testing.test_dsp_pipeline()
# disabled for debugging
# if not test_result_passed:
# sys.exit(1)
if not test_result_passed:
sys.exit(1)
# # test SSA detections
# test SSA detections
test_results = []
test_passed = True
for test_file in test_files_ssa:
@@ -83,3 +83,4 @@ tags:
risk_score: 90
risk_severity: high
security_domain: endpoint
@@ -66,3 +66,4 @@ tags:
risk_score: 63
risk_severity: low
security_domain: endpoint
@@ -83,4 +83,5 @@ tags:
type: Process
role:
- Child Process
@@ -75,3 +75,4 @@ tags:
risk_score: 63
risk_severity: high
security_domain: endpoint