About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; h! Y8 r) q7 ~7 j$ O* X
<TBODY>
. V+ V; [6 W# D8 p5 r: }& a0 c<TR>1 A' }4 y- v+ H  w4 \0 N
<TD><PRE>Method 01 5 O. x! ]9 X/ ]. r7 R7 Y' N
=========
/ B, _+ z2 A% I" U+ S5 z2 x
& P* _9 h0 w0 [" c" R/ t7 t5 o. kThis method of detection of SoftICE (as well as the following one) is# D) M; z6 C" t; w! p, b$ S' W
used by the majority of packers/encryptors found on Internet./ V2 x) `% c; T- J
It seeks the signature of BoundsChecker in SoftICE
& c, R& b" Z; k& C; n0 E) ?, U6 ~$ X& Z5 `
    mov     ebp, 04243484Bh        ; 'BCHK'
+ d0 O* J) A- [2 z    mov     ax, 04h3 b2 i" Q3 h' n3 a
    int     3       ' u8 r6 f* A' p' ?
    cmp     al,42 Q: A; |& ^& M
    jnz     SoftICE_Detected
. @& V( [# f+ P* R3 D# a5 |+ G+ K; Q* R9 E$ B. r# x; r+ }
___________________________________________________________________________
8 ~; Q* d3 h9 \5 t% C4 D2 @9 Q8 h& K
Method 02: T. l2 y8 [2 R; O( V+ y
=========8 W: D2 t+ F& ~4 Y9 `- d

4 D. r# u( }( f9 Y' g# LStill a method very much used (perhaps the most frequent one).  It is used: t6 K2 H9 v) V& h$ G' @% w
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, v/ e' d' P6 N$ j) G3 eor execute SoftICE commands...6 G  ]$ s2 {. C5 J
It is also used to crash SoftICE and to force it to execute any commands
! C/ G% U. l+ @  J(HBOOT...) :-((  
7 e! G1 K& x) ]/ J
* {0 ]5 ]: `8 @; f% _, ?! F! yHere is a quick description:5 y5 M- B' l' \
-AX = 0910h   (Display string in SIce windows)5 Y! l0 [# u1 z1 u1 c& O+ G
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# Z: a( r0 H# `, k+ X1 F-AX = 0912h   (Get breakpoint infos)" Z1 d( H- f; B0 h$ D; \  F
-AX = 0913h   (Set Sice breakpoints)
: ~$ J4 h6 W8 _-AX = 0914h   (Remove SIce breakoints)
7 T' I" l" b* ]- U5 W
" A; D( L0 V; ~& ^Each time you'll meet this trick, you'll see:
1 C  l3 t. A  P" W3 \# i3 n-SI = 4647h, `; K8 L1 i8 v1 v; _& G
-DI = 4A4Dh  a& q, x+ a& J/ y2 C' W
Which are the 'magic values' used by SoftIce.
% M/ W: u7 V! p( H" c" o$ @5 sFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
# a$ [/ n9 g: A! Y5 g3 [) `/ b( ?4 _" H7 m$ X) x% n0 b
Here is one example from the file "Haspinst.exe" which is the dongle HASP$ C8 Y9 Q' `0 J% J
Envelope utility use to protect DOS applications:/ ]) k" b. f7 o0 z$ h) J
" r; {& Q5 p- r6 A9 M3 M5 n
  o: _+ n3 x4 g
4C19:0095   MOV    AX,0911  ; execute command.
8 ?" D2 O/ O# w$ i4 D: M* |% B4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; q' A, |  l/ M
4C19:009A   MOV    SI,4647  ; 1st magic value.
1 d& I7 a8 p' A8 c$ r/ |4 f: L4 o' t4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
3 ?1 \* S, [: Z7 y( r4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 ]$ m& O- K  i8 u& a: `4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute, ^# m8 c. _( F4 W
4C19:00A4   INC    CX8 j* }4 }' N5 ]7 b+ W, Z3 E+ g# }3 Z
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 z6 L1 b. `# V. o$ E9 _4C19:00A8   JB     0095     ; 6 different commands.2 d- v% b7 ~0 q, e: w
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 k9 i0 a4 v' H+ j4 v3 Y, n& \: ^7 m
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' s! [2 e4 Y' h5 a7 }6 w! A9 l' {: g. A" c* P
The program will execute 6 different SIce commands located at ds:dx, which! J; r$ I- U) c1 L0 O4 N' }  X9 b
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 o- u  r5 P* a
  _4 k  r8 B5 M: j
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* k; K& H$ ~. d' A___________________________________________________________________________4 ~* q! I5 K) b+ B6 ?+ l5 K: T* Q" @
5 z2 D7 Y# g3 r8 s7 x3 e

2 p0 r, i7 F3 y5 c, FMethod 03
% A* N& x& O, v8 V; R=========* f0 `$ u1 w4 G/ z: J5 n) R
6 R- |  c) G: ~( S6 [' z; X
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 c6 f, ~  q+ a9 ]6 b1 M5 A(API Get entry point)  n- y: L! J4 _+ t* i
        / L+ N: Z; H2 n# o) [! A
0 i. H2 O! g9 O- k) t
    xor     di,di$ p* }0 c+ M, X% E# Z8 t
    mov     es,di7 a4 p- k7 y0 ^# u6 J7 P. x2 v
    mov     ax, 1684h       " q2 G' O& r( j' c7 s9 Q: [+ d
    mov     bx, 0202h       ; VxD ID of winice
0 B- z7 K0 U& L, I( A    int     2Fh
7 W. e. u! D5 N# Q8 x0 T    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 t8 c/ k2 K7 [9 f, W) V1 L' n    add     ax, di
" Z$ Z$ }0 I& Z6 @) J    test    ax,ax4 V* T9 y( B0 @+ k5 A0 i
    jnz     SoftICE_Detected1 E7 `3 g( G( Q. d$ p/ [% I5 ~: m2 O
0 y/ \9 X- N2 k0 |( N1 `% i
___________________________________________________________________________) s! W) E  ]4 O) }

* \3 U2 X  Y& m/ I: _5 B; H! `0 AMethod 049 }' T; q% R# f! F4 F& c% Q
=========
) A% C9 O$ Y; v$ l+ j
5 d6 I8 U4 p3 S7 N% x  I1 YMethod identical to the preceding one except that it seeks the ID of SoftICE
4 j' o% l/ z9 S: o" S$ UGFX VxD.! X1 B0 G7 r) B1 A- ]1 h

& I4 p6 V& P8 o5 s1 Z1 z    xor     di,di
  ^5 A% q' f8 o3 \, w    mov     es,di
3 _0 p+ U* Z3 A    mov     ax, 1684h      
3 V/ H; Z; p# N8 z( H* \2 G4 k# X    mov     bx, 7a5Fh       ; VxD ID of SIWVID6 H1 |# [; M4 z0 |* r7 X9 e2 T
    int     2fh
- Z' l2 F' p, s, p5 I    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 V( q/ _7 |/ R9 c' f  U9 |
    add     ax, di
+ r/ `3 w6 W9 C3 {    test    ax,ax" N$ ?4 F/ ?0 }0 |1 z) t
    jnz     SoftICE_Detected! B" A$ Y6 d  X  [1 U
0 l4 v' c) n1 F& C$ \, c' U( k5 G% f' k
__________________________________________________________________________' g- Z' I8 H9 Q; I/ N2 X1 P& G8 S
+ I) |9 n5 T" ?* k
; y/ M$ i# X2 M3 z: r
Method 05, m) n! A9 L1 q( M% C9 \
=========
. C, y6 N$ s- u' ?* G$ N, H4 x! V) i- e, a+ Y4 o
Method seeking the 'magic number' 0F386h returned (in ax) by all system
) @) ?4 t& A! T$ N; M; Y/ U3 |9 [debugger. It calls the int 41h, function 4Fh.
' I' J% R+ u. T% g6 ]( v/ p& M% PThere are several alternatives.  1 O- g5 N* `& N" p: @

7 G6 r0 I  }5 [" KThe following one is the simplest:9 j. h. ?. ^  a% J

6 l7 c1 @% v8 a* Y7 u    mov     ax,4fh- d" K" b9 h2 j* l
    int     41h1 H  l; |; z& A: M( M  K1 m; K2 Q
    cmp     ax, 0F386
2 e5 H: R5 i' ]' S    jz      SoftICE_detected$ T- p# ]; Z$ y+ N

# f6 M  X6 A: u; H% Y) a! T1 Z1 f- }# m; C. p: @+ m
Next method as well as the following one are 2 examples from Stone's
9 x* j% H6 o: A% z; P8 W"stn-wid.zip" (www.cracking.net):. n, |% d4 J& _! Y2 l" u9 q

4 `- x5 M- V7 j4 Z    mov     bx, cs
+ J' ?6 q6 q+ n2 ~    lea     dx, int41handler2' e# I$ e; H, @' i0 L4 i; |2 m
    xchg    dx, es:[41h*4]. y1 E- k) k  n. a$ F* p1 h
    xchg    bx, es:[41h*4+2]8 a3 T, l" l/ m# S; ~
    mov     ax,4fh
& s% V9 `; q8 B. q3 U5 V( l! _) x    int     41h
" t2 Q. j2 i' A6 p9 n    xchg    dx, es:[41h*4]& Z& k6 z' f  b
    xchg    bx, es:[41h*4+2]
/ d- K) ~4 b- M; o5 E4 ]    cmp     ax, 0f386h
/ S* {! X7 O2 b- I0 d( Y* ^' X; F    jz      SoftICE_detected
6 Q  k& q) [$ d7 J
8 j* v, I( V& v$ A, L  p* V( w6 Pint41handler2 PROC
% K2 V+ y  F# G6 Q4 n% z    iret0 x8 n- `0 F& g- [: G* b
int41handler2 ENDP7 q# s% n: J$ K( Z! ]) U. N
+ s& p$ Q5 j: _
) W# _- X2 d" v, q- F* f0 L5 ^$ l
_________________________________________________________________________
# J$ J3 h* Z2 A; C
8 ?7 T. u) j) F& }) Z+ e
7 y) w7 a$ K- g+ p  e* kMethod 067 ?3 J) ]: s$ y! l3 \' w: t
=========
! O9 K% D! z) @2 L) _5 \0 i" Y% R% ~" b5 X! X' f0 U5 _

