About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% Y  I- Y, g0 ?- v, o
<TBODY>
. r6 ?) d( C9 F3 ^2 I9 r<TR>1 l' P+ ^6 }: ^' P
<TD><PRE>Method 01
) ]: t. c; q: d1 ^# m" h=========$ `" L' O# F% j5 ?; x
& ~1 k* D1 Z1 B) Y
This method of detection of SoftICE (as well as the following one) is
0 w/ b0 u" E! l# o& V6 Nused by the majority of packers/encryptors found on Internet.
; c' V1 O. v' `6 r/ l- wIt seeks the signature of BoundsChecker in SoftICE+ \0 I* C$ M6 Y+ }2 q. w4 J( d5 o
( h& J+ |. S& P& ?& Q6 `
    mov     ebp, 04243484Bh        ; 'BCHK'+ c- c7 l4 h# S2 u- \
    mov     ax, 04h# A, t# i2 R: J$ l% i
    int     3      
, t  r2 e* }6 p    cmp     al,45 T) \9 O& l& \+ j$ \* d
    jnz     SoftICE_Detected
% P: ~! b/ X( M9 d; q: e" }- R
& a& Q: ?5 S7 I0 d7 p" c___________________________________________________________________________: Q) e2 i- b; D$ U

, E6 ?6 L& q, w) {( N& g) v0 uMethod 02, k( d* A# Q$ \
=========
; P1 Y) m& b2 y! S+ W% f; v
! U, V8 u3 ^2 x" RStill a method very much used (perhaps the most frequent one).  It is used
7 {/ d2 z) Z* G" p! D. V( _0 Kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% l. v/ P% w' P) [5 s7 \1 |or execute SoftICE commands...; S- k8 m7 `; h! T. S! I7 g+ i
It is also used to crash SoftICE and to force it to execute any commands
) E6 f; e3 j8 @, K% y4 ~8 T4 x(HBOOT...) :-((  2 ?4 ^$ A: T2 I4 Z

) Z6 J" c4 |3 d6 G8 `- VHere is a quick description:
* L. L% j4 G9 H-AX = 0910h   (Display string in SIce windows)6 [5 _: B6 V* [$ T8 Y; X) b, o/ H
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)2 ^2 K2 E' E4 J! X0 v0 w
-AX = 0912h   (Get breakpoint infos)
6 \+ y& ^# h! J7 @6 t, A4 A- ^-AX = 0913h   (Set Sice breakpoints)
6 Z6 D0 ?% \+ @; k' W-AX = 0914h   (Remove SIce breakoints)
" t& r% W  y. U% u
. [: r+ |9 C- X1 gEach time you'll meet this trick, you'll see:
5 }, x! p; ?5 `" A) Z-SI = 4647h9 I3 v  W4 h- ^4 z- y) F7 \8 o
-DI = 4A4Dh$ v4 H0 R; q% [
Which are the 'magic values' used by SoftIce.
/ v  n& C. x' `/ A! @, ~  VFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.! ?* x1 n2 L, k

1 |. c5 J% K7 JHere is one example from the file "Haspinst.exe" which is the dongle HASP5 Z  B2 y5 W" I+ i' O
Envelope utility use to protect DOS applications:
1 [  W3 f4 o. p! p! o- C6 A3 C& E" r- @2 D
$ |: N8 M0 Q) D; L  f& @- k
4C19:0095   MOV    AX,0911  ; execute command.
2 ]3 s1 R" m5 b; ?+ E: K5 R4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ n( I3 d% q7 T& d
4C19:009A   MOV    SI,4647  ; 1st magic value.
) N: Q1 u4 r- K: j% v8 d& l6 d4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; ~6 D6 _1 [+ H
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 [1 D' U' C( ]. J. c4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# S4 u( Y; \6 A" u! P! v2 J4C19:00A4   INC    CX7 u9 i+ T( j! d" B  d
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
$ d; S3 d3 \' b4 \3 B# b5 w9 V4C19:00A8   JB     0095     ; 6 different commands." O# t5 ]% T- z2 |1 C& ]
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.! h$ O9 U+ ?! ?' G% F, f/ D8 s
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :), u1 i3 D) P$ c& L* ]8 @- U" }

