About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* k! d% c- \8 W- W. Q+ |
<TBODY>: }1 V. G% m# `
<TR>
" O9 y: C. M+ S$ ^: e! D$ y, e<TD><PRE>Method 01
- J2 ~4 T! ^  N: ]=========
! ]# q, Q# F. y, o& E# V7 `5 z* M' {6 f; Y* G
This method of detection of SoftICE (as well as the following one) is$ {- r/ o$ T! x3 t# \& A
used by the majority of packers/encryptors found on Internet.
" J/ l) z; w9 t1 ~9 QIt seeks the signature of BoundsChecker in SoftICE: |. X& i! u4 }' x

: N1 m7 s! y0 L6 A" w* G9 ]5 t0 s    mov     ebp, 04243484Bh        ; 'BCHK'
# z) O. u' W; b% q+ z( R; o    mov     ax, 04h
! Z' n4 e7 Q' U' f5 o    int     3       ! X: h" R# y8 R( C! }/ F" U
    cmp     al,4
: C( [3 H& h8 t: F* S# y' U    jnz     SoftICE_Detected: k/ }) I- Z( P  C& O5 f- {" j+ l
6 _& d* U' d1 T- C" X1 P3 s
___________________________________________________________________________/ f% n. z/ c/ f: [& P8 e; f+ L
# y2 P( z" n8 G& J
Method 02% e2 g0 n0 P' n4 \! x
=========
2 Q: v) o* S; g' A+ C4 J0 ?# q+ z
4 ?1 j. t% t6 j8 l* sStill a method very much used (perhaps the most frequent one).  It is used0 ^' }! ]2 I" ~, A
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,: l' n6 x% ~0 M  b# O0 d4 `( V
or execute SoftICE commands...
2 K% k* |9 x! aIt is also used to crash SoftICE and to force it to execute any commands: }+ n2 M) d3 v% Y4 y5 _3 N  u
(HBOOT...) :-((  & i0 Q: m, d  _7 r9 \) C
) A( g+ y1 W4 x( K: x6 _
Here is a quick description:/ k1 ]6 L3 d' J; q. E
-AX = 0910h   (Display string in SIce windows)' v$ Q- f0 m) G7 o7 q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
7 I! D0 @* Z* S6 W" F1 N/ h' _3 H-AX = 0912h   (Get breakpoint infos)
2 n( y6 a9 _" E+ x9 X( q-AX = 0913h   (Set Sice breakpoints)) a, Y+ d  |( s$ l% u
-AX = 0914h   (Remove SIce breakoints)
# o1 e. S5 l' q  [+ B$ M- Z: K$ l
4 h# y. {6 b' r7 |Each time you'll meet this trick, you'll see:1 w2 N  j- e4 ~0 h) c
-SI = 4647h& W& I6 d6 `2 E2 j" q5 Z9 f* P
-DI = 4A4Dh+ g8 }6 u" U! u( n& B2 F5 n$ ]
Which are the 'magic values' used by SoftIce.  b3 i/ ~! m) J/ E- @
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 E  G/ m( r4 d. A7 V0 E* }
/ `* ?4 v# F6 M
Here is one example from the file "Haspinst.exe" which is the dongle HASP
6 `: p+ g: x' h( O/ ~- AEnvelope utility use to protect DOS applications:- u9 p" y+ m4 b( s

3 q; n" |; N! H: s# v; C$ ]1 {1 g- R. W5 I* Z; |( e
4C19:0095   MOV    AX,0911  ; execute command./ `) ]1 p3 T0 E
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 t+ e7 `; n) M# H* X; J  c8 n4C19:009A   MOV    SI,4647  ; 1st magic value.3 A; L5 r( K1 k' @/ l6 o* T
4C19:009D   MOV    DI,4A4D  ; 2nd magic value." G4 _7 M! p( A. c6 h
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ y  }$ \4 X3 \0 D
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ B: b- [% ~/ ?+ D$ P# O  G
4C19:00A4   INC    CX
. T3 Y- C* d3 X! k+ z  l( ?4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' [9 _4 d. x' b
4C19:00A8   JB     0095     ; 6 different commands.! @8 S+ L' ^) P- L$ v
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, d, ?, n: Y/ F: p/ E3 z7 t4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: u2 u6 D( L" ?" Y9 w! k/ b+ g' ^8 H
The program will execute 6 different SIce commands located at ds:dx, which
8 r) w+ c+ Z' e7 f+ w0 {) a. Rare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  o% i1 V; B3 B/ I7 |6 ^  I7 w0 D# Y' f5 |. k  I
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  z! N; [7 {* }  G2 y7 b& y3 t
___________________________________________________________________________5 c7 E8 B4 ?( c$ |& k5 B/ r1 v
1 Q, F" g" E0 V* G: J
; u+ X! ?! o2 g
Method 03, u" O- U: M! k  F8 a# E
=========7 G3 g' ]* Y; g& R" h9 G
8 U1 H: U* ^+ q$ z( t# q& `! t! V
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 C' _  e" t7 N& n( W(API Get entry point)9 V$ ]6 l8 H+ M7 g$ q5 u
        
6 L3 b: N% Y# B+ p) f  s2 i) n0 a- l6 c
    xor     di,di
/ R0 e4 e" T+ d% l+ s4 V    mov     es,di' C9 }' n9 L7 p) C1 z! |
    mov     ax, 1684h      
& v9 D; r  d# y    mov     bx, 0202h       ; VxD ID of winice: W- q. L0 U% v* h% c
    int     2Fh, ?% t* _) C8 G6 T9 i
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, S; H! Y0 ^# m    add     ax, di
+ m3 Y7 {2 a6 Q  ]" Z0 T    test    ax,ax) A1 I) {4 B$ k5 y
    jnz     SoftICE_Detected