$ f7 Z9 c- _  E* O2nd method similar to the preceding one but more difficult to detect:
, k4 R& b" }0 N5 C2 o% n! H  j2 E
' N3 a% p' R( l2 C  u( N% H4 R
! W4 \2 l4 i9 j6 A9 o; q; ^; N( cint41handler PROC/ h. \+ Q9 Z: V6 w& l  h% r: L
    mov     cl,al
4 J: s+ I$ r* Y: p4 J( I3 |    iret
3 V1 Q+ D, f: a& n- n& Cint41handler ENDP
: @7 I& h3 d/ D8 {6 p" N, {! @0 ?3 p0 K5 m- g( R6 u" T3 N

8 a* B" g/ b8 D" L) b& W    xor     ax,ax1 s' H9 T4 |3 w0 Z
    mov     es,ax8 N  d( G; H2 R; J
    mov     bx, cs
+ N' I6 G4 v5 @* R( \3 E    lea     dx, int41handler$ {4 `# z, h& O, O8 _+ l5 m
    xchg    dx, es:[41h*4]
3 g0 t0 n3 e! @# m    xchg    bx, es:[41h*4+2]1 L' K& E: a5 M; M! i. O# z4 I
    in      al, 40h2 F% I8 J* g) d/ Q
    xor     cx,cx7 q: x+ Q! I" X- p# o+ P4 T
    int     41h* E' `5 h8 F9 W4 W9 `
    xchg    dx, es:[41h*4]! @& m8 u7 S( W. c
    xchg    bx, es:[41h*4+2]
7 j3 Z8 q' ^1 ]    cmp     cl,al
% `; D9 I2 b( ~+ }. s    jnz     SoftICE_detected
% E9 ~  y7 b- v7 l% u! j, T% l7 q3 G9 A
4 W) U5 r# R% \) T# B+ v2 ]_________________________________________________________________________
  J6 @: B6 G1 D$ o; [* \! y! ^4 \' u  K1 k& B7 j; v1 f* Q, I/ n* f
Method 07
. F0 D! p- ~& x) Q=========
" j9 d* b8 R# v( o! V( W$ T6 Y% a9 i2 h& k8 u' o, R
Method of detection of the WinICE handler in the int68h (V86)
. C# ~, I- [' Z5 m0 ^
" ^+ Q% |& @* N6 _* L% i8 Q& d    mov     ah,43h8 H* b7 `/ d( S
    int     68h
+ Z5 x0 H0 D8 L    cmp     ax,0F386h1 g8 R* R2 Y- Z. x' Q
    jz      SoftICE_Detected
+ F+ G1 q  ]. \# X$ ]: c% x# V6 R, z
4 Y) X1 ]( c  ^
1 r- T1 ~% f$ \% U7 p* f6 z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  M+ p/ E) q) U   app like this:
0 x4 u4 j4 U4 @& d6 z
. \8 V! `' C. b# o3 l- r0 d   BPX exec_int if ax==68
. t* k3 t: P& c( k( o   (function called is located at byte ptr [ebp+1Dh] and client eip is
( H/ u+ _; Y1 r1 v8 u6 `& d   located at [ebp+48h] for 32Bit apps)" ~9 Q2 l: V4 P; @* f3 {
__________________________________________________________________________
( u! j7 x$ Q+ W9 R9 ]& Z- M7 I& K6 w

2 p% A) Z7 B/ M7 n( M5 b* @" w5 oMethod 08) R  F. ^4 Z( b6 `, i
=========
! }) L) j# @% N3 B5 v! e, Y9 [0 r- F( v6 _
It is not a method of detection of SoftICE but a possibility to crash the" m1 J" G, o2 r# K6 W1 t
system by intercepting int 01h and int 03h and redirecting them to another
$ j" j8 N/ w$ D# froutine.+ m- n0 V0 w9 f5 s& I  {
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 E7 C8 a7 m% A& ]) Dto the new routine to execute (hangs computer...)
0 t) }" p- D, K9 O6 O
8 k' U: J" g) S. s; x    mov     ah, 25h- E# n9 r$ D7 O7 s. O. K; y
    mov     al, Int_Number (01h or 03h)6 C% K# ], i' g- e" |
    mov     dx, offset New_Int_Routine# x- e$ c' s7 y2 G3 b
    int     21h