. m) _! U2 T* T0 ~! DThe program will execute 6 different SIce commands located at ds:dx, which
/ R9 c1 D8 j9 n. s: a$ a& ?are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
; ]2 U7 K, y% T0 q* l
! \# F4 H! L8 V( F/ k* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
8 V3 h0 J0 c4 e9 [; j___________________________________________________________________________. i4 v7 `/ }/ c2 N# V
) T- @* ~2 ^+ K- Z/ G2 N9 Z6 N

+ ~( s6 r; r% g" G1 bMethod 03
, h3 m# E: E% W$ @=========0 Y9 f: S6 I( o2 w3 e; [

& p: }# S1 z5 [7 t8 n2 |: J/ `Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 F6 \; U& m% \3 z(API Get entry point)3 t+ |" M3 {/ t* h; ]- {
        
1 p  x3 v* E0 \9 j# w0 N% F' W/ S, N- B! }
    xor     di,di
5 C* O) B: D( Q9 l3 Q6 y% m* B    mov     es,di
* ]- f4 p( l$ i6 v5 n- P+ ]    mov     ax, 1684h      
; o6 N1 z" J$ p: O* x    mov     bx, 0202h       ; VxD ID of winice
- H% W' ]! R7 l4 j7 b    int     2Fh7 i+ n1 ^) r  b# ]6 p9 M
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, s, g+ c! i" B' n" `    add     ax, di
! g6 z; Y, O3 y0 `7 r3 y* p8 r- L    test    ax,ax
: B1 @9 m( B" Y# w+ }1 `    jnz     SoftICE_Detected
( t. }5 \% X& I8 N# U! j0 ?& S( A0 |+ k; F' H: k- U+ `( D1 G
___________________________________________________________________________
, X3 r6 z) A& ?3 z7 g( w. B+ X5 Q: e+ F) N& l2 O
Method 04
" ~/ l) u8 |, `8 V" n* p=========; e- c9 s8 E* x

