#
Main FAQ Search Member List User Groups Profile Log in to check your messages
Login Register
Return.to/Scheinsicherheit
Code Permutation -- Unpacking Methods / Signature Strength

 
Post new topic   Reply to topic    Return.to/Scheinsicherheit Forum Index -> Malware & Malware Exchange
View previous topic :: View next topic  
Author Message
--ntl--
Guest





PostPosted: Sun Dec 19, 2004 1:33 pm    Post subject: Code Permutation -- Unpacking Methods / Signature Strength Reply with quote

Recently, z0mbie's good 'ol code permutation tool was rediscovered by Aphex and, subsequently, discussed in several underground boards.

1. How does it work?

Taken from the description:

________________________________________________
CODE PERVERTOR
release 1.00

Lets imagine next thing.
We wrote a virus which partially permutates all code it can find - in the CODE sections, binary files, etc. Sure, it will be too hard to perform such thing in all meaning of permutation, but its easy to replace some instructions or instruction groups with their equivalents of the same length. What will be achieved performing that hard task?

- EXECUTABLE FILES will be changed
- PACKED executables & packer checksums will be changed
- TROJANs & their checksums will be changed
(tested on some trojans - all became undetectable)
- VIRUSES & their checksums will be changed

So, IDA will not understand standard libraries. Antiviruses will be unable to detect most of objects processed with such mutation.

Of course probablity of meeting of two viruses on the same PC is low. But anyway there are also lots of packers/trojans.

_______________________________________________



Taken from the configuration file:

_______________________________________________

; ---------------------------------------------------------------------------
; CODE PERVERTOR 2.xx data file
; (x) 2000 Z0MBiE
; ---------------------------------------------------------------------------

; - this file consists of parts, and each part consists of two bitmasks.
; - source bitmask is prefixed with '-' character, and destination with '+'.
; '$' character terminates each two bitmasks.
; - if there are two masks may be applied to one opcode, and -a option
; selected, first mask will be used.
; - opcode conversion possible from first mask into second one,
; but not vise versa.
; - all characters from 'a' to 'z' are copied from first mask to second one,
; but if in the second bitmask any character is in uppercase, value
; will be reversed.
; ***WARNING***:
; each character (such as 'a') means ONE bit, so if first source opcode
; is 0000aaaa, then only 00000000 and 00001111 opcodes will be processed.


- 100010s1 11abcdef ; mov r1, r2
+ 100010S1 11defabc
$
; FIXED!
- 00xyz0s1 11abcdef ; ttt r1, r2 (ADD,ADC,AND,OR,SUB,SBB,XOR,CMP)
+ 00xyz0S1 11defabc
$

- 10001011 11abcdef ; mov r1, r2
+ 01010def ; push r2
01011abc ; pop r1
$

- 10001001 11abcdef ; mov r1, r2
+ 01010abc ; push r2
01011def ; pop r1
$

- 001100sw 11abcabc ; xor r, r
+ 001010sw 11abcabc ; sub r, r
$

- 001010sw 11abcabc ; sub r, r
+ 001100sw 11abcabc ; xor r, r
$

- 000010sw 11abcabc ; or r, r
+ 1000010w 11abcabc ; test r, r
$

- 1000010w 11abcabc ; test r, r
+ 0000100w 11abcabc ; or r, r
$

- 10001011 11100101 ; mov esp, ebp
01011101 ; pop ebp
+ 10010000 ; nop
11001001 ; leave
10010000 ; nop
$

- 10000011 11001abc ; or r, -1
11111111
+ 00110011 11abcabc ; xor r, r
01001abc ; dec r
$

- 01100100 01100111 ; mov r, fs:[0]
10001011 00abc110
00000000 00000000
+ 00110011 11abcabc ; xor r, r
10010000 ; nop
01100100 10001011 ; mov r, fs:[r]
00abcabc
$

- 1101000w 11xyzabc ; ttt r, 1 (ROL,ROR,RCL,RCR,SHL/SHA,SHR,SAR)
1101000w 11xyzabc ; ttt r, 1
+ 10010000 ; nop
1100000w 11xyzabc ; ttt r, 2
00000010
$


