API Hooking for Packed Binary Unpacking Detection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current malware detection methods face challenges in unpacking packed program binaries, especially when unknown or undocumented packing techniques are used, leading to difficulties in distinguishing between unpacking and packed code, which can evade antivirus programs and increase the complexity of signature databases.

Innovation Solution

The proposed solution involves using heuristic techniques that hook Application Programming Interface (API) calls to monitor memory allocations and binary mapping, allowing for the detection of unpacked code without executing the unpacking stub, thereby enabling accurate and efficient unpacking of packed binaries.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If signature scanning is used to detect malware, then detection of known malware is improved, but packed malware can evade detection because the signature changes when packed

Engineering Contradiction:
Improvemalware detection accuracyVSAvoiddetection capability against packed malware
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The system performs preliminary unpacking of the malware sample before scanning it with signature-based detection. By extracting the packed code from the self-extracting executable and scanning the unpacked version, the system ensures that the malware signature matches the known database entries, thereby resolving the evasion technique used by packers.

Inventive Principle:
Principle #10Preliminary action

2Ease of operation

If the unpacking process is emulated or controlled by the antivirus program, then extraction of packed code is possible, but anti-emulation and anti-debugging techniques terminate the unpacking process

Engineering Contradiction:
Improveextraction of packed codeVSAvoidunpacking process completion
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The system introduces a sandbox environment as an intermediary between the antivirus program and the self-extracting executable. The sandbox allows the unpacking stub to execute in a controlled, isolated environment without triggering anti-emulation or anti-debugging mechanisms. This enables the packed code to be extracted successfully while maintaining the appearance of a normal execution context.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Adaptability or versatility

If multiple signatures for variations of packing techniques are added to the antivirus signature database, then detection coverage is improved, but the size and maintenance complexity of the signature database increases

Engineering Contradiction:
Improvedetection coverage of packing variationsVSAvoidsignature database size and maintenance
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

Instead of adding numerous signatures to the database to cover different packing variations, the system extracts the packed code from the self-extracting executable and scans it using the existing signature database. This approach eliminates the need to maintain multiple signatures for different packers, as the unpacking process reveals the original malware signature that can be matched against the standard database.

Inventive Principle:
Principle #2Taking out (Extraction)

4Ease of operation

If the unpacking stub is executed to unpack the packed executable, then the packed code is extracted, but determining when unpacking is complete and when the original executable begins execution becomes difficult

Engineering Contradiction:
Improveextraction of packed executableVSAvoiddetection of unpacking completion point
Core Design Contradiction:
Ease of operationVSMeasurement precision

Solution Approach 1:

The system employs feedback mechanisms to monitor the execution of the unpacking stub and determine when unpacking is complete. By analyzing the execution flow, memory allocations, and control transfers during the unpacking process, the system can identify the point at which the packed code has been fully extracted and the original executable begins execution, allowing for precise intervention and scanning.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS10311233B2Generic unpacking of program binaries
Publication Date: 2019.06.04 MCAFEE LLC
  • US10311233B2 patent drawing
  • US10311233B2 patent drawing
  • US10311233B2 patent drawing

AI summary

By hooking application programming interfaces in an execution environment, the return address for hooked application programming interface calls can be logged and used to determine when a packed binary has been unpacked. In one approach, memory allocations are detected and the return address is checked against the memory regions allocated. In another approach, the contents of memory at the return address in a pre-execution copy of the executable binary is compared with the contents of memory at the return address in the executing copy of the binary. This allows efficient detection of the completion of unpacking without knowledge of the unpacking technique. The unpacked binary may then be analyzed for possible malware.