About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 n4 d9 U9 ?0 z: R- U
<TBODY>
! _7 n  w3 j* I7 r<TR>+ k  ~# K( @* r0 G
<TD><PRE>Method 01 1 e7 W/ |* H' D( M1 `" v
=========
& E2 f9 n7 D$ V2 W2 F7 p# u! {) R1 h
: _; m3 h. C& E  c  B, zThis method of detection of SoftICE (as well as the following one) is
8 [4 C4 S, h. N. Bused by the majority of packers/encryptors found on Internet.
# |9 e. ^0 B0 S- ]It seeks the signature of BoundsChecker in SoftICE
3 j8 }2 k1 l% C
  }% ~- d( {, l1 s% u    mov     ebp, 04243484Bh        ; 'BCHK'
! ]! U3 w9 p$ \    mov     ax, 04h
9 e* j( b9 h) x- t0 J& }/ s    int     3      
0 f- [; v7 N  w2 ]% q    cmp     al,4) ]" u9 F3 a" g1 h  W5 M- f+ x
    jnz     SoftICE_Detected7 M, f* r9 W# y
: E" @, l" o  e7 l
___________________________________________________________________________8 ]) }$ K' f/ w6 T  g
- a- M- c5 `2 c) M0 K) ~6 [
Method 02* E( K1 a+ ~$ A- ]
=========
& b6 b- k  \. z1 F& A
3 }6 Y: h$ g! G: _( M8 VStill a method very much used (perhaps the most frequent one).  It is used
- z; f8 v+ I9 ?# Jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 v! M3 Y5 C% K( `- l3 I
or execute SoftICE commands...
6 S0 p+ ~: u4 |) F' t# CIt is also used to crash SoftICE and to force it to execute any commands
5 |- o: d+ S2 ](HBOOT...) :-((  
1 {7 [3 I( ?( h3 |$ t3 ?- u/ w9 j9 I' u
Here is a quick description:
- u/ N+ n2 p0 s' m, S7 P, l-AX = 0910h   (Display string in SIce windows)
3 v# f9 Q/ F1 X/ j9 }( i, r-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 B6 l& d: r; `3 B% U. ]-AX = 0912h   (Get breakpoint infos)# y/ [, a' H$ N# s, S0 w) X
-AX = 0913h   (Set Sice breakpoints)1 M" l' _( \6 u5 M' F( f& z
-AX = 0914h   (Remove SIce breakoints)3 g: E  ?, |1 K- D7 v# M6 \- h* I
% e! J" Z9 ]8 P6 ~5 s. @5 x! M
Each time you'll meet this trick, you'll see:
  t" T' X, m/ S! N6 s( Q& Y3 E# U-SI = 4647h
% u' H' {3 q' v3 e( L* ]' o: l-DI = 4A4Dh5 y  B  ?! L" K, K; h' m$ a) U, y
Which are the 'magic values' used by SoftIce.) D  W+ g! Z, J! m2 L! b
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 L& M3 ?' v1 @

4 d; `5 F/ O! P6 h) S4 YHere is one example from the file "Haspinst.exe" which is the dongle HASP; R- c& A2 p, T. C! B
Envelope utility use to protect DOS applications:
  V1 p$ v2 i. G8 K8 C9 Z, h0 E" |/ p, R) B7 Y/ f
5 i1 L+ U9 ~# O8 q- T
4C19:0095   MOV    AX,0911  ; execute command.5 i1 q  k4 J  k
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).' W1 `" x$ @0 v# {/ }# M+ C. V
4C19:009A   MOV    SI,4647  ; 1st magic value.7 W0 s# K0 C( f( C
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
4 h  H/ a6 K) \  q3 S4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
* w8 o+ |- I" T0 I' x4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ C. b* h$ l; t3 k& j' q
4C19:00A4   INC    CX0 p' Q/ ^( a- b8 P+ P/ |/ s9 y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 T' v+ ^# a* |1 g- `! R' o
4C19:00A8   JB     0095     ; 6 different commands.
0 U8 ~0 `; u6 |" [5 K* u4 E4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 M9 R3 p; r' W  D5 O7 j* Z$ S
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 O& M" b- Z1 |5 j6 M

0 \" f* r  [8 q. c1 ~9 S. gThe program will execute 6 different SIce commands located at ds:dx, which9 w( k. O, C. y3 ]& g  x
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( s9 X/ U" a, M2 `1 l1 U, z
4 h- N. k& z& o# Z4 Z( J* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.) |( B9 o  x2 o% f, O
___________________________________________________________________________" I! Q6 A7 Z5 L. ]

. I' _6 P1 I/ Y: A  ^: B& U$ G
6 Q  W7 Y2 p2 D- ]) @Method 03$ q( s+ H  j( C+ Z' Y
=========$ k  Z! D% k* P$ @4 Q

; D6 O1 |7 |5 V$ ~/ |Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ i& P7 [5 s$ H# o) q3 H$ n) n
(API Get entry point)
6 T) _2 i1 j5 y- i        ) X$ j, i# v# J% F% ~, t
8 w6 O$ q7 X2 |+ O% r0 q, T* F
    xor     di,di. `8 n$ ^; X6 @8 X0 V8 ]5 a
    mov     es,di# J! c# Y8 n0 {% X- A7 p/ y6 R
    mov     ax, 1684h      
: ^$ D- T8 a* U' l/ W! i    mov     bx, 0202h       ; VxD ID of winice
/ z, ~, r; o6 _, `5 H' h1 r' w, S7 \0 c    int     2Fh
4 y4 Y, h& c4 p; g4 {* t0 e, Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point! a3 y) J, w. D
    add     ax, di/ J1 H+ {* Z) P3 U
    test    ax,ax# f% D' t! G. |4 ?1 |
    jnz     SoftICE_Detected: h2 t% e! r' Z! Q3 |+ d
( C4 ^' i, h4 t' I9 W5 E' a$ z
___________________________________________________________________________* \5 j! H( g- B) B- N( b. h
- B8 W/ {% o; N. g
Method 04
2 p8 c; T2 T2 R8 p=========" F1 S( ]2 ?, a" e: ?; V$ ~8 ^

& G$ F3 [& [0 n$ a+ jMethod identical to the preceding one except that it seeks the ID of SoftICE
3 e$ {9 N- v& _! p' FGFX VxD.! L/ b6 `, _3 p5 f

& P6 o8 i9 R$ n" L; J' B    xor     di,di: V9 q. [/ O& S7 V0 r4 M# r
    mov     es,di0 a3 _2 T; e- V. h7 t. u6 S" ?
    mov     ax, 1684h      
6 I1 i: i& C# e% {1 g, c1 ?4 s$ {    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 O/ Z) ^: K! F$ g8 F# I5 Q    int     2fh$ M1 m7 y9 \; |+ O- ~! r
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ }' e* x9 }2 h, w* E$ i
    add     ax, di- H+ h4 `+ O; P0 A
    test    ax,ax: ^! Q# z% W9 x; f
    jnz     SoftICE_Detected9 G# w  U6 Q& }  U: [3 R
3 |2 V  ~) ^+ J7 S/ t0 i
__________________________________________________________________________# n, Y  s1 F7 b  j
; \. R5 z1 {5 }( z  {( @* H1 K

8 [( Y6 k  V8 WMethod 058 E$ z/ u& h8 a! g0 j8 j
=========4 }$ M) U9 e7 Z1 {2 _

3 E8 l' a/ Y2 G( WMethod seeking the 'magic number' 0F386h returned (in ax) by all system( h# z6 V0 m) T7 J3 k3 m& J3 e
debugger. It calls the int 41h, function 4Fh.
1 i# S6 l; ^7 W. T) C( ~) k' m8 xThere are several alternatives.  
. N; F+ J* h8 _& ?& ^- b* J  g
# s6 w( n% l+ d$ B* TThe following one is the simplest:- K! ~3 x! ^. U. ~7 y
7 ]/ ]' u4 b; D! k
    mov     ax,4fh
& X6 v' s/ A0 p9 m7 A    int     41h
( O( S2 k: ]4 k  h8 m    cmp     ax, 0F386/ e. g+ j$ I! U8 k9 t9 [
    jz      SoftICE_detected
) L; ~3 c% C# i( Q% R; O" c! ]1 p
7 i% Z8 N6 E; s$ P2 e/ O
; Q' `* G9 y! O9 F3 y, KNext method as well as the following one are 2 examples from Stone's * L) h" Z6 _4 `. Z2 m  A9 X2 N
"stn-wid.zip" (www.cracking.net):; p% o  u" q) W3 |+ }

7 L/ l8 u- b9 T    mov     bx, cs4 R) e8 G$ m8 G
    lea     dx, int41handler2# T1 F; p5 {$ S' p' e
    xchg    dx, es:[41h*4]5 A, p- A+ o8 w, ?
    xchg    bx, es:[41h*4+2]% O% v0 {+ W, f, `# |
    mov     ax,4fh2 A) T/ c3 g* y8 E, d; Q
    int     41h
; K! a# [$ ^7 l" d" b" ^2 _4 O& P    xchg    dx, es:[41h*4]
! R5 g& b, f* J: I- K: D* N# e    xchg    bx, es:[41h*4+2]
- k% k1 I  z$ G9 L) \    cmp     ax, 0f386h) W# c, t* j! [/ A+ n. \
    jz      SoftICE_detected
4 @( A+ j/ e$ w3 F/ P
6 Z( T  Z: ?$ l( e9 ?) {int41handler2 PROC
0 E* ?% s& @" c    iret
& ^( F) d# H, K! {1 p! l8 [int41handler2 ENDP! i* N7 C7 J+ P' L5 |5 O: R
1 g$ i% l6 v0 {% o. r3 x( g$ }2 e4 ^

1 L. P) Y" a+ O. }; h2 Q; R_________________________________________________________________________1 b" ?$ e, b+ C4 w

7 o5 Z; e( P0 J" x; z6 H9 G) I6 a& k- U% \
Method 06% m+ w' M; G& E/ l( i! i2 J
=========
4 Y1 U0 r6 `8 U$ k4 J0 l" G- {- K: _
/ G9 }% b; L+ y9 x, N0 T  H
2nd method similar to the preceding one but more difficult to detect:1 J$ l/ [1 E9 U, Q* C8 I& ?2 S

" ^: Y  Z( S7 t& H1 {: Z3 n/ P0 A9 U' y& B8 x5 Y0 b
int41handler PROC/ u# b& @" s& c/ M* r
    mov     cl,al
9 T: j( f: r) k9 w3 S5 d    iret
0 ^0 H3 t  ]3 x  xint41handler ENDP
: U3 ^+ a6 b6 j) v( `0 F! f* s" E9 @2 x0 z
' V# M6 y8 j- p9 a$ ]! m
    xor     ax,ax
8 E3 t  U3 u# t: o  T% e5 V& T    mov     es,ax
6 F* N" i" c1 @! P    mov     bx, cs  u/ F0 g- B. S% b1 c
    lea     dx, int41handler2 U' a, n) ]# k9 W- y
    xchg    dx, es:[41h*4]8 x8 V, t4 K+ ?- y5 v' T' W
    xchg    bx, es:[41h*4+2]
' V$ L( N9 @2 L* P4 l    in      al, 40h
! H0 W& h  V% Y- b# ]. I) Q    xor     cx,cx0 A6 W8 t' _) h
    int     41h
6 N# R. S" Z+ {, G    xchg    dx, es:[41h*4]
: Y0 b5 \( O2 p% P    xchg    bx, es:[41h*4+2]
* R: H3 u+ ]1 |5 n, N( I  ~    cmp     cl,al% m7 p: q  [0 {1 M% W# ]5 l
    jnz     SoftICE_detected8 W% |" T% D. i/ Q0 q
* ?2 ^7 m6 i$ X' {' P3 \
_________________________________________________________________________
/ a0 ?* F2 T) k" s; c" L* e( F& k8 Y/ I. k( o
Method 079 Y& I( q% n% C: b
=========
7 p9 w  D& D  J( I! E  I3 [, ]  P9 z
Method of detection of the WinICE handler in the int68h (V86)4 C( ~" b. ^$ J+ x1 L" V) f
! {# I% B+ f& r1 _* z
    mov     ah,43h$ R: W6 i8 b- ?5 O" E
    int     68h* J" X+ b3 M# y- D' W0 d5 I
    cmp     ax,0F386h
* [7 P4 k+ N4 l* T/ v' C9 z    jz      SoftICE_Detected
8 P; V7 H( l' E" p( {0 ^, Q* z% }# M" S& @
( Y* o; n. I" l9 x: t
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 J; M1 I1 w; R" U
   app like this:
3 o% Z5 k) s. r) _+ g. m* L7 y9 x& |+ o( i2 h2 |
   BPX exec_int if ax==682 v: [5 u* `0 `  i
   (function called is located at byte ptr [ebp+1Dh] and client eip is9 `0 t8 n4 s1 {  I8 i/ p" l
   located at [ebp+48h] for 32Bit apps)4 ~/ M& }) b# r0 A$ {: f- m9 j
__________________________________________________________________________! f) h7 h. }! ~" H

, `4 d  d5 ?& U) y6 C- V7 f
7 P9 x, e; Y8 e; {: j3 BMethod 08
7 w  \1 a0 q& B* m/ ?=========
: _: D5 x& ]8 E0 W8 ^4 i9 B- Z+ X( D
& P7 B( @8 w, J- l) UIt is not a method of detection of SoftICE but a possibility to crash the  a5 L+ c9 v( @. n% a
system by intercepting int 01h and int 03h and redirecting them to another
* e( e" B2 ^1 V" R: d* L* jroutine.
# n8 ~( K) K+ UIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' s# v( }  T8 z5 @0 Wto the new routine to execute (hangs computer...)
, m" B! T5 T6 P7 P/ X1 [; k/ x" j9 M  U$ B! Y" O3 Q
    mov     ah, 25h  S0 }0 O  ~3 |- Y4 |2 F
    mov     al, Int_Number (01h or 03h)
) t0 k* D4 p" Y4 K$ d" J    mov     dx, offset New_Int_Routine
4 y- [" x  p7 J+ e    int     21h
% T$ H3 M( n0 _( A" o7 B5 e7 e8 w' t& O, M
__________________________________________________________________________) _2 a9 N. N/ o/ k% _

5 _7 M0 p9 \$ J7 qMethod 090 }: B1 p% r8 O) n) H4 w' t) F6 F
=========6 i6 B& F- ?6 {

; k  G9 U/ s& w$ {3 F* EThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% L0 g7 U. Q2 I5 I% w, j
performed in ring0 (VxD or a ring3 app using the VxdCall).1 a. y' `1 w. T4 N: y* I0 K3 z
The Get_DDB service is used to determine whether or not a VxD is installed+ q; F2 r2 ?  E% b+ T
for the specified device and returns a Device Description Block (in ecx) for* }4 S. T) H6 Q$ B& r
that device if it is installed.
* v8 m( p: f& h3 `4 P
8 ^: {8 }0 R# N) ~: l- E   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# w. x9 J# m- l4 M
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
  ^$ x+ Q5 z5 x, o   VMMCall Get_DDB0 J8 B( o; O9 P' b4 I% U  Q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ X8 t! Q$ f+ o+ z

/ E* F, O; A: f/ n3 hNote as well that you can easily detect this method with SoftICE:
  L  N: U1 {9 N, @   bpx Get_DDB if ax==0202 || ax==7a5fh
: E& M) K* u0 T: @' S
+ K0 i% g+ T0 N+ d) B5 U__________________________________________________________________________# `+ u) e# x- M/ H% v1 g7 M/ r" F) }. m
0 W4 i7 l/ T- }7 D) \* B
Method 10  X% l6 l8 H0 A, Q$ X7 M9 x% b5 ^" ~+ y
=========
) h6 @, |$ P: v" K: E
' d1 Q; m( b4 B; T; p=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with' Z( a1 t6 C4 r$ f
  SoftICE while the option is enable!!
) A5 o( i# o1 b
5 z2 p; w9 J# \7 ~6 bThis trick is very efficient:' d* d  p; y$ k. s
by checking the Debug Registers, you can detect if SoftICE is loaded
1 |% l, L  T; ?(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, C7 J% Y1 M* F% sthere are some memory breakpoints set (dr0 to dr3) simply by reading their/ K/ {, f6 H% l6 K# A/ K) Y( Z
value (in ring0 only). Values can be manipulated and or changed as well% B. n2 K! @% }& Y& ^6 _0 G6 }; b" o- \
(clearing BPMs for instance); L% D, N) i9 b( E! Q
  d2 o: w4 _& i. M  X8 p" h
__________________________________________________________________________6 q% [  v+ m4 \! R( |+ P

' i& I. @$ _) I; F$ CMethod 11- N4 }: Q2 V' @, x
=========
0 m# p6 ~5 I% K! U4 F+ m% z( |- d" {/ d7 A% L
This method is most known as 'MeltICE' because it has been freely distributed
# J4 K& N; R. N% j6 r: m9 f" ?via www.winfiles.com. However it was first used by NuMega people to allow
1 {  o- Z" A0 d: c# I' }Symbol Loader to check if SoftICE was active or not (the code is located* T! R$ c% Q0 p$ ^& R
inside nmtrans.dll).
) T( [, B9 I8 M. K6 n2 D+ W1 f. q* U9 ~3 n2 Q1 v3 m5 s* y* a
The way it works is very simple:
' y. q# k% I6 ^9 H1 U2 AIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
7 r8 [! r0 s% _" E: t4 EWinNT) with the CreateFileA API.3 r/ V: m. T; O, K) d1 N; N, F( r/ X
0 I2 g8 {8 ~* b, `6 `- Q5 O
Here is a sample (checking for 'SICE'):9 s5 U+ F9 ?% ?$ }* F) {

) T& X' Q) p. `- Y( T) S7 f- IBOOL IsSoftIce95Loaded()8 M' {( s/ M8 T& [6 Y4 j6 A
{
8 c* I! g; M! h! }' s0 m   HANDLE hFile;  
; I) K9 {% t( _+ Q   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 f. H) V2 d2 K- X
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
2 y, {: k- W3 d0 M  x" }                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! l. V6 b  i8 g) b9 u! e4 N7 @$ c' W$ n   if( hFile != INVALID_HANDLE_VALUE )
" _  ], [, |# f" C   {# ?/ W7 W5 p* R+ V. E/ ~1 t- V
      CloseHandle(hFile);6 Q/ k: ~$ C; j5 A+ w3 Y
      return TRUE;
$ v& y% a3 T% q, N3 v   }9 d( A) @0 z) T; {" B9 L
   return FALSE;
* }! @2 P! P" ]! ~}/ k8 _+ v7 a( x" y0 s/ R+ x

2 w8 Z  _0 ~* S8 m, G4 A% y  E7 {Although this trick calls the CreateFileA function, don't even expect to be
6 `* a1 A. F( A- R" N' M% Qable to intercept it by installing a IFS hook: it will not work, no way!
9 t5 a. v$ Q6 A# kIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
: R2 ?* y" G0 I* P5 o  L7 R$ `service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
- u3 |5 j6 Z- T2 m8 h7 T. z  o* oand then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 l, b4 f' ^8 \$ ~  p# G$ M5 Zfield.8 I; e& `& n. k0 A' }. p
In fact, its purpose is not to load/unload VxDs but only to send a
; C: g9 C! {- V5 tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
& b3 P; {7 {* u1 Kto the VxD Control_Dispatch proc (how the hell a shareware soft could try! D; s* L' C, H8 c
to load/unload a non-dynamically loadable driver such as SoftICE ;-).% i0 ~& N0 M; {+ T* k4 s
If the VxD is loaded, it will always clear eax and the Carry flag to allow& U0 x1 ?# @; J6 g7 T$ H( ^6 n. k) q
its handle to be opened and then, will be detected.
( O  }! p% O# J8 bYou can check that simply by hooking Winice.exe control proc entry point) K6 C; U* o! N% [* e
while running MeltICE./ t/ r2 `% H; h8 ^: `9 e8 A
, x1 j% m" f9 c

0 t% Z: Z- B/ v  00401067:  push      00402025    ; \\.\SICE2 J  d+ P' u% s4 w1 e
  0040106C:  call      CreateFileA- t2 S0 \2 \3 E, U
  00401071:  cmp       eax,-001
  @& b* G) p& w* l6 A  00401074:  je        00401091& {* I8 ~9 ]+ ?; e# F
; g* x+ H# S/ J, N& e% q( s1 Z

2 U1 M) v1 Y9 x- c. r( m6 MThere could be hundreds of BPX you could use to detect this trick.
! C  H+ ~( W$ l( E' P/ a( A-The most classical one is:3 J0 |- W/ U4 X; M" h0 k
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 F9 s+ Z4 l/ e  D  N
    *(esp-&gt;4+4)=='NTIC'3 r5 |0 y8 U4 ], r1 S
' I9 E5 E2 d" _1 }; f0 Q" P1 Y
-The most exotic ones (could be very slooooow :-(
# ~- d- b* A: N; ?8 x   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  : n& ]) W/ s1 y6 H7 Z6 V1 K- \, T+ j
     ;will break 3 times :-(
+ c; a! C7 S3 t
: t; {+ L: t2 E0 a1 K& U, F-or (a bit) faster: 7 g1 j) `+ |' k
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 G3 z0 B$ D5 l6 n. M& q, v& ~
# Z# A% G: K2 y3 a: P   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 w- O4 l: O/ `0 ~; E: T     ;will break 3 times :-(
9 c. v8 u5 e1 f
0 G# F) d8 M2 y6 v/ W-Much faster:
7 [- v/ ^, @$ n   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
6 J! m3 [9 \! b
( s: f9 c( s' U' X& dNote also that some programs (like AZPR3.00) use de old 16-bit _lopen6 t0 t; b9 S- P! q
function to do the same job:
% `- m# H$ L6 ^  M: i8 ^" g2 w% z# T$ s+ V% D0 n
   push    00                        ; OF_READ
' s) b( \7 `! R. R   mov     eax,[00656634]            ; '\\.\SICE',0
8 |  L: ?* R6 W( N9 ?( i   push    eax
. [0 ?; O: W$ [8 j   call    KERNEL32!_lopen
2 ?/ O6 i6 |! G& e9 ^4 u3 y   inc     eax
! d) J. l4 o4 i) L# t2 R% {   jnz     00650589                  ; detected2 q$ ?9 [0 H. J4 `
   push    00                        ; OF_READ* K, G4 l$ x$ _; Q
   mov     eax,[00656638]            ; '\\.\SICE'
$ E& i$ V% i- b& Z- }, I9 {   push    eax
! p+ s1 e9 ^* U& R/ v   call    KERNEL32!_lopen+ q5 U& }/ ]0 I( U
   inc     eax+ r( x, b  D2 X: d
   jz      006505ae                  ; not detected
( y6 F! n! b3 O6 P: [, P  i' `) @
) C" n) ^6 j  m$ u0 b2 P% w4 \* D2 I& ]) w' V8 f
__________________________________________________________________________) H" X! r$ u. @0 ~) s
' U! F$ }+ [$ o( W) J1 E
Method 12
9 K5 U, y8 M5 j=========& k& {7 H4 Z! l, w" _4 M

8 u0 b3 g5 u6 A8 R8 i3 t0 V' D* _. ^, LThis trick is similar to int41h/4fh Debugger installation check (code 05
( l( y$ r1 z& `: c7 f6 r&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 c+ g- L2 t! u4 F+ i* bas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( A9 X* z& C: b8 O8 W& i7 i3 r# m, W& M
   push  0000004fh         ; function 4fh
8 x7 S% c/ a3 R$ G3 y   push  002a002ah         ; high word specifies which VxD (VWIN32)
, Y: `/ z8 i( G: n9 d7 M$ e                           ; low word specifies which service
0 g( B6 k' W: p- n, k6 J. h" u& s                             (VWIN32_Int41Dispatch)
! O# A9 W/ ~8 c+ e# r   call  Kernel32!ORD_001  ; VxdCall4 T9 W1 p' x) C# H0 p" V0 z9 v
   cmp   ax, 0f386h        ; magic number returned by system debuggers5 F, {( M8 L4 Q) t9 O) u! @' X
   jz    SoftICE_detected
' j# u/ r) e: h2 v
2 g% w* ^1 w! q$ F  p) zHere again, several ways to detect it:
' o  H: }; H% n; f0 g4 \0 ^' [  a
9 ^  h1 ~) t( ^- b: y5 w) p6 J/ K4 K    BPINT 41 if ax==4f
- u& ?8 o1 K- W8 A. N5 C! T; G- A5 q+ Z* m1 h( r; K9 \% F
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
* S7 S/ _9 a  c+ H+ u4 J! c  _% G" ?# K8 [( L
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) q# ^: g4 Y/ M- F
$ Y# _7 f& b# W2 r7 w( r7 Q
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! d% U0 M! u0 r+ G1 c) n' ~
" E: c( m" v( s9 U, s
__________________________________________________________________________
) \- J3 t+ O' T) s+ P5 o) j" Q( S+ M5 W6 m( A
Method 13" c0 e; u$ I# [
=========
1 b( \/ B; T: L7 H1 S: M+ q; l% {# L8 o7 ?. n- R
Not a real method of detection, but a good way to know if SoftICE is
$ k! y; m3 q5 q& _1 N; x+ X/ ]3 j2 oinstalled on a computer and to locate its installation directory.
3 z; x* X- {& n- B# l# z+ cIt is used by few softs which access the following registry keys (usually #2) :
0 M2 k, c% e5 H; ?9 M% K- b) H& M
( s% r( D! z  |9 i# X-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: D; i" e3 W4 y) x2 I/ s
\Uninstall\SoftICE
2 T) b% p  e  `5 r' T9 U) u9 I-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE# S- G6 O( H# a/ R) A+ F
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 U+ s, U6 Q9 Z7 Z4 n' G
\App Paths\Loader32.Exe% c' W- _: q! m. z& d  f
+ V( f; E5 g  W* X& W$ H
2 D# w) F; s0 u! F3 r
Note that some nasty apps could then erase all files from SoftICE directory
' p& k) o4 a( D(I faced that once :-(
8 ?0 Z# [. F. Z
+ S3 ?9 ?7 l3 ZUseful breakpoint to detect it:
' g$ O+ l5 H4 r: x1 L  A8 X+ }, L/ w/ I/ T/ g7 n, I% l8 q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ ^# Q6 T6 f- F
4 T* O+ a6 I; q/ d  m
__________________________________________________________________________
0 j  @* J2 T6 [+ T  [
* B- b. M' E+ b( M' G8 C% g! \3 }# M. m9 c7 A4 w: I, ]
Method 14
$ U8 \" t( w" z, H7 C=========9 c& Q) N6 o, p  ]: V1 a8 S

9 \; ~) F; Z1 WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 B# O5 z/ c) V* Sis to determines whether a debugger is running on your system (ring0 only).
3 u5 W6 L# T% U6 `% B2 e2 d% w) }2 n2 j
   VMMCall Test_Debug_Installed  q9 A5 `0 V5 O9 U" e* V  ?
   je      not_installed5 d9 N" @' \; I

0 o1 s* w3 R1 G" H( w  QThis service just checks a flag.8 X  N9 J8 m2 R7 y. D
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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