APK逆向分析入门-以某影视盒子TV版为例
字数 1071 2025-08-22 12:22:48
APK逆向分析入门教学文档 - 以某影视盒子TV版为例
1. 准备工作
1.1 工具准备
- MT管理器:用于查看APK基本信息
- jadx:Java反编译工具,用于分析APK代码
- 小黄鸟(HttpCanary):网络抓包工具
- MP管理器:Activity记录器
1.2 目标APK基本信息分析
- 未加壳处理
- 启动Activity:
com.f0208.lebotv.SplashActivity - 主界面Activity:
HomeActivity
2. AndroidManifest.xml分析
2.1 SplashActivity定义分析
<activity
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name"
android:launchMode="singleTask"
android:name="com.f0208.lebotv.SplashActivity"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.MONKEY"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="f4u4e8"/>
</intent-filter>
</activity>
2.2 关键属性解析
android:screenOrientation="landscape":指定横屏显示(TV版应用特性)android:launchMode="singleTask":单任务模式- 第一个
intent-filter:MAIN:应用主入口LAUNCHER:在启动器中显示
- 第二个
intent-filter:- 可处理
f4u4e8scheme的URL
- 可处理
3. 登录逻辑分析
3.1 登录对话框初始化
public void a(Activity activity, a aVar, boolean z) {
b();
this.f3573b = new Dialog(activity); // 账号登录Dialog初始化
View inflate = View.inflate(activity, C0444R.layout.user_form, null);
this.f3574c = (ProgressBar) inflate.findViewById(C0444R.id.progress);
this.f3574c.setIndeterminateDrawable(activity.getResources().getDrawable(C0444R.drawable.custom_progress_draw));
EditText editText = (EditText) inflate.findViewById(C0444R.id.user_name_et); // 账号输入
EditText editText2 = (EditText) inflate.findViewById(C0444R.id.user_pass_et); // 密码输入
this.f3573b.setTitle("账号登录");
this.f3573b.setContentView(inflate);
this.f3575d = (Button) inflate.findViewById(C0444R.id.btn_confirm);
this.e = (Button) inflate.findViewById(C0444R.id.btn_confirm_epsd); // 忘记密码按钮
this.f = (Button) inflate.findViewById(C0444R.id.btn_confirm_regist); // 注册按钮
this.f3575d.setOnClickListener(new View$OnClickListenerC0311g(this, editText, editText2, aVar)); // 登录按钮
this.e.setOnClickListener(new View$OnClickListenerC0313i(this, activity, aVar, z));
this.f.setOnClickListener(new View$OnClickListenerC0315k(this, activity, aVar, z));
}
3.2 登录请求处理
- 登录按钮点击后调用
View$OnClickListenerC0311g类 - 请求参数:
password:密码phone:手机号uuid:设备唯一标识
- 请求未加密或编码,直接明文传输
3.3 登录状态检查
if (!C0261f.a((Context) MyApplication.f3171a, "isUserLogin", false)) {
com.f0208.lebotv.g.J.a(MyApplication.f3171a, "请登录后再操作", (int) C0444R.drawable.toast_smile);
C0320p.a().a((Activity) this, (C0320p.a) new D(this), true);
} else if (this.C.size() == 0) {
r();
}
C0261f.a方法实现:
public static boolean a(Context context, String str, boolean z) {
return context.getSharedPreferences("com.f0208.lebotv", 0).getBoolean(str, z);
}
4. 绕过登录方法
4.1 修改smali代码
- 找到
isUserLogin相关判断 - 将
nez(不等于零跳转)改为eqz(等于零跳转) - 修改所有相关调用点以确保完全绕过
4.2 网络请求注入(使用小黄鸟)
- 抓取登录成功响应并保存
- 创建静态注入器:
- 选择登录请求
- 编辑响应体
- 上传保存的成功响应
- 应用注入器后,任意账号可登录成功
5. 安全漏洞总结
- API接口硬编码:接口地址直接写在代码中
- 明文传输:登录参数未加密或编码
- 客户端验证:关键功能仅依赖客户端验证登录状态
- 响应可伪造:服务器响应可被轻易伪造
6. 防御建议
- 使用HTTPS加密通信
- 对敏感参数进行加密处理
- 实现服务端严格验证
- 使用签名机制防止请求伪造
- 避免在客户端存储关键逻辑判断
7. 实践练习
- 使用MT管理器分析APK基本信息
- 使用jadx反编译并查找登录相关代码
- 修改smali代码绕过登录验证
- 使用抓包工具拦截并修改登录响应
注:本文档仅供学习Android应用安全分析使用,请勿用于非法用途。