About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>7 _: X* k9 i( t. O, C
<TBODY>4 Q4 s" L4 H2 b; L9 ~5 q+ x! i; S  z
<TR>. D9 ], |0 X  K4 G! n. B
<TD><PRE>Method 01
# v: Y% D  d( T2 N6 Z7 v5 \3 e=========0 c/ e5 z. f$ z% j$ _

. ?& \1 `  K. d' ^7 SThis method of detection of SoftICE (as well as the following one) is
3 r; _- y  s/ ^) L, p4 Mused by the majority of packers/encryptors found on Internet.' {+ p; F1 |1 ^
It seeks the signature of BoundsChecker in SoftICE
" U( g& [6 q6 r. P: J* [* n
2 ]( F1 Y. z' L' J* ]- j% G& f    mov     ebp, 04243484Bh        ; 'BCHK'# D! V/ ~1 W* d! @/ K
    mov     ax, 04h# M/ p7 M: ^& ]' Z1 D% D; p
    int     3      
# Q5 |$ ~' Y% Y    cmp     al,4
# b1 w* b8 U, ~6 n$ D1 {5 J. Q( e; M    jnz     SoftICE_Detected
# [, C5 J  T  J+ l0 U
" T# l% `& T# s) t: Y! M0 H___________________________________________________________________________
. }3 t/ f) e8 U! L# H
  t( q) e0 P# P6 [Method 02
7 W' I% E, R* `; Q* I, G=========
$ _* E; S2 X7 K! t
! m# _$ V# ^% v, R( dStill a method very much used (perhaps the most frequent one).  It is used3 l4 c* Q2 h1 c) ^8 c
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,' O$ b/ s* B) _7 |. v9 u4 u2 d
or execute SoftICE commands...8 _& {2 k! ^% c1 O9 F; i( ]' K* x! f5 u; U& F
It is also used to crash SoftICE and to force it to execute any commands
1 q- l: J/ x0 I+ L, m, |7 A(HBOOT...) :-((  ! C5 V, |- V/ m& b# u3 @* I1 M+ }

" h5 U% Q% m4 ^+ A, h' lHere is a quick description:
) I5 Y: Q7 B9 {+ w: [-AX = 0910h   (Display string in SIce windows)& G' p/ ^: i- H+ V" D4 U2 Z8 p
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)1 |  R. s  d- Y  j" a
-AX = 0912h   (Get breakpoint infos)
& h5 G0 `5 U6 t0 r5 q9 u, M2 Q-AX = 0913h   (Set Sice breakpoints)
6 B4 W- t& S8 J. W+ f" c5 j-AX = 0914h   (Remove SIce breakoints)
; m; \* O5 B  \$ E- b2 m" n
; W% J% E6 Q$ [$ PEach time you'll meet this trick, you'll see:
6 _7 E& [5 G) y4 i-SI = 4647h+ D* A! q! O9 a: O
-DI = 4A4Dh
9 H5 c! F8 ~" w: U* F1 U  r2 eWhich are the 'magic values' used by SoftIce.
  o* v: \* m7 X$ e, [$ i1 W% p' m- G( ^For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
. N' I9 K9 {; T* r+ {& v# _$ [/ J' M2 |4 H0 m2 g( O* ~) L& T4 y
Here is one example from the file "Haspinst.exe" which is the dongle HASP) |' L. u. s; q( R8 y  a3 y# W
Envelope utility use to protect DOS applications:
/ T% n3 y3 X; i. h2 P% }, k$ @" m3 s# n+ k' J1 K2 R) y$ m5 r# l; B+ J

; h6 `  @* Z& ~4 D  Q4C19:0095   MOV    AX,0911  ; execute command.
9 S, z+ J: ]. ?  Z! f' H$ M' _4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
$ o8 `9 u2 F: s' X3 @$ O. v) d4C19:009A   MOV    SI,4647  ; 1st magic value.
* Z! l+ s" r' t% [1 V( D, }: `4C19:009D   MOV    DI,4A4D  ; 2nd magic value.1 k0 D% j) q0 g
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)( Q- y5 s+ n7 @- F
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 g& s4 K; E# g: t7 l4C19:00A4   INC    CX8 y2 g0 J+ @; I3 x& S! X4 F/ T
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) k) U; U$ `$ u, q# Q/ g8 U4C19:00A8   JB     0095     ; 6 different commands.
! D" G" E* s# v1 M4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ n8 L% }8 Q  o! D; s7 a4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)- X, F$ m0 N0 d9 U9 H; H
: k; K$ E4 \* ]! e; x
The program will execute 6 different SIce commands located at ds:dx, which
; |' R' K  c% C% B7 gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% n/ s  H$ D  t1 `! v. Z8 H" r3 F5 M' \
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& f2 q6 V, [; h___________________________________________________________________________6 ^+ L: m( s3 J8 ^0 m

