gpt4 book ai didi

Android应用重新打包: Why does it not break the code?

转载 作者:太空宇宙 更新时间:2023-11-03 11:58:53 25 4
gpt4 key购买 nike

我已经阅读了很多关于恶意软件编写者如何重新打包现有的良性 android .apk 并重新打包以添加恶意功能的文章。

现在,根据我对 .apk 文件结构的理解,每个 .apk 文件包含一个 .dex 文件,本质上是 java 字节转换为 .dex 格式。此外,该应用程序还有一个名为 manifest.xml 的二进制 XML 以及其他资源文件和 Assets 。如果我们必须向应用程序添加额外的恶意功能,那么我们必须修改 manifest.xml(可以通过将二进制 xml 转换回普通 xml 轻松完成)、资源(可以直接替换)和 .dex 文件.

但是 .dex 文件有一个特殊的结构。根据我的说法,对它所做的任何修改都应该破坏代码。这些工具使用什么技术来防止代码被破坏,因为如果向原始应用程序添加一些恶意功能,我们实际上是在添加一个额外的模块。

有哪些支持 .apk 文件重新打包的工具?

谢谢。

编辑:一些成员可能会觉得讨论逆向工程很冒犯。我是研究 Android 安全的研究生。我需要知道 .apk 文件重新打包是如何工作的,因为这是我的研究课题。此外,公开谈论逆向工程并不是恶意行为 - 关于逆向工程的书籍已经写成 - 出于恶意目的使用逆向工程是恶意的:)

最佳答案

安全信息

在 Release模式下启用 proguard。这将使逆向工程变得更加困难。还要检查 this developer training documentation on security .

(来自对这个问题的评论)

包签名验证

您可以通过检查签名来验证包是否已被重新打包。一些帮助解决这个问题的文章:

Retrieving APK signature during runtime .
Self checking an APK signature.
How to check APK signature.

(最初发布的广告 Verify Android apk has not been repackaged? )

将DEX反编译为Java

之前回答过一个关于反编译DEX代码的问题。我原来的答案现在可能已经过时了,但这个问题已经被其他人更新了。以下是其中列出的一些工具的概述。

A more complete version of fred's answer:

Manual way

First you need a tool to extract all the (compiled) classes on the DEX to a JAR. There's one called dex2jar, which is made by a chinese student.

Then, you can use jd-gui to decompile the classes on the JAR to source code. The resulting source should be quite readable, as dex2jar applies some optimizations.

1: http://code.google.com/p/dex2jar/
2: http://java.decompiler.free.fr/?q=jdgui

Automatic way

You can use APKTool. It will automatically extract all the classes (.dex), resources (.asrc), then it will convert binary XML to human-readable XML, and it will also dissassemble the classes for you.
Disassembly will always be more robust than decompiling, especially with JARs obfuscated with Pro Guard!

Just tell APKTool to decode the APK into a directory, then modify what you want, and finally encode it back to an APK. That's all.

Important: APKTool dissassembles. It doesn't decompile. The generated code won't be Java source. But you should be able to read it, and even edit it if you're familiar with jasmin. If you want Java source, please go over the Manual way.

(原题:decompiling DEX into Java sourcecode)

关于Android应用重新打包: Why does it not break the code?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16747617/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com