About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
- |8 ?- v, Q* F1 i9 W6 I<TBODY>
" b. f1 v7 B9 K& _' j6 a<TR>. V- g9 U% i. v8 l2 k0 L
<TD><PRE>Method 01 4 T* Q. t2 u1 ]6 W! n
=========
% Z3 n* `. @! Q8 @
* m) b4 }2 Z" Y& BThis method of detection of SoftICE (as well as the following one) is1 P/ Q4 V% q) g* ^0 n
used by the majority of packers/encryptors found on Internet.1 V8 P  E: b$ M* j- O) X3 j& [4 N
It seeks the signature of BoundsChecker in SoftICE9 F8 e# \3 H: L$ e: j' Q  t
! D' a0 F" x5 p- r+ z
    mov     ebp, 04243484Bh        ; 'BCHK'  U- g; d( }4 f  Z! E% Y7 P
    mov     ax, 04h) V1 v, K# y5 w! H7 u
    int     3      
  g  T' o4 X# `8 S    cmp     al,42 H. B7 R) c0 C% r7 I
    jnz     SoftICE_Detected1 J( y/ }' V, ?: Q

2 X- j) q# e( D) i0 B% {7 z___________________________________________________________________________) S/ s1 P7 e8 ^- G

7 R3 j2 R( ]* q9 DMethod 02) G9 R+ K! W( |9 E( e) e
=========' V  P+ e  j/ \  F+ O) o* _

, e! M0 ]* u6 T4 jStill a method very much used (perhaps the most frequent one).  It is used
  j. f2 h  x$ Q& U6 U& O- Bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 ~4 X5 W% k/ O! Por execute SoftICE commands...9 B- r$ h! V# ~9 J" I8 `
