About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
2 k2 ~7 C3 v- B" n  B<TBODY>
, C4 ?3 _. \* Y( f' m# K7 {% }7 r/ x<TR>
( P3 w% Q9 |  w" F# ^4 t# D<TD><PRE>Method 01
) [  l/ E3 D8 B( A: L- J8 t' r=========  O% X: B( i9 q; i' @

. m; j# R% a# W, w2 `; f: A! {This method of detection of SoftICE (as well as the following one) is
6 ^. M/ @$ O1 Z/ k6 J: Pused by the majority of packers/encryptors found on Internet.5 K# G8 n$ l4 y! I
It seeks the signature of BoundsChecker in SoftICE, o+ D/ Y6 I3 K0 Y

' Q) P( {9 {9 |  S: r6 E    mov     ebp, 04243484Bh        ; 'BCHK'
3 e, s+ E7 Q; g/ H: m$ F    mov     ax, 04h' t: a' Q4 a/ g( ?; G8 `- ^
    int     3       ; x. ^8 x) U2 Y7 q2 m% {
    cmp     al,4
- t  b5 c6 C2 @( L    jnz     SoftICE_Detected$ Y0 @0 L' W& i# C

( j9 j, z. w/ i' m5 ?___________________________________________________________________________1 l, H) C+ G1 X5 T# m" {; G3 V
" S) R1 y9 B; n6 S* a
Method 027 K8 M5 R" U/ K0 T% C
=========# y% v7 C3 N, u8 v" c: l
: o" h$ D8 v4 u
Still a method very much used (perhaps the most frequent one).  It is used0 Q# l% v$ D( J- {& h) v9 r
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
( p9 U: [# ~" d; M5 c/ Gor execute SoftICE commands..., G' c0 P  A, b. Z) [5 U9 w- R5 O; M6 k
It is also used to crash SoftICE and to force it to execute any commands
& ^* {" v" x/ O8 g: j( o/ G(HBOOT...) :-((  
0 g6 v* r8 D1 @+ V( h
: l$ A3 z3 k8 Y) SHere is a quick description:5 F9 B2 ~1 D2 k8 v. Q# j' a9 Y! F* q
-AX = 0910h   (Display string in SIce windows)$ F- f1 @$ y2 n% p! U
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)( d# s9 v, Z! X- W
-AX = 0912h   (Get breakpoint infos)
! H0 d: N  X, ]1 |+ v-AX = 0913h   (Set Sice breakpoints)
' D) Q6 i! P- a3 U8 [8 o; d" w-AX = 0914h   (Remove SIce breakoints)2 [. u. m3 ~6 a

/ m4 U0 \6 O/ E  r  b2 nEach time you'll meet this trick, you'll see:& P; J; d+ Q& Z# b7 J9 e- ?
-SI = 4647h
9 z" l# N: e( O+ x-DI = 4A4Dh) I7 q  b! m# e/ a
Which are the 'magic values' used by SoftIce.
* @3 ^  h: _3 \9 Q9 kFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
6 X6 f3 ]: B$ |5 e9 o+ [9 o
0 v2 n- @2 j& D$ N* CHere is one example from the file "Haspinst.exe" which is the dongle HASP/ x3 [- B6 X' p( R- ^4 b: r
Envelope utility use to protect DOS applications:
- J. ~3 t; T) |& G9 U/ F& L6 j2 k8 y( a; w" A6 X( Q1 U2 l! H
+ I9 K" W- g! t% w# ~: z( Y
4C19:0095   MOV    AX,0911  ; execute command." }5 `& i. }/ R9 u8 f; R* `# d
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
# }1 r: o' x  i8 M' q7 C6 V4C19:009A   MOV    SI,4647  ; 1st magic value.
* U$ k* ?0 J9 O9 t; k3 ?4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
, p* a% j8 n( T" _/ D* E7 t4 X4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- Z/ L8 a2 {0 t4 S# Z+ I+ ?( F3 ~* l
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 x4 i# m% ^* o' Q. G. _8 M
4C19:00A4   INC    CX
$ i, q) f3 x/ f3 i0 y  F, @9 r4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& U3 K& I$ a4 Z( z; \3 C4C19:00A8   JB     0095     ; 6 different commands.
4 h7 {' x1 I. h+ O9 d4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 y7 G4 P. Y4 m+ V) M9 w7 w# y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 j- g% \6 d9 r: n
' X( b4 @0 Z) w/ o; mThe program will execute 6 different SIce commands located at ds:dx, which
0 m$ p' w5 a# I- tare: LDT, IDT, GDT, TSS, RS, and ...HBOOT." t9 y$ Z# k% X4 \1 J2 b
& g  _3 U* `8 x- C; j
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! r8 n4 h4 U8 G9 u6 j
___________________________________________________________________________
: I* j1 N8 |* ]- h
3 H& k4 T" g5 d  A2 W  ^/ l1 m" }3 L+ {% j7 g
Method 03
8 a% i0 C7 q- k+ J=========4 X) _$ e  n! ]0 u3 T) ?: ]0 A

