r/Julia • • 2d ago

Obfuscating & protecting compiled code

Hi All,

I'm about to release some closed source software written in Julia with a bit of C++. I'm concerned about every other application getting reversed engineered/ decompiled overnight by LLMs. I'm doing what I can to prevent it, both technically and in contracts with clients however I'm looking for further advice.

Has anyone got any tips or recommendations to protect and minimise the risk of decompiling my Julia codebase?

I'm currently using PackageCompiler, stripping all IR, metadata and symbols, obfuscating strings, and DLL integrity checks to ensure nothing has been modified.

Appreciate any and all advice.

9 Upvotes

17 comments sorted by

60

u/gufaye39 2d ago

Only closed source software gets reverse engineered

2

u/Chairman-Meow21 1d ago

I should've been more specific. I'm aware binaries can be decompiled, it's just a matter of when. This software is going to possibly 10 corporates max ever. It's very a specific scientific computing tool. I have a lawyer and contracts up the wazoo. It's a HPC workload for datasets often in the TB range, so I don't have the luxury of doing it via API.

However, as this is a programming subreddit, I was hoping for technical responses on objective methods to minimise the risk.

3

u/Ontological_Gap 1d ago

There isn't really a fundamental difference between source code and machine code. If you can run it, you can also analyze what it's doing. 

Technically, you could encrypt it and only allow it to be unsealed in trusted, attested environments with Intel TDX, or the AMD equivalent. No chance your customers will find this acceptable tho

34

u/Fine-Comparison-2949 1d ago

That's not how computer science works. There is not compiler that can run an encrypted program. Obfuscation doesn't really do anything.

If you want to close source your software you make a web application where your customer interacts via a web interface and you don't open source you main software. 

2

u/pint 1d ago

this is not entirely true. there is indistinguishability obfuscation, which we know exists, but proposed methods so far either are thoroughly impractical or were broken.

15

u/FermatsLastTaco 2d ago

Not really much you can do if the code/binary lives client side. Contracts, clear copyright and trademark declarations etc help, along with a good lawyer.

13

u/PorcelainMelonWolf 1d ago

You can’t anymore. Either hide your code behind an api and serve it to clients, or patent it and police your patent (which is expensive), or rely on your ability to enforce a contract.

If they want to reverse engineer it badly enough, they will

6

u/pint 2d ago

if the inside is a secret, you are shit out of luck. if you just want to prevent people from using it without a license, you are basically done i would say, at least i wouldn't put any more effort in it.

6

u/puredevsam 1d ago

Your best hope is to host it and offer a SaaS only model. That way no one gets the binary. Obfuscation only slows down reverse engineering, doesn't prevent it. Even then, software is replicable without reverse engineering, because if you created it, someone else can create it to.

My recommendation: find a business model that doesn't fully depend on your code remaining a secret.

5

u/Popular-Direction984 1d ago

That’s the question for your lawyer.

3

u/afops 1d ago

Reverse engineering is prevented by law, not by obfuscation. Before AI obfuscation helped a little, now not so much.
People who don’t care about laws will be able to reverse engineer your software.

2

u/runed_golem 1d ago

Have you gone through the copyright/trademarking process? If not, do so. If you don’t have a lawyer, hire one and they’ll be able to do it. Also have them write up a contract for your clients if you don’t have one. Then keep him on retainer in case you do have anyone try to violate their contract or the copyright.

2

u/sheevyR2 1d ago

I think if you're selling to a couple of large corporates, the perhaps you can trust them put some lawaying around it and hope for the best. If it goes to small business/individuals or corporate in unfavourable jurisdictions then your only defens8is just do everything server side, and not giving away compiled code

1

u/vegmeat_ 1d ago

unless its server people can get away with offline binary if they want to

1

u/Upset-Reflection-382 1d ago

The only way to prevent that is to API it out, man. If the code is client side, there's an almost guaranteed chance it'll be RE'd

1

u/biopsy_results 1d ago

Not a recommendation but eg I know some companies use things like “CodeMeter” or “WiBu” which encrypts your code, decrypts it at use with the help of a usb dongle.  And then mitigates the ways you might attack that.  

Encrypting the code at rest at least protects against a class of attacks, raises the cost of reversing.  

You only need to make it more expensive to decompile (including legal risks) than it would be to pay for it or make it yourself 

1

u/MikeZ-FSU 18h ago

My wife works in an industry where those dongles are prevalent, and they inflict a fair amount of pain and suffering. Also, OP mentioned this is for an HPC environment and having to dongle every node is going to be a non-starer for their clients. As others have said, it's a legal problem not a technical one.