About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% q2 W) Y: c7 }+ v/ g
<TBODY>
# C/ x. w( l8 G6 ^% S& A* w<TR>* e, q. y6 R0 M7 W6 _: J. ?- x5 k
<TD><PRE>Method 01   t0 }; J9 Y" u; A3 m
=========- h+ D9 j4 _1 `* \6 {/ i
$ s$ m3 _7 N/ Z/ N
This method of detection of SoftICE (as well as the following one) is7 r2 \- N- ^6 o" h2 m1 I: i- a
used by the majority of packers/encryptors found on Internet.
* z: @% o% o  e. eIt seeks the signature of BoundsChecker in SoftICE
2 L8 B9 v" Y  r. ?3 ^: k3 O! [/ g  q
    mov     ebp, 04243484Bh        ; 'BCHK'
6 M1 w- P, @0 D: V6 n$ l- V6 n6 C    mov     ax, 04h
; G% d; Y3 z# Z  D    int     3      
3 E. r4 a* U% }5 p; i" W- I# q    cmp     al,4
* w& K$ a' q" @9 W* g. A1 i6 s    jnz     SoftICE_Detected; h9 _& V" ^; F5 k: b( b) R# D
6 t; j% k; r; I$ J. q! O+ ^
___________________________________________________________________________
0 J. U* q2 v/ j4 D, t% }( W
' g4 d* m7 `  H, V* k: q2 F4 w6 B) BMethod 02
7 [* `$ O. g3 @7 V. q=========
+ W# I. C) t) A
, w! H  L6 w9 SStill a method very much used (perhaps the most frequent one).  It is used
$ R4 Q! r7 e$ ]to get SoftICE 'Back Door commands' which gives infos on Breakpoints,: d6 a/ B/ S0 y5 {
or execute SoftICE commands...
3 ^' I; ~! S# j9 q* ^1 I  H1 O/ X$ \It is also used to crash SoftICE and to force it to execute any commands
+ F( R' V" Z8 k6 c& Z$ K(HBOOT...) :-((  ; W7 S7 ?  l) M3 l( s
, v, E2 ~0 n/ H* y: D% I) _) t1 D0 d
Here is a quick description:
# n) ]9 r* \9 k3 z5 R-AX = 0910h   (Display string in SIce windows)
1 `/ W! N7 i( t- ^  |% f9 K- ~-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
; \6 V* j$ R& r+ J. q-AX = 0912h   (Get breakpoint infos)0 s, A/ p6 d9 P/ Q4 C
-AX = 0913h   (Set Sice breakpoints)
) D+ }* R% O. a  U$ ?-AX = 0914h   (Remove SIce breakoints)
# Y  }8 F& S0 p& t$ ]/ Z
2 ]/ o( q' g7 A7 |8 @Each time you'll meet this trick, you'll see:- }; E, v  V; G3 a$ Z  @2 T4 j& M
-SI = 4647h
% ?5 L$ k+ E5 a/ D2 q4 Q-DI = 4A4Dh
- `0 V2 ^- [7 g. s6 c5 WWhich are the 'magic values' used by SoftIce.
; o" c% c1 C! nFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- M, N% ^( q& B9 j, H9 m/ R$ {) U9 s4 Y4 G
Here is one example from the file "Haspinst.exe" which is the dongle HASP
2 m' g  \4 b4 D% @Envelope utility use to protect DOS applications:+ D4 ?1 x6 b( c' v$ V

/ c& G) N! m; l( I, g6 `1 |. Q& S6 p8 p
4C19:0095   MOV    AX,0911  ; execute command.. B& D4 P" j+ t6 j# H, g6 v, ]
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).0 Y6 u: e) m: W; b8 k
4C19:009A   MOV    SI,4647  ; 1st magic value.3 j4 u/ Y6 I9 D- H
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.( n8 _' \, m! M% h2 F( @. e
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)* o- A" G1 ?  }. c8 y1 i
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
) o7 [! u! b/ y7 n% c: z% ~0 i4C19:00A4   INC    CX
  l0 N* q' T( J6 L4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 U" S4 b7 {2 ]* G# x4C19:00A8   JB     0095     ; 6 different commands.
" w) f2 x7 B& b! O4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 S, n: a' s; Z' D+ \8 {& T
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)) u2 _' C- n* [$ c; s: F" X