0 \5 I% c% V$ V! `# O! H8 |) FLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( G8 B7 `  H2 E" o$ |( d8 A/ M
(API Get entry point)) |9 S7 f  i! E6 u
        8 t; I9 O4 |) F

* n3 [. e9 s4 f; p9 T    xor     di,di
  p) z# t) J+ V' ~7 n2 y) [# ~3 P    mov     es,di' c; X4 h+ @0 q% M0 ^
    mov     ax, 1684h       ) b6 B: r! ]0 T
    mov     bx, 0202h       ; VxD ID of winice8 T& a1 F1 F% v+ l. V, Y1 B/ H
    int     2Fh' U/ K6 B3 @" \$ ]
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 z+ W8 P- x9 X! `- l
    add     ax, di) j, f3 a  l0 l9 n, \  N, V
    test    ax,ax
, i2 [: `: B2 _  e, }8 _( n    jnz     SoftICE_Detected
5 O! I$ l; U. m( O/ c' n$ i
! S, I/ s% R# q* Q7 \___________________________________________________________________________
/ v0 ~  z' m5 t. }" G
) D. Z: h9 |/ Q) j) n# ^, aMethod 04
; w' i" ?6 y, q0 p=========. z' x3 {% E1 q, j
5 ]1 e7 o& ]& A9 m
Method identical to the preceding one except that it seeks the ID of SoftICE
; ]$ e4 W, Q" R8 Q, F+ |9 K1 q* W6 XGFX VxD.5 q  e" y  k3 o6 u
; F' E6 ~2 ]" }+ H  Y  Y1 ]* T; J
    xor     di,di
* A$ v) p. ~# V) I7 N: b4 x4 R    mov     es,di3 S( A' h* Z4 C4 v4 G
    mov     ax, 1684h      
4 J; ^( w  y4 K    mov     bx, 7a5Fh       ; VxD ID of SIWVID; F- y/ ^+ n4 {* P2 m: ]
    int     2fh
* I2 a  r& m7 t( e    mov     ax, es          ; ES:DI -&gt; VxD API entry point! E5 a) J, B8 P- Z" h6 k
    add     ax, di* T* M* |0 B4 ]2 H9 R/ V
    test    ax,ax
$ x6 _. V/ {3 _6 K! M    jnz     SoftICE_Detected8 L. O1 M: r% b) p* q* r! @, C, X
' V" v2 }# V) D6 j
__________________________________________________________________________
9 M3 l* w& u) L  t8 F. i: @+ r  q' Y0 z. c% O, m7 U  P

* z( d  I$ N1 w4 o. }; @5 yMethod 05
2 N6 I9 i# P/ z3 @. t=========
9 F" W2 A" |0 @/ d6 P; m7 j
1 \$ W* V* \; r9 r- U6 TMethod seeking the 'magic number' 0F386h returned (in ax) by all system- q% u7 W7 l) X* J" T7 s6 r
debugger. It calls the int 41h, function 4Fh.
: v% u' T* [) b3 F* g( GThere are several alternatives.  9 @1 S/ @. X4 L8 E

$ A; K* b8 x6 l9 O# U% AThe following one is the simplest:4 C& C4 b. \6 `7 B" n$ b

