Malicious documents may use specific function prolog signatures to evade detection and execute payloads. SOC teams should proactively hunt for these patterns in Azure Sentinel to identify potential malware activity early and prevent lateral movement or data exfiltration.
YARA Rule
rule maldoc_function_prolog_signature : maldoc
{
meta:
author = "Didier Stevens (https://DidierStevens.com)"
strings:
$a1 = {55 8B EC 81 EC}
$a2 = {55 8B EC 83 C4}
$a3 = {55 8B EC E8}
$a4 = {55 8B EC E9}
$a5 = {55 8B EC EB}
condition:
any of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 5 string patterns in its detection logic.
Scenario: Scheduled System Maintenance Task
Description: A legitimate scheduled task runs a script that includes a function prolog similar to malware patterns (e.g., using GetProcAddress or LoadLibrary for legitimate purposes).
Filter/Exclusion: Exclude processes associated with Task Scheduler or use a filter like process.parent_process_name == "schtasks.exe".
Scenario: PowerShell Script for System Monitoring
Description: A PowerShell script used for system monitoring or compliance checks includes a function prolog that matches the rule’s signature (e.g., using Add-Type or Invoke-Command).
Filter/Exclusion: Exclude processes with process.name == "powershell.exe" and check for known monitoring scripts or use a filter like process.command_line contains "monitor".
Scenario: Antivirus Signature Update Job
Description: An antivirus tool runs a signature update job that temporarily includes code patterns resembling malicious function prologs.
Filter/Exclusion: Exclude processes associated with antivirus tools like avgscan.exe, mcafee_virus_scan.exe, or use a filter like process.name contains "antivirus".
Scenario: Admin Task for Patch Deployment
Description: A system administrator runs a script to deploy patches or updates, which includes function prolog code that matches the rule’s signature.
Filter/Exclusion: Exclude processes initiated by admin tasks (e.g., psexec.exe, PsExec, or msiexec.exe) or use a filter like process.user == "Administrator".
Scenario: Log Collection and Analysis Tool
Description: A log collection tool like Splunk or ELK Stack includes a function prolog during data ingestion that triggers the rule.
Filter/Exclusion: Exclude processes related to log collection tools (e.g.,