Skip to content

Commit 51ff3b2

Browse files
authored
Merge pull request #2118 from CybercentreCanada/maco_sync
Sync MalwareConfig model with current MACO spec
2 parents d75fd45 + 5e5795d commit 51ff3b2

1 file changed

Lines changed: 71 additions & 3 deletions

File tree

assemblyline/odm/models/ontology/results/malware_config.py

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
from assemblyline import odm
22
from assemblyline.common.attack_map import attack_map
3-
from assemblyline.odm.models.ontology.results.network import REQUEST_METHODS, LOOKUP_TYPES
3+
from assemblyline.odm.models.ontology.results.network import (
4+
LOOKUP_TYPES,
5+
REQUEST_METHODS,
6+
)
47

58
# Based on model in MaCo framework
69
CATEGORIES = ["adware", "apt", "backdoor", "banker", "bootkit", "bot", "browser_hijacker", "bruteforcer",
710
"clickfraud", "cryptominer", "ddos", "downloader", "dropper", "exploitkit", "fakeav", "hacktool",
811
"infostealer", "keylogger", "loader", "obfuscator", "pos", "proxy", "rat", "ransomware",
912
"reverse_proxy", "rootkit", "scanner", "scareware", "spammer", "trojan", "virus", "wiper",
1013
"webshell", "worm"]
11-
CONNECTION_USAGE = ["c2", "upload", "download", "propagate", "tunnel", "other", "ransom", "decoy"]
14+
CONNECTION_USAGE = ["c2", "upload", "download", "propagate", "tunnel", "other", "ransom", "decoy", "dead_drop_resolver"]
1215

1316

1417
@odm.model(description="Encryption details")
@@ -21,6 +24,8 @@ class Encryption(odm.Model):
2124
iv = odm.Optional(odm.Text(), description="Initialization Vector")
2225
seed = odm.Optional(odm.Text(), description="Seed")
2326
nonce = odm.Optional(odm.Text(), description="Nonce value")
27+
password = odm.Optional(odm.Text(), description="Password")
28+
salt = odm.Optional(odm.Text(), description="Salt")
2429
constants = odm.Optional(odm.List(odm.Text()), description="Constants")
2530
usage = odm.Optional(odm.Enum(values=["config", "communication", "binary", "ransom", "other"]),
2631
description="Purpose of encryptions")
@@ -103,6 +108,15 @@ class DNS(odm.Model):
103108
usage = odm.Optional(odm.Enum(values=CONNECTION_USAGE), description="Purpose of DNS connection")
104109

105110

111+
@odm.model(description="Usage of ICMP")
112+
class ICMP(odm.Model):
113+
type = odm.Optional(odm.Integer(), description="ICMP type")
114+
code = odm.Optional(odm.Integer(), description="ICMP code")
115+
header = odm.Optional(odm.Text(), description="Non-standard header fields")
116+
hostname = odm.Optional(odm.Text(), description="Hostname")
117+
usage = odm.Optional(odm.Enum(values=CONNECTION_USAGE), description="Purpose of ICMP connection")
118+
119+
106120
@odm.model(description="Usage of General TCP/UDP connection")
107121
class GeneralConnection(odm.Model):
108122
client_ip = odm.Optional(odm.IP(), description="Client IP")
@@ -125,7 +139,7 @@ class Service(odm.Model):
125139
class Cryptocurrency(odm.Model):
126140
coin = odm.Optional(odm.Text(), description="Name of coin used")
127141
address = odm.Optional(odm.Text(), description="Wallet address")
128-
random_amount = odm.Optional(odm.Integer(), description="Ransom amount")
142+
ransom_amount = odm.Optional(odm.Float(), description="Ransom amount")
129143
usage = odm.Optional(odm.Enum(values=['ransomware', 'miner', 'other']), description="Use of cryptocurrency")
130144

131145

@@ -187,6 +201,58 @@ class Registry(odm.Model):
187201
description="Use of registry key")
188202

189203

