This hunt hypothesis targets adversaries who employ complex JavaScript obfuscation techniques within web applications or browser environments to conceal malicious payloads and evade signature-based security controls. A SOC team should proactively hunt for this behavior in Azure Sentinel because obfuscated scripts often serve as the initial entry point for fileless attacks, allowing attackers to execute stealthy commands that traditional static analysis might overlook.
rule generic_javascript_obfuscation
{
meta:
author = "Josh Berry"
date = "2016-06-26"
description = "JavaScript Obfuscation Detection"
sample_filetype = "js-html"
strings:
$string0 = /eval\(([\s]+)?(unescape|atob)\(/ nocase
$string1 = /var([\s]+)?([a-zA-Z_$])+([a-zA-Z0-9_$]+)?([\s]+)?=([\s]+)?\[([\s]+)?\"\\x[0-9a-fA-F]+/ nocase
$string2 = /var([\s]+)?([a-zA-Z_$])+([a-zA-Z0-9_$]+)?([\s]+)?=([\s]+)?eval;/
condition:
any of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 3 string patterns in its detection logic.
Here are specific false positive scenarios for the JavaScript Obfuscation Detection rule, including suggested filters and exclusions:
Scenario 1: Automated Reporting Dashboard Refresh
ServiceAccount_BI on Host-Tableau01). Additionally, filter out alerts where the process image path contains known vendor directories such as \Program Files\Microsoft Power BI Desktop\ or \Program Files\Tableau\.Scenario 2: Software Deployment via Configuration Management
svc_sccm_agent) running on the Configuration Management server. Implement a filter that suppresses detections if the parent process is identified as wuauserv.exe (Windows Update) or ccmexec.exe (SCCM Agent).Scenario 3: Modern Web Application Development Environments