The suspicious embed rule detects potential adversarial use of embedded content to exfiltrate data or execute malicious code through seemingly benign files. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify and mitigate early-stage threats that may evade traditional detection methods.
YARA Rule
rule suspicious_embed : PDF raw
{
meta:
author = "Glenn Edwards (@hiddenillusion)"
version = "0.1"
ref = "https://feliam.wordpress.com/2010/01/13/generic-pdf-exploit-hider-embedpdf-py-and-goodbye-av-detection-012010/"
weight = 2
strings:
$magic = { 25 50 44 46 }
$meth0 = /\/Launch/
$meth1 = /\/GoTo(E|R)/ //means go to embedded or remote
$attrib0 = /\/URL /
$attrib1 = /\/Action/
$attrib2 = /\/Filespec/
condition:
$magic in (0..1024) and 1 of ($meth*) and 2 of ($attrib*)
}
This YARA rule can be deployed in the following contexts:
This rule contains 6 string patterns in its detection logic.
Scenario: A system administrator is using PowerShell to generate a report that includes base64 encoded data for formatting purposes.
Filter/Exclusion: Exclude processes where the command line contains powershell.exe and the script path includes reporting or logs.
Scenario: A scheduled job runs nightly to archive user data using rsync and includes base64 encoded metadata in the log files.
Filter/Exclusion: Exclude processes with the command line containing rsync and the log file path includes archive or backup.
Scenario: A CI/CD pipeline (e.g., Jenkins) is using base64 encoding to pass sensitive credentials securely in environment variables.
Filter/Exclusion: Exclude processes where the command line includes jenkins or ci and the environment variable names contain SECRET or TOKEN.
Scenario: A database backup script uses base64 encoding to compress and encrypt data before transferring it over a secure channel.
Filter/Exclusion: Exclude processes where the command line includes backup or db_backup and the output file path includes backup or encrypted.
Scenario: An IT admin is using Python to generate a PDF report that includes base64 encoded images for embedding.
Filter/Exclusion: Exclude processes where the command line includes python and the script path includes report_generator or pdf_export.