Monday, December 25, 2023
Wednesday, December 20, 2023
Sigma rules for Linux and MacOS
Welcome macOS and Linux
logsource:
product: linux
category: process_creation
detection:
selection:
Image|endswith: '/crontab'
CommandLine|contains: ' -l'
condition: selection
Linux, MacOS and Windows examples
Creating Livehunt rules from Sysmon EVTX outputs
import "vt"
rule sigma_example_registry_keys {
meta:
target_entity = "file"
condition:
for any vt_behaviour_sigma_analysis_results in vt.behaviour.sigma_analysis_results: (
for any vt_behaviour_sigma_analysis_results_match_context in vt_behaviour_sigma_analysis_results.match_context: (
vt_behaviour_sigma_analysis_results_match_context.values["TargetObject"] icontains "\\CurrentVersion\\RunOnce\\" and
(vt_behaviour_sigma_analysis_results_match_context.values["Details"] endswith ".vbs" or vt_behaviour_sigma_analysis_results_match_context.values["Details"] endswith ".bat")
)
)
}
import "vt"
rule sigma_rule_evtx_cve {
meta:
target_entity = "file"
condition:
for any vt_behaviour_sigma_analysis_results in vt.behaviour.sigma_analysis_results: (
for any vt_behaviour_sigma_analysis_results_match_context in vt_behaviour_sigma_analysis_results.match_context: (
vt_behaviour_sigma_analysis_results_match_context.values["TargetFilename"] startswith "C:\\Windows\\System32\\" and
vt_behaviour_sigma_analysis_results_match_context.values["TargetFilename"] endswith ".dll" and
for any vt_metadata_tags in vt.metadata.tags: (
vt_metadata_tags icontains "cve-"
)
)
)
}
Sysmon EVTX fields - overlaps
- Sysmon information is fully stored/indexed only the part matching the Sigma rule, which will limit any YARA hunting.
- We mapped most Sysmon fields into YARA VT module for simplicity.
- Linux and MacOS samples do not have any Sysmon information related to Sigma rules. Similar details about the match can be found under the “behaviour” JSON structure entry.
VT Intelligence |
YARA VT module field |
Sigma Category |
Sigma Field |
behavior_created_processes |
vt.behaviour.processes_created |
process_creation |
Image CommandLine ParentCommandLine ParentImage OriginalFileName |
behavior_files |
vt.behaviour.files_attribute_changed vt.behaviour.files_deleted vt.behaviour.files_opened vt.behaviour.files_copied vt.behaviour.files_copied[x].destination vt.behaviour.files_copied[x].source vt.behaviour.files_written vt.behaviour.files_dropped vt.behaviour.files_dropped[x].path vt.behaviour.files_dropped[x].sha256 vt.behaviour.files_dropped[x].type |
file_access file_change file_delete file_rename file_event |
TargetFilename |
behavior_injected_processes |
vt.behaviour.processes_injected |
process_access create_remote_thread process_creation |
CallTrace GrantedAccess SourceImage TargetImage StartModule StartFunction TargetImage SourceImage |
behavior_processes |
vt.behaviour.processes_terminated vt.behaviour.processes_killed vt.behaviour.processes_created vt.behaviour.command_executions vt.behaviour.processes_injected |
process_access create_remote_thread process_creation |
CallTrace GrantedAccess SourceImage TargetImage StartModule StartFunction TargetImage SourceImage Image CommandLine ParentCommandLine ParentImage OriginalFileName |
behavior_registry |
vt.behaviour.registry_keys_deleted vt.behaviour.registry_keys_opened vt.behaviour.registry_keys_set vt.behaviour.registry_keys_set[x].key vt.behaviour.registry_keys_set[x].value |
registry_add registry_delete registry_event registry_rename registry_set |
EventType TargetObject Details |
behavior_services |
vt.behaviour.services_bound vt.behaviour.services_created vt.behaviour.services_opened vt.behaviour.services_started vt.behaviour.services_stopped vt.behaviour.services_deleted |
registry_set process_creation |
Image CommandLine ParentCommandLine ParentImage EventType TargetObject Details |
behavior_network |
vt.behaviour.dns_lookups vt.behaviour.dns_lookups[x].hostname vt.behaviour.dns_lookups[x].resolved_ips vt.behaviour.hosts_file vt.behaviour.ip_traffic vt.behaviour.ip_traffic[x].destination_ip vt.behaviour.ip_traffic[x].destination_port vt.behaviour.ip_traffic[x].transport_layer_protocol vt.behaviour.http_conversations vt.behaviour.http_conversations[x].url vt.behaviour.http_conversations[x].request_method vt.behaviour.http_conversations[x].request_headers vt.behaviour.http_conversations[x].response_headers vt.behaviour.http_conversations[x].response_status_code vt.behaviour.http_conversations[x].response_body_filetype vt.behaviour.smtp_conversations[x].hostname vt.behaviour.smtp_conversations[x].destination_ip vt.behaviour.smtp_conversations[x].destination_port vt.behaviour.smtp_conversations[x].smtp_from vt.behaviour.smtp_conversations[x].smtp_to vt.behaviour.smtp_conversations[x].message_from vt.behaviour.smtp_conversations[x].message_to vt.behaviour.smtp_conversations[x].message_cc vt.behaviour.smtp_conversations[x].message_bcc vt.behaviour.smtp_conversations[x].timestamp vt.behaviour.smtp_conversations[x].subject vt.behaviour.smtp_conversations[x].html_body vt.behaviour.smtp_conversations[x].txt_body vt.behaviour.smtp_conversations[x].x_mailer vt.behaviour.tls |
network_connection |
DestinationHostname DestinationIp DestinationIsIpv6 DestinationPort DestinationPortName SourceIp SourceIsIpv6 SourcePort SourcePortName |
behavior (too generic) |
vt.behaviour.modules_loaded |
image_load |
ImageLoaded Image OriginalFileName |