' q2 f$ X: B% i3 e' T( h+ j5 x$ X6 {8 C) D% Y
___________________________________________________________________________3 [) ?. b% p# y9 f* I5 C" N

) R. h# J7 ]4 E% T* K2 _7 wMethod 04; O6 \4 t- r/ ?9 s$ S. T% X
=========
0 x4 Y  I9 a7 H; R$ i' y1 Y3 W8 O' o% x. _: X5 t/ e% u6 i
Method identical to the preceding one except that it seeks the ID of SoftICE
9 }* R3 s7 F' H9 M* `6 tGFX VxD.
" h) P1 ~3 r) O7 E5 G2 X
& m; Y% y5 e# Y* K2 X4 X* y- ~* {    xor     di,di8 V: `. X; X/ ]1 L; b/ [) y9 ^% C
    mov     es,di
6 G( p" h+ e7 _4 ?    mov     ax, 1684h      
$ |: B0 [; Z. {/ Y5 ?    mov     bx, 7a5Fh       ; VxD ID of SIWVID
9 b5 [: S; p- E4 h9 z3 d" S+ Z    int     2fh2 Z' M4 t. h1 c( p9 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) x% c' [) \7 S+ Q& N
    add     ax, di
: f- m- I0 X4 V- ^8 C( S    test    ax,ax' ~! X( l5 {* H
    jnz     SoftICE_Detected
- H) z% g7 \( t) @* F& C1 y; u5 {( e  M- P$ F5 c
__________________________________________________________________________/ a  H7 b( o4 p

# A0 \. H+ Y. H* H$ k! q% ^- r# D$ J! j$ x( J% i4 h
Method 05  U. ~, S; Q+ u
=========
4 G- n( A+ s. A9 O# Y$ m% L. ~: ^2 a- u3 C# X
Method seeking the 'magic number' 0F386h returned (in ax) by all system7 B9 q/ M$ C2 Y9 {1 W
debugger. It calls the int 41h, function 4Fh.
( c0 I$ A+ h: r4 AThere are several alternatives.  
1 |$ ~: Z! V7 P; B9 }/ I& ^
2 P- z" p) Z7 T) EThe following one is the simplest:
/ o; D: X2 f1 |  f1 C2 t; }1 y) B! }
    mov     ax,4fh5 K1 L  X2 \5 G  _/ `+ q4 B
    int     41h6 z' _' L* }/ `& N; ?4 J3 l
    cmp     ax, 0F386& I& N  [2 l  T; f
    jz      SoftICE_detected
3 |! X; I* S1 d+ T5 D# }( ^: a; x6 ?1 o$ V/ V+ _
6 I& c+ O; X5 \- y8 c
Next method as well as the following one are 2 examples from Stone's
7 l9 N' k! ~% D"stn-wid.zip" (www.cracking.net):
. o# J" z3 m+ |7 f" P" Z
' n$ I7 t6 F: G/ O2 R5 }    mov     bx, cs* A' y& A; f* w9 @
    lea     dx, int41handler2; e' ?5 d: J/ j: J/ q
    xchg    dx, es:[41h*4]
$ Q$ U, K! p( c    xchg    bx, es:[41h*4+2]
, V& B5 d. w5 M) x! @* G, X    mov     ax,4fh- P( F! R! K* n
    int     41h; o7 G# J& `, c0 x3 J6 n/ S
    xchg    dx, es:[41h*4]$ B' M3 ]6 u% Z8 v
    xchg    bx, es:[41h*4+2]
* F. g7 ~5 y& Q3 L/ K    cmp     ax, 0f386h
7 p- O1 d6 V! D$ Q1 ^3 j9 d, u    jz      SoftICE_detected1 K) }9 J7 a3 C  ~% F

$ `0 O; E/ s- b; Dint41handler2 PROC% I7 H. p( j+ q
    iret
9 Y! }6 R" u$ N8 oint41handler2 ENDP
- o5 ^. T1 ^) @" X; n% t) a8 ~4 C* X. l% G1 a" q

. s9 }# u8 M1 @_________________________________________________________________________, w$ }  l+ e& b7 J& k
9 l7 N: q9 v8 v: E

1 A  U/ R1 a: t  c! E  dMethod 06
( d0 v9 A- x- e2 ?$ z9 |=========% k+ v/ m* g" f- i+ g8 p* j' u- O- r

7 ]6 {% c$ L% b+ b/ R, l
, K+ h/ O3 C  e& Z9 N) U9 t2nd method similar to the preceding one but more difficult to detect:: w# g# x& m  M5 T: G$ o1 q

( ?! g9 V" H, W! N4 o% {9 `- K2 _6 ~1 H" |
int41handler PROC% @5 g  m2 x7 Z" m  z
    mov     cl,al
! W( [6 k5 M2 U: A  Y! e    iret
+ I. p' X; q: v" Nint41handler ENDP
" j% P( [0 e# N( P/ [3 s. A: \% N. L# w4 S- s

6 J4 w6 I0 A' c7 i- l    xor     ax,ax) ^9 ]' R4 K& \6 T* ?
    mov     es,ax
9 U  f* A' `# v( r6 P! p* U" L    mov     bx, cs
9 y/ z- P" J5 u$ y$ O/ @' k    lea     dx, int41handler! P0 U, i) s: t' A- {) `+ s
    xchg    dx, es:[41h*4]
6 n! G/ `" [7 r: V    xchg    bx, es:[41h*4+2]  ?# B" [, S4 o% t
    in      al, 40h
& |* i% u& Z% }9 g3 A    xor     cx,cx
( m. c2 }8 O( P& o5 @' x    int     41h
7 A3 l/ {: U' l( z3 Q8 F% F$ q5 G    xchg    dx, es:[41h*4]$ g& T6 O" T# e& V- ?
    xchg    bx, es:[41h*4+2]
% ]# g0 y/ h2 r* W    cmp     cl,al
0 Z3 p  j2 i" B+ N2 [    jnz     SoftICE_detected
# b4 F+ R. Y+ t& N6 l# \, a0 ?0 }9 R5 P* S, \0 D# I$ }
_________________________________________________________________________  ~6 B0 H: Q; N! W8 r  C

% H, G6 S( O6 c) n& u/ {6 UMethod 07, N& T+ Y, {$ K( G, v$ E+ q
=========4 r/ V+ U: H/ i+ l% i

: T) a7 L3 O3 g1 aMethod of detection of the WinICE handler in the int68h (V86)& @$ ^  A5 E$ |* k3 C- N
/ H0 D  H: m+ P4 S+ t2 P
    mov     ah,43h1 J' `! p; v4 k+ V8 V2 e
    int     68h
) J* G8 g4 X3 k    cmp     ax,0F386h
  `* ^: |* _$ B0 K    jz      SoftICE_Detected1 `7 P0 }; q. @! {0 G
- t+ J) g  k1 n; h3 ]3 N" d

( L7 `8 ~2 s1 Z, Y0 t5 c* E=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 L& _4 O/ v& A8 n* z   app like this:
( s* T  M% h8 X+ K
* n. Z+ D/ o8 A   BPX exec_int if ax==68
* D0 f2 @( a4 Y   (function called is located at byte ptr [ebp+1Dh] and client eip is
! M0 l1 J: J2 @1 v& h$ ]" ^   located at [ebp+48h] for 32Bit apps)2 r1 Y# Y: R; B; u: r% d
__________________________________________________________________________
8 S: S& W( R+ U; h7 X1 F) w. @$ R% t& n8 [+ s2 {! o
+ n  G% H9 W- P
Method 08
" J$ K8 p% z8 t8 v4 p0 ]4 ?=========; r  a8 s: t7 k" d

* a$ q( f5 ^) n# xIt is not a method of detection of SoftICE but a possibility to crash the. i, _5 r5 K( g% g2 _5 [$ B
system by intercepting int 01h and int 03h and redirecting them to another2 @; k" h3 e  x7 c5 C( J
routine.
3 s3 n( N8 k8 ?3 w) a- C. ?It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points3 V! O+ ^! C, A* m
to the new routine to execute (hangs computer...)
* B6 @, a4 |& J4 f& m$ U" x
) I) E- L$ F. |7 R* Z    mov     ah, 25h
, E' \* d- |- m! x% Z    mov     al, Int_Number (01h or 03h)
! e" n" S5 @6 v: c* J7 s- ~- C% [    mov     dx, offset New_Int_Routine) s# \* q5 P; s/ E# {3 w2 N
    int     21h5 r% J' Z8 B2 L9 f

( V: b& b2 ^" @3 \__________________________________________________________________________
! o* `7 S; s" k( R/ u
9 N! A3 o- ]: m4 @5 k4 r# zMethod 09
  k; s; J/ f. \+ w' Q1 O) l+ f, L=========
) g& J; k4 B2 J, `, y1 Z# y2 E$ e' }$ O4 M6 Q' s
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 m! [5 `$ N8 C6 W+ Pperformed in ring0 (VxD or a ring3 app using the VxdCall).
; |: Y, ?4 q. V" g: oThe Get_DDB service is used to determine whether or not a VxD is installed
6 _  o2 m6 t  W; F3 K& p/ L( Y2 y- `3 Zfor the specified device and returns a Device Description Block (in ecx) for' ~9 a2 C3 i7 k& b2 o+ Z
that device if it is installed.
  J. V! u9 Q. [2 A& O+ t& U$ @
1 Z) H! x, f! W/ w* j6 B5 M- d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
& k4 e) M# V) u$ n! e   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# H" \- V' [. Y  n; J4 @1 f# A   VMMCall Get_DDB4 b% n$ y+ y5 {2 s* E7 H
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
8 H2 ]& _& X. x0 {# f" h$ Y6 d5 X2 X3 w( d/ Y9 j' j
Note as well that you can easily detect this method with SoftICE:
9 ?9 g/ ]) f; V/ s! \   bpx Get_DDB if ax==0202 || ax==7a5fh
/ [0 z$ w% e  g1 s& {* E" K, H& n/ y. X- l
__________________________________________________________________________5 Y  M1 R7 }2 M& x7 c: N
  u1 y. c- k8 g! \& O3 E+ J
Method 10% m- u8 l! W1 l. `- V0 A+ h2 n/ ^& M
=========( ^, \" F% h, R
0 z, i/ g0 Q5 u; O  G
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) }+ b% F' q; f  SoftICE while the option is enable!!$ a1 O7 H+ N# h# C9 u# u9 \
& ^, U" Z2 e+ ?; l3 N, t
This trick is very efficient:
8 ], J- _" e$ k2 _by checking the Debug Registers, you can detect if SoftICE is loaded
. x( G* C, T! [5 }, Z' I! a(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
; a! a) p' l  j5 e2 x. B0 _4 ethere are some memory breakpoints set (dr0 to dr3) simply by reading their  N- P( G% ^& S  `# `9 V
value (in ring0 only). Values can be manipulated and or changed as well
* M  G8 |0 e9 A% X5 y) h3 o7 I(clearing BPMs for instance)8 n1 Z8 s* ^6 N6 v

! o5 w$ y, Q7 I& A__________________________________________________________________________
7 X$ D9 x: t# x9 w$ ~7 Q5 C1 [
: Q4 y7 t/ C# pMethod 11
3 g' ~2 H) a' h1 r1 |8 F=========- j  u6 [0 m: ]. {

& f# B4 o5 g% {/ P, qThis method is most known as 'MeltICE' because it has been freely distributed8 E" M# g7 k" f
via www.winfiles.com. However it was first used by NuMega people to allow
6 |) C6 o9 g5 w. q1 M: _Symbol Loader to check if SoftICE was active or not (the code is located$ _1 ~# f' w* z) b
inside nmtrans.dll).
4 Z, e. d; c$ F+ b. j: h0 q* A6 E
' n; f3 Z7 [% L; [The way it works is very simple:7 V5 [) d2 {4 I8 R0 g
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
1 t* [+ D9 f  k1 r" @4 u4 ?8 [WinNT) with the CreateFileA API.
+ {- o) @5 ?; U3 v) `6 z$ Q4 k. \2 x. Z" h, V" S* h% M+ `
Here is a sample (checking for 'SICE'):
3 b% G& P* v+ |5 y7 Q5 Q& ]: F7 H
BOOL IsSoftIce95Loaded()
! D# Q6 g) c9 b, x; c$ P{
  A$ [7 w6 c/ Z5 }) p1 O% k: y   HANDLE hFile;  