. k" Y" e+ f0 O) q    mov     ax,4fh
4 S' b" [# {6 b8 U0 }! j' v. W3 Q    int     41h5 v6 r# h8 h- N% |0 i2 B) I) b) m
    cmp     ax, 0F386' g. \0 L# n2 ~& x$ V. B
    jz      SoftICE_detected! A, i  K" G1 W( [7 S3 i8 k5 B) H
) \$ v; u7 j0 j2 w- T, K, b5 v: g
# n' v% I  W& j! }
Next method as well as the following one are 2 examples from Stone's ) v6 [- s0 n1 C+ K# _
"stn-wid.zip" (www.cracking.net):
: X" ^8 `1 x+ \
0 }# v0 v6 j" A2 \    mov     bx, cs
+ n! b' i6 p9 @6 D5 }3 E2 d* T. Y2 b: s    lea     dx, int41handler2% T5 [" `7 |4 z. U% @: Z2 h, {
    xchg    dx, es:[41h*4]& c5 P" f/ U( m' v' c4 z1 G4 x5 o! f
    xchg    bx, es:[41h*4+2]' t7 A: ^$ g1 y4 Y5 [
    mov     ax,4fh
$ n  z7 q, {# Z9 Z* C5 i    int     41h8 P6 f4 I% W' M' M/ t* U
    xchg    dx, es:[41h*4]
% f& _) a% e; m, ]* d# n+ n+ i. M    xchg    bx, es:[41h*4+2]0 E' H  X$ F" t6 N, \% K3 [
    cmp     ax, 0f386h5 q* w# E6 S  t: l1 F% B0 v# N
    jz      SoftICE_detected
! I8 D+ k) c) z& _5 U$ i( J# t" s, a$ [/ k# G: e" M
int41handler2 PROC5 Z! i4 O2 _' I: M/ I
    iret
5 B/ @: w$ A4 G" n% z6 d( n' jint41handler2 ENDP
* d1 A  t7 q- B" O- q- I
: x7 f$ e+ A3 s, T' A0 x" L' e/ {2 C# X% F0 {. A7 U- t
_________________________________________________________________________* o* E/ t) ?  c/ W& b

7 X  g2 K1 c) ^3 y( T5 n* i8 J1 M/ A; \5 T2 Y$ d
Method 06
8 ?2 d3 I$ B5 q: L2 |8 ~=========
4 V" u6 ^0 x  K! o" ]6 o1 ]7 B) o, ^5 {" d
0 A7 R" q, P2 e0 j) }
2nd method similar to the preceding one but more difficult to detect:. f0 V0 o, M0 x8 g2 f( C
( i! R" j7 T! C' S
) v' Y5 E8 q( u  y
int41handler PROC
5 y) ?, K; V) V* C6 ^$ q; ^4 p0 J    mov     cl,al* p% s5 C4 j: ~! W' ~  t7 a- p$ \
    iret
6 Y9 J2 H, ]+ P$ ~* s+ z/ cint41handler ENDP
0 Q4 S5 x, x; D' F2 ?, u- r9 ^/ B5 h1 z" l& B- B
3 o* n  l; C& A* J
    xor     ax,ax5 p, L8 b9 n* v7 u5 N# n
    mov     es,ax
+ v: z8 L* v8 M5 }9 t8 w9 I" M    mov     bx, cs  O& Z, J7 a- t, o' u/ e! [, z
    lea     dx, int41handler9 ?5 Q5 U8 L; T* y/ P+ q! A4 m1 w
    xchg    dx, es:[41h*4]
7 @' b) X2 ~+ L3 _    xchg    bx, es:[41h*4+2]( _$ {7 Q  ?5 ]- t& ?( H# ^4 U$ k
    in      al, 40h
& Y: E6 b# K! L! O8 k; g( i    xor     cx,cx
4 @9 h! _/ K- q$ S$ i" p    int     41h# m: n# Y* I: Y7 y8 Q6 @
    xchg    dx, es:[41h*4]
# T+ X* l+ Y" z; t1 b5 a    xchg    bx, es:[41h*4+2]% b6 {6 [$ |7 f; C
    cmp     cl,al
