Detect Stripped Payloads in Microsoft Sentinel
Adversaries may attempt to make a payload difficult to analyze by removing symbols, strings, and other human readable information. Scripts and executables may contain variable names and other strings that help developers document code functionality. Symbols are often created by an operating system's linker when executable payloads are compiled. Adversaries use stripped payloads to make malware analysis more difficult. Stripped payload formats include run-only AppleScripts (compiled and stripped AppleScript), stripped ELF binaries on Linux, and stripped PE files on Windows. Cuckoo Stealer and macOS.OSAMiner are notable examples using stripped formats. Golang malware is frequently stripped to remove symbol tables.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1027 Obfuscated Files or Information
- Sub-technique
- T1027.008 Stripped Payloads
- Canonical reference
- https://attack.mitre.org/techniques/T1027/008/
KQL Detection Query
DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName in~ ("osascript", "osacompile")
or FileName in~ ("osascript", "osacompile")
| where ProcessCommandLine has_any ("-x ", "-o ", "compile", ".scpt", ".scptd", "run-only")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc
| union (
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType == "FileCreated"
| where FileName endswith ".scpt" or FileName endswith ".scptd"
| where FolderPath !has "/Library/Scripts/"
and FolderPath !has "/System/Library/"
| project Timestamp, DeviceName, AccountName=InitiatingProcessAccountName,
FileName, FolderPath, InitiatingProcessFileName, InitiatingProcessCommandLine
) Detects stripped payload indicators on macOS: osacompile creating run-only AppleScripts (.scpt files), and osascript executing compiled scripts from non-standard paths. macOS.OSAMiner uses run-only AppleScripts nested inside other run-only AppleScripts to prevent decompilation. Also detects .scpt files created outside standard script directories by non-script-editor applications.
Data Sources
Required Tables
False Positives & Tuning
- IT administrators deploying AppleScript automation tools that compile scripts for distribution
- macOS application builds that compile AppleScript resources as part of their build process
- Legitimate automation frameworks (Automator, Script Editor) that save compiled scripts in user directories
- Go language toolchain installations that strip symbols as part of release builds
Other platforms for T1027.008
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Create Run-Only AppleScript (macOS Stripped Payload)
Expected signal: Process creation events for osacompile (twice) and osascript. File creation events for compiled.scpt and runonly.scpt. The runonly.scpt will fail osadecompile, confirming stripped (run-only) status.
- Test 2Strip Symbols from Linux Binary with strip Command
Expected signal: Process creation for cp, strip, file, and nm commands. File creation and modification events for /tmp/stripped_ls. The 'file' output will show 'stripped', and nm will return 'no symbols'.
- Test 3Compile Go Binary with Symbol Stripping Flags
Expected signal: Process creation for go build with -ldflags '-s -w' arguments. File creation of stripped_go in /tmp. Execution of stripped_go from /tmp. The 'file' command shows stripped ELF.
- Test 4Verify Stripped Binary Cannot Be Analyzed with Standard Tools
Expected signal: Process creation events for cp (twice), strip, and nm (twice). This test demonstrates the before/after comparison an analyst would perform to confirm stripping.
References (4)
- https://attack.mitre.org/techniques/T1027/008/
- https://www.sentinelone.com/labs/fade-dead-adventures-in-reversing-malicious-run-only-applescripts/
- https://www.intezer.com/blog/malware-analysis/executable-linkable-format-101-part-2-symbols/
- https://www.mandiant.com/resources/blog/golang-internals-symbol-recovery
Unlock Pro Content
Get the full detection package for T1027.008 including response playbook, investigation guide, and atomic red team tests.