! ?: R4 w% O. p2 \0 y$ p. D, ^+ O
* `! c2 R. }* x# PMethod 03& f" O- h) m; W, j; H3 ^
=========2 F- @( H! e* M

5 f9 k4 q3 D4 e2 H/ S' @* eLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ ^! Q; N5 y4 I(API Get entry point)" k1 \- Y) g% q9 O
        
7 z: x5 K* P% K, K# U7 ?/ u& A8 [
0 S) Z) V' A, Z0 ]) O    xor     di,di$ |% e8 b2 j, p% F$ U
    mov     es,di+ _* J- H$ b$ {6 Z! {
    mov     ax, 1684h      
( d7 r; C: y8 D1 j! C" n    mov     bx, 0202h       ; VxD ID of winice
6 z$ u' X) @2 t# d    int     2Fh
! G. ?8 {7 c; ?+ C/ Y    mov     ax, es          ; ES:DI -&gt; VxD API entry point- l& Z5 ]4 p5 q' i/ h7 w4 `8 a3 D7 V
    add     ax, di
, |) f1 g* x, C( \+ Z1 V- a    test    ax,ax
0 x/ j3 ^! i. r' F: [    jnz     SoftICE_Detected+ c4 |& O" P, c
2 N% _% O5 L8 M( H6 B) S
___________________________________________________________________________6 K9 Z- _/ L% a

5 M* X8 w) O+ z  `3 \. @( T+ {Method 04
# i4 h; v/ {3 p. d. k=========9 ?, `% J& x% V2 _# h* Q
' p/ p; O3 _- V  Z: ~* _6 L2 Q0 e& R
Method identical to the preceding one except that it seeks the ID of SoftICE
9 R8 e5 w3 D8 r! I& r4 P) `) ?GFX VxD.. `/ r" y% n/ T" R7 ^6 P6 O

' P( e; N% ], I0 ~    xor     di,di
0 V" N! C0 e' s8 C: s' o  @    mov     es,di
) `+ x+ H* X' L# I9 n+ K    mov     ax, 1684h      
* A) Y" U1 f# |* f; a/ O    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 D, n7 [6 c- `! q5 f    int     2fh
: W/ u1 k0 p# {$ {' u    mov     ax, es          ; ES:DI -&gt; VxD API entry point- Q8 B! s5 c! ~" q  Z$ M
    add     ax, di8 Y7 M  I% `& d% e+ S! E$ |
    test    ax,ax
9 }) v6 r' x! ~8 W, W$ Y    jnz     SoftICE_Detected: r, {1 Z% A/ E. x9 H$ X- K; d$ _
: C! o- r8 q7 Y& H: U+ a+ e7 f
__________________________________________________________________________3 F0 ], }( g5 Y
5 f4 D3 m- O2 Y/ U3 B' U

3 u7 k: {: M/ i  W! h$ F) JMethod 05
6 z: Y0 f/ y) }! I+ L( w+ f=========
# `6 I( D0 o9 f- A
# b  ~' ~! M5 l( _$ ~9 WMethod seeking the 'magic number' 0F386h returned (in ax) by all system
! ~3 C7 e' v& l+ x: q8 Adebugger. It calls the int 41h, function 4Fh.8 j/ N# g& T9 {* o
There are several alternatives.  
9 A: c* L7 _; T0 ~) A8 p
9 T- n1 C  J) v, L7 o" V+ h0 e3 k. FThe following one is the simplest:5 {/ X$ d: w  q, H  h, k
  g7 r9 S, W9 k
    mov     ax,4fh