& n( O  r- y( {  X  \    jnz     SoftICE_detected, Y. a* j& t: m* y3 G. p

8 }9 N! K3 T' @  u- C* O/ y_________________________________________________________________________
5 k, b% y. I- t& L; \1 x3 ?, C& r0 ]/ F1 N$ g
Method 07
, H, Y  m5 q6 X9 i! K3 y=========
$ h1 z; i$ g; \4 F) g$ N! q. W9 u7 _5 l: l" u8 f# @
Method of detection of the WinICE handler in the int68h (V86)
( K* d, E" e$ u) D
7 Q$ F4 M0 h% N    mov     ah,43h
; _* X+ e& B* G/ \9 _3 [    int     68h
2 r# @& \% x1 E( W; J4 z    cmp     ax,0F386h
3 B# Z2 n% T/ o: n    jz      SoftICE_Detected+ J0 S; \% v- U+ n4 r$ j
8 P/ W1 E8 E; m* U: I7 A
  M+ u6 s3 u% x* ~. R
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
* ^$ u. l! o1 C5 _6 N   app like this:( B0 T9 v1 d; c- P. k
5 d3 Z3 c, k7 D0 x: J/ H+ e, m
   BPX exec_int if ax==68
) C0 i. s3 A3 |7 b- K7 P. K   (function called is located at byte ptr [ebp+1Dh] and client eip is
  [- k3 Q. f. e6 p2 l   located at [ebp+48h] for 32Bit apps)" _/ b/ V, g! i& n* P8 ?
__________________________________________________________________________
' w- Z4 |& C$ }- q5 k+ b4 q3 i0 ^4 T5 w0 m$ D
' w+ ^) I/ k+ s! f' Q' ?
Method 08# o3 x5 P1 s: O
=========  O' q! b  I8 z

4 Y4 `% @- u2 W- j  KIt is not a method of detection of SoftICE but a possibility to crash the
& u1 x5 J6 @# msystem by intercepting int 01h and int 03h and redirecting them to another
; x, i0 j6 {1 k5 hroutine.
0 s3 g* G6 z# U# F! o$ KIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
& s# f! ~6 Z4 p- H' P$ s; L2 O% |. Bto the new routine to execute (hangs computer...)
* h& h  H7 m. c6 Q
' F; l, t8 f6 W4 j  P3 b7 E2 F    mov     ah, 25h
: e: `$ ^: h) z  b. b! p    mov     al, Int_Number (01h or 03h)% c& r" f1 a" z4 X' i
    mov     dx, offset New_Int_Routine
: l# ^1 i% F% r  k) E# J    int     21h
7 G" x: G. S6 {* Y8 |. q6 R* B  c# i' G( u( U
__________________________________________________________________________5 _6 T  N, i& \  O/ l4 M7 b

) d  L5 I# N" J  i6 O* W/ TMethod 09" C) }2 }  e. B# g! I6 b: J
=========9 e7 j* z: y! s  i3 }

5 Z4 P  K+ P* o* K* f1 dThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
  v/ p: F: i7 r1 o8 operformed in ring0 (VxD or a ring3 app using the VxdCall).
, ~7 v" l: `4 P/ D& h- b& ~2 m, XThe Get_DDB service is used to determine whether or not a VxD is installed7 ^) o) g2 b$ R+ \- x* r
for the specified device and returns a Device Description Block (in ecx) for
' e# w* e2 J* P8 ]8 M) [+ `: r# b3 [that device if it is installed.
/ v1 B' r) E! K% P1 r6 B) h+ e7 Y' ~+ C
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 e% k- ?! \' t4 G9 y3 ~
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). d/ a' V$ ?+ d& j
   VMMCall Get_DDB
