VirusTotal (简称 VT), 是谷歌旗下一家免费提供可疑文件扫描服务的网站. VT 上有超过50家反病毒引擎提供实时扫描服务. 我们每天收集用户上传到 VT 的 APK ...
Trustlook Mobile Security has researched an app (MD5: 67257EA2E9EC6B35C9E5245927980EEA) that is packed/encrypted by Baidu Protect, the service provided by Baidu. Users can upload their APKs to the developer portal in Baidu to get their apps hardened.
The app terminates itself when running on several versions of Android emulators.
It runs on a Moto G phone with Android version 4.4.3. The app has the following structure:
The file “libbaiduprotect.so” under the lib/armeabi folder shows that the app is packed by Baidu Protect.
Some popular unpacking tools don’t seem to work on this app. ZjDroid, for example, which is installed as a module for the Xposed, causes the app to crash. DexExtractor also doesn’t generate any DEX files.
The app has implemented anti-debugging techniques. For example, the following code snippets prevent the debugger from attaching to the process:
Most app packers use JNI native code to modify the Dalvik bytecode in the memory. The packers sometime unpack/decrypt the real DEX file in the memory, which is what gave us a chance to dump the memory.
Using the ADB connect to the phone, we ran the “ps” command, which gave the following result:
The app has the process ID “28953”. We examined the region of the virtual memory in the process.
The first address field shows the starting and ending address of the region in the process’s memory space. The last field shows the name of the file mapped. We fired up “dd” command to dump the memory associated with the last file.
The “dd” command accepts decimal values in the parameters. Here the value for the “skip” parameter is the beginning address of the memory and the “count” parameter takes the range of the beginning and ending value.
After the file is dumped, we pull the file and examine it:
The file is an ODEX file which has the header stripped. After retrieving the magic code, we have the following file:
Unpack the file:
Observe the JAR file:
Note the above method does not work for apps using multiple processes. The memory dumping tool searching for the DEX magic code won’t work on this type of app.