r/java • • 1h ago

AIs read bytecode very well and can infer source code from it: how do you continue to protect code?

0 Upvotes

24 comments sorted by

31

u/awidesky 56m ago

Obfuscation never protects your code.
Copyright law does.

2

u/ZorakOfThatMagnitude 31m ago

Hard agree, though it hasn't stopped the entertainment industry from trying.

1

u/awidesky 17m ago

Sadly, death penalty hasn't stopped murderers from trying too.
So it's the law enforcement system that actually stops that behavior, maybe.

But since law enforcement system is powered by governments, I'm quite worried that they might cut off some slack for their companies to give them advantages.

Like, it's been a while we heard the news about kimi stealing claude, but did we hear chinese government doing anything?

1

u/zackel_flac 2m ago

Crazy how people are discovering that today. For something to run on your local computer, it needs to read something locally, no way around that.

1

u/zazzedcoffee 19m ago

This is just a fun aside: for some types of software, it can be obfuscated in a cryptographically secure way. That is, it is more efficient to enumerate inputs and outputs (which is still inefficient) than it is to try to reverse engineer it.

I have no idea how it works, but a CS PhD student I knew worked on it.

1

u/awidesky 1m ago

Mostly "Obfuscation" limited in making symbols hard to read for humans(which makes it vulnerable for AI-driven cracking), or encrypt the script with a key and hide the key inside the app as hard as possible(which is not secure at all actually), but there must be lots of other stuff people are working on.

I heard Homomorphic Encryption is powerful in securing LLM privacy, letting server process the input without decrypting it.
I have no idea if that technology can be used in obfuscation, but it seems fun XD

35

u/janora 1h ago

https://java-decompiler.github.io/ can read bytecode even better and lets you even export the sources. There was never a protection from anyone reading the code. You could obfuscate it but in the end the logic does not change.

13

u/revilo-1988 41m ago

Since when do you need to protect Java code? Decompilers and such have always existed. Java is the wrong language for that.

2

u/Proper-Ape 39m ago

Yeah, especially since you don't ship your Java backend as a binary to your customers. You host it.

4

u/revilo-1988 35m ago

It depends on where it's running and what kind of software is being delivered.

1

u/Proper-Ape 25m ago

Yeah of course, but Desktop Java, while possible, is really not that common anymore.

2

u/revilo-1988 24m ago

It's not necessarily about fat clients; often you overload the code for the customer, and they take care of whether they want to run it in a private network.

6

u/AnotherLexMan 54m ago

You've been able to do this with intellij for years at this point anyway.

3

u/sweetno 37m ago

You put it on a server. It was the only way all along.

3

u/_1dontknow 34m ago

That was never the point of JVM bytecode.

4

u/BoltaHuaTota 1h ago

the truth is, you can’t. companies like rockstar are getting their most expensive game ever reverse engineered, there’s not much we can do if someone with enough claude credits to burn decides it’s our time

2

u/FlatWorldliness1061 1h ago

In my opinion you are cooked. If it is possible to completely decompile native binaries (see NFSU2, Fallout 3, ...), then there is no chance in hell to protect your JAR files if they are given to external users (e.g. lib in classpath).

1

u/AnyPhotograph7804 31m ago

You can't if you distribute the binaries. This is not even possible with programming languages, which compile to machine code. If you want to protect your ideas, put the app on a server.

1

u/OhGodNotHimAgain 1h ago

AIs can also slop-copy any product, making a good product that doesn't make consumers think "I should just make my own copy"

0

u/ducki666 58m ago

No giving your (byte)code to public?

0

u/uldall 49m ago

Host the code on a server and only expose an API or UI

-1

u/chambolle 46m ago

To be more precise, even with code obfuscation, the AI recovers very readable source code. What bothers me is not being able to protect code ideas (i.e., algorithms) anymore.

3

u/janora 35m ago

You never could protect your code by technical means. Everything just increased the effort a decompiler had to work through. Use the law to protect them by using your intellectual property rights and contracts! And even then some countries have laws that allow decompilation in certain cases. Maybe checkout the EU Software Directive.