Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to protect (obsfucate) Go binary from cracking

I wish to sell Go application. I will provide serial number to my clients. Is there ways to make it a bit more complex to crack app?

I say it is complex to crack C app and it is easy to crack Java app. Is there tools that will make Go app cracking job as hard as cracking C app? or some tutorial? At least something I could do to protect my project a bit. I do not ask about super heavy protection.

like image 321
Shuriken Avatar asked Jan 04 '14 21:01

Shuriken


People also ask

Is code obfuscation secure?

Ultimately, code obfuscation alone is not enough to handle complex mobile security threats. Although it makes it more difficult to read and understand an app's code, the availability of automated tools, when combined with hackers' expertise, does not make it impossible to reverse-engineer.

Can you reverse engineer obfuscated code?

The results show that it is possible to reverse engineer obfuscated code but some parts. Obfuscation does protect the code, as all the variable names are changed and every unused method are removed, as well as some methods changed to non-con- ventional ways to program.

Can you obfuscate obfuscated code?

Obfuscation means to make something difficult to understand. Programming code is often obfuscated to protect intellectual property or trade secrets, and to prevent an attacker from reverse engineering a proprietary software program. Encrypting some or all of a program's code is one obfuscation method.

What is binary obfuscation?

Binary obfuscation is a technique that aims to shadow the real application code to make it difficult for an external person, who does not have access to your sources, to understand what your program has to do.


2 Answers

Once you have the binary itself, obfuscation is pretty difficult. People have tried stripping the symbols out of Go binaries before, but it usually leads to instability and unpredictable behavior, since symbols are required for certain reflection operations.

While you can't necessarily obfuscate the libraries you're statically linking against, you can certainly obfuscate your /own/ code by changing variable, type, and function names prior to compilation to names that are meaningless. If you want to go one step further, you can try obtaining the source code for the libraries you're using (the source code for the standard libraries is available and is included in most Go installations), and applying this obfuscation to the library source code as well.

As for post-compilation binary modification, as I mentioned before, it's probably best to stay away from it.

like image 140
joshlf Avatar answered Sep 19 '22 14:09

joshlf


To add on joshlf13's answer: while stripping Go binaries is not recommended, there's a flag you can pass to the linker to omit the debugging symbols all along:

Pass the '-s' flag to the linker to omit the debug information (for example, go build -ldflags "-s" prog.go).

(Debugging Go Code with GDB)

This should at least be a better way, since I haven't seen any warnings for this like the ones about stripping symbols post-compilation.

like image 24
justinas Avatar answered Sep 21 '22 14:09

justinas