About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
" f8 g* N, H8 ?<TBODY>
) A: @- u* E- ~<TR>" d1 p1 b  Z4 o- u: J' e
<TD><PRE>Method 01
' \& `$ H6 |/ _/ a" x7 T$ {0 A=========
+ v0 L; v- B0 u" E. }  t0 B4 d# g' G
This method of detection of SoftICE (as well as the following one) is/ ?- G. \5 V3 n) U
used by the majority of packers/encryptors found on Internet.
  D- x$ v( w; g" F+ YIt seeks the signature of BoundsChecker in SoftICE1 J% M6 e" z4 V4 g) X; R

8 l7 \) @! W3 I5 K9 T9 B    mov     ebp, 04243484Bh        ; 'BCHK'
( W& R' h4 Q- o* A  k    mov     ax, 04h$ U( s  x' M& i  B4 V  v0 m
    int     3       & j( `; v: U, T" Y" }- V1 s
    cmp     al,4
% @$ U* G( }0 r+ i- v    jnz     SoftICE_Detected6 Y$ J8 ?, Z: N/ F  I) L. t7 r

2 G. s9 W: k7 L___________________________________________________________________________2 I1 a8 R) b; T" p
4 T% q7 S, q4 B4 `( l4 ]: \: O, X4 i
Method 02
3 w) J  O6 f( w$ @=========; y- ~7 d# X0 ~: n7 N, [6 R

- h. o6 b; }! HStill a method very much used (perhaps the most frequent one).  It is used
! a0 Z0 N9 s, e) t2 P/ c8 Q4 kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, {8 u3 n8 Q4 F3 Hor execute SoftICE commands...
+ ^+ y/ R- s4 |/ O% kIt is also used to crash SoftICE and to force it to execute any commands
, d2 V6 L* e- {3 v8 J# o(HBOOT...) :-((  " C, h% M& y( H* Y% p/ [* f' K* I

6 s8 f& M( [4 y# ?2 c3 C1 zHere is a quick description:
& n4 a3 b; q: `9 x" |8 K-AX = 0910h   (Display string in SIce windows)8 d, O0 i: W  P" c  f
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ A, b- q6 D7 t* J-AX = 0912h   (Get breakpoint infos)
+ N) ]( d( }& I& W  q-AX = 0913h   (Set Sice breakpoints)
% t6 {/ P1 @% S& l-AX = 0914h   (Remove SIce breakoints)
& P" l# w# B, y# d3 _- j, j2 x0 \1 _5 Q- T  P* X
Each time you'll meet this trick, you'll see:* z- l$ s. F6 _0 [
-SI = 4647h6 x5 D9 o, _$ _: `! q
-DI = 4A4Dh6 {9 m& b$ j$ Q
Which are the 'magic values' used by SoftIce.
! g7 s/ Y& v- A" a# x7 t% D. q9 hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h./ Y$ ?! S0 c' p7 s" R- B

. c: k# U* v1 [! L9 V/ ]1 I, N5 f+ wHere is one example from the file "Haspinst.exe" which is the dongle HASP$ |# _% z3 f: v4 u2 ]0 E: Q$ L
Envelope utility use to protect DOS applications:
# A, a2 t9 v: U- P: @/ C. z
. k. j5 r! E7 G6 R: \# ^1 m% H3 o: t
4C19:0095   MOV    AX,0911  ; execute command.4 P# D- j6 D8 t0 K5 Q& q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 S' n6 q2 N0 z$ l+ e! ^7 g! D2 d4C19:009A   MOV    SI,4647  ; 1st magic value.
! j, [1 e/ \' a4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 b- k# t# d( g) Y0 F- Z4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
; b: r6 i! G  [) s+ k1 |4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute& d1 f2 r1 q( F( d  S6 w: U
4C19:00A4   INC    CX$ z$ F- K+ ~$ _" u, }" {+ |
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" Z6 D3 c! X7 g( U4C19:00A8   JB     0095     ; 6 different commands.
" b+ D. m0 g) t4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ S: H: w: d9 c6 |4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! E1 }# Z6 ~1 J9 T! B6 c, d  b: y

# A% y7 N9 q. k2 q& W- f7 pThe program will execute 6 different SIce commands located at ds:dx, which
2 R# ?5 f, x# R0 `0 D2 M! p, Oare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
* n. n, n/ o! b: l1 }0 C. k1 ]3 ~3 B" \! I8 u+ X' [3 ]
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
7 B- P3 @5 w/ a: v___________________________________________________________________________4 y. Z- {! Y6 B3 V( Y  g, T# a2 j) M
1 Y0 S/ ]8 i# A/ L
% \9 v2 X5 s+ V) w
Method 03$ X! o7 C& b8 v; E8 n* s# B/ z
=========
6 V9 m( f( Y! Y; H, A$ N# F- R* O8 o; ?) }! F7 Y' J
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
" F8 B1 [% V# R(API Get entry point)) ?! t) ^0 d; G. h! T1 {
        
. y4 |/ c+ M9 _, s- [5 G& O* A4 N! h' G1 |
    xor     di,di
( f& L6 h8 y( D, X8 U( g: _4 w    mov     es,di# n/ A% t* p* H. o9 z# T
    mov     ax, 1684h      
  N3 d9 C2 S$ ^* b    mov     bx, 0202h       ; VxD ID of winice3 H! J2 e1 {: `- m
    int     2Fh' D% \/ ~% u2 X% K9 k7 Q- |
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, a7 v* K2 e; c) o. Q, ^    add     ax, di' a8 {* W( K( _5 Y3 d: g: T( W
    test    ax,ax& _) ~- S3 _6 X- j2 F
    jnz     SoftICE_Detected; P2 W' v# @& n' C* |6 ^  b
" ]) h! u$ _; N8 ]. k. u
___________________________________________________________________________
$ m8 N' U1 j, E+ q# U4 V" N  U# f% @6 X) }3 L; H5 o
Method 04
9 [% F' K) P( S" S, E) D7 J=========- q/ z, ~' y0 I1 ^- J
* Z5 v- H+ s8 ^! H4 p
Method identical to the preceding one except that it seeks the ID of SoftICE* B8 m4 z1 [2 u4 y' l- C
GFX VxD.
+ ^4 M( ~' l' P& G! k5 p
: S2 G$ S$ ]# f2 n1 m; y    xor     di,di0 O- N8 Z: \7 J
    mov     es,di4 |% Q3 v6 r1 p% U2 i+ U( S
    mov     ax, 1684h      
' r; n& l! o  t5 s2 A    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ J# Y  B! s8 l& G/ J. a; Z
    int     2fh8 |0 w% c( D. L' k+ t
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- _. @& |% ?4 z, ?    add     ax, di) k% b- b3 ~: B2 X0 L; o5 X% |
    test    ax,ax
4 f8 }5 P( S: I    jnz     SoftICE_Detected
4 y: N- R3 `& M+ k
3 h4 e+ S7 H! v8 w, t; u" A! L, S__________________________________________________________________________$ M2 k1 ~& v% n2 l
; }" F/ O4 s, d1 J$ l7 S" T( t* ~

6 C  a$ ~6 `6 Y/ RMethod 05& C8 `6 B# x, L4 j4 H' u
=========- ^1 `5 ?  H5 e$ e1 G2 C' s

! Z# @* W9 N. X4 C* }Method seeking the 'magic number' 0F386h returned (in ax) by all system
" }# A5 L5 \+ s0 Edebugger. It calls the int 41h, function 4Fh.
: F" b1 C. R  l$ p" PThere are several alternatives.  / n% s3 W$ y" e3 y# o0 X1 A
' `! K6 W7 a$ d' r& N
The following one is the simplest:0 a, N  q. y& @3 S
6 V, }# l# l! T( d3 Q. c8 j5 }
    mov     ax,4fh9 b/ m8 ^4 Q! |; ^( U! o1 r2 i% P
    int     41h$ f* C& {. a, }: _0 v
    cmp     ax, 0F386
8 Q9 _3 n! o9 U: D    jz      SoftICE_detected1 s+ v5 I# r8 l3 {- J- J& n
% z; [# c/ A) m

) \/ c8 w( B( m: VNext method as well as the following one are 2 examples from Stone's
/ n% J; q+ Q$ j* [& q' i; |"stn-wid.zip" (www.cracking.net):
- F; S/ m* ^' Q4 m8 N# s$ }5 I  a; o! f4 j
    mov     bx, cs+ g( c: s1 a) ?- |& P+ C: V9 y
    lea     dx, int41handler2( j& [9 M4 ^! O! S$ W
    xchg    dx, es:[41h*4]3 i/ `2 w  l# ?
    xchg    bx, es:[41h*4+2]
" z, J; D- F" M* S$ S, C    mov     ax,4fh
. O4 C  h3 ~. A% i, J! z    int     41h2 q0 c: [% K2 X  ?+ |
    xchg    dx, es:[41h*4]
2 p+ w7 H4 s$ p6 [  q. Q    xchg    bx, es:[41h*4+2]0 W* n9 h: m% H& b
    cmp     ax, 0f386h! Q& w3 E# b' k. h
    jz      SoftICE_detected9 y! }# Q' o2 O7 z! q
, O% F5 G, F/ _$ ^
int41handler2 PROC
' e. L% @/ p( ~* B. D; ]$ H' F    iret
( s& P0 E( p, t$ B3 Z( e' O: pint41handler2 ENDP
4 C0 F0 [! H$ @7 N( l! \9 i( u0 {) q1 X" a
- [3 s6 c' _8 f8 M$ y7 |4 m
_________________________________________________________________________
: @) I# s$ J- ?' P& N  u6 h
7 c: [4 c% F8 D! v  w" `; T- J1 E; G2 _0 E3 o8 g; [, L; [. \
Method 061 x1 ^8 v3 r* M' U; W
=========5 F* [& K0 u( X# l& u* F
( a$ Y3 S4 f2 K! C/ n7 d
, O3 g, X' k8 H1 ?
2nd method similar to the preceding one but more difficult to detect:
1 u8 r; O. e" g
' w5 [' T( h. P' r1 l$ d2 r) O, D0 s2 }2 v
int41handler PROC
  V+ R  N8 C% n* H: _7 z1 n    mov     cl,al
* k* p# p1 G8 f6 h; _' I    iret* V$ ?1 T+ ?6 G0 y
int41handler ENDP
" L$ H) y3 u. `4 o- Y3 }3 y6 N- d+ B

7 q! N! ]* B" t$ k3 P    xor     ax,ax- T8 t5 W- R; {- c
    mov     es,ax" [8 c5 X0 B- [7 j* }1 @
    mov     bx, cs8 B2 D8 e) G# S" v- ?6 p9 ^. }" [
    lea     dx, int41handler; N2 i% ]+ h8 a) P! [
    xchg    dx, es:[41h*4]
6 C( x& ?6 I- U    xchg    bx, es:[41h*4+2]. |# @1 s0 t' k5 X8 c: `
    in      al, 40h, N" t# f- r. F% r
    xor     cx,cx
) l9 J5 l# N3 J- V& k  ]6 [    int     41h
# {& n0 g3 n; h8 Y& c    xchg    dx, es:[41h*4]& v/ @$ s# O1 h
    xchg    bx, es:[41h*4+2]0 J$ Y2 f) A4 @
    cmp     cl,al+ X/ [, b: i7 s( V  Q
    jnz     SoftICE_detected7 @& N) y, V( v5 `

  [( \5 h* s5 l3 n% C  ]& O_________________________________________________________________________
$ w1 D* p5 q( z8 i; G( J6 \9 W- |' \; ~3 o" \
Method 07
) K) K& J& u% a6 ~. P$ u9 {=========  g+ P& V; g! g6 N7 Y: S. s5 B

  r& d; I" M  l- n+ C. H1 nMethod of detection of the WinICE handler in the int68h (V86)" Y) C. q. n, ?! G, ]- x: w" @5 h

! A4 I0 l* R& L: V: F* R  v    mov     ah,43h
6 L; b, L0 d! I+ T    int     68h
% m" X4 `- W* ?5 ^  S6 P$ f6 T    cmp     ax,0F386h* R& b+ n0 J2 O& U6 q4 Q
    jz      SoftICE_Detected
3 E4 H. ^, S; u) e* l% h+ Z5 T$ o/ x$ Q1 T

  Q" F7 z( h0 r( ]# e# p) f=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 `( N: j# L( L( ^: B# f
   app like this:4 j* H. a. R% C! v3 W0 f
: u2 ?/ A) a5 b
   BPX exec_int if ax==68
, t2 q2 S% ~  b( S( w) o: j/ k   (function called is located at byte ptr [ebp+1Dh] and client eip is
7 E: [4 Q6 ^$ W9 q, o. ?: r  X   located at [ebp+48h] for 32Bit apps)
* d* g! ^4 T1 `: a. u__________________________________________________________________________" J" z) @, q4 _! {& y! T$ S! G

- H2 y/ F3 e7 ?0 d7 x# \# R1 q) n3 x; ~2 s3 v9 ?; k
Method 08
5 H# f! F* R1 J$ h  r( T! K=========& s) J* o* l+ D# K! [$ e
' b7 Y; Y/ ?  b: W1 M
It is not a method of detection of SoftICE but a possibility to crash the# {6 E9 [; |6 c" `2 I  A
system by intercepting int 01h and int 03h and redirecting them to another
8 L, i; ~, u7 d1 k/ Wroutine., n2 H6 `4 F  k3 Q& r5 Q) L0 [! l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ p- l, J9 n+ S
to the new routine to execute (hangs computer...)) o; B: ^! x# t. o! w( V

- _3 x3 ]! D5 u: ]. H    mov     ah, 25h' u; X. s8 P3 }& H$ z3 M
    mov     al, Int_Number (01h or 03h)
9 l: J5 e, d4 j# L    mov     dx, offset New_Int_Routine
% Z* |! T) L+ ]% u& H% `    int     21h
; l4 _6 @' A( t% j9 ^  }/ Y* s6 O6 e4 s. Q6 G( n
__________________________________________________________________________
9 I) k: K1 \7 d% d3 c/ S
( i  a7 b% h; K' ]0 F& RMethod 09
$ ^" e' y1 R! y2 H8 O+ }=========
( C/ w$ a6 m7 o+ k# G8 x9 |0 V, H" i* f) Q. K  j- h; G
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# w0 r" V! u% I8 G  {* Fperformed in ring0 (VxD or a ring3 app using the VxdCall).
. A) q- H5 }/ R3 p. ~5 DThe Get_DDB service is used to determine whether or not a VxD is installed) @5 L) W. h9 O" u) N! `- ?
for the specified device and returns a Device Description Block (in ecx) for' W$ z( j! q* r2 w! Y
that device if it is installed.8 t8 u: ?" n4 W  i5 C
; |" E4 R# l" ^/ Y3 n
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( o* w) ^7 M5 G  O   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
  [% B- R' I' t7 j3 J   VMMCall Get_DDB
6 D4 l' m8 `. _* d5 h# O   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ e- U+ J6 V! i1 w8 n

6 _) a6 z- u; rNote as well that you can easily detect this method with SoftICE:- s8 D' u' o) b
   bpx Get_DDB if ax==0202 || ax==7a5fh9 J1 E& N# C2 d# W/ }

0 {( d  I( \6 N__________________________________________________________________________
& ^! |4 g5 L8 X4 Y5 w$ C- z7 g- `) q7 b3 o; B( t
Method 10
- V9 z3 {1 R9 A/ g( [=========
2 G0 m4 B6 Z4 P9 w- H0 M! f
' ]' b+ Y' [$ S- r=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 P& l9 ]$ O+ t6 O  L
  SoftICE while the option is enable!!
" L0 }5 U  a7 B7 g* l9 M% ^! U. {) v0 r1 Q
This trick is very efficient:* C% A& r, Z/ P1 q
by checking the Debug Registers, you can detect if SoftICE is loaded4 V; H+ S8 }6 v$ y$ `' r
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
' |( S0 ?6 V3 Tthere are some memory breakpoints set (dr0 to dr3) simply by reading their
4 u; \) v: v& o( D0 n9 Tvalue (in ring0 only). Values can be manipulated and or changed as well
9 v& h1 N& T" i, Q(clearing BPMs for instance): x$ \/ N4 q- I% ~, n

( d' P/ E' u9 `" A1 x* L__________________________________________________________________________) `! m+ V1 [, {$ X0 t  z) r
1 g* C  D& d' J. U! l
Method 11# `: Z8 y  N& y# B
=========) o5 V9 l# t; N' ]3 i' ?  J
9 p( _# w6 Q  T8 H4 ?
This method is most known as 'MeltICE' because it has been freely distributed; {. ~) E) w1 c
via www.winfiles.com. However it was first used by NuMega people to allow3 X( C6 {1 I  x) E9 J+ P1 \. o
Symbol Loader to check if SoftICE was active or not (the code is located; T" J+ z0 V& y" r
inside nmtrans.dll).& p! n0 h$ |( d( A

7 T% c4 L2 H2 U' TThe way it works is very simple:
; M; }- w: z$ t6 ~It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& V9 c+ V& B' H6 n! g( s9 J) NWinNT) with the CreateFileA API.
7 l+ D% S2 P" U3 M8 s4 f  {2 Y
9 T, Q) V* u) xHere is a sample (checking for 'SICE'):$ X8 g# E  M6 y9 O. Z

$ c2 z/ z: G" b) aBOOL IsSoftIce95Loaded()
5 d+ e2 @8 m4 Q6 [* @{1 T3 E1 b) P& y
   HANDLE hFile;  
8 T' d% e- s1 o   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
* w* i2 @! }0 k0 f2 O# A! E                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  i- t: p6 M  Z                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);3 K4 O; m$ Y- S! z3 u# T8 g
   if( hFile != INVALID_HANDLE_VALUE )
. O1 C) I# |% c* A' c+ Z   {
$ d3 {  u2 x5 {. @5 }, {  p      CloseHandle(hFile);
" J. W* ?' D: B      return TRUE;
. S3 ~! v& P; _! c6 z1 W   }) ]. V0 G& i# s9 Y  d5 F
   return FALSE;- C' x& Z, O7 \! k1 |
}
- F1 a" n5 j; f) I/ L$ [
/ U# L5 C; w6 h. ]9 u0 WAlthough this trick calls the CreateFileA function, don't even expect to be, O  @. J6 m$ _- e1 i
able to intercept it by installing a IFS hook: it will not work, no way!
+ ^6 w' l9 O9 ]" e2 WIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
4 w" J4 N. j/ c- H5 X% V& \service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
4 Z) k# y5 S& g8 U: v; G+ V& kand then browse the DDB list until it find the VxD and its DDB_Control_Proc
  V- q7 d+ d8 p! o. @7 j" tfield.
# V1 i* t7 t. c# p2 P6 L9 NIn fact, its purpose is not to load/unload VxDs but only to send a " S8 n$ ?% {, q0 K
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 R1 {0 v% ?: E4 `  s7 r' Ato the VxD Control_Dispatch proc (how the hell a shareware soft could try! W, Z0 w, B% Q8 b+ A
to load/unload a non-dynamically loadable driver such as SoftICE ;-).  r. z# }# G) I, ]
If the VxD is loaded, it will always clear eax and the Carry flag to allow4 M7 F1 }" r7 `8 |7 i8 r
its handle to be opened and then, will be detected.+ @, d9 k0 l  h) }3 m8 T6 N8 U$ z( b
You can check that simply by hooking Winice.exe control proc entry point! V, J" @5 C6 e; W$ J. t7 @
while running MeltICE.- C/ r# @1 A, i( {. X

4 c! @4 A/ d  k) E
' q- V' G$ _2 r; \4 ]7 C  00401067:  push      00402025    ; \\.\SICE
, G! V! z% W/ s" s/ w4 {  0040106C:  call      CreateFileA( i/ |! h2 W6 c* Y3 n3 W
  00401071:  cmp       eax,-001
9 l2 l* F1 P% U$ F  00401074:  je        00401091) w" P/ f4 }. u4 A. z1 o& r" V

8 @5 [, S/ ]6 k- ^, {# w
1 G' f+ n9 J5 JThere could be hundreds of BPX you could use to detect this trick.
0 U/ H- X4 g. n$ w3 e+ n( d) q-The most classical one is:; u, t) R# v/ `2 o& J! @" _
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
& ~! N% L2 g. G$ r! o/ f3 m5 P! b    *(esp-&gt;4+4)=='NTIC'
$ _( {  C+ L0 n1 y4 O: [' A0 S
3 `8 S6 q7 x! w5 j, p-The most exotic ones (could be very slooooow :-(& a( q  c% B; b2 y7 ?# |4 {
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 \8 R# G) m8 K" H* S5 ?5 u9 X$ Q
     ;will break 3 times :-(3 B7 f" [& [4 ^* j: s( m3 m! T
. K* R" m) X! Y, c3 p, `# }
-or (a bit) faster:
; @5 n. a0 g0 l+ X1 \   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 U2 g' h2 i6 p9 Q0 l
" Q5 u9 F1 D) y6 w* G2 o
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
+ v' M6 a: M& G# ^  X4 Z+ ]+ X     ;will break 3 times :-(
* o, O' T( G5 D* c6 C1 o  r% @. ~4 k' f+ K$ Z$ z  t! H* S* S. F
-Much faster:
. r5 @3 r, ?. _, q& s( E   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. _+ q& W: ~. _6 c1 |
% E+ |+ d7 X' X% R4 U' e3 U9 N0 Z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 r1 |8 P& p; z& D2 e& d" efunction to do the same job:
/ U' e4 N4 ^" L3 O# Q* o3 `% t3 K& d2 b$ D- s1 t
   push    00                        ; OF_READ
$ N( h! g; M: p& U, G% h$ Q   mov     eax,[00656634]            ; '\\.\SICE',0
7 C# ~4 K( n7 v7 a# Q! x. i   push    eax. w8 y& q7 }- _% ]+ c, ~- N
   call    KERNEL32!_lopen
+ \8 m  X8 G* b2 V   inc     eax
9 r0 w' g6 w7 b! v$ r  G   jnz     00650589                  ; detected- j% Q' [0 s$ X6 U3 ^% w9 u
   push    00                        ; OF_READ
! H- R% z, y% L9 `$ |# y$ J   mov     eax,[00656638]            ; '\\.\SICE'
" u5 @+ R, j* {& |, o! p+ L   push    eax
  |) g9 C1 W( P, i: u% x) M. z   call    KERNEL32!_lopen
$ y0 v% g8 M1 s- o/ o- C7 B   inc     eax! Q0 ^! F# {: E. L' @# }
   jz      006505ae                  ; not detected
8 z2 s' ^  \4 n; j' Z; N) |: y) M! u. ~1 P+ m
) a9 N) I  B8 k2 `* x( O* {
__________________________________________________________________________. S( c6 r- ^5 O) P+ H3 o- q0 @+ ^

) s! v1 S# o' R  U; wMethod 125 ^+ J# V! \" N9 l4 t* |- T
=========/ B# E, @+ T  D/ S

/ e1 t7 Z0 W  c9 cThis trick is similar to int41h/4fh Debugger installation check (code 05/ M! q3 k/ Z- L# _& g4 ~- Q: S2 _
&amp; 06) but very limited because it's only available for Win95/98 (not NT)5 Y6 I3 @+ \' ?- A
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, }. c- V" b0 B8 I- N* ^+ k- h3 Z+ k% p
   push  0000004fh         ; function 4fh
( r9 o* E# v8 }1 N- U1 `' x$ m  w6 {   push  002a002ah         ; high word specifies which VxD (VWIN32)
& r6 a& i' g  T' p" `3 |                           ; low word specifies which service. P: X2 g8 R- t+ Q1 ?6 B! k. J8 \
                             (VWIN32_Int41Dispatch)
* \/ D! C5 h! X4 y  Z   call  Kernel32!ORD_001  ; VxdCall. O8 t7 M! G$ @6 A/ X1 n7 E2 Q
   cmp   ax, 0f386h        ; magic number returned by system debuggers
/ ~; |7 P, q) a3 Y+ {   jz    SoftICE_detected
. J: C1 A$ J4 U4 V- Z2 w+ O6 C# n) K8 o  }- Y, B. E6 L; h
Here again, several ways to detect it:
3 q# M: f1 S4 f( A5 |' S
: C6 `) V  A; R1 \    BPINT 41 if ax==4f2 M8 v1 _5 j5 }6 Q5 G2 p
' f4 L# K  D: j/ w) T2 f0 K
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- I( P2 V1 M  l5 l' K" T# I  K/ ^! b- t1 D& V) `: e
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 O& f( R3 u' w5 }* p0 i9 ?

; U: s0 O: G3 Z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!4 T/ y% v4 v# p$ X* `  O1 n6 J( Z- v

4 H" n3 _3 ^3 ^7 V& s__________________________________________________________________________
7 x; @, X) q' u0 C
; n+ X2 b( t1 }6 L+ e$ I. QMethod 13
. ^& s2 E$ R+ w! K- Z8 k- g' z=========% D7 E( I" h$ d! k# F: d
# n% U9 W$ u' h' J" _
Not a real method of detection, but a good way to know if SoftICE is
. s1 H$ [# S5 j$ i# v2 `6 Tinstalled on a computer and to locate its installation directory.
( |) N% [) J6 ~& I" O( GIt is used by few softs which access the following registry keys (usually #2) :
" d1 B* U: r/ ?- s
, v; ?& ^9 o5 z: d* V; z-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# ^- W6 i" y' Q- l* u+ h
\Uninstall\SoftICE
. L/ ^6 n" {( i! k-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) J7 y0 Z8 o$ q' [
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 M! C7 Q3 h( E& k6 l\App Paths\Loader32.Exe
  M* {1 i: q# I
4 m" Q0 h) @2 o: X! C$ W" _- R
" _) O9 f3 p) T7 j4 S0 P, Y8 d3 r# PNote that some nasty apps could then erase all files from SoftICE directory
  |8 b6 ?; O7 E) ?! L(I faced that once :-(
4 X/ [0 D6 b3 T
  K9 E6 q7 |+ l) {Useful breakpoint to detect it:
5 \1 ~8 e7 p7 x; F( F4 p" q$ z3 A( X1 R3 i, R9 T
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'1 E+ P8 L- r9 p: y/ i) `
4 T3 j1 f) Z# }( _; Y9 w6 R2 j
__________________________________________________________________________: l. O" C7 R8 }/ l  J6 s+ W

; _" F" |0 i. Z- C& P
0 l# e7 B2 X# TMethod 14
8 `2 e8 N) T) W=========9 g1 K* W5 h/ \% L

% D4 C+ h6 r7 [7 b8 KA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% [- o8 k9 R) X2 |/ R4 Bis to determines whether a debugger is running on your system (ring0 only).
1 n0 U3 A; {4 z4 @5 ^5 T( t7 Z; q3 N8 ?' M% z
   VMMCall Test_Debug_Installed
' \! f8 M9 q3 ?2 y/ D   je      not_installed
3 D' `; E" O7 x) V, O
/ n& ~% P3 x1 C; ?This service just checks a flag.
% u* K2 c" w# X</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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