; A( G2 A8 t" v# b7 j8 w1 dMethod identical to the preceding one except that it seeks the ID of SoftICE
8 Y' k3 ^5 q% E; `GFX VxD.
5 c: u7 J7 B- g( v) [( i+ c9 Z$ u7 l! U) _- }/ t" m' ^, Z# P( E
    xor     di,di
8 c5 L$ D4 t! N$ {" {    mov     es,di1 E; U  R1 j! `+ {1 |( G% |
    mov     ax, 1684h       . M: r" i5 b7 [; h" \# g2 ^6 @$ d8 Z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 ^0 X3 J/ Y' e9 R6 i5 U  X9 m
    int     2fh
) Q- A# \& A1 D8 H2 {" P6 Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) r( u+ W# n+ y$ K" [% ?  g    add     ax, di
! P, g5 U$ f2 s4 _8 ?: k    test    ax,ax. I7 P! Z; r4 `2 X+ Q9 I# t
    jnz     SoftICE_Detected) R) r& a2 o6 p, x

- H( Y: E6 G4 p. `  U& C__________________________________________________________________________
4 q% F, r6 f) M( `2 P
: t$ c# X2 ]+ c8 N0 E: W" y% ]# w
/ O0 }) M6 J5 ^3 D" G/ M# ^/ U: gMethod 05
6 z4 q1 s0 C3 Z* G=========
0 j) v/ t/ @2 E. z$ f( ~9 A9 t& N7 y6 g! x7 U% Q) v2 X
Method seeking the 'magic number' 0F386h returned (in ax) by all system) m! \0 i5 @( s% a- H
debugger. It calls the int 41h, function 4Fh.
! a1 G0 g3 a! ]* yThere are several alternatives.  
& l- L+ ]3 o. Z4 h- n! s
+ d6 x% P. v8 GThe following one is the simplest:/ n# G% x0 F8 B$ C
9 f: R; C$ E/ M7 U: [* K0 q
    mov     ax,4fh: D3 e# F% L8 x5 R; D
    int     41h2 c" j1 Z( m* K7 q" H+ a
    cmp     ax, 0F3866 }) d  p. ]( v  W
    jz      SoftICE_detected) }, I2 b; V4 u
3 h) [' |, ?/ g+ l" ]
# O* [. ^2 c) F4 o  X! o, `
Next method as well as the following one are 2 examples from Stone's 4 u* M! K" w, p2 _, k
"stn-wid.zip" (www.cracking.net):
3 j5 V) v- ~1 [# l% N! W! j- \' g, b; d7 m  T4 N) m
    mov     bx, cs% W2 W% l& [+ Y  Z, e3 I- O
    lea     dx, int41handler2
2 J7 F: @: w) F/ F; a5 T    xchg    dx, es:[41h*4]7 Z% l* G. Y. F3 d+ o4 ^( ?9 z
    xchg    bx, es:[41h*4+2]
9 _' a% |# U& N; F1 J& A4 c2 r    mov     ax,4fh* O9 g+ c1 ]6 R+ k. r
    int     41h
" C' }: \; v) [6 u    xchg    dx, es:[41h*4]
+ J% J: p, \7 Z, o8 ^    xchg    bx, es:[41h*4+2]
' Z9 H) D/ _( D% `' E    cmp     ax, 0f386h, f$ y& J9 ]( q2 Z" w
    jz      SoftICE_detected6 D8 [8 l$ r% E
' l/ b: a$ T" i! R7 e7 w, h: w- @
int41handler2 PROC
8 `% T3 z' {6 g& s    iret% n! a) o' I7 o& z! z5 i% o2 E0 ^
int41handler2 ENDP: `; `$ V2 h8 ^2 ~; C5 C3 B* z" Q6 t

& |1 g" A, R; u% u1 \+ H# G  n; r$ y/ `8 N3 o0 k
_________________________________________________________________________
; c+ g$ l3 K! R1 h) s" g
; M3 T5 t; _8 r  L9 q# q" U$ j/ g1 _& K6 K2 \: @8 @
Method 064 j9 T/ J; L; O* w8 B8 u
=========
- e  g4 o2 I/ \) B) Z1 J" k* w  K7 ^& L: G- _

