About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' n" g; G. s7 B: e5 L8 l
<TBODY>" M9 r' E$ E' ^# b; X
<TR>! D+ q1 T; {0 C, |4 |
<TD><PRE>Method 01
: x5 W: Y& Z5 ^5 E) ^=========
* M8 R, _; u% ]8 t0 @! W% \2 O9 a& d$ U
This method of detection of SoftICE (as well as the following one) is
4 j7 U0 f; y+ L. `9 }# w2 hused by the majority of packers/encryptors found on Internet.# n( I$ l0 x' W( Z9 s3 }& A: |& x
It seeks the signature of BoundsChecker in SoftICE
- B  X  a7 @' d% J# R6 j% V& y0 J; a1 {; l# X  T5 g
    mov     ebp, 04243484Bh        ; 'BCHK'4 K2 h, T& x& D- \& k" `
    mov     ax, 04h4 h6 U# t; h. R
    int     3      
* W  [1 J. w1 J& }6 Y; Y    cmp     al,4' X! h% v( |, W/ f* g1 K
    jnz     SoftICE_Detected" S' u7 i3 N" a; K

% Z5 q4 W3 ]9 q0 V3 ?9 U___________________________________________________________________________
, {0 U* v0 k- f7 J
+ Y5 U" v0 @8 m4 {2 Z) JMethod 02
7 C) \% o  }5 q2 q  Y! f=========: ?7 k! o' ^2 z+ _