9 K3 b) p6 Y- e4 e   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,( G2 t2 }. y$ G& ]
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 c* I$ {- z8 R9 p/ `" m+ X                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. J0 R/ W- Y$ O2 d5 V: z& x
   if( hFile != INVALID_HANDLE_VALUE )) C* |6 t+ \8 ^
   {; s( b3 L7 B$ u5 q" @# w/ y
      CloseHandle(hFile);2 V* |* C  k* h4 c
      return TRUE;$ U5 ?. q6 E& I8 |3 P3 @9 ?* A
   }5 F- y! M0 T9 ]/ n) A- r& v0 l! E2 s
   return FALSE;4 M; g/ O0 U) }/ t1 s
}2 G9 M# F5 h0 p; ]% K  O) \; X

3 E/ V0 f7 u  w6 }# l9 ?Although this trick calls the CreateFileA function, don't even expect to be
) X0 u# Q; L# m& d% uable to intercept it by installing a IFS hook: it will not work, no way!
- T' m& f2 y) h5 fIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 K# q+ j' y5 n+ nservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); X) |  D. r+ _# s1 c
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
6 K9 B; H4 h# ?' ufield.
; P, @9 p, ]1 h: OIn fact, its purpose is not to load/unload VxDs but only to send a
2 N" [) ]" z' JW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); @1 \* T: |/ k$ }
to the VxD Control_Dispatch proc (how the hell a shareware soft could try* m- {/ D( T; x; m( t
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 m+ u1 {: u' R6 q/ W; MIf the VxD is loaded, it will always clear eax and the Carry flag to allow. J% J0 n! N" V' k, z
its handle to be opened and then, will be detected.3 \% v9 d' h9 K$ G
You can check that simply by hooking Winice.exe control proc entry point3 p8 G; n) r' Q
while running MeltICE.* W4 t& t, Z$ ^/ Z7 _) F7 X3 B

: N/ k: E' L) h6 v3 y3 l% ]' x" n' c- y* w
  00401067:  push      00402025    ; \\.\SICE' D+ U; f; J4 D, k
  0040106C:  call      CreateFileA
" O4 m+ N' G2 k0 @! y" r0 h( A  00401071:  cmp       eax,-001/ V  M5 H# i* M6 y
  00401074:  je        00401091
; s9 h* k( s$ V% ?3 [
- `% n" x8 l( ?/ A& h2 t) h# }
, T, s+ d* l, Q: i& j, C8 I& A! oThere could be hundreds of BPX you could use to detect this trick.; X: R$ i1 V* Z% I
-The most classical one is:
4 |3 z/ E9 c, e& L: G  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||& {: |! W4 s( P" R
    *(esp-&gt;4+4)=='NTIC'
2 t' r' }+ J1 _( X/ l& O3 D% `9 E. [& {1 O' r3 K4 |5 Z$ ]
-The most exotic ones (could be very slooooow :-(7 G" _1 a5 M3 i$ `* _0 i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 S5 ^+ F# d& q5 z     ;will break 3 times :-(9 b, @* Z" {2 ^. ]
+ Z6 v# {) Q% z, ?$ f/ A0 Y* L
-or (a bit) faster: ( E  J; f" @. a
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), d) l4 D. \5 H$ B; D9 ?4 \. u
& u# F  F4 u; _7 x4 g
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! y% F- O7 Z2 m: J5 F. J( G
     ;will break 3 times :-(
  r" E; {- w3 d7 N) p  A; N! c, X! S
-Much faster:
6 {3 V% z% m2 s+ o/ m* I7 P   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 m$ i) _0 s$ |1 W+ \. H
- q8 Y. F! ^# J8 S
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 R/ P/ Y% _; U. O0 m, dfunction to do the same job:
) F. Y/ Z6 a5 I! q: _: V9 s3 s
: z( _- a% @- S6 n$ d   push    00                        ; OF_READ+ l1 Z; l- w/ B2 U' Q" ~* r
   mov     eax,[00656634]            ; '\\.\SICE',0
1 z, u+ {) ^; i$ j$ {   push    eax0 X* [$ s9 A% B% z7 }
   call    KERNEL32!_lopen5 B. I# S# `! C! y# @" S
   inc     eax
; N' _0 |" y4 P  u3 Q4 x   jnz     00650589                  ; detected: D" e" P3 h) ?
   push    00                        ; OF_READ) ~8 K8 Q# M# T
   mov     eax,[00656638]            ; '\\.\SICE'
$ s) R- E& @( @. U* R$ w6 n0 f   push    eax
) t8 ~9 X# S- T. g6 W' g   call    KERNEL32!_lopen
: C5 {( E2 m, Z# ~5 f; Y3 N   inc     eax
" H3 x  q* J8 o4 \2 w% a% b   jz      006505ae                  ; not detected9 S8 _. X' d" x1 P
0 Y& P! z) c/ ~! u
% N. E: h3 G7 F3 s$ I( K4 n
__________________________________________________________________________* z) _( q" _$ e. j) o

3 \8 \9 W8 l, z% y1 eMethod 12
' u- ~5 z, ?& e=========
* h. _. {1 z6 u5 k* p1 i" N1 l5 B$ t2 v4 d- C6 |7 B
This trick is similar to int41h/4fh Debugger installation check (code 05
7 P/ \8 C. [' Z$ S0 b& S: p: R- }, Y, I&amp; 06) but very limited because it's only available for Win95/98 (not NT)" R! r+ G# R$ p& F. M3 S
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 \% H4 {, Q  l, v- T
& a: O& O( Q. Y8 [% T; I6 `
   push  0000004fh         ; function 4fh8 y( V1 b0 {; S' t" q  }  a* Z  E. a
   push  002a002ah         ; high word specifies which VxD (VWIN32)
  w5 r5 Q3 ^& Y5 v* }                           ; low word specifies which service2 i$ @5 A$ H% v4 l3 k" h
                             (VWIN32_Int41Dispatch)2 ]8 ^/ N4 T, }/ Z% q! W
   call  Kernel32!ORD_001  ; VxdCall! y! E' a& R% m. C& o& V' [
   cmp   ax, 0f386h        ; magic number returned by system debuggers
) q# n6 c/ u& m0 ?  h" p! l   jz    SoftICE_detected
9 S7 O6 @& }1 k, \3 j  J1 T% i
3 ~, Z- Z5 L( w4 D1 U1 |9 o8 @! }* l* EHere again, several ways to detect it:
: G7 G, ]) v6 |$ R) k) Z- T9 v8 _& W
    BPINT 41 if ax==4f
( U9 {% ^1 U/ e" g+ o9 O5 o
' `, `( |0 Z: e) S% S# _3 Q" B7 X    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
; V% f, K7 \1 y4 y5 ?3 d" D7 o# m! m' f6 G  u+ }) h# T' E
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  U' |% f* X0 Q6 u+ I0 R: M; |. ?
' S* B2 r- h4 b, M$ |6 p4 Z5 l& l% i
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!: E# R4 o* g1 V6 m3 K
/ _1 Y3 Q. {; p6 P) Y4 L( m  F
__________________________________________________________________________1 H" E4 y, C  w5 X4 E

" j' r$ K9 d# N# w$ `  u8 VMethod 13
: A- M' D! B3 l% X- l& t7 }' h- N=========
; d2 L- c- G. Z4 T
. Z6 y5 D, |) Z4 K7 x% ^Not a real method of detection, but a good way to know if SoftICE is
1 w% o6 k& C5 l! }- i" @installed on a computer and to locate its installation directory.4 x8 {- x( m$ k, H  N) h' T
It is used by few softs which access the following registry keys (usually #2) :, |# J# [  |) v7 K5 t* E: [  E
& k$ m( r# p. v
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* n0 p, b5 q  H: |. K/ g  u\Uninstall\SoftICE
0 G3 c3 @7 _* a3 i-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE0 w. x2 Z: A. x8 G
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 o$ h, G4 M6 o\App Paths\Loader32.Exe
( H! P" ^2 I# L% X5 f0 {
# S$ Q7 o$ \; E" L+ I! H  @- ?* B( _8 v2 L6 \# u
Note that some nasty apps could then erase all files from SoftICE directory
. V( e2 t. O) X: W: G(I faced that once :-(0 e, G* Y: @* E' z9 V% U

% N: ]; V5 Q2 N3 Y. e) k4 p: NUseful breakpoint to detect it:/ ~; b8 @' n3 K' z3 p: x, @. [

! S) V& d, x$ w6 C; i     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
  S  z5 {; K6 `4 g) Z/ U7 q, N  ]/ ]& X! O  G- Q% ~
__________________________________________________________________________. M! Z8 @/ j7 |9 r! m9 R
, T1 ]5 p) Y- p2 F
: ]+ M& E8 ^( H, Q, M
Method 14 ' M% L8 x! v5 W/ j# z5 o
=========# `7 O" e9 L9 y" ]$ K$ g
% t% ?& v" p& O* l$ c' |* ^7 m9 q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 C! q( J( A3 s1 c0 t7 Iis to determines whether a debugger is running on your system (ring0 only).7 [- j: D7 |. D$ g' w1 Z. k
# o) T4 d5 R4 u$ _
   VMMCall Test_Debug_Installed  g! \; {8 o# Y8 v  x
   je      not_installed
# Y! }- y" ^- R/ A9 ]8 J- F
( e, G  d! F) L/ XThis service just checks a flag.+ e- V$ e& h; D; e5 F$ S" B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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