/ c7 E3 k$ K9 ?! A! T# F* Z/ i   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, p% l3 u& Y. C6 P, e5 L& Q+ l7 K) W3 \" E* z2 }& F" c# \& g
Note as well that you can easily detect this method with SoftICE:( Z5 ^5 |) \6 d1 Q: L7 N4 [% Y( E
   bpx Get_DDB if ax==0202 || ax==7a5fh
( c1 V: y/ q6 d3 r" _9 D5 E5 I# c5 }9 k/ x, y
__________________________________________________________________________7 P! M  @+ z  W$ B! u) F
; q9 H. d: O4 s+ o, C; `
Method 10
: f' {+ O& }' g" t' V- h) Q=========
8 ]# S/ S! J; _4 S. D, ]1 D: v' a, p  S4 J% q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- p+ d9 O, u- A5 t1 c- l9 L) R1 a1 \
  SoftICE while the option is enable!!
. j. s4 b; k7 v* l; K+ c
$ U3 R- Z/ S) Q4 w* E3 _This trick is very efficient:& p, s" t8 H9 U( `
by checking the Debug Registers, you can detect if SoftICE is loaded4 G! m: t6 J$ ~: ?2 Q# c  F  D
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 [1 m# O8 {/ @8 Lthere are some memory breakpoints set (dr0 to dr3) simply by reading their% J( F5 @0 O; \8 H& _
value (in ring0 only). Values can be manipulated and or changed as well
& h9 T9 G; {8 K' P5 V(clearing BPMs for instance)
( f+ N* w" J2 \8 u8 ]! r2 G4 p
) P0 v" A+ U3 P8 m" Y__________________________________________________________________________2 J4 {- {2 y+ w3 Y
! c, U8 X, }7 e4 x
Method 111 X. W6 \5 N. s. {% s0 m3 g
=========% w* I( \' I  v: P& i: _
' E! Z) l8 z8 N" m
This method is most known as 'MeltICE' because it has been freely distributed4 G2 @5 y6 {. h/ e2 d
via www.winfiles.com. However it was first used by NuMega people to allow
- @9 ]4 s2 X$ z$ o* u: y$ }Symbol Loader to check if SoftICE was active or not (the code is located  D) B/ V5 u0 L* d0 k
inside nmtrans.dll).
1 E" N# P+ C5 J4 }2 ~# g( ~$ [4 p! V6 Y# b# [& W; c3 T( {5 j+ Q$ q+ d. Z
The way it works is very simple:8 r+ P7 x5 v! p) a5 }) p1 t/ [) X  y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
7 n) \. y  ]; d) S4 EWinNT) with the CreateFileA API.
$ S8 n6 A2 A' f4 c) c! E
& k; L' U0 b* k- YHere is a sample (checking for 'SICE'):6 q$ K, y9 I0 {4 Y; {( z: U( W7 [

