About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># p- f3 \9 E4 T1 g( R) c
<TBODY>
( ~& f  t& z! w& h. w% E0 R& C<TR>2 p" g4 g% z8 t, E
<TD><PRE>Method 01
* c' l+ `# X6 K% ]3 V=========! `  H- ^/ N4 u9 m- j

( ?& K! I' g; b/ d+ L6 TThis method of detection of SoftICE (as well as the following one) is
8 b* ^' G8 u, |+ p' D. H; R' p# hused by the majority of packers/encryptors found on Internet.
3 {: b2 _- S  a2 w+ h9 `5 cIt seeks the signature of BoundsChecker in SoftICE1 N! R/ ?8 L" Z9 [  A% u5 {  r
5 P% }8 p" `1 }2 G' r9 s
    mov     ebp, 04243484Bh        ; 'BCHK'$ W$ m& Q# e$ r$ G% g. c
    mov     ax, 04h
0 w- J3 V, ~9 y# G/ @- \8 i/ t    int     3      
6 u8 }1 W: n: x0 J! C' h' w7 c  w    cmp     al,4: M  t' g6 a  f- n; l
    jnz     SoftICE_Detected+ o0 k+ ^9 R5 f5 |' F, T

3 P& \6 g0 d. J# G$ s  Z" i0 q7 u___________________________________________________________________________
2 L! \( [- l; j3 h/ U! z
. ?7 j7 {+ J2 ?. d9 PMethod 02
/ i% a0 B& z! z3 H. K. R" I! C=========! e2 u! z8 `# U3 c

: Z% A! h3 _  l) vStill a method very much used (perhaps the most frequent one).  It is used
8 [* T5 c# I; Wto get SoftICE 'Back Door commands' which gives infos on Breakpoints,* a2 A  o! C5 H* ~0 N8 b; x
or execute SoftICE commands...
* v$ k7 o! P- M* GIt is also used to crash SoftICE and to force it to execute any commands( [* ?; k. |) H; l6 [6 A8 J: t$ \8 r7 U
(HBOOT...) :-((  
5 G. [( t8 N! S  P- L# H
: G5 `9 F+ x" ~6 r, ^Here is a quick description:: q# M* W" B0 B0 O, J) ]6 A
-AX = 0910h   (Display string in SIce windows): Q) t0 O; ~8 C
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)4 u6 k2 s: F6 L0 X
-AX = 0912h   (Get breakpoint infos)
8 |$ A3 `! L2 U: |' J-AX = 0913h   (Set Sice breakpoints)
6 O; ?) U3 u- X& \-AX = 0914h   (Remove SIce breakoints)
6 o4 n: B/ T7 q( t" z- |
* o$ \' t+ N3 ^0 ]- V8 h' iEach time you'll meet this trick, you'll see:
+ p6 n3 g' m* E( X" B% G6 g-SI = 4647h# \3 p/ Q/ g) M! R
-DI = 4A4Dh8 [' D" I* E6 ]7 G; |
Which are the 'magic values' used by SoftIce.
( T  x1 \0 y2 v& i5 ~4 xFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- u- |6 U' ]7 V. j: J) [1 c' q0 e9 v; W: b% F# |0 H( s# X
Here is one example from the file "Haspinst.exe" which is the dongle HASP9 `8 G' B2 d$ ]0 {# I0 B' `0 {* l
Envelope utility use to protect DOS applications:$ |3 a% ]4 ^% D6 \1 n

/ V) r2 s$ k/ ]5 V- y- y3 S: m3 W( |# {
4C19:0095   MOV    AX,0911  ; execute command.1 |4 k5 {: ~  p
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  {! z2 k7 A8 h, E
4C19:009A   MOV    SI,4647  ; 1st magic value.) m) `% }; a3 R& S0 k
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
9 J8 Y% J& A; y! V4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  }: @3 z& p- r7 n  G/ H. K
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: L- a$ n- \8 T6 m4C19:00A4   INC    CX+ A" F  V8 |* x8 l1 k# F
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- {5 l8 n$ r  e  }3 O0 n( y4C19:00A8   JB     0095     ; 6 different commands.9 x) M9 O7 z7 U3 z7 k2 I
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ ^8 f' R1 ^4 P6 ?& |/ S" n
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)- |. y6 j; d3 f

, K" B. B1 _% q$ t  nThe program will execute 6 different SIce commands located at ds:dx, which
' p3 [* C+ X8 \) Xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% V. x, }3 X' @& L$ J

. K9 k& C- z/ C0 E% W8 u% m* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 g$ y) p3 q) c0 v
___________________________________________________________________________7 T$ M' `& N) @0 n. Z) Z# n$ A
: ]! d& z- f. I& @0 F

8 K- [$ w9 E  U1 u( v4 F" YMethod 03
5 J) o/ L) N2 n2 _5 w. E5 j8 X=========
6 H, S( E; I- W  Q+ s7 b7 y0 v" M5 D
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
. f3 U8 R4 ?6 e9 K7 A! ~(API Get entry point)
; Z  w* X% J4 K0 `4 I. u3 b1 y        
+ `( |# h. X1 x& l2 U3 B- K
  g; B0 }+ ^  R/ |    xor     di,di
+ p8 ~/ p$ y0 K/ g4 A    mov     es,di1 M( j. V- D% q1 O
    mov     ax, 1684h         C. ?( b5 l3 N. X! E+ a5 z7 S% H
    mov     bx, 0202h       ; VxD ID of winice5 R# i8 z0 b! }) P. v" E. n$ K
    int     2Fh
# k4 A% w$ k  R- c9 z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; a' o& q- ^' w! N& @# t- u    add     ax, di
8 Y) O' d  F6 L* u# \    test    ax,ax( Q2 D2 t# r& c, c8 M4 m2 U
    jnz     SoftICE_Detected
8 d7 n5 A! A8 Z6 ~
) C& \; w8 q9 n- B. O___________________________________________________________________________) a% _# @  c# K: a5 q
9 w8 b3 b& B4 R/ J4 o+ K& x7 i( K! M
Method 04
  p3 t6 u7 |2 F, R$ u- o=========. I  O8 z% q5 U, R, b6 \

7 F- A. P# O1 ?4 e+ l) MMethod identical to the preceding one except that it seeks the ID of SoftICE
& P$ g6 ~7 Q. t# Q1 b5 gGFX VxD.
9 c* j' v0 ?& _: `
/ N3 w6 Q1 `& R8 D8 Z4 Z    xor     di,di8 q/ M' B0 d9 k# O7 N3 T: R8 p. o4 E
    mov     es,di
9 e. |; _; y8 W) s$ x    mov     ax, 1684h       % F4 S) }/ i" l/ t& Z+ c. x
    mov     bx, 7a5Fh       ; VxD ID of SIWVID6 W- ^' E& B5 }2 ~9 K5 O4 Z7 {" i
    int     2fh% n7 @& b0 G$ ?
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: \  }& @8 L, X5 h0 y
    add     ax, di
" J7 _9 [3 M3 ?8 l    test    ax,ax
4 @6 l( b& K# K5 n; A    jnz     SoftICE_Detected' s+ d% l2 v4 _2 Q3 A2 B# U0 R8 X
# c5 T# y$ l3 ?6 l5 `9 m
__________________________________________________________________________
3 A- D. I* f  l2 R" O& ^- x+ a+ q. G. c3 s) l3 g  B" m
4 P' Z4 d% D# I4 e9 z* H6 X- U; ?
Method 05
0 L1 ?1 a1 u* l9 O% g8 ?' D=========7 @) y2 w( L0 k
: }/ M$ c0 Z0 `  U/ N
Method seeking the 'magic number' 0F386h returned (in ax) by all system; H5 h/ c/ s4 C  \
debugger. It calls the int 41h, function 4Fh.
* a/ M* [. S: {7 t3 L! |There are several alternatives.    N9 F; C5 H  O

1 v" d1 l/ i1 A/ ^The following one is the simplest:  x9 f$ {9 X( u$ r+ i
" \& F  S' `) f' |8 s8 @" u
    mov     ax,4fh
- z6 M* _; D! N0 s5 [8 V3 W1 R/ v    int     41h7 c! o6 J9 l/ e6 W4 c7 X/ q  q" W
    cmp     ax, 0F3862 v% F1 Z$ I& M7 Z$ _! l5 o
    jz      SoftICE_detected& O: t9 D, P6 \/ f/ W( T7 K
) R6 k+ }& S4 }' W9 g1 e

: d8 Y& A/ p& J7 m3 k1 g( r: F. I( ANext method as well as the following one are 2 examples from Stone's
$ \- _: P" _( W. s/ a. S"stn-wid.zip" (www.cracking.net):
' m9 c" K! I  \( z8 P% l' p! |' j9 M/ g9 ^4 H: R) E' |3 m% `' `
    mov     bx, cs
! k4 ?8 }$ C( N+ n' ^* {    lea     dx, int41handler27 B' Z: i8 j6 U( r, G3 U* g; G
    xchg    dx, es:[41h*4]
* b3 ?+ a5 {; E, `% G    xchg    bx, es:[41h*4+2]
* ]( n" f9 V) m    mov     ax,4fh
0 X* O8 V: f, W0 Y- ~# V    int     41h& o0 }0 k9 c. c& `. f: w5 E
    xchg    dx, es:[41h*4]
3 b2 e! L" R4 ~5 j, u. ^    xchg    bx, es:[41h*4+2]
# R& f8 g9 `6 e% C) S$ ^3 M    cmp     ax, 0f386h4 ^: }& O7 Q0 ^9 T
    jz      SoftICE_detected
6 ^1 x2 ~  R9 [' R9 A
6 m; r( n4 c( C/ Wint41handler2 PROC
- E, G  c" w: z: a8 j    iret$ Q  q( V* [- e5 x
int41handler2 ENDP
9 j, R3 D% N- T& S7 u* c, g( o- o, J
5 M$ o4 [( v( \7 a
_________________________________________________________________________7 J+ ]. S3 K; l% [: }5 g0 B/ p

' _2 S6 x* i& C3 |1 Z
8 D9 v0 `7 r) OMethod 06
( P( _  n6 T, o# \. ^=========
& B, ]8 X' G" z& A8 M  j1 c; Y" C% P. U: _# O- N* Q# S
& U+ w2 J8 D; x- t
2nd method similar to the preceding one but more difficult to detect:, l# d2 X3 F# }% Y) f1 P1 L
5 y4 b" G$ O! n/ Z% e7 B# n
, Y2 @* P0 x. T4 g0 X
int41handler PROC
$ h) J$ i) {- h7 @: u    mov     cl,al, t8 j- a3 B$ h/ W2 H/ L1 n& M
    iret
* g# q2 |  Y1 B7 o2 ^/ hint41handler ENDP
: p. _% R6 }% C8 O' a; O5 C! @. ^3 ^' p$ n; m& m
! P! i! W5 w6 o2 P( ]; t# M3 y
    xor     ax,ax) X; s3 l$ E- Q: s6 C  h- }
    mov     es,ax  Q4 a% V7 O4 n
    mov     bx, cs
) V# c$ a- R1 J* C    lea     dx, int41handler
$ F+ j# d. c9 N  Z% B    xchg    dx, es:[41h*4]7 a& V$ X5 C& p9 f! n+ S% I
    xchg    bx, es:[41h*4+2]
3 W! A# K6 {; Z' N5 S    in      al, 40h* I4 k6 @  f( m- a5 s! l
    xor     cx,cx
* K8 Q5 n8 S7 i, ~" t3 r% l5 e/ l- ]    int     41h
" Y! r2 T) R9 j1 m    xchg    dx, es:[41h*4]
* Y+ i0 d. A7 m* J" m# Y3 h    xchg    bx, es:[41h*4+2]
+ m2 r9 T! k0 \+ j4 x    cmp     cl,al+ f+ j3 g1 R+ t+ b; l# e- c0 @& b
    jnz     SoftICE_detected
9 F1 O) m. |( _& ~7 Z
6 @5 ?; E& U5 p$ r- V_________________________________________________________________________
/ h3 g. O* x8 X4 I# ~* I
; j. z  {. P+ Z) v1 LMethod 07/ V" V- X/ t6 L! @; N' U5 Z. j- F
=========
0 Y2 x/ A( ^' X) e3 Y! `
8 L/ U2 D" a) qMethod of detection of the WinICE handler in the int68h (V86)
7 M, e( b5 L, S+ P* ?1 G9 M% Y4 c' B) h8 g. d; |
    mov     ah,43h
( a" J: r& k# @" b6 S    int     68h
/ i. _1 |4 @0 k) y0 G! U1 Q    cmp     ax,0F386h  l/ ~$ G) z7 x6 a; |/ R1 P; [. m; z
    jz      SoftICE_Detected
: J, x2 G& h4 T( N4 z2 M, R6 O  I8 |# Y' ]# y- y
! ~( e1 n4 Y; u: q0 {/ [" c/ B2 h/ M
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit  }) F- G3 [% j6 d- u: O/ e/ e
   app like this:( A& x& q$ w2 U( H% R5 C6 H/ y8 h
* [& O% ~' U, V8 K
   BPX exec_int if ax==684 N4 G# L/ ]6 P. f% \) F% C& i1 s
   (function called is located at byte ptr [ebp+1Dh] and client eip is- N; c. a; P* ?) M$ ]( @) i
   located at [ebp+48h] for 32Bit apps); N/ q) }0 J$ ?; z3 |: m7 L0 z0 h# ?
__________________________________________________________________________* c2 v: d; o- b

8 s+ o- J7 w/ ?9 F3 a5 B$ n+ w- w- G; \$ `$ }2 z3 Q8 p. b
Method 08
0 c2 R6 ^5 j# u=========9 a7 }( O. m& z2 c6 M0 N

2 \8 S5 x$ v6 K: r: @& q4 CIt is not a method of detection of SoftICE but a possibility to crash the
1 O3 D5 ]. D1 G2 isystem by intercepting int 01h and int 03h and redirecting them to another
) h+ G2 w8 L4 u  k2 m' L$ c+ vroutine./ ]* s  r8 c  d  @8 r. ]
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 b! r) [4 c8 H  @9 H
to the new routine to execute (hangs computer...)
& P% a" ~0 a4 h+ U3 `- X# b7 d3 u8 S
    mov     ah, 25h
: m& h, a* ?8 ~; n  c2 m0 w    mov     al, Int_Number (01h or 03h)5 b. ~% E' u3 B2 l' ^9 t" K
    mov     dx, offset New_Int_Routine+ L8 e" l3 a7 |- k: M/ W
    int     21h
; u, H) w! ^/ w$ a2 z' x; V( \5 h
- a3 X0 Y* ~: }& H+ i% }__________________________________________________________________________
6 h, c; I- `* Z& e* Q4 W  M
! `5 T+ \8 s- N$ n) XMethod 09/ b1 n% Y) q0 g' u
=========+ q0 a$ ^8 [4 q- h

7 n( C9 x8 G" b/ X( e. K' pThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 C/ w: V# v1 h/ `8 V. cperformed in ring0 (VxD or a ring3 app using the VxdCall).9 w/ V2 o' Q/ n& H
The Get_DDB service is used to determine whether or not a VxD is installed
& ~; H/ V& K& qfor the specified device and returns a Device Description Block (in ecx) for8 z- Q. `. K- Z- W; p3 ^3 `
that device if it is installed.3 h3 }4 t! q* ]6 U2 T- p
' R% ~! k: _' {+ N% ^: b4 K/ s
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 r# \& p# P; ], ]2 @   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)( h1 |/ I, P. i, _) R; j
   VMMCall Get_DDB
6 ]; g1 ]8 ~; E! D   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ C, [4 E+ g, n# l1 l* B, ^5 s' R% O
Note as well that you can easily detect this method with SoftICE:7 r' S) w  P' H7 s
   bpx Get_DDB if ax==0202 || ax==7a5fh
% b/ y  u1 x  H! e1 G/ d  ~$ j* N* t9 l3 G3 d  K4 s
__________________________________________________________________________
! U: u) L4 F% u- v/ V3 M9 ^1 v* b" w* o4 `6 d, B! ~& ]
Method 10
  W/ O; a8 v6 O, y+ N' L=========& _6 N3 V6 }6 V7 b

0 \8 @1 ]: [' }' c, v( K" g=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
; v1 b9 e5 u3 y# X* @  SoftICE while the option is enable!!5 B$ O+ ?+ ~9 I- j2 O; K) t4 D$ V
9 I9 J! \! ]: B9 h1 p
This trick is very efficient:
: K; b- u  e+ \, V% w# ]by checking the Debug Registers, you can detect if SoftICE is loaded
1 _' R$ x: h+ s- W7 g' e(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 ?% Q6 n( y% G% D) L9 p. B
there are some memory breakpoints set (dr0 to dr3) simply by reading their$ [, q& O( ~: X6 J% {: _* \
value (in ring0 only). Values can be manipulated and or changed as well3 c# D: A. S! p4 c  _
(clearing BPMs for instance)9 b) s! B: B5 z+ Z! T, T! @% M+ i. c

6 w) J7 t7 b8 S3 e6 \1 S% l__________________________________________________________________________3 O  Y4 v1 N- Z0 N9 p

$ a% O: L3 M. p* A% y+ ]' KMethod 11
% e0 o# q! ^1 a' f, L1 T=========. O1 @# K3 T; `0 T8 K
5 G: v8 U+ E4 E, d3 M# ]
This method is most known as 'MeltICE' because it has been freely distributed" }1 t, q, R5 C& P+ c
via www.winfiles.com. However it was first used by NuMega people to allow
) f2 S) ^4 `7 l# F+ Y" ESymbol Loader to check if SoftICE was active or not (the code is located8 C3 y- }0 t6 D( _" m) ?
inside nmtrans.dll).
. `- n6 L9 a1 E$ K4 p0 H2 F# \4 t& r! Q: o3 z
The way it works is very simple:& _4 K% M9 Z* p+ W) c3 X! H
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 G& n+ Z, v. c4 ^$ D
WinNT) with the CreateFileA API.
5 w) Z* q* {5 X# |! ]0 m, \3 b
) z0 B8 Q7 H  u# j) kHere is a sample (checking for 'SICE'):  `  `- M3 w8 T" t
  a1 X" u+ v9 @
BOOL IsSoftIce95Loaded()
) c1 x3 |& h# n8 b; Y1 y9 Q  u. b0 D{! h- }' Y1 E# `1 ?
   HANDLE hFile;  8 Q" {# C6 ?2 F$ V- X9 k7 i
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 P. O9 \' i8 V+ T6 `- ]
                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 u3 Q' ]( ?6 M* z7 z5 @; d9 z
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 m+ V3 {! G8 H) {6 s  \
   if( hFile != INVALID_HANDLE_VALUE )( \, J/ j# S. ]7 t; C7 [
   {
, `4 O3 i; [4 ^* t9 ~& j/ X" u" i# k      CloseHandle(hFile);" ~! `8 g. ?, n0 u% q
      return TRUE;1 [4 O* ?+ I9 V/ p3 R2 D5 C
   }
+ M* u5 {+ h' M. e+ X& K. y0 M/ J   return FALSE;" G1 K0 {5 B$ Q4 d' A- \* J6 X
}" {/ f- W7 ^2 y# F( y# z- [

# ?% t+ x6 V% O) P, I( f! p4 G& sAlthough this trick calls the CreateFileA function, don't even expect to be1 J) {" O. F7 F" ]
able to intercept it by installing a IFS hook: it will not work, no way!
6 d7 i2 K+ k4 p6 t* ?In fact, after the call to CreateFileA it will get through VWIN32 0x001F
& C2 x4 G0 t3 B3 }service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 W4 F$ C+ C) C$ m; G5 f
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
: p9 ^3 G  L8 H% d! Q+ ^field.! u; N1 B1 _4 g, L/ F
In fact, its purpose is not to load/unload VxDs but only to send a
  p5 u" }* q0 T- uW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: a) R. N. C" Z" p1 h6 I# `0 C8 x( @to the VxD Control_Dispatch proc (how the hell a shareware soft could try9 @1 G& ?7 Q8 j: S# t
to load/unload a non-dynamically loadable driver such as SoftICE ;-).* j* _# c# Q3 Q  a' Z. q5 G5 C
If the VxD is loaded, it will always clear eax and the Carry flag to allow' L. E7 I3 n9 m
its handle to be opened and then, will be detected.
) o! g+ h2 y2 G( _  DYou can check that simply by hooking Winice.exe control proc entry point9 R; X( Y' n0 O6 l1 k2 F- q! ?5 M
while running MeltICE.  x6 K0 w9 m: F3 s# v
- b% r( @4 C  ~( @# u! j1 ]3 ~

% W' j% r7 n$ e6 F* X' O; \1 j# Z  00401067:  push      00402025    ; \\.\SICE
7 [, E% t! f6 Y2 x( N/ \+ k; P7 \" {  0040106C:  call      CreateFileA; u+ U. x; Q) n5 E6 J* K% R
  00401071:  cmp       eax,-001
3 J+ b$ B1 C& M! h* ]  00401074:  je        00401091
8 |2 F7 `8 t6 g- K# R! F
3 h9 P# l  D. G9 w. |, Q1 ]% D" ^7 a$ K; k- m$ A! i" ~
There could be hundreds of BPX you could use to detect this trick.
; C" g" ~, `: m& ?& H; U-The most classical one is:3 d& I. L6 k- {2 G9 ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ b' k. Q0 Q% r' c% K) j
    *(esp-&gt;4+4)=='NTIC'
2 M; r( J+ y9 z; \9 j. D) d8 k+ z* _7 {2 z3 {# W' H8 l, {
-The most exotic ones (could be very slooooow :-(
$ Y1 Q" N' V' T1 J4 L* D4 k& U   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, S8 e7 o9 }. N) n7 a+ L     ;will break 3 times :-(# ^5 ~9 h+ R: M6 L. S- p  e  x
' p2 v' B9 s) T8 o$ v/ s0 r
-or (a bit) faster: 8 T* s# h) {" t9 F7 d$ o. G
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
" p. M8 ?) ^- n! T  L5 M/ G" T( @6 U& }
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & q8 c( P) f8 C- u3 F8 K" ~+ }
     ;will break 3 times :-(
; ~8 R* h" f& p2 w" u9 R
  v% ?6 J6 l% k- q8 n8 T-Much faster:& e0 B- b; w' h" }3 i2 g
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' A0 ^  A" z4 Z( z
3 @3 e4 @# s3 w* DNote also that some programs (like AZPR3.00) use de old 16-bit _lopen$ q) c. @' c, [
function to do the same job:
' i8 N, S: `4 ~5 S3 e3 R' K2 W1 l9 M' p0 l% B# W# Y+ E; `
   push    00                        ; OF_READ8 Z! U9 w3 c+ L1 ^5 F3 x# \( N
   mov     eax,[00656634]            ; '\\.\SICE',0
  g" e7 m! u. ^8 ?& w3 d% F   push    eax3 ?" L. X( v( a
   call    KERNEL32!_lopen
. B3 o* P1 s+ D4 ~   inc     eax
9 Q0 u. N/ p" t0 I6 r   jnz     00650589                  ; detected
% ?/ L) ~/ g) Y$ k   push    00                        ; OF_READ2 Q% N0 I7 t% e; K7 V
   mov     eax,[00656638]            ; '\\.\SICE'
  ^. q( K5 v7 u+ Y: O   push    eax
  H; z+ e6 R7 n* c7 D   call    KERNEL32!_lopen$ x2 q! {& U: s! @- R8 I
   inc     eax
0 H) z4 M  c  E, L" F   jz      006505ae                  ; not detected
4 I6 l) |$ c" h' `2 p4 |' j! G4 r) U; T) l1 V2 @( v2 [' U6 I
) `9 I4 {6 W0 E  ^3 S7 K
__________________________________________________________________________
4 `4 j+ W; ~+ q3 N- O9 w3 b, X) u+ N( c' X; C$ G- ^( x
Method 12) C2 X; {+ o3 X$ S( x
=========& G4 f9 H0 @7 a' Z! D+ x

* m( u& e5 C, [, i7 \# kThis trick is similar to int41h/4fh Debugger installation check (code 05
9 o* K) [/ z9 r9 J% _&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: o0 {' o6 q" W4 G  s5 uas it uses the VxDCall backdoor. This detection was found in Bleem Demo.  |& ?3 ?% O  L" T7 g+ v8 n

& m. @+ ]4 B; b   push  0000004fh         ; function 4fh2 ~( x9 ~; O8 a3 j7 p
   push  002a002ah         ; high word specifies which VxD (VWIN32)! Y( b+ I5 ?, e
                           ; low word specifies which service- B: r) M7 }7 i" n! c, w1 L
                             (VWIN32_Int41Dispatch)3 i0 C# Z' s" _# m* k0 ?
   call  Kernel32!ORD_001  ; VxdCall( D& c" Q$ ?" G- [2 }  i+ @& M
   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ Q5 D  w8 E1 J+ n7 K; x   jz    SoftICE_detected* z& f: F$ F1 T4 ?' W* L- e4 V
, s4 v, j8 U4 P, k& K* v
Here again, several ways to detect it:
; q7 r7 A9 a& O
' `3 t+ ?: @! y* e: b6 ^    BPINT 41 if ax==4f
. G/ J+ C+ w! q% c; H5 }$ z0 n+ C' r+ U% S/ z) C
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 r) R8 O" k% d5 v- P" d
+ O) E! U7 K6 j3 j
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
7 O& O# r# U, W8 S1 q
/ G8 `/ ^7 [  [    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 \+ f# D0 W0 \$ G$ i" g9 [
3 a5 r' A5 N* l+ h$ p
__________________________________________________________________________
& [+ h# n; _) ]7 }) m) B
$ M3 m7 J4 J: `Method 132 u  r) f! x+ d
=========
% f3 y' n- ~& {) [% G+ |
1 n0 G, z, V! U' XNot a real method of detection, but a good way to know if SoftICE is8 X8 h- [: H7 ]& D
installed on a computer and to locate its installation directory.
/ M. D3 c$ ^5 Y7 ~It is used by few softs which access the following registry keys (usually #2) :
. g/ y, E# |% }
, `/ b& J2 i4 ^: h8 ~0 z-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ @7 p0 u) B" q, \9 z' k) c
\Uninstall\SoftICE6 I. k' f1 W4 `0 Z# |
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( H& r: H+ R4 O% Q: x" F
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 |2 h4 J6 W6 n- u, c3 ?
\App Paths\Loader32.Exe0 e. r+ |- W7 U6 S
# ~6 w. z' [" @2 H8 t) Q2 X
% p6 g5 V& P% m' j" c! X
Note that some nasty apps could then erase all files from SoftICE directory3 E& b* C1 N0 _% x8 N& t
(I faced that once :-(
  f, E# f+ h' {
% D8 J$ z$ r3 J* B, r8 o: PUseful breakpoint to detect it:
' o6 v# s% f1 k- d
3 T. p1 h9 Y! B2 U. \     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'7 [1 X3 z( A1 S0 p

- \3 N# f0 s* Z4 W' f1 m* L+ j__________________________________________________________________________3 ?8 w7 C" b4 B8 Q0 x
) ?# n# v, S8 n& h+ S+ L" m) z
9 K2 s) w) B; d& L
Method 14
) L0 \; q+ q; J- g6 p; u( ~=========4 z0 }8 V$ |. o# e! G( k) I
- M$ H) q2 Q$ y' B
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 G' I7 L1 F2 ?2 G0 `- ?* }, \' k
is to determines whether a debugger is running on your system (ring0 only).
8 L5 i9 p) S  f" J5 M, U7 {! j" r; _% j
   VMMCall Test_Debug_Installed
) ~. T: W8 C$ K" W" v   je      not_installed, b2 F$ q0 O! P! [" k
$ s  q+ Y8 j9 |4 p
This service just checks a flag.
6 u3 c* r  d/ d  r5 o5 R7 v</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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