Blackrota: obfuscated backdoor written in Go
blog.netlab.360.com
blog.netlab.360.com
This is fairly weak: Go runtime functions are unobfuscated, and package names are consistently renamed (that is, if "geacon" is renamed to "ammopppfcdmmecpgbkkj" in one function, it's renamed that way consistently for all functions). This in turn should make it much easier to deobfuscate by gradually expanding the set of "known" package, class and function names.
XOR-encoding of strings is slightly annoying, but since gobfuscator replaces each string with an anonymous function, you could in principle write a simple Unicorn script to emulate each string decoder function, coupled with some heuristics to detect such functions (e.g. just look for functions which have an xor and a single call to runtime_slicebytetostring).
Having worked on really "heavily obfuscated" code (flattened control flow, functions implemented in obfuscated VMs, custom incompatible ABI, cryptographic encryption of code, etc.), this gobfuscator looks comparatively easy :)
For any HN readers who have not already encountered the MOVfuscator [1] I cannot recommend this Blackhat talk highly enough -- the x86 MOV instruction is turing complete, and it flattens arbitrary code to MOVs. It's also the only time I've ever seen brainfuck being used as a seriously sensible intermediate language ;-)
[1] https://www.youtube.com/watch?v=R7EEoWg6Ekk [I think this is the preferred link!]
The mov-only DOOM renders approximately one frame every 7 hours, so playing this version requires somewhat increased patience.
and
https://z0mbie.dreamhosters.com/autorev.txt https://z0mbie.dreamhosters.com/src/mistfall2/index.html
"The virus supports a unique new technique: code integration. The Mistfall engine contained in the virus is capable of decompiling Portable Executable files to its smallest elements, requiring 32MB of memory. Zmist will insert itself into the code: it moves code blocks out of the way, inserts itself, regenerates code and data references (including relocation information), and rebuilds the executable. This is something that has not been seen in any previous virus. Zmist occasionally inserts jump instructions after every single instruction of the code section, each ofwhich will point to the next instruction. Amazingly, these horribly modified applications will still run as before, just like the infected executables do, from generation to generation. In fact we have not seen a single crash during the test replications. Nobody expected this to work, not even its author Zombie.Although it is not foolproof it seems to be good enough for a virus. It takes time for an individual to find the virus in infected files, due to Zmist's extreme camouflage, making it the perfect anti-heuristics virus."
Search here for Zmist (Mistfall is the engine with sources in previous links) description: https://crypto.stanford.edu/cs155old/cs155-spring09/papers/v...
What I am seeing today as malware is a joke compared to those times. The knowledge is just lost.
(And of course, the main source file is named hooy.cpp)
I would love to give some other example next time instead of 20+ years old piece of code. Please share the knowledge.
The biggest contributing factor is likely internet - I don’t think I ever passed executables from one computer to another. The modern package management (think debsums), multi-user separation, digital signatures, open source and “cattle servers” helped a lot too.
It ia still interesting to read about old techniques, they were very ingenious, but it is approximately as relevent as steam train maintenance.
`[edist(S, b) for b in basis]`
Where edist is some Levenshtein edit distance. You can build feature vectors from these by analyzing adjacency within logical blocks. Take other known Go software, obfuscate it, and vectorize it on the same basis. Even though the obfuscation is random, similar code chunks should project to a similar "shape" manifold.
That type of obfuscation is pretty common for PHP malware. The only thing notable here is that the original, human-written source is Go.
Yes, I can attest that. I worked for a company with a team of malware researchers and this was a common obfuscation technique. I would not say the use of Go is novel either. I have reviewed several pieces of malicious code and exploits written in Go in the last five years or so.