( H8 b4 y1 B; T& h# E  MBOOL IsSoftIce95Loaded()
* R9 Y8 `! W' r6 U6 o{; @' b6 A3 \( G' [* T' @3 c; _5 W
   HANDLE hFile;  
7 }+ H. M, G! z3 G0 S, M   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# A$ q* p/ S2 p$ f* ~' h                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% K, Q2 H- e$ W  w, l+ Z+ w                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: |: _1 J* i  W2 J+ K5 d& h   if( hFile != INVALID_HANDLE_VALUE ), h2 A* o8 e: L3 h# g0 Z
   {5 P1 o. u% |; F4 Q5 o& g) ^7 N
      CloseHandle(hFile);/ w0 [2 ~! q( D; S( M. J: p4 }
      return TRUE;3 ]7 C! \- {& }: S' Y# D/ r
   }
8 B7 e- h5 @% v& I' [   return FALSE;" F' }9 h7 C. t; V
}+ n* j$ f/ ^4 I/ N5 j0 e
8 e% N1 s8 {8 ?/ x
Although this trick calls the CreateFileA function, don't even expect to be
: \2 W5 k* C$ ?% u* C4 C; X# }) Gable to intercept it by installing a IFS hook: it will not work, no way!7 {5 p- G- T/ [5 j* ?) R! @3 H
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
7 _1 |- _: t1 a# L1 T, `5 ~service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- y+ ?: z! g# i
and then browse the DDB list until it find the VxD and its DDB_Control_Proc9 _6 w4 S* o6 z0 v, R3 W' n7 Z- c9 w
field.
: C/ P3 G% m& @+ ?In fact, its purpose is not to load/unload VxDs but only to send a / u; E$ E  k7 _3 a6 |* Q/ e
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)! n: P. Q5 n0 Z1 P2 j1 m: p& d- k( F
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
, w) G  E8 J% T* Mto load/unload a non-dynamically loadable driver such as SoftICE ;-).
, P! r7 Q( ?) b! J+ f" FIf the VxD is loaded, it will always clear eax and the Carry flag to allow
' `8 y) v$ X) k0 v! }* t, ^its handle to be opened and then, will be detected.
( G7 Q2 Z4 O- ^You can check that simply by hooking Winice.exe control proc entry point
" E6 `6 A7 l  p* _& ewhile running MeltICE.
, X( @( H7 U3 Y1 l  J  H3 a5 S1 a
% I7 p. ]" k. ^& W: k2 }& k* y7 e+ w; V4 g
  00401067:  push      00402025    ; \\.\SICE4 a' A  e3 u/ l
  0040106C:  call      CreateFileA# O' B$ i* `0 A
  00401071:  cmp       eax,-001$ Y* o& k. F# q. E  o# J1 M
  00401074:  je        00401091& c& u( x. E& S. M: o/ C7 \9 r; U- M/ T
+ m7 ]2 C$ m! n
8 e+ M% i6 |$ s; v
There could be hundreds of BPX you could use to detect this trick.2 U; i% Q/ C- Y4 {6 _
-The most classical one is:3 F( J* z$ O! A
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
2 G- b2 F. A/ \* X    *(esp-&gt;4+4)=='NTIC'- o) _3 q" d4 [0 f

" x( J9 h# @3 V1 e' t3 M& U-The most exotic ones (could be very slooooow :-(3 ]( ?0 R, Q8 Q! x! I0 H2 P
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
7 z. q! k  \! E     ;will break 3 times :-(3 b, d, d, Z) R

/ N1 c8 q9 P9 r+ P" c-or (a bit) faster: 4 p& G8 p/ \' ~/ Z! @# Y
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
; D  R4 e9 o4 ?) M) b6 F; |; f3 {' Y/ c9 U
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
; w, S1 Y# _' g9 F+ @8 k: F5 E     ;will break 3 times :-(; U. K* O& u/ k  F: Z8 J
: T: e9 Y: M, N* ?
-Much faster:
& k5 `( Y! N* d& y0 ?5 H   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
# O% B# }+ m7 q2 E7 g8 v
. g2 k( H9 w9 \- hNote also that some programs (like AZPR3.00) use de old 16-bit _lopen6 ^) a( K/ w& t- _6 p" B: U6 e& S0 D2 Z
function to do the same job:
, z/ b& u% y8 N7 d$ t( l0 m( R+ k0 Z* V/ K) w
   push    00                        ; OF_READ
1 o! T  N8 {  z+ i   mov     eax,[00656634]            ; '\\.\SICE',0) ]4 Q& `$ q7 S2 m
   push    eax
1 f- K! o' X+ ^( j0 [- t   call    KERNEL32!_lopen
/ ]. x1 `2 x% h, D9 f   inc     eax7 O2 `1 l0 Y( m0 I! r" ?  Y2 ]2 j8 M
   jnz     00650589                  ; detected
, u; u( m4 j, g" _8 h   push    00                        ; OF_READ
( _* E# @; A0 M! q( [   mov     eax,[00656638]            ; '\\.\SICE'1 {# ?" Y2 O( R- q) N
   push    eax
7 B8 N$ r7 Z1 q% a   call    KERNEL32!_lopen
# J) i# u$ J) E+ T" v/ {   inc     eax3 v* n; l! ?) n' ?
   jz      006505ae                  ; not detected6 J8 F  W/ @) g8 U' D1 F% N6 [
) v% h. c4 ]' Y. e

8 ]* g- y  O6 O# Z__________________________________________________________________________0 _, U3 U5 S' I0 ^2 y4 w+ Q% A! {
" {7 w% G  V9 J; @! f4 i$ C6 E
Method 12; q/ ^+ D9 \, K/ v! y5 x3 t% S8 ~7 a
=========
. n. x( F: j$ {/ Q) }9 A  ]" O7 p) C& `& L' n
This trick is similar to int41h/4fh Debugger installation check (code 05
7 y7 z2 }, I, ~2 C: c&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  U# |$ O2 X* l8 O  ~$ J6 Das it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 T5 W) n* V7 S/ F1 r( `; J  x4 Z! D* g5 a
   push  0000004fh         ; function 4fh
