About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>$ {" M- n( i% N4 ~  O7 U
<TBODY>5 I# @# d7 G! g, }& A
<TR>$ {7 G9 Z+ o' ]0 a/ p
<TD><PRE>Method 01 ) h4 K5 S( P7 m: Q
=========; T; C4 O  E& ~* @) G

8 y7 l1 m' m7 J$ i/ O  j: tThis method of detection of SoftICE (as well as the following one) is+ H+ ^7 [; F4 y, @- ^: m
used by the majority of packers/encryptors found on Internet.# r" T; m& }* o
It seeks the signature of BoundsChecker in SoftICE
' @/ L$ c* X2 w! b" \- G2 {
9 c4 F. Y) |' H  _6 ]8 x7 W2 s* ?    mov     ebp, 04243484Bh        ; 'BCHK'
7 \4 g$ I1 V% X0 }    mov     ax, 04h
; O8 F7 _. M7 ~+ g. a* g    int     3      
  }+ A5 J% _( }3 g( ?# `    cmp     al,4
( ~: Q2 B5 ~- D% A. }    jnz     SoftICE_Detected
5 t* _8 U" R. A2 s. ~' a. N9 o+ @. x/ U) m4 Q% u; R( Z0 f
___________________________________________________________________________
7 ?* a- w/ O5 f) |0 r
: a5 P+ V7 Y! J1 m% E$ h+ b7 ~5 yMethod 02
1 n$ e9 e$ J: U; x& P3 d=========: G' F; Q( q, `
+ ^" u2 Q# e- x) f. x
Still a method very much used (perhaps the most frequent one).  It is used
3 j6 c( S6 `  z0 z# m2 Z( jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 N! K/ |% }2 F+ p7 A& kor execute SoftICE commands...
% c: k4 }5 U: g1 s' y$ H+ mIt is also used to crash SoftICE and to force it to execute any commands" \- k: [; S! K9 i, p' L# u. p$ c; N
(HBOOT...) :-((  
% @0 H) M  O8 Q" e' p- {, d8 \0 j
Here is a quick description:
3 U. G+ W& S# S-AX = 0910h   (Display string in SIce windows)
, e" e; G2 w- k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
4 o6 a& M; A' g* _8 B-AX = 0912h   (Get breakpoint infos)2 |4 }9 m7 z+ v" d# N# r
-AX = 0913h   (Set Sice breakpoints)
- h7 @1 v8 ^: ?6 J% ^, H8 n-AX = 0914h   (Remove SIce breakoints)! h+ Q+ |" G+ j& z  k6 [
7 L. \4 }+ _# ]) Z9 F
Each time you'll meet this trick, you'll see:
# L- o6 a  A4 B-SI = 4647h) t5 L. A" v) E' `0 \) \
-DI = 4A4Dh7 z, W8 v0 ^7 I
Which are the 'magic values' used by SoftIce.
  x8 m# q- h; U$ u4 d" J* nFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
8 U1 n! r4 C: T! s% N  B6 G2 e' {  [0 o1 h) r, F8 j
Here is one example from the file "Haspinst.exe" which is the dongle HASP
  r1 \0 e" l8 n- k* x  eEnvelope utility use to protect DOS applications:% n! S; O3 ~+ b9 [8 i

