About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' X' B2 b# d+ f; b
<TBODY>! I! @" P( F  H& h# v) b
<TR>& o9 w- p8 R. q; o! [: T  W
<TD><PRE>Method 01 0 n* s/ r5 }, \0 [
=========5 o* q, E+ z% p/ O; p
1 a+ }! x( n) d$ ^5 s/ e3 W
This method of detection of SoftICE (as well as the following one) is
' K: c' Z: a' ?$ @- @- j) eused by the majority of packers/encryptors found on Internet.
. ]6 T" {$ x' W! [% Y3 v$ [* {It seeks the signature of BoundsChecker in SoftICE
/ d8 M# P, @+ a0 f  \$ N( }8 }) `$ |+ _6 U
    mov     ebp, 04243484Bh        ; 'BCHK'
7 M4 u8 m8 i3 e; h    mov     ax, 04h/ g0 Q: G! x& `$ }
    int     3       ' [  w1 T; |+ J
    cmp     al,4# B! H' T8 Q2 V
    jnz     SoftICE_Detected
4 B/ c. m+ z7 Y3 _
4 [$ u+ J% C% h( n' n+ m___________________________________________________________________________
$ w! {( W% h4 I  ^
( n2 j: I+ c( q. d  o% M5 M# |# PMethod 029 j& C$ V- t  q  ^2 l3 S) l% B
=========
  Q( _- l6 Z2 x2 T! j- ^" d; {9 ^. [5 Q$ e( X+ a, \( f
Still a method very much used (perhaps the most frequent one).  It is used( M; W: y, Y6 i) c6 m
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,. o$ o% c1 y. s' D, i. L* |+ W& A8 u
or execute SoftICE commands...
# ]6 \1 Q) M: R% a' LIt is also used to crash SoftICE and to force it to execute any commands
/ b+ g2 e+ k5 D3 x# I: B(HBOOT...) :-((  % e4 ~, w. t; k

* V& p' W+ H! X% wHere is a quick description:
) Q$ b% E/ O, u$ w! v-AX = 0910h   (Display string in SIce windows)) E2 x: K+ h  W- W; v
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 ~5 |! d9 p( r; ~# S2 D' B, f* ^! C
-AX = 0912h   (Get breakpoint infos)( n- U- |- k& c% a/ C/ L
-AX = 0913h   (Set Sice breakpoints)3 v- R) a" X! @2 l4 K
-AX = 0914h   (Remove SIce breakoints)- V2 w; A8 n4 p+ W/ |, i

7 O- R" g" O- s* HEach time you'll meet this trick, you'll see:  ^8 D4 ^3 \5 d) Y6 A& L/ `
-SI = 4647h& b, r- |1 \: w0 v3 {! c: O
-DI = 4A4Dh
$ E, }( w3 R* N8 L( j$ |/ ?Which are the 'magic values' used by SoftIce.
1 \7 }' a/ h) }For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ T$ P  F& v# V  g4 i. X, p2 T, f5 S! r
Here is one example from the file "Haspinst.exe" which is the dongle HASP
1 |) K7 H* B: I8 v9 k+ q6 p! o8 v" W- bEnvelope utility use to protect DOS applications:
% X% @) l. z) d; Q5 h
6 r5 k, W6 n  T- W" o1 p; P8 H! o6 o6 ~) F
4C19:0095   MOV    AX,0911  ; execute command.- @' S6 D  Q" g8 y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# _1 @* s  H$ ?. z- I1 ^$ U
4C19:009A   MOV    SI,4647  ; 1st magic value.6 z2 |# ^" n; b2 _& i2 R7 o
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& j' v1 K  w) y4 K4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) j8 m2 @( Y, A- x0 J9 q- n
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ {' l+ |; Z: l
4C19:00A4   INC    CX& L  V8 `7 v9 v3 k$ c" S2 L7 Z
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% J" B) `( u9 s( t9 v4 L4 L
4C19:00A8   JB     0095     ; 6 different commands.
1 {) z- _9 k! o* |9 u6 y8 ^4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 v+ V" ~, q& y/ G" [5 n8 q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
0 M/ k0 u- P7 ]- k; P4 s
5 o# I1 z! l+ u/ B& G% U  b5 C4 c% ?The program will execute 6 different SIce commands located at ds:dx, which/ }# V/ k: \9 U- k: j. B
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. `& l- I  a9 \4 q$ B: ]! K! T$ n2 N
/ ~4 s7 M- r; q
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.7 f, w& R+ X! u& i' Y+ w
___________________________________________________________________________
5 t, v; E) o4 B$ S  Y& B+ ~. c% w& x
/ }( X/ l+ m& C& K6 K  c0 q  T
Method 03
' m3 n7 m- E- E$ B- H5 {* c1 c=========, }# y, E2 Y/ k  d; B
9 \6 Q4 P, g7 R4 m0 Q
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 s9 f# }& u& ^" u: C(API Get entry point)  y! ?+ I% z' q1 v
        
. n5 T% y5 t" y$ L5 K1 v
% F/ A# _: _2 ~: Q  z1 T# a# t6 w    xor     di,di2 H- s4 I% r* o8 M, ^% H4 u
    mov     es,di: R& o. B8 g5 P. A
    mov     ax, 1684h      
2 [8 S! N" x( m( m    mov     bx, 0202h       ; VxD ID of winice' Q- ]' A% w: f' K. i
    int     2Fh
6 A8 P' v2 [! Y! {    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! \1 S! W5 R/ R" r    add     ax, di3 t- g5 j! I' c+ M2 s0 Y
    test    ax,ax! \, H. _% V3 ~9 j1 P
    jnz     SoftICE_Detected& ?/ U, z6 C/ ?5 M' a
/ ^5 z0 i( r7 [* l- \
___________________________________________________________________________
" i0 W& D, p) }6 x  n0 }
2 ]$ }$ B0 Q' GMethod 046 g' I3 J& n- B
=========
3 [- X  t# ^# s+ }7 |5 D3 B# \. ]# w: l
Method identical to the preceding one except that it seeks the ID of SoftICE3 T% q/ f6 V$ Y0 j6 n
GFX VxD.
& K9 X: {% T$ W$ v6 F/ x
; I% i% `, y. D& z5 R1 Y    xor     di,di* Q0 Y$ ?+ R2 v% Z5 b7 S  e
    mov     es,di/ A3 Q0 J7 F  P% u
    mov     ax, 1684h      
* r" U9 `3 P  b3 v3 `- G6 }    mov     bx, 7a5Fh       ; VxD ID of SIWVID
& p% c- ?% E+ \& G9 V    int     2fh
5 U" m1 w; k* g& T5 Z" [) v    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 v- R7 p( S" U/ e
    add     ax, di
7 d1 e: S9 j0 x0 N$ Y    test    ax,ax( ]3 X, t7 l. v
    jnz     SoftICE_Detected( R4 u% X2 T8 Y1 q

! W! v  y+ ~. e0 I" E__________________________________________________________________________
/ i: D. h& F" l- a( L& }" g2 @- A1 V5 b, C% ^9 g2 W1 L
0 B+ i4 [7 b# B! c! X, |
Method 05
* j% d5 g1 p- b. ?1 u, l& p=========" J7 e( I& I# j8 r* F; N
8 F+ F, J2 ~+ m  B  n/ X
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- i( Q8 Y  {% t" I% F9 I4 h) `debugger. It calls the int 41h, function 4Fh.
  G9 u% _0 _- A% c3 M2 zThere are several alternatives.  , {% a1 ~. s- u8 M) e

/ `1 b: _; p/ D1 {The following one is the simplest:
% p( g* r; r" n/ S2 K0 ^# E  I; `! f2 P
    mov     ax,4fh
$ w/ D  b8 `- [: k  N; d  J3 T9 ]    int     41h
7 Q7 y. Q$ D0 A    cmp     ax, 0F3864 C5 h& l' w) L% ~1 g6 W5 X
    jz      SoftICE_detected6 y- o( ?' k' N( h/ @

7 A' a5 O) @( W. l6 x6 |, \; f1 x
Next method as well as the following one are 2 examples from Stone's
. v7 P: \! n" K"stn-wid.zip" (www.cracking.net):7 F7 k( y, X" z7 f

4 h! r" C1 |8 ]9 m    mov     bx, cs
) h3 p0 x2 m' f, k; w    lea     dx, int41handler25 Q/ B* N" }+ z2 L1 D
    xchg    dx, es:[41h*4]: S& G1 q! h- _/ r0 v2 {  e
    xchg    bx, es:[41h*4+2]" X" g! S& ~* j: @  T
    mov     ax,4fh
. ?4 V1 H+ W: a; T, T: v6 E    int     41h
' x# T9 n4 R& {' m- ~    xchg    dx, es:[41h*4]! z, g- ^/ y9 n% P$ T
    xchg    bx, es:[41h*4+2]& A2 m. p" \$ I& V7 _
    cmp     ax, 0f386h; [) r# J, n5 w4 Z7 B1 I
    jz      SoftICE_detected
+ B  f1 L: K, J0 w# `, [7 [  D
% D/ ~$ d; w" U; g7 D3 [' ~int41handler2 PROC
: w3 I# Y: C/ ]( {, @9 r( _    iret% \, L5 o4 S( j5 F  C0 F- {
int41handler2 ENDP' d) n+ z: z' |- F: p
" a' S2 f" |0 `0 X" F; L
3 s+ `, Y$ F8 ]. X7 Z; Q' L
_________________________________________________________________________! g- F3 ]) K$ W# U' P  L
2 b6 m4 ^  j5 S4 t; ?$ a
+ ^$ _, C, d- ?( n$ x
Method 06
! D! d" R5 N9 b& l$ T: |=========4 T: X' m9 m. I& |- [

% u7 ?' i9 u* q
7 @/ L8 C6 S: n" i2nd method similar to the preceding one but more difficult to detect:
3 m1 v9 y7 y: ~+ `. S. i* }' ?* _. ~2 ~9 F& e' k+ Q
$ ?$ m8 g% t/ e# j; I
int41handler PROC
% a4 ~) a. P3 o( t" M" e    mov     cl,al6 M" C& D: ?% H' X
    iret
' D' H) f( U  ~' W* v# ^int41handler ENDP
0 g$ _/ L/ v8 C5 b/ C% v* ^
7 h1 ]2 Z( S- T* C
- Y! I- B8 @# \9 ]    xor     ax,ax
( X; \. d6 F) h9 C: J    mov     es,ax; T5 ]; {, W, p2 K" O, u# c
    mov     bx, cs0 @6 y( h4 B' p( X* K' p
    lea     dx, int41handler
) K5 A# h, t& w$ Z* v4 D5 i    xchg    dx, es:[41h*4]
4 [$ p1 `& O$ b0 E" J) z    xchg    bx, es:[41h*4+2], L* T5 F1 w& l' f  g
    in      al, 40h
+ R- \0 W8 A* ^& t9 t# t$ _    xor     cx,cx1 T2 S7 m% O9 L' e+ q
    int     41h4 B9 |2 ]0 G/ m7 o: e. c' y+ q- G
    xchg    dx, es:[41h*4]2 u- \* H) H: c: a8 x
    xchg    bx, es:[41h*4+2]
) O% E5 \8 U4 Y    cmp     cl,al2 ~$ n" g$ L2 E  J. e- ^
    jnz     SoftICE_detected
1 B+ G7 e3 l: n) t, i) y. ]
, y9 a$ Q6 x4 [8 z5 I" v_________________________________________________________________________
) N* F: x2 D3 G! \1 i) L# _; B2 ?  u- A- U
Method 07, u, |- g0 \7 D" f) x( x( w
=========
5 X4 o: A5 I9 A/ J* A" i0 U4 ]2 ~8 M' t, U6 a/ y' ~# }
Method of detection of the WinICE handler in the int68h (V86)
+ M0 L9 a2 ?0 P! X( O1 X$ U6 p) j' J& {& w  w% S; M5 s  D
    mov     ah,43h
1 k4 s7 b' D: k7 z0 P; Q# K    int     68h
% _6 D9 F4 W7 m! x( r    cmp     ax,0F386h
5 ]) U% h# \. r$ s5 B    jz      SoftICE_Detected) Q2 s: z8 B/ t. D
; k' z/ ?9 h$ w7 F
* H* r% E4 c3 T9 \
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit! ~- X& Y4 t/ \0 D" T7 Y# L
   app like this:, @; J$ r9 q7 c5 O4 n4 [( e3 _  C

  Z. N5 Z* @/ j; X% x   BPX exec_int if ax==68
- z/ h6 ~7 i: h, b   (function called is located at byte ptr [ebp+1Dh] and client eip is
  h7 Z& V0 M$ i1 t   located at [ebp+48h] for 32Bit apps)
, K& u; Q$ P+ j__________________________________________________________________________) c3 N  k4 @1 D9 @* y8 Q
5 u" Z( S9 J* [* P& X
' z" D8 O1 J* e* P2 l
Method 08& o; j; \  T7 V, l
=========8 [% e" C) I9 Y6 K+ @# @' }8 u
1 N7 S' [* v+ \, \% e' ^9 E* L8 A
It is not a method of detection of SoftICE but a possibility to crash the# v, Z: t8 V' }5 l* i" ]( t
system by intercepting int 01h and int 03h and redirecting them to another4 q% \$ x3 a; V$ l9 v
routine.
" F' s3 [: b/ o, C2 kIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points! [' z* r5 D, j2 H' @9 A
to the new routine to execute (hangs computer...)1 b( @1 M9 d, |, W9 L
. R- U" W4 p! Y0 ?# G( u
    mov     ah, 25h" A) K0 d+ S7 |( v  R
    mov     al, Int_Number (01h or 03h)
7 o, m. ^" L& y. X7 m; V    mov     dx, offset New_Int_Routine# I6 S* r' |7 g! s! ^% ^' C! B8 P
    int     21h# t# F; |6 v' |* a8 M* Y
5 z7 X$ Z1 N" [7 `' B1 u4 z
__________________________________________________________________________8 U8 ~9 g" B; ~) G% V

! b4 k6 \& E$ z; Y4 b0 gMethod 092 I# U) {" [4 \
=========
4 f/ R0 `/ @0 y( n9 ^# g& m+ N. y9 U+ y) M# r4 q
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! N6 D" L5 w3 _  s- \. i* kperformed in ring0 (VxD or a ring3 app using the VxdCall).8 @( M* L9 [" S. s* j8 R" @
The Get_DDB service is used to determine whether or not a VxD is installed/ P- E8 j$ X/ V% W/ D
for the specified device and returns a Device Description Block (in ecx) for
0 e, h0 |# |$ Z! b0 R! pthat device if it is installed.' j1 A: R- a# u) @( ~9 n9 `. v4 p

7 y( P' i- D8 j3 O! L& p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 T3 J6 u% ]) E3 C  D
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)! g3 V+ b8 F/ ~' U
   VMMCall Get_DDB
) u5 l( Z" F$ t6 q' ?  {0 k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ q3 Q7 ^1 x1 y3 h6 U7 r8 X2 s* k+ o7 ~& I/ ?4 S& V3 [" Q" m
Note as well that you can easily detect this method with SoftICE:8 C6 H: x& L- U8 M& y0 E
   bpx Get_DDB if ax==0202 || ax==7a5fh
, ^9 r' b! m/ v
+ ?6 A6 S0 n. @' [( F" j__________________________________________________________________________
, l; w" q+ n5 O) @1 |% c  t1 O) a  z% G, U' T- ~3 x5 v
Method 106 \- w: N& x9 W/ G' @/ J  Q
=========0 t" D* T/ q( U7 @
2 }% n2 T% Q. G2 I1 t
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ g# d# \5 G0 I# t0 E, w
  SoftICE while the option is enable!!
( q2 C) Y- N+ H- Q: G& p+ h3 u
- N7 Y& [) a: c/ u/ \6 WThis trick is very efficient:- X/ o, r: z0 r
by checking the Debug Registers, you can detect if SoftICE is loaded( Y3 d7 s- ]# D! r3 w5 k
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
4 @( ~( `; o6 T# Z2 |there are some memory breakpoints set (dr0 to dr3) simply by reading their$ X+ Z  e: W) `# L' O. f3 L# l0 u
value (in ring0 only). Values can be manipulated and or changed as well! P4 S/ S' p. j3 a0 d
(clearing BPMs for instance)
6 W7 r8 ?: I, r+ R' K& i) y
) p' y0 z7 Q! \# U8 _; ___________________________________________________________________________0 W6 }! \% H, V- ~. s8 p
5 q% z! j/ L/ I
Method 11: f( f% `/ y1 Y, n; i0 Q, K
=========2 t& Z0 h6 T5 ]
0 ~! u$ b- b+ @4 F- x: b" G0 [: k% u
This method is most known as 'MeltICE' because it has been freely distributed
$ _0 Y' o6 U, N1 Evia www.winfiles.com. However it was first used by NuMega people to allow/ |9 Y0 ~6 M+ Y
Symbol Loader to check if SoftICE was active or not (the code is located% X: ?- B- ?: e3 s
inside nmtrans.dll).
& T' u( h- ~- k! d2 ]4 L; \4 p0 g) q/ A+ i6 a# @& e' P
The way it works is very simple:
/ E- s3 I+ _6 f& s/ aIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& s$ p+ S4 O) g: \# NWinNT) with the CreateFileA API.
% R, O- S) M% A( x, x
7 J( u( I% K4 dHere is a sample (checking for 'SICE'):. H+ v( ~0 L$ a' [2 _' q+ R1 p4 R

- E, q; ?+ s6 H1 s# D% u6 E& @BOOL IsSoftIce95Loaded()
5 y1 A* g% _- c{
, y) o6 |) l: S# W, K   HANDLE hFile;  1 I6 e. B' O4 n) Z( k  y3 K8 S
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
2 C+ W  `" z; B& V/ {                      FILE_SHARE_READ | FILE_SHARE_WRITE,
: K# k  Y" Q/ k- M, e. v. ^                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 _3 \) |5 R, _* c) z7 ~
   if( hFile != INVALID_HANDLE_VALUE )
+ X/ I9 V( p7 _% p   {
; @! K. }# G. M. C      CloseHandle(hFile);+ E/ G+ k7 m# b0 T" K2 G
      return TRUE;0 T  v0 x( A" k9 h
   }6 J( k" ]% J! S1 w+ X' y7 ^
   return FALSE;2 @) {# k  s! ?2 Y/ I5 i
}( |1 V: b7 q- g4 M# r0 l
6 Y: U, U2 M6 N: @: t1 x6 z3 C
Although this trick calls the CreateFileA function, don't even expect to be
- c) a6 k) H( p) \3 G" gable to intercept it by installing a IFS hook: it will not work, no way!3 B: O1 r1 n# b2 w5 M
In fact, after the call to CreateFileA it will get through VWIN32 0x001F. H# {9 h( F, D3 N4 U; q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 Z4 |& l; `- u5 Y# W, \
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 R% e5 C/ w- R6 Sfield.
  w, |2 [/ ~" U( aIn fact, its purpose is not to load/unload VxDs but only to send a
' b3 [/ _2 T: z' \9 S4 e  b7 ]W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 Z/ R# {# x9 i# e; a
to the VxD Control_Dispatch proc (how the hell a shareware soft could try. G, C5 Q& b- `
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
% B/ _$ Z5 z) p/ FIf the VxD is loaded, it will always clear eax and the Carry flag to allow; i' o- g0 ^9 L* T7 u( D+ m# e6 x
its handle to be opened and then, will be detected.
' e3 H5 k! B( _* P0 M: v" e2 EYou can check that simply by hooking Winice.exe control proc entry point) N1 e  `5 W2 m! w% J! D+ {
while running MeltICE.
( K8 h4 B# p4 }; H  G$ I" n+ _
5 j3 V& H( y; o5 X- K: [- u" R) E3 f4 J( l$ G$ Q! X1 n
  00401067:  push      00402025    ; \\.\SICE! {8 Y) y: s8 Z1 y2 S4 V) \
  0040106C:  call      CreateFileA/ D( T! ?5 N% m9 g& F- G3 D5 |
  00401071:  cmp       eax,-001( g% v9 d5 f8 ^0 Y/ C1 u  O) v9 w
  00401074:  je        00401091
. [3 }+ N1 X" z7 Z2 }
" M6 E# ?8 O0 _* @$ t2 P+ {  a4 c4 _8 ~9 }7 n
There could be hundreds of BPX you could use to detect this trick.
5 ?- V( L! @+ P-The most classical one is:  Z1 q$ k) H$ z/ p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* f: V0 D4 B! J& t. h    *(esp-&gt;4+4)=='NTIC'
6 c: \$ \' i. o, @8 d" e6 ~0 J1 N) B9 W) L% o
-The most exotic ones (could be very slooooow :-(0 J" H' V" T7 W7 q
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
/ }9 l$ H5 N' E0 F2 r, [     ;will break 3 times :-($ m. `  W- M$ ]; b8 W8 A5 }

: ^+ o' i0 `1 x" \' V  V, R/ {-or (a bit) faster:
3 f3 P  W0 M# ], h/ W4 s   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')* `  H5 U  q7 [$ \9 [+ C8 ~) b

6 Q  o% \: f" B1 O$ I& [   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 P# I' [! {7 R
     ;will break 3 times :-(
# D5 Q1 a  R% {8 B" l/ Q- a- G! k1 c/ O3 E- X$ H1 T. M6 V
-Much faster:9 m# M, a) n2 u7 D; C+ ?8 w
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', L0 [6 j1 r1 K7 R% h

$ A4 u7 q. }! Z1 C9 Z0 Q; F' f* RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
. |! d7 n6 C( I" Q1 j5 gfunction to do the same job:
# a- R; y% y0 I3 n: D2 ?' Q, T3 U) A8 [  F6 p
   push    00                        ; OF_READ% k, Y& x' w+ D1 a0 x
   mov     eax,[00656634]            ; '\\.\SICE',0
; ]/ r4 x! l% |# q   push    eax$ L! [: y2 C, {7 f* g$ g* x- c
   call    KERNEL32!_lopen: A1 G* `% [5 T
   inc     eax( _4 [+ {! K0 S
   jnz     00650589                  ; detected$ w$ N5 C: P3 h5 U2 R
   push    00                        ; OF_READ# A  m. i) v/ x; ~) J) N1 z0 b
   mov     eax,[00656638]            ; '\\.\SICE'
5 k! {. Z% D* N$ R0 I% q6 d& E$ k6 z   push    eax4 L/ {) z% E; F$ s5 G2 C$ C
   call    KERNEL32!_lopen! \. L0 p; f1 s9 b
   inc     eax
% P" v0 u1 g. ~$ W' K: k, p   jz      006505ae                  ; not detected
% m: J  u3 e0 C# G" [* N3 Z
" L$ G' M; Z3 G$ f7 z
! U+ h, M& y% z, ^) ]  O& h6 p__________________________________________________________________________8 G' T% i8 ~0 F3 a5 a

  A# x9 N5 S' o# V# i' s0 MMethod 12
1 i6 L5 y: v  {, e3 G2 h=========
! Y5 U3 w4 K* L& A. H- ]
% S+ n" y( B- m4 s  oThis trick is similar to int41h/4fh Debugger installation check (code 05
9 q& q+ H/ t6 U* u; g3 ]( z&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( V# U9 B% D6 _6 m$ b( @8 sas it uses the VxDCall backdoor. This detection was found in Bleem Demo.% K# G, Q( m9 h1 b# Z6 Z
9 e2 g  e7 a! L( \" t6 c  A$ R: t9 [2 n
   push  0000004fh         ; function 4fh
3 [# l- S3 B2 g. t   push  002a002ah         ; high word specifies which VxD (VWIN32)8 r0 j4 M5 P: _" z1 M, J
                           ; low word specifies which service
3 ?/ `, @1 Y- S: u                             (VWIN32_Int41Dispatch)
$ j: ~, z8 F! P6 a$ H1 N( J   call  Kernel32!ORD_001  ; VxdCall
% N) u$ H6 u5 a# k% ^   cmp   ax, 0f386h        ; magic number returned by system debuggers) I" }" T, s$ I1 G+ q' x
   jz    SoftICE_detected
$ b) [5 W3 J4 L  M. C
7 H& M4 z1 Z; R. Y3 ]0 ~* gHere again, several ways to detect it:9 ]4 ]1 f* n! s# E( }
3 s) _2 ^% P9 R9 U& v6 c) [* r
    BPINT 41 if ax==4f
: R, T: {- }* T. ]  j1 ?* M: p/ d$ O" E6 Z0 B# x
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one  ^- ^: J- |# t; k- H9 z

! ^" L: W  n* R% N  g    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A, v  q. O* u+ {8 @1 z
- X0 `/ e; l3 s& O! m
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& w9 G  h, A- v" e  }- @

& ?$ d7 V. d/ r6 l7 C3 b# c__________________________________________________________________________3 G& E. S+ t! c! \( ~5 t

) u* L2 }0 G' @' dMethod 13- K$ X8 g/ \4 J: s# }
=========- \3 l/ o0 ^& I2 M! z

, [: Z8 s. X+ d9 h- wNot a real method of detection, but a good way to know if SoftICE is
: W# f8 V: q3 U9 g. Zinstalled on a computer and to locate its installation directory.9 y  l  v. }( k) e% _0 j& n6 @  T
It is used by few softs which access the following registry keys (usually #2) :
4 ?4 V. T+ M4 T4 S9 }; a* d) h$ Q' L# _1 ]6 @9 D/ m
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 s# ]* |/ H2 k. u  b
\Uninstall\SoftICE
5 w4 A4 ]6 }) B-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 s' m1 d" F, S  r* b/ C
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! ?# f& y! a$ R4 ~& A5 I  H$ P# O
\App Paths\Loader32.Exe
' m( O5 w* w. p/ `- p% Z  g2 s" C! K! D6 A7 S
# W/ `' o  X& c% `* B3 H
Note that some nasty apps could then erase all files from SoftICE directory
! p. L. P! J5 d) A1 A4 _" R: T(I faced that once :-(
4 g( q  S( c2 U" ]% ]: H; p" {1 Z( J- ?% m* v& i$ T
Useful breakpoint to detect it:
7 r$ {& f$ K3 P! m/ a# {, O
# ]' c2 N# A2 C0 f) O* a0 p' T     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE') @# X; c+ m3 g0 _  ^

) G, l; ^/ i/ Q: C9 B, [% W__________________________________________________________________________
/ K; M8 l8 O$ H: k% X. u& g; `$ d7 d; [& x" K
& i* e+ l; W5 _
Method 14
4 I; N' h8 Z6 k) H) V=========( J! w( B( m% s; i

/ o) d1 r. f' o5 i8 c2 x8 |* Z7 KA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! [8 N2 Y/ o: U. his to determines whether a debugger is running on your system (ring0 only).
. y2 D7 g: o+ K) u$ n/ m- U+ c5 J4 C9 K& B
   VMMCall Test_Debug_Installed2 m' d- m8 Y! p% i' G$ k
   je      not_installed
+ d) S4 w1 N* u% J1 V5 x( k# z: z; D
This service just checks a flag.
! p8 v% l/ q  d1 a6 a1 B+ Z</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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