About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. s1 k5 C5 ?* Y& \7 W8 z+ T+ b
<TBODY>' u5 T6 e! Y; V( ]6 Z" H' Z
<TR>
4 g: w8 ^4 B; |9 B  w<TD><PRE>Method 01
: m8 v+ H$ N2 _$ H- l; x=========
: B+ c5 O1 W  W. a; X5 _# e
  m4 q. m8 V6 O) I1 w7 z' [This method of detection of SoftICE (as well as the following one) is" ~6 m+ T; m3 ~
used by the majority of packers/encryptors found on Internet.% d; |) G. F4 K/ @+ I0 h+ a
It seeks the signature of BoundsChecker in SoftICE" N2 Z$ R, }* T

) R9 \( _/ }% g7 d    mov     ebp, 04243484Bh        ; 'BCHK'7 K% r& r+ P4 t8 b" x* [
    mov     ax, 04h
# M; A) Z# B: ~% U" T    int     3      
/ n) L. Q5 j6 K% @) J8 L! q/ E/ s6 J    cmp     al,4
$ D% N$ Z7 X& x! B* N# Y9 `4 H    jnz     SoftICE_Detected
( G8 ?; }( ?+ g) z5 y1 p0 \3 I* v0 W- u& e5 m
___________________________________________________________________________: ?+ `# G, @% \+ g

# j5 J/ O) D5 q& RMethod 02
6 ]  g: E7 @8 y+ a- D7 u=========$ d6 K6 s7 R2 P& e9 R, K

1 f/ u# c0 I" w0 pStill a method very much used (perhaps the most frequent one).  It is used
: u3 R2 U  R( q5 kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,: {9 j7 Z' E4 F. D; k! [0 p
or execute SoftICE commands...
+ L4 J  g) D# U0 ZIt is also used to crash SoftICE and to force it to execute any commands( A, z9 o; r/ z4 X/ d# T  r
(HBOOT...) :-((  9 a# ~) o- l: c6 }# S, B

/ C& J6 \( m7 T( \& A5 V% XHere is a quick description:
! D* y9 n6 X. g-AX = 0910h   (Display string in SIce windows)
! p1 y) O- j, x! \-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)# d! w& @% p" L+ f
-AX = 0912h   (Get breakpoint infos)2 \3 i5 l; y8 V, L3 a; R' l
-AX = 0913h   (Set Sice breakpoints)! X4 z1 i* G$ n
-AX = 0914h   (Remove SIce breakoints)
. L: ^/ Q) A) S2 k5 j1 K
6 f7 A) |" F" S7 H& |8 YEach time you'll meet this trick, you'll see:1 z$ I' `2 Y9 `- q% Y3 ?) C# g3 ^! n
-SI = 4647h
( y; h6 J& U9 P0 j0 O* Y0 V7 Z2 p-DI = 4A4Dh* X* f5 \, B, Y0 l) T* Q' i
Which are the 'magic values' used by SoftIce.  j! f/ a. G2 J& w+ j% D3 ~
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 b; R7 B; ]5 G- E. H3 P

' t* }; {$ N# F9 m7 ]6 d) D1 }Here is one example from the file "Haspinst.exe" which is the dongle HASP
: N0 u# |; V+ K2 uEnvelope utility use to protect DOS applications:3 b$ l$ k: h4 R; `