1 ]1 f, i5 J% p" ]/ A( ]4 R- o& s
+ b( Z" I1 u% E& x7 F. i__________________________________________________________________________
& I. S: Z" J: A' X2 ]4 T% k8 k3 a: b
+ u" j- e; E3 c0 s7 ^2 h* w4 A/ ^Method 09
7 N$ _: q! N" Z3 f# q=========
& V( X- T- T/ U6 Q( |# `+ A+ u
7 I$ B7 ]' f+ }+ |  o4 qThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% j/ `: l, I, O7 ]
performed in ring0 (VxD or a ring3 app using the VxdCall).
" @' m. L1 Z& @! c  oThe Get_DDB service is used to determine whether or not a VxD is installed
- `" \9 {! @& Yfor the specified device and returns a Device Description Block (in ecx) for
- f, h$ s2 o- Lthat device if it is installed.
+ v" j" I! E1 A8 t1 t" z4 A* R  s" L+ g8 h2 ~& u3 ^3 m
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
' J' @4 y( ~2 G# f   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 b: f! e: q9 T, B7 X0 {/ E7 o$ J   VMMCall Get_DDB
8 Z* a, I$ P! O0 [+ p   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 `) D, a* M) G2 F

- J9 h' H' s; n* q8 eNote as well that you can easily detect this method with SoftICE:" S' A$ L: L9 I$ A
   bpx Get_DDB if ax==0202 || ax==7a5fh0 s) v# H2 c8 \$ H( A( h% J3 }6 D! h- w
