News for hackers. Stuff that matters.
Re:How decompilers work by demallien on Thursday May 05, 2011 @09:08AM (#2517200)
Because for two years it was my job to make sure that decompilers didn't work on code generated by my company... It's so easy to throw automatic analysis tools of the track. It's easy to throw humans, and we're way better at this game than automated tools, at least for the time being.

To give you an idea of how easy it is, if you want the decompiler to drop the ball on a for-loop, all you need to do is something simple like increment by two and then decrement by one at the start of the loop body... The tool might be looking for the use of an INC instruction, but because you increment by two, the compiler generates an ADD... and now your tool doesn't know how to recognise the loop.

Re:How decompilers work by zeugma on Thursday May 05, 2011 @11:41AM (#2517763)
What was the reason to do that ? Apart from rendering your own code completely unreadable ?
Re:How decompilers work by ma2rten on Friday May 06, 2011 @09:28AM (#2520855)
That is exactly what I though. I don't know enough about decompilation to argue with OP, but it is my impression that people are too focused on making something that is always guaranteed to work. If you would use some kind of statistical machine learning instead and learn from data (like machine translation for human languages), I would think that you can come a long way, or am I mistaken?
Re:How decompilers work by verroq on Thursday May 05, 2011 @09:23AM (#2517245)
I don't think anyone uses decompilers to analyse machine code.
Re:How decompilers work by demallien on Thursday May 05, 2011 @09:38AM (#2517295)
Err, what do you think decompilers are for then?
Re:How decompilers work by verroq on Thursday May 05, 2011 @10:13AM (#2517408)
Well in reversing applications, most people use disassemblers and debuggers to step/trace/analyse the machine code.

Just because they exist doesn't mean what they provide is of any practical value, as you said it yourself they decompile badly.

Re:How decompilers work by swolchok on Thursday May 05, 2011 @02:30PM (#2518409)
The Hex-Rays decompiler is very good, and I've used it for reversing several times. In particular, it was extremely useful for our analysis of the Green Dam censorware system (http://www.cse.umich.edu/~jhalderm/pub/gd/).
Re:How decompilers work by Luyt on Friday May 06, 2011 @01:39AM (#2520112)
Thanks for exposing that shipwreck of government-mandated Horrorware.

From the Wikipedia article: "As of 30 June 2009, the mandatory pre-installation of the Green Dam software on new computers has been delayed to an undetermined date."

Source: http://en.wikipedia.org/wiki/Green_Dam

Re:How decompilers work by DCoder on Friday May 06, 2011 @12:31AM (#2520010)
The decompilation quality really depends on how obfuscated the original code was, and how much time you care to invest. For example, I'm using Hex-Rays to decompile Command & Conquer: Red Alert 2 and extend it, and now its output looks like [1] , which is a lot better than raw assembly menemonics. Though I've been digging into this game since late 2008, which is a long time.

[1] http://img824.imageshack.us/img824/1188/hexrayscpp.png