About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' }& _% N0 _( {6 W& e
<TBODY>9 m& l. L- `# u( y# T
<TR>4 k! O% ^3 \. }* V  A0 c' W$ l
<TD><PRE>Method 01 1 N( H  l% ]5 `: P" A; z
=========
: B& F( N0 Q! l' N0 X, K4 K: Y$ R4 \& }  \# ^# n) A
This method of detection of SoftICE (as well as the following one) is% u4 S" ]! I7 W
used by the majority of packers/encryptors found on Internet.
( O  ?% E3 e4 R- m8 {" XIt seeks the signature of BoundsChecker in SoftICE$ w2 v+ {2 F* P9 M

- A: Q0 @/ B% B) r( S* N    mov     ebp, 04243484Bh        ; 'BCHK'
( @% c4 x! c0 H8 y' n; Q0 e    mov     ax, 04h
) g& b+ T. C* }    int     3       : x, O- H+ s' L3 \+ {
    cmp     al,4
* Q4 E' t9 ^; _' N3 w4 k" D    jnz     SoftICE_Detected
7 f( J# w& U7 t5 r# F/ \4 M8 j& Y, f$ Y& O3 p
___________________________________________________________________________$ o6 ~6 v3 _5 q3 }/ G- r2 p+ O

- K4 y" P; k7 D0 T) z4 @8 w& G8 xMethod 029 N4 {, ^5 z0 F6 x
=========- ]7 g$ N% N! Z& _: f

+ d5 X% E0 l. u$ I, gStill a method very much used (perhaps the most frequent one).  It is used
2 i+ Y5 M* \6 A' J! R( Fto get SoftICE 'Back Door commands' which gives infos on Breakpoints,: e7 @0 h' @# j; P% x
or execute SoftICE commands...
# n. O- A! N: ~5 \It is also used to crash SoftICE and to force it to execute any commands
0 ]. v' ^+ U% F$ C1 }, e- D(HBOOT...) :-((  6 ]2 N% U8 T9 f1 P; h

2 `) v! x# v( C$ I) m$ x: F) LHere is a quick description:  Q, V' |5 d: S
-AX = 0910h   (Display string in SIce windows), a4 y2 k" a# P2 m, u/ [& j
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- \) F" d4 e+ q" Z
-AX = 0912h   (Get breakpoint infos)
  n. }' S( z5 V8 D5 o-AX = 0913h   (Set Sice breakpoints)2 `% T3 c. l+ T3 L; @: x5 K6 L0 T/ D; D
-AX = 0914h   (Remove SIce breakoints)
) H' ~+ w. p, ^* J1 y: f; Z7 x0 u9 P8 n/ ?6 `- `9 @  b( X- ~
Each time you'll meet this trick, you'll see:1 Z7 k) @3 t$ @& o! o( Z
-SI = 4647h
3 [  ]# M3 [: T. {3 B8 U-DI = 4A4Dh
, W9 {& }% h2 r1 i  \Which are the 'magic values' used by SoftIce.. d+ {. ?& S7 F: d  c5 m7 Y4 D6 J; @
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 d3 Z( s; q$ D3 ]; h
& }8 b. c0 V) ?: K8 @/ u
Here is one example from the file "Haspinst.exe" which is the dongle HASP
( Y4 C: _4 ?8 [Envelope utility use to protect DOS applications:) L+ b( J" v& Y( h$ [) M
$ e+ `& _% @, l. Q2 B0 c
3 q7 ~6 g5 Y$ P' p4 G
4C19:0095   MOV    AX,0911  ; execute command.
8 O1 ~4 J" e) R( F& q1 r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 D) a# F# ]3 |4C19:009A   MOV    SI,4647  ; 1st magic value.! C# S1 R0 s0 Y6 o3 k" o
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: K4 v8 D: H, {
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# p1 _/ d# N! j- F1 ?
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute, n& ]- I7 C' y" L# R
4C19:00A4   INC    CX3 H) r, _0 u. o1 H/ A7 q" k
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute3 `5 n2 P- z" @: E2 Z, s- e
4C19:00A8   JB     0095     ; 6 different commands.9 Q  r1 Y5 N6 h# P9 ^" f' `
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 y5 x5 F% _$ @1 [, L0 u# R
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)) c3 Y2 Q0 o1 o1 H& \5 x, s
) n0 a* Q( U: ^& h4 u* Q* k/ N# q+ e
The program will execute 6 different SIce commands located at ds:dx, which9 J$ ^+ e* A& j" B1 J
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT., d1 n0 I# ?$ D
- s" D" F  c4 }7 a# j) L/ B
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 P2 e, O2 L) n8 B6 b
___________________________________________________________________________  Y5 }6 M0 |: C3 Z