204+
SCHEDULED_TASK_USAGE = ["persistence", "defense_evasion", "privilege_escalation",
205+
"lateral_movement", "staging_data", "other"]
206+
SCHEDULED_TASK_OPERATIONS = ["CHANGE", "CREATE", "DELETE", "END", "QUERY", "RUN"]
207+
SCHEDULED_TASK_SCHEDULE_TYPES = ["MINUTE", "HOURLY", "DAILY", "WEEKLY", "MONTHLY",
208+
"ONCE", "ONSTART", "ONLOGON", "ONIDLE", "ONEVENT", "OTHER"]
209+
SCHEDULED_TASK_RUN_AS = ["SYSTEM", "USER"]
210+
SCHEDULED_TASK_RUN_LEVELS = ["HIGHEST", "LIMITED"]
211+
SCHEDULED_TASK_OUTPUT_FORMATS = ["TABLE", "LIST", "CSV"]
212+
213+
214+
@odm.model(description="Scheduled task usage by malware")
215+
class ScheduledTask(odm.Model):
216+
usage = odm.Optional(odm.Enum(values=SCHEDULED_TASK_USAGE), description="Scheduled task usage")
217+
raw_command = odm.Optional(odm.Text(), description="Raw command used for the scheduled task")
218+
task_type = odm.Optional(odm.Enum(values=SCHEDULED_TASK_OPERATIONS), description="Task operation type")
219+
schedule_type = odm.Optional(odm.Enum(values=SCHEDULED_TASK_SCHEDULE_TYPES), description="Task schedule type")
220+
task_name = odm.Optional(odm.Text(), description="Name of the scheduled task")
221+
task_run = odm.Optional(odm.Text(), description="Program or command that the task runs")
222+
remote_computer = odm.Optional(odm.Text(), description="Name or IP of a remote computer")
223+
user_domain = odm.Optional(odm.Text(), description="User account domain")
224+
user_account = odm.Optional(odm.Text(), description="User account to use when running the task")
225+
user_password = odm.Optional(odm.Text(), description="Password for the user account")
226+
run_as = odm.Optional(odm.Enum(values=SCHEDULED_TASK_RUN_AS), description="Account to run the task as")
227+
run_as_domain = odm.Optional(odm.Text(), description="Domain of the account to run the task as")
228+
run_as_user = odm.Optional(odm.Text(), description="User of the account to run the task as")
229+
run_as_password = odm.Optional(odm.Text(), description="Password of the account to run the task as")
230+
modifier = odm.Optional(odm.Text(), description="Modifier for the schedule type")
231+
day = odm.Optional(odm.Text(), description="How often the task runs within its schedule type")
232+
month = odm.Optional(odm.Text(), description="Month(s) during which the scheduled task should run")
233+
idle_time = odm.Optional(odm.Text(), description="Idle time to wait before running the task")
234+
start_time = odm.Optional(odm.Text(), description="Start time to run the task (HH:mm 24-hour)")
235+
interval = odm.Optional(odm.Text(), description="Repetition interval for the task")
236+
end_time = odm.Optional(odm.Text(), description="End time for the task")
237+
duration = odm.Optional(odm.Text(), description="Duration for which the task should run")
238+
kill = odm.Optional(odm.Boolean(), description="Terminate task if it runs longer than end time or duration")
239+
start_date = odm.Optional(odm.Text(), description="Start date to run the task (MM/dd/yyyy)")
240+
end_date = odm.Optional(odm.Text(), description="End date to run the task (MM/dd/yyyy)")
241+
channel_name = odm.Optional(odm.Text(), description="Event log channel for event-based task")
242+
interactive = odm.Optional(odm.Boolean(), description="Task runs only when user is logged on interactively")
243+
no_password = odm.Optional(odm.Boolean(), description="Task does not require a password")
244+
auto_delete = odm.Optional(odm.Boolean(), description="Task will be deleted after it runs")
245+
xml = odm.Optional(odm.Text(), description="XML file containing the task definition")
246+
v1 = odm.Optional(odm.Boolean(), description="Create using version 1 task scheduler")
247+
force = odm.Optional(odm.Boolean(), description="Create/delete the task and suppress warnings")
248+
run_level = odm.Optional(odm.Enum(values=SCHEDULED_TASK_RUN_LEVELS), description="Run level for the task")
249+
delay_time = odm.Optional(odm.Text(), description="Wait time to delay running the task after trigger")
250+
hresult = odm.Optional(odm.Text(), description="Process exit code in HRESULT format")
251+
output_format = odm.Optional(odm.Enum(values=SCHEDULED_TASK_OUTPUT_FORMATS), description="Query output format")
252+
no_header = odm.Optional(odm.Boolean(), description="Display column headers in output")
253+
add_advanced_properties = odm.Optional(odm.Boolean(), description="Display all properties in output")
254+
255+
190256
@odm.model(description="Extracted Malware Configuration")
191257
class MalwareConfig(odm.Model):
192258
config_extractor = odm.Keyword(description="Name of extractor")
@@ -216,12 +282,14 @@ class MalwareConfig(odm.Model):
216282
ssh = odm.Optional(odm.List(odm.Compound(SSH)), description="SSHs")
217283
proxy = odm.Optional(odm.List(odm.Compound(Proxy)), description="Proxies")
218284
dns = odm.Optional(odm.List(odm.Compound(DNS)), description="DNS")
285+
icmp = odm.Optional(odm.List(odm.Compound(ICMP)), description="ICMPs")
219286
tcp = odm.Optional(odm.List(odm.Compound(GeneralConnection)), description="TCPs")
220287
udp = odm.Optional(odm.List(odm.Compound(GeneralConnection)), description="UDPs")
221288
encryption = odm.Optional(odm.List(odm.Compound(Encryption)), description="Encryptions")
222289
service = odm.Optional(odm.List(odm.Compound(Service)), description="Services")
223290
cryptocurrency = odm.Optional(odm.List(odm.Compound(Cryptocurrency)), description="Cryptocurrencies")
224291
paths = odm.Optional(odm.List(odm.Compound(Path)), description="Paths")
225292
registry = odm.Optional(odm.List(odm.Compound(Registry)), description="Registry")
293+
scheduled_tasks = odm.Optional(odm.List(odm.Compound(ScheduledTask)), description="Scheduled Tasks")
226294

227295
other = odm.Optional(odm.Mapping(odm.Any()), description="Other information")

0 commit comments

Comments
 (0)