About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' j+ A4 Y2 c  E& s  Z/ j6 H<TBODY>
0 ^. x$ r  B1 e<TR>" z3 N( _' B; h2 I2 }3 b2 b
<TD><PRE>Method 01 3 W7 A" X0 X! c
=========
: M' N1 n! _, D4 r# w8 i" y8 V; T; |
This method of detection of SoftICE (as well as the following one) is  j  z) H" P. X6 H; [" s# N! s
used by the majority of packers/encryptors found on Internet.4 b" [" ]5 v  y" @3 {
It seeks the signature of BoundsChecker in SoftICE2 U$ O4 k  }  `* U* R3 t
1 c) P9 v( C) K: ^. z
    mov     ebp, 04243484Bh        ; 'BCHK'
8 |( `2 O' B/ k0 `; J7 @* c' c    mov     ax, 04h
# g- h* m( A! K) O% f/ S1 _# d    int     3       ( X: |& J+ G4 }+ s
    cmp     al,4# Z0 y! a- W3 b. [% Y
    jnz     SoftICE_Detected1 t: b/ n, |$ k
$ T+ a# h4 f- r) q/ X  C
___________________________________________________________________________
$ H' n& ]( v- I) f
9 Q8 a! v( Y3 P- L$ i( \$ ~Method 02
: U. w6 p& k! i. g4 ]=========! h0 O5 M: \: h% _$ c

7 P5 T7 v) D  |+ ]8 }! [Still a method very much used (perhaps the most frequent one).  It is used; J# A+ l  r" l4 S% M  X
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 ^. w7 }4 C% m" Nor execute SoftICE commands...
/ l6 [* C8 b9 r# ]It is also used to crash SoftICE and to force it to execute any commands9 b' w, a' a' ?/ m/ b: V6 C
(HBOOT...) :-((  
/ }" h4 }/ M+ }- K$ B
& V* g+ h: \; J0 QHere is a quick description:2 |: J9 G3 Z! u5 \# ]
-AX = 0910h   (Display string in SIce windows)3 R4 ?3 B4 m6 a; ]/ z
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)1 y9 E% {  G! @: b
-AX = 0912h   (Get breakpoint infos)8 ~( ?- A- a1 B
-AX = 0913h   (Set Sice breakpoints)
3 Z# H: M& y4 t3 W-AX = 0914h   (Remove SIce breakoints)3 [6 c- O4 O' A3 |1 Z
, V/ E& x$ Q- W
Each time you'll meet this trick, you'll see:
, J5 T0 @, S* G3 \7 v7 t! i& q+ ^-SI = 4647h
* a# g. ~0 B. ~  @' v6 I-DI = 4A4Dh
+ n8 I+ Z0 I) g; |- CWhich are the 'magic values' used by SoftIce.# L/ g5 l) d4 `1 |% \6 @2 a
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, }4 |! w' q* r6 D- u: R- V& i: C% C* ]
Here is one example from the file "Haspinst.exe" which is the dongle HASP7 |5 z/ n) s, W1 U4 _2 q( n! W
Envelope utility use to protect DOS applications:
8 e5 Q2 R* S# ^% \' i* x- e: ]+ ^1 |1 |
3 ~! I& ?$ X8 _0 k7 Y% @
4C19:0095   MOV    AX,0911  ; execute command.2 L& ^" m9 @  O, n/ b2 Q/ O' y/ l  r
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  q/ d$ x5 p" v1 y# W4C19:009A   MOV    SI,4647  ; 1st magic value.9 g, {. p" F/ o1 x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value./ e9 Y; z+ v: z' m
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 f9 B6 P7 F9 S  c+ }9 C2 f
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: Y: ?) z) e  c6 |% C0 a4C19:00A4   INC    CX
$ |8 t9 G0 }7 a( F* o  W& U4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute& g. k! F0 c, g1 Z3 r! Q& a
4C19:00A8   JB     0095     ; 6 different commands.
1 p2 w9 d$ q7 Z1 o; k3 M0 D( H9 c% u4C19:00AA   JMP    0002     ; Bad_Guy jmp back.( M% z& z4 Z+ c2 y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
* z: C/ v" M3 C
7 \3 V; s' _3 q; a: V' {( \4 w$ K: _  NThe program will execute 6 different SIce commands located at ds:dx, which* C' i& b$ x7 O7 l& s; K
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 W% K2 R  v6 h, S9 u

& ?# W, T8 |; r# X( d! u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 h# L4 V4 f6 k
___________________________________________________________________________
; ^( S: e6 Q: s9 |; H; o8 k0 H! \  e( P9 ^' Y9 B

4 `9 [$ j9 y, `1 L/ ?1 LMethod 03
& m% D# p4 X0 s( B, C=========
& O( j/ B. a" a- r1 u0 K
; A9 a: l+ C! y/ R' I& KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& x$ @/ v' f7 T(API Get entry point)4 H. N3 F* W- @3 }
        
0 `# k$ P+ P1 \  a
+ w% `( d# G; B, Q. R) m    xor     di,di; ?7 |( v! G' G1 q' w7 ^6 A! D
    mov     es,di$ F6 ?2 s" K$ t$ X5 l% h' ]1 j, J
    mov     ax, 1684h       ( {6 M8 X6 }0 Y3 m% X; u
    mov     bx, 0202h       ; VxD ID of winice
6 P. P6 _5 v4 f    int     2Fh( Q7 \: T. B1 I
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& ?1 `1 J3 E; C    add     ax, di
3 R3 c/ Q/ D# v    test    ax,ax
. \+ ?: q% _4 ~8 j* Y$ j" L' \- Y! m    jnz     SoftICE_Detected
: P; o2 S3 c! f3 z4 H4 ?& B
$ C7 B9 w! ^- @( r8 p# [, R* g___________________________________________________________________________
3 \2 I5 i7 G$ W% v2 `: w2 H; i& [8 s& l% |% H$ h+ d+ b) M
Method 046 `. D. E; g* F9 ~! Y: `) G6 H
=========
# {! l5 _- e, C4 u8 q8 `/ A, j. h+ `* T/ U. w, n1 d( D
Method identical to the preceding one except that it seeks the ID of SoftICE' J% l3 l& w2 B, M% I
GFX VxD.  H9 M: [- E  r; a

6 T1 Q  i0 d9 M  F! i$ i    xor     di,di0 B* z% |6 |  j$ o: D+ j
    mov     es,di
) `, T0 U' c; l2 k2 r; [    mov     ax, 1684h      
% T8 g9 q3 X  H; R  B+ D    mov     bx, 7a5Fh       ; VxD ID of SIWVID& g; ?: U/ r) X# S
    int     2fh. b% _) o2 I/ @: A& p8 K: w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ I. D& I. K9 p9 n- v9 n( H' C! Q
    add     ax, di' ^, N% B# O: i! r4 P
    test    ax,ax
- `+ }5 n! T! k) r1 o5 H    jnz     SoftICE_Detected' {4 x# ]) v+ l3 U- \5 P8 {( [' g# p( _

" W- A- {& ]8 M- p' c__________________________________________________________________________. f8 P) }' H( y4 E5 C9 \, [% Z

  n" X9 S8 \( j
3 R0 A3 V! B, p1 sMethod 05& i( r( Q7 P* g
=========
& S# c7 c& c/ ], S' P7 V& d- |& l# J' g! |* t7 ~
Method seeking the 'magic number' 0F386h returned (in ax) by all system' x! J* b7 n0 i5 s
debugger. It calls the int 41h, function 4Fh.
1 n" y1 n0 L& ?) e- mThere are several alternatives.  6 r9 M3 S  i( Q3 [6 o3 K; _! F! H

0 R: o) P! D# f+ |The following one is the simplest:
% W0 M+ Q# d6 t! U9 U4 t& A
- h& N6 ?% ]7 A) Z( f, ]    mov     ax,4fh
& o/ {  W- l& }! b+ W    int     41h
( G# k) \' k5 f3 a" f4 X    cmp     ax, 0F386- m% u* x4 b3 {$ ?2 E& Y* z
    jz      SoftICE_detected
6 c) q' q1 u3 s, g7 s! P/ y! O# x  ~: D% C

' V) e0 V0 y) `) ]Next method as well as the following one are 2 examples from Stone's
6 \4 e6 h4 k' L/ }) B' S4 c"stn-wid.zip" (www.cracking.net):
2 ]' _- Y" d* g2 u$ `4 _# X* U2 @6 z) P( q% Y" H3 G
    mov     bx, cs, @3 C2 {4 R; J; j
    lea     dx, int41handler2
1 W7 o6 [  x. c4 n2 J, ^' ^- f    xchg    dx, es:[41h*4]. P, m, X- q' C! O$ c
    xchg    bx, es:[41h*4+2]) k0 q, z2 h) g( b6 Y
    mov     ax,4fh
3 u( O# X5 [( }9 f9 K+ O9 `3 M    int     41h  w( R" i& U. b- s* j
    xchg    dx, es:[41h*4]
, O% `0 ?6 d0 `& g+ b6 ^    xchg    bx, es:[41h*4+2]
# X: z( Z; p, a    cmp     ax, 0f386h
/ p% d5 M* m. M! c- B. O    jz      SoftICE_detected
  ~6 Q1 h) m9 R, _: Y& ?7 e2 }) l% p# ]! J$ g  V
int41handler2 PROC
/ o, }7 M7 Y+ X    iret
  N5 b8 c0 W7 S+ T! n7 I/ Y) A- kint41handler2 ENDP
( c) P% z1 ]: S( v$ g7 X' J8 ^! \* a

  p0 P8 c5 y9 `_________________________________________________________________________% p3 R3 V2 K; c7 Y

7 d$ M6 ^5 F6 H2 `! G) z: N1 e- J8 |  k" W1 M
Method 067 h9 w- _* c+ J5 j: A$ X
=========! P- y/ f3 K, ^5 j

: f) `, U' w6 m# B/ \, j( h  G8 t1 r  U4 [+ U* H$ ~+ O% I/ V
2nd method similar to the preceding one but more difficult to detect:3 f. P8 v1 O. K$ ~! u

& w4 j( a1 l# [* O. a4 }. h. D# U( c+ ]  E
int41handler PROC
9 ^# W( A8 k) E    mov     cl,al; c; f7 ]" V( |2 v4 G
    iret3 j  |8 G8 a3 g/ J0 P# m
int41handler ENDP* O5 {3 |( y1 g
" s" Y4 G8 \# N( e, N# A
* \0 s. k: g1 [: q7 D3 a1 }3 U, A
    xor     ax,ax/ I  Z, s" _- k8 I1 R0 E
    mov     es,ax
4 _( _2 {7 K( H3 z    mov     bx, cs
0 f- `% v5 A$ G; M$ [& T9 p    lea     dx, int41handler- g& f* b) r/ a8 Y" x8 D
    xchg    dx, es:[41h*4]4 g- ~1 G0 y6 ~8 g3 ?2 q9 i
    xchg    bx, es:[41h*4+2], h/ j8 l: V- U0 n( B8 k$ _9 K
    in      al, 40h
$ C) D) B! R+ ]2 a$ M    xor     cx,cx# c$ T! {3 [: ?
    int     41h
