Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #70146

Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops)

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c++
Subject Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops)
Date 2019-11-29 11:21 +0100
Organization A noiseless patient Spider
Message-ID <qrqres$nu4$1@dont-email.me> (permalink)
References <57c02673-cd31-4e78-ba6a-14e4cc4fdeb1@googlegroups.com>

Show all headers | View raw


On 28/11/2019 16:58, Frederick Gotham wrote:
> 
> I have two programs that I need to obfuscate.
> 
> The first one is just two source files and doesn't link with any 3rd
> party libraries, so I just went through the code line by line and
> tagged each function with "__attribute__((always_inline))". This
> worked fine.
> 
> The second program is more complicated. It is linked statically with
> a 3rd party library that I have the source code for. I could go
> through the code for the 3rd party library and tag each function with
> 'always_inline' but I'm looking for a cleaner and handier solution.
> 
> If I take the assembler for my second program, or even the binary
> executable file in ELF format, then I could manipulate the assembler
> (or machine code) in order to remove all function calls (and also
> unroll all loops if possible). Is there a tool for doing this?
> 
> I suppose another thing I could do is compile the 3rd party library
> with some sort of global setting that every function has the
> attribute "always_inline".
> 

Obfustication like this does not work.  If people have enough reason to
want to know what your program does, they will find out.  It will take
them more time and effort, but they will manage it if they want.

But if you simply want to make it harder for casual hackers to know what
is going on in the code, don't mess around manually like this.  Use
link-time optimisation, and -O3 optimisation.  You might also like to
play with some of the parameters to encourage more inlining, cloning,
merging, etc.  There are also a few more experimental code optimisation
options, or ones that change the language semantics, which can be
enabled explicitly (see the gcc documentation for details).  And some,
like the "align" options, you might want to explicitly disable to make
code harder to follow.

The compiler can do a far better job of inlining, code-reordering,
unrolling, etc., than you can hope to manage.

Once your LTO-optimised binary is stripped of all extra symbols, it will
be very difficult to follow by examination of the object code.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Obfuscate Assembler (Remove Function Calls, Unroll Loops) Frederick Gotham <cauldwell.thomas@gmail.com> - 2019-11-28 07:58 -0800
  Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-11-28 19:47 +0100
  Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) Öö Tiib <ootiib@hot.ee> - 2019-11-28 11:19 -0800
    Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) Frederick Gotham <cauldwell.thomas@gmail.com> - 2019-11-28 13:10 -0800
  Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) David Brown <david.brown@hesbynett.no> - 2019-11-29 11:21 +0100
    Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) scott@slp53.sl.home (Scott Lurndal) - 2019-11-29 17:18 +0000
      Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) David Brown <david.brown@hesbynett.no> - 2019-11-30 12:00 +0100
        Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) scott@slp53.sl.home (Scott Lurndal) - 2019-11-30 19:03 +0000
    Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) Frederick Gotham <cauldwell.thomas@gmail.com> - 2019-11-29 10:58 -0800
      Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) Vir Campestris <vir.campestris@invalid.invalid> - 2019-11-29 21:19 +0000
  Re: Obfuscate Assembler (Remove Function Calls, Unroll Loops) Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-11-29 16:43 +0000

csiph-web