3 p8 a* n, ~9 n1 u' a2 MStill a method very much used (perhaps the most frequent one).  It is used7 s: F  L9 H& Z, f  |
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, x: {2 T% w7 @3 Y. p* Eor execute SoftICE commands...
/ V) L6 Y8 `- TIt is also used to crash SoftICE and to force it to execute any commands' c* S6 X$ V8 |; n% \- f
(HBOOT...) :-((  
1 G% f3 T, o* g  ^  Y* T& e& u
8 \" x0 t# f/ F& hHere is a quick description:
8 `; q0 S* e% `; J  ^7 ^% a-AX = 0910h   (Display string in SIce windows)* c% t, x! v: H5 x  a
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 V# D2 u; D, Y9 r
-AX = 0912h   (Get breakpoint infos)3 z) \# ]4 A* [! N
-AX = 0913h   (Set Sice breakpoints)' Z9 ^. Q- \& m' `5 s+ p. X
-AX = 0914h   (Remove SIce breakoints)  q# M3 U. W; [: j0 `4 o! L
7 p  H( W( i1 C' r4 {3 [
Each time you'll meet this trick, you'll see:. [& S' P- Q5 N  a
-SI = 4647h
( [7 s- N, H+ w; G; C5 x-DI = 4A4Dh
. ^  Z5 t7 Y0 M( N: h: q% fWhich are the 'magic values' used by SoftIce.
8 ?5 r$ c8 n/ ?' Q1 @: vFor more informations, see "Ralf Brown Interrupt list" chapter int 03h." @& O* v/ \& o5 c6 [' J

& T! i7 s, f: @: zHere is one example from the file "Haspinst.exe" which is the dongle HASP
) @' e5 N+ K$ W3 N" E* XEnvelope utility use to protect DOS applications:
( ]3 R+ T4 h3 E  D, v9 n) U9 c$ q7 o% |1 ?& P4 y6 v
3 t" M& A/ f* R3 N. i
4C19:0095   MOV    AX,0911  ; execute command.
& o  b, L, x, t7 O4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 u' g/ s5 B* k4C19:009A   MOV    SI,4647  ; 1st magic value.4 D( H6 E) a3 f4 C' y1 ~2 w- Q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 H' H8 y. o" u. b
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% h5 n$ I* v/ r4 _, r& [+ S
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute1 o  p% I: S- T) v
4C19:00A4   INC    CX
7 N% F4 ^3 I1 j5 c$ _: q& a+ `: \! H4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute8 G1 y  s2 Z$ L) r* S
4C19:00A8   JB     0095     ; 6 different commands.  g: `  ?. f; f/ K% y. Q5 z
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 q( f* [9 Z- y" u3 p
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ m$ _# T; E; \! l
2 C# ]8 w7 J% t. q. I
The program will execute 6 different SIce commands located at ds:dx, which
5 S5 K1 [5 R# d1 V) r+ Gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) C6 p% b$ P3 v4 ^) m- ~" K, M" |/ w$ o4 j5 t
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
- _. ]3 m9 Y3 E2 _# z  k___________________________________________________________________________& N7 ~/ `3 R% n

( g4 R& K9 p, q, k0 P% I3 u; c
! x4 U% v, Q- h1 N/ Q$ FMethod 03& f0 s+ ^5 r* I1 b' T$ z) [
=========
. B" k8 b( k" o: ~) @' |
7 N7 Q5 y# O/ i! ?2 u6 e3 ELess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" l% g# Z- g% C/ U5 {. e: A9 v
(API Get entry point)  _. y) u2 M$ P
        2 n, p' X7 f1 ~
' p8 w4 _0 u' O) @' l! V
    xor     di,di; i. Y' u  B5 U$ ]
    mov     es,di
" e9 B% S1 E, ]0 o( s    mov     ax, 1684h       $ q$ \7 D  g3 ~6 t1 [  I1 O
    mov     bx, 0202h       ; VxD ID of winice" L! x* ~. r+ U! M8 G& y; D  i
    int     2Fh+ _: c5 ?0 Y( \+ x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 Z; m6 Y9 n" L
    add     ax, di# a" _4 b& s" C6 K. F8 X9 ~' |
    test    ax,ax
3 w+ T, R3 c, v; }! }; i7 W    jnz     SoftICE_Detected; \# s( a) e! o; P

' K6 P7 D9 |, R7 f) [+ Y7 Y___________________________________________________________________________6 L& _- D, u! `

- D5 L) [& U- C2 h- Z% aMethod 04  w, c1 l5 k% G8 w, Y' R
=========
. {: P$ q. H; A( M  Y, G# l
8 k3 d- Y+ r7 x4 z2 |4 B6 lMethod identical to the preceding one except that it seeks the ID of SoftICE
: U0 @  r: b" \GFX VxD.
1 I# p* `# B2 F8 L
# w7 L# P( E1 K1 M% z: Q9 v    xor     di,di
6 k2 y$ v5 M# x  a, g1 [) w3 `& V    mov     es,di% j% g+ }( w) X! L. P( U
    mov     ax, 1684h       1 a8 x. q( |! h6 j. j4 t3 }
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 t% b) d& `5 X0 P+ G    int     2fh; z. A1 t* l  O# L3 r; j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' f) r# f; J8 Y# ?# d7 f" b    add     ax, di
, {' \& t2 F/ ^+ D/ O. D    test    ax,ax3 a; G! N' Q9 ~( N4 _. |
    jnz     SoftICE_Detected
6 d9 T. w0 q  u$ p* I6 G" U) J. ~3 B) q0 p9 T: E( G& h' O* n
__________________________________________________________________________/ O& K) z0 T# ^9 G

- t2 F! ^. u, X" C$ k; S! b
  g: J$ Z/ S$ J! x" IMethod 05( U* V. k; {5 N/ Y, _
=========
$ g- F( u( I1 \  w9 N
$ A6 o8 M( z- m$ MMethod seeking the 'magic number' 0F386h returned (in ax) by all system7 u! B2 k( [- |
debugger. It calls the int 41h, function 4Fh.
% b% J" ?* K1 L5 m" }There are several alternatives.  " W, w, e9 g) ?

" D' Q4 D! b" o4 v! V3 @1 TThe following one is the simplest:
$ M1 m& r0 ?$ ]5 [0 e6 y
1 W  R* [$ v7 f" D5 ~4 B7 H/ R* t    mov     ax,4fh! x6 F6 E5 Q, f
    int     41h# E$ J6 d& ~, ~3 ^/ D3 `
    cmp     ax, 0F386/ k- A+ k; _" g
    jz      SoftICE_detected2 I, @: Y1 v/ v. E5 E
$ k- I1 e- c! x7 D0 t

; H( M* w9 \0 u4 ^# k3 aNext method as well as the following one are 2 examples from Stone's : c& T$ ]7 |4 f+ ^0 z) J
"stn-wid.zip" (www.cracking.net):
: }6 _, j- g6 g' E+ B* l7 _( q3 h. ^# ~/ J7 B7 r
    mov     bx, cs
1 A6 R& f* }* l    lea     dx, int41handler2+ s$ ?# G' a0 J3 q2 N, Y
    xchg    dx, es:[41h*4]2 s( ]' ?0 D& C$ [) x* _, U
    xchg    bx, es:[41h*4+2]
8 g0 S, \' F3 ^/ l9 }' }    mov     ax,4fh
2 F9 L% \  G' y7 G9 I    int     41h  q6 A8 F( u! n9 S6 y
    xchg    dx, es:[41h*4]6 P, g7 L! k/ q, N9 Z. N! a
    xchg    bx, es:[41h*4+2]  R' [  ?! T! D% D6 G
    cmp     ax, 0f386h3 R/ z3 A5 v9 z0 ~5 D6 W/ Z! e: I
    jz      SoftICE_detected
% Q, \8 Z  u' s& G5 ~0 z
' Y' g4 C, z$ \& F5 T9 fint41handler2 PROC
" q$ n/ }8 _- j# B    iret. [- K. w! r2 I
int41handler2 ENDP9 l. |  Y. y3 Q
* @$ [" t$ u/ l5 x

& Y: E  w+ T' e_________________________________________________________________________3 H) Z$ Z0 _2 l

( w6 H# c2 O: d0 C5 O- ~/ y3 U
  s( Z/ Y+ C' {/ K5 `' XMethod 066 N: b. s9 B. u* Q- J* ~6 [
=========
7 b. a5 ^, F! S$ G! G; V8 h. r5 n
/ Q/ W! A$ Y% d, X
' n9 t) M, O4 `/ S+ \) T1 Q6 V1 J( Z2nd method similar to the preceding one but more difficult to detect:
  _0 Y# Y8 e! o! M& B: Q# F; Z
9 D% T* j' Y6 Q, a. q3 Q0 F# t. h, G- p6 u* ?
int41handler PROC& U* Z  d4 _2 ?
    mov     cl,al
' H/ X$ [9 ]* }: V2 r# W- o; g    iret
0 Z) U2 h+ N# a" A+ H+ mint41handler ENDP
9 n! X5 C3 k( B, r  ^* _
  h. a% q. Y$ n; s
4 s% K1 m2 q' c+ O4 f    xor     ax,ax5 H3 ~$ |8 Q0 _/ ^9 U, y. H; k
    mov     es,ax" f/ u* X6 R  M) `
    mov     bx, cs- u/ x. J, h& |' V+ ~/ L" s- o5 z
    lea     dx, int41handler
3 s8 e6 L" s9 b( P3 r; i% Q6 P, r    xchg    dx, es:[41h*4]& S9 ^, M9 f5 B9 ?, D# F
    xchg    bx, es:[41h*4+2]8 z2 z& \+ P: W% E% }
    in      al, 40h
% `0 L$ H# {. K% ^    xor     cx,cx0 y; g$ H  Y% g5 }: ~; s; w
    int     41h
0 w' u/ H- U/ N( d    xchg    dx, es:[41h*4]1 c+ n! [; L& L# T; Z+ m( J9 a
    xchg    bx, es:[41h*4+2]
1 O* ^+ K# h- i: J! a/ P    cmp     cl,al8 \7 z) u! K( |7 _8 h
    jnz     SoftICE_detected9 A4 f2 X, R  K3 ^, d' R. I: N* {3 e
" @8 n2 ~! |7 Z
_________________________________________________________________________. h0 T. v4 R/ ^
3 `; I/ \$ k' b. n9 O
Method 073 b9 ^0 ?; H( v, P  e. ]1 X
=========, w, |  j; T+ {; h% m
( }; u' `: F" k& _5 C5 B! ?. l' y
Method of detection of the WinICE handler in the int68h (V86)0 X1 P/ `; {0 u/ H* ?7 m/ ]

- y! [/ C- r! |% t    mov     ah,43h) j0 D4 E' |2 J8 [; Z
    int     68h* r1 }) q" H  c3 z
    cmp     ax,0F386h
( e5 Y( i: j. b+ x, x7 C. V- A' o    jz      SoftICE_Detected
9 [  }) a3 v) h/ P+ t) _2 `! v  w; e- u. r. Z$ u; }
- r4 {$ Z) `6 O9 [$ ?, i$ F$ h9 }
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
' T. T8 ]$ g3 S( L/ I0 N8 e   app like this:
* p- a1 \  Y6 }& B" K2 u+ m' }% k0 `$ v2 W
   BPX exec_int if ax==68: [* ]2 {( e, O- Q+ ~( T4 t
   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 n  d% p" e& o' Q# l   located at [ebp+48h] for 32Bit apps)
3 Z4 T- Z6 z' t) J9 X__________________________________________________________________________" @8 H& K7 d" r/ g0 `2 b
/ O8 C/ D% u8 K9 h

  P1 z& h4 B) {, B) e" M0 }7 PMethod 08
. t9 y& S7 n* c' P=========
( C# z5 l9 q) q* O' j5 Z% L* U
% z# o, q8 R6 |  `It is not a method of detection of SoftICE but a possibility to crash the% h6 V7 v: x" W. W7 t# t" u
system by intercepting int 01h and int 03h and redirecting them to another
' N( E  l9 P! }/ |+ ~9 Z5 Wroutine.% ?" Y6 b3 f2 J+ q8 p: E1 a+ c
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 D* v7 K4 a) H; G
to the new routine to execute (hangs computer...)" x* p+ I) S- q8 U, h7 i

8 Q% x: I( B4 w! i    mov     ah, 25h9 z) p( x' t6 S$ y1 n
    mov     al, Int_Number (01h or 03h). Y& v! z9 c, r) x; ~+ P* ]4 V" \
    mov     dx, offset New_Int_Routine
0 q, {' j5 B! [! W    int     21h
7 i0 X# j; a  E$ C6 X) w9 ?3 c8 `0 J
__________________________________________________________________________
" z4 K9 l7 D- f
) I) ?! X2 h$ }: ]( ?  D  o- f5 @Method 09% U# K& O& t' \  n9 A) s/ O% @
=========& j; J0 m/ y9 c  `8 C1 R$ B

" ~& c/ i5 _# D# ZThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only$ k% h" \2 F( l; M' k7 x
performed in ring0 (VxD or a ring3 app using the VxdCall).% d  O! j# y9 I( G
The Get_DDB service is used to determine whether or not a VxD is installed
# z- K3 `9 h! Z! l% S0 Efor the specified device and returns a Device Description Block (in ecx) for
8 k0 `# j, g: k3 m( a% m" n& mthat device if it is installed.
( q- ^; k9 K6 B' B- o/ M8 P# G6 o* F4 H+ Y1 X5 M" M
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID% p. e% v9 d+ D. x" z& h
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), g1 E( w6 H% `! f+ c+ ]
   VMMCall Get_DDB3 L% A& B/ N# F
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ l* _2 [) i+ u% R: a' }" |' n
1 |7 x% W1 l: x( V; UNote as well that you can easily detect this method with SoftICE:9 P! J' V, O- w! l6 p* b' ]& i# a
   bpx Get_DDB if ax==0202 || ax==7a5fh
, G* K6 {8 h* p4 [: k% w6 V0 b, {
9 m# N8 D" ^) q__________________________________________________________________________% \* ^7 i' H: [+ a

7 j$ i7 O. H2 S% k; H7 n" j& TMethod 10( |/ z- _" P* m6 ?; h# I
=========
0 u. T. x5 w% n- O2 W4 Y( Y; x' j1 T3 X- X/ o7 K
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: E- {. a& ?, C2 I/ W2 B9 x9 \) a
  SoftICE while the option is enable!!
+ J# }% H% U* i" X
; L; N, k- z( ^! r' v+ lThis trick is very efficient:
2 p* \/ Z4 ~) R- jby checking the Debug Registers, you can detect if SoftICE is loaded6 C3 T8 j/ ^, b& N' r4 k
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if+ ~' n7 G  l4 D+ F
there are some memory breakpoints set (dr0 to dr3) simply by reading their
  J, M# T* ?( Z/ w. ~7 Hvalue (in ring0 only). Values can be manipulated and or changed as well
1 Y; ?5 M& F) I3 ]' p(clearing BPMs for instance)" I# g1 z% J1 v" m6 e

1 N- Q1 B: M; D; z1 j8 V. L__________________________________________________________________________# ~1 }# p0 x- g" \$ D( f- X

, d! W+ |" P0 nMethod 11
( K( g& z( b7 ?: q( w=========: a1 F- @. R; L; s
5 d0 r; [: A1 U- J4 p/ b3 N$ b
This method is most known as 'MeltICE' because it has been freely distributed
- j; P2 b7 }2 V: \- Ivia www.winfiles.com. However it was first used by NuMega people to allow
8 `' N/ [3 g" ?) ESymbol Loader to check if SoftICE was active or not (the code is located
" B2 z: ~( Z* Dinside nmtrans.dll).
. I' @8 U9 N. d) k0 X. B# v+ i. w+ q
$ B3 C5 `0 O( r- HThe way it works is very simple:# }. a- Q$ B; x; ~
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
+ H+ V  L* B3 }' _0 X9 \. ZWinNT) with the CreateFileA API.& x; `9 T9 f( D: d1 G% ~5 O0 d  K) s/ H
+ I' B: U/ ^1 i- k$ a. O. F
Here is a sample (checking for 'SICE'):
6 N  O) U1 @; d  a; U2 W$ R4 q
. o; ]( i8 p# G. g) UBOOL IsSoftIce95Loaded()% T# K# [# b  G* _" n
{8 m: l! `7 u$ M/ g. W6 E4 Y; }: r
   HANDLE hFile;  
0 W+ h" ~( v' q% b& Y+ y' T   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,- d6 i, C5 Z' v1 e$ x
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
7 ^" I0 k( y) u! j& w                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 ?; Q+ s6 ?5 g( p. g0 p
   if( hFile != INVALID_HANDLE_VALUE )
( g0 o) I8 A! Q0 h9 J) p- v   {" s& {% O  k  s2 s2 R2 ~2 b1 U
      CloseHandle(hFile);) o# x& q# b1 h2 A) P
      return TRUE;! m( w9 F2 i7 H9 c& Q& z
   }
' C5 [) e; s! @5 b! O$ }4 t   return FALSE;) O) \1 Q. C' N- C, A
}
- K% i* W2 `* }! V0 r# u: j3 b4 m+ a- ^8 Y0 r
Although this trick calls the CreateFileA function, don't even expect to be$ u8 u5 L. A2 L- b
able to intercept it by installing a IFS hook: it will not work, no way!( j7 r( Z+ l# X
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: E4 K' {) z0 F3 P; V" y5 Z
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
4 u0 w% J' r" ]and then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ b, `: @$ P8 d5 x; hfield.
% Q8 C; t/ [2 K0 t4 Y! HIn fact, its purpose is not to load/unload VxDs but only to send a
2 H; i) e8 g! B7 j; P# {W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)! \4 z* _8 y; N$ V
to the VxD Control_Dispatch proc (how the hell a shareware soft could try" O8 m8 A6 m6 r0 B$ m* e
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ r- H* o# S; i8 x9 ], Q8 q: {If the VxD is loaded, it will always clear eax and the Carry flag to allow
5 b& M8 E1 u( K3 {1 Fits handle to be opened and then, will be detected.
+ ^5 g! G* w3 T2 l6 |3 hYou can check that simply by hooking Winice.exe control proc entry point
3 E4 L, O( ?* T7 l: hwhile running MeltICE.# N/ S5 a1 p: C& Q4 t  H

! R5 d: w$ Z; \" H- G  P. B8 D% G( p, G! z+ \' O  a; H
  00401067:  push      00402025    ; \\.\SICE- O2 v4 }7 J: s6 ~9 ?! {
  0040106C:  call      CreateFileA' j# d" n& y4 [3 A
  00401071:  cmp       eax,-001! S1 D3 s  F& I9 w# ~8 l! @
  00401074:  je        00401091
6 [& f* X$ p: h1 w9 l  ?/ p( e! |& v- J  l

. l0 p9 P) @3 XThere could be hundreds of BPX you could use to detect this trick.
+ i$ `( o' ~3 Y/ Q% A5 P' R-The most classical one is:: Y% `6 n: A  q9 H# w
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
( m. X1 q5 f4 c2 [& L    *(esp-&gt;4+4)=='NTIC'3 p  N( F. c3 A; D
" F, k. r. D% L! [! q4 C* V$ j& t# r
-The most exotic ones (could be very slooooow :-(4 C; Q+ ]4 B& i# p. @, [
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% Q) e1 D5 F8 v7 W7 Q8 A     ;will break 3 times :-(
* _: @. Z" G2 p- f7 d4 O7 ]' y# _* S: S9 b  P* G
-or (a bit) faster: 4 T2 F8 w" ]/ V$ I! h1 d1 G
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
" c  i1 y2 |6 J' l! c- y
: d2 m9 G" h& K* R! I   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : G; i  G. C- O/ o) L. J  D% t
     ;will break 3 times :-(  M9 @' _( I# K: I' A: z' e

; E& T9 X2 `9 O6 C$ D6 i; s-Much faster:. S7 t0 I5 e) K( {) h" o
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
8 h  [9 u7 @4 ^' d+ n! H6 z4 v; O7 V1 T: w5 z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen/ w# D: k- c' h; h" ~. {  M) L5 C
function to do the same job:6 L2 u8 r9 Z& p5 y% u. @, E. f* G
' Z; R7 X$ u. ^. j% S" N, A
   push    00                        ; OF_READ) e( Y+ I/ W  H, F5 v
   mov     eax,[00656634]            ; '\\.\SICE',0; ?6 l* L0 N7 ?. r5 P
   push    eax
" b5 L0 q7 K% Q   call    KERNEL32!_lopen
- k, f9 R# U1 f, F3 E' q. z   inc     eax% ^, Q: C6 x: w8 a; z
   jnz     00650589                  ; detected
+ M9 P. O5 D9 Q   push    00                        ; OF_READ
% Y6 C- p; _, q. A6 L   mov     eax,[00656638]            ; '\\.\SICE'
' x1 `8 T5 G* W- y* w   push    eax
6 U" I* |% w9 j+ L/ `% P   call    KERNEL32!_lopen3 @+ d: {# }" z/ @! Z( x% j
   inc     eax2 q: g/ Q( Y' {% y
   jz      006505ae                  ; not detected; ?9 x; e  F9 M, |8 @

# a& N* _$ y5 V8 m1 q. X0 _# w# x% W# F
__________________________________________________________________________9 y* e5 X8 s1 j: E7 s8 C6 {

: p: j  |0 q$ @% F3 BMethod 120 Q# X% D5 F- m9 ]* U" G% @
=========
8 H& T& y$ ~/ a; c% ~
' N, \# ^/ u. `! {1 R" wThis trick is similar to int41h/4fh Debugger installation check (code 057 ^* X% [; m* b1 `" t4 B4 I
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
1 R4 \" {! K6 }$ Yas it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 S: _7 [" O4 Q  i, T+ p( G9 S

9 J2 I! ?* W3 n& u   push  0000004fh         ; function 4fh# Y. W1 v0 @: l/ T' T' i: K% t
   push  002a002ah         ; high word specifies which VxD (VWIN32)' h9 a! J- ~  m
                           ; low word specifies which service* f+ @8 g9 F7 c  ]5 W
                             (VWIN32_Int41Dispatch)% X" m; |# t' ?8 R2 B
   call  Kernel32!ORD_001  ; VxdCall
2 @, P5 E, S9 I$ {% l) k. l   cmp   ax, 0f386h        ; magic number returned by system debuggers2 l/ M/ J$ F8 v: r3 ^. U4 |/ z" k* V
   jz    SoftICE_detected
9 a5 B; T1 N$ g; w6 l$ f9 U7 I1 X$ Q& m- P9 \
Here again, several ways to detect it:, h/ E& x! I1 e9 X1 p
2 _8 X8 W* t( |1 N) x: {2 Y
    BPINT 41 if ax==4f! A% j6 O: x# }  S1 I0 N

- {3 N3 C! @: U# l! }    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 Q) o! G$ @& g9 ?1 P/ Q, O
  C- ?+ O" t, x- L1 F/ B    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ S- y5 N8 |2 [: B3 l
9 b0 u! Q& O! m
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) i4 Y. X& s# e9 f0 K5 h+ [6 p# u- n2 U
__________________________________________________________________________2 c+ K; F( E/ }6 e; G2 Y2 P, @4 h4 L
& N8 L! c) e0 l( g2 _5 T
Method 13
) [$ H% H4 X1 i7 \0 y, ~- W=========
! |/ i6 T  N+ e+ s2 o) B
. ?9 E! k2 u, H5 ?4 p9 |3 a9 ?6 j, cNot a real method of detection, but a good way to know if SoftICE is
  g: N( H2 X$ {; [installed on a computer and to locate its installation directory.# \! B1 H4 J! G0 E3 @: Q& I8 _& [
It is used by few softs which access the following registry keys (usually #2) :' G) v5 R1 @2 d# U+ a

& r$ M  p: U+ w2 h-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 ?; `1 i+ C' X7 G6 G
\Uninstall\SoftICE& p7 S1 y/ s4 R' Q: y/ e$ K
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
8 G, l- w. J2 e-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* [$ B4 z  ^  b2 g2 a\App Paths\Loader32.Exe
9 [/ q$ |' y6 S, A* Z  I
. i* R- {& E* g9 r. T8 i+ S6 c4 P! d- N7 W- Y7 L
Note that some nasty apps could then erase all files from SoftICE directory( C* s( ]5 h, M) q- H; g
(I faced that once :-(% D/ g: H# e. l1 G/ P& w

0 i4 a) n$ i9 I& U2 u' pUseful breakpoint to detect it:- i! n1 d/ r! \7 Y: |7 X/ U- I9 C

' V. r& M- `2 Y4 ~6 O4 \     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 \5 c! R3 Q: R. H' H. ^6 V
7 ~; B# T9 e. s3 f9 b$ b
__________________________________________________________________________* H/ x) L7 ?  E

4 o8 d, Q7 T/ e7 }6 h" s, `
5 Q7 W% B' I" a' c' F; O5 t& mMethod 14
( M+ ~8 ~- D) ~3 l4 Z=========
, h/ n4 O3 d, S! |: N* w7 y" {
# m9 u1 O4 D3 u/ a$ I! ^' UA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ w/ V9 C& V; @0 |4 ~0 Ois to determines whether a debugger is running on your system (ring0 only).% f$ P; p) N1 I. X5 L$ o
' Q/ |1 _' a2 f7 O
   VMMCall Test_Debug_Installed: g) o& @$ R, C& }! B. q
   je      not_installed
: T, n8 h( @0 C/ C0 G! j, D/ A/ r: h0 d9 ~
This service just checks a flag.  q, T* F4 }: q3 B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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