0 u, b. _7 Z$ a: x4 m6 O! e
7 Q# E- }! u: U, S' |4C19:0095   MOV    AX,0911  ; execute command.
8 u; p- r# _, C/ F# d* e& t1 j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
) N2 V% M6 {4 s* o, w- `4C19:009A   MOV    SI,4647  ; 1st magic value.( V% O+ ?+ X, g# G
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ A3 b" G# t- r3 `6 `4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
# \$ Q8 L* R* Y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ F0 U: u/ j5 U! X, [) F
4C19:00A4   INC    CX1 @/ g& K# l1 y! u' _1 A# N- w2 K
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 O: r! _2 M, o9 o: ?! B, `4C19:00A8   JB     0095     ; 6 different commands.
( w9 I; a( \: j4 j' W5 a4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 n+ P, s7 m/ e. t. G1 u5 [
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)2 N! q8 W" W( U- L$ K6 Y

5 |" ~& [1 t% F) R- BThe program will execute 6 different SIce commands located at ds:dx, which
3 t! a$ o; z5 c1 B& i# xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
0 m3 l* R6 N% B4 n9 v, w( S! d" i( i; Q+ g( F
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, b7 g$ q/ v& ]; v3 b4 _2 {___________________________________________________________________________6 @( I$ p4 Q* j0 _

* C2 v+ E/ K! G6 p0 @( p. u( r) z/ u+ m
Method 03* O% n' m8 g9 A, B5 h
=========5 b5 `) H: r) p2 i. z8 U

2 v5 l( e$ k: w. a/ t/ A5 C+ ~Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( f* j" L$ L1 v(API Get entry point). E+ I! O& r3 ]
        
) h6 m$ g. N7 I( R( h) j7 O- z1 K+ k
    xor     di,di1 y+ c* D- W1 W3 e& n
    mov     es,di
* z: V+ `+ t: ~1 H$ ?4 \5 @0 t; U( Z    mov     ax, 1684h       4 z5 q% w' F& I  \9 R# ~+ p  C: m
    mov     bx, 0202h       ; VxD ID of winice; z0 m  H1 A9 f6 g% \1 E
    int     2Fh
  [) \2 e1 m8 ]5 w& M3 U6 D    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% E+ R+ X1 G  a- ]* e: N  f3 r3 |    add     ax, di
6 y! A/ a$ W' c" u    test    ax,ax
* g+ w( ?4 ^& Z+ [( K* G% `    jnz     SoftICE_Detected
# _& j1 P1 e5 C9 {, g4 N; Z: m  C% t! G& N3 C) i  V
___________________________________________________________________________! x$ l; G& C1 c# i5 d2 W

4 }6 h  X( S( b& \1 [7 ZMethod 04
' W2 n0 q2 M' k: o4 i/ u/ B=========
9 l, D6 Z8 w1 r
; a+ R0 j3 c' G4 }- gMethod identical to the preceding one except that it seeks the ID of SoftICE
4 k: P! E/ m0 aGFX VxD.
* f. r" M5 W6 a" q2 n( P6 Y) H
9 ^0 @$ ~" r7 I% @9 R    xor     di,di
+ C/ }) s, u; U0 f# p' h. E    mov     es,di
- r' {# l5 B/ q8 [# _: k7 b    mov     ax, 1684h       $ t) ]/ j1 P6 g" r9 Q. e
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, w' ]  D9 S. t. P$ X, m* k2 S: |    int     2fh
1 a8 ~  J' a# p" }    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( e  m3 c2 Z5 g7 m' q6 L% a. e    add     ax, di
* x! u3 z6 n4 P+ X' W; _    test    ax,ax
* I( y4 C  [5 u/ H* d    jnz     SoftICE_Detected
1 {, G5 X% C7 L; s, t1 m3 H; R2 n1 ~' G( z3 N  v# y7 R
__________________________________________________________________________) m7 P5 y# [. F

( j: k& K9 V  T2 m6 G+ ?$ X4 Q. K2 C! T6 [& t- @
Method 05
) J& P  t; `+ B) o7 z( C+ ?5 D& x6 f=========
" y3 U, K( T2 L$ g% S% F$ ^, G8 a. ^
0 k5 T5 e* e5 d5 {. ^/ u9 dMethod seeking the 'magic number' 0F386h returned (in ax) by all system
/ e6 s8 ~8 @) r+ m9 D( y- s) n5 `debugger. It calls the int 41h, function 4Fh.
7 s# n2 l  X$ I9 ^1 \" uThere are several alternatives.  
) y$ F5 a$ \& k! }% N! U# `6 t9 ~
, B% s% \8 z$ r" i3 [" m9 c8 }The following one is the simplest:% L: V$ z' `: u0 P5 x

9 Y* t6 V2 q  @( H    mov     ax,4fh( A. ^/ X( v' ?* ~8 q
    int     41h
5 G5 q/ i: M* I7 }9 b    cmp     ax, 0F386
/ n* c9 `% s3 z6 Y- J    jz      SoftICE_detected
5 O# j0 o, M& \3 e  [8 U, s8 D. n* Z1 ^

6 c7 I# m# J5 I8 f  Z: o2 GNext method as well as the following one are 2 examples from Stone's
) a$ {4 U# \! l$ ]$ |1 Y& G5 M% `0 g"stn-wid.zip" (www.cracking.net):4 z# W3 u4 z8 s" k" X& ^5 e
  H; N" G* R+ G9 n0 ]
    mov     bx, cs
( Z8 \2 {: Y: T5 G8 R1 v8 ^9 f    lea     dx, int41handler2# E2 f$ d. f, K0 y
    xchg    dx, es:[41h*4]
. |9 s: v+ U8 @8 A0 Z8 t3 T6 E# v    xchg    bx, es:[41h*4+2]
. c% w; o9 o  ?$ T! q$ `: ~2 ^  p    mov     ax,4fh# }- m, p/ s2 n' a
    int     41h6 S6 E' ~% A- ~; Z4 C$ |2 a" s5 M  V
    xchg    dx, es:[41h*4]- N8 g) O. D8 ^$ Q9 }1 d& m
    xchg    bx, es:[41h*4+2]8 p/ o9 c. ~# X
    cmp     ax, 0f386h9 f9 }: a4 E' w. B* z* }
    jz      SoftICE_detected$ P7 w( O% ~1 j/ N0 m, v1 X  s
! ^* r. \- z' ~* h+ k
int41handler2 PROC
2 m; H6 f' H% p; i* B3 \6 P# K. d8 h    iret% |: a+ t! ]; S
int41handler2 ENDP
0 j+ S6 A0 y. a( M, y! ]
2 i7 v/ _& b$ ^9 B1 v% H5 w- i/ G9 i6 x( p; d
_________________________________________________________________________- j# B9 E% H6 M
- N) ^' z* ]. t7 C* N
# c# A( Y. a, n$ D) D$ E# a3 d
Method 06$ H* Q0 S" p8 B& J( Y+ ?
=========
) I( w  C, F0 h, L8 V. H5 `& k
* j. ~2 @5 q- L: g# m! j
) w: r+ j/ V5 `3 d! B" t2nd method similar to the preceding one but more difficult to detect:& F; a! w; `: a6 u, f  r4 R

- A& T, ~5 o& g' N
  K. D0 [, B6 i' O9 Oint41handler PROC7 X- A( s' C  b" B0 H6 L/ k% M! J
    mov     cl,al3 R+ H3 |# k* c( i" V7 r; d
    iret! K% y4 I: }6 @- r8 d
int41handler ENDP- H% X; J3 k# g& z6 f/ F5 Y- U" x
8 c) v; i7 J4 W4 V, m1 I6 J

7 t: k( e1 ^, R$ @/ B3 B- C. v* ?) x    xor     ax,ax
* D$ H- U" O& a    mov     es,ax% n5 B. t/ B; Z+ y1 Y
    mov     bx, cs
. }0 `7 {! w4 b0 X5 M: K2 l1 N    lea     dx, int41handler5 a9 X" }- L# s8 H* _8 I- M' v
    xchg    dx, es:[41h*4]
  a  k) X; Q' d  P" V% [    xchg    bx, es:[41h*4+2]
0 p! b+ o0 |  C6 u2 }+ ?    in      al, 40h
: M9 e: L' R! B  ]: H    xor     cx,cx
, r5 R# g1 y# _% c% T    int     41h
& M- `. V6 t8 k, N; a    xchg    dx, es:[41h*4]# B$ c. u) V7 q1 N; t, a
    xchg    bx, es:[41h*4+2]$ [9 a' N* Q1 J
    cmp     cl,al
& l  X7 _% B7 r* [3 R    jnz     SoftICE_detected
- `$ p7 x6 f( ~" b) d" Z# G: C  R3 F# e( M7 C" H6 ~
_________________________________________________________________________7 s! z+ z  w" G% v: Q" K9 k

# C- G: j" ]! K, y. oMethod 07
5 }5 K5 r. x2 i=========
& S& O- G% U% }5 r6 {! ^2 k. K! o% P9 O9 m/ M. s7 x3 X5 h) R
Method of detection of the WinICE handler in the int68h (V86)
* E. _2 _. S! X7 H1 `4 G
3 ~, X5 L, ?& n3 Q2 x8 d/ q* q  G    mov     ah,43h9 t, a0 Z' D6 J3 ^; F
    int     68h" D# `: ]4 E4 R6 f
    cmp     ax,0F386h
/ W) X5 q* F& r    jz      SoftICE_Detected& r7 j9 A- n$ \1 Q6 C
5 c, O8 x8 G) L) e% ?3 q1 F

7 K$ ]8 o) i7 U6 C  w=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# ~. Y9 K8 v7 g8 ~' C$ Y3 m% q  ?   app like this:4 L: j2 s7 X8 \  }9 j; ^% q. P& v  Q
3 }; h+ O/ n$ Y# h
   BPX exec_int if ax==68
1 x4 L" X1 A5 n6 v' ]" |, Q! V   (function called is located at byte ptr [ebp+1Dh] and client eip is
. d0 w4 O! f' Z6 }( A+ l$ @% b   located at [ebp+48h] for 32Bit apps)
$ h$ ?4 v4 z2 h: ^9 x__________________________________________________________________________
6 l% q- J# M% s, ]; {% o% _3 a$ L$ p+ `7 v7 D  a- q
& U) g" v, ?4 h  F. g! b4 C
Method 08
# m2 A9 Z+ v) {/ S, R0 d8 ]=========/ J$ c3 q% l) U, h7 B. ~

' `& }& ^- \1 Q, \0 D0 f0 SIt is not a method of detection of SoftICE but a possibility to crash the! L: S: S8 k( a6 a" a5 v, w
system by intercepting int 01h and int 03h and redirecting them to another  v$ D: b2 V( l9 h: l) L+ k! _
routine.8 H( k: f" |5 ~. W2 }& J" j
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( S5 X, ~) [7 S# E' \
to the new routine to execute (hangs computer...)
- O* }, C2 y7 E) y
1 F2 t3 @4 b, y3 ]/ b- }    mov     ah, 25h& h% }- `1 l' |0 q
    mov     al, Int_Number (01h or 03h)
) [  d, P  {+ a0 _! F; W8 L  ~    mov     dx, offset New_Int_Routine
) W: [- {5 |1 t7 `9 d. \. ~    int     21h
9 C% B4 s! X) |5 l& k  H8 t! [/ v0 N6 j1 ^5 Q$ v: T* D
__________________________________________________________________________
. F) u3 Z" z# L/ \; n! W. E9 n- }: K& C' j9 u0 c3 @
Method 09
9 l0 Z6 ~2 z$ ^5 u& B# ]( `: h=========8 G0 V2 ?* a% a& `: ]
# {+ E3 k: X& z9 H
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
5 t- X! D5 x9 g' a0 H+ \4 Bperformed in ring0 (VxD or a ring3 app using the VxdCall).* ]" i4 f  i% q7 ]2 ^) D
The Get_DDB service is used to determine whether or not a VxD is installed( {0 W0 f( Z, d7 i9 f! c
for the specified device and returns a Device Description Block (in ecx) for6 S- c( B  _+ `* Z& _2 _# S6 q! n( O
that device if it is installed.! w1 c7 r( e1 N1 R( T* ^

! q9 L9 i5 @3 M) Z8 U# v   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID/ z) @3 g# O5 i5 `
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ O$ l# P* a. [# K' z# ^, _
   VMMCall Get_DDB
. l2 y/ e" _2 T) Z8 }   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 m, }' g9 E! r% M( k

: f* J" |. h$ ?+ g' bNote as well that you can easily detect this method with SoftICE:5 h0 }5 S" J; g% ^
   bpx Get_DDB if ax==0202 || ax==7a5fh
/ L: [) h- @* E$ [! P/ a" u
1 R) c' W, I9 f4 w+ |; l__________________________________________________________________________
0 c' f/ ]) ]1 y  j2 F3 x7 v
( x# S* z, }( k2 n1 r, s; aMethod 10
  W7 @' ]/ ~/ y; I& o6 V=========/ x8 L, A" I% c; l" L: p7 G5 b4 @9 a
/ c4 d1 k" u3 m# F
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with( }- s, N1 g2 P+ m
  SoftICE while the option is enable!!
4 w, o# t, U# _) u$ b
. O3 F6 p  G* n4 [5 FThis trick is very efficient:
  G4 z, X9 ~1 y3 z8 Y5 s! Fby checking the Debug Registers, you can detect if SoftICE is loaded
& u% B: d& r7 ?- d# K(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if" H, p- [- \6 P
there are some memory breakpoints set (dr0 to dr3) simply by reading their+ O4 D+ n) ?1 W3 ?8 L" F/ t
value (in ring0 only). Values can be manipulated and or changed as well
8 l1 U2 j$ `1 ]+ W& }( o6 H5 q(clearing BPMs for instance)/ {4 J0 [. K  \: U

! Y7 Q& _2 h4 u0 ?0 U' I__________________________________________________________________________9 `( T) B, }( q! Y- X* ~
* U; g9 y1 T, o% J) z8 ?0 N
Method 119 @. T3 W6 n4 S5 @8 E. m# N
=========& ]8 C- b. i! b: m' e# ~7 }

/ p& P' Q9 l! ?2 xThis method is most known as 'MeltICE' because it has been freely distributed. V& Q: k% i/ g& D6 w, _& F
via www.winfiles.com. However it was first used by NuMega people to allow* t+ p+ Y4 {2 c3 D" N
Symbol Loader to check if SoftICE was active or not (the code is located/ v" z' E" U  L) u' E6 z
inside nmtrans.dll).* Z5 y" Z) n0 r1 n! B

' V) n- g! k0 s. E# G3 G( ^The way it works is very simple:+ S- c5 Z9 }8 ]: G
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- M/ O& {' R$ m, `( JWinNT) with the CreateFileA API.: R  S% N6 ~. L( L
- O" V! l4 [& \% M5 R6 F; g
Here is a sample (checking for 'SICE'):8 Z# o/ Q- f! t9 x7 y8 ^5 X8 q
$ G/ ~' {- _& c6 S; a* a8 Y, N7 [
BOOL IsSoftIce95Loaded()1 C8 C3 w7 Z0 `4 d* b& I
{+ g" w; j! |$ m& y- n# q  S+ b
   HANDLE hFile;  % [! p3 y% ?; a, h9 B9 ]
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,- o, v+ V2 o1 J: u; |
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. o1 o+ E6 U4 {$ O' \                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- {/ a1 p: |/ B! V" O: ?* ?( ?- N: [   if( hFile != INVALID_HANDLE_VALUE )+ T( v0 m) ]8 W6 Y8 [& ?
   {
6 j, X  m, w7 s" j1 j# i      CloseHandle(hFile);
1 F( q0 J0 ~* B$ s      return TRUE;
3 v& {  r0 f' p/ h1 j! m* Y' e   }
5 W1 ~$ I$ a- G3 |# I3 W1 g   return FALSE;+ [( @' _& _2 A5 U5 J
}2 z+ E" C0 p! R& h' P
0 z# t2 ?. ~% g
Although this trick calls the CreateFileA function, don't even expect to be
0 v1 U+ t) t/ P: \3 @+ \, Dable to intercept it by installing a IFS hook: it will not work, no way!  D& l8 B' K4 r! b, V
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
& z' d5 R* }7 f+ ^3 J1 Aservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). J" w9 d. T: A( i, V* n0 q7 m
and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 T$ B; K: n# g& D
field.
8 ~  j- A' e  \In fact, its purpose is not to load/unload VxDs but only to send a ! e3 e( U: X7 K2 L) ?6 d3 C' e, k
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# }' n9 z3 p2 Z6 b+ p" ^! i
to the VxD Control_Dispatch proc (how the hell a shareware soft could try  E+ x6 u' Q6 J0 \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 I0 R- N2 A! [8 a5 MIf the VxD is loaded, it will always clear eax and the Carry flag to allow/ Q" c3 @6 H+ Q
its handle to be opened and then, will be detected.2 g3 d& @) P9 ~2 ?
You can check that simply by hooking Winice.exe control proc entry point
6 s6 a( I- [0 x6 W! Qwhile running MeltICE.
4 K6 l0 F1 Q* X7 u4 _% b, }2 \+ T$ Q# j

6 V# J( A- y% B  00401067:  push      00402025    ; \\.\SICE
8 E6 F. X$ b) @3 d; s# x5 x  0040106C:  call      CreateFileA/ j2 ]; e' W9 i% u3 r
  00401071:  cmp       eax,-001
# ?' u9 @& x' u  00401074:  je        00401091
7 G* I3 e, p. ~5 N6 U/ Z; }
$ w# G& j0 s3 q! _) h9 w7 z( _9 G7 K/ m4 Q
There could be hundreds of BPX you could use to detect this trick.  v/ V( D& l/ t+ c1 G* r
-The most classical one is:
9 F+ p/ f) h2 q3 s/ O9 |" ~  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||* O+ n8 L. F5 R) |8 L
    *(esp-&gt;4+4)=='NTIC'2 i) p8 {. Y0 Z6 V; _% ]5 A

9 I# f. K, l6 E' B7 Z4 `  I+ Z-The most exotic ones (could be very slooooow :-(
* f$ x$ ]( j7 Q+ n! y2 r   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  - j; x$ q% F9 g- K% g
     ;will break 3 times :-($ _7 Y& C5 H# K& ?4 }$ y3 {

9 T& e& ], U. D. x2 o- E-or (a bit) faster: , g$ l# S# h  u0 f
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 q4 J8 j( g/ i, W2 B
% x+ N+ \* D0 Q) X3 l  p   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ {$ t0 ]" _+ A8 J  i     ;will break 3 times :-(
$ [) |+ H' T9 M
5 l# e% z9 D! _-Much faster:( V. E; s/ A1 X/ Z2 \
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. _3 C; G* ^9 D, i: E7 n3 |/ H6 G. S0 i4 I7 E9 Q
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. x5 R' ]# S( }0 K; X. f6 j) e7 Gfunction to do the same job:
/ c; S( |* t+ b) I3 X# N/ ?  {
   push    00                        ; OF_READ
- n5 v! c6 ~7 X3 o  v   mov     eax,[00656634]            ; '\\.\SICE',0
# h# d: N& _- G, }& b% X   push    eax9 F8 n# l5 N2 X  U9 x
   call    KERNEL32!_lopen6 P' P" l) l9 [$ O
   inc     eax4 H7 J" s% v3 E8 H5 V& y
   jnz     00650589                  ; detected
/ U! {2 H" F2 s( J7 D   push    00                        ; OF_READ& P' _; [$ J' W; r( b
   mov     eax,[00656638]            ; '\\.\SICE'
5 f6 @/ M( c+ i/ Y  G- i   push    eax( t$ w( r6 ~- b
   call    KERNEL32!_lopen: c, K8 Q% {' V) Z* V$ h
   inc     eax6 t# L7 X+ _  X3 a
   jz      006505ae                  ; not detected
, c* o4 x" c) q: {" V- J' u+ K1 B' Q9 Y3 k

, K& S0 O. g; ^__________________________________________________________________________
; w! R, `: v, W% D% K" c8 U' ~, z: W  v8 I3 \1 @+ w
Method 12
+ c/ b5 N9 d+ q; L# o=========( X( F6 w& W3 n3 y" k. L( r" R
- P$ K( X" J  N
This trick is similar to int41h/4fh Debugger installation check (code 05" l% V8 j. h/ C2 H  N- G& {
&amp; 06) but very limited because it's only available for Win95/98 (not NT)1 {# `5 H7 m& m1 R. P' w& U. |, N
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, R6 V3 I4 S+ a! \' i  h7 a6 u- B. \) f# u6 V: _7 k" a8 e
   push  0000004fh         ; function 4fh
# X- a3 s8 }: {+ K" _) e& R, L. ]' \   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 E: y: i( @; c                           ; low word specifies which service
* z$ }* U, R% c0 c                             (VWIN32_Int41Dispatch)
+ c8 T: ]. i& I7 o3 ?6 Q- B/ [2 A   call  Kernel32!ORD_001  ; VxdCall
* L4 e; y% H% g5 y5 t   cmp   ax, 0f386h        ; magic number returned by system debuggers$ d/ p7 M6 H. j3 A$ t: i/ Q
   jz    SoftICE_detected) b* I; r1 W) A4 J) L

9 W/ |* Q9 F  l8 @* \Here again, several ways to detect it:
( K  `" z9 U1 I3 E2 T! V/ E* w
2 A. q. M9 g) j0 S9 ~    BPINT 41 if ax==4f
: ]( \4 ^: c8 i
5 R* ^/ X8 r2 T, X* {: L    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 z$ s' w5 x2 i0 m1 j

, r$ ~! l9 t3 ]    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' \9 @; D) ?+ Q1 [6 O4 n' \
6 h& M- j( H) ?6 G" u    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 \) ]8 \) @2 D6 }8 |: f
/ q( A% r( r6 x6 d" r  ~& A  l
__________________________________________________________________________
5 v1 B: n6 b8 B
  ~4 v; h: u$ H+ R1 B* m# UMethod 13
" k3 e# W1 l; J4 D: J: T4 u=========
" `. @1 g5 e, y4 x3 |9 \, O9 a  W5 ]0 w* i) r
Not a real method of detection, but a good way to know if SoftICE is
6 w% ^; b- Q- a# N# B  G0 F* G8 a$ Uinstalled on a computer and to locate its installation directory.: _/ w9 E  j4 _# x1 G0 H: w) ~* n
It is used by few softs which access the following registry keys (usually #2) :
& y$ E3 d' Y2 z8 C1 k  K5 B/ }
/ z9 d' K& ^, N# m  @1 N) q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 G3 k9 _" D: x2 [$ P
\Uninstall\SoftICE
0 V9 f( P+ s, N+ b0 L-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE3 t% {$ R& Z  w9 @; P, a2 O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" u) Y0 b/ }# g! d+ R0 y- Q. r( D
\App Paths\Loader32.Exe- h$ ?0 n/ f+ w. {% W4 m+ n6 ]
' ^% U* b: W* P2 b2 B9 d4 t

) J; u; U: N! W) A& tNote that some nasty apps could then erase all files from SoftICE directory
' C4 k" O7 {# S- m(I faced that once :-(
$ |" `0 X3 ^( z# {
/ ?) X4 t- J8 a4 WUseful breakpoint to detect it:) Q% U( I$ ^1 Y/ D. c

( {9 w% L& s+ I     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" `- q2 X. V% B5 O, g& s+ c2 M% v- P, @9 N
__________________________________________________________________________
5 ]" O8 W- a$ \
1 a+ |- H3 N+ K' G$ j/ D! ^: e" N8 h7 G7 V) X
Method 14 ' O. r* b7 h  V) C7 }
=========, d9 C1 ]) z2 d( Z" \8 X6 V
0 P* O5 L% _7 f. v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, v! u" A% h) p3 Zis to determines whether a debugger is running on your system (ring0 only).3 |1 Z/ F8 y9 Z4 k4 T# P0 Z6 q2 m

- e8 i' t7 \1 {, J   VMMCall Test_Debug_Installed
3 U- c$ z9 w3 C" u' K2 B   je      not_installed
3 F6 g  y, V, Q5 S0 \* p/ j0 E7 ]8 o- U3 P( B! j
This service just checks a flag.( N+ S& h* c- U, T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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