除了混淆之外,还可以采取哪些措施来保护 JAR 文件的安全?

发布于 2024-12-03 00:28:07 字数 138 浏览 1 评论 0原文

我担心 Java 可执行文件的安全性。它们对反编译几乎没有提供保护。使用 Java Decompiler 这样的工具,即使是小孩子也可以反编译类文件以获得原始代码。

除了代码混淆之外,还可以采取什么措施来保护类文件?加密类加载器仍然是一个神话吗?

I'm concerned about the security of Java executables. They offer little protection against decompilation. With tools like Java Decompiler even a kid can decompile the class files to get the original code.

Apart from code obfuscation what can be done to protect a class file? Is the Encrypted Class Loader still a myth?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你爱我像她 2024-12-10 00:28:07

在之前的一家公司中,我们曾有过这样的问题,主要是由于管理层的偏执所致。

首先,你必须明白,绝对安全只是一个神话:只要你的程序运行在不受信任的硬件上,它就可以被反编译,无论你使用什么语言。您唯一可以改变的是攻击者了解您的软件/算法/数据的成本。

关于混淆:它可以被认为是第一级保护,因为它使 Java 代码完全不可读。像 ProGuard 这样的优秀混淆器会在变量/方法名称中使用禁用字符,从而防止执行反编译代码。现在,人们可以认为它是一种足够好的安全措施,因为反编译代码并不像运行 Jad 或其他反编译器并拥有完美运行的 Java 代码那么简单。但是,可以理解此类代码中公开的大多数算法(因为可读代码与可编译代码非常不同)。

其他安全措施包括:

  • 使用某种 Web 服务发送结果并获取结果(使用 REST/SOAP/YouNameIt),在服务器上运行敏感代码
  • 使用 HTTPS 和(可能)附加安全层从远程服务器加载敏感代码。

从这两个安全措施中,我诚实地选择第一个。事实上,第二种攻击可以通过典型的 HTTPS 攻击(中间人、日志代理等)来破坏,并且将代码放在不受信任的硬件上会带来主要的不便,这使得它可以从那里借用。

In a previous company we had such questions, mainly driven by management paranoia.

First of all, you have to understand that absolute security is only a myth: As long as your program is run on untrusted hardware, it can be decompiled, no matter what language you use. The only thing you can change is the cost of an attacker to understand your software/algorithm/data.

Concerning obfuscation: it can be considered a first level of protection, as it makes the Java code totally unreadable. Good obfuscators like ProGuard use forbidden characters in variables/methods names, preventing execution of decompiled code. Now, one can consider it a good enough security measure, as decompiling code is not as simple as running Jad or other decompilers and having perfectly working Java code. However, it is possible to understand most of the algorithms exposed in such code (as readable code is very different from compilable code).

Additional security measures include:

  • Running sensitive code on a server by using some kind of web-service to send results and grab results (using REST/SOAP/YouNameIt)
  • Loading sensitive code from a remote server using HTTPS and (maybe) additional security layers.

From those two security measures, I would honestly choose the first. Indeed, the second can be subverted by typical HTTPS attacks (man in the middle, logging proxies, and so on, ...), and has the major inconvenience of putting the code on untrusted hardware, which makes it possibly borrowable from there.

一个人的夜不怕黑 2024-12-10 00:28:07

基本上,您可以对字节码执行四件事,以保护其免受 Java 反编译器的攻击:

  • 混淆
  • 软件加密
  • 硬件加密
  • 本机编译

我的文章中介绍了所有内容 通过混淆器及其他方式保护您的 Java 代码

Basically, there are four things you can do with your bytecode to protect it against Java decompilers:

  • obfuscation
  • software encryption
  • hardware encryption
  • native compilation

all covered in my article Protect Your Java Code - Through Obfuscators And Beyond

彡翼 2024-12-10 00:28:07

您可以使用 native 编写所有代码。无论如何,逆向工程是可以完成的。但比较难。

好吧,这不是一个严格的 java 解决方案。

正如 nfechner 在评论中所说,编写开源应用程序。

You can write all your code with in native. The reverse engineering can be done anyway. But is harder.

Ok, this is not a strictly java solution.

As nfechner said in a comment write open source application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文