0 j2 D: q3 U# h' C2 Q2 j8 _    int     41h. S3 k. Q: B* j5 h0 j1 ~8 ~
    cmp     ax, 0F3862 K6 T$ J5 p. _/ p# I, P6 A
    jz      SoftICE_detected: W5 l' J+ Q1 u. C
7 W/ c  I6 d! S/ u# r. H

* h: P  F5 I2 W* z1 W7 R4 K3 ^Next method as well as the following one are 2 examples from Stone's
" B! _1 j- A+ `' [2 K1 o"stn-wid.zip" (www.cracking.net):
0 P4 z& P8 _4 D/ q
2 n8 ]" P8 N1 [0 `    mov     bx, cs- o4 _8 G% ~, q0 U# }1 T  g
    lea     dx, int41handler2
+ |7 R% ?/ j( @0 k8 {    xchg    dx, es:[41h*4]5 N5 y* ^8 \: e
    xchg    bx, es:[41h*4+2]
. H2 B) F" L, R6 U8 J6 l( N    mov     ax,4fh
7 N) [1 J! _& J$ K3 m; p# K$ F    int     41h1 ?8 O  L4 p0 ~8 m6 U
    xchg    dx, es:[41h*4]
$ h; x' G3 L/ y, u. k" Z    xchg    bx, es:[41h*4+2]" j0 o- s+ C3 q9 B
    cmp     ax, 0f386h
- z1 A9 G9 T8 |( P- l9 Y    jz      SoftICE_detected
0 [9 Q1 T* M* K1 v* B: i& e, O+ |
int41handler2 PROC/ d3 t- f$ y: }
    iret/ _* p1 u) l" B
int41handler2 ENDP, O, y$ h- A3 r& z7 z5 K
7 i! g1 x) C& Y6 Y8 k

