This detection identifies suspicious processes or scripts that incorporate Base64-encoded packed functions, a common obfuscation technique used by adversaries to conceal malicious logic and evade static analysis. Proactively hunting for these patterns in Azure Sentinel is critical because low-severity alerts often represent early-stage reconnaissance or fileless attacks that could escalate into significant threats if the encoded payload’s behavior remains unexamined.
rule possible_includes_base64_packed_functions
{
meta:
impact = 5
hide = true
desc = "Detects possible includes and packed functions"
strings:
$f = /(atob|btoa|;base64|base64,)/ nocase
//$ff = /(?:[A-Za-z0-9]{4}){2,}(?:[A-Za-z0-9]{2}[AEIMQUYcgkosw048]=|[A-Za-z0-9][AQgw]==)/ nocase
$fff = /([A-Za-z0-9]{4})*([A-Za-z0-9]{2}==|[A-Za-z0-9]{3}=|[A-Za-z0-9]{4})/
condition:
$f and $fff
}
This YARA rule can be deployed in the following contexts:
This rule contains 3 string patterns in its detection logic.
Here are 3-5 specific false positive scenarios for the possible_includes_base64_packed_functions detection rule, along with recommended filters or exclusions:
Scenario: Automated PowerShell Script Execution via Scheduled Tasks
Task Scheduler to run maintenance scripts (e.g., log rotation, backup verification) that embed Base64-encoded configuration strings or function definitions directly within the script body. When these scripts execute via powershell.exe, they often trigger high entropy scores characteristic of packed functions.-EncodedCommand and the parent process is Task Scheduler Service (svchost.exe -k netsvcs) or System. Additionally, whitelist specific script paths in C:\ProgramData\Company\ScheduledScripts\*.Scenario: Microsoft Defender for Endpoint (MDE) Live Response & Policy Updates
MsMpEng.exe or SenseiService) periodically downloads and unpacks policy updates, threat intelligence feeds, or performs live response queries. These operations often involve decoding Base64 payloads containing sensor definitions or remote procedure calls (RPC) that mimic packed function signatures.C:\Program Files\Microsoft Defender\MsMpEng.exe and C:\Program Files\Microsoft Defender\SenseiService.exe. Further refine by excluding events where the file hash matches known Microsoft-signed binaries (using a hash allowlist).Scenario: CI/CD Pipeline Artifacts Deployment (e.g., Azure DevOps or Jenkins)
azagent.exe or java.exe running Jenkins) often process YAML manifests or Docker images where