DEX Code Segmentation and Encryption for Mobile App Protection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Mobile APK files are vulnerable to tampering and reverse engineering due to their ability to be unpacked and modified, allowing for potential malware injection and data exposure.

Innovation Solution

The original DEX program code is split into encrypted segments, stored in separate files, and loaded into non-contiguous memory blocks, where it is decrypted and parsed for execution, using a stub DEX file and DEX shield library to prevent static analysis and reverse engineering.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If the original DEX program code is kept as a single file for easy loading and execution, then the ease of operation is improved, but the security against reverse engineering and tampering deteriorates

Engineering Contradiction:
Improveease of loading and executionVSAvoidvulnerability to reverse engineering and tampering
Core Design Contradiction:
Ease of operationVSObject-affected harmful factors

Solution Approach 1:

The original DEX program code is divided into multiple encrypted segments stored in separate files. Each segment is independently encrypted and can be loaded separately, maintaining ease of operation while enhancing security through distribution and encryption of the code base.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The code transitions from a single plaintext file to multiple encrypted segments with different encryption parameters. The encryption state and segmented structure change the parameters of code storage, making reverse engineering difficult while preserving executable functionality through controlled decryption.

Inventive Principle:
Principle #35Parameter changes

2Object-affected harmful factors

If the DEX program code is encrypted and split into segments, then the security against reverse engineering is improved, but the device complexity increases

Engineering Contradiction:
Improveprotection against reverse engineeringVSAvoidcomplexity of loading and decryption process
Core Design Contradiction:
Object-affected harmful factorsVSDevice complexity

Solution Approach 1:

A DEX shield library acts as an intermediary component that handles the complex tasks of segment loading, decryption, and reassembly. This mediator absorbs the complexity of security operations, allowing the main application to remain relatively simple while still benefiting from enhanced security protections.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Object-affected harmful factors

If the encrypted segments are stored in separate files, then the security against tampering is improved, but the loss of time for loading and processing increases

Engineering Contradiction:
Improveresistance to tamperingVSAvoidtime for loading and decryption
Core Design Contradiction:
Object-affected harmful factorsVSLoss of time

Solution Approach 1:

The DEX shield library performs preliminary actions by pre-loading and caching encrypted segments in memory during initialization. This preliminary preparation reduces the time penalty for subsequent code execution, as the segments are already positioned and ready for decryption when needed during runtime.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS9762385B1Protection of program code of apps of mobile computing devices
Publication Date: 2017.09.12 TREND MICRO INC
  • US9762385B1 patent drawing
  • US9762385B1 patent drawing
  • US9762385B1 patent drawing

AI summary

Original program code of an app of a mobile operating system is protected by splitting the original program code into several program code segments and encrypting the program code segments. The encrypted program code segments are received in separate files in a mobile computing device, where the encrypted program code segments are loaded in memory of the mobile computing device. The encrypted program code segments are decrypted, and the resulting decrypted program code segments are stored in non-contiguous blocks of memory. The decrypted program code segments are parsed for loading and execution in the mobile computing device, such as by a Dalvik process virtual machine of an ANDROID operating system of the mobile computing device.