7 w- p4 O7 G% H9 t* F, x: c+ {2nd method similar to the preceding one but more difficult to detect:* E. R  B3 g, d7 q

" P7 [( j4 X+ v7 c: c. K* g
  G. |1 {& M5 f9 Aint41handler PROC
7 u3 M$ A# X- ^' J' g& I0 T    mov     cl,al
1 W( ?/ g8 N5 a( |    iret; s+ Y, N; k, N$ x. o) A* C; O
int41handler ENDP
, j  V2 B4 m" Z( j! L9 r% R* K7 `$ a; F8 Z- C' V% i
. @$ s' |& O# K2 }; L: B0 u
    xor     ax,ax
8 |% o, g8 s$ n8 K1 W    mov     es,ax& j, A9 G8 B% M0 L, V
    mov     bx, cs4 w0 I' k2 ?/ T- @& {2 H' v
    lea     dx, int41handler9 l2 ]1 A# e! C( _; ^& o
    xchg    dx, es:[41h*4]$ J  o& K# S) R, O9 E0 }9 C
    xchg    bx, es:[41h*4+2]! J* O- V# f' h5 q9 D' w$ [
    in      al, 40h- ]* \: R+ U- F
    xor     cx,cx" e0 q! u4 v) P( E4 N
    int     41h
6 e' O+ z" C( t  e3 R7 ?    xchg    dx, es:[41h*4]
+ Y2 b5 h. F* h6 ^    xchg    bx, es:[41h*4+2]
, L; F# H% D+ X# t( T$ s7 p    cmp     cl,al
5 i. W- S/ `  e% |) a; E    jnz     SoftICE_detected7 Y. d0 t- l* u: B9 E

! D/ F7 d$ s: x9 \6 n0 u_________________________________________________________________________& l0 e) _/ c5 K- g. B3 f! I5 |
( o* J4 X9 p5 o4 m
Method 070 n+ N# l8 u/ P# w! b( z' N
=========; u  d' Z3 ?9 T# ^" Q  a

# l$ z$ E6 U7 I0 _  \2 e, x% RMethod of detection of the WinICE handler in the int68h (V86)1 V1 d/ h' V) m0 [+ A

7 ~" v6 ~" h& h7 q* R    mov     ah,43h8 Q4 w- |8 H3 H9 A
    int     68h
* u$ [1 K! y, y5 q" Q    cmp     ax,0F386h
+ {' j2 ?2 g% Z. m    jz      SoftICE_Detected2 W$ j% I1 |, {& U- v: B
/ r& [6 e5 ]  G( q- U+ w+ Z5 B% z% O

' P8 o/ Z1 U1 P  T7 S; p% m) D/ U" N=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit0 W, E: v$ o. h! s' m" t5 g
   app like this:5 \: M/ \% ^7 J2 I! {3 J

8 }9 r7 J7 F' ]& `4 K+ {   BPX exec_int if ax==68
# f6 W2 ^# k9 F' r0 G6 b; K, ?8 D   (function called is located at byte ptr [ebp+1Dh] and client eip is
  y; W# d* H0 y5 u   located at [ebp+48h] for 32Bit apps)+ z' y1 O/ q5 w" V9 v+ f6 A! \/ j9 x
__________________________________________________________________________( @2 x7 \7 F- t) C2 Q6 s/ b
3 `4 i* m" K% i! [  j- v
7 d, h0 b5 u' J
Method 08
3 K, o: ~. h+ S' v( Y. k4 e5 F9 E=========
' _7 Y' l/ i* d# p% C' {+ {1 }0 }6 k0 w" h  j7 g/ e& g! ]
It is not a method of detection of SoftICE but a possibility to crash the/ A, \6 ^; B0 O' i: b
system by intercepting int 01h and int 03h and redirecting them to another6 K. ]9 [9 Z& x8 [  ]! y* T$ c& Y, n
routine.
* Q  s" R2 R& }* ^It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points4 z: K$ b( \) n2 V/ S, W
to the new routine to execute (hangs computer...)
8 h0 K# S1 q, h% }% V6 A! m8 f) s7 H$ G9 N' S8 _0 s+ v% W# t
    mov     ah, 25h
% n5 P4 \% H. J# J4 d5 P- ]: [' N    mov     al, Int_Number (01h or 03h)
. G% c4 R% O, ?" N0 r! ^6 m    mov     dx, offset New_Int_Routine
% @- ^- S$ q( c2 G2 q    int     21h: e% e. R  i+ R! y* ~! \
8 i; W8 t. `6 e8 l3 C; }3 y
__________________________________________________________________________
2 e2 S* C  t3 E7 F2 W2 _9 g0 c' g, g; b2 S" Z9 o
Method 09
  g0 N+ p5 S0 @( L* N1 t# a7 b" Q=========) V6 g3 u7 q* u3 U

/ g1 g5 v+ y8 B1 S( zThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ A# u) ~; f4 y0 G% W1 q
performed in ring0 (VxD or a ring3 app using the VxdCall).* @7 s2 R" w' d% ]* `
The Get_DDB service is used to determine whether or not a VxD is installed
9 }8 H  W4 k( b. g* mfor the specified device and returns a Device Description Block (in ecx) for
  r8 t4 @! o0 k  F4 ~that device if it is installed.. }; a/ o! P* {3 m

" z+ |9 X2 ^  `* S. w$ c   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
% a$ x, j2 `- o! @/ F   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)7 {: |, R- P3 f1 r5 O/ Q
   VMMCall Get_DDB- Q( N. x! l$ ~# G
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 Z: N$ q, [4 Y8 J7 }- l! _0 l5 L& s6 d8 w$ ]0 E
Note as well that you can easily detect this method with SoftICE:
% p; t' J. Z) ^1 J! _4 u6 h   bpx Get_DDB if ax==0202 || ax==7a5fh/ ~2 E5 r/ C" `* b1 m* G; e3 P- d* U

3 M; M: p8 D* g6 {__________________________________________________________________________
4 O' R3 ^) y% q* `! T
! e: B1 c8 c5 x$ ?) J# SMethod 10
+ d# I& Q. q! f0 f( M7 B9 A. b3 |8 M5 Y=========. U" F( |! Y: X0 l$ S4 e( O# W

* ]8 K( f6 |, W8 K* E=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ ^; s' q/ f6 Q, }) W
  SoftICE while the option is enable!!
  J2 T" u0 L! u: ^* Q; g: H1 I/ V9 w( r$ \( {( i9 u3 K; g8 s
This trick is very efficient:
$ ^) ]8 f) j- Z& n4 i0 Y$ A. \/ Z" zby checking the Debug Registers, you can detect if SoftICE is loaded
' O9 Z7 k3 O& z  S( M9 g! T(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 ]$ s% C! ?* W3 j* S+ |2 I; e
there are some memory breakpoints set (dr0 to dr3) simply by reading their
& F: ]8 {6 J8 V3 F2 U3 kvalue (in ring0 only). Values can be manipulated and or changed as well
. c; ]3 J% ^" f- d- F(clearing BPMs for instance)
/ Z; o# g# |5 }4 t2 c5 v4 U- K
__________________________________________________________________________/ b) F9 C1 z) O4 B8 F: A6 O
) W' H' L. X$ E% a' H/ \" ]
Method 11
  L4 e1 f) T. ?- e: u: a  v=========
