Virtualization/Sandbox Evasion: Time Based Evasion

Adversaries may employ various time-based methods to detect and avoid virtualization and analysis environments. This may include enumerating time-based properties, such as uptime or the system clock, as well as the use of timers or other triggers to avoid a virtual machine environment (VME) or sandbox, specifically those that are automated or only operate for a limited amount of time.

Adversaries may employ various time-based evasions, such as delaying malware functionality upon initial execution using programmatic sleep commands or native system scheduling functionality (ex: Scheduled Task/Job). Delays may also be based on waiting for specific victim conditions to be met (ex: system time, events, etc.) or employ scheduled Multi-Stage Channels to avoid analysis and scrutiny.[1]

Benign commands or other operations may also be used to delay malware execution. Loops or otherwise needless repetitions of commands, such as Pings, may be used to delay malware execution and potentially exceed time thresholds of automated analysis environments.[2][3] Another variation, commonly referred to as API hammering, involves making various calls to Native API functions in order to delay execution (while also potentially overloading analysis environments with junk data).[4][5]

Adversaries may also use time as a metric to detect sandboxes and analysis environments, particularly those that attempt to manipulate time mechanisms to simulate longer elapses of time. For example, an adversary may be able to identify a sandbox accelerating time by sampling and calculating the expected value for an environment's timestamp before and after execution of a sleep function.[6]

ID: T1497.003
Sub-technique of:  T1497
Platforms: Linux, Windows, macOS
Defense Bypassed: Anti-virus, Host forensic analysis, Signature-based detection, Static File Analysis
Contributors: Deloitte Threat Library Team; Jeff Felling, Red Canary; Jorge Orchilles, SCYTHE; Ruben Dodge, @shotgunner101
Version: 1.2
Created: 06 March 2020
Last Modified: 15 October 2021
Provided by LAYER 8

Procedure Examples

ID Name Description
S0584 AppleJeus

AppleJeus has waited a specified time before downloading a second stage payload.[7]

S0642 BADFLICK

BADFLICK has delayed communication to the actor-controlled IP address by 5 minutes.[8]

S0534 Bazar

Bazar can use a timer to delay execution of core functionality.[9]

S0574 BendyBear

BendyBear can check for analysis environments and signs of debugging using the Windows API kernel32!GetTickCountKernel32 call.[10]

S0611 Clop

Clop has used the sleep command to avoid sandbox detection.[11]

S0115 Crimson

Crimson can determine when it has been installed on a host for at least 15 days before downloading the final payload.[12]

S0554 Egregor

Egregor can perform a long sleep (greater than or equal to 3 minutes) to evade detection.[13]

S0396 EvilBunny

EvilBunny has used time measurements from 3 different APIs before and after performing sleep operations to check and abort if the malware is running in a sandbox.[14]

S0512 FatDuke

FatDuke can turn itself on or off at random intervals.[15]

S0493 GoldenSpy

GoldenSpy's installer has delayed installation of GoldenSpy for two hours after it reaches a victim system.[16]

S0588 GoldMax

GoldMax has set an execution trigger date and time, stored as an ASCII Unix/Epoch time value.[17]

S0632 GrimAgent

GrimAgent can sleep for 195 - 205 seconds after payload execution and before deleting its task.[18]

S0561 GuLoader

GuLoader has the ability to perform anti-debugging based on time checks, API calls, and CPUID.[19]

S0513 LiteDuke

LiteDuke can wait 30 seconds before executing additional code if security software is detected.[15]

S0447 Lokibot

Lokibot has performed a time-based anti-debug check before downloading its third stage.[20]

S0439 Okrum

Okrum's loader can detect presence of an emulator by using two calls to GetTickCount API, and checking whether the time has been accelerated.[21]

S0626 P8RAT

P8RAT has the ability to "sleep" for a specified time to evade detection.[22]

S0453 Pony

Pony has delayed execution using a built-in function to avoid detection and analysis.[23]

S0650 QakBot

The QakBot dropper can delay dropping the payload to evade detection.[24][25]

S0565 Raindrop

After initial installation, Raindrop runs a computation to delay execution.[26]

S0627 SodaMaster

SodaMaster has the ability to put itself to "sleep" for a specified time.[22]

S0559 SUNBURST

SUNBURST remained dormant after initial access for a period of up to two weeks.[27]

S0595 ThiefQuest

ThiefQuest invokes time call to check the system's time, executes a sleep command, invokes a second time call, and then compares the time difference between the two time calls and the amount of time the system slept to identify the sandbox.[28]

S0266 TrickBot

TrickBot has used printf and file I/O loops to delay process execution as part of API hammering.[5]

S0386 Ursnif

Ursnif has used a 30 minute delay after execution to evade sandbox monitoring tools.[29]

S0658 XCSSET

Using the machine's local time, XCSSET waits 43200 seconds (12 hours) from the initial creation timestamp of a specific file, .report. After the elapsed time, XCSSET executes additional modules.[30]

Mitigations

This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.

Detection

