About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ J2 {6 z( j" t0 Q( C) E
<TBODY>
2 S7 h# K# |# S8 W5 y5 c<TR>
6 @- ?, {+ I% k( m2 M/ C; P4 t! [<TD><PRE>Method 01
" g/ x* F6 l9 r=========6 r/ p" c, n% o  D# F" d

  C/ v2 O5 J5 ?; `/ TThis method of detection of SoftICE (as well as the following one) is* O; N, Q% ~+ V" f" Y9 P5 A3 h! D% m- I
used by the majority of packers/encryptors found on Internet.# T) p' g. u# w* h
It seeks the signature of BoundsChecker in SoftICE
; n7 j" n0 g4 c! c, i  K' u( `% }
$ \( t3 }( d; q# R    mov     ebp, 04243484Bh        ; 'BCHK'
: O# n+ h& M/ }    mov     ax, 04h
' }! H9 f: j; f% x# H! I    int     3      
9 c3 p, b6 `5 ~3 c8 r7 o5 G! o" J    cmp     al,4
$ u- W% x3 U7 ]    jnz     SoftICE_Detected
5 [- X* P. s4 Q6 F( f& R$ h4 t* }) X+ b5 }
___________________________________________________________________________
; l4 t- Q5 I( q* c! t
' ]7 T; h  A' ^  h+ i* fMethod 02
. `# K$ j/ N  t! q0 ?( ^# B=========" N7 c/ i8 m) K+ Q# y
6 y$ F' i# \: q/ a; b
Still a method very much used (perhaps the most frequent one).  It is used0 c- k, X7 ?0 a, o% f
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 }( Z2 P$ O' X0 e& c% M6 ^or execute SoftICE commands...: a, ]9 k$ ?: v9 E9 H
It is also used to crash SoftICE and to force it to execute any commands
+ w4 U$ U5 t5 o3 t! N(HBOOT...) :-((  
7 h! p% o7 w7 s
' \& X7 B2 P4 `! Z& yHere is a quick description:6 A7 f& f& j2 G; M( c5 V
-AX = 0910h   (Display string in SIce windows)2 g1 }4 O1 ?$ W+ ?9 q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) S$ [3 a! y2 A* V-AX = 0912h   (Get breakpoint infos)
; d8 b  ~8 B* `: k2 B  @-AX = 0913h   (Set Sice breakpoints)! e/ Q& t9 Y; B- y8 b, p
-AX = 0914h   (Remove SIce breakoints)0 ?$ g( |: ~3 {( u  P9 N6 j, c

, q3 u! @% w# B6 B/ f3 XEach time you'll meet this trick, you'll see:6 s; Q2 _7 w2 Q( l3 t8 U+ Y
-SI = 4647h1 h7 z. m! I, Z2 g
-DI = 4A4Dh, a( j) z1 d( j8 o
Which are the 'magic values' used by SoftIce.& u7 x. _0 B- `9 I, U' y
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& `1 G- x: y$ _. j- ]7 {5 F
" H2 ^4 X! z9 i; c
Here is one example from the file "Haspinst.exe" which is the dongle HASP( u4 W$ U' W8 ]6 T4 k7 _
Envelope utility use to protect DOS applications:
& m+ T' d( C' K% t& M9 e* P9 v4 }5 J: e' d4 \% }" L

' K' R1 E: V+ F* Q' a4C19:0095   MOV    AX,0911  ; execute command.
0 w: P0 g; |8 Z3 O" b' X4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
% y' y" R6 K+ }: y9 S- p0 M( h4C19:009A   MOV    SI,4647  ; 1st magic value.
' X1 H/ x7 j" n$ `6 {  Z4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
9 j+ t% D0 f' V4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 H. ^( n3 N2 R2 [: W: H
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 q) W/ B6 t5 {
4C19:00A4   INC    CX1 Y* Q6 H" @( l% r$ T8 Y2 f7 l
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
5 {4 y! W5 b+ g. M/ m4C19:00A8   JB     0095     ; 6 different commands.
# ~6 b: m* q9 A+ N" {, u4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 T6 u9 u0 v) i
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ z& ~/ M5 y( Z) \2 D6 C  k, e# K& ?8 {  d  w
The program will execute 6 different SIce commands located at ds:dx, which) x9 t9 N/ r- s
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.7 O8 F- f5 g) }" u

5 s7 L/ H8 R% W7 p& m* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: m0 R3 n* e2 q8 U4 V. e' l( ?0 J___________________________________________________________________________& A5 v, J$ P7 q( j

+ A9 D. Q# n; n$ z4 U+ n# _3 A; Q
- Y# |+ Q3 b) ^# s- b6 T7 |0 x' D) dMethod 03
. N5 C1 M+ i- C0 J; @/ v  R=========7 K" X" p; \- Q3 M" z0 O
; I. |' Y: o) ]" K- z
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( Q" A1 m7 K7 {3 O0 y+ {' D& H
(API Get entry point)9 i, }+ ~# f6 w6 ~6 D
        5 S6 V2 z  r, y

- g5 T# ^! [& c3 n' [5 Z    xor     di,di( ?- y( E$ \! o; u. P$ }
    mov     es,di
) n% w4 ]% m# \- t% f$ N% A    mov     ax, 1684h       8 O) a! Z( d8 ~) ~: Q( ]
    mov     bx, 0202h       ; VxD ID of winice& j6 w1 k9 g% B* l6 T
    int     2Fh
) X& l7 J! p! Z( o    mov     ax, es          ; ES:DI -&gt; VxD API entry point# b! y& t5 X! g  g( I
    add     ax, di
8 b& L* _& y8 V9 N( |, m    test    ax,ax
$ h: F% u/ {" F! A: e1 Z    jnz     SoftICE_Detected! F$ {. }( E9 d: d* b, }
0 E6 x2 C  Z$ b$ @) E* \4 K4 S. z
___________________________________________________________________________
, l/ R; N" s, z2 p5 K
7 t% p: c- E, q- r5 AMethod 04. Q# c8 t1 M& G; K5 j: v9 k
=========
4 p" d4 `+ {' r& B* I4 R
' V/ E3 ?. L7 r) }+ MMethod identical to the preceding one except that it seeks the ID of SoftICE9 Y; S# |$ _0 A2 P! l
GFX VxD.
% X2 }$ `# q* N3 ?: W$ `
2 ]; y* ?& V/ i( ]    xor     di,di; d- _7 ~8 r; y2 T' @
    mov     es,di
0 V! o  E) ], b    mov     ax, 1684h      
% J! u, x( e; s  _    mov     bx, 7a5Fh       ; VxD ID of SIWVID
; @4 l6 W6 e9 L0 V    int     2fh
- }* J1 M# l3 V" A% V" S    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 s3 h" \0 N; `/ h7 Y    add     ax, di7 G7 {! z; k  V  t8 Y6 ~/ Q
    test    ax,ax  ]7 N( L. u$ }) }
    jnz     SoftICE_Detected