, e, Z, z- |" o) A
- U! x/ U& u" a2 tThis method is most known as 'MeltICE' because it has been freely distributed
& e: @4 D$ H( K& k; Y) K1 I/ hvia www.winfiles.com. However it was first used by NuMega people to allow1 U/ C# p1 h, U8 ]9 v+ F
Symbol Loader to check if SoftICE was active or not (the code is located
5 a5 s. ^( Y1 t6 {* h' E1 k- |inside nmtrans.dll).- s4 H4 i. G! a  m0 f
, g0 x$ E& S) u% d) H5 V
The way it works is very simple:
+ C$ t3 B/ c) k7 jIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
1 g, M7 H3 d# W2 Y+ yWinNT) with the CreateFileA API.+ \6 V' G: ~% D5 j5 [
8 I0 f$ ^" ^; q1 x9 K' w
Here is a sample (checking for 'SICE'):+ r' F' T- P7 p8 j- S
* U) |. \* g2 [, W( _7 x1 J
BOOL IsSoftIce95Loaded()2 v; a& x1 X( a1 s& ~# K% V
{" T- k2 A5 K( _
   HANDLE hFile;  
! \8 q0 Z0 |. X8 c: B$ Y& y   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& p: Q; C# C1 Y% c" c! V                      FILE_SHARE_READ | FILE_SHARE_WRITE,2 R" m$ k% D- u0 e3 ]/ c
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 H2 d9 l) ]! L% u$ `/ c# J& R, q% {   if( hFile != INVALID_HANDLE_VALUE )8 X- L8 O0 D- X: _: _
   {! o+ g) s$ i( i& @+ g* \# Q' P
      CloseHandle(hFile);0 |8 K5 ~; m! i: A  }" Y
      return TRUE;( n9 W  ?$ i, p9 Y
   }+ \( U# a) R: A) |+ }  r# T9 ~
   return FALSE;
! v6 y  n8 L# W4 I}
# D* V8 R" k) o9 P% r7 X: J7 z  `" F/ d& u/ J8 M9 ]+ a
Although this trick calls the CreateFileA function, don't even expect to be
. v$ L5 I+ H8 j+ e6 R& b( ?2 nable to intercept it by installing a IFS hook: it will not work, no way!# a. z: M2 d% |4 R6 \
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: R, [/ b, H  @3 w
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function), c# S" I% {0 Q4 i, F
and then browse the DDB list until it find the VxD and its DDB_Control_Proc6 K5 [  d! c4 M6 j, a6 d
field.+ O7 o  `7 q+ G0 _0 x( V! V
In fact, its purpose is not to load/unload VxDs but only to send a
3 w& Y( w& R" [: S  lW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
+ A+ [/ X  r+ O2 \7 wto the VxD Control_Dispatch proc (how the hell a shareware soft could try
  G8 S3 U. v- u$ r; Y$ q. g& gto load/unload a non-dynamically loadable driver such as SoftICE ;-).- L$ g- u8 O/ L; y
If the VxD is loaded, it will always clear eax and the Carry flag to allow' Z+ |9 O, Q1 h8 O8 u3 L" _
its handle to be opened and then, will be detected.
3 H  ~; y: g. c( Z0 p! S6 p0 [You can check that simply by hooking Winice.exe control proc entry point
) u2 Q( l: I1 L* ~" Q4 Z3 `while running MeltICE.0 v+ \" e1 ]1 c5 m/ P  i
3 o2 I4 c: t9 T% ^' c

" P6 y  {) C) h/ c- M: v  00401067:  push      00402025    ; \\.\SICE
/ r- m- o1 T2 H, C4 F3 y3 H; o/ K  0040106C:  call      CreateFileA( y$ ~) E3 R7 l2 ^  x) J
  00401071:  cmp       eax,-0019 \1 X, T4 x' R4 E. B1 W. J
  00401074:  je        00401091
" K+ C2 w$ Y6 c) R) e. |) I, B8 L3 `
" A1 P# P; s) r: O
There could be hundreds of BPX you could use to detect this trick.
2 {# G  L" q! [4 @+ x+ M; Q9 D-The most classical one is:
5 n; Y' R7 t* r4 x  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||4 k3 G: x7 I, Q  b9 I  U5 e
    *(esp-&gt;4+4)=='NTIC'
2 i$ ^% \. `% L# V7 o% ]2 k% k: u: P3 g$ p. P
-The most exotic ones (could be very slooooow :-(" ?7 x2 b/ Y# H1 M2 L
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! j/ a4 U! m' J
     ;will break 3 times :-(
. c. `8 n( k8 J$ q3 ~5 R$ ?+ E7 a/ f! H8 K
-or (a bit) faster: ( \4 ?. w8 N5 g( Q; @* \
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 C/ ?, v" l( s# l3 E2 X; m( A

% V5 J7 E. S, F9 h+ n! f  w   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
  q. [+ V  U9 W# f: f, {: ~     ;will break 3 times :-($ D+ v! r4 Q% O" @+ N1 r  C$ u
0 \" y! r' G& `
-Much faster:; Z- ^3 x0 C5 U  O/ z8 P+ x$ n
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
4 _" I- X4 {& }; q/ G: ?4 ~
" y0 n: l" v8 |8 q# rNote also that some programs (like AZPR3.00) use de old 16-bit _lopen5 W0 D' R' o5 N; `2 N1 U
function to do the same job:1 K/ G2 O3 `; ~4 [
; A( ]; A- w1 y# o& L
   push    00                        ; OF_READ  l/ [7 U/ q: ~  T! }
   mov     eax,[00656634]            ; '\\.\SICE',0
+ [: ^; b/ w, l' ^: A9 }' |# D   push    eax
" W- I. k0 m  p6 x' l$ C   call    KERNEL32!_lopen
; }# @6 |3 G0 s1 x   inc     eax  ]" @4 z3 c6 _+ n) P3 R" {
   jnz     00650589                  ; detected$ V7 b$ q2 c% J9 Y
   push    00                        ; OF_READ7 H) z5 o; b8 P+ a
   mov     eax,[00656638]            ; '\\.\SICE'
9 R! L! X! v" K$ _. \   push    eax0 S6 X$ I/ O3 E3 f0 J; y9 M
   call    KERNEL32!_lopen6 v1 |5 [1 H9 M6 R
   inc     eax
* B9 v# I. w- f7 x6 u   jz      006505ae                  ; not detected
  a9 Z. \5 c' j
0 q/ r! X9 u5 ^2 p2 ?
% H5 |, t8 Z0 ~* v, U__________________________________________________________________________
! I# P0 ]  Z; C" {
  d; z2 }( ^% S" u+ jMethod 12
/ Z( v* V' r; o- {) p* K5 y$ o=========
+ w$ s, h4 s: n3 a# i9 r
+ V: q6 [' ]; u2 y- Z$ AThis trick is similar to int41h/4fh Debugger installation check (code 05
2 S4 M5 j3 o9 n9 q- b9 ~&amp; 06) but very limited because it's only available for Win95/98 (not NT), r4 p' v( n0 F) V" n" N; Q+ A
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
* O# O' b2 n: f+ `) I
/ i4 j/ ?+ c2 H! {" N/ K   push  0000004fh         ; function 4fh
' \; q: k( O0 n9 P. s! e) u   push  002a002ah         ; high word specifies which VxD (VWIN32)
# L" `- s7 y' z; L; a. s3 q                           ; low word specifies which service7 J2 U* n8 G7 L( \5 a
                             (VWIN32_Int41Dispatch)
5 A+ E' i- h. J   call  Kernel32!ORD_001  ; VxdCall0 X- J1 ^* s7 Q) e& o: F* P
   cmp   ax, 0f386h        ; magic number returned by system debuggers' L3 c8 E. A  V
   jz    SoftICE_detected
7 o7 c- Q/ g% l
( b# T4 P+ d! B, r' T: O, gHere again, several ways to detect it:
0 c. b8 c5 f" o' A) P+ x- R- |6 c
4 @. e' W8 O- \$ T: x% R    BPINT 41 if ax==4f8 n. ]! e& U" R2 ?0 P) S

# H, m. \9 O- a9 ]    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 V6 z+ _7 W/ E+ O( ?$ V
1 d4 ]/ g# P6 m0 f( ]) t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 U& i! L( m2 C8 O# g$ d9 |# b8 S6 i! m
4 n9 _* \1 @8 `1 a' s  T5 ]  Q/ N    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' ~3 ^5 T' V; T) ]

3 I$ s; H9 y, }: T+ I1 A9 D# ^__________________________________________________________________________
1 a6 o- N$ F: ^' \7 N
2 w; T4 |  v$ e7 p& A, W# f( zMethod 13
9 o- C; u/ A0 r% y=========
- v- i* y4 l+ Y
9 ^# i. s& ?$ o6 B- l; F( H' N: @4 T' |Not a real method of detection, but a good way to know if SoftICE is
5 K" x2 ?' x% ]9 v( t8 Yinstalled on a computer and to locate its installation directory.; T5 i% s9 x0 L' M
It is used by few softs which access the following registry keys (usually #2) :
! ?' N  z3 E# I& A* f' x* \6 r# ?: H1 O. R( v: h0 ~
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 O' P- N8 Q: \) |: L- ?2 |\Uninstall\SoftICE. {6 U$ V4 h7 x6 B, |
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ U! p  {, R7 w3 U7 W7 S
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 b& k6 o6 U. o# _" O0 v\App Paths\Loader32.Exe1 Q  I; y. J2 f9 t

! }) U! u  Q' C' _: O2 k
* h. v4 F+ J* t7 e9 ?' P; eNote that some nasty apps could then erase all files from SoftICE directory
6 ~6 H) ^4 x' E/ t(I faced that once :-(
1 ?* a) C  K) F( K& K% Y% @! u. r1 C# \' N1 y
Useful breakpoint to detect it:: l& C* w0 g8 n( z5 V0 R5 N
. T! v; Q( x% \/ S* g$ S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& ^! j+ z& W1 t* ~
& O5 Z) A! T  Z$ @__________________________________________________________________________5 ]/ o  o- t( X# I, G

5 L* q- @/ D+ d6 K' I5 h
" o4 b4 q$ A8 M! z9 k5 v# y% wMethod 14
* `+ g9 F  l! ~: o=========
6 l( D" v; {% z, l5 ?+ C
- J. u* M5 t  I9 E5 o5 yA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# K3 R3 t+ ]2 {" ^1 S2 C2 q1 yis to determines whether a debugger is running on your system (ring0 only).) l, s. l' I( K, [9 `- x
9 }+ o+ I% ]. {; X
   VMMCall Test_Debug_Installed
0 `! Z( h1 u% \% H. e3 a   je      not_installed
/ B' p! D4 w& ?& S4 s8 l  G6 f7 R* Q4 t
This service just checks a flag.
, d4 [0 [; ]7 h* t</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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