by asimpletune · 9y ago · 0 comments
From what I've read so far, this is pretty freaking cool. It's super interesting to read these docs and see their thought process involved, especially since the product their building is so different from what people are making on a day to day business. It actually looks pretty fun to work on. Also, I think it's neat to read about their need for developing frameworks that can be used around the agency to accomplish stuff.
Unfortunately, I didn't ready anything about self modifying code, which is probably the most difficult malware to detect and probably to write. Maybe it's in there though, I didn't read the whole document. I came to the comments about half way through to see dozens of people talking about whether they support Wikileaks or not which I think is fine, free country, but I'd like to actually know what some people who work with this kind of stuff think.
A framework for compiling to self modifying, yet correct, code wiukd be super cool. I wonder if it always has to be written by hand? Probably not but maybe that's a separate tool Wikileaks has yet to release.
The exception to that is packers and other obfuscation techniques, which are related to self-modifying code. The general idea with these is that you take your real program and compress/encrypt/mangle/etc it and store that data in an executable. The code in that executable de-compresses/decrypts/demangles that data, sets it as executable, and then runs it. Unlike traditional self-modifying code, packing is orders of magnitude easier to write for the malware developer. The advantage here is that an antivirus tool can't determine what your real program does statically unless it understands how you mangled it, which is hard to do in general. To "unpack" an executable you've got three general techniques:
1. Packers tend to get reused a lot, so just have a person write an unpacker for popular packers by hand, and do some pattern matching to figure out which packer an executable is using. This doesn't work for everything, but it's fairly simple.
2. Dynamic Analysis. Run the executable and watch the contents of memory as the program unpacks itself, the real program should pop right out. Of course you have to run the executable in some sort of sandbox environment, and there's ways for the malware to detect that and alter it's behavior. This also isn't the most efficient process, so you can't really do this to executables during, say, an antivirus scan.
3. Symbolic Analysis. Basically static analysis on steroids to figure out what the executable will do without actually running it. The malware can't stop this with sandbox detection. But it's super slow and is still an active area of research.
Of course nowadays the makers of fine malware detect whether they are running inside a sandbox, and won't activate.
Another comment about the content of this article:
Three quarters down the wiki page there is code for "adding foreign language" to the code. The options are are to add code comments in Arabic/Chinese/Russian/Korean/Farsi. My gut reaction is the purpose of this added language is to obfuscate the true source of the code - i.e. the code has Chinese comments in it so it must be from China. Ahh. I guess this makes sense to do. Only problem now is that the Chinese/Russian/Farsi/etc characters that they included in their code is now public. (Obviously now the CIA will change the foreign language words they insert)
I'd posit if someone had an X-year-old (i.e. x=7) copy of some malware, and the malware had these specific foreign language comments as shown by the article, there's a good possibility the source of the malware would be from the us government.
Analysts never use the language of the code comments for attribution, because such things are trivial to forge.
My comment:
So I see now (thanks to you) that it is just showing test cases (test warbles) to demonstrate that these scrambling techniques work with foreign languages. However, why would the us gov need to make sure that this program can successfully obfuscate Unicode strings in Chinese/Russian/Arabic/Farsi?
My gut reaction: while code comments would be trivial to forge, it appears the us gov is still using foreign language strings in some way - maybe having just one string constant originally in a foreign language that is then obfuscated/scrambled (such as by xoring every char against a random key)
Personally I do not believe self-modifying code would make much sense in their use case. In fact, this would not be possible on iOS due to kernel-based security protections.
It's hairier for people with clearances. Technically you could have your clearance revoked for accessing classified information despite the fact that it's public. I don't know if that's ever happened, but it's a possibility.
https://www.usingenglish.com/reference/idioms/in+that+vein.h...
https://en.wikipedia.org/wiki/Metamorphic_code
https://web.archive.org/web/20070602060312/http://vx.netlux....