: C0 Z/ t- t& \7 Z    xchg    dx, es:[41h*4]" t: y+ i5 {: u( w$ w
    xchg    bx, es:[41h*4+2]
/ W$ V$ f  {  I5 b! A5 [1 w5 r    cmp     cl,al
" W. B: a* j7 O    jnz     SoftICE_detected/ z7 x' s/ L' u$ l. B1 s. E
  u% N, _, d. B$ V$ e9 \
_________________________________________________________________________" {" G9 u3 _* w) N1 o. N7 d6 o/ r. C

8 P8 L0 f; o; [* CMethod 07# Z/ X( L. s. Z! {0 j8 h/ Z
=========
4 k4 h, ~* Z, }( D8 c
/ h. }& k$ b# ?# j! W5 ~/ X; |Method of detection of the WinICE handler in the int68h (V86)3 I& Z# A6 {0 W+ S: y3 N

2 j) p& U; n  ^2 X6 A- _) i    mov     ah,43h8 p) ?* i$ m: k6 t; \6 ^2 Y* L7 C
    int     68h
2 c- j' j( V& ]/ U' E( E    cmp     ax,0F386h7 B' a2 y7 H# X$ j
    jz      SoftICE_Detected0 Y3 A! a1 Y1 z1 v( z8 ~

5 H1 f/ C) b9 m3 `! O1 n
, I0 k+ h3 a* G" Q7 R9 d=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. T3 o1 `, ^/ Z5 C& @' L   app like this:# b8 h- m6 }/ C# }8 x
; \' H4 i7 _' T2 ]+ U
   BPX exec_int if ax==68
