About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
5 _1 k) k% `8 V" P# e5 ?<TBODY>
1 [, {- L; c. N) V5 v; j6 l<TR>
2 \4 T1 u/ T' O" F1 E( Y<TD><PRE>Method 01 - X6 v. F" f6 H5 Y* c6 x
=========6 B' Q' I3 c9 l
# u. r  ^1 i5 p: h3 K6 Q
This method of detection of SoftICE (as well as the following one) is7 k3 i! A0 z) T8 I- w6 ?
used by the majority of packers/encryptors found on Internet.
& x" g6 r; s! @0 J# X5 ?It seeks the signature of BoundsChecker in SoftICE
" G. L/ @' |/ I. W* |& ~) f, ~9 M* P+ a9 d! j
    mov     ebp, 04243484Bh        ; 'BCHK'
) i& y" X0 z$ m    mov     ax, 04h9 r! i2 A" P( @& M- ^
    int     3       5 V  T+ I1 `( v- c
    cmp     al,4. e! k0 E' k/ y+ J0 b  v& x5 N( z
    jnz     SoftICE_Detected
- @& W* }1 @/ z& Z1 w. M( I
. H  U/ T- ]) W7 I" u___________________________________________________________________________
0 I3 v. ]0 x* \( w: p( r
5 U$ x& U* B5 b" B$ x. DMethod 02
: T' w! X4 Q/ i2 O3 e. u7 g* ~=========, V/ w, h! @6 l( z5 X2 z) l( S
% g2 l' B! G" U3 m+ n" }/ F
Still a method very much used (perhaps the most frequent one).  It is used
5 N1 U" K$ K5 u8 m1 }2 a3 b7 H/ \to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# z2 N: f! e: x1 lor execute SoftICE commands.../ ]6 }5 I- a+ ^  \6 r1 r3 b8 c' z
It is also used to crash SoftICE and to force it to execute any commands; Q" o5 Z% X0 t$ _+ N
(HBOOT...) :-((  
0 N. f. K2 X! }+ B) G0 O, ?, q) T/ u4 P: J( O1 ]( y' S
Here is a quick description:' e" C2 k; r7 J1 R& t. k! S) k
-AX = 0910h   (Display string in SIce windows)& Q" i8 b  J5 a* w. R2 V
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
, a8 e9 n- R3 l$ m- U7 ~5 u-AX = 0912h   (Get breakpoint infos)' ?9 B8 N) I) r8 [; d( I2 ?
-AX = 0913h   (Set Sice breakpoints)
4 q1 a3 O, B0 Q" }6 h: `-AX = 0914h   (Remove SIce breakoints)! F( @/ Q$ a, L* V4 P. \
6 f5 `5 n/ W3 E% l5 M- {
Each time you'll meet this trick, you'll see:( b. Z7 V' _" ]( n
-SI = 4647h
5 t* h9 P, g: w5 I9 ]9 k4 o6 G3 C-DI = 4A4Dh
% s/ I: ?3 S& o- p6 Z! O# j8 `+ qWhich are the 'magic values' used by SoftIce.
* J: m- }6 u5 u3 ^4 x9 ?For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 B3 |; |) }8 _- [) i) d$ y  l! W: M3 x+ W) ]
Here is one example from the file "Haspinst.exe" which is the dongle HASP
' A+ k3 P2 R0 ]9 r  L3 TEnvelope utility use to protect DOS applications:
4 y! @- ?* J# }7 _* d+ ]$ ~
+ F8 D- V( M" U3 q( R; A9 q% z; V
8 P* G! H  d2 D4C19:0095   MOV    AX,0911  ; execute command.
2 k& p; Z1 r/ M% y6 M4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- j( T* Z- r8 l3 i, c, t% T; ~
4C19:009A   MOV    SI,4647  ; 1st magic value., \  U1 Z" ]: i0 X! Z! j& w  p( \$ b8 a
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.' n, B" I: K4 w$ x. w$ y
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 x. s4 p9 Z- ?; f1 V4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 ?/ b4 m, D1 _* N; K2 W4C19:00A4   INC    CX
8 P: S3 s* T  H/ \, s4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
8 P1 [( p& |' ~: s' {! ~7 R# I4C19:00A8   JB     0095     ; 6 different commands.8 D% r5 Z/ m* R* d8 x+ g
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' G* k8 j8 @, J. D
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)2 n4 A+ X& y; \5 G$ d

/ D" I4 }; t" |/ _  VThe program will execute 6 different SIce commands located at ds:dx, which
& v. J" u# T7 o! b7 Zare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.+ c+ j- ]3 S& Y

; c/ G- O/ r3 R* H" O5 G$ f9 Y5 a* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.) d5 o- i3 s8 \8 [( [8 {
___________________________________________________________________________
% p7 U0 Q7 w: N1 u
8 A. d1 N/ v" C& o- b8 L3 P" V1 \+ W6 L7 J7 ]9 @7 p
Method 03
! @2 {8 L" o, \8 c  }. t8 L  |=========4 ~' n& P& P7 w( L! [, t& o: \
! e1 J) `( \4 l# v  h) _
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 Q4 }  G6 a: Y6 q- u* r1 P(API Get entry point)
7 g% L- T5 w% T' R        
- |; S6 h3 m- l, t  e3 q1 H8 R: {: `9 X" T& E; r
    xor     di,di" c- b% e0 D4 k: u& c1 B
    mov     es,di
3 b, W8 u+ i* W* J; A0 \    mov     ax, 1684h       $ H: H% c  s- F
    mov     bx, 0202h       ; VxD ID of winice
7 q& h) N3 T! j8 t( A3 B    int     2Fh6 [- y4 ~. g$ {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ I) ^7 K- ~# g5 ~& u; i
    add     ax, di8 Y; _8 S+ d: X& i4 y: Q. h* Y" X( k
    test    ax,ax
; H( R, ~+ t$ ?! {/ z5 V    jnz     SoftICE_Detected
4 s, ~' ~2 Z( ?! ]" ]6 F$ Y% r- s8 P. E" o- |* H
___________________________________________________________________________
# v0 [8 |3 X! ]# a4 V. E3 t0 R$ K- }/ g: u% J- I' P3 s2 v) B
Method 04/ Y5 }$ `& l* o
=========( E' i/ u9 a- X: p! ]5 @/ `

/ u% Z; F* t0 l% L! q! m5 l2 H1 RMethod identical to the preceding one except that it seeks the ID of SoftICE- `% m1 `* m5 u0 y5 w0 R% ]; j
GFX VxD.9 p4 O0 E, ^1 f* f  g

. R4 {2 N* i( ^! W. C0 `8 G8 }    xor     di,di2 t9 B, p& a+ u  u/ B- K4 T- }
    mov     es,di, o( G/ u* q8 n1 B# X; D* F
    mov     ax, 1684h       ; r( g# c3 [: a: n3 T) ]7 d
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! H/ O# w6 y& U7 ^6 ~9 D. L4 K    int     2fh
4 Z. Y7 N" E1 ]1 v/ V( x- B+ n    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 p6 N( i3 C. }; h: C4 X8 x3 L
    add     ax, di
( j3 I* i- }# X' F4 |2 F: L    test    ax,ax
# j6 L% p6 T9 h    jnz     SoftICE_Detected- S9 @4 W5 H- A' v% ^( S

$ U( \) n* K# ^. B. I__________________________________________________________________________1 l+ O& H7 Q8 B  g& _

" v9 W1 O4 X3 @: ^3 y1 S; t4 ]- O/ L* Q0 c
Method 05
3 g; G% M) k4 C0 J=========1 d4 p# Q# r5 m. x& s( h
& U6 [( F; K2 w; C% z
Method seeking the 'magic number' 0F386h returned (in ax) by all system  V% r' e' L& p1 a; _
debugger. It calls the int 41h, function 4Fh.
+ ]' ^4 H! Y- O8 y" A8 wThere are several alternatives.  % T/ W+ D7 b, g7 t1 k
6 F- B) V: B* u/ H! k2 V' K2 C
The following one is the simplest:
+ {8 H/ N9 l2 o* N* o" j3 ^; F! N- a. L; g+ D9 ?/ G9 B& F2 L: r
    mov     ax,4fh7 l, n' A7 Q. Y' U7 v
    int     41h5 [$ v  G' D( X- D0 c7 `9 ^1 @4 d1 I
    cmp     ax, 0F386
5 e. }& N+ _" U: c# v  s. k    jz      SoftICE_detected
2 q' h& T) e' T- m+ v# f  }/ F7 g" g% K7 ~3 }! l
4 d; }5 Q1 o& y' c. w  F
Next method as well as the following one are 2 examples from Stone's ' h6 J  ^7 q. _+ Z- |
"stn-wid.zip" (www.cracking.net):, V) G  f/ G8 G# g  K" S  d) F: o

3 V/ ^& g+ z) c3 y7 E3 Z5 g. w    mov     bx, cs  Y$ i  ?' w& H& Q# |/ L0 {
    lea     dx, int41handler2
8 s7 X# {" T! Z! U, {    xchg    dx, es:[41h*4]) w+ i) y2 }/ H4 D# D  k9 B
    xchg    bx, es:[41h*4+2]* T/ s+ ]4 R2 G4 p  I- t7 _/ u
    mov     ax,4fh9 j" z5 g0 A2 A% s; y4 ~
    int     41h
% L4 }# w+ R& Z( `  A    xchg    dx, es:[41h*4]
* b) ]  @. N- y$ u3 n    xchg    bx, es:[41h*4+2]6 o7 R' c; f/ M% p! l9 p
    cmp     ax, 0f386h