_______________________________________________


2. DIY Test & Results

The following samples are variants of harmless Bionet 3.18 & Bionet 4.00.04 trojans (no working , visible server). They were scanned with BOClean, Dr. Web, Ewido, Kaspersky, NOD32 and TDS-3.


Bionet 3.18, standard sample, uncompressed

detected by: every scanner
not detected by: -

Bionet 4, standard sample, uncompressed

detected by: every scanner
not detected by: -

Bionet 3.18, uncompressed, perverted (variant 2)

detected by: BOClean, Dr. Web, Ewido, NOD32, TDS-3
not detected by: Kaspersky

Bionet 4, uncompressed, perverted (variant 2)

detected by: BOClean, Dr. Web, NOD32, TDS-3
not detected by: Ewido, Kaspersky

Bionet 3.18, standard sample, compressed /w UPX

detected by: every scanner
not detected by: -

Bionet 3.18, compressed /w UPX, then perverted (variant 1)

detected by: BOClean, Ewido, NOD32, TDS-3
not detected by: Dr. Web, Kaspersky

Bionet 3.18, compressed /w UPX, then perverted (variant 2)

detected by: BOClean, Ewido, NOD32, TDS-3
not detected by: Dr. Web, Kaspersky

Bionet 3.18, perverted (variant 2), then compressed /w UPX

detected by: BOClean, Dr. Web, Ewido, NOD32, TDS-3
not detected by: Kaspersky

Bionet 3.18, perverted (variant 2), then compressed /w UPX, then perverted again (variant 2)

detected by: BOClean, Ewido, NOD32, TDS-3
not detected by: Dr. Web, Kaspersky

Bionet 3.18, compressed /w UPX, then perverted (variant 3)

detected by: BOClean, Ewido, NOD32, TDS-3
not detected by: Dr. Web, Kaspersky

Bionet 3.18, compressed /w Petite 2.2

detected by: BOClean, Dr. Web, Ewido (on access/mem scan), Kasperky, NOD32, TDS-3
not detected by: Ewido (on demand)

Bionet 3.18, compressed /w Petite 2.2, then perverted (variant 2)

detected by: BOClean, Ewido (on access/mem scan), NOD32, TDS-3
not detected by: Dr. Web, Ewido (on demand), Kaspersky



3. Analysis of Results

a) Kaspersky

Kaspersky uses a static, signature-based unpacking engine. The unpacking engine is extremely powerful since it supports hundreds of different packers and crypters. However, it is also extremely vulnerable to code permutation.

The same applies to Kaspersky's single-point scanning technique in connection with the use of code-based signatures (i.e., the code permutation vulnerability does not merely apply to Kasperky's unpacking engine but also to the main scan engine which is responsible for the detection of uncompressed samples).

b) Dr. Web

It seems that Dr. Web's also uses a static unpacking engine and, therefore, is affected in the same manner like Kaspersky.

The signatures used by Dr. Web for the detection of the Bionet trojan seem to be resistent to code permutation. However, we also performed internal tests with trojans like Lithium 1.03. Because Dr. Web did not detect permutated variants of other trojans we conclude that Dr. Web is partially affected by this vulnerability.

c) Ewido

Ewido uses a generic unpacking engine that is less vulnerable to code permutation. On the other hand, Ewido's generic unpacking engine is less powerful than Kaspersky's static one (i.e., there are many compressors like Petite that are not (yet?) supported by Ewido). Fortunately, Ewido also supports memory scanning.

Like Kaspersky, Ewido's scan engine uses code-based signatures. In the light of the fact that Ewido claimed (and still claims?) to use "fuzzy", patch-proof signatures we expected that Ewido would be able to resolve the permutations and, therefore, be resistant to code permutation. However, the non-detected Bionet 4 sample and our internal tests with other samples (like Lithium 1.03 and Aphex FTP) show that Ewido's "fuzzy" code-based signatures are almost as vulnerable as Kaspersky's code based signatures.

d) NOD32

Not too bad ... the term "advanced heuristics" does not seem to be a mere marketing gag. It will require a more indepth analysis in order to figure out how NOD32 exactly works.

