Decompilers – Myth or Fact

decompileobfuscationreverse-engineering

Lately I have been thinking of application security and binaries and decompilers. (FYI- Decompilers is just an anti-complier, the purpose is to get the source back from the binary)

  • Is there such thing as "Perfect Decompiler"? or are binaries safe from reverse engineering? (For clarity sake, by "Perfect" I mean the original source files with all the variable names/macros/functions/classes/if possible comments in the respective headers and source files used to get the binary)
  • What are some of the best practices used to prevent reverse engineering of software? Is it a major concern?
  • Also is obfuscation/file permissions the only way to prevent unauthorized hacks on scripts? (call me a script-junky if you should)

Best Answer

Is there such thing as "Perfect Decompiler"?

The original source is -- in some languages -- unrecoverable. A version of the source can be constructed, but it will lack meaningful names for variables. It will also lack comments and may have inline code expansions that are confusingly repetitive.

Note that optimizing compilers can make the recovered source pretty obscure-looking.

In other languages, there is enough debugging information that a reasonably readable version of the source can be recovered.

[perfect] mean the original source files with all the variable names/macros/functions/classes/if possible comments in the respective headers and source files used to get the binary)

Never. Macros from the preprocessor are not part of the source, and are always lost forever.

"if possible comments" doesn't make much sense. I'll assume you mean that you want the comments. They're generally gone forever, also.

You can, however, get binary back from stuff that's missing macros and comments. So your definition of "perfect" is inconsistent.

binaries safe from reverse engineering?

No.

What are some of the best practices used to prevent reverse engineering of software?

Offer new versions so quickly that there's no value in reverse engineering the previous version.

Is it a major concern?

Only to lawyers.

Also is obfuscation/file permissions the only way to prevent unauthorized hacks on scripts?

What's an "unauthorized hack"? Indeed, what's to you mean by a "hack" on a script?

If you want to mess with a script, you just mess with it. Unless, of course, it's on a web server, and you're not. Then you don't have access to the script, just the web page presented by the script.