9 L1 _) v5 K- a1 F" i2 V9 H' Q
__________________________________________________________________________# h$ M- b0 z, |# s: r7 p& J
& D. ~9 E( `" S8 }
Method 10! ?% S4 a2 s( F4 t+ b" F* c) a
=========$ Y$ G8 w% c( x# r! T: s* d  u

- Q/ [* l" R) m3 U# A$ `=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
: T" F8 G% h3 r3 ]/ m  SoftICE while the option is enable!!
" Z" _! S2 p  L( e9 Z  l& y; J
6 {" K  I5 g* m6 \4 FThis trick is very efficient:
" M( U( I; E4 D2 J( T7 w8 V2 Yby checking the Debug Registers, you can detect if SoftICE is loaded' ^8 \- j! B+ H8 O" ?8 N$ P' `
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. H* }$ ^7 {& B9 t# n! E
there are some memory breakpoints set (dr0 to dr3) simply by reading their
- \7 _, y) \" l: [7 Kvalue (in ring0 only). Values can be manipulated and or changed as well2 S+ \, ?2 d, n- e- S2 g
(clearing BPMs for instance)
6 J% h* q( r+ H  o, {: C
- `( ^' w* l/ J8 x$ f4 {/ D__________________________________________________________________________
8 s$ A/ w/ U! B+ f
: T" x7 c/ A) h& `8 r. fMethod 119 _% @9 \7 I. w; C
=========& \" \: u9 h9 }% {' m
# H8 R/ y8 y; Y' }7 p' f+ _. |: \
This method is most known as 'MeltICE' because it has been freely distributed: S5 f5 S! }- S1 w( z! O6 O
via www.winfiles.com. However it was first used by NuMega people to allow
$ L5 |+ u- P# I7 a; f3 z6 lSymbol Loader to check if SoftICE was active or not (the code is located
" O: c9 D! ?! y: N7 e& s. a2 I. ^7 Sinside nmtrans.dll).1 D4 _8 y; p$ n" A0 u
# P, W8 m# l! a9 z$ J* z0 y. i. Y8 a
The way it works is very simple:
2 H8 e# D1 D1 H3 D: v( l# ]6 j1 KIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 [' Z* S  A3 ?WinNT) with the CreateFileA API.
+ Z1 d3 s; c* t2 B/ ~, Q' Q$ p6 U! _) C* p
Here is a sample (checking for 'SICE'):
! Y7 j4 g9 G9 H
# q% D, B9 u: l1 ~+ lBOOL IsSoftIce95Loaded()  ?- U$ {/ A1 v- [, \1 x
{
! D( P* S  P! v0 H2 p   HANDLE hFile;  , j- ]6 M0 B  P1 O% ~- U) t8 F
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 h3 U. r0 |, k
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
: ~' \. Y( g! g: c5 M6 Y) S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 ^; A; N  P& ^! Z% y' S   if( hFile != INVALID_HANDLE_VALUE )
7 C: d" Y% Y2 Z/ m5 l3 a2 H   {( \4 q( m' P% j4 R. [7 b
      CloseHandle(hFile);3 N6 m- j9 ?5 X3 h
      return TRUE;
8 O1 W( ?7 j2 H3 M! K   }7 L2 Y; Y) ?$ j. a4 N$ |
   return FALSE;
2 ~# g/ w$ O- z$ L: F$ I}
2 @$ ^; y. w% A
& v% X7 r9 w' c7 _+ QAlthough this trick calls the CreateFileA function, don't even expect to be4 |5 l; p3 w1 j
able to intercept it by installing a IFS hook: it will not work, no way!7 V6 ~4 ^- I2 R
In fact, after the call to CreateFileA it will get through VWIN32 0x001F8 L: T$ y: _7 T# p3 Z; I; P' @
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- h2 N4 k2 G6 s6 Q/ t7 B
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
  x* B( v) }2 c" Bfield.
& x6 E& P8 ]7 p5 |6 O% h7 tIn fact, its purpose is not to load/unload VxDs but only to send a + _4 b2 o9 M0 G& ^+ T! ]0 u
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
& C+ |8 f' @8 o" @1 c( g+ qto the VxD Control_Dispatch proc (how the hell a shareware soft could try
0 I; u  t8 t; n/ }+ lto load/unload a non-dynamically loadable driver such as SoftICE ;-).4 `8 u) u- G/ l# X- M7 y2 d$ E
If the VxD is loaded, it will always clear eax and the Carry flag to allow6 q, D2 h8 J; K* N- ]
its handle to be opened and then, will be detected.* J  U0 d! D* m4 T
You can check that simply by hooking Winice.exe control proc entry point0 X; u6 b; P8 k% u* i, g
while running MeltICE.% h6 E! y5 ^: i+ J- a: c/ J% e; d
6 s. i, c  C$ A3 i6 C

6 s+ u1 h- m' s  00401067:  push      00402025    ; \\.\SICE
. a4 s4 j1 b7 _9 K" m  0040106C:  call      CreateFileA
' k# `& J, a- V2 _7 t  00401071:  cmp       eax,-001
' x4 G# q* m6 w* G  00401074:  je        00401091
1 k) b6 V/ @8 Q
) T' p4 i; E+ v9 j$ o# N+ N3 a- F/ a& _3 q" g# G$ O3 ?
There could be hundreds of BPX you could use to detect this trick.( T6 m4 V2 Y3 t2 r  J
-The most classical one is:
: v2 v! X0 y1 @3 c% n' x  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
! p/ K3 d, l5 i9 Z* Z: N    *(esp-&gt;4+4)=='NTIC'
9 p0 z1 T. M! d8 N: K9 Q  g' s
5 v& ]" m9 ^9 K( C% a-The most exotic ones (could be very slooooow :-(8 Q$ L  S0 M1 L* V5 A. H! |
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 }1 a: Q% y) \$ a" O' ~     ;will break 3 times :-(
: I" |, Q$ Q. L# y" i. n. o2 X4 _$ W# ~6 y
-or (a bit) faster: 4 r/ S1 d2 f6 H1 a
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 O0 d* u' C: c" n( m7 t