( c7 K9 g+ [* g# H$ M7 l; E5 m; i- b
4C19:0095   MOV    AX,0911  ; execute command.
$ v0 I7 p& T- t" N: |4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. B( |/ O% g" @% V: X4C19:009A   MOV    SI,4647  ; 1st magic value.
! Z8 N* B) I0 D- f$ \* s4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. D- s+ C( V) e4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! d$ ^) I% z4 u4 {5 d4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ d  M' d7 e7 G: U6 C# j" |( u4 q1 W6 l
4C19:00A4   INC    CX# _4 u1 K9 ^' d
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute. Z+ F2 i7 }8 X$ d1 @& U
4C19:00A8   JB     0095     ; 6 different commands.0 m. \) p2 c! v+ a
4C19:00AA   JMP    0002     ; Bad_Guy jmp back., Z: M$ G" ?* _) w7 U( _, X; @
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
1 Z: ]( B4 Q' c+ w1 f( M' V' \$ _: Q9 A- B6 p9 L! ^
The program will execute 6 different SIce commands located at ds:dx, which5 K5 q% Y3 I# w) N2 t
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! ^7 f; Z+ ^' D# I: j  ]4 u% P* f. @$ Q: s
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 v3 x8 _( V% Q) c. G1 i1 g
___________________________________________________________________________7 b% b: Y& g- V$ W! i- H/ r& x" ^
8 [) h1 E. h7 m/ \; g# p8 y7 B! L# R

* z5 R8 t& y7 o6 H7 @Method 03! g( ?; G3 L' I- m( z9 K
=========
1 [4 b9 }1 h6 B! m4 l
7 @7 S. O7 o+ KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 k" M3 P7 H( Y
(API Get entry point)5 a# }  H) R9 {$ z' ?( y0 f3 }
          o8 S5 A" I" S" X# _1 Q% @
3 L2 N1 R( m- w' e3 _. f) e
    xor     di,di- Z) y0 X. b. Q" o% i' H7 l
    mov     es,di
; P3 U. D" e2 l1 `    mov     ax, 1684h       + a8 v2 T! s( n9 Q
    mov     bx, 0202h       ; VxD ID of winice
- [. u! o/ l4 u' J    int     2Fh% n. z5 z- X6 u
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; S2 X3 x. W, [8 |: h, i    add     ax, di& B9 ~/ X3 M+ \
    test    ax,ax. k% o& b# Q' J6 p% I: `: _
    jnz     SoftICE_Detected
3 F. u4 R2 ^& b- h! f
' E! X; s6 }, r8 V+ ^( P( t___________________________________________________________________________" L7 f- X8 B2 g
. \3 B" Y: ?7 l# o+ {- j$ G# d, _" X
Method 04
  o- u- l6 _: \3 [/ U=========9 E' i4 x8 k8 s8 `: X

, q: `$ }& V1 fMethod identical to the preceding one except that it seeks the ID of SoftICE
: Y, @& c! M! O# v& T# W: bGFX VxD.! V1 `2 V* a' e, U" \4 _/ }& {9 K
  u; O, T& }+ N6 V2 J* q9 ]
    xor     di,di$ d" E# v: _( W6 X" m2 E
    mov     es,di
: O4 E1 r' O$ X7 T; I' r) F4 A; V    mov     ax, 1684h      
9 o9 `6 P; j# o0 @4 R1 T    mov     bx, 7a5Fh       ; VxD ID of SIWVID. Z$ }& w# S7 m1 N( ]
    int     2fh
& `' q) c* \" t# E8 Q  ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 ^2 y; {$ u4 ]8 E1 u    add     ax, di& D4 I% V8 e  A4 B  G+ }% n
    test    ax,ax6 l" r5 r+ b" N
    jnz     SoftICE_Detected0 R1 ~0 r' U: b( p& r, ?
6 {4 R8 K& ]- F' d5 C# {
__________________________________________________________________________# D9 u0 y4 e2 S9 P  H

$ G4 M# i/ Z( f5 o9 O! p
& Y1 r  g+ t! h9 iMethod 05
  s& J3 C/ t$ n; Q& V9 m=========
$ X- m* W0 v2 z5 y. `# u
9 v- z9 s# J1 A; \Method seeking the 'magic number' 0F386h returned (in ax) by all system/ Y5 M$ `3 ^: D2 b" a  P
debugger. It calls the int 41h, function 4Fh.
& j3 [" }* k, _% k  _9 ~$ o' J4 ?There are several alternatives.  7 c  _- T0 |4 Z4 ~' N: j( |3 v- R

5 T. L% o0 X! \( d7 yThe following one is the simplest:/ }# T1 ^& c1 d' T* G

. z6 k% m; F7 q/ m9 u' Y3 T    mov     ax,4fh
3 A. o# g& W! Z& q  }4 p. m    int     41h8 r, }4 U1 ^5 c9 }( J! _
    cmp     ax, 0F386& a9 z- @/ v$ K# ~, \6 |/ m
    jz      SoftICE_detected
/ b+ T' j. t6 d! b! V4 y
4 N$ {* [9 `. k# V- i- x2 M5 U# d# i
Next method as well as the following one are 2 examples from Stone's ( {2 M" H  e+ `2 Y& _. v
"stn-wid.zip" (www.cracking.net):$ A3 u. ?2 S2 ^( B  R! {3 t  k/ L* A

, F: G( q5 t4 ?( F    mov     bx, cs0 y& k3 [! v6 m  A
    lea     dx, int41handler2
4 g& v. H: G: o    xchg    dx, es:[41h*4]. y0 @- Q) w4 ]
    xchg    bx, es:[41h*4+2]
, m2 h4 k0 t, ^, _8 m  N    mov     ax,4fh* y8 i- o5 g+ g$ G. Q  f% {
    int     41h7 u1 O$ O6 V# o+ n
    xchg    dx, es:[41h*4]+ Y' L' a# V9 a. K
    xchg    bx, es:[41h*4+2]: Y9 F6 P; ]$ O+ g4 J. ]
    cmp     ax, 0f386h
1 [: d: Q! s* |9 Z2 {9 I    jz      SoftICE_detected
  k% m% i5 b' x+ }& G" b8 ~( F( t5 O& i6 F& o4 v# c( L
int41handler2 PROC
& F# j, B, d0 y) m8 @3 L( D    iret
( J* F9 y! Z3 [+ dint41handler2 ENDP
2 I9 _( U# i' q1 E5 }- U9 r! Y% `2 Z1 e' Z, E* r
1 j3 ^: v7 d7 t1 D: _
_________________________________________________________________________
& A8 k7 I, }4 J1 h$ E+ U! z2 e) Y9 F7 V9 H: x+ F
, b8 W: H: b) J5 }% ?; L2 U. p) H
Method 06
; E4 P! P' }/ Y7 t- w=========
6 @& f/ {3 t! e7 F- v: R0 o8 U! t. h  b0 m8 ?4 j, Y
& M- L8 \4 P$ G( w. b' `+ U" L
2nd method similar to the preceding one but more difficult to detect:
2 ^7 p% e; P. }7 w
& m- G$ R2 Q+ e; A. v. h8 ^/ |6 l: f7 B# j
int41handler PROC
, L* G3 y! Y+ [' d2 \/ L; T8 u( }    mov     cl,al8 y( e% \& u" {7 p2 {" A: x
    iret: V5 ?( l% b1 z
int41handler ENDP1 h, g( f# S8 c

/ M/ n. c+ b! ]7 d. X
$ m5 s% ?  F: t! @    xor     ax,ax# O# V% t1 Z7 Y' b
    mov     es,ax$ w# y7 `8 z5 e$ K" B
    mov     bx, cs
4 H  a) r: R4 G    lea     dx, int41handler% |$ s1 g* t# \+ Y/ p' V
    xchg    dx, es:[41h*4]
  ~  s0 X( s8 z; P) D5 k3 {4 m: a) t# M    xchg    bx, es:[41h*4+2]7 J- Q& G$ u, G9 @- ]% e6 `" [
    in      al, 40h
# N. {2 D" t) a+ ^: X! U3 z4 |    xor     cx,cx# D& n; \' H9 d8 G2 @) O
    int     41h2 j1 k" E8 g) Q; \( b) E
    xchg    dx, es:[41h*4]- C$ p! ^  T  Q+ a2 g
    xchg    bx, es:[41h*4+2]9 J  `1 c3 t3 O7 S' W) c
    cmp     cl,al& [- Z+ j- `: T6 p# j
    jnz     SoftICE_detected
5 K$ [1 ~2 e) d% G9 l# @* P0 n, k: `
_________________________________________________________________________. }/ q, k# D, ]9 w4 \4 R) H; S

9 p5 `- |. F9 R! Z  N; W3 lMethod 07
7 _6 l/ W4 J# p& v6 t0 d3 f=========# U5 i+ Z3 d3 P5 V6 @  d

3 ^/ K4 X" r3 J% V2 eMethod of detection of the WinICE handler in the int68h (V86)
/ L7 S8 ^0 H& Z! C! B
8 O% a1 h2 ~4 |, c  J/ i    mov     ah,43h! i. }* j& D4 h; ]1 w% L4 O# c3 B
    int     68h
+ K# u+ g* H' j    cmp     ax,0F386h3 C5 S& T, i" @6 s
    jz      SoftICE_Detected; o0 F! n0 n5 E# A. F* L& |" A

: u- R, [  d. e( D0 k4 Z* G' }$ S% h% O# P) M
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" f) F' f) x# R& x: l% F
   app like this:
# y/ M3 y( R' ?7 k% j9 [; W( W# r! K/ m+ ~( ?8 [  n
   BPX exec_int if ax==68
; ^: i1 J9 z8 O9 N   (function called is located at byte ptr [ebp+1Dh] and client eip is
! B% q& @& D* M. r5 H   located at [ebp+48h] for 32Bit apps)
) k+ o# y4 h4 B5 t__________________________________________________________________________
- S% |3 ~8 G$ D' I+ q0 N/ e, t
3 Y2 p! [% H3 S1 {+ |2 j' q- ~+ A! V: k& H1 a
Method 08' |# @) d( V- P0 E$ F9 T- L
=========% A4 I+ \1 |$ i! Y: N. ^0 O
, \* n* B  Z* P' ^  t
It is not a method of detection of SoftICE but a possibility to crash the
  K8 v/ T9 }/ u, {3 {system by intercepting int 01h and int 03h and redirecting them to another7 h% B$ ?' l* s5 ], ?
routine.7 T' n, y. h  @+ Y/ k# G8 {1 i7 w
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: F5 {7 S, K3 u) ]to the new routine to execute (hangs computer...)
" u1 r/ d  j* I' ?9 c# W- b) \0 G$ w5 s. g
    mov     ah, 25h  x  [% X" k/ W. H
    mov     al, Int_Number (01h or 03h)3 B0 q3 R. k( M! H# m+ U( {2 J
    mov     dx, offset New_Int_Routine
" e* D$ d0 C  M: i    int     21h4 M% G* `4 b! c6 f& q1 w% ?/ x

9 ~* j0 k# ~3 P+ E& r3 v__________________________________________________________________________* t& H7 U1 p" b% r0 r
5 _  z1 T3 k' E6 @# Z2 N
Method 094 f7 t/ z4 `6 z+ P2 Y) W2 p( q
=========7 n6 K* o; D/ q3 l9 W6 g5 m

( ]; j) p4 U8 a; K/ R+ PThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 D5 G% }; k8 L) D2 {) U# ]- o& Bperformed in ring0 (VxD or a ring3 app using the VxdCall)./ e9 p! i8 y( p+ @4 X
The Get_DDB service is used to determine whether or not a VxD is installed* H; i8 |6 I- L7 v- P
for the specified device and returns a Device Description Block (in ecx) for6 o7 X. r1 l  ^' i
that device if it is installed.
/ X* y; U( @$ H& h. Y% A: m! M9 U1 L! j  f" h$ h
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 u" N. ^+ t' m   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
- X7 _0 a; `: S   VMMCall Get_DDB$ \$ t7 C; R2 {/ J; Y: j
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
" S4 z# }% w3 j7 ~
- j2 c* R' O* _- z; R: eNote as well that you can easily detect this method with SoftICE:9 F& p5 l, ?- F4 R% s
   bpx Get_DDB if ax==0202 || ax==7a5fh
: T" @: }0 g- |9 l3 @. [' q* z
8 @- d" D" z; o1 K__________________________________________________________________________, @: d( X6 b2 a; P

( l  t0 q, A6 F) `0 H& ?- @Method 107 `! p% q6 ?! c+ x
=========0 q3 u8 C6 [% r" C  \
/ n2 C1 `. [* I4 p6 R# S
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- R+ A* @- F2 z0 h# o" Z4 _
  SoftICE while the option is enable!!# F: j. u6 O, K, W0 R. Y

3 a/ h9 l3 Y/ a2 E3 J. CThis trick is very efficient:1 E& F3 m; w2 m4 M2 N
by checking the Debug Registers, you can detect if SoftICE is loaded
! |# M' ~4 ~5 {/ z2 r  J4 X6 O(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 Q5 ~$ m4 |6 o  B  g5 Gthere are some memory breakpoints set (dr0 to dr3) simply by reading their+ S- ~# B, P) M9 x' |6 ~
value (in ring0 only). Values can be manipulated and or changed as well
  l; f# E5 x5 V" G. i(clearing BPMs for instance)0 ^5 }. z2 Y* s6 k

* w! R! m5 Z& K( @* \6 R5 A% Z2 |+ K__________________________________________________________________________
) c2 y( V9 a! l6 ~& F: M6 e
2 Y$ V* Q4 O, o2 O3 NMethod 110 E1 B' {/ R2 ?; \2 d
=========2 u) i9 h$ k9 J5 r" i8 o5 d5 o
2 R( \+ R+ |7 j8 h: G
This method is most known as 'MeltICE' because it has been freely distributed
: x' ~; U! ^  L: {via www.winfiles.com. However it was first used by NuMega people to allow- S. T+ `) I8 k6 @7 P9 s
Symbol Loader to check if SoftICE was active or not (the code is located4 v0 M2 D: [/ X) L6 y: b' Z+ d1 J
inside nmtrans.dll).+ t& I( R( ^" Y* D1 f9 f+ p: A
' p6 c* Q+ d5 b. i4 z* ~8 y. q
The way it works is very simple:
* ]4 V; [3 L8 y9 S1 IIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
" d. Y2 g+ _0 tWinNT) with the CreateFileA API.( ^1 e* p' }$ d2 p! w: R
$ m* C( G# a6 x  Q
Here is a sample (checking for 'SICE'):
9 J7 A2 C' Y" v- d- a1 w6 o3 Z! G) M9 V' {6 h5 q" }- [5 g
BOOL IsSoftIce95Loaded()1 Y$ U. F1 t9 ]7 q1 s) C
{* m9 y6 {1 j% W: Q. a8 j5 N
   HANDLE hFile;  
9 C4 F- _5 {( q4 Y- C+ y+ F   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ n$ T" r* a) @" L& j# U
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# h  l1 P$ j0 ]6 c0 k                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);: l3 t3 P2 J7 R! }7 y: O
   if( hFile != INVALID_HANDLE_VALUE )
6 v* N/ \6 W; y8 f" y   {
& M  `7 ~% ?& T7 {      CloseHandle(hFile);* Q3 X: I7 E0 l, y" b3 j' y1 }6 l4 @
      return TRUE;
+ |! l* ?. ~) Q0 D: T( I  g6 C   }
1 z. x0 `' @; i3 U& ?5 f" C   return FALSE;/ K6 ]7 l8 P2 |& x! q/ L
}
0 y' D, Z/ S& C& V' x' e/ d, l
( z* f+ W3 ?- V& a4 ?& |4 lAlthough this trick calls the CreateFileA function, don't even expect to be3 x3 M+ M8 z  |
able to intercept it by installing a IFS hook: it will not work, no way!0 c; l8 R3 h8 E6 v+ N4 ?3 Z
In fact, after the call to CreateFileA it will get through VWIN32 0x001F& ~0 O0 A- S3 O; H6 J
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)$ y5 a  t* w4 s9 v3 D8 W
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
" z! a9 i% f! U, ~field.
, v& J  U" f" [( F4 K8 r) H+ r2 \$ HIn fact, its purpose is not to load/unload VxDs but only to send a
0 X# A# ]7 @4 W3 d% c( L4 yW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)/ Q9 W4 ]  R  Y5 n9 s' `+ ~' x
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
# h+ ]4 \/ A% B2 w' sto load/unload a non-dynamically loadable driver such as SoftICE ;-).5 x' b7 R! |. }3 t
If the VxD is loaded, it will always clear eax and the Carry flag to allow! D( C$ }1 x' r* K" ?" J. B7 G* a
its handle to be opened and then, will be detected.5 [/ x8 P4 a, q1 s
You can check that simply by hooking Winice.exe control proc entry point# D. k( P: o# C  c0 d/ s% n# Z0 R
while running MeltICE.
3 L% ]& G1 Q8 D+ x- k7 X6 |
1 V. t7 z" ?" l* c8 k2 S- D% S
8 E, L8 ?  H8 a6 F) ^# }" m- R* E  00401067:  push      00402025    ; \\.\SICE  [* w/ |, Q& S) X
  0040106C:  call      CreateFileA7 L8 m5 @0 k8 K
  00401071:  cmp       eax,-001
% s* D7 G0 I8 n9 f4 v6 U' e' ~  00401074:  je        00401091- T- B0 U9 h% R2 z: |" i& l4 D
: ?9 q, ^/ ]1 k& h, F
: ~7 M& h- W: ~! m! T" P* o& l/ B3 k
There could be hundreds of BPX you could use to detect this trick.
" p- p3 e/ L8 _0 n9 f2 l-The most classical one is:* T( y! p$ i$ m8 t! w9 @
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, [3 P4 I7 N4 ~* O) G, G    *(esp-&gt;4+4)=='NTIC'
% t$ Y) u& y9 A5 w& U. t; Y
: v# m4 m; C/ _0 b-The most exotic ones (could be very slooooow :-(5 _5 C+ ]9 Q4 S7 I+ g8 @7 ^$ A2 T: K1 u
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
0 [( H8 u: c6 p# q0 S. X     ;will break 3 times :-(5 F& e0 D( y, H; O+ b

4 \% X  k$ K* _-or (a bit) faster: * W: O. M/ p. ]0 a* U
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- U( ]8 K5 h( _7 ~1 l; f

6 `  g! [  B8 F; V   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! v8 f; t# z" ^3 u+ {* @
     ;will break 3 times :-(9 H* G" ]4 B3 J

7 [, M7 ^( l: L( S2 r0 y-Much faster:
! x# v2 @3 k" @   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ k. X$ [, u& q2 i* N

$ K0 E2 A! M8 z+ _7 B# HNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
, R. C( ~. U1 |8 T7 o- E' p8 zfunction to do the same job:
8 ]3 s4 I) y5 z, l8 @$ Y
2 d, C; i& B" G/ m8 R/ F   push    00                        ; OF_READ+ Y& m% l& w& D, H
   mov     eax,[00656634]            ; '\\.\SICE',00 P7 z- r2 [4 v# E8 @3 z4 Y0 K
   push    eax
4 R6 _: ^3 ]# v  g   call    KERNEL32!_lopen4 V- M* b) c% ^# T% {
   inc     eax
' x. ?% l; U8 p7 l8 u   jnz     00650589                  ; detected
: Y% Z. ]+ z; D) N" x4 Y# S0 J& [/ o   push    00                        ; OF_READ8 i7 N5 L! R& ^. g/ M) u
   mov     eax,[00656638]            ; '\\.\SICE'2 U- @' `. u: P2 F# f8 A* C; P
   push    eax
5 `' l+ h+ d  z% B5 O% H( Z* b0 H   call    KERNEL32!_lopen- K! W: ~" `* [, \0 G9 z* a
   inc     eax
3 O/ {9 A( T( }# Z9 o8 J   jz      006505ae                  ; not detected
- E% z+ j0 {' q& f( Z8 E8 I4 C9 ]
& g8 K! X3 D$ J+ q' _
__________________________________________________________________________) h9 Y$ C" k( [7 i; X

6 U9 ?" G9 g( ^1 P' E# V4 Z, dMethod 122 Z+ [" ]9 J9 l  s2 z8 u2 R6 Y
=========
8 z! i+ \4 N* ^! x1 {
4 O" v% ]. g9 W; ^3 p) ~, c( NThis trick is similar to int41h/4fh Debugger installation check (code 05
8 d" O) o* Q/ [+ J2 K" \; Y&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ }: F1 A: {7 q7 kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.$ D  q6 m* N* Q- E# s8 `0 H
( W/ U# ^7 T; M- L( T3 ]4 h; C/ Y3 E
   push  0000004fh         ; function 4fh( t8 L: I0 \3 u, b8 ?  V7 h
   push  002a002ah         ; high word specifies which VxD (VWIN32)  o) A; ?# h+ d0 c  _
                           ; low word specifies which service1 o  m2 I9 S# _4 n3 i! q# S
                             (VWIN32_Int41Dispatch)
. ?7 _' Q/ x; T2 w" [   call  Kernel32!ORD_001  ; VxdCall6 g4 v1 q+ F$ c! ^& D- P: m
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 L2 v- p, {$ h4 @& T' x1 d
   jz    SoftICE_detected
# N0 R9 `0 e2 B) ~6 D0 \# H7 [. X
Here again, several ways to detect it:
" L& `  ~8 |. Q' F
( r% `6 j; {! E    BPINT 41 if ax==4f
+ N% @# p1 c" e# ~/ @. x5 T/ p, T! Z5 o8 t  I, \  @4 g' R
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 F. W# n# d" n( Z) X

! o: P; L! D7 Z# m( ?7 N    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ M9 _2 g  z: C+ f$ f& W
$ `6 }' x- ^- W$ t. K# N, Z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- j- e1 B& i, r- l- e$ n8 q4 a
: L& X7 m) w1 e# ?- c1 _
__________________________________________________________________________
8 t% k0 b$ j7 v8 U1 `& ?* G4 R/ H( R& J9 |6 I" R6 D0 O- a
Method 13
1 W+ F/ k+ a  h) j$ R8 Z" I=========* h. P: p: ?, w" J8 t. Y
: M" M8 [) B9 P% e+ N: p: I
Not a real method of detection, but a good way to know if SoftICE is  N* u- i' }3 T
installed on a computer and to locate its installation directory.
7 V8 F" s' ~/ g, F! p5 q2 E6 UIt is used by few softs which access the following registry keys (usually #2) :
$ v2 @! J' L0 E0 j7 {, Q: c8 k7 l7 x! y8 l* O
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, ^0 k3 [/ F( e$ t
\Uninstall\SoftICE
' a  Q6 t" s& h5 M-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 P* ?. M! Q- p- ~
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: V% L1 P7 {4 ]4 U
\App Paths\Loader32.Exe
. I; ~' [7 R" F2 b: T; i( }  i. ]8 w3 D! v; i4 @. Z& {
4 S& S- P% E% D
Note that some nasty apps could then erase all files from SoftICE directory
3 _7 b% G* w6 U$ z% R2 Q(I faced that once :-(
6 d0 L: U9 c' ], t; X# l) j/ U) s# B$ y1 o1 B
Useful breakpoint to detect it:
" ^) X0 D' r9 e' j( x: \' z* J" h' N' z, L& C4 t' s% C
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 r/ K1 Q2 {7 _
! T6 ?# S7 t8 U% l6 {0 @' J__________________________________________________________________________; q& C8 A) h2 U- G: n1 q: A- x, T
5 N; s$ N; Q( k7 W

$ |8 {* P7 S" M+ f# t$ ]" T2 M5 JMethod 14 " R4 T( d) g! I1 c, v
=========
1 b7 g1 X+ e! ^/ i! L
& |$ Q5 _: f) e8 aA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose: h6 k& r; y: ?8 @6 x' l- B8 U! }
is to determines whether a debugger is running on your system (ring0 only).% B$ _; M0 F- g8 |3 G8 T
" R) w0 r* F$ k" k2 m$ F
   VMMCall Test_Debug_Installed
6 Z" s! k, |( Y& B- c   je      not_installed# Z4 x4 z5 O2 w7 G

# {- [# Q- a! M: e- t$ gThis service just checks a flag.
) [5 c- A+ C" t3 R</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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