About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>- l6 y* Z/ T) o* ~  ~6 D
<TBODY>5 M4 [) ^- Z. v4 e* c1 N9 b
<TR>
: O% @  E- g) C' U' W<TD><PRE>Method 01
. r( c8 I9 }+ `  [0 u=========0 r0 C  u& u& s" ]

& {6 E3 y$ ^  F2 z& ~This method of detection of SoftICE (as well as the following one) is
" W/ W) d* T3 o1 ~% fused by the majority of packers/encryptors found on Internet.
+ E3 y. Z( k, }! x! ~- b% ]It seeks the signature of BoundsChecker in SoftICE
5 f7 `- b5 W9 p) Y: y
) m/ @" z  _; I0 V* u/ y    mov     ebp, 04243484Bh        ; 'BCHK'
* U, _; ?! r* ?    mov     ax, 04h
  [5 g- l, F2 Z    int     3      
! c, T0 U9 o8 z) D/ |    cmp     al,4
8 c+ Q  Y0 Z& I    jnz     SoftICE_Detected
# r4 C9 z/ n' c! B
- B5 Z; ?0 U  a/ a___________________________________________________________________________
& ]* W7 g/ T7 F5 {- D: s* s
4 \, `6 C" i- B$ B# f5 }Method 02$ ?# E$ }( U: z
=========+ |/ I: W% J7 \; o) R6 t; y( S
+ w: ?1 p* @/ ~0 e; k
Still a method very much used (perhaps the most frequent one).  It is used
. y8 ]7 I1 a2 I# |to get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 X$ U3 f+ J( Z" ~/ `/ |' s
or execute SoftICE commands...
" x# k9 [2 g/ Y5 w' |8 ~! z) kIt is also used to crash SoftICE and to force it to execute any commands
; [2 z2 Q0 e% x% G$ j5 k4 H& E(HBOOT...) :-((  
1 i) V. M* s4 `$ A, ]0 q0 }: j0 [+ @+ ?; A/ {, l- Y5 ^1 P
Here is a quick description:
& S5 t6 ]  b8 D, \" I: y-AX = 0910h   (Display string in SIce windows)
. w, G, H. A% G( R- J8 r/ a$ z-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* H& R1 h* i' C7 _' _-AX = 0912h   (Get breakpoint infos)
# S7 V; j) q! W; x-AX = 0913h   (Set Sice breakpoints)/ H( P3 i) k# U2 [) X+ W
-AX = 0914h   (Remove SIce breakoints)5 W7 }( z$ t- B" \& b7 ?9 \( }5 @
% z% Q% l  @( {; n' G/ t
Each time you'll meet this trick, you'll see:
+ z* n) c8 ]: t$ [! l1 A; j4 S) O-SI = 4647h
4 f0 c4 O- ]4 c: p& r7 v$ m- S-DI = 4A4Dh
* R& {* i% i. J, Y$ e& DWhich are the 'magic values' used by SoftIce.
1 l0 c- S; k# W$ G' |- o$ EFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ j/ q1 ^& V" a) v. u* H4 j/ o3 x/ z2 V( s8 H
Here is one example from the file "Haspinst.exe" which is the dongle HASP5 d1 e! y4 T8 _' G" p- V
Envelope utility use to protect DOS applications:, F7 \7 @9 V% |* c$ B; l

1 f% W9 w1 t0 B3 n1 x9 _  h$ |4 N9 j9 ?$ x
4C19:0095   MOV    AX,0911  ; execute command.5 `8 E0 X) Z2 @* Y/ m" G- S5 T
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. D4 @+ ^( W4 m3 [" ~4C19:009A   MOV    SI,4647  ; 1st magic value.
* f5 T  @; l( M' @9 h6 A0 [4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: y* y% s, [/ w1 u! w8 a4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
$ q1 `$ m9 |- v3 [" S4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
. G  h8 d4 e9 |* t4C19:00A4   INC    CX
" H# X  X) ^% X0 T8 _! n; E' ?4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ w7 w, N  E8 R! l) y& P
4C19:00A8   JB     0095     ; 6 different commands.9 n$ |/ S# W( n3 F/ K8 y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 W* p# T5 Q+ t: f4 A) _
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
$ C5 E0 V0 G! s/ ]' b  N" n- S) Y- e$ w8 @; ?* ]2 J
The program will execute 6 different SIce commands located at ds:dx, which
- R+ e* }( j% J( N& Lare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. E' O; v& b- T: o# e+ v
: @) j$ l- t6 S& B- @
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 c7 D. ^% x! ~* [+ ^9 t
___________________________________________________________________________
8 [5 Q0 @4 u2 w) C8 ^9 N4 C6 s2 R) N5 n: D2 O$ M
, e7 Z% d8 ~* T# _, [5 r
Method 03: D( h: }# p$ w# M* v2 s
=========
: a" j  _5 z5 M7 F
0 F9 D7 G2 F: @: `8 [7 _Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 ^- b4 M* S+ W, F) N(API Get entry point)
. E  e/ z3 N& V8 c. ^2 K        
/ K+ D" n6 N, ?9 p9 T9 h0 H: V8 F. l- I, ~( f' x! v
    xor     di,di
$ a. \  M2 |2 |# _8 E3 g. D6 o    mov     es,di7 o  Z& A9 _; Z. v# z
    mov     ax, 1684h      
# Y$ ]; l' v3 J3 i    mov     bx, 0202h       ; VxD ID of winice  v) k) y- t, t6 \  n8 E6 w2 C" s( }
    int     2Fh
+ D9 ]6 y# j1 Y    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# t/ f8 U; r) d" ?' _    add     ax, di
0 g* M" i1 f7 g, @( r' Z1 C    test    ax,ax/ k* a% q1 v9 d8 c$ Z$ f+ x* K" ^" M
    jnz     SoftICE_Detected
1 O7 k+ t( U7 ]5 \; m) D" t+ ^3 A& O/ @7 j6 q
___________________________________________________________________________, F% D# ?4 y4 Q3 t

/ O- ~- I# Y7 d0 H  F0 qMethod 04
5 Q, n( `( y! ~1 v8 V=========
' z4 O! T, o% D1 p2 w
3 N( A" [* @# v) b6 T5 r/ rMethod identical to the preceding one except that it seeks the ID of SoftICE
/ }4 k- ]9 s. k2 ^GFX VxD.
, f# k+ a$ c# s. l+ m  h# I
9 w- y: t; N7 E    xor     di,di
1 P5 \: U; e& h# f, n- ]  n' _    mov     es,di* V* \& _. R: n3 w! r
    mov     ax, 1684h      
) s% R* s) A# Y, E    mov     bx, 7a5Fh       ; VxD ID of SIWVID' J6 S2 |7 U& B* S, K! E9 ^
    int     2fh0 v( t' Z" \; d- G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ ^7 T. S9 `' R1 ?2 f
    add     ax, di! R4 P1 p$ q8 l1 m. [8 J
    test    ax,ax
) [2 u7 B( @6 Z    jnz     SoftICE_Detected; v7 e2 t; X) p: ?/ V: I

! D5 D+ f6 p6 }# A* x$ J, }& ~__________________________________________________________________________
3 t! |0 Y7 O( d7 h1 K6 V+ T3 o+ L
1 e. C, L7 E7 k; D1 L9 g! w! `2 f; d+ y4 W+ d( m' [* Y
Method 053 W) v: K- b* r1 ~5 E' s' X
=========
& |! o' B! M8 \
- ~* D! O5 s4 q4 A# ]7 x; MMethod seeking the 'magic number' 0F386h returned (in ax) by all system% \4 Y1 E/ N8 H; r
debugger. It calls the int 41h, function 4Fh.' B5 |& J* z8 `/ }% C1 x0 F9 u
There are several alternatives.  
/ T( M7 Y2 \8 Z. f* a7 h
7 j6 P; A; C! [/ v  L( ~5 oThe following one is the simplest:
0 O! b$ K" H: J* Q3 u- m" y. W5 |. Q
' [" T9 C' f- z, o0 I% \    mov     ax,4fh
! u8 x/ a, h5 o2 f  N% a/ Y    int     41h
$ [  J' h" |7 m$ L    cmp     ax, 0F386
* B5 R4 S0 P1 S4 q$ z- f/ Q( q    jz      SoftICE_detected
; t; |' Y  Y9 U- A- `# B' Z7 Y) A, w2 @  s! Y

2 b- M( W: e' e1 G! I% M+ gNext method as well as the following one are 2 examples from Stone's
3 {' u" K; Z6 |% l- g6 R"stn-wid.zip" (www.cracking.net):
+ u. k& T5 W8 b, b" f. k+ g; k# r7 e
    mov     bx, cs
, C% t; l; i$ ^    lea     dx, int41handler2* Y" b" t* o- b: }- m# l  k
    xchg    dx, es:[41h*4]( n; p+ P( u' u, R: G! `; w6 Q
    xchg    bx, es:[41h*4+2]
- a, ]% v0 G1 E" H3 t( a  ?2 S    mov     ax,4fh
' Q, R8 A- {  u; _7 t    int     41h7 K2 e1 z2 B! i/ z: Q: M
    xchg    dx, es:[41h*4]5 {; t% ]4 ]5 C1 d8 J8 E! d3 \, K
    xchg    bx, es:[41h*4+2]5 L9 b/ x$ L, Q3 j' K* ~, |" X1 J
    cmp     ax, 0f386h
$ B( h* M4 K4 Y1 A' l    jz      SoftICE_detected
1 e( o: V2 x0 C/ i
  h, K7 |$ J3 |  i; ]6 L2 tint41handler2 PROC
3 a! B5 M* K& d( J+ y0 [6 B' q    iret/ Y0 R( X" [8 R4 @( y
int41handler2 ENDP& T( R1 G7 ~0 i& ^
9 b+ k( b! `. a/ r
, G% B' D* u5 j- _3 h0 n9 K
_________________________________________________________________________
' j$ g8 g# X, w2 Z! J& E
6 b3 [/ P8 P  }3 O: S+ J- r4 F- V2 }! G5 X! X- c
Method 06
; o7 k; W" i. w# y+ H) T=========
+ d  @3 F' ?0 n- F) A. p+ S. K1 s" k6 o

7 A7 U( s* i5 J8 T& ^6 A2nd method similar to the preceding one but more difficult to detect:. \+ z9 m# V  q4 G- [$ l

2 E5 s( v  w% a: C
4 z5 J0 V9 b3 J3 z1 u( `int41handler PROC' P7 g5 o9 I9 S# A
    mov     cl,al
) ^' k2 `5 w( [9 p6 `3 G    iret' a" I$ ^" u" A. B% N, H
int41handler ENDP, Q: ^6 ?8 f: o" ]1 g
9 ]3 }. n! [" U  Q& Y& H$ H
2 ?5 R$ \, ?* |2 a4 }; d0 O* r3 ]& F
    xor     ax,ax  Q( i! t8 Y4 z, U: Z, A4 j; R2 D  O
    mov     es,ax  Z8 S: ^% j9 o1 C8 a
    mov     bx, cs( ~8 t, O9 `2 n% V& w
    lea     dx, int41handler
2 P7 n5 t% j7 f! [6 L/ G6 F    xchg    dx, es:[41h*4]$ t5 J- g, S: ^
    xchg    bx, es:[41h*4+2]
- m6 h+ ]  N$ }    in      al, 40h
5 [: C5 I4 h0 Z1 i* y; ], r    xor     cx,cx4 [, ]( O0 Y6 t* R2 A# i4 L* R
    int     41h+ y6 D; I5 ^2 k
    xchg    dx, es:[41h*4]
, E1 C& @. Q+ h' B: z- Z4 _' I4 I' M    xchg    bx, es:[41h*4+2]
9 w7 @$ {' r, [4 s; H5 c    cmp     cl,al  z) A1 n0 y0 p% J( b  m
    jnz     SoftICE_detected; h. j' J* a) J1 m6 |- q
6 C# M3 f: q+ |/ D& s( n# y
_________________________________________________________________________8 p6 T! ^/ `2 ?
8 ^6 p& L0 M1 ?/ `9 y! ]
Method 07, s% ]+ Z( H0 E+ |
=========" b& y5 g# W1 O& R' M( y6 d

: J3 ^, p& {& `2 v  O; OMethod of detection of the WinICE handler in the int68h (V86)" w6 E( I0 w( V0 M, g9 H

9 K! H# j0 e+ F# C+ j    mov     ah,43h
/ E- K' O' \" y! z# c) i/ F$ R    int     68h% u8 c( v2 X- ]% |; [! J6 i) c
    cmp     ax,0F386h/ B# Q4 R: R* \5 V! Y' v: f& D
    jz      SoftICE_Detected
; Y4 H! e. |# {) w
& i4 W, m5 r: ~" G
# v) t; e/ t4 l( o. V=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) n& d+ x( F/ j. s/ Z
   app like this:
' ?: R9 H6 B$ {  i, `  r, j9 N, D4 `. d& E- O
   BPX exec_int if ax==68
( K' f( Z: Y  M$ p6 [) ?   (function called is located at byte ptr [ebp+1Dh] and client eip is
8 P& d  R2 M  X7 A- Z) Q" l3 c, x   located at [ebp+48h] for 32Bit apps)
4 K, ?7 u, A, e- C__________________________________________________________________________
+ L% a; a! y% E0 R8 c. y1 h# g! k) Q6 I  z$ z
: ?6 v5 |0 R' ?* Y& p. R3 l+ |9 B
Method 08
: |% ]& U' V* \' D4 u, k=========3 M# n$ w. U; T' C

, U4 C" }3 l) kIt is not a method of detection of SoftICE but a possibility to crash the
- E, n8 T/ t' C. Ksystem by intercepting int 01h and int 03h and redirecting them to another
7 d; N2 Z% L- Z7 [  Uroutine.
' ]( N' g% X6 W8 r7 bIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
. T  N( I0 c! Lto the new routine to execute (hangs computer...)
' o7 s: C# s6 x, A! T1 p9 U
5 V6 R: O" J% X- e. H# I    mov     ah, 25h6 p9 q8 n9 Y4 r$ l$ A4 x3 Z
    mov     al, Int_Number (01h or 03h); H; T: P8 Y0 {' `
    mov     dx, offset New_Int_Routine4 r0 w3 n: o; j6 W% Y2 `
    int     21h
& L. u1 a( t+ J, r# [& y3 F/ O8 S# P# W; q' z& X3 `9 _# O3 f) f
__________________________________________________________________________, A# z; t  H) F9 h# k# w$ P
2 H/ n4 z8 h* |- X! g) ~
Method 09
, {+ g, \  N' l1 x=========9 _! \. y- I1 \) M
& Z; d1 {2 A4 }9 D+ G. o; b
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only- F" S4 E+ C7 t  }
performed in ring0 (VxD or a ring3 app using the VxdCall).
& J" h$ T+ ]0 y% [6 n! q# D- ]1 ZThe Get_DDB service is used to determine whether or not a VxD is installed0 T8 w/ f7 ^. S% w) D& A
for the specified device and returns a Device Description Block (in ecx) for
% J5 P# W& z: j. zthat device if it is installed.
; X# u& h* Q6 Y- f
( L5 L, T& y5 c- d0 z( S3 H   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 j- X1 O9 K, |3 [
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)5 m' p# ]7 G3 H0 P
   VMMCall Get_DDB
& @& k0 H5 [5 }$ |: v% A   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: @; \8 t' ~/ T5 ^( B! ?/ i# D! {) h6 X0 |9 n/ V9 F5 _+ \6 W
Note as well that you can easily detect this method with SoftICE:
) ?7 ~$ ^/ X# p, z   bpx Get_DDB if ax==0202 || ax==7a5fh
9 @& ~' K  B, s  c
: f" ~( q/ }4 v9 h- p! D__________________________________________________________________________
+ R& l* O; u5 V2 X9 ^% |( u  l: _- L1 Z, D: `: v* N
Method 10+ `4 f! E1 P2 ^" W, L
=========: S9 h9 u( L3 k& S
# c9 x) u, n) C" X& q3 K$ m# f
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- T" O5 m) d2 ~# @  SoftICE while the option is enable!!# g8 I1 N2 g3 H2 }# D! A- L
" |' Y) v; o% p# S8 `+ r
This trick is very efficient:
2 f& o" ?9 v1 I  H  B# mby checking the Debug Registers, you can detect if SoftICE is loaded
" L* h; s6 Z# A(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; h1 {% i" R) d0 N* v; w) b
there are some memory breakpoints set (dr0 to dr3) simply by reading their3 T- H# u2 Y& ~/ R0 J$ I
value (in ring0 only). Values can be manipulated and or changed as well
/ x% V9 c% b: \/ v; j/ r8 N(clearing BPMs for instance)
# S, K& Q' Y4 B) [- T0 @  U1 m
* [1 P. [0 s$ C1 F! D3 Q( i__________________________________________________________________________! q4 X6 `6 Q* h) @

6 |( N9 T; U" F" ^4 jMethod 116 ~1 P; X" |' P1 Z/ R& j7 n
=========) \2 Q, v0 {  n7 B4 ]# @
! s3 p& I: z, U. o
This method is most known as 'MeltICE' because it has been freely distributed0 y  \2 r/ P, h$ F
via www.winfiles.com. However it was first used by NuMega people to allow7 \. ?, n+ }/ Z$ J
Symbol Loader to check if SoftICE was active or not (the code is located
) L* N7 ^; Y# w- ginside nmtrans.dll).
# Y7 E! t  A( C: l, P3 V) l  p
: C) H' H3 D$ P; _The way it works is very simple:) J8 P/ Q/ Y* e
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. {8 r! {, U" Y/ _, hWinNT) with the CreateFileA API.* h( ^+ k2 a3 n$ N" @

6 l  u! Y: _3 B- N1 {Here is a sample (checking for 'SICE'):
" w4 M* l$ H  I6 K0 f& O& f! T' I" `2 E& _2 f$ M9 X
BOOL IsSoftIce95Loaded()
' ?5 s2 |$ N) J: ~/ X: O{- `' K' ^' f3 {- }7 q/ H
   HANDLE hFile;  
# N- ]) p1 {- Y8 }   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' i4 [! ?( }$ M- U% ~/ C) P                      FILE_SHARE_READ | FILE_SHARE_WRITE,% ?7 F+ F3 }; R- }: \
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) ?8 z3 [9 W6 H( ^% N& _; N3 ^   if( hFile != INVALID_HANDLE_VALUE )
9 B% w# Z# q! K" J+ w" F   {
! U) G1 B: _+ X# B' M. ]/ ~      CloseHandle(hFile);
6 Y3 O$ e* H& S1 p      return TRUE;% U$ C9 g$ q6 t$ g
   }* C. F* ^2 n( g; p; G
   return FALSE;
7 s& T( W3 k% O( H% e# z}2 F7 s+ y! a: y0 t% e
! ~5 o4 z6 o( \* h- A
Although this trick calls the CreateFileA function, don't even expect to be' k) [2 b6 g8 _! F5 ^7 h
able to intercept it by installing a IFS hook: it will not work, no way!
6 A% u2 E$ G2 l3 |) IIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
" O# z( h8 C, u" S! I5 i( zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 K( Z2 ~4 B! g: x- W0 k- n
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
- c; w+ R0 D* o' R4 z6 T# _field.
7 |' s2 t% m: V* hIn fact, its purpose is not to load/unload VxDs but only to send a
$ S! q! m, K9 {9 g* z9 HW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); c) D; T! |0 T1 |7 l. n  B5 {9 l% K
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
, Q; x* m4 c6 }to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ n+ D* j( {) u0 [. ~# u/ \If the VxD is loaded, it will always clear eax and the Carry flag to allow
* Q( t* U) E6 }  Bits handle to be opened and then, will be detected.( I" N$ O& e3 p2 W
You can check that simply by hooking Winice.exe control proc entry point
8 ~1 G6 r6 o, L/ Fwhile running MeltICE.
: w+ n7 H' n" ^" l: N
8 _3 [' {; A8 C& g( k+ K6 _& E6 l% ?2 a) e5 V
  00401067:  push      00402025    ; \\.\SICE
. }4 p& Q* [5 N+ Y  0040106C:  call      CreateFileA% G, t# b) ?! \, L& l* M( I
  00401071:  cmp       eax,-001
* N& R0 L# P1 B: P' V. p  00401074:  je        004010916 G  K7 ~6 M3 T

2 H7 J5 b, Y9 h* H) J) L) [& y6 B7 c" P% r. G. P
There could be hundreds of BPX you could use to detect this trick.
# p$ N& y) |: l9 m-The most classical one is:- D* i8 K0 a1 |$ B6 D, d9 e/ N
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ r8 n% o* b4 c# q: B+ W
    *(esp-&gt;4+4)=='NTIC'1 I/ n3 r- ^9 h# H: R# w6 s  R

5 L0 s+ t: |; Q, S-The most exotic ones (could be very slooooow :-(
8 G, j4 q! ~  w& v+ `2 K   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& C: g( v! \# \- Y0 }* L     ;will break 3 times :-(
7 W% q: r; c6 d' G* v, O3 T/ X
-or (a bit) faster:
8 U/ k8 l  m. }# c! g   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
% d9 e; R. p% D6 b8 F6 @. R
- D# U6 m& h* L   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 e' Q& P9 D$ v. y( f% q     ;will break 3 times :-(% X. Z8 p) r& H7 q4 Y% y* u
1 K( T7 _, I% @, X: `- ?0 r. V
-Much faster:
3 c  k+ y8 n+ K   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, `* @2 ~/ F8 @* |+ t; w. z5 w- P' X/ |% ]
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen0 E- U; B1 u$ k% t1 q
function to do the same job:
& C" M+ R" T* N0 f3 _& f
; F& M: B. r+ }; b   push    00                        ; OF_READ
& V  G5 o7 [  w& }  m* [$ H' }7 F   mov     eax,[00656634]            ; '\\.\SICE',0
2 u; P) Z# w, z. s, q   push    eax
% i, p: M' d  }# S# L   call    KERNEL32!_lopen! Y4 o. E4 C( D
   inc     eax
2 Z+ A; e: M, \0 H. I1 Y   jnz     00650589                  ; detected
$ F/ l+ F" s& G2 {   push    00                        ; OF_READ6 y, e4 V0 o- A! W! P9 g% R
   mov     eax,[00656638]            ; '\\.\SICE'
( q- b! @& u& \" Z, N, c   push    eax
8 ^* \4 v  `  }9 p5 ^' V   call    KERNEL32!_lopen8 E" D; u6 A2 q; A4 _5 r
   inc     eax
) v" ~9 a# J5 A   jz      006505ae                  ; not detected
8 J( g. t, a) j# ^& l
0 F2 s  d  e' \* i4 N" h" [0 E* U3 {
/ v) `/ Q  m& ___________________________________________________________________________
# @! }1 @3 J3 Q9 z# X7 m, J/ m$ b7 s
Method 12
6 _( }8 F. g6 z  t=========, ^& q9 Q& d; r3 r& q1 @0 ~
+ x1 U  O+ A! _+ D! W7 G9 ^- i$ b
This trick is similar to int41h/4fh Debugger installation check (code 052 i! ^5 o8 l0 {% ~6 T7 H6 X4 x: Y
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
) ?* s4 @' Z0 G# k9 \as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ z! U9 w/ r, J* ^
( @1 F1 v, ~2 c3 S' K+ Z9 G   push  0000004fh         ; function 4fh
" R4 _* ?. s, U1 x' q0 `   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 @: n' q2 V+ }: d                           ; low word specifies which service; k. f- _1 M! S! u3 V+ O
                             (VWIN32_Int41Dispatch)  e0 `  k5 G/ n- r
   call  Kernel32!ORD_001  ; VxdCall# j) @2 s3 p; v/ d& v
   cmp   ax, 0f386h        ; magic number returned by system debuggers8 {' [6 [9 a$ T8 L0 V
   jz    SoftICE_detected
0 W) V- \8 b5 Z0 R* O% y  l% u. t/ G2 ]3 [* v
Here again, several ways to detect it:
2 k% G/ E3 [  q7 j4 i0 c% O& ]6 H! Z, z9 ?0 R8 w
    BPINT 41 if ax==4f" N7 [8 D' z5 L7 o9 |1 I
4 f  L# b) B- d4 r
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one$ R5 e5 o9 Z/ g6 e
- i/ [/ N* R! _9 z$ u4 p
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( E+ B3 C; u+ x$ [6 V* d

4 u2 ?0 T5 M( t) E/ q- C    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 T/ s+ U. O5 E

* r' ]3 F; t' D+ v4 M5 R4 b__________________________________________________________________________% X2 {8 h* x. ~! b: P
/ f0 U' G0 T+ J+ U8 {7 F6 X
Method 13
8 K( V- ]  b  f9 [9 k* J2 D=========
0 m8 H" n+ t; L( _" K& s! d* X6 l5 i, C( i
Not a real method of detection, but a good way to know if SoftICE is& x) H# U5 C/ ]! s% H
installed on a computer and to locate its installation directory.& P8 j% T. w3 R% [& x/ Q' p
It is used by few softs which access the following registry keys (usually #2) :
& l3 Z( |/ a4 ]5 z4 l# u9 y5 s
, l1 U8 v6 n% C6 \5 a-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, M! W5 r. v1 u$ O' ~/ E& U\Uninstall\SoftICE0 W5 L2 a- Q0 d" f- I
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 N) Y4 @9 W! H0 ]* U8 e( W- X
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 A" H  x+ o! ]- |- E\App Paths\Loader32.Exe
  @) S; z  Y; T7 O/ o& P
5 k3 z7 t& R+ y3 I; U: Q$ J
0 N, U! _; E/ o, h$ A# zNote that some nasty apps could then erase all files from SoftICE directory) i  Z$ G6 P6 ^, `: S6 @& s: F
(I faced that once :-(
: Y. b2 W0 h" F9 ^- ~
) R* W+ P$ |0 {# a  c4 rUseful breakpoint to detect it:8 e1 ]/ I- i) o) q
% B/ N6 X. A2 P  V4 c
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ e8 v3 O; n6 O! p+ O6 I6 X
8 s( y( s% R: I7 [+ d3 h# U' p
__________________________________________________________________________
$ L* L! A% @" d6 }. j
$ g. R0 G; \( M0 n& }0 t0 O  r$ x( t0 O  ^/ S" C$ H
Method 14 6 w& v4 C* b# `+ D8 w; |7 C8 B
=========" b" v1 X$ v' x- z8 h' ]) s* Z

; l% F3 i2 i; U* rA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, N5 N8 x. h) x$ W( r* his to determines whether a debugger is running on your system (ring0 only).) k% l( g3 D. [* J- k) R
+ P7 ~* |( T+ L8 _' g; t
   VMMCall Test_Debug_Installed
& r3 ^3 j1 v+ r2 z+ h, K   je      not_installed
8 Y& d; }" J8 _
7 Y& r. D; T) E6 Q% |8 k0 xThis service just checks a flag.
) R9 L( A5 {0 o, z( j3 E0 g, ]2 n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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