e) BOClean & TDS-3

BOClean & TDS-3 do not rely on code-based signatures and, therefore, these scanners are not affected by the code permutation vulnerability. In other words, signatures that are based on text strings are sometimes, but not always inferior.



4. Conclusion:

Probably, a good AT scanner should use different types of signatures, e.g., code-based signatures, signatures based on text strings and also signatures taken from the resource section (i.e., a file section that frequently remains uncompressed).


Nautilus, the Pervert.
Back to top
Guest






PostPosted: Sun Dec 19, 2004 1:55 pm    Post subject: Reply with quote

Addendum: Trojan Hunter seems to detect any permuted Bionet samples because special advanced heuristics have been created for this well-known trojan familiy. Permuted variants of other popular trojans like Lithium 1.03, however, are not detected. Therefore, we conclude that also Trojan Hunter is affected by code permutation.


Please feel free to reconfirm the above results. Moreover, you can test other scanners and post the results in this topic.
Back to top
Guest






PostPosted: Sun Dec 19, 2004 9:45 pm    Post subject: Reply with quote

It seems that TDS use for the packed version(s) of Bionet 3.18 the Text string TServerForm inside the rsrc section of the trojan file. For the unpacked version of this trojan TDS uses maybe an other string. The other AT scanner aČ is also not able to detect the pervert trojan samples.
Back to top
where can i find the z0mb
Guest





PostPosted: Wed Feb 02, 2005 6:37 pm    Post subject: where can i find the z0mbie Reply with quote

where can i find the z0mbie code perverter
Back to top
Guest






PostPosted: Wed Feb 02, 2005 11:05 pm    Post subject: Reply with quote

http://www.google.com.au/search?hl=en&ie=ISO-8859-1&q=CODE+PERVERTOR+&btnG=Google+Search&meta=
Back to top
Guest






PostPosted: Tue Mar 01, 2005 2:41 am    Post subject: Reply with quote

can somebody try this on Norton and Mcafee as well.
Back to top
Guest






PostPosted: Tue Mar 01, 2005 6:38 am    Post subject: Reply with quote

McAfee generally detects permutated samples because it frequently uses signatures which are not code-based (e.g., signatures taken from the resource section).
Back to top
Guest






PostPosted: Wed Mar 02, 2005 11:26 am    Post subject: Reply with quote

Did anybody try kaspersky v4.5 with redundant scan enabled to see how that faired against this type of threat,reading product info this "setting" is specifically designed for exactly this type of problem
Back to top
Guest






PostPosted: Wed Mar 02, 2005 10:17 pm    Post subject: Reply with quote

Nope. But I tried it with respect to rebased samples after people said that "redundant scan" finds each and everything. It simply did not work ...

If it did work well ... why would Kaspersky not include it into KAV5?
Back to top
Guest






PostPosted: Wed Mar 02, 2005 10:33 pm    Post subject: Reply with quote

If you've ever ran with redundant scan enabled(has to be enabled via command prompt:-unless you know that youd look for a week and a day to find HOW to enable it using the help files,they tell you about it ,what it does but not how to use it!)you would know why:-its very slow and nowadays users seem to want speed above anything else including thoroughness,I personally would like the option or something similar included in V5
Back to top
exorcist



Joined: 09 Apr 2005
Posts: 4

PostPosted: Mon Apr 25, 2005 8:19 am    Post subject: Reply with quote

I have KAV 5.0 and detects all of them...
_________________
http://ljubimte.funpic.de
Back to top
View user's profile Send message Visit poster's website
Guest






PostPosted: Mon Apr 25, 2005 9:34 pm    Post subject: Reply with quote

Guess why...Kaspersky has downloaded the samples and created special signatures.
Back to top
Guest






PostPosted: Sun May 15, 2005 11:57 am    Post subject: Reply with quote

KIS 2006 (Proto2) detected all
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Return.to/Scheinsicherheit Forum Index -> Malware & Malware Exchange All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



zeroSpace Template © Digital-Delusion
Powered by phpBB © 2001, 2002 phpBB Group
Back to Top
</body>