angr / angr/pysoot

Encountering weird problems when analyzing some APK files

未关闭
#16 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
question
主要语言
Python
星标
42
派生
23
平均合并
23 小时 51 分钟
30 天内合并 PR
6

描述

### Question

# Encountering weird problems when analyzing some APK files

I am a beginner, so please forgive me if these issues are actually easy to solve. I have been stuck with these things for a long time.

## Description
When I load different APK files using the following Python code, three weird problems occur that prevent the program from returning the correct results.

Python code:
```
from pysoot.lifter import Lifter

android_sdk_path = "/home/yyy/Android/Sdk/platforms"
apk_file = "xxx.apk"
lifter = Lifter(apk_file, input_format="apk", ir_format="jimple", android_sdk=android_sdk_path)
print("{} has {} classes".format(apk_file, len(lifter.classes)))
```

### Problem 1: Chosen the wrong API version.
The output is:
```
pysoot.errors.JythonClientException: JYTHON SOCKET CLOSED
STDOUT:
b'Soot CUSTOM: Scene created! >>> 3\n'b'Chosen APIVersion: [-1, -1, -1] --> 3\n'
STDERR:
......b'java.lang.RuntimeException: java.lang.RuntimeException: error: target android.jar (/home/yyy/Android/Sdk/platforms/android-3/android.jar) does not exist.\n'

```
or
```
pysoot.errors.JythonClientException: JYTHON SOCKET CLOSED
STDOUT:
b'Soot CUSTOM: Scene created! >>> 3\n'b'Chosen APIVersion: [63055, 28, 19] --> 63055\n'
STDERR:
......b'java.lang.RuntimeException: java.lang.RuntimeException: Required APIVersion (63055) is not available. maxAPI is: 34\n'
```

### Problem 2: Encountered small uint that is out of range.
The output is:
```
pysoot.errors.JythonClientException: JYTHON SOCKET CLOSED
STDOUT:
b'Soot CUSTOM: Scene created! >>> 3\n'b'Chosen APIVersion: [29, 28, 19] --> 29\n'b"Using '/home/yyy/Android/Sdk/platforms/android-29/android.jar' as android.jar\n"b"Warning: exception while processing dex file '/home/yyy/apkfiles/testapk/Mijia/v6.0.214.apk'\n"b'Exception: org.jf.util.ExceptionWithContext: Encountered small uint that is out of range at offset 0x38\n'
STDERR:
......b'org.jf.util.ExceptionWithContext: org.jf.util.ExceptionWithContext: Encountered small uint that is out of range at offset 0x38\n'
```

### Problem 3: The program took more than 4 hours to execute and did not return any results.

## Environment
OS: Ubuntu 20.04
CPU:
Architecture: x86_64
Model name: Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz
CPU(s): 16
MEM: 128G
Python: 3.8.10
pysoot: 7.7.12.1

## APK File
- Problem 1: [xiaomi.v5.1.1.apk](https://drive.google.com/file/d/1xqa6zXRs-Qz1uQS3-yK1nZyiuDlTrwxL/view?usp=drive_link), [xiaomi.v5.7.5.apk](https://drive.google.com/file/d/1eV30-Q6-gARog-mcY6fKhlj8xg_1zebw/view?usp=drive_link)
- Problem 2: [xiaomi.v6.0.214.apk](https://drive.google.com/file/d/1PsS9aGZv2LmsN8XoHboUY9E9lXSUhgD5/view?usp=drive_link)
- Problem 3: [alcidae.v2.5.5.apk](https://drive.google.com/file/d/1TMbjYgIM8hYpuRHJfpFYSpNOf5v_X9Uu/view?usp=drive_link)

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。