ID Data Source Data Component
DS0017 Command Command Execution
DS0009 Process OS API Execution
Process Creation

Time-based evasion will likely occur in the first steps of an operation but may also occur throughout as an adversary learns the environment. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as lateral movement, based on the information obtained. Detecting actions related to virtualization and sandbox identification may be difficult depending on the adversary's implementation and monitoring required. Monitoring for suspicious processes being spawned that gather a variety of system information or perform other forms of Discovery, especially in a short period of time, may aid in detection.

References

  1. Torello, A. & Guibernau, F. (n.d.). Environment Awareness. Retrieved May 18, 2021.
  2. Loman, M. et al. (2021, July 4). Independence Day: REvil uses supply chain exploit to attack hundreds of businesses. Retrieved September 30, 2021.
  3. Malik, A. (2016, October 14). Nitol Botnet makes a resurgence with evasive sandbox analysis technique. Retrieved September 30, 2021.
  4. Joe Security. (2016, April 21). Nymaim - evading Sandboxes with API hammering. Retrieved September 30, 2021.
  5. Joe Security. (2020, July 13). TrickBot's new API-Hammering explained. Retrieved September 30, 2021.
  6. Kolbitsch, C. (2017, November 1). Evasive Malware Tricks: How Malware Evades Detection by Sandboxes. Retrieved March 30, 2021.
  7. Cybersecurity and Infrastructure Security Agency. (2021, February 21). AppleJeus: Analysis of North Korea’s Cryptocurrency Malware. Retrieved March 1, 2021.
  8. Accenture iDefense Unit. (2019, March 5). Mudcarp's Focus on Submarine Technologies. Retrieved August 24, 2021.
  9. Pantazopoulos, N. (2020, June 2). In-depth analysis of the new Team9 malware family. Retrieved December 1, 2020.
  10. Harbison, M. (2021, February 9). BendyBear: Novel Chinese Shellcode Linked With Cyber Espionage Group BlackTech. Retrieved February 16, 2021.
  11. Santos, D. (2021, April 13). Threat Assessment: Clop Ransomware. Retrieved July 30, 2021.
  12. Huss, D. (2016, March 1). Operation Transparent Tribe. Retrieved June 8, 2016.
  13. Joe Security. (n.d.). Analysis Report fasm.dll. Retrieved January 6, 2021.
  14. Marschalek, M.. (2014, December 16). EvilBunny: Malware Instrumented By Lua. Retrieved June 28, 2019.
  15. Faou, M., Tartare, M., Dupuy, T. (2019, October). OPERATION GHOST. Retrieved September 23, 2020.
  1. Trustwave SpiderLabs. (2020, June 25). The Golden Tax Department and Emergence of GoldenSpy Malware. Retrieved July 23, 2020.
  2. Nafisi, R., Lelli, A. (2021, March 4). GoldMax, GoldFinder, and Sibot: Analyzing NOBELIUM’s layered persistence. Retrieved March 8, 2021.
  3. Priego, A. (2021, July). THE BROTHERS GRIM: THE REVERSING TALE OF GRIMAGENT MALWARE USED BY RYUK. Retrieved July 16, 2021.
  4. Salem, E. (2021, April 19). Dancing With Shellcodes: Cracking the latest version of Guloader. Retrieved July 7, 2021.
  5. Muhammad, I., Unterbrink, H.. (2021, January 6). A Deep Dive into Lokibot Infection Chain. Retrieved August 31, 2021.
  6. Hromcova, Z. (2019, July). OKRUM AND KETRICAN: AN OVERVIEW OF RECENT KE3CHANG GROUP ACTIVITY. Retrieved May 6, 2020.
  7. GREAT. (2021, March 30). APT10: sophisticated multi-layered loader Ecipekac discovered in A41APT campaign. Retrieved June 17, 2021.
  8. hasherezade. (2016, April 11). No money, but Pony! From a mail to a trojan horse. Retrieved May 21, 2020.
  9. Cyberint. (2021, May 25). Qakbot Banking Trojan. Retrieved September 27, 2021.
  10. Kuzmenko, A. et al. (2021, September 2). QakBot technical analysis. Retrieved September 27, 2021.
  11. Symantec Threat Hunter Team. (2021, January 18). Raindrop: New Malware Discovered in SolarWinds Investigation. Retrieved January 19, 2021.
  12. FireEye. (2020, December 13). Highly Evasive Attacker Leverages SolarWinds Supply Chain to Compromise Multiple Global Victims With SUNBURST Backdoor. Retrieved January 4, 2021.
  13. Patrick Wardle. (2020, June 29). OSX.EvilQuest Uncovered part i: infection, persistence, and more!. Retrieved March 18, 2021.
  14. Caragay, R. (2014, December 11). Info-Stealing File Infector Hits US, UK. Retrieved June 5, 2019.
  15. Mac Threat Response, Mobile Research Team. (2020, August 13). The XCSSET Malware: Inserts Malicious Code Into Xcode Projects, Performs UXSS Backdoor Planting in Safari, and Leverages Two Zero-day Exploits. Retrieved October 5, 2021.