. M! s- }6 |9 Q, r* z, r_________________________________________________________________________: @% ^8 {0 }1 l- S8 V7 |( L

5 ~' u: t: _( T, ]* d
9 R/ r$ }1 \: I- v3 UMethod 06: r- i2 _$ w8 y$ [  P3 F
=========7 ^6 y* r3 L0 u' P* ~; m: u) t& m- K

9 h  r5 A& A, i3 v& |
6 o8 R0 {  e7 j, o, q2nd method similar to the preceding one but more difficult to detect:
) S# j% a6 q+ Y+ G# \: |% G) R0 g1 M
7 p5 `3 k3 S2 a/ m% q( \% f# ]* @8 }; ?8 B! M$ {3 C
int41handler PROC/ h/ p' r  D. b7 \0 C
    mov     cl,al( U, x- I' ^* u: [0 D
    iret
; K% M. S+ q+ q8 [0 Q# Z8 Sint41handler ENDP! b4 w% u" s4 W/ X, E/ K7 `4 q

' ?! b+ @  m' ^: X
, C) [! U! L7 E* m3 @: j2 m  w    xor     ax,ax( [- _4 f- `$ @4 w1 P5 ?
    mov     es,ax9 E0 T# e" l3 ?5 a0 o; E
    mov     bx, cs
* h* @! m0 o6 R    lea     dx, int41handler
) l2 H& U/ `2 w, |9 \  ]8 }) J    xchg    dx, es:[41h*4]" m3 J3 g/ G+ Z4 u2 e% f
    xchg    bx, es:[41h*4+2]$ x6 k+ _% q/ Y- s5 Z7 G+ m8 h* @- Y
    in      al, 40h. D6 a- t4 x; D, |. f; t$ o9 h5 n5 `
    xor     cx,cx4 Y2 T& |; H# p+ _5 Y1 p
    int     41h
) m6 f9 Z' o9 K' H: W: E    xchg    dx, es:[41h*4]
1 Q; Z; m  ]) ]4 p) \    xchg    bx, es:[41h*4+2]; p5 W- I% ]: c# z: e
    cmp     cl,al0 \1 `( F( A. {/ @& P  N: }
    jnz     SoftICE_detected
6 d! v% n( Y+ M/ h) d2 f# O$ _# r
_________________________________________________________________________
! J% [# Y" C* q5 ^; j  x$ u1 ?$ z# P: F. ^, z: p
Method 07
4 k5 x! l8 O4 f- r+ n9 I=========
9 e1 n- O6 v$ }( I+ F! J
" p: |' ?7 f; D, D& |Method of detection of the WinICE handler in the int68h (V86)/ ~  _/ p3 s' x" Y2 ^' d

/ G1 @  a( D# l. L    mov     ah,43h/ D% W$ a5 F+ N+ i& E" X# O- V
    int     68h
0 R3 C5 @$ W$ c8 f3 ]    cmp     ax,0F386h3 C( h  r) b, [0 p9 u0 Y
    jz      SoftICE_Detected7 x2 f- f6 X( @4 Y

9 X! A! ?3 @  l3 S/ u6 [- @' X5 {* O, i3 k
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit7 `1 R( U5 r9 E! L6 m# x
   app like this:' |$ J) u4 v( b- e. b3 c
' B5 I6 n8 [, y$ `7 G
   BPX exec_int if ax==68
! L% |1 c" _2 _1 U+ H) w   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 h3 `: d, T; Q  A9 b   located at [ebp+48h] for 32Bit apps)3 z. [7 l, e" L9 s; q
__________________________________________________________________________2 [  q1 u( E+ P: H$ R! G2 z' I
- j8 I- A! P# i! s4 \
  ]8 P* K7 D; }# E4 y: z
Method 08
& T& q8 O+ r2 p- Q0 _; z: k=========
0 x0 N8 [  @2 t& p. `
% u4 [0 E1 ~0 T" k, QIt is not a method of detection of SoftICE but a possibility to crash the9 H6 p7 H" w2 k- p
system by intercepting int 01h and int 03h and redirecting them to another
- q! a: d5 M6 j* E$ L: Hroutine.
* |( N& Y: G* Y3 oIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; a: z. A7 v% `- m. _
to the new routine to execute (hangs computer...)( d  m" H) l) y6 O- q
& T2 y8 d+ G3 [" a
    mov     ah, 25h
) p. y7 g- D2 n" z9 Y    mov     al, Int_Number (01h or 03h)
% D  E4 u- E9 @    mov     dx, offset New_Int_Routine" Z" O: K: e3 @4 Q: j
    int     21h
+ m- y! P# y& G0 Y& }/ ]1 j3 ?. x; I, S* H5 S. e2 J
__________________________________________________________________________7 g7 C  |8 t; |' k* {+ p9 i
" Y3 P! ?) P. ~! c# P4 N
Method 09
4 Y* I4 _5 @6 G1 }, B/ {  @=========, z3 [% T2 q+ d. c4 E6 D

. G6 A4 ?% j7 |& G+ K- T, {This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" r2 i  ~* f/ [2 s' _performed in ring0 (VxD or a ring3 app using the VxdCall).6 X% [6 P0 U# M4 v! z. J- y8 z* `  ?
The Get_DDB service is used to determine whether or not a VxD is installed
# {$ m, d4 y4 D" H) l/ Gfor the specified device and returns a Device Description Block (in ecx) for
/ g) C5 G9 W: [/ @8 zthat device if it is installed.. {# f) B; \2 L" M
) ?4 X4 a9 c. H/ d+ G  x9 ?& z6 O- b$ Z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID) d% T7 Q: x+ g
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
6 o- Y1 d7 V9 K; b   VMMCall Get_DDB
+ M' e) Z: d  F% J. P& V+ z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" e0 g) h' _& P  O  f- W( g

" \& J; S  S- @7 F  I3 WNote as well that you can easily detect this method with SoftICE:
7 f/ d, d% z8 K) u$ e3 C   bpx Get_DDB if ax==0202 || ax==7a5fh# s) N6 k: P: x" j5 J8 M) H
; p7 t) e, S- w6 s. ?& v/ B4 K
__________________________________________________________________________" V& f, ?& n9 R9 M
3 d! @5 R6 m& x* J" f# T+ s
Method 10
% g5 Y/ @3 a$ l/ E; S- a=========
7 v, [3 j8 {- R, m' M" @) N% ^' q- U/ N1 J6 i
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with5 F3 I2 j* f3 C& H$ b' I! m1 q+ V3 ?
  SoftICE while the option is enable!!' }3 r1 m+ k1 U# O' r
1 k8 ?- a! z: p$ b' v/ C
This trick is very efficient:) _" V# M1 }* y1 q
by checking the Debug Registers, you can detect if SoftICE is loaded
$ Q' C8 `( X& x% @  D# w) `& }(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( v  g! k2 k( C$ s' R$ P+ @" X% ithere are some memory breakpoints set (dr0 to dr3) simply by reading their
- u2 {0 g6 }& Z+ ^+ @/ |$ nvalue (in ring0 only). Values can be manipulated and or changed as well
8 K4 {! ^; t' L9 C. A(clearing BPMs for instance)
2 G( U; m4 b9 R; p' |8 u# p+ b
2 }# o7 a3 m" C__________________________________________________________________________
, m) _  S: i$ l2 D+ _' E, }) A0 m7 m
Method 119 T9 C. o* G0 L0 C
=========
" Y. O8 V. L% K/ `$ Z4 K6 L* H4 l
( c: k4 m# G/ G. g) |$ B* \This method is most known as 'MeltICE' because it has been freely distributed0 P7 E9 Y) l& i% V1 X
via www.winfiles.com. However it was first used by NuMega people to allow
+ b& A2 w  v/ E/ p6 h: [5 SSymbol Loader to check if SoftICE was active or not (the code is located
3 x" v# U  {1 Q, U( R# jinside nmtrans.dll).7 w$ w8 a; H1 W' ^/ b% I

" Z* m% _7 q1 h- E/ u3 M7 f$ A: sThe way it works is very simple:
) I. l3 ~/ c- J5 y+ m9 v4 k, IIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" d% i9 t: M# i) t5 m
WinNT) with the CreateFileA API.
& e& d! Y/ T; T8 I+ B! G0 s/ m2 u' H  V5 P* |, d! N
Here is a sample (checking for 'SICE'):0 X' J- r$ f: g' f$ ^

0 B4 n& O& F' J, P/ D/ XBOOL IsSoftIce95Loaded()
/ [4 B) M( h" y$ |! i3 B, ]+ O{
6 E4 c( P. Z# `! X' ~  X$ @* X   HANDLE hFile;  
( W+ K1 {4 r4 P' P* V   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
) x& v5 G* U+ A5 {3 y                      FILE_SHARE_READ | FILE_SHARE_WRITE,
5 v/ Y; ?* S: ?& c* ^3 t9 ]                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* P& G0 H6 k+ m( O" L# z   if( hFile != INVALID_HANDLE_VALUE )
$ F( e* |, ^- s. F  |( H1 U( q   {
4 }% c2 F/ d. f9 I! Z1 f* t, v, R      CloseHandle(hFile);- X! a* j2 J# Y! Y: F$ D; W$ C; ?
      return TRUE;
8 p) J3 F3 K1 d   }
. K: P0 ^  Z- {5 A7 P   return FALSE;; w% t( Q0 y% k1 _4 r
}
: {7 U9 }& U. m. K: ^. x3 t0 O/ S4 Q+ j3 H9 @1 |
Although this trick calls the CreateFileA function, don't even expect to be
; N# }" J! u5 k  _+ `able to intercept it by installing a IFS hook: it will not work, no way!
# ]. Z5 q: p7 N+ y+ D' f' X# wIn fact, after the call to CreateFileA it will get through VWIN32 0x001F# c, v8 t3 d: a: F5 x$ I
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& [; a. v4 }4 S- X- e# x! S, i; kand then browse the DDB list until it find the VxD and its DDB_Control_Proc2 B3 E* m/ _( J; I  Q3 M7 W
field.
. `1 {; M% s! G$ S# MIn fact, its purpose is not to load/unload VxDs but only to send a
1 r; u* h. G" Q" }( \, i" }W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' t0 e/ E( }3 |2 V1 @8 _3 ato the VxD Control_Dispatch proc (how the hell a shareware soft could try. A5 U+ B3 }' _' n% i" [
to load/unload a non-dynamically loadable driver such as SoftICE ;-).' P5 q1 \9 r* @( P% I$ |  w
If the VxD is loaded, it will always clear eax and the Carry flag to allow
7 B; b0 }6 e- A; a& H" Bits handle to be opened and then, will be detected.
, W- W# b2 ^1 F1 V/ [8 g- VYou can check that simply by hooking Winice.exe control proc entry point9 U- a4 i0 `) w" {+ I
while running MeltICE./ [: k0 a( F" j) B2 L4 G" ?
% ?1 l( C5 H0 S9 \. M4 T6 f2 Z" }- I

# V& Q4 ^$ K* f' z0 J2 K1 t  00401067:  push      00402025    ; \\.\SICE/ R8 c1 T) d- g
  0040106C:  call      CreateFileA9 |& Z9 v. b6 a0 @' i  g4 I$ Z
  00401071:  cmp       eax,-0019 u5 ]; [- s$ K* h* D/ n2 i8 g
  00401074:  je        00401091
0 E! l6 `1 r* v0 P# q7 h0 ?$ F& J" T3 R. D2 @
$ A+ t3 m2 \& F4 x4 x& Z- a
There could be hundreds of BPX you could use to detect this trick.$ D' r! o3 `1 B
-The most classical one is:
+ C8 _6 [% Y  z8 e, u( z+ @  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) t. {7 l/ A, \9 N- I
    *(esp-&gt;4+4)=='NTIC'4 O7 i2 _! ?, {
! Q$ h+ N) ?0 I; g1 l5 K  l0 v1 x: P
-The most exotic ones (could be very slooooow :-(: M5 P9 M  G8 ]$ B; J) m
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& a$ @4 ~* K) o" T1 S) d) u     ;will break 3 times :-(
. `$ C8 Q# \9 y/ G6 f" G
2 y% r0 ]* f2 C0 {8 `8 F$ c-or (a bit) faster: 7 L) W: h# A6 i) Q. Z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). r9 A0 r) v8 O( D3 w

; x0 [5 ^1 r! E6 a. g6 e  m   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& _4 O" g4 K7 Z" ~: P2 u     ;will break 3 times :-(% I( l( s' k. g4 j0 B$ c7 X
  X" |0 b; y7 A
-Much faster:
- D/ U& [/ v: p, N* f" {: u3 d   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 n, N3 v" o$ {; P" {) D# X; ]+ S: y

" X! {0 T, c  mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen7 e" @0 ~& p$ v; S$ H& {5 w
function to do the same job:
/ L" @" X) n5 a/ t9 J0 V/ o/ L. G( k- Z8 n
   push    00                        ; OF_READ
) K0 b, e( |# r! h& V/ b# I; K   mov     eax,[00656634]            ; '\\.\SICE',05 ^3 t5 @& O3 b
   push    eax
# A$ Q3 ?: b  \! }   call    KERNEL32!_lopen. K6 l3 D% f9 t. Q( c! k. g
   inc     eax
4 X! h  [0 ]3 ~# q* w/ E   jnz     00650589                  ; detected
- s: p  H/ U0 z) S1 d8 J   push    00                        ; OF_READ" p! m7 |( I$ j6 F4 N& ^& V4 L
   mov     eax,[00656638]            ; '\\.\SICE'- m, b0 I3 @! h# }5 r
   push    eax7 m: d) R! `: r% _
   call    KERNEL32!_lopen5 j, K2 _0 B9 ^7 N9 ~7 h- Y
   inc     eax5 k+ Y9 z7 c3 `! b
   jz      006505ae                  ; not detected' A/ C8 _3 p& ]( R6 J
, L( ~8 r' ?- Z# _' K% Y

( H8 X0 o4 t& h" E4 H" x__________________________________________________________________________
: i! u3 K, z+ a2 S
0 l- x2 w; D- c/ H' t% _# _Method 12
! t) z' v4 j9 [=========" I9 j9 ~8 v" {: }; B1 \
* }: M) s2 @6 I  @- h
This trick is similar to int41h/4fh Debugger installation check (code 05
# q1 H/ I% j+ ~&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, P3 Y% r) v: R) K  F' G' cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.7 d1 n1 v, \. m1 v
; T( i7 A8 g3 x
   push  0000004fh         ; function 4fh
. O6 O8 A: h) ~( S2 g9 i   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ M: D% z( e. G0 P  [( E" E                           ; low word specifies which service+ _, F# J" x- g$ S# ]; @, i
                             (VWIN32_Int41Dispatch)
' k; W% j8 @  t4 U   call  Kernel32!ORD_001  ; VxdCall* }" r7 r# n% U
   cmp   ax, 0f386h        ; magic number returned by system debuggers) \' f0 _3 g2 |
   jz    SoftICE_detected
3 S  E  R: s$ g
5 k4 p, \" ]7 ?/ A% nHere again, several ways to detect it:  {$ N* O# n. v( W" u+ O2 C
) g/ P) q+ ^; p% [, b5 v9 M
    BPINT 41 if ax==4f
6 F7 ~8 W0 c4 D! y; ?0 d1 ~/ ]) b, k# C' R  P
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) y5 [% T9 D1 g9 K& g# l3 p: P' e  b/ Z, T& R$ ]$ m8 H
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 N( ]; Y- l' [  D* a% o' S1 N  v6 o+ @: i# O
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!" j% |, S  O* j+ _* ~
0 Q) j3 o, r+ p" Y/ e: _  Q: x
__________________________________________________________________________
& A. q  [! M) z3 p, d7 _1 d. Z4 |+ W+ d* n
Method 13( m1 C2 \5 D: p' a* b
=========' a7 b0 h) o; ~  P) a7 @: l. ^$ b8 |
$ X1 f2 V# v3 m2 \& e
Not a real method of detection, but a good way to know if SoftICE is; M) b: F  p* l1 c. E2 C
installed on a computer and to locate its installation directory.7 [, Y6 t4 O( ]" o/ Q
It is used by few softs which access the following registry keys (usually #2) :
/ Y" [! D" X! ?( E$ x0 w
5 ~" c* x5 ~1 w5 {6 Q/ e% y% h  {-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, r( O, g9 W) m
\Uninstall\SoftICE5 o) e9 @% w7 N
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ M* X" ~# n; I+ i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! H5 T. _. l& ~* _/ J1 v" M+ O
\App Paths\Loader32.Exe) f7 D" H# M" @/ m

) A( S+ @+ J" t2 p2 V/ F* @6 y$ Q
Note that some nasty apps could then erase all files from SoftICE directory
& X/ z& ~' t! }(I faced that once :-(! Q' V% n3 o, c7 {: V, A  I$ ~

( _" `/ A/ o$ S3 S0 RUseful breakpoint to detect it:
- z9 G: S5 ?" b" c7 I% L( x
# e7 z! t) j7 |- }6 v     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; @  `* l" A2 d+ }1 z( {8 Q6 d# R
__________________________________________________________________________
( t3 E7 M) ~4 ~0 e4 a% X; ~; m" k2 R4 R2 G/ A/ z. ~# u
. G; B6 c6 P6 @, L: U8 f! p
Method 14
+ Q( C3 O" b$ s- d1 T$ L. p0 D=========
* y9 A9 f6 U' V. Q2 D% U$ g* a+ r3 V' J
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 f7 m! m% N0 \) M7 {is to determines whether a debugger is running on your system (ring0 only).
6 K  ^' \! Q3 W* V: }& [
6 O, o* Q: S. p! F. ~2 R$ ?   VMMCall Test_Debug_Installed
2 `1 \% K5 ?/ u   je      not_installed
# A- j5 v2 l  F/ e, |
7 z1 ]. ^5 p1 d2 l% v# S; @$ mThis service just checks a flag.3 z& _; c. \, \! E
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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