It is also used to crash SoftICE and to force it to execute any commands7 q6 G; y2 O7 n/ s+ J
(HBOOT...) :-((  * F/ T8 o3 G$ R+ C

& l' [" N; n& I. u, }9 ZHere is a quick description:
# A8 E9 X! x7 O-AX = 0910h   (Display string in SIce windows)# }* @# g, s5 Q" ]" G
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
, C0 I( H* C0 E-AX = 0912h   (Get breakpoint infos)* E* x! y# |7 G6 t+ G- o1 D& w
-AX = 0913h   (Set Sice breakpoints)* P! b# l7 j5 b6 B1 y
-AX = 0914h   (Remove SIce breakoints)  i  G, V, K( J

9 u. c6 w7 D1 DEach time you'll meet this trick, you'll see:2 S. i+ M( n1 ^2 }8 }
-SI = 4647h
1 Q4 z9 e1 `( E: s, R" w-DI = 4A4Dh
: @# v$ \! g, }3 K) D. H  lWhich are the 'magic values' used by SoftIce.
$ i) \/ O- N' `: |% @For more informations, see "Ralf Brown Interrupt list" chapter int 03h.; i0 b( A8 F8 \
% e) p$ r) f6 b8 ]. _9 e) X7 L6 J; K9 W
Here is one example from the file "Haspinst.exe" which is the dongle HASP
" P1 Y8 t4 d0 p/ g1 W4 _Envelope utility use to protect DOS applications:
% D0 I, K) u- x: ?3 I5 U- @
) q: E: F0 d5 M) }6 \, f
( z. {5 l6 t! R: A9 ~' y4C19:0095   MOV    AX,0911  ; execute command.
* O+ |% b+ M5 ?  @. I; {4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
) g; G, t( Z' P) r6 K4C19:009A   MOV    SI,4647  ; 1st magic value.$ P' k) _9 y8 z/ N
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 v3 J6 V# [; w0 c2 S2 u
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& A6 y( @( H2 E* q
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" t. y' Y# S7 q& J& [# A0 O
4C19:00A4   INC    CX/ |+ r# _( O4 M
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" k2 T! j/ n3 ~2 Y% e. L, C1 B9 v4C19:00A8   JB     0095     ; 6 different commands./ W7 Q6 B' F& i3 U
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 T0 `1 Z4 |2 B+ Z: @) }
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)' p8 U4 B  ?3 `7 K+ _- Z9 `

( j" {. ^  h% |# b+ w$ F+ QThe program will execute 6 different SIce commands located at ds:dx, which7 ?- W" W( k1 T3 o
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.; j, d! c( ]0 @% W

1 ?' q$ Z5 @% Y0 L6 A! k$ ^) h, u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, X0 J+ b4 \7 j) [8 ~7 z4 V___________________________________________________________________________
9 n9 I0 @: {' o( A& g0 q( Z7 E1 B4 n/ D2 f/ z6 ?

) l" q2 g. i. N+ ?Method 03
$ t1 F/ a) P" _% Q( G=========( F* G' e5 \# h8 i
/ h( ?/ S6 O$ n% A  Q/ A
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 A) o; l1 G$ s% O
(API Get entry point)
0 v6 Y* ~/ S% x" m3 N        6 l3 N7 \. E0 Z

- h4 _. n% Z+ T2 B    xor     di,di
9 I- J, |& `' |( ], O( s: d    mov     es,di. R* K5 T) F" l( u% Z! y: {  h
    mov     ax, 1684h       0 Z* U" p, p9 _! G" d7 d+ ?
    mov     bx, 0202h       ; VxD ID of winice( L: N: G. j% W' Y7 s1 a% |" m4 |
    int     2Fh
* ]) [# k  e1 V  K) I    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 l- e8 P" z! G    add     ax, di
" e2 g/ ]+ W" R    test    ax,ax9 W4 H( r( U6 d4 c" \' A" ~
    jnz     SoftICE_Detected
* y! u) k  U% D* _1 q+ v- Z& g+ d$ W3 t( ]; l$ t$ C
___________________________________________________________________________
' @. r9 C$ n! L' w: y" b  D% J, s# P. E: j& R$ K7 Q
Method 04
1 Q" J9 a# X( n5 D" E( R9 W=========) t2 |9 _- I5 r* h  i7 O3 S! Q

$ A! S; ~( r6 m; `% B5 O: y- MMethod identical to the preceding one except that it seeks the ID of SoftICE3 c" [* G. _" q! c2 b
GFX VxD.1 I" n; n) L5 [# }$ K' g, p

; \+ O7 {! ]2 Z$ \% [, ~  s  ~+ k    xor     di,di
+ y5 e. k+ W8 D6 t9 s. i6 u. D    mov     es,di
5 A, v. R( L* ~/ t0 P5 h" e    mov     ax, 1684h       8 c6 o' Q7 i  U4 S6 A" L4 e
    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 E: @& k8 x2 |' C/ j
    int     2fh( j4 @5 Z( K5 T! N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ ?5 l7 E: V/ W3 Y    add     ax, di
  X0 V4 Y2 c, {6 }3 u2 l$ n3 N3 _    test    ax,ax
% M7 A  Q8 e% N6 _    jnz     SoftICE_Detected
1 f) h( a! h! W- x6 Q8 a5 G- Y& f4 e! G  C
__________________________________________________________________________
( h0 u" }/ ~# S% ?2 ?, l) _5 l5 ~- T) {% U( {" q

6 y% u, ?. {! X' |+ {# }; i, FMethod 05
+ H% S. [7 c8 W4 ~=========
$ o& c1 a% J& G8 C' F9 c' W0 A) I$ ~3 T* j4 t# `3 E3 d
Method seeking the 'magic number' 0F386h returned (in ax) by all system# @; i1 N6 ]0 `8 f' A. B& E4 A
debugger. It calls the int 41h, function 4Fh.: |2 T8 p- I* d: [8 z
There are several alternatives.  
/ j5 B' G0 J5 l3 ?. F8 C# T; R" l5 }. n+ x3 R) r8 _
The following one is the simplest:
8 P7 d( v8 W0 s. Y  k' o6 B7 E) M( \' _. N8 H0 F2 `1 P4 z
    mov     ax,4fh0 N8 E# U" c$ W+ I
    int     41h0 O" x( P: ~+ B2 e' U
    cmp     ax, 0F386
' `+ \% F: r( G    jz      SoftICE_detected
- `* q1 [( y( H( u' n: F% Q3 P& k" k6 h$ l2 O

( U. Q8 \) L. MNext method as well as the following one are 2 examples from Stone's
6 X0 U( J% s. K9 I"stn-wid.zip" (www.cracking.net):& z+ i1 ^7 V. ]7 G

' r1 M3 p" h, j9 r7 a7 @    mov     bx, cs! H4 E7 W3 x$ t* |2 g
    lea     dx, int41handler2
: H7 d$ p5 t2 t. j- _7 P    xchg    dx, es:[41h*4]4 P5 }( E& s7 \$ B: j9 T7 _$ P+ ?/ V
    xchg    bx, es:[41h*4+2]
6 ^% X4 |/ N4 K& V; O6 f* w* J+ Z    mov     ax,4fh% E( E/ u1 p, U9 m0 k! o
    int     41h4 w  M  {4 h0 C  b) y1 F6 }2 |
    xchg    dx, es:[41h*4]
) C( \, A( F8 p0 Z' H! N0 H    xchg    bx, es:[41h*4+2]/ |9 w( S( F$ ?3 Q
    cmp     ax, 0f386h
: T* t' f: K7 x% b" F* i    jz      SoftICE_detected
* ~+ {" W! o% {, U7 k( P! Y! x$ ~, p% t; s1 O8 Y) F- r% u) \
int41handler2 PROC% }" _+ s, V. t7 r% _
    iret& r$ q- ?$ {. W1 t( C
int41handler2 ENDP
4 |+ ?* a1 G( B! I+ g" }1 P% v5 P& m5 ~9 i+ S

2 Q* p6 Y- N- B  _) f; X_________________________________________________________________________6 W  O6 H7 F% y' i

- V6 I, u) |9 R+ L! Z# Z- U  |/ K8 ?  z8 Y; W+ e
Method 06
2 \; ^: s" P- j* G, E0 F" E$ q=========! n; m" I* M" G0 f, M
" B  L! O5 o6 i* R! t
  w+ N+ ]3 i" I1 `% Y
2nd method similar to the preceding one but more difficult to detect:
# ?! @& _3 k9 c: M& b$ N. W" [8 }% ?0 N6 P/ V% n7 o" T; S# |
9 v$ F  j  E7 [4 ^% P
int41handler PROC
0 W# m! E. L$ w8 _5 ]4 G# M& |    mov     cl,al
+ I* \! k5 L& H$ Q2 d/ ~/ c4 Q2 [    iret
1 B0 w3 U. x; g7 t& q. _) gint41handler ENDP
6 x# \: w/ @' ^3 i$ K9 _/ x- B) F( _% B, ]/ |! l# K

- Q5 @% j; R, c+ p, U0 ?    xor     ax,ax. n" Q- U" P( w9 \
    mov     es,ax
) t: U& t; @+ b; Y. }    mov     bx, cs  F: }# @. _' \8 J. i2 y
    lea     dx, int41handler; }9 {& U6 [$ I' |* c
    xchg    dx, es:[41h*4]
3 r# q$ c( K$ a% A0 N9 `9 ~5 p7 e    xchg    bx, es:[41h*4+2]7 z" I6 n) b& e! s% u; Q$ U/ v  Y
    in      al, 40h2 {# X: Q. \6 K1 N3 r
    xor     cx,cx
" }/ U, b0 K7 T# ~" q1 _0 l    int     41h3 Q% K7 `* K! O5 C& Q
    xchg    dx, es:[41h*4]
/ e6 u' I. G; M% y2 v1 y/ V4 x    xchg    bx, es:[41h*4+2]3 i  @" r: ]7 ]: L% V
    cmp     cl,al
% L6 t2 R. O/ L! @8 ]    jnz     SoftICE_detected0 C# b# W0 E' P9 U7 b
1 G' b3 V, y- s0 ~: A% d. o8 ], N
_________________________________________________________________________
: C0 Y4 j9 Y) `/ z$ A3 r0 Q* \
9 O/ D% ?+ i% p! ZMethod 07
5 K- J9 N2 C, g" y6 `/ l=========: S+ y1 j' N" u

0 d" g4 {/ F$ ]Method of detection of the WinICE handler in the int68h (V86)
' U6 |( j; f! H/ |7 S# h. k. m9 H$ P
    mov     ah,43h
0 h2 p4 _8 h4 V5 ^    int     68h# N; E5 o' }( o! G1 C
    cmp     ax,0F386h
5 h) k9 J- f. e* {: s6 C& S1 C    jz      SoftICE_Detected6 G3 O4 Q: w$ e% t" X
7 G; @# j  X4 w8 E! U
3 O& A  t9 W+ x( d3 c
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' w+ k7 r4 _# b( F
   app like this:/ G! ^+ ~* V$ f) l( [

) ?) \: P% J% E8 I9 f$ r0 D   BPX exec_int if ax==682 h9 N  F( M  d/ t& N0 s5 Z
   (function called is located at byte ptr [ebp+1Dh] and client eip is- c3 {6 Z9 y. J
   located at [ebp+48h] for 32Bit apps)
. p3 P8 T! L9 m6 S( o1 r+ G__________________________________________________________________________/ ^9 \( }( |  I" G9 p  }! _6 o

% A: v/ Q# `- j' X0 J& i7 r  j8 J& {- p1 z2 t
Method 08
: f4 C8 P+ a5 `; ?. O=========
7 H& E0 t% a& [$ c
( B9 J! J) g4 u% {, VIt is not a method of detection of SoftICE but a possibility to crash the, m0 I( c/ ^( R0 W! L9 c0 M
system by intercepting int 01h and int 03h and redirecting them to another
1 N6 z4 |: S- z3 {routine.$ E% E$ C% p+ e
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 F7 ~2 J: R( m& O* C( s
to the new routine to execute (hangs computer...)
7 m* T2 k9 k- w
+ `( Y2 _; f1 R1 T0 q' Y    mov     ah, 25h/ }5 y5 P5 ^# k
    mov     al, Int_Number (01h or 03h)% f2 n) @3 O: p* O
    mov     dx, offset New_Int_Routine
! C5 i8 y* j) o0 n% @( Q    int     21h
+ X; y3 k- n" ], j8 A5 Z0 z5 m- V0 x& j7 ?6 Z4 B& @; V. w0 o
__________________________________________________________________________, v( y# S/ Y: t- E3 [: r# t, j  P

2 S: t" x6 }8 Y, yMethod 09# C) K( f1 J5 P+ G0 m- h
=========: ?6 X8 T" d0 [" k2 H6 `
- `# |2 p( Y. L0 f+ c9 J/ j- L; A
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 Q* c' g/ F0 c, H1 `, N. }performed in ring0 (VxD or a ring3 app using the VxdCall).: d7 T: D; \) K$ \8 X2 K  t  F
The Get_DDB service is used to determine whether or not a VxD is installed
: c5 f2 j8 r; j' t7 ?5 Qfor the specified device and returns a Device Description Block (in ecx) for- f" q8 ]. X+ \, ^: P' j' q% R
that device if it is installed." T* L. y( \! Q! @( b4 i: h. a

- n" m) Y! E: N0 \# w) E   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID) k5 Y3 |9 }! i! @6 o: K$ s: Y
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 Z8 X& J' N' D9 K/ t/ D
   VMMCall Get_DDB
% s7 @9 d/ U" D& |7 B; _) k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 H( _# C: |5 f7 q( d8 ]2 w
+ f) E; m% p% ?7 h6 p
Note as well that you can easily detect this method with SoftICE:) I' J; y( F1 w# ?
   bpx Get_DDB if ax==0202 || ax==7a5fh; {; {# e2 ]1 y9 s# n* x

6 B- v( ]& U% M5 g__________________________________________________________________________* e' `" h# s8 k& i+ [. P
6 D9 G$ {/ Z5 Q& Q, x8 r5 g
Method 10
. T/ T$ @. o, ]=========
- ]0 e  _& G) y3 q" v: ]5 _; h. U/ O/ Q6 o6 T2 `! ?7 n
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with$ d! {, l/ L5 _$ d! ~
  SoftICE while the option is enable!!, O) d: d& O3 F6 ^
3 [& y7 O* B7 x5 R
This trick is very efficient:
/ N& U% \; L- ]( cby checking the Debug Registers, you can detect if SoftICE is loaded' n3 I8 E9 L: W/ j* Z0 H8 O4 c
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% b/ x$ \2 ~. A) cthere are some memory breakpoints set (dr0 to dr3) simply by reading their9 A+ T% ]7 o# Y8 K0 C3 f& P1 j
value (in ring0 only). Values can be manipulated and or changed as well2 @3 ^, g1 n$ i2 y$ l/ r/ N
(clearing BPMs for instance)
1 X6 o; |- g2 S* J
, v/ I' J  b0 M) C0 l__________________________________________________________________________9 ^, I  X/ O" y/ \$ h+ ]

0 S5 f; u! ^3 o& _. g+ Q5 zMethod 11
7 H6 F5 ~! ~9 Z8 x; @- s# X1 {& ]+ I=========/ H4 L! z$ I" j

+ ~* l1 W3 Y  U0 Y" f- K' I4 nThis method is most known as 'MeltICE' because it has been freely distributed( p! a8 g) q; d3 X
via www.winfiles.com. However it was first used by NuMega people to allow8 M) U: U" F8 Z
Symbol Loader to check if SoftICE was active or not (the code is located
  B3 g1 N2 M0 s" einside nmtrans.dll).
# Z& O. `1 I& t1 X7 t: G- E" d' F. J
The way it works is very simple:/ g2 |: T9 C) d% R' R( ^9 R
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for  v% m0 y! c$ X0 J% x  F2 p7 G1 l4 I
WinNT) with the CreateFileA API.
/ c& D9 U' \! j% |/ n( h4 ^+ D" J( l, v( r3 R, }! g
Here is a sample (checking for 'SICE'):
$ c3 V2 [" u$ \6 d! V" J; g( m0 T1 f+ F  r" _, {
BOOL IsSoftIce95Loaded()3 w/ `& J) C0 ~
{
- s2 \1 m# s' Y" q, N& |) z   HANDLE hFile;  & a1 u8 m3 r1 C! p- e/ ?
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 ?7 \7 v3 H- M% p0 E1 L2 u
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 z+ K8 U  S! x& r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  d9 X6 Q, t. E- H* B. N
   if( hFile != INVALID_HANDLE_VALUE )( Y# ^, L# s3 r! Y4 F) v
   {
. |( B1 q/ g% y      CloseHandle(hFile);
' [- V6 C8 `! P3 h/ ~. n      return TRUE;/ A( k9 v+ i$ {: t, K+ H
   }
0 b+ F9 R2 b. M   return FALSE;
2 B) z1 G3 r9 M}
5 p1 ~) m0 W: B3 q& q- z
- ^7 P7 C( ~( y+ `  }5 g9 \Although this trick calls the CreateFileA function, don't even expect to be4 u  _0 L2 U6 O
able to intercept it by installing a IFS hook: it will not work, no way!# I; Y. P  W4 E' ^8 z7 g
In fact, after the call to CreateFileA it will get through VWIN32 0x001F8 C' s" P4 h- j: K* o
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 Y! U' |: r$ P& V' e: x
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
& f+ F6 G( S$ X5 Y% }field.( y+ h6 q: f2 Q
In fact, its purpose is not to load/unload VxDs but only to send a
* I/ J  M$ s/ o: R  dW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
+ R6 P7 Q* H. Q; ^$ v6 Pto the VxD Control_Dispatch proc (how the hell a shareware soft could try: p" D  t# F* [  Z
to load/unload a non-dynamically loadable driver such as SoftICE ;-).2 {1 s$ x& s. F0 F( X
If the VxD is loaded, it will always clear eax and the Carry flag to allow
. p7 \* ?; h+ xits handle to be opened and then, will be detected.
6 T' O8 k; N9 ^, x) [You can check that simply by hooking Winice.exe control proc entry point! W9 m& B* t- C; v: v+ `
while running MeltICE.: _4 o! ^: [9 ]- G
  _5 U7 O% v# P  C
; q# V- o8 H! x) s8 Q4 Y2 Z8 L
  00401067:  push      00402025    ; \\.\SICE' y: @6 r, F# P6 M7 l
  0040106C:  call      CreateFileA
( ?* Z( b/ l/ M  E) v  00401071:  cmp       eax,-001
7 C- C4 ?% O' i5 a" ]  00401074:  je        00401091
+ o7 o5 G6 b* Y: F& C; \& \$ O3 X! R8 [/ y

# [! {8 Y) p3 E4 N( [+ NThere could be hundreds of BPX you could use to detect this trick.4 p2 i6 k2 W( j$ j
-The most classical one is:! R) p$ S0 ^" o' N5 Z8 T$ t
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||: N8 a- _* T! k+ F3 P3 K
    *(esp-&gt;4+4)=='NTIC'( [- a, [. U6 _
# v$ k6 |+ s; Y& Z1 W0 t
-The most exotic ones (could be very slooooow :-(1 }6 \! y( f+ \: N+ _( l, H
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 h7 g) Y. E. Q) a1 z# R- a3 A- @     ;will break 3 times :-(2 f$ W0 i" |; S4 E* h
& m/ x5 m' i3 r' t
-or (a bit) faster: & i  P% ^1 `  V2 ]) D
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')/ S$ G1 n, I/ J; \! s

( s, j' _- T* m   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # L1 O; M5 }: w' T/ Y2 O
     ;will break 3 times :-(4 X6 }  E" ]- W# e

( z( M7 Z" x6 }! k. S-Much faster:
3 U" _! |! N5 [$ P   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ `+ M, m& C* Y- f* p) c8 y1 d% S; U- r* J- }# ?
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 X1 ]- _' T0 \* r4 C. dfunction to do the same job:
4 D7 s' b5 L2 c* g5 J
+ e1 }/ t( t- O6 Y" N2 R/ s- d   push    00                        ; OF_READ8 `5 T& Y) ?5 U, Y6 {% Y) J
   mov     eax,[00656634]            ; '\\.\SICE',00 K* C1 L; o# ?) Y% f& H
   push    eax' F$ L! r+ O5 W: l3 [& q- d
   call    KERNEL32!_lopen/ R  r8 h# _1 a0 c1 A' }/ o
   inc     eax& _2 T5 k6 t( y! m. |2 V- W
   jnz     00650589                  ; detected3 t4 {) P' d% M4 U$ X0 k: Y
   push    00                        ; OF_READ
+ `4 h( H0 v* [( @   mov     eax,[00656638]            ; '\\.\SICE'4 m3 E7 q  }3 q. e
   push    eax& w" S' f' ]: F0 h2 I
   call    KERNEL32!_lopen! Q5 n1 G& Z3 M5 X+ o
   inc     eax5 N& r+ M- q; K* B
   jz      006505ae                  ; not detected/ z" ]9 W2 R2 y+ @% }+ c$ P$ b$ c% H. m

9 Y% A! }6 w- Y9 v4 q! q
3 {2 A( M# s. s6 j__________________________________________________________________________
# d' O- e" }" ?3 G  I6 H
. y# Y+ ~/ \" FMethod 12
2 I7 a* q* D# Z  a/ f/ f2 C8 W5 i=========+ T! u  j/ G& \# o  G1 |, q- Q9 X

( r6 x$ L0 o  d0 Q. S0 yThis trick is similar to int41h/4fh Debugger installation check (code 05
. N2 U& D, z0 f&amp; 06) but very limited because it's only available for Win95/98 (not NT)- q4 ?( y: Q" E& c$ o
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.. Q* Q9 Q  i# y0 e& a2 i
) {$ m- L2 V( p' {, b
   push  0000004fh         ; function 4fh) W# q9 m+ t% z3 h& Q6 l: b
   push  002a002ah         ; high word specifies which VxD (VWIN32)$ L; }& R) n# T9 n; ^
                           ; low word specifies which service
* G# B/ t  ^! Z! c                             (VWIN32_Int41Dispatch)+ S3 ?. n4 e; E, D
   call  Kernel32!ORD_001  ; VxdCall2 R8 R- Z& q) u
   cmp   ax, 0f386h        ; magic number returned by system debuggers
5 o  [) ?" d! \5 Z$ f7 Z   jz    SoftICE_detected
8 |' V& y/ ~; l) T
" F+ N- U3 I# cHere again, several ways to detect it:+ j% G( x, R" V. i$ H* c6 z% i

6 k/ b( S1 t+ V% @    BPINT 41 if ax==4f
' b; }' e* g7 \- F  F. E4 K; Y2 g* R) A2 X1 g" w4 N
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one6 ?  U9 p7 j2 L6 s) q
6 I$ B6 Z- [" G* e6 i
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ w. K2 b4 C9 \( n& F7 {2 \% C/ M# n6 ?) q" h& B! x7 C4 }' v1 C
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ L  Z% @; G& ]2 S, Y9 {- D8 k6 x* C( O3 j. t
__________________________________________________________________________
" _& d4 D' E8 W
' X. ?$ q9 v- L8 [  I. t9 V- \6 ^Method 13
: P- j2 T; I( F0 f$ @) Y=========
' _" i5 U3 U7 T3 [! B% s( M- {, A- r$ z3 f! F% J
Not a real method of detection, but a good way to know if SoftICE is
3 V: u& t) X3 c; Zinstalled on a computer and to locate its installation directory.& u. f" V& B8 w2 M6 n% e
It is used by few softs which access the following registry keys (usually #2) :
. q- h2 \0 G$ @- Z8 L, g, k# B4 U, S. P4 `
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 @5 u9 M7 O# ~
\Uninstall\SoftICE: A3 ^3 j' N7 Q$ }; _
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
1 x1 t# _, z4 i- l-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: U: n. y$ o4 \% Y\App Paths\Loader32.Exe8 h* d# b; O/ i5 @, e+ A: D
# j/ w9 d0 F- b& M  j9 k

* h& n' x, D5 K- @+ `9 j5 ~Note that some nasty apps could then erase all files from SoftICE directory
6 u' R* V! B7 q% q  l, G(I faced that once :-(
1 l4 X. t! H: y" l( ?6 S7 L9 P1 E0 x: p( U. i4 t
Useful breakpoint to detect it:! h' [0 V9 u# I. h+ ~8 g
& @8 z$ Y5 L, n2 b
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& ]' W5 f' N1 V# t
( z# p2 R! J( z/ a: E: T. r
__________________________________________________________________________4 I+ B* @: \" B( X* l

/ ], V( A/ g+ v. w
9 w7 j1 l- V7 D/ h9 A2 zMethod 14
9 R5 d7 n  f7 S4 B=========. M3 j& R% Z/ T
& V8 _+ ^  l' s
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 _( X0 Y1 `, Ais to determines whether a debugger is running on your system (ring0 only).$ W0 E4 \% _, T: r+ G- F  r: X% Y

. A0 K- s$ u/ g5 X   VMMCall Test_Debug_Installed( W( X, E9 J6 f* T7 m4 \
   je      not_installed
. H! F* X- h+ D' j! M+ A9 O6 }/ Z# R) W9 y2 E$ o# S5 o/ x
This service just checks a flag.
& S! k. ^  e) z" s0 a3 A: s# y+ w: G</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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