& _' n; r% c- ^1 B   (function called is located at byte ptr [ebp+1Dh] and client eip is: @: g, y& @3 ~
   located at [ebp+48h] for 32Bit apps); T4 J0 K/ A) q; r/ W
__________________________________________________________________________% }; j- `& K: A* b9 i. O: p

, A5 F2 _6 z; g  a, K  V, \
. Z- ?7 h5 x( d8 {$ tMethod 08! f# f: F5 |- k; c
=========/ R% E, R$ t8 T* u* |3 a

- |, d/ i: Y7 }% ], b1 MIt is not a method of detection of SoftICE but a possibility to crash the1 w5 Q5 B' j5 f8 H
system by intercepting int 01h and int 03h and redirecting them to another
8 k6 `+ ?7 B1 @# T0 }+ u9 C! Vroutine.3 \) N. M9 K$ d: s9 Y$ x4 G- j
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" q: C( }- V2 D: pto the new routine to execute (hangs computer...), K& z6 q1 S# V& d% I
8 R' Q" _; m3 ^+ X5 N
    mov     ah, 25h. [+ f0 h2 S1 Z: ~2 W; d
    mov     al, Int_Number (01h or 03h)
0 \# B# G  U2 R0 U; o    mov     dx, offset New_Int_Routine. }1 N! P  m  I
    int     21h% C8 Z, e7 T9 @3 e

3 a; f+ ]3 F( `  t& {$ ^__________________________________________________________________________- ]! h1 o( F* L" K/ y/ v

- u) h# ?- Z* L* B+ s# D/ OMethod 096 \+ E( n( Q. @% z0 \; h8 ]! e
=========
8 l8 S+ s$ {$ L5 _" V- `# s9 E* p" |" c' B$ P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ \- i' n7 r# q8 g: iperformed in ring0 (VxD or a ring3 app using the VxdCall).
6 a% h# i! v. C/ AThe Get_DDB service is used to determine whether or not a VxD is installed9 ?! Q/ @" I& ^$ ^8 k4 \: _3 q% e) p
for the specified device and returns a Device Description Block (in ecx) for7 N; c, t$ R7 e: x  X: N: A
that device if it is installed.
! y& W6 e$ w1 {/ m
! D% B: a/ i; U6 Q; r) Y  [   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( E+ W; L' A( n3 b; A   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 A3 s8 Z, o& q# P( z3 h% i6 I- ?   VMMCall Get_DDB
: Q" J6 R# v5 ~8 X5 ?9 Y1 ?   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. X" j* M: D9 G0 O  l. I9 {  \; l* h

9 s6 G. s+ g# [. L4 s0 kNote as well that you can easily detect this method with SoftICE:
9 `8 o, z4 ?$ R3 ~. {! x% L   bpx Get_DDB if ax==0202 || ax==7a5fh
" V0 N9 o% ]- S9 G$ r$ w
% d  y0 x/ |7 q6 G- {__________________________________________________________________________& u) C) r. b( C* ]" u8 O3 Z( c
0 e# X4 `1 j- B  D: M" k
Method 10% M, h& k; o" W5 d+ l* D7 ?
=========8 f: a" W& f8 s9 @6 ]/ o

! u. g5 \" O* r& x/ {=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
8 S1 k9 d0 F8 {9 |" D  SoftICE while the option is enable!!, V/ {- i0 u, l6 b6 v
6 l8 y8 V5 S: ^1 Q1 y9 l
This trick is very efficient:
7 r- E) u' C  U  x! d  h6 Hby checking the Debug Registers, you can detect if SoftICE is loaded0 A6 M3 k* J& U- ?; Y- \
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if$ a' K  y% S6 P( ~& F7 ~- E+ ~
there are some memory breakpoints set (dr0 to dr3) simply by reading their' T$ F) h( P2 s, ~( B& E. M
value (in ring0 only). Values can be manipulated and or changed as well: h+ G" V( O2 @/ }" h  N4 P
(clearing BPMs for instance). k; ^$ _7 h: B# {- r) C

; q  I% K7 g1 I1 o; n. V__________________________________________________________________________
9 ]  \0 N) a' R. r" W4 f' b2 ~2 c8 M/ @, y2 c% n" A6 n
Method 11" o: \7 @9 v& L8 f4 a5 m, U; w
=========
7 o3 K" `; j- w' h7 C) p9 U) @5 @4 H9 l6 {* f
This method is most known as 'MeltICE' because it has been freely distributed
  x9 X& `& @' F$ U/ evia www.winfiles.com. However it was first used by NuMega people to allow
  S8 |! k0 \0 a5 k4 T. h/ ISymbol Loader to check if SoftICE was active or not (the code is located5 {) d0 g* v" h0 z9 a7 p
inside nmtrans.dll).; q) I& {' h+ d

3 T% {$ i3 Z' ]* t. i7 s4 MThe way it works is very simple:( Q7 p6 l/ a/ r0 f
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ C8 M; n2 t  z1 N3 iWinNT) with the CreateFileA API.( C8 A: _# T/ e: N  V
+ R9 a( X0 l, x5 h2 [
Here is a sample (checking for 'SICE'):# f8 K  d2 J6 P: d

. v) L' k/ ~6 A$ HBOOL IsSoftIce95Loaded()& d' Q6 P! f+ `  O1 e7 u
{% }) d0 I% d% [. S4 p
   HANDLE hFile;  + {* T" i; M. D. P; I2 Y$ b
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
) P( B1 k# q! e+ y9 k7 Y* _                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! M6 o! O; }2 |                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: \- I' K2 ^+ Z& R$ R   if( hFile != INVALID_HANDLE_VALUE )" ~) ]) J" @: M# z6 U! `* p2 p
   {9 @  l# B5 F8 B5 g7 Q& p; [
      CloseHandle(hFile);1 H" i+ ]6 b7 }  e
      return TRUE;& n0 d- z5 B+ Y9 i
   }
# B0 H# P& n# v/ Z  k; z7 t   return FALSE;' Q' E  N) Y7 k
}* l) l% D4 f5 p& G3 A
/ Y  L/ @* U- z
Although this trick calls the CreateFileA function, don't even expect to be
+ t% Y4 @2 @9 x- M1 @8 }# Y: |able to intercept it by installing a IFS hook: it will not work, no way!/ Y2 v5 C2 o2 X/ `; [' U
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
( Q* f0 x* v1 x, Eservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 s$ \! ~& ~6 T' g, m4 J2 J
and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 f% n7 C- n6 X3 }
field.% [5 a7 B4 {2 r
In fact, its purpose is not to load/unload VxDs but only to send a
8 V$ h. ^0 \. j0 r( B9 l" wW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 J. F  q+ S; G6 A. H( _1 S8 [to the VxD Control_Dispatch proc (how the hell a shareware soft could try& A# b1 i; L4 [" ^4 H
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ }, Y7 V, \' zIf the VxD is loaded, it will always clear eax and the Carry flag to allow1 A8 c, s+ M1 ?& _+ T+ E8 E
its handle to be opened and then, will be detected./ X8 E( O$ z# f5 p
You can check that simply by hooking Winice.exe control proc entry point
0 @% {7 F% Y7 j, h1 rwhile running MeltICE.
1 ~5 q$ t! M1 O" \; A$ j: x
6 t  r& h2 `, V/ O0 C
2 @# Y4 U1 l( [& Y1 H+ P0 j) j  E  00401067:  push      00402025    ; \\.\SICE: Y6 w) Q& K4 y$ V& @
  0040106C:  call      CreateFileA# w7 D( T. `+ }- O  y% x
  00401071:  cmp       eax,-0012 m7 B: `( L) T/ Z5 ]# o( W
  00401074:  je        00401091
; Q5 E- P+ ]! L, \# ~0 L7 m* x/ e: _0 z7 x
, Q5 D- O4 Q$ w; [  s$ V5 Y
There could be hundreds of BPX you could use to detect this trick.
- E1 n7 r* A. M( O8 B-The most classical one is:" [# W3 }+ q& O
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 x! y$ g* d7 f( C7 F/ n
    *(esp-&gt;4+4)=='NTIC'
1 F$ h6 t7 c$ `, _
8 i* J1 l) y% b# N. U+ M-The most exotic ones (could be very slooooow :-(0 o" D5 }! K6 J" A% W/ i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ g- _0 A; G1 i6 u6 h6 @3 p     ;will break 3 times :-(2 q# f) G4 b* b1 ~# Q" l' c

) X5 t$ A& W  n-or (a bit) faster: $ J/ A) N" ]. K* a7 b1 |( V# O
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ b- r  p& }# u- b; f2 A9 M) y% c/ y- ?
* Y3 ^  n! h0 j0 ]9 S0 ^   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 |; J2 y$ G2 C* G+ l5 X: i
     ;will break 3 times :-(
% L. G- g( _4 P6 U, F" D" [4 u* q
-Much faster:6 P( s# }: Z3 y+ o# i7 G3 N/ v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 i* O. k* N3 [. V9 ?5 ~. c$ w$ A: |. X  n" Y% r% R
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen7 g; R" n8 e7 P7 b# [7 F, e
function to do the same job:
, b4 g: L7 |- X% R* _8 U' y) ]0 F4 H
   push    00                        ; OF_READ
/ F& s0 l& G2 B. ?6 m' V   mov     eax,[00656634]            ; '\\.\SICE',0
/ H& ~2 l" D2 d7 p' \   push    eax
6 e, S5 {. }8 K4 d   call    KERNEL32!_lopen
9 O8 t/ R$ U7 l% z( R   inc     eax8 S1 P$ P3 N5 L! f3 z6 d* Q5 [
   jnz     00650589                  ; detected
6 I5 t& }* G4 d8 s+ U+ [   push    00                        ; OF_READ! F8 r# U$ d. x6 M) k9 H0 p1 H$ Z5 `8 s
   mov     eax,[00656638]            ; '\\.\SICE'7 F0 b* L, S, I; W6 Z  a7 K
   push    eax
/ s# t5 |1 a: u+ @% ?1 F; u8 ~# {   call    KERNEL32!_lopen
* N9 W  v! r4 p3 R3 D& A" |   inc     eax
6 y6 U+ b+ }# K, b' V+ X   jz      006505ae                  ; not detected3 A0 M3 N4 |2 ^% v
- k7 A' U! G& j- U, l

3 a0 Q8 U/ R" ~! e/ Q__________________________________________________________________________
2 n$ ?/ D6 T1 ?# ~. Y9 l4 [8 j+ m, m, C
Method 12! m/ d* M% r) c, h9 g& F
=========! a1 s8 X  U0 J8 U/ }% `4 Z
+ E6 n* m9 u. T" ~. Q2 ]" v
This trick is similar to int41h/4fh Debugger installation check (code 05- H. W& ]0 e( h( C' u1 p$ l
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ p2 M% h7 T, U' Zas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; X9 J5 L9 U, l4 F  m0 {
) e9 n& P4 d4 d! a' y; x& O( {( Q( a0 u   push  0000004fh         ; function 4fh) Z) B0 T; o0 t# V" ^
   push  002a002ah         ; high word specifies which VxD (VWIN32)7 X" b$ [/ P9 F, \4 e
                           ; low word specifies which service
/ {# k* X$ ^; I# T% R* N% h                             (VWIN32_Int41Dispatch)
3 o5 H2 ]/ g. [. v$ R   call  Kernel32!ORD_001  ; VxdCall
7 h( t) a% x- Y3 `& ~1 p   cmp   ax, 0f386h        ; magic number returned by system debuggers
) A) u/ n$ t- _7 b, A) Z& j   jz    SoftICE_detected
* x* }5 c- E: O* Y. W. C
8 g" n& u" t; b5 Z% EHere again, several ways to detect it:/ E0 @4 y2 f! c( i) g1 W9 `- `; n  y