" E) t, [( {3 M5 D1 C* d& {+ S2 i7 wThe program will execute 6 different SIce commands located at ds:dx, which
, H( `6 E1 ~* ?% p4 w( lare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
: V, u" `# t* _2 R- @
$ t( e1 E( Z! j5 e3 S- a* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 f; Q& n- Q5 v
___________________________________________________________________________  U* H. V" C" Y$ h- w8 ^3 U

7 u* o0 l( v! j/ _+ E2 I1 z
; ^( b, q8 W8 w: `1 e% wMethod 03- r% q( O) _( _8 E0 K0 c9 t
=========
/ k( l) Y% e# ~5 Y+ m( w7 g& n3 z" C
: Y8 M5 n( Y+ q; c1 I0 ULess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. F* f& R3 H1 }. U3 z6 ^' R6 g" P
(API Get entry point); o, @7 l* U% `7 X7 a1 E
        8 k+ Y, o/ S1 A& d3 f( T# E
+ ]6 Z3 }  F) j% y" }- l. i+ V3 E$ j
    xor     di,di; X' B1 G% e! j0 @
    mov     es,di6 o0 f5 h+ `9 a9 k# J! \& J
    mov     ax, 1684h       $ w/ [; ~, d' e. I& q: O
    mov     bx, 0202h       ; VxD ID of winice
% _% y& L$ n1 Q, L    int     2Fh
) L5 w0 y+ _0 o* c8 d8 ?0 i# x    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 k# E- y" |) I0 b4 I7 n4 o% `- Z    add     ax, di7 T" U( o3 i6 ~$ i
    test    ax,ax% q. G. l# v$ m; L& h4 x+ p
    jnz     SoftICE_Detected
# B. @) t, M; |5 o) q! B5 K) k! F6 a6 O6 `& z! X% z! T
___________________________________________________________________________
/ }* P$ ]2 M) \  ~/ t" A7 F) A; ?" `) y. X+ |% x# c
Method 04
# l: p4 Q3 F7 Q% e=========3 D6 p+ ~# L: H/ ^
4 V; k& v1 R; v& d& C# v! y/ V
Method identical to the preceding one except that it seeks the ID of SoftICE
8 E$ W6 D, ^6 O% q0 z0 y* XGFX VxD.
; i; Q, x1 K5 Q) B6 A' o6 e5 R2 `3 r, |
    xor     di,di