* _% H' x. q5 k% \
# e" m0 i- [) M, RMethod 035 }1 b1 H/ c4 h- R$ U- q. D2 D4 r
=========, p5 M. m1 ?( G4 [. D. Z

+ I% x% x3 ]8 p# q0 V) qLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: t7 v2 R5 U$ U(API Get entry point)3 L; i6 N9 d  o  F6 R2 F" b; n
        
$ ], I. {; d' D2 S
7 [* r- D1 E' `+ D5 j    xor     di,di
; v/ z# ~5 L5 e8 g  Q% E0 I    mov     es,di
" Q: N& [$ P- f0 W' V4 r    mov     ax, 1684h      
; u& p4 e/ Z: X3 `* N4 S    mov     bx, 0202h       ; VxD ID of winice7 t( R, L, b2 u3 D' r: B, D
    int     2Fh
1 P& _9 z& G# q8 o! ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  q; p9 q* H. D! {5 z, v% C    add     ax, di
! t( V0 I, N) W1 q/ n7 o# R' N& t    test    ax,ax
, b# Y4 v. Q% Y) _; E+ |    jnz     SoftICE_Detected; n+ E5 ?( M# q2 e7 o! ^3 a
& E7 W: x9 t6 q' I& E1 o
___________________________________________________________________________+ S5 }7 x/ U/ b! g& Z- K, q; B
% i( v% ]4 T( z
Method 045 j3 R) n4 z3 X
=========; @5 g% |9 _+ K% Y4 r* Y

! j- K- r  `2 J# s+ CMethod identical to the preceding one except that it seeks the ID of SoftICE
$ `. o2 F! ?& a5 h& \- ?/ H' F8 CGFX VxD.
  s9 Q1 W8 n/ A
- A; L6 j3 X; _# C- h    xor     di,di
- F% E3 o' r' M/ t, @( F9 W    mov     es,di
/ l" ^: w; M7 D* U  @" k' \! U    mov     ax, 1684h       3 i: _- a9 r* ?' s% l( V
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( S9 F1 r/ v( G# a3 w    int     2fh. ?+ _* O/ `3 J7 v  i& `
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ B7 j0 y1 z' V/ e  B! S$ i    add     ax, di. _/ b  \; N" y$ h
    test    ax,ax
: ~# `6 F; K* ?! A8 P    jnz     SoftICE_Detected
- r5 T. b0 ?, R0 ?7 L- N5 ?* d
9 ~' U7 j: y* N; p__________________________________________________________________________
' i/ a2 v' v4 F/ S. }6 w0 e
$ `/ m# }0 G, J: h& q7 Z$ m7 n! I2 N9 u0 W1 @, x" C
Method 05" n, x. }7 e1 M3 d% ^, w" W! A
=========
* b1 i* o4 H- F" Q* h" Y
* x+ ~& e6 [3 z" w8 k: [Method seeking the 'magic number' 0F386h returned (in ax) by all system  }$ ]+ f& B' E7 r. [" U; Q
debugger. It calls the int 41h, function 4Fh.
+ P6 f# Q" [/ \7 Q( Y/ s. YThere are several alternatives.  + \6 \2 o2 b' D; c% f1 O( |

% \7 l; R  m0 ]; R' x% rThe following one is the simplest:% P" w8 i, W$ y( ?
& @: X9 ]' F: b/ s
    mov     ax,4fh  T! X, @/ n( ]4 E0 ~* P$ L. y
    int     41h, I0 Z" `/ [7 Z3 X" w
    cmp     ax, 0F386
; E0 n4 }6 e" p, x8 S+ N    jz      SoftICE_detected
$ R/ [8 ^" T0 A3 R8 ^* h
4 w6 t& n( @" h( F+ ?# D+ n) s3 G$ V, ?% ^3 e
Next method as well as the following one are 2 examples from Stone's
- y. ~6 }! w9 t+ b: Q! q"stn-wid.zip" (www.cracking.net):. c0 t2 w* B) F- S/ O  A6 l
3 v$ j2 ~( w. t1 {/ E7 O; x
    mov     bx, cs+ ?; Z" `7 r4 z7 S2 ^$ |8 t
    lea     dx, int41handler2- d  k/ j  A6 W0 w8 \5 ?
    xchg    dx, es:[41h*4]. F' j: |: y( Q# |/ G2 E5 Q. t5 B
    xchg    bx, es:[41h*4+2]9 ?1 i+ D" w  j* I# q1 _
    mov     ax,4fh
% h' [: |7 S% t: P7 }  S; d    int     41h3 p' v9 r& v  s% p' m6 u
    xchg    dx, es:[41h*4]
# r6 r  Y: \+ L, D7 h9 p3 c6 g    xchg    bx, es:[41h*4+2]
' M, K; V, |1 f9 p# ^  V    cmp     ax, 0f386h) R/ Z' I  A. t8 i' e/ S: A- f! P  L5 N" e
    jz      SoftICE_detected
1 p5 h9 w1 P- p
5 Y0 `0 Z- l+ q" S3 @4 a0 T- {int41handler2 PROC. _3 d1 K, ]9 O
    iret
( B1 J" y- O0 x: d: N  V* Aint41handler2 ENDP. t# J* A3 w6 t0 d5 ~7 K$ D9 ^
. W% i& M  Y) C* g

7 G1 z! k' n1 R  |1 x_________________________________________________________________________7 S6 f: {7 v7 j$ _
# k6 r% }4 U1 d4 O7 m
" S- [7 r8 k7 g* d8 H0 D1 S5 |! ?
Method 06& b: Q5 E( |& l4 a- W: ^- f. H! e% e
=========! K$ f8 F6 z# C6 @/ s
: N0 [$ x: X2 I$ a9 a
0 e' o2 v( y: b" _5 _
2nd method similar to the preceding one but more difficult to detect:
: B% c& ]: Z' ^5 m3 r" N8 N9 E6 g8 [& l* J

2 E; s4 T& x7 R: H: H& k, ]6 fint41handler PROC* a& h- ~3 ]9 P  e! E! x8 P
    mov     cl,al1 g; n. u/ l  k6 R$ w5 {" o# d
    iret
( X. Q/ F* H: C: N! {: [int41handler ENDP
+ V. Q1 Y" j( _; R. q- Q" i* h0 G+ ]* |9 y+ ?: A" g1 b$ w( _( E
( H$ Y4 U- e8 A9 D8 R% |# K
    xor     ax,ax7 c5 N# x; |1 A$ n) l$ ?5 [
    mov     es,ax
) h; Z4 o9 d9 j; e% V4 g& h4 Y- q    mov     bx, cs! y4 |- F) J0 @0 H
    lea     dx, int41handler! h6 R+ z) a. {( o3 v
    xchg    dx, es:[41h*4]
" v# r  T- S- ]" w* M* E% N0 X    xchg    bx, es:[41h*4+2]
% Y' `" S+ ^6 Z$ k3 ]    in      al, 40h
  [' P8 r; ?5 w6 V    xor     cx,cx# l* R6 [! B, `' _- j( @! M% W
    int     41h* `5 _& x0 C7 y5 `, m, I
    xchg    dx, es:[41h*4]9 M. L. J, ^  H+ i2 Z) [0 ~0 k
    xchg    bx, es:[41h*4+2]
: O1 k7 M- Y9 l1 V6 U    cmp     cl,al+ k6 x3 U; a# U1 K" @
    jnz     SoftICE_detected* Y  U" L8 R& ?  O0 I- D/ K2 u, o

2 M% j4 o0 c& a- u0 R% F_________________________________________________________________________
6 a+ v0 h) F6 H/ R6 [/ [
- g3 \6 A9 I  L1 k$ O2 M+ M) k+ K" V9 x/ QMethod 07
: D( o) Z1 e* R1 }9 k=========
% [/ X, \2 L, y4 ?  f1 l+ D4 G5 Q5 a  t" ?; p' v2 b" @+ z4 R6 J& k
Method of detection of the WinICE handler in the int68h (V86): }7 r2 {, [3 I  _* n) M
0 O7 s0 d, z3 H
    mov     ah,43h
* ~1 y5 a0 j8 V  ^2 [% d* y    int     68h
/ @0 J! ~. F4 m# P, ^6 u    cmp     ax,0F386h
/ K0 h# U$ T3 K: J% o    jz      SoftICE_Detected
5 g& s/ _! ^9 A& ^; ~  t  Y5 r. D! L) z* v$ o% i2 C
+ b% ~, I# m/ _) C6 }
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ j3 O9 w( o: s
   app like this:
1 |7 Q+ E. e/ ?* k$ L3 @, L0 ?, m. Z8 l, Y: r
   BPX exec_int if ax==68
  d) c4 ^+ {9 T9 ]- }" t   (function called is located at byte ptr [ebp+1Dh] and client eip is
$ y3 y8 g2 r- [+ ]8 e& i2 L   located at [ebp+48h] for 32Bit apps)
0 ?4 [" Q! Q/ A__________________________________________________________________________
! \) h: s, D6 N
( A8 |& m" M. G2 N; D7 J8 p- U. m* g9 P4 L, H- j
Method 08& {- V$ M. P$ n& k
=========7 l& u- v* D. y7 V- {
$ m" U6 [9 j+ I- v. Z. |
It is not a method of detection of SoftICE but a possibility to crash the
; N: [: e& }- a, N+ C8 f: F+ I7 Ysystem by intercepting int 01h and int 03h and redirecting them to another& x% x# O* F4 z" a5 I. I2 r
routine.
7 W) u- S" C0 A) m1 l9 g& m/ BIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 n3 K7 R  ]' k" L% g( h, kto the new routine to execute (hangs computer...)" [3 R3 R# j. F2 e2 I3 _7 p, _9 r( C5 {

- F( p4 d- P; |6 e7 _    mov     ah, 25h
! M$ D6 C) w8 w7 v    mov     al, Int_Number (01h or 03h)3 d6 p5 }% \4 t9 y
    mov     dx, offset New_Int_Routine7 q' e. q7 L  A' {
    int     21h. C7 i% g$ q) s
( a3 h$ H8 D1 b
__________________________________________________________________________6 R  {+ Z+ O' @" B$ T

, H+ ?/ p$ A2 i5 DMethod 09, W& {3 I9 ^  P$ Y0 J! M' c
=========
4 v# m2 [) |" T1 K  S' l7 R) c  k1 v. f- x3 @% G: N. h5 Z5 k2 D3 w
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 v1 ^! K& R0 o' n+ w" A
performed in ring0 (VxD or a ring3 app using the VxdCall).
" _" f. F& S2 hThe Get_DDB service is used to determine whether or not a VxD is installed
; \: V" @9 Y; vfor the specified device and returns a Device Description Block (in ecx) for
# a  v$ K' s. T* o9 Ythat device if it is installed.) ?) G0 A$ Q! \  K; V7 f

1 a: F, \7 l8 R' i" d' [   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
  F# L' R. G3 U4 |3 B   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 W, b: J1 f! P- e6 K" ?
   VMMCall Get_DDB
7 q" n: K, y6 H; x' ^( ~   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; p; W2 v, O/ D5 |9 y
5 x1 ~) ?. s- [6 X# G+ _# @% fNote as well that you can easily detect this method with SoftICE:: k  E/ I$ Q, L1 a. Z2 l
   bpx Get_DDB if ax==0202 || ax==7a5fh
, g+ y/ Q2 J' D9 B# j! _
$ a$ s6 x* [6 ]- @, M( f# K__________________________________________________________________________  p; X! h0 h+ N( e4 {& e; c

( C, _  z; {! |3 jMethod 10
  a! Y* l# R3 E0 [' a6 `. n* Y=========
6 k3 ~  Z2 K& I2 Q3 S% n7 V- S: t2 F9 l+ m7 n
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. q( R" u) g( ^; t- P0 q  SoftICE while the option is enable!!
7 g! ^; b- Y& b. V: L
  {3 j! D1 U: XThis trick is very efficient:
/ `+ t6 R" Z5 Nby checking the Debug Registers, you can detect if SoftICE is loaded' [9 |* }# I$ }1 V
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
+ P3 E) J( R; p; Y( C0 }/ ~there are some memory breakpoints set (dr0 to dr3) simply by reading their& R0 l6 s: `& F% g
value (in ring0 only). Values can be manipulated and or changed as well6 y) F; J/ C8 n
(clearing BPMs for instance)
- \. e+ O$ `+ C5 N) m* V4 y3 g8 Q) q2 K4 }
__________________________________________________________________________
. c3 m2 n2 z8 Q  p4 s
8 O4 B$ r% }! [. CMethod 11) z0 M: w  y5 z6 t, ~9 _5 W( d
=========
- D, r) o+ i; b# I+ c; X- M) }$ Z9 e! V7 M
This method is most known as 'MeltICE' because it has been freely distributed& w- s4 B/ z0 P5 r& _9 x3 o% @; f
via www.winfiles.com. However it was first used by NuMega people to allow
  ^/ ?& N6 J& J' D  G+ @Symbol Loader to check if SoftICE was active or not (the code is located+ K" S- H$ _8 z5 V! D6 d8 K7 c
inside nmtrans.dll).
- i) X' k. s6 h) d' e8 m# d: y1 b, H. G  [8 ]' L
The way it works is very simple:
* T0 |: r* t! I6 H: @It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 T% S# t  c  F- O/ AWinNT) with the CreateFileA API.4 ^/ U3 G* R0 l  C8 b" c3 `2 e/ |

2 M' [7 ~7 M1 w& HHere is a sample (checking for 'SICE'):
$ n2 e1 m/ `1 e4 ~9 o; Y' _
: ~8 u8 i& k0 k# X9 CBOOL IsSoftIce95Loaded()* D& \6 |- p% U# h# c, B3 Z
{$ c* _1 e( \1 g; ~  h  \
   HANDLE hFile;  
9 r2 _0 B# Z% r. Q9 L2 x; d   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% C9 Z- A$ }% ~1 r, B8 o- C: U' X                      FILE_SHARE_READ | FILE_SHARE_WRITE,, u) ?/ o4 d: a, z$ p: z5 N7 _0 m
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, H0 J% T5 B! @8 E
   if( hFile != INVALID_HANDLE_VALUE )
3 n1 |  c. N0 Z  _& H+ _6 V! H   {( D3 O5 I# W% v
      CloseHandle(hFile);
# z5 q, f- y6 l      return TRUE;
* l$ p5 p& t; Y( c: ]   }( T3 Q' j# A4 h( B
   return FALSE;0 I, @0 i/ m% Q. l) E* A' H: E6 ^; v0 E
}
8 r# t9 Y0 m% j. @  l1 x
( H( F0 S/ U: P' ]8 Q9 b: ZAlthough this trick calls the CreateFileA function, don't even expect to be
5 ?7 j3 C- C; t5 E6 \/ k; v/ O/ u% nable to intercept it by installing a IFS hook: it will not work, no way!- e8 b$ ?! h$ U* x0 X" {0 t
In fact, after the call to CreateFileA it will get through VWIN32 0x001F0 L- F/ O) Q3 @, `! {. b+ b
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)1 S$ u, h. [! m1 g0 e9 ^4 H
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
- b- K; \6 J8 U8 H3 C' e3 E) ~3 t+ Gfield.6 G* I1 T9 j- o0 r5 E, z
In fact, its purpose is not to load/unload VxDs but only to send a , r3 Z$ t3 G4 U% M0 Z
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% K- u3 d8 t; C9 Qto the VxD Control_Dispatch proc (how the hell a shareware soft could try' P/ @% Z! b$ L# J3 r9 ~
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
- O7 z# U& \. _4 IIf the VxD is loaded, it will always clear eax and the Carry flag to allow
' b7 f/ J7 t  d3 d: u* @8 O: i5 Iits handle to be opened and then, will be detected.
- {$ f# X9 i# ?/ o) KYou can check that simply by hooking Winice.exe control proc entry point6 p+ ?& K& {8 o* J
while running MeltICE.. ~& w# p2 h7 T5 p4 f& y
; z) h3 T' T. c" Q' t( w
& }* A' T0 @6 |% ~8 s* d5 _8 k
  00401067:  push      00402025    ; \\.\SICE5 Q. i( l6 J8 e' O/ ~4 _8 s
  0040106C:  call      CreateFileA
! Y  S5 A7 h, F  00401071:  cmp       eax,-001% c+ e+ G6 Q% f) g4 K) x
  00401074:  je        00401091
, ?( N6 B. @3 i" x6 q: a: m0 o6 p
! X# D8 d0 z9 ?0 U4 A1 x: s
/ m# W" }0 J4 _% y' b- }There could be hundreds of BPX you could use to detect this trick.# ~5 F+ s' v* |2 J
-The most classical one is:; p0 f1 x4 t% E7 F% z  L# Z
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
# p2 {+ y6 j3 E, o& H: v+ W    *(esp-&gt;4+4)=='NTIC'
5 q8 ^) p% w+ L1 r) G; d
" v! \+ B& _+ }/ T5 k-The most exotic ones (could be very slooooow :-(# j) U( S; q) j- W7 D) Z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 j, a! ?- ?' V4 ^# H     ;will break 3 times :-(
- J8 F- a' Y0 i, E* {4 I8 c6 ?' k2 f  Y
-or (a bit) faster: . X- b. |" c; f7 k- R; a
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 k7 Q. q* q6 E+ c+ x
8 T# z4 h$ n0 O4 p' b! b. ]   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  , s; E1 C8 s! Z* }9 l
     ;will break 3 times :-(
' x$ H/ u2 |3 }7 A; I( B/ F/ ?, ]- v
-Much faster:
1 E( ~) C) t: k2 I   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% f! z# S6 I. @2 n7 `& U# A& [# D
) `  \" z8 c+ A+ Y* G' W
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# l8 b6 ]: A/ G6 l1 _3 ]% U
function to do the same job:
. Q3 C. ?. a) g9 j6 N  p/ U- }9 m* L5 n% R
   push    00                        ; OF_READ
( B; S$ t, v; _4 o# j# u1 @5 X   mov     eax,[00656634]            ; '\\.\SICE',02 |! O6 u) H7 B- N
   push    eax
) r0 i9 D% v) h4 K0 l. w% E   call    KERNEL32!_lopen
2 V3 ]" c* u% A/ H& W   inc     eax
+ S4 x& M1 o) W   jnz     00650589                  ; detected4 i5 ]% u% P- T' c
   push    00                        ; OF_READ4 R6 e# q& s! p. H- k1 |2 @
   mov     eax,[00656638]            ; '\\.\SICE', |7 }* z  t% w9 U( p
   push    eax  o6 n2 E) A5 O) ~
   call    KERNEL32!_lopen! u! U$ c0 t7 R- ]3 J' ]' I
   inc     eax5 v% u! j9 N+ ?* @
   jz      006505ae                  ; not detected# b  |6 L5 ?( s

3 c! @# Z. F0 {7 G# D% `1 g
7 x! b7 L+ _3 I% l& H1 }9 G: n__________________________________________________________________________# I# N+ X# ?; [" w1 |) c' U
/ }& W  p% R' V" k# y0 |
Method 12) v5 _( C4 w, o! C. ?( A" v3 q6 I0 l* p
=========/ u' D& {- e5 e0 h, v

1 W9 E' F$ S7 bThis trick is similar to int41h/4fh Debugger installation check (code 05- {* n' O0 X; s0 P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
7 j7 [8 J+ i) @# F1 ras it uses the VxDCall backdoor. This detection was found in Bleem Demo.6 T6 @1 q6 q7 W5 f+ g( D6 P" g5 F
- P- j& K, [* L. d8 }! l; z' P
   push  0000004fh         ; function 4fh
0 O) @! s% X! V   push  002a002ah         ; high word specifies which VxD (VWIN32): O* u0 T, d3 T+ B* U! }, C, A
                           ; low word specifies which service
8 q" Y/ t7 x, P6 {                             (VWIN32_Int41Dispatch)
' U$ Y) _3 C7 G! ^   call  Kernel32!ORD_001  ; VxdCall
: Y8 W; _/ L) Z) N- f  T$ H! g   cmp   ax, 0f386h        ; magic number returned by system debuggers) ]( Y% `, Y, |( G/ s5 Y8 G
   jz    SoftICE_detected
# E. }6 Z5 S0 U9 P6 l9 {+ U) `5 {0 j* B. K( V! S: R# L2 N6 W
Here again, several ways to detect it:# e4 `' A( x" m; @

* N5 `3 @3 C) a    BPINT 41 if ax==4f
$ W) V! y1 `. r
) y( w1 z; d" p* D0 D( z2 g    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one6 K' P/ v+ A/ g; H6 |

0 l: b/ S" v: t8 y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* _1 O7 j. i- C6 K9 @
- E) B1 z3 ]  _4 P4 J    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, L# C+ [: n, i6 u' ~) c

. x) ?1 ~" `4 z# r2 F* L__________________________________________________________________________
; e2 t- J+ y9 x) r% R3 V' A. y8 r8 I% W0 C* @4 L8 \
Method 139 c8 L+ q  ]+ O8 W; \# t2 `+ T# ]
=========8 b/ X& p, r  m+ @: \/ p! t+ v3 G

2 }+ T4 }# s( p* NNot a real method of detection, but a good way to know if SoftICE is
3 n+ z) f; I4 G, x$ Sinstalled on a computer and to locate its installation directory.' x/ ^' B% T( K* J; ~9 ^
It is used by few softs which access the following registry keys (usually #2) :
, E* O9 j0 I, N9 N7 ?
% l' i% k4 Z5 P( a' Z-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 u7 d1 \8 Z  k+ @$ V\Uninstall\SoftICE
  m/ p  {: z1 `# r0 n-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) n4 G9 m1 G" Q1 e" @
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' j9 C# y5 H8 D! u5 `# U3 K
\App Paths\Loader32.Exe8 a& `( ]) O) b3 J2 _
1 ]- H3 q+ S# p9 j" Z# N+ X
: J0 f% V- d/ e- y) B' i5 V
Note that some nasty apps could then erase all files from SoftICE directory" \* r2 y% x1 F" Q8 q
(I faced that once :-(" G" U2 X% j" m

5 B/ T1 @. H7 GUseful breakpoint to detect it:
8 M1 m4 m9 z& Q! V; r' \7 U; W$ K3 c4 x; H; s2 t9 p
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ N; }+ m1 ^& F( K
* s, B7 y. z, o# E- h( R$ ?+ g+ I, e__________________________________________________________________________
+ W4 o2 @& R5 [! z2 r7 H7 A& N. L. k) Q+ T) V9 S3 ]8 D  P

2 n% W$ B/ c, S* T2 {Method 14   P6 q' I& J: w  m
=========0 x7 q$ m7 X  n2 J

/ Z' G# ^- i, U: T9 J1 K# j, S. \2 p- iA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, {" v: x6 J" @2 \! W, T' xis to determines whether a debugger is running on your system (ring0 only).
3 ~# l' W7 U9 M" w- [& h  S" d: p7 ~7 X7 {, q
   VMMCall Test_Debug_Installed
5 V) k/ P; Y/ i- C8 B* U   je      not_installed/ j, h6 j/ O) R  K$ F

, H0 D5 l  Q- ^0 a; w& wThis service just checks a flag.- y7 A5 o$ e7 |
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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