- H- u8 m  M; ~- U  ^' u9 R   push  002a002ah         ; high word specifies which VxD (VWIN32)6 ?' ~) f0 h$ L0 L7 j: m
                           ; low word specifies which service
! r+ v6 h: d# Y2 `                             (VWIN32_Int41Dispatch)
! J/ T% J$ i; J" w; [" G   call  Kernel32!ORD_001  ; VxdCall  ~$ H6 o; N5 n' w
   cmp   ax, 0f386h        ; magic number returned by system debuggers1 e" O4 E. C1 p. R
   jz    SoftICE_detected
, `& g' O; z; O; ]0 h5 A7 o# _# S7 X3 V9 M+ A! y
Here again, several ways to detect it:
, K  D* [- w: U% \; a$ K1 {# l1 }% W7 L5 q; K
    BPINT 41 if ax==4f
8 c. I. F; M1 N+ S. u5 ]; F9 Q2 U, @+ h  \, |0 b
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 J  t5 y: ]/ }7 t

; B3 {- r3 M! j6 W( E& Q4 R    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 A! @. C2 d# |2 b* |
1 e) u. R' ~/ H4 K3 H4 B, h    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 _$ O8 S+ z1 R! I0 d- P

( k) b/ P. I! D5 [2 }) Y__________________________________________________________________________% V" q4 I5 t2 x  b0 d% W. \

" ~) O; f$ d, E6 xMethod 13
8 q" j6 ^4 I" z! ^=========
$ r: [2 M0 W# Z! V8 _
0 y( }. ~( P3 m0 cNot a real method of detection, but a good way to know if SoftICE is6 u0 H8 l! [+ U# v; H& P0 \. o) P
installed on a computer and to locate its installation directory.
0 x" e7 J, D* T$ EIt is used by few softs which access the following registry keys (usually #2) :
$ _; u' R, N3 ]( j! v1 a* Y
! ?; R9 L4 [0 g( G- R2 k3 \-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 a" k9 y% g/ e3 D\Uninstall\SoftICE
. {  ^( M8 U5 ?2 [  G2 p# [, U-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- L2 I, }# V: _2 T2 O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. J; t0 }4 T6 @3 ~/ P\App Paths\Loader32.Exe
9 e. i, E: l# i% y, w
# I1 y9 }4 G, Q2 J; u
/ l$ p) ?( e* BNote that some nasty apps could then erase all files from SoftICE directory
2 m9 A3 P4 a. s( V  l: g! i6 i(I faced that once :-(' ^8 c3 j' L2 t& {; R
# v# f5 A/ L5 z# ~" e
Useful breakpoint to detect it:
: O2 k8 \2 ?2 m0 C$ i, k) f7 b/ }% a
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ U( o: p& d( Q- d& T! m, _
+ O9 b* @2 |5 [& K5 `__________________________________________________________________________
0 s& X; l! v( R3 m& c/ J: W
( |, E9 P) P- p6 f9 J
) i9 I; a' m9 G; w% z3 uMethod 14 1 \9 K7 Y" m+ o! g7 M
=========
2 D2 }" q- v  r7 H9 ]" ?9 p0 I, J  i6 A. k6 V3 b2 H8 y; W, `
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 k0 X& n$ n5 K* `is to determines whether a debugger is running on your system (ring0 only).% L, |  P, S4 ~2 H8 m) w

' k0 M6 g* e0 A* x   VMMCall Test_Debug_Installed
7 }& q+ a" S. J# M0 [" \5 [# d   je      not_installed! A% i. ^7 }( j) ~

9 z3 H! D* B3 i5 RThis service just checks a flag.
8 D% F5 C4 W/ _5 Q0 R8 |# Q# [: h</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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