0 [' M  n1 B# S! F6 w! U, V- v    mov     es,di9 V: G- t* a2 Q( }2 K" L- w/ x
    mov     ax, 1684h      
$ m9 {3 h: Z! v$ e1 E. U    mov     bx, 7a5Fh       ; VxD ID of SIWVID
: }8 J5 ?6 n7 H. z7 a) o" C    int     2fh
0 S7 W( q6 y& q8 o( W  X    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' p( z! d( M5 @$ s$ Z    add     ax, di2 P1 X" R- ~5 ~# d
    test    ax,ax
& P; a5 q5 u4 N    jnz     SoftICE_Detected
, b2 g& ^( c& a7 g7 y! K4 L  ]; M1 R! Q! H
__________________________________________________________________________
& P: {& x+ b+ X% P" P& Z6 Y4 N; Z# D# ^- X* b, i

2 u& h4 r+ q1 Q8 {. B/ q! I$ cMethod 05  D( p" y  {  |6 s
=========
6 E, q! `7 s* Q$ O0 T0 u$ L4 ]$ O
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- L( n4 k! v. w9 G5 h% ?3 C  \debugger. It calls the int 41h, function 4Fh.
7 P6 B& o7 n* r! U3 \There are several alternatives.  * z6 r2 ]( n% t6 t
4 }- e$ l% T7 B4 `
The following one is the simplest:
0 E6 I* g0 f: j1 n: {/ C$ S# ?
* `- Z) M6 ]! r: U, j    mov     ax,4fh0 o/ N% m% o0 o: N5 O) m9 F
    int     41h
) x) s. r/ I, L    cmp     ax, 0F386( p; C# q4 U1 }' x+ i
    jz      SoftICE_detected
. Q! ?1 g" m4 F* [% }0 O/ }; [
9 s. @; O4 A  D" B5 q7 H5 ~) r+ m' v  X3 z2 m
Next method as well as the following one are 2 examples from Stone's
: G" S7 ^& h: h. J"stn-wid.zip" (www.cracking.net):: \  ^" g+ Q* n6 u
! P5 v6 y! g3 ]; N4 u
    mov     bx, cs
& F- Z$ q" C; i8 A% u1 S    lea     dx, int41handler25 D! t% M" T3 l& {; H
    xchg    dx, es:[41h*4]  G- {. w& [! `0 o, ~
    xchg    bx, es:[41h*4+2]
/ f7 R; C) }9 i0 x; K& h* ?* H( s    mov     ax,4fh
6 G2 j1 d" S" g  X% K0 q    int     41h; \' k( V, z1 I2 v
    xchg    dx, es:[41h*4]/ @" }3 a9 H& v4 n& O6 G  l; ?4 Y
    xchg    bx, es:[41h*4+2]8 D, g  V, J- p! y
    cmp     ax, 0f386h
$ p5 k4 |- u- H6 _    jz      SoftICE_detected
0 e4 r+ _6 w3 N% c2 m2 P" p, l5 j
2 y3 ?, R% U) j" I6 d6 Bint41handler2 PROC
, W+ h( Z! \3 D1 M    iret
% U6 @8 I/ T. Yint41handler2 ENDP) l3 d& A" _) G
4 k+ b( b" E, |  Y0 Y- _
3 h2 H% `4 D9 S9 a/ [
_________________________________________________________________________
; q7 j9 v# z9 k# K8 L  q
8 N5 i2 e0 l- c& H6 y6 G5 ^7 ?6 {+ k
Method 06. _5 u8 Z) W/ n
=========
% H/ b0 C" K" U8 J3 j+ V" o1 O5 e" V' E- a' _

2 d* q" w* }" ^' U1 ]2nd method similar to the preceding one but more difficult to detect:
) L+ Y0 w3 o9 F5 }: M
* r1 B3 {1 p  E- D% J
0 \' j4 \3 e5 R: E) dint41handler PROC' D+ e) U4 F; F9 S1 [& _
    mov     cl,al
5 M' m8 K. g$ {3 R* B3 H; F; Z    iret
& s. A" p4 _. O1 ?% }int41handler ENDP. X" G+ q0 u9 l

% l$ G8 `2 E( ?. Z, o9 [" K+ P0 K/ n, v# M! h2 ^
    xor     ax,ax
& C2 t5 B! [6 q    mov     es,ax
$ b  H9 A2 V7 C2 z0 ^, Z3 `( {  b/ N    mov     bx, cs7 `. Z" R% L5 \4 Q
    lea     dx, int41handler
! B3 `& f/ f3 Z0 k! w    xchg    dx, es:[41h*4]
2 j) J& F7 ~! l" u    xchg    bx, es:[41h*4+2]
) m. o5 v# ^1 m; [1 s% ?    in      al, 40h6 ~7 T0 @/ G( u9 M9 Y
    xor     cx,cx
" I( k$ ~4 \/ E. ~. U    int     41h) d7 d5 |: i0 B6 y
    xchg    dx, es:[41h*4]& O7 r6 i/ j( Q# f$ Z5 R
    xchg    bx, es:[41h*4+2]
2 m2 Y9 T/ s+ f* [$ R) m    cmp     cl,al" X1 J1 A9 y: q$ Z2 z
    jnz     SoftICE_detected& \- c& G9 r3 p
. R8 x: x) i' t# e' d; a
_________________________________________________________________________. u0 \# Q2 [( G6 T( T

! S9 ]& J" G( l4 f1 }/ n8 QMethod 071 U0 {9 H- _, t5 _2 Y7 W
=========
3 i7 C, \0 `4 V. D. y' P4 L8 m4 K$ f2 X" e
Method of detection of the WinICE handler in the int68h (V86)
- K! m/ w6 w  R" c. \8 \( e& H0 I. }" b/ ?+ M- S: M
    mov     ah,43h" _& U/ v' A: R0 H% @
    int     68h
! R9 Z2 O; _( ^" J5 F    cmp     ax,0F386h) V7 Z0 i6 n+ }1 ]
    jz      SoftICE_Detected
9 b7 `/ W7 U/ _" R: p- N6 r. v& l2 G) h) Y7 N
4 U( f: `6 G! O5 h% J9 w
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit. |7 t1 V. l$ V- }) H2 S1 E
   app like this:
$ D8 y* l+ J1 ^6 J& R# Y2 Z/ @# r! n# @9 ~' O" U5 Z' g
   BPX exec_int if ax==68
+ a) c3 e& L0 j$ V1 S! H   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 q. n. O  \: m0 J0 _6 h   located at [ebp+48h] for 32Bit apps)
6 i! l0 n5 U0 p2 A  F( H9 c__________________________________________________________________________
% b; O0 [9 Z, Q. N! Y2 L  a6 Y, N

" z/ K/ M" K( q0 G* a/ FMethod 08
1 n3 M2 @4 T6 x. H- N=========
% x) A# f) s( r9 \
( u8 g4 ]5 [- R/ s; c: G: jIt is not a method of detection of SoftICE but a possibility to crash the. z9 l0 }" J: @0 o7 J9 y2 |6 F7 x
system by intercepting int 01h and int 03h and redirecting them to another& ]% e8 P2 g/ K9 C. I
routine.
! b  ~- f# m% A: L. w; G9 mIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
0 ?$ ]* |3 N9 u' e) gto the new routine to execute (hangs computer...)
' F) U& l2 H0 c6 e2 M+ T5 G) X" J, x
    mov     ah, 25h
. V& t  u( d! ^0 {& f    mov     al, Int_Number (01h or 03h)
3 g( O5 \) e/ f    mov     dx, offset New_Int_Routine, R9 L- o8 l2 S; b% |0 |9 G0 t
    int     21h5 f9 L& Z+ D( o* b1 d/ ?

- G+ o& G3 |' Y, y__________________________________________________________________________2 h/ e& e4 o1 i8 d+ u
- g8 b: Q- t9 M' K& i
Method 09  I1 y( n6 _) \
=========% {# x5 ^3 G  N. J
) {7 ^, v. m9 T
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only# \; Y; D. o9 I0 A/ n! L
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 M& j% T' {$ ^( i. b  XThe Get_DDB service is used to determine whether or not a VxD is installed
/ s3 Z9 X5 {5 e9 rfor the specified device and returns a Device Description Block (in ecx) for
7 F# u8 M, Y; t+ R; {+ wthat device if it is installed.3 ?, X# R  H1 ]/ s! m

1 n! ~. R. J  S' l   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
. h* K# N2 w, Z8 x   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% }, o/ M0 S# Z
   VMMCall Get_DDB9 c5 @" `: P( {" h
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed6 _  o4 Q/ K! _8 @2 W7 S( O3 N
0 ~* c" M6 f& Z7 X
Note as well that you can easily detect this method with SoftICE:
7 [) X6 e+ t1 i9 q+ E, _   bpx Get_DDB if ax==0202 || ax==7a5fh
4 [9 V  `/ S) i% ~9 h' S" f. Q6 j7 \/ ^9 N
__________________________________________________________________________
% y% c) c3 _+ S4 n( e( C0 u# ~* x- N4 i
Method 10
+ F% y0 S+ i' b( ?=========/ R7 s  _1 \1 X

: e" q$ {) ~" c3 |$ j: S& B- D=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% z# k3 a# P4 p1 M6 B4 g
  SoftICE while the option is enable!!
* p% P4 e: c; ]% Z8 Y' ~" ], |3 G2 p5 e5 B
This trick is very efficient:
6 z/ z) u6 c1 _. {0 }* a( Lby checking the Debug Registers, you can detect if SoftICE is loaded
1 I* w4 ]1 b( t3 O(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 p0 o/ t. N8 s) D
there are some memory breakpoints set (dr0 to dr3) simply by reading their4 O7 e$ ?0 m/ b! s, n3 C
value (in ring0 only). Values can be manipulated and or changed as well
$ [1 Q' x, g2 @(clearing BPMs for instance)& @, v5 _/ d8 g# I2 r. ?; C& X! k

  g3 }, C6 E0 s; ~1 C__________________________________________________________________________
. F9 j. j# d7 Y& o" d4 ~2 w+ f. @1 T: F" W/ Y+ D
Method 11
7 ?2 o( ^- W/ F/ t, k=========
+ r. g8 t. \0 M4 t1 ]- N; k  S+ g2 {" C& l1 t; Z; B0 }. U( G
This method is most known as 'MeltICE' because it has been freely distributed
$ m- t: l* K4 \4 E# @; vvia www.winfiles.com. However it was first used by NuMega people to allow
$ T7 z' y" q5 \Symbol Loader to check if SoftICE was active or not (the code is located8 n; r$ u4 ?4 Z
inside nmtrans.dll).$ z' Z1 o( b4 T, Z/ r  v9 h) `
- n( i  G- W* l
The way it works is very simple:; S  A: I" P9 L6 @
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 Y/ Z1 g' k& E2 j. R% E; \
WinNT) with the CreateFileA API.0 V* ?  e4 t: I( V
, `0 r6 H# ]" c
Here is a sample (checking for 'SICE'):/ B- A+ Q5 j6 `/ y( i) y% d$ y: b

/ G; o( C* ~) X) _: GBOOL IsSoftIce95Loaded()$ F% z+ Z! M9 s9 {3 P
{
$ M. v2 M3 I) L2 j" W   HANDLE hFile;  
6 f8 ^6 u9 ]# r+ s+ k7 E3 C% [   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 ]) B: N- T6 G
                      FILE_SHARE_READ | FILE_SHARE_WRITE,2 V! g2 L0 v* ?$ W! {( {: W; t7 k
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# u3 L4 U. P; }0 \" w. T
   if( hFile != INVALID_HANDLE_VALUE )9 Q, @  J3 h6 _
   {( z' P5 {2 W% N/ E8 `3 x7 A. Q' t
      CloseHandle(hFile);& D3 X% u) ]  o1 b, i- P8 _
      return TRUE;
9 f5 i3 }; l# l) W0 u3 }8 U! @$ y   }  O, ^. _/ b* m+ ^( ]6 J2 }+ |2 v7 n
   return FALSE;
* q$ ^$ g0 g  [+ g}6 o1 c5 k! x# A7 ]& S4 ]

% i1 b. O& F  o5 OAlthough this trick calls the CreateFileA function, don't even expect to be; M. O5 E3 v; \" F
able to intercept it by installing a IFS hook: it will not work, no way!0 X6 h+ t: `# P1 F6 l' V5 M' {$ @
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 ^. ^- I) H0 V2 ?+ k# U
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( F- r2 [% ?( V  Xand then browse the DDB list until it find the VxD and its DDB_Control_Proc  o+ G; V' }( N* u6 a
field.
, e7 y' s& W9 Z7 c/ x' `In fact, its purpose is not to load/unload VxDs but only to send a 0 a/ j# R: B# s7 c9 K  p
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" d: V6 o7 k# h- j! ^
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
! I* y7 w" w; v1 L# a8 {. Y3 qto load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 K. e7 p5 P8 a# ~! Q! VIf the VxD is loaded, it will always clear eax and the Carry flag to allow7 \1 }* Q; F. A% H: F/ R# v
its handle to be opened and then, will be detected.+ M4 A4 [8 X' z- N
You can check that simply by hooking Winice.exe control proc entry point
! {1 e* k# u! w! P' jwhile running MeltICE.
" h1 g; ]. H% [3 M: n* I& V' k, W, n* d+ b# f) }+ e

9 Q. z+ w/ q4 N+ u  00401067:  push      00402025    ; \\.\SICE
  I3 f  f+ d1 U) t2 T: c: F! b. a  0040106C:  call      CreateFileA
! ]8 {9 u" T) Q& T9 O) s  00401071:  cmp       eax,-0011 N; X9 k- u7 _( c7 a  s+ S
  00401074:  je        00401091+ Y+ |/ e8 a" E9 M+ U5 m% O' Q; t( I
1 P8 W' m; E$ M5 c( Z9 h+ u

/ _$ y: N* f0 p& QThere could be hundreds of BPX you could use to detect this trick.
6 v  [/ M2 r8 m+ }0 l; B6 \-The most classical one is:1 [. E* }( q5 x# E
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
2 G* ]9 I, u# k    *(esp-&gt;4+4)=='NTIC'
" m( r& K1 A$ w' Q4 V' |" |# Q0 h  J+ t/ n8 r' U: S) f- I
-The most exotic ones (could be very slooooow :-(
+ S9 A# T$ K4 n* W4 S0 ^   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 p$ X+ W/ g* q) m' u9 b     ;will break 3 times :-(
6 L( I3 r6 e) N. M) X- g9 W/ n" q# |3 p
-or (a bit) faster:
# T% s/ O2 R- r' _  \   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')+ o- b7 e- w- n. k4 G- |4 ^! w

/ K9 v8 ^9 e) c# k$ l3 r   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( K0 r, \7 C! h0 e3 g( Z  F; Q8 D
     ;will break 3 times :-(
6 d: C2 E9 N  L% F
# }0 ?! ^. d5 U  }1 @5 B-Much faster:
% p* w0 Z: A  j, j; }   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'; A' D: z# F/ s9 @' @, \
' s8 e9 g) o+ i/ b5 q: d9 x
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen2 f" K+ d, L% X
function to do the same job:
' a% T3 t6 O$ R' Z  d, b" n- W/ I* g6 @2 p
   push    00                        ; OF_READ) i( \6 n# z# M- [( ^
   mov     eax,[00656634]            ; '\\.\SICE',0( j4 S* i) H  A- L! O" k
   push    eax
3 P( _: a* N/ X8 C/ u   call    KERNEL32!_lopen2 O5 l* ]6 Y1 Z- R
   inc     eax% E6 k( ?: u9 b, f+ z/ Y' \( _( z
   jnz     00650589                  ; detected: Z1 c3 V; K0 ?3 U: j5 |8 y4 e" X
   push    00                        ; OF_READ3 k7 D" E3 O2 V/ C1 R2 X! k+ w
   mov     eax,[00656638]            ; '\\.\SICE'
3 B0 u. U4 |, P9 N   push    eax
; W2 Q( @$ m% @. G% Y   call    KERNEL32!_lopen; J+ U+ o$ B! F/ G
   inc     eax
% |; M! h$ a* v1 f   jz      006505ae                  ; not detected7 U: [4 {( c4 t( t# B4 P6 b
, ]/ k  ]* m$ d: ?- L
6 B* j7 K( f- g3 h
__________________________________________________________________________
6 N# Q1 w7 v, o
  h. V2 [. l4 O% @8 L  {  @Method 12. S2 ~6 ^* l5 Z6 W% y; ^4 \5 K
=========, }2 f$ d8 T2 P0 j0 }9 E" w
$ x5 L7 ]9 j6 J0 {& m6 ^
This trick is similar to int41h/4fh Debugger installation check (code 05
9 k, E/ \/ s) L& ?&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; Z2 P* u5 b$ ^) @) was it uses the VxDCall backdoor. This detection was found in Bleem Demo.
* f' |" ~5 x! T' h3 t7 }% H1 J6 m# `$ r# R
   push  0000004fh         ; function 4fh
6 i0 B( b* E+ k$ d) E& {/ M5 W   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 m4 x# W2 @, _5 F( Y7 p4 v: ^! h& S                           ; low word specifies which service7 o9 l2 [2 i: ?9 [7 Q; l/ P6 U- u- b
                             (VWIN32_Int41Dispatch)1 l: p% r/ _* e' A# C
   call  Kernel32!ORD_001  ; VxdCall
: I+ ~: S, \0 X   cmp   ax, 0f386h        ; magic number returned by system debuggers% U+ g2 q, _' r1 A, G/ o
   jz    SoftICE_detected5 M2 m$ N& p% ?. e2 l' F8 e: ?
. i; |" b, h' K2 \9 s8 R7 t0 s0 z
Here again, several ways to detect it:5 Y. |( T! Z% Z  y. J- _9 _$ Y- I# A) k

% G, C2 ]" H$ t! z8 C3 f3 f    BPINT 41 if ax==4f$ e  [9 i0 V2 j$ h/ E

, Z  ?0 o6 F6 K# M2 t* P& ?9 S8 w    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 K: d( a$ [" [# w" z2 t( l4 r! w7 r
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ q3 N2 Q& p1 {/ Z! S  o+ U5 K

# Z( V* P6 I& O5 E+ X* t    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 ^) w9 ^) a' j9 G+ K! j
' P9 W, q; {6 C% a; S2 o
__________________________________________________________________________
& Q9 Q1 n* @( r5 B+ P. l
  e9 j2 w( s* yMethod 13. W6 b1 f. e8 L
=========% L) i3 d: i1 c) A: i3 @; a
* R& h& e( b9 n. K- e8 |
Not a real method of detection, but a good way to know if SoftICE is
1 r  Y4 w: y( c, ?2 w/ tinstalled on a computer and to locate its installation directory.
4 I( K- R" U2 P  S! N( o# ?It is used by few softs which access the following registry keys (usually #2) :0 K* s+ `8 x# k
6 y3 r9 G2 d) r5 h2 t* M
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 S3 G3 W& X; X4 f$ K
\Uninstall\SoftICE
2 q% D5 P) y5 F-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
' @4 k5 o& O$ B" F1 u-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' q% Q( y2 h# V$ n3 \
\App Paths\Loader32.Exe
0 r1 v. x$ y5 ]% Y8 |+ k3 p
% L3 w# n6 o+ ]# i3 Q; L
# F3 n4 `6 w+ S8 vNote that some nasty apps could then erase all files from SoftICE directory) g) E* h* S! t$ V
(I faced that once :-(
3 N9 v5 i+ U6 X  r* j7 E0 Q4 A/ p
8 t4 [) P, r+ x+ G& ]  NUseful breakpoint to detect it:$ S/ ~4 f8 Y, V2 f4 J/ e8 E0 Y( U( K

6 W, U4 R, B3 B, U: H     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* V+ N, j, \# e. K  ]+ Q5 D3 b

! k" o# S7 i; \6 _, v__________________________________________________________________________
$ s7 N( y8 O- c- ~) d" a1 K# R, ^
8 K7 D! J* n  M" ?  ^/ F. t! g- x6 x+ ^& e5 w
Method 14
1 F4 `# i! L4 L1 ^=========( r& h4 o5 L  |: o

1 J3 D7 o$ ?6 @4 o( ]A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 K- N# V  C# R" O) v% r3 B
is to determines whether a debugger is running on your system (ring0 only).
5 }* c9 J& ?' S& {$ X& u0 ?
0 {. u. p3 U. Z1 V& i   VMMCall Test_Debug_Installed
5 v. a" _1 H% Z, ^4 G   je      not_installed( ]1 j  E& P! n1 P
7 J. T# o* o  S: t( s; l1 `
This service just checks a flag./ p0 i" z: q5 J. `
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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