3 T- A' e5 X" W4 o# L/ R" K1 w  v8 i: e) j0 B! ]
__________________________________________________________________________
( m6 q# Z1 w2 Y( T% P0 X; H( C7 x2 j/ ^) \

, N& k4 \8 j& D! QMethod 05
$ h; C7 y* ^4 q- [! t- I- n/ v=========
0 r  T6 a' [# Q5 S1 S; u
  l! A: [6 w. i  P8 tMethod seeking the 'magic number' 0F386h returned (in ax) by all system# T8 u( s4 G& ~9 |( w
debugger. It calls the int 41h, function 4Fh.1 ]2 A- V( P( ?1 l5 \2 k: W
There are several alternatives.  ' m# _+ W- F3 J1 |$ ]9 n
3 }" p4 n/ n* c* x9 X6 w" b3 ]( [" n
The following one is the simplest:" z6 P: V* D/ H8 p) G  s

) E0 l; T5 p+ I5 b" x0 ]    mov     ax,4fh
0 V, ]# s) B' L: d% X    int     41h
" z' I( Z; [0 _$ ^    cmp     ax, 0F3863 ^* p" A( G4 o' G
    jz      SoftICE_detected
: v* I8 J! @/ J( \- B0 G0 B' X5 L/ a" p; x+ G/ t5 u

8 ~4 i7 @. R' R" T* Y: ENext method as well as the following one are 2 examples from Stone's
% D0 e) x4 ^, \. X"stn-wid.zip" (www.cracking.net):
& H5 F4 X3 V6 E3 e* ~5 Z
( `& `& I" [1 `, T/ t; x# z; T' L    mov     bx, cs
+ z. V' y/ l8 v7 P    lea     dx, int41handler2
+ u% C* {3 [7 [. a% i% M7 k0 o    xchg    dx, es:[41h*4]
# f9 ^" V0 k1 \4 b5 b$ ^    xchg    bx, es:[41h*4+2]
3 B5 I2 n8 U6 {' l: Q8 b# g/ u    mov     ax,4fh* f+ J5 h2 N- L; S! `' m
    int     41h# l/ |9 D, v! }" `7 o
    xchg    dx, es:[41h*4]
' }0 K# e3 C  B* S  l    xchg    bx, es:[41h*4+2]+ T- P' q- a' I
    cmp     ax, 0f386h
% N8 F" q! {! w! p; w    jz      SoftICE_detected4 _7 l' v- q# w8 ]

, f9 r" A- i7 [1 j3 U/ Z; |int41handler2 PROC4 w2 C* N7 B* f4 l
    iret
+ H' F' S' Q$ |0 S( @- z& m/ X# iint41handler2 ENDP& _* A9 D" H/ b( |2 S2 {/ \$ C2 V

9 e3 E) a+ B' `. U
; o$ M- G& ~1 r) a# E# t* F_________________________________________________________________________
) J3 `7 l3 @1 N) H
6 t6 k* |1 X( G; I1 ]; q2 e3 x8 ?- i3 T- Y( K5 k% f- g3 p9 C1 z
Method 06
7 x' B9 P( M# K=========
( ]. V8 U. b* P/ b) g' y/ N$ B6 `. Y! l
. b  T. d8 X# `
2nd method similar to the preceding one but more difficult to detect:7 t' T% I( I7 o' P( ~

/ r% Z9 q4 X3 |: W) l6 X- c/ U  o/ H
+ ^. a* `2 Y0 ?" aint41handler PROC2 Y& o7 Q7 ^$ _
    mov     cl,al
5 w" K& ~8 v1 ~: E  W7 S" ?* V    iret. }2 _1 [, D, J  t! b- X
int41handler ENDP( M0 x  E+ W4 L$ q( |1 E' N

7 P$ S6 q6 g& N% A3 Y+ A# R
2 H% ?/ [3 c5 b    xor     ax,ax
  p7 U/ W: v" A0 Z: S    mov     es,ax
& K. f2 P' t5 T' m1 [    mov     bx, cs
- P% X1 r9 }- l6 |. o+ H5 O    lea     dx, int41handler# V! f5 _% \* v6 x/ I
    xchg    dx, es:[41h*4]- |5 c+ {  S' J+ m0 Y7 z
    xchg    bx, es:[41h*4+2]
8 Q4 Y4 d: \2 ^2 p. G3 D    in      al, 40h6 ?" ^1 g+ K! W1 @, L7 \
    xor     cx,cx
( j& a( y( M! O7 U    int     41h
, _+ \5 u& P; E% s+ R' L    xchg    dx, es:[41h*4]
1 G; g% \7 `3 F    xchg    bx, es:[41h*4+2]( x1 n4 D  `8 [# S0 o: Z
    cmp     cl,al
% V9 k3 I9 r9 J! s$ s    jnz     SoftICE_detected
4 T) k4 w5 Z9 r" M0 I# b$ m6 S' n5 {# q/ `
_________________________________________________________________________
8 K+ B- f1 G9 g4 Q
2 t1 h% I& R" E( {* K) qMethod 077 c. \# q: |4 l& f( e
=========+ K; |; r. e6 E+ ?  s
) \% y0 a9 I/ t1 `  f! O3 `
Method of detection of the WinICE handler in the int68h (V86)+ S/ B5 n- G8 {! X1 p; s, i

( h% k) M- j  P0 [    mov     ah,43h
6 O" k+ P( V7 Q" r    int     68h5 T2 f% L; l4 b! m" t5 g2 x
    cmp     ax,0F386h9 q4 T+ I  T* e) j
    jz      SoftICE_Detected* K4 }! |& m# @' R! [
/ |' B9 v& e% m' @0 Z, n
  t8 }, q2 S5 S/ r# P7 d
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
$ I( V: j8 R- i" i5 L4 f7 t   app like this:: t' m! T1 e, C$ y
0 s2 s' L7 Q* t, a# n# ]. `" V
   BPX exec_int if ax==684 W1 H. Z# s0 V/ ?
   (function called is located at byte ptr [ebp+1Dh] and client eip is; W0 Z1 m* W) @4 U9 I. N
   located at [ebp+48h] for 32Bit apps)2 y. V$ Z+ O2 i
__________________________________________________________________________
8 b* J! e8 ?- O8 V- G! {8 J  g6 B% _( j# t% s% y! v6 V6 s- {

' J4 f  D/ B: E* b1 yMethod 08! C, H" O5 |! }- M/ Z5 [" J
=========
  L# w3 q: a% _+ B
) W1 j) n6 T. N; z+ O$ S6 BIt is not a method of detection of SoftICE but a possibility to crash the
, q' \% ?+ ^! c7 e* }. `, p" F& osystem by intercepting int 01h and int 03h and redirecting them to another* D- B8 c" o9 U3 i# x$ E
routine.: v0 O# X7 Z" P/ L" j
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, ]: r# A5 R, ^. q! ?* u
to the new routine to execute (hangs computer...)
3 q$ I* n) P( H! |* h  B$ d
' I7 {, o3 {0 d+ Z5 F7 J    mov     ah, 25h4 {3 M" \7 G& X2 O( B( }
    mov     al, Int_Number (01h or 03h)
- y+ p" R6 t; N, Z- k; A6 t    mov     dx, offset New_Int_Routine
, G6 y# j: A6 B2 L    int     21h
0 h# R! U8 l0 |/ e) Y
! g  P+ D; M1 X0 q. k3 m' h8 b__________________________________________________________________________
6 U; Z* J6 m+ F  p5 ?% G9 ?5 R% R1 q5 C
Method 095 |& ^7 ~$ Q6 w8 y
=========
) A3 @7 D, f) C3 V0 W9 Q6 [
! X8 c- `7 y9 ?6 B+ ?( ]# OThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! Y+ q5 S$ h1 b# G# l( m$ E% H1 x, M8 Aperformed in ring0 (VxD or a ring3 app using the VxdCall).
2 N' a  g+ E$ BThe Get_DDB service is used to determine whether or not a VxD is installed
% c+ @& L9 o& d, J+ Vfor the specified device and returns a Device Description Block (in ecx) for( a; W- ^! b" h$ C- N1 D! w- d
that device if it is installed.+ w' u- \% _0 M" y( U; q5 ^

$ k  [4 T" z8 a  T' p$ Y/ q   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ \, o6 v  ~. S' ~3 s# F
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
. E3 K  ]4 D, G! D. }9 \$ x7 l   VMMCall Get_DDB
$ n" u7 t: D" i* ~; ?   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
3 K! F% k, ^+ Q: v3 Y
8 F2 y( @) `8 KNote as well that you can easily detect this method with SoftICE:/ r! ~6 s' E/ i) Q* A& q
   bpx Get_DDB if ax==0202 || ax==7a5fh
1 j5 }' f" Y8 i0 ^: c* ^( B1 v! A, A7 k4 I2 j
__________________________________________________________________________
8 x! a& x1 k+ K' E# n$ ~
; H$ B  H  i% w6 g' W/ UMethod 10
5 s8 A2 Y: n& Z3 K" `/ U=========. L9 i- j5 j# E7 `. G+ V

3 r% L% j+ u, G0 p4 J3 Y=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 q$ l; f8 a4 Y5 w  SoftICE while the option is enable!!# f# t8 n5 ?+ g3 i

. y" Z4 R1 K3 I3 r& R* JThis trick is very efficient:
. R- _- v  @3 {, E( u7 i1 `- U1 Tby checking the Debug Registers, you can detect if SoftICE is loaded
; H( t7 Z- V. ^4 c6 V- Y# g7 |# B(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; `4 U# s% M! A* i+ [: R7 N
there are some memory breakpoints set (dr0 to dr3) simply by reading their7 p2 |& d! u2 K9 z6 m9 @
value (in ring0 only). Values can be manipulated and or changed as well
7 l" ]7 I& l1 X' u7 P(clearing BPMs for instance)
3 U; k0 X% \5 M) p( [' C" o
& A  x: J+ d% r! R__________________________________________________________________________0 b2 \5 f- _( a0 d- M% l
- q0 e; x, ^. p5 v: n* z
Method 11# B$ I% l9 m& W7 F
=========9 g) o* R2 E( ^) b1 D6 u/ I
$ [! q7 L% o  I9 Z( }# |0 I% V+ `
This method is most known as 'MeltICE' because it has been freely distributed
4 I7 ~$ Y4 ^2 r( {) I) Yvia www.winfiles.com. However it was first used by NuMega people to allow
* E5 z; e& r9 f) |Symbol Loader to check if SoftICE was active or not (the code is located% o8 Y5 k, N" C2 Y' K* Z. ~# U  F
inside nmtrans.dll).
/ f6 Q$ L+ i6 B) G0 f/ y+ C$ f9 b: ^
The way it works is very simple:
; z$ q4 C' _8 b; G# W7 _; u3 kIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 q' u, B; b* [) y$ F4 n8 d
WinNT) with the CreateFileA API.1 i0 V2 {& U5 m3 }  n! k
  E4 ]9 S; U1 k. z" c& |! t7 B
Here is a sample (checking for 'SICE'):7 K0 j$ y, V* d0 s/ h* L4 Y
; k9 T5 g1 U3 k, {: i
BOOL IsSoftIce95Loaded()/ n. b( o8 W9 H; y
{
5 X7 w9 v7 e3 l! `( ]   HANDLE hFile;  $ I5 `6 s- i. F5 _: X
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' I& K5 S3 X* k( C                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 l- z5 U; L+ }. {
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 G9 ?: o2 y0 N   if( hFile != INVALID_HANDLE_VALUE )
5 s# f1 V$ h3 D$ `   {5 |$ x1 }" W% f2 Z4 E/ V
      CloseHandle(hFile);0 S+ e& ]% n4 E3 r& D; B
      return TRUE;
; N& l! R6 U& ~% j( K   }
. W& V. c" D6 m$ W* R7 `) R   return FALSE;
7 _- s1 q0 R4 b% T: w}6 k* I. q% Y7 P

3 z8 H' Q- P, I: J- aAlthough this trick calls the CreateFileA function, don't even expect to be
- E+ Y- U0 c7 W& }; b( z- Hable to intercept it by installing a IFS hook: it will not work, no way!8 p& J& b, s6 W9 r2 k4 {6 P" g
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; W) L' j% A# P6 f+ P
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! H( Q: Z" c2 x; Q4 Wand then browse the DDB list until it find the VxD and its DDB_Control_Proc8 l7 Z! |7 a+ c" z5 w
field.& a; Y' H1 B4 x0 m# g7 \3 Q. v
In fact, its purpose is not to load/unload VxDs but only to send a
9 L; X8 g# h" w/ d+ a6 RW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" n% Z6 M. m# q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' ~# M- w+ q7 g! m1 q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
! ]- I  y; ]! R& G9 v( ^* @If the VxD is loaded, it will always clear eax and the Carry flag to allow
* C& e( s8 p  K4 Yits handle to be opened and then, will be detected.- o4 ?: M( _1 E. P4 ]
You can check that simply by hooking Winice.exe control proc entry point
2 {* \: c8 _3 j3 awhile running MeltICE.
6 a: N% z% O7 B8 ~' ~, v! i7 x  Q. v7 r; ]

3 t5 O  S7 K1 J8 h  00401067:  push      00402025    ; \\.\SICE
8 M8 p( J# I) a1 i, e+ F! R  0040106C:  call      CreateFileA6 L+ G- ?: u* z( z
  00401071:  cmp       eax,-001: j3 M5 Z, |3 i3 C
  00401074:  je        00401091
& H; \3 }4 Q: K) r7 G8 Y. k) Y( E1 g2 @' t8 s" K8 e
. t0 l1 @+ E, {/ M
There could be hundreds of BPX you could use to detect this trick.' z" S  H. O. T5 a, c
-The most classical one is:
# K  r* q* B$ z9 ^  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ J8 T4 C; m" y/ U9 u
    *(esp-&gt;4+4)=='NTIC'
$ z, G& m! y. |( F: \6 ^8 i2 h7 u2 B" J# N" \4 Y5 @
-The most exotic ones (could be very slooooow :-(, }+ @: D# u( a$ X  T
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- k7 O% a+ e: d! d# O     ;will break 3 times :-(/ H) T' z( z. _6 J' j. K% C/ {

$ t/ H3 g& o8 t: _3 c! y9 |" A% K-or (a bit) faster:
3 p; ^  g+ @! t! z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
8 L* |. n( l$ W  `' @3 P' _. C5 Y) O$ S* ]
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" Q; [$ S. |' O4 N2 v     ;will break 3 times :-(
8 M$ ~7 h. r* a4 R# _/ W9 i& D# e$ E) y3 x. _2 L0 l* O6 _
-Much faster:1 m3 I. {+ i9 h+ i' Q" y
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 I; w% a8 A$ N8 M' [. V' t3 ?

  b! }; h0 i$ [0 f* [Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 @# g" [- b5 S5 F& v7 E4 D! Sfunction to do the same job:
: {/ k  A7 E( [" L3 O+ Y1 b; Z+ v7 C3 }  j- G5 ]
   push    00                        ; OF_READ* F1 Z, T  S& A2 T: o% y
   mov     eax,[00656634]            ; '\\.\SICE',0: K( K$ w! t/ B8 y
   push    eax  f  [$ Y9 D$ W; B
   call    KERNEL32!_lopen1 A' D7 e2 T, p" \6 {6 k
   inc     eax
8 ^" X& o1 S' O2 Q7 v   jnz     00650589                  ; detected7 k  h* o) a/ W
   push    00                        ; OF_READ
2 L7 O( `. M# b/ f  K& _3 O( u8 U   mov     eax,[00656638]            ; '\\.\SICE'9 [  T7 A2 k! a: F
   push    eax- \5 i6 d' X. Z3 o. V/ @
   call    KERNEL32!_lopen
5 K& N) S9 t8 q8 j2 E   inc     eax* L" }. [: Z2 T3 Y8 f2 t9 _- @+ G- ^
   jz      006505ae                  ; not detected  Z& J0 _( n% g4 _
0 m% `5 V5 i+ w4 [: v, @' U3 H
7 O; o5 h" {9 Y5 B0 z$ K
__________________________________________________________________________
( k( b: b7 h" M$ I$ I  W) G4 u5 k5 J3 c: B1 K+ q
Method 123 m+ P, ^1 f% \9 {
=========
$ q+ K1 o  w& H2 H1 X4 Y7 q$ g& k/ v
This trick is similar to int41h/4fh Debugger installation check (code 05" w. L0 |5 w$ e- q; J4 X, z* |+ J# K
&amp; 06) but very limited because it's only available for Win95/98 (not NT), g  a' r1 Y6 U
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.  M$ _+ p$ K  F7 u1 k

/ H; c; D3 k, R1 _  |   push  0000004fh         ; function 4fh
( I4 M) t; l4 S; t6 A' q   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ w" k2 X$ {) r( D                           ; low word specifies which service
3 |- Y) b2 H1 N  t0 y6 @                             (VWIN32_Int41Dispatch)' N. w, _: |' }/ X
   call  Kernel32!ORD_001  ; VxdCall6 f% _$ Y  {# y% h! y" P$ c8 P
   cmp   ax, 0f386h        ; magic number returned by system debuggers$ r/ `/ _: H. |4 b( L# s8 x
   jz    SoftICE_detected& U8 O9 N6 K* t: C9 p

9 X% d% K" D" w/ D! X7 Q; z0 NHere again, several ways to detect it:
0 U4 i* b5 G9 k& F4 a; X
* q2 U9 {! T- ]* W- D    BPINT 41 if ax==4f3 o# q7 S7 l& |$ @5 R$ B2 \
( S! l# s+ }. ^
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 _5 p) T0 l, p% }( M" V, \" A) Q
- i1 b7 t4 |* D& J6 ]+ j+ m3 u    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 O. X" G8 L& @
, C& _+ V& |& [+ F& h$ M
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
5 B7 L1 r9 }# ~( ~
( V* f7 L+ I8 O__________________________________________________________________________
7 C/ A; o* I' K3 g. q
9 ^0 U7 o; W3 BMethod 13
5 ^- k; i* A* W8 Z, `% Y7 y=========: P' x4 Y* H/ E% ^8 I/ n

# g: U( j9 t: t) a0 SNot a real method of detection, but a good way to know if SoftICE is
8 _" [) Z9 }; A) einstalled on a computer and to locate its installation directory." q5 R" k6 O! j, x
It is used by few softs which access the following registry keys (usually #2) :2 Y2 @+ w& W; R) U
" k) V) C# V' }8 g7 n
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) o; D4 n8 }  F6 p
\Uninstall\SoftICE
& _% T) a/ ]" T; V' Q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- E' I% v) j9 L; @' t# S-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 J* ?4 B; ~: u$ x\App Paths\Loader32.Exe8 Q. X  D: N1 v0 O' x) J
) q7 L- ]7 k! ~7 D+ E, E( D' S

! r+ \0 G0 r% WNote that some nasty apps could then erase all files from SoftICE directory' x  [; B/ h- }( x& f6 m
(I faced that once :-(
% R  q# k) |7 T
3 K6 X/ y4 w4 ^5 }* pUseful breakpoint to detect it:
& N- r7 ^5 j& `8 }3 w
6 I3 l% X( L5 e/ O4 d     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) ?( D* R9 {- @' y+ C) F4 E2 f& F, n7 I" O+ U- ]8 ~
__________________________________________________________________________
! w9 Z# b1 [$ U' ~  _+ }" y9 ~! Z" _6 [$ L& ?; g% |  p% C5 X
! F( x7 ]4 c( b" r( x
Method 14
9 H$ c  Y% Z7 K+ H=========
+ j6 x+ {) [, b: t0 g  W8 K# C
+ e1 b+ _5 {8 O, Y( K% F$ c' x- kA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose- @( [/ G- U- B6 P3 R' h4 a
is to determines whether a debugger is running on your system (ring0 only).
9 q5 o7 {1 P% k3 G1 V* W, ?% N3 r" t" e  N: O/ W9 e: P
   VMMCall Test_Debug_Installed
0 v6 n( K4 t; c   je      not_installed
  A" j' L6 b1 E: q! I2 z+ y, l% }
This service just checks a flag.. |% \3 m  ~0 q, ^2 z, a
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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