1 D$ a" J+ J& V" A    BPINT 41 if ax==4f4 t; u8 ^7 K0 O0 j
) N: C2 u* J: S' b9 a
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one4 z+ j; e% w3 t6 ]! c
$ @* v9 f+ b5 y
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. y! c/ J& z! m" \4 P. R1 R* _: u. t9 K6 x; G& U2 p
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
: U, ?* c$ H; |6 c# h2 S+ |
. y5 O( y1 _6 y" M+ q: g__________________________________________________________________________  n$ ]% J) p. w9 ~3 V! k5 H. Q
) |2 ~* c0 @" t$ Q& R5 y" @
Method 13
/ x9 W0 t8 Z/ [  X" d- f=========
& R' {" k1 D5 o) }. K, _- \7 g. B
' p. _* N# y! I3 |+ hNot a real method of detection, but a good way to know if SoftICE is
2 b: O1 a3 D$ p' ^+ O8 b3 Minstalled on a computer and to locate its installation directory.
2 T/ z( x+ e* N* ?/ R" A* QIt is used by few softs which access the following registry keys (usually #2) :. q: T' k8 `1 h% E

, ]1 y% ?$ t' [5 j-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 s  c( {- p2 W! b8 h0 Z. |% J8 H\Uninstall\SoftICE
" {2 k) `* f8 {-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 n  P- m, n: o2 n/ m( ]0 Z/ \
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, A& F* e( U1 H6 y
\App Paths\Loader32.Exe
: i- _* `5 Q& S, e# c
' U2 _4 g. P5 J4 K. F
* g7 v- z1 k7 ?5 j3 I$ _Note that some nasty apps could then erase all files from SoftICE directory* e6 q2 P2 W) _- t0 G
(I faced that once :-(
1 U, R+ b" r0 h1 U; P2 D1 T1 @- b5 g8 [. v! _
Useful breakpoint to detect it:
+ j+ }$ {9 B* o, X  N
; r! p+ u- [3 O  O7 X0 w     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'+ G: {! |6 x0 J& z: B4 B
7 e/ ~( N8 q* H6 C0 j" T7 J
__________________________________________________________________________
' M/ {( U& e9 m% W/ H/ u0 l3 T9 x4 W0 r
4 b& B; g. ?0 J* L3 o
Method 14
( ?: L' E) F: m' e! ?- }- _=========  H; q' m1 H! J
& m) D5 i. B1 L9 _
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! I3 L6 O- p$ s5 R1 T) a' A! tis to determines whether a debugger is running on your system (ring0 only)." O2 W) F7 ]* S! K0 c

5 ]: ~7 p$ a1 O  K, I8 c" K   VMMCall Test_Debug_Installed
4 F# x) K- T; v0 t+ G   je      not_installed
2 e. k9 Y  u& K% V. W
) Q" L6 ]5 k8 V! Y7 I+ LThis service just checks a flag.  ~8 W; ^. Y# A' ?7 z" o: c
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|鲁ICP备19052200号-1

在本版发帖
关注公众号
QQ客服返回顶部