IT Pro is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission. Learn more

Hackers abuse single bit change in Intel CPU register to evade detection

Palo Alto Networks discovers that Trap Flag is being abused to notify malware it is being analyzed

Security researchers have discovered a specific single bit (Trap Flag) in the Intel CPU register that malware can abuse to evade sandbox detection.

According to researchers at Palo Alto Networks’ Unit 42 threat research group, malware can detect whether it is executing in a physical or virtual machine (VM) by monitoring the response of the CPU after setting this single bit.

Malware usually avoids detection by checking if it is being run in a virtualized “sandbox” environment set up to safely analyze potential malware. When the malware finds out it is executing in a virtual machine, it will terminate its execution or provide fake outputs to hide its real intentions.

In this instance, to detect VM use in a sandbox, malware could check the CPU’s behavior after enabling the trap flag. This is the eighth single bit in the EFLAGs register of the Intel x86 CPU architecture. 

If the trap flag is enabled before a single instruction is executed, the CPU will raise an exception (single-step mode) after the instruction is completed. This exception stops the CPU execution to allow the exception handler to examine the contents of the registers and memory location. Before allowing code execution to continue, the CPU must also clear the trap flag.

“To determine whether a VM is used, malware can check whether the single-step exception was delivered to the correct CPU instruction, after executing specific instructions (e.g. CPUID, RDTSC, IN) that cause the VM to exit with the TF enabled. During VM exits, the hypervisor – also known as Virtual Machine Monitor (VMM) – will emulate the effects of the physical CPU it encounters,” said researchers.

Researchers also said there was an ongoing cat-and-mouse game between malware authors crafting evasion techniques to prevent effective analysis and sandbox authors researching novel ways to defeat those evasions.

Related Resource

2021 IBM Security X-Force Insider Threat Report

Top discovery methods and recommendations for insider attacks

White background with a black border on side - whitepaper from IBMFree download

“This is one of the main drivers that led us at Palo Alto Networks to build our own custom hypervisor for malware analysis. Since we have full control over the software stack, including the virtualization layer, we can react to new and emerging threats,” said researchers. 

“In this particular case, once we had identified the issue with the incorrect emulation of the trap flag, our hypervisor team was able to test and deploy a fix.”

Researchers have since been able to fix this evasion problem for any malware sample by deploying this technique.

Featured Resources

2022 State of the multi-cloud report

What are the biggest multi-cloud motivations for decision-makers, and what are the leading challenges

Free Download

The Total Economic Impact™ of IBM robotic process automation

Cost savings and business benefits enabled by robotic process automation

Free Download

Multi-cloud data integration for data leaders

A holistic data-fabric approach to multi-cloud integration

Free Download

MLOps and trustworthy AI for data leaders

A data fabric approach to MLOps and trustworthy AI

Free Download

Recommended

Who needs Intel vPro®, An Intel® Evo™ Design, anyway?
Sponsored

Who needs Intel vPro®, An Intel® Evo™ Design, anyway?

18 Nov 2022
Intel unveils Max Series chip family designed for high performance computing
components

Intel unveils Max Series chip family designed for high performance computing

9 Nov 2022
How to trust your inbox with Cloudflare Area 1
Whitepaper

How to trust your inbox with Cloudflare Area 1

19 Oct 2022
Best antivirus for Windows 10
antivirus

Best antivirus for Windows 10

13 Oct 2022

Most Popular

The top 12 password-cracking techniques used by hackers
Security

The top 12 password-cracking techniques used by hackers

14 Nov 2022
How to boot Windows 11 in Safe Mode
Microsoft Windows

How to boot Windows 11 in Safe Mode

15 Nov 2022
Interpol arrests nearly 1,000 cyber criminals in months-long anti-fraud operation
cyber crime

Interpol arrests nearly 1,000 cyber criminals in months-long anti-fraud operation

25 Nov 2022