( U+ k' |7 w4 m3 c: }: |- h   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
0 c- @, j; [0 ]# ~( e3 w( [     ;will break 3 times :-(
# G$ g$ Q& V- s. g( m8 v) e6 G& K# b0 d" _2 Q$ h3 C' w( i
-Much faster:
$ `$ b  b/ g8 L5 d1 B1 {   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& M% J  l$ W2 }# l

' h/ @* \5 |) G- a- FNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
; M0 f! c  p8 h0 ofunction to do the same job:
- |5 b, k6 N' P4 U
, f/ c& {% O) |; t  C% W* t   push    00                        ; OF_READ3 D& Y2 o; `, d8 p8 l- [# Z
   mov     eax,[00656634]            ; '\\.\SICE',0
! _/ E" U- O! {& f   push    eax
7 \( T; C% V& g4 s( D" W* r/ ]# X  z   call    KERNEL32!_lopen
6 X$ F, }6 D, @7 a) D0 \- c   inc     eax0 \4 q7 k0 W# Z
   jnz     00650589                  ; detected
0 A- m, l3 n7 C, E9 e  o; ?. U   push    00                        ; OF_READ
6 F; ~* D( T7 C2 u2 n& g" u   mov     eax,[00656638]            ; '\\.\SICE'/ `* u; G6 l4 ?5 e% r. c
   push    eax0 u9 m4 m- P1 ~1 f# a$ c
   call    KERNEL32!_lopen$ o& F  t. W2 d: V4 b3 g5 j$ U
   inc     eax
; D: T. E9 U4 W; o* s) ^   jz      006505ae                  ; not detected
! z: _4 h$ n" ^$ \
1 D! C' x; s( x6 ~$ u3 r' q( A* s( R; n+ P% A* o" Z; f! }! }
__________________________________________________________________________( T9 w) ~0 K: Q1 K, g9 m  s
6 q, U5 J6 k6 [* @2 T. b- i
Method 12
. e' ~6 S7 p3 F2 B7 L! N' m7 S=========
$ e7 E: l% B2 T/ [9 Q# u8 K6 W, K! S9 G7 l$ l
This trick is similar to int41h/4fh Debugger installation check (code 05
7 [& g2 [7 U1 t&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ a. i6 c! X! M" e' I  n/ Q4 aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: D) m8 u& s  c$ ^: y3 c
* c' ^- D( d# g; n) w4 y0 p' Y: h   push  0000004fh         ; function 4fh7 }; h! @& Z8 [5 `  O6 l
   push  002a002ah         ; high word specifies which VxD (VWIN32)
3 ^; i: L4 {1 U, h1 o1 W                           ; low word specifies which service
+ c/ O- o4 l8 q3 n! O4 f                             (VWIN32_Int41Dispatch)
6 ^. @3 x1 H% E  a  q   call  Kernel32!ORD_001  ; VxdCall' f/ q, p- |/ X% G; N0 B
   cmp   ax, 0f386h        ; magic number returned by system debuggers
4 D$ w$ E, Y% S2 E2 S1 Y   jz    SoftICE_detected
# [' r- H5 _, h5 @( I
1 [" \6 O# s$ JHere again, several ways to detect it:4 _5 |  n2 v4 S! l

; y" u3 D. M9 C8 ^+ M    BPINT 41 if ax==4f
4 l9 F; d/ a& D
# h* ]6 j. Y! D0 X    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* F+ w9 B8 ^8 R. ~5 u
9 e& t$ _4 p+ J8 J3 n- `' f
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
, Y* C* ~, C' i2 L" a* R; o/ r4 }2 j. ~) @/ J5 \3 A2 F
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' ]; Y4 X" F5 ?# ?
5 Q% _: u+ X% d+ U- e% i3 z1 }8 n
__________________________________________________________________________
4 O  r3 `9 ?# A
; Y* T1 x- g( e) O$ a; PMethod 13& T/ S8 f7 A# m! R' m- P* t5 Q$ X
=========
; T* h2 `4 n0 a! \4 D. r/ H2 ~+ @* ]$ y
Not a real method of detection, but a good way to know if SoftICE is  M0 S" ~  @! S  E6 ~/ b& F
installed on a computer and to locate its installation directory.. p7 \$ {% g5 f# Z# e+ K/ K
It is used by few softs which access the following registry keys (usually #2) :1 w" Z) B7 |: x: ]8 S$ u, j$ W. f
& [5 W8 G$ w$ N+ {8 o5 X( G6 e
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. p! ^1 k5 {. Z\Uninstall\SoftICE
7 L% V9 C) F0 J: s  s0 n& _  M-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ B* H. R" ]( r( g-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 o) N6 t2 j) A/ b; l! l
\App Paths\Loader32.Exe* r; Z! E% I! b9 J# l

4 @7 P! ^4 I" r, V* r; M$ J
1 U2 y2 M* z' LNote that some nasty apps could then erase all files from SoftICE directory
& b) Z5 l; M6 ^) ^2 C& J2 K3 T(I faced that once :-(
0 F2 l. O6 \2 h* O2 n# j
" r4 [. q' m8 w# s" _Useful breakpoint to detect it:+ m# ^4 H5 h5 C; B- Z
  {6 u9 K! q9 a. [) e+ c& V6 A
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'6 W0 t$ P! ?3 p1 U  ?1 x9 \  Y; m
1 S2 d4 }# U3 F0 z* l! m
__________________________________________________________________________8 K: D. }4 V* S( X, c; ~
/ F( n- a) [$ ~
) C5 c! n2 @" L
Method 14 7 _6 S4 ^% o9 ]. d/ D6 v# ^& T
=========9 a* x) E2 h* {* O1 a* t

8 B! k/ ~2 q/ q; L1 eA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# W' a. U$ s) W; S, q) kis to determines whether a debugger is running on your system (ring0 only).
2 |. |! I) l0 R1 P! D' s; E; O, x1 _  B
   VMMCall Test_Debug_Installed
) y! J1 w) i0 B; D   je      not_installed5 Q* n, H- c4 ~$ K/ L, n

- t2 F  l3 ~7 X; z7 zThis service just checks a flag.  S7 f8 C' Y( C+ o- T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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