News for hackers. Stuff that matters.
Re:Stuxnet is now on GitHub by rst on Sunday February 13, 2011 @10:44AM (#2212967)
Decompiler output; product of the HBGary/Anonymous dump. The most interesting thing here is probably the emails from HBGary folks about StuxNet in the accompanying blog post[1]. (For public purposes, the CEO wants everyone to know, they know nothing about it, but Aaron Barr was talking about it with various people anyway.)

Unfortunately, the decompiler output doesn't convey much as it stands, unless you like sorting through pages and pages of

    local199 = local191;
    local203 = local191 + 0x6f02418d;
    local3 = proc2(0x10021238, param1, param2, param9, param5); /* Warning: also results in local190 */
    local208 = local3;
    local209 = local190;
    local211 = local203;
That being one of the more interesting sections; there are stretches with dozens of lines in a row of the form "localfoo = localbar".

It does seem to suggest, at least, that this dump didn't have the actual source.

[1] http://crowdleaks.org/hbgary-wanted-to-suppress-stuxnet-rese...

Re:Stuxnet is now on GitHub by viraptor on Sunday February 13, 2011 @10:48AM (#2212978)
A silly decompiler that doesn't even recognise for loop with a break (https://github.com/Laurelai/decompile-dump/blob/master/outpu...)

That said... I wonder how useful would github be as a collaborative decompilation space - grab a file, annotate / simplify as much as possible, send pull request, repeat...

Re:Stuxnet is now on GitHub by soulclap on Sunday February 13, 2011 @10:51AM (#2212986)
'collaborative decompilation space' (github-based or not) sounds like a sick idea, actually.
Re:Stuxnet is now on GitHub by nitrogen on Sunday February 13, 2011 @07:38PM (#2214686)
I wonder if Google's translation tools could be adapted to the task: "Suggest a better decompilation," perhaps?

Does anybody have a good reference for how decompilers work? When converting assembly to C by hand I always went through multiple passes (not necessarily in this order): first a literal pass that looked a lot like this dump with gotos and variables named after registers, then I'd identify if/else and switch blocks, then I'd convert any reverse gotos into a while loop, convert while loops into for loops, identify data structures, duplicate lines that had been optimized to a single reference with jmps, etc.

Re:Stuxnet is now on GitHub by NateLawson on Monday February 14, 2011 @01:37AM (#2215650)
Pretty much that, yes.

Also, you have specific idioms for popular compilers (vc, gcc, icc, borland) and value propagation. You could even include an SMT solver to identify constraints and propagate the range to child basic blocks.

Re:Stuxnet is now on GitHub by NateLawson on Monday February 14, 2011 @01:33AM (#2215634)
Bincrowd

http://www.zynamics.com/bincrowd.html

The plugin is open source and the community server is free.

Re:Stuxnet is now on GitHub by mukyu on Monday February 14, 2011 @02:00AM (#2215720)
I wanted to post about this, but I could not remember the name and googling things like '(collaborative OR crowdsource) static binary analysis' was futile. Thanks, it was driving me insane.
Re:Stuxnet is now on GitHub by rst on Sunday February 13, 2011 @11:38AM (#2213096)
Although in this case, the object code may have been deliberately obscured. On reflection, I can't help wondering how much of the seemingly pointless diddling of local variables is the result of turning a naive decompiler on a bytestream where the actual instructions are somehow encrypted or masked.
Re:Stuxnet is now on GitHub by viraptor on Sunday February 13, 2011 @11:46AM (#2213119)
I really don't think so. The decompilation result is genuinely silly. For example look at:

    if (*(int*)(local2 + global0) == 0x4550) {
        local5 = *(unsigned short*)(local2 + global0 + 20);
Either local2 or global0 are pointers to a structure. Neither is detected. Most sensible decompilers would change the names and just make it `local5 = global0[local2].blah` instead. Advanced decompilers also can avoid gotos in almost any case. It also uses function calls without parameters or output, assuming some stack layout probably.

It's a really really bad output, not a result of obscured compilation.

Re:Stuxnet is now on GitHub by DCoder on Sunday February 13, 2011 @11:52AM (#2213139)
I've seen HexRays do the same thing - most of the time you need to actually tell it that a variable is a pointer before it tries to do that.

Stating the function type explicitly also helps it display the right arguments given to it. This output could be significantly improved if the assembly version were available as well.

Re:Stuxnet is now on GitHub by updog on Sunday February 13, 2011 @03:43PM (#2213848)
This came from one of the better known commercial decompilers. Which ones do you consider 'advanced'?
Re:Stuxnet is now on GitHub by viraptor on Sunday February 13, 2011 @06:44PM (#2214502)
Pointed out before: http://news.ycombinator.com/item?id=2214052 - this is from boomerang - not a known commercial decompiler really.
Re:Stuxnet is now on GitHub by NateLawson on Monday February 14, 2011 @01:24AM (#2215601)
Hex-rays is much much better than this. You'll have to see the actual output to understand, but at least here are some examples. It does not do such a bad job with type identification, although it certainly isn't perfect.

http://www.hex-rays.com/hexcomp11.shtml

Re:Stuxnet is now on GitHub by bigmac on Sunday February 13, 2011 @01:53PM (#2213469)
Stuxnet didn't really do anything to actively thwart reverse engineering. See here: http://rdist.root.org/2011/01/17/stuxnet-is-embarrassing-not...

Truly obfuscated code will just plain cause the Hex-Rays decompiler to crash, producing absolutely no output at all.

Re:Stuxnet is now on GitHub by NateLawson on Monday February 14, 2011 @01:28AM (#2215616)
I don't think it would necessarily crash, unless you intentionally wrote code to target a specific bug in Hex-rays itself.

You can certainly get Hex-rays to output confusing information on purpose without actually targeting it. If this was obfuscated, you'd expect that would be much more likely.

Re:Stuxnet is now on GitHub by sp332 on Sunday February 13, 2011 @01:17PM (#2213353)
You could compile the decompiled code with an optimizing compiler, then decompile that, or use GCC's C backend, or something to automatically simplify the program?
Re:Stuxnet is now on GitHub by mukyu on Sunday February 13, 2011 @01:54PM (#2213475)
No. There is just too much information lost going from source to binary and when you use optimization the results are more information lost, not less.

The idea works well enough if you just want get optimized asm though. http://events.ccc.de/congress/2010/Fahrplan/events/4096.en.h...

Re:Stuxnet is now on GitHub by kens on Sunday February 13, 2011 @09:54PM (#2215035)
Is this decompiler output accurate? I'm suspicious because proc12 [¹] looks like memcpy, except it's advancing a byte at a time and copying an int at a time:

  *(int*)local6 = *(int*)local5;
  local5++;
  local6++;
Either the memcpy code is strangely broken, or the decompiler is putting int * where it means char *.

[¹] See full code at https://github.com/Laurelai/decompile-dump/blob/master/outpu... and same for proc20: https://github.com/Laurelai/decompile-dump/blob/master/outpu...

Re:Stuxnet is now on GitHub by yuhong on Sunday February 13, 2011 @02:27PM (#2213578)
"(For public purposes, the CEO wants everyone to know, they know nothing about it, but Aaron Barr was talking about it with various people anyway.)" Which is of course not a good idea in the PR 2.0 age. Anyone found emails explaining why they did this?
Re:Stuxnet is now on GitHub by jeffreyg on Sunday February 13, 2011 @05:07PM (#2214117)
"Throughout the following emails it is revealed that HBGary Federal may have been planning to use Stuxnet for their own purposes"

what does that even mean? nonsensical.

Re:Stuxnet is now on GitHub by nailer on Sunday February 13, 2011 @06:17PM (#2214404)
Parses fine here.

"Here are some emails that show this company was planning to use Stuxnet"

Stuxnet is a distributed bot. It can be commanded. The post is saying this company planned to do that.

I don't know whether that's true or not but it seems easy to understand.

Re:Stuxnet is now on GitHub by jeffreyg on Tuesday February 15, 2011 @02:49PM (#2222914)
late reply but hopefully you'll see. AFAIK, stuxnet is not an application where you can simply 'remove' the centrifuge-targeting payload and add your own. That, combined with the fact that all 4 0-days have been patched, means that I don't think the author's commentary is accurate. There are much better options for HBGary had they wanted command of a distributed botnet and they would have known that.
Re:Stuxnet is now on GitHub by kissickas on Sunday February 13, 2011 @03:14PM (#2213738)
Many of the emails in that article are ordered newest to oldest... not a great link.
Re:Stuxnet is now on GitHub by levigross on Sunday February 13, 2011 @02:22PM (#2213556)
this is just in time for the RSA show that is starting on Monday.
Re:Stuxnet is now on GitHub by leon_ on Monday February 14, 2011 @06:35AM (#2216374)
it's just building the stack frames in C. at the end this is just assembly with C syntax - and the reason why I rather like disassemblies than decompilates.