5 ~- {+ s( b( n3 N    jz      SoftICE_detected
' r. s& E: N7 |. m( m3 Z4 N* R
3 B- W' r' [( z, _7 W% B6 ^int41handler2 PROC
5 j, I: _; o$ w/ q1 w    iret* ~# O1 A7 |5 \5 n& F% C
int41handler2 ENDP
! {( B3 o3 c- J
' T+ V) p6 s" C7 g( w7 F8 u: m. Q/ r' g" X
_________________________________________________________________________
5 |8 B: L8 D" Z, U- l! @$ [5 n. Z) Y7 \% N9 b
9 t/ o0 M  l* c8 j' I; o" P
Method 061 o( q# \3 h" E  C; S/ Y/ I. f
=========. x) |2 v: _# \& q% `  s" _

# E$ g8 [" c) d1 E
1 ^- h: {8 F! K6 X2nd method similar to the preceding one but more difficult to detect:" E3 Z9 a( v( N
2 Y; z9 o' c5 M4 M2 ]7 C- Y

" l3 q' V7 L6 }int41handler PROC# M, T* f5 r/ P
    mov     cl,al4 W$ D. J; H& W) k
    iret
- o( r8 Q/ i9 f! B; c' A  o. Uint41handler ENDP
! F3 x2 @, N, C6 `4 i1 g+ B: ]' K. v8 m5 c& {) G8 B9 d

! h/ |9 e7 V; H0 m% z" I5 v- H    xor     ax,ax. U. G( f/ ?5 _) f
    mov     es,ax
5 C8 l; H& L/ P+ N    mov     bx, cs
4 w, \, l+ B. J& B6 U    lea     dx, int41handler
9 G" x3 ^% b6 u1 s4 M( l    xchg    dx, es:[41h*4]0 o- @0 z! {# P! J0 a
    xchg    bx, es:[41h*4+2]
% l% x4 N2 B( _2 y) ]0 L    in      al, 40h
+ f8 T' E" w  N4 s3 i0 Y    xor     cx,cx
$ |4 v: Z* ?. z' b    int     41h
) d% j6 ]+ w! ]5 [0 q    xchg    dx, es:[41h*4]
: \0 ]' [0 e7 z- l    xchg    bx, es:[41h*4+2]. o) D9 I1 s, \. n. X
    cmp     cl,al7 ?4 s8 R' E/ }! O8 H
    jnz     SoftICE_detected
. N* n/ b& [, `
5 I' m( ^8 [7 `, p* }_________________________________________________________________________7 C" a) u" H& ^/ e- l# P* @

7 k6 S9 Z! N8 D& DMethod 07. t  q* l" K$ n/ I) T* K8 D
=========
" E5 f, G! a# d$ W0 i, S& f: t5 Q8 m1 \
Method of detection of the WinICE handler in the int68h (V86)
! P( |, z0 U- ?6 P# H  L  l. V0 t: {  s' C1 H' o  S
    mov     ah,43h
* G1 q1 L: p7 b    int     68h, `7 r5 U6 ^2 ^4 v' D
    cmp     ax,0F386h3 A3 y. b; a; C& e; I  i3 A+ g( Q1 M  I
    jz      SoftICE_Detected. J5 K0 \5 y* b  U- @  [* O4 k; i

1 w4 o  t% G9 h; n' i' T$ ?' m* l
/ n. p+ `, c& n( I( ]* _8 G=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% o! ~9 o1 k! {% m1 w6 T
   app like this:: u" ~7 K4 B- K0 _. B. Z8 N
. ]6 f2 B8 t' T+ i4 U7 c% ^+ n
   BPX exec_int if ax==68, [5 L+ T/ T' N& Z
   (function called is located at byte ptr [ebp+1Dh] and client eip is
( a; {0 b+ d0 s+ h   located at [ebp+48h] for 32Bit apps)
- r! @2 e: W0 Z' @% o__________________________________________________________________________
- n9 \1 o3 {+ U/ Y: x8 |* n8 R4 x$ K' h  Z: y4 A/ M

# r$ s5 y4 S9 ]5 cMethod 08
6 t+ T! p$ a* u# P, V! W3 d=========0 P3 z" e- b) ]- X+ J  i3 a
3 M9 p/ g0 z# H$ B2 q
It is not a method of detection of SoftICE but a possibility to crash the  U6 x; m! J: Z; M* L
system by intercepting int 01h and int 03h and redirecting them to another
' P9 V' s  i+ M, [5 }/ ?& o( Q# Nroutine.5 V' c! t) Q/ W/ A& @
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points4 _% P# }' _! Y/ l! ^$ \  ^
to the new routine to execute (hangs computer...)' e$ w; `& p. r* l5 ^

- [' E4 s& s# [4 n    mov     ah, 25h
2 p/ l& D' M8 `4 X$ S    mov     al, Int_Number (01h or 03h)
# E+ b  u2 c5 _% ], W    mov     dx, offset New_Int_Routine3 a$ q0 e  a/ M7 b- R8 |. Z0 a2 V
    int     21h
- h3 A- x6 W* ~9 C) P% C9 t+ O8 T& I
2 R) p* Z" u# e: u3 R; o9 |7 l__________________________________________________________________________5 R- w6 p! {! {$ ]
$ l& ]4 E5 n5 B
Method 09
! k1 p) _& A  i& {7 A9 V+ m=========
. }4 ?. W) H9 e1 C2 M0 i( A. X  m/ Y  V. q1 ~9 }; |  ~8 f3 I8 }9 P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
* b. W% s7 Z$ ?performed in ring0 (VxD or a ring3 app using the VxdCall).0 R( E7 @) J8 U5 [) j9 c2 |
The Get_DDB service is used to determine whether or not a VxD is installed6 z- j% Z1 O6 O
for the specified device and returns a Device Description Block (in ecx) for
7 n* Q, Q$ q% C4 p% A! P9 @that device if it is installed.- Y' ~( b( q# R+ U9 Q3 M
% ^3 _, k) A8 ]( g1 M9 F; E1 _
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID! N, \) m6 S) ]( G
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 b4 b! U8 l6 I" k1 D/ \   VMMCall Get_DDB; B7 @9 I2 L- b7 y1 O
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% [7 N6 r+ z; n4 b: W

/ X% b/ ?  o  X! z# _  |Note as well that you can easily detect this method with SoftICE:2 P( e: r5 ^5 t. Q( \
   bpx Get_DDB if ax==0202 || ax==7a5fh  g) a7 }% R6 _

7 Q3 n/ E4 p, P5 R- S$ b__________________________________________________________________________
; N* y& S8 ]" X& I
3 i2 T$ S& E( Z4 Y6 GMethod 10
+ J7 _9 Y3 c; b3 ^& H* L1 s+ Q=========- n9 D" g( ?+ H) Q+ `

/ S6 X( ~! e! W5 c# o( S=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) |: ^$ _% ?" I$ s( S
  SoftICE while the option is enable!!4 a( Q$ s7 A, g$ a9 B4 a

' b5 K# E& r7 I* R  g0 j! XThis trick is very efficient:( k$ S( J& a3 u4 P/ C" g- ^
by checking the Debug Registers, you can detect if SoftICE is loaded
0 V9 h4 }2 q' E' H' N(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( l  H( A1 E9 H2 K
there are some memory breakpoints set (dr0 to dr3) simply by reading their3 ^4 ~/ a; a. d; u4 v
value (in ring0 only). Values can be manipulated and or changed as well# A( a: F8 n- q/ f, f- x
(clearing BPMs for instance)
. W/ t+ L' W! E3 {. L8 \; x2 b9 ?) k7 `. D" P7 e) a0 S) g3 d
__________________________________________________________________________  [8 [, M6 q; M8 I9 j
5 r( [" o  m# Z
Method 11
9 [7 S+ |- j- i" U( E- P1 O=========
& r3 Q2 e8 |$ M
) \4 m: O0 x* n1 V$ c8 v8 T2 q0 ^This method is most known as 'MeltICE' because it has been freely distributed& s- o$ u6 m/ U0 L4 O) Z- R- w
via www.winfiles.com. However it was first used by NuMega people to allow
1 Y, [8 m- E, M$ JSymbol Loader to check if SoftICE was active or not (the code is located$ c& c" |) N! w, ]- K, u" Y
inside nmtrans.dll).
& b# @; x1 Y6 j! @  O: \7 N6 N! ~/ f  i  t8 x8 x; K
The way it works is very simple:
  d1 q. |% S/ ]# z1 nIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 d9 Y9 j: q) _  c" `) TWinNT) with the CreateFileA API.
' c* z; d- R+ ^9 c4 J) d4 J) P  r! O1 G$ s, r9 X" f) q" j; @  ]
Here is a sample (checking for 'SICE'):% t* F6 y! n7 d- Y# Q9 M2 J. Q

& w$ o! O$ `. |1 F& jBOOL IsSoftIce95Loaded()
* c' c& j# `' }+ N7 A, I6 J{4 i0 N2 t6 ]' k  k! K' c
   HANDLE hFile;  % k0 t2 x/ \  h- G
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 K  Y7 O. s: @( I                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 J1 S$ X2 Y) e  t, h+ r
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 X+ K8 I' J: T   if( hFile != INVALID_HANDLE_VALUE )9 S( k! j" \, W) S- f
   {1 N7 R( ^4 _: h
      CloseHandle(hFile);
4 _" b5 J0 ]; `! c! \- t2 H      return TRUE;8 e) c) C% T, U" b9 g/ @
   }
+ @9 D+ p, |0 Q3 I# z# W+ n! `+ A   return FALSE;9 M/ {/ S3 ]/ u* N' I1 J( m
}
4 d* G9 `( l: _3 z+ b+ N' U' b" _/ l5 v- ]$ N- u
Although this trick calls the CreateFileA function, don't even expect to be
5 t& W  Y$ v9 J7 r4 v# D1 [able to intercept it by installing a IFS hook: it will not work, no way!
9 H+ y) B* [8 S7 o( A7 EIn fact, after the call to CreateFileA it will get through VWIN32 0x001F& _" s# ?. s" W$ B5 u1 h
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 o4 X( k( x& }
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 V, N7 ~8 \! `) g( wfield.3 w5 l- }; ?' |, k2 j1 m$ u! ?( t- ]
In fact, its purpose is not to load/unload VxDs but only to send a
; d9 _/ Q. b$ D3 w6 M* E2 \W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 s7 Z4 q+ x% D; D  I3 oto the VxD Control_Dispatch proc (how the hell a shareware soft could try( `- I! l& e: I% ~& r! ?- i. n
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) V' O) ^$ \7 ]' G* w3 q  |If the VxD is loaded, it will always clear eax and the Carry flag to allow3 b9 I- ~' {% I" A7 C: q, R1 h, Q% ?
its handle to be opened and then, will be detected.8 ]3 O# A, E. f) P
You can check that simply by hooking Winice.exe control proc entry point
" i& Q0 e7 {) B+ v0 x* v: Ywhile running MeltICE.( |3 ?4 {' _' L; k; e
; m2 o8 j* Z, b( U

6 r$ P/ E; m& [: {% {8 s+ E# m# O7 {  00401067:  push      00402025    ; \\.\SICE
) U5 a% k* b4 n: ~  M6 ~& }, u  0040106C:  call      CreateFileA- F0 q6 Z9 S; v
  00401071:  cmp       eax,-0010 a/ \2 s) T! R/ g, c7 E
  00401074:  je        004010910 X7 Q7 b6 H4 t8 s3 O5 `( K

  q8 E6 M& m% i% m* E' Z; ^( @/ {, `; B& n# X
There could be hundreds of BPX you could use to detect this trick.
4 b6 B* v  ^/ A$ M# G, P-The most classical one is:- Q- `' b: L. ?& }
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
# Z; A& o8 n9 e' N! e    *(esp-&gt;4+4)=='NTIC'. \0 j! |: q" f. Z! \

: W9 `( ~* o$ N2 l-The most exotic ones (could be very slooooow :-(0 [7 i5 [0 X  n' N& V
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
0 u& C+ ?9 a: E# P, C" N8 A     ;will break 3 times :-(
! l* o. F6 p- ]5 n& |) {
+ s! Q4 D+ \- z& s6 M8 {-or (a bit) faster: # |3 R. {2 _3 X1 ?) T+ f) t
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ K8 a. j3 K; z4 J, B4 Y
" \/ o7 E+ v5 @! S+ e3 b7 ^7 I   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 ~. ?, ]7 ^* R- A5 v0 s3 j     ;will break 3 times :-(
9 z( c, U  Y6 z0 s( W( b3 x; d
8 c/ V, A8 \! z; _' Z) j0 P-Much faster:
6 d- [2 d: Z3 `" m   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 U8 B9 n7 z; B& t0 s! V  T. r  w. A4 W9 w( T
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen9 P4 u% n9 v- F  V9 c0 M
function to do the same job:) h% |* R8 {4 D" }0 g/ [

7 f( b5 ?9 B3 R3 L$ C   push    00                        ; OF_READ7 w" I2 y0 C) J: A- v, i
   mov     eax,[00656634]            ; '\\.\SICE',0
) L0 i% S9 X; V+ T! K   push    eax
0 r  ]3 e7 E" C4 r. u4 ]8 [5 i/ T   call    KERNEL32!_lopen2 K4 K5 u) [2 e% O2 C' @
   inc     eax
5 w9 }* q1 r' @  R$ I$ t5 ~   jnz     00650589                  ; detected! }1 J0 s  [6 n3 F5 b8 C0 L' ~8 e
   push    00                        ; OF_READ
. B  I; p7 x# Q4 S* L   mov     eax,[00656638]            ; '\\.\SICE'% U& Y6 \2 A( ^
   push    eax
4 h0 e0 `7 Y+ {$ ~# b% @   call    KERNEL32!_lopen( }5 v# I4 P' p; _2 F. a1 Y
   inc     eax
6 x9 c2 K' S" b   jz      006505ae                  ; not detected; T# N, U6 F2 d: @$ ^
" K4 U  L3 }& Z  r  ^! k
; q" N  Y7 S* a5 i" M- ?; Y
__________________________________________________________________________
! s3 v. D" x9 c/ O; J
# Q/ c# E6 A: AMethod 12
  A) }. K) T; ?' o3 R$ B=========) {. ^: F& |  b: i
% ]0 l/ q* n6 d7 {3 [- C2 J
This trick is similar to int41h/4fh Debugger installation check (code 05
& B; {: D+ y. Z# O&amp; 06) but very limited because it's only available for Win95/98 (not NT)
9 L6 f. U+ I; ^as it uses the VxDCall backdoor. This detection was found in Bleem Demo.# m7 k4 O- C0 x2 ^- W2 ^: x
" a* i0 j2 x9 X3 F* z  T
   push  0000004fh         ; function 4fh" a* }5 f4 `: {$ d0 c8 w
   push  002a002ah         ; high word specifies which VxD (VWIN32)
; h: m+ f6 @' t: S; x8 z                           ; low word specifies which service5 T' a" R4 N  d% Q. P& A
                             (VWIN32_Int41Dispatch)
2 T8 l! c' g1 i& t+ a" {0 s" b, R" V   call  Kernel32!ORD_001  ; VxdCall
. [+ n  v# E- V6 E4 b# |   cmp   ax, 0f386h        ; magic number returned by system debuggers& D. a1 C, }. g" Z1 w
   jz    SoftICE_detected: n0 F6 R& j7 @) a

1 U: K) M6 j( K$ |' n! NHere again, several ways to detect it:6 K6 s# }+ C- h8 p, o
$ N3 {& F7 m+ U* \0 N) d: O
    BPINT 41 if ax==4f
2 S3 e4 U5 ^- n  k' a4 A3 ^, p/ g7 h: J" q9 P2 f5 R
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" R& R& Y3 b! J# P3 g
! d( s" ]* Y3 [0 O
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A' Z' y6 E; F9 q6 m: W" o2 u/ A! i0 r
* C, ?* _3 W. I$ U2 Y' R
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, i, D% V) H8 T0 ~0 K0 _: F
7 R$ R9 I( i) u) \7 [, W7 e% g
__________________________________________________________________________
# N/ T( X5 S- K6 ~1 j" e. T9 v6 X3 w" e
Method 13! M$ x3 B7 G! o) n
=========
( d9 a) S/ r9 f8 ]
% n! o; H5 W$ M. G+ |3 C5 kNot a real method of detection, but a good way to know if SoftICE is) I- w$ M; {6 w4 o
installed on a computer and to locate its installation directory.9 b. W1 e, T- u2 j- Q0 h
It is used by few softs which access the following registry keys (usually #2) :" j% l6 w6 P, N

) r+ p% V1 O" s9 P- y; g) U-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  R9 l2 S4 q, c( B% D0 q
\Uninstall\SoftICE
; _+ _7 y% g5 G  j& v-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE: W5 u% ~8 l0 B6 D* W9 [( H  T
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. m0 k4 V$ d9 e/ O( }\App Paths\Loader32.Exe& ]* z6 G/ q# D+ B# Z  r6 Y" d& V

$ v& t' B" H8 r+ s: Y5 }
; o7 `7 O9 n9 @3 o+ n! b( e! J5 Q+ CNote that some nasty apps could then erase all files from SoftICE directory! x# l  _& C; r) L
(I faced that once :-(
, _; ~: q! K7 O5 g! d
. k2 A3 |; c4 j5 b* pUseful breakpoint to detect it:- [  y4 D4 g  ]* H9 b7 P

9 U% N& `1 M: K! e     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; z8 A- a& t$ K
6 l0 v0 a( c% w! H$ D6 K) {# t) }8 E
__________________________________________________________________________
$ ~- P) D: ~/ K' G! ?' Z7 e: P) A/ a5 i. D: h

: e: j( ^( i8 X, dMethod 14
' E  J0 E7 }9 X. u+ a0 R- d=========  G( z7 `- ^. ~0 ]! S# C
, u4 ^" ^% d9 L9 R
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 Y* P! S3 S- j# C9 z$ o
is to determines whether a debugger is running on your system (ring0 only).' q7 F/ r+ E9 d, u! |7 `7 j
. h" X5 g" V+ l: ^! n2 a' G2 y
   VMMCall Test_Debug_Installed
! a0 q: X0 z0 ?   je      not_installed, B! i  c7 Y! p8 J8 l  }% h' ]3 N8 I

5 w' U/ B! _+ X1 }0 U5 UThis service just checks a flag.
* r  z9 O" x2 Q; Q( x</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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