About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>  a1 ]* H( {; n& I/ C
<TBODY>
4 @3 b% h5 c% ^7 ~; g% ^<TR>
. U& l! W9 p) i1 U<TD><PRE>Method 01 7 A7 w& G# ?! w: X" K
=========! `5 Y! j! o3 a7 ^5 V6 F

# K- S% D2 `1 O1 m1 a3 t) D4 y. i4 oThis method of detection of SoftICE (as well as the following one) is
% x  Q- O3 I. V. t8 [8 w, F4 Jused by the majority of packers/encryptors found on Internet.$ A3 v; R9 J6 e$ F; h
It seeks the signature of BoundsChecker in SoftICE
9 y5 h$ t6 [/ q, o# T  [9 @* y, Z: a6 A/ d$ |5 p; a6 u
    mov     ebp, 04243484Bh        ; 'BCHK'
* D+ u$ A3 K0 L0 b9 U    mov     ax, 04h
. v5 @- d6 `  y! D, i    int     3       4 I+ n; n: j: O$ m! f) E. W3 F
    cmp     al,4
  ~' s8 _" |6 A, C+ e    jnz     SoftICE_Detected, [  z; b/ m* n( s1 e% a& v
% g9 z: E) r" l" ]: ?# o
___________________________________________________________________________+ N' G* j# Q% O4 s
& I: {- B2 }- ]; g
Method 02( N/ T& T6 |! U$ M' T. h
=========
- g! D0 G, |7 A+ a, m2 C* W$ ^
% N6 ~  ~! e, uStill a method very much used (perhaps the most frequent one).  It is used
) D3 h) i6 m# r+ J2 ~to get SoftICE 'Back Door commands' which gives infos on Breakpoints,) j/ h& W! d: U. E
or execute SoftICE commands...
7 y: n) d" ~) C1 |4 ?# w( `It is also used to crash SoftICE and to force it to execute any commands/ z% k. a0 G, E7 Y& e" y
(HBOOT...) :-((  
2 u3 N2 q' q( V2 h$ j  }* I5 A  I; I' k* P
Here is a quick description:
; s& z0 S2 k% A* q. R5 i! f8 p-AX = 0910h   (Display string in SIce windows)
; E% @+ [5 r% n! g1 y8 ^- r; N-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) J" J, X; C6 _; s" @8 J4 x-AX = 0912h   (Get breakpoint infos)$ j) q; S8 r. ~. u0 T0 g
-AX = 0913h   (Set Sice breakpoints)  K9 |& i7 U$ N* t; m) y' P
-AX = 0914h   (Remove SIce breakoints)% I) e; T% a8 ~5 q9 S

. p" c* U$ |3 N2 I# q" U( {& eEach time you'll meet this trick, you'll see:
  }  w& g( y, H1 A/ L-SI = 4647h" R1 K2 [) P% @" l
-DI = 4A4Dh4 e  J9 T9 ~$ R! u5 @- p
Which are the 'magic values' used by SoftIce.
2 U! X) g" y6 E) S4 i! `% N! k9 W, C+ H/ IFor more informations, see "Ralf Brown Interrupt list" chapter int 03h., b( K; X( |3 j5 I: C

: l3 A( }/ f  mHere is one example from the file "Haspinst.exe" which is the dongle HASP
  L  F% N$ H3 i( e, E8 gEnvelope utility use to protect DOS applications:
# ^9 o. ~- D9 M% ?/ u6 R# I2 v& q7 @; E$ h9 h

6 S3 B/ M! M$ y+ {4C19:0095   MOV    AX,0911  ; execute command.6 w9 {1 Z3 p( \" c- W. ]9 i
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).1 e8 Z3 \, r! h- G4 i7 F6 o
4C19:009A   MOV    SI,4647  ; 1st magic value.. y, y( {5 g3 c( H# Q" x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 q# W6 G8 |) D5 v" d
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 {/ W! t& y. P9 |6 w4 Q& B
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# I6 Y5 J7 {: D% w' s
4C19:00A4   INC    CX& n8 @7 y# p# ]/ V$ r5 m: T
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 W0 {& g' J$ c4 l
4C19:00A8   JB     0095     ; 6 different commands.
! l) t& T+ Z6 x3 h3 U$ w1 S5 Z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% K# N. K/ O% `/ }- c8 X% ^4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% T$ m  t, j- Y- Z8 K+ C. E

4 }9 a8 }. H6 G) V/ t1 a- t: TThe program will execute 6 different SIce commands located at ds:dx, which8 F: I5 z, O  y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 Y% ^) c/ o; ~6 R
" d* H" T/ b+ I  k, N* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  l) ~8 g+ Q8 a# Z/ C; s
___________________________________________________________________________: Y! L4 t3 Q4 M* F+ C
/ ^2 g; l' _# @
5 o1 s! C+ F# t
Method 036 e$ X/ R! R; b& L, J/ G  q; H
=========
8 n& W% V! B5 Z* }
: {6 d! Y  w8 k3 T$ C( V. x7 XLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ R3 i! z! I$ I  t; W
(API Get entry point)) V% F/ G) Z% [
        
; [8 B5 {. L: W2 A' q4 P5 c1 ^* n( K7 _" z1 f( T2 m, q/ n/ E
    xor     di,di8 E3 G6 L) i5 d0 d: Z. o0 E% ~
    mov     es,di8 Y7 y& P* L/ H' ^- V# \
    mov     ax, 1684h      
% b  D$ }9 p" r2 D- i; }" E# e    mov     bx, 0202h       ; VxD ID of winice
: n$ W6 Y( N+ J. }    int     2Fh/ V6 E* L; `( K, n) C: g& x
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 \' \) e( ]  x( @4 h
    add     ax, di! a6 \' @  K  M5 ^6 u$ g
    test    ax,ax$ Q: D$ P2 X$ D) S* h
    jnz     SoftICE_Detected
) G# c9 I4 ]7 }3 x
/ t  S$ I0 {! z$ `* S* d___________________________________________________________________________
3 Y5 i& ~* R: r7 Y1 {7 M$ ~2 A1 e/ C0 F7 F
Method 04
# g1 N; M+ J5 \2 A# l/ m=========; z% Q8 I0 F! S# `1 P  ^$ `1 g9 i

2 b! L, E1 R5 a" l/ cMethod identical to the preceding one except that it seeks the ID of SoftICE
' V, a1 X2 C: Y0 gGFX VxD.
0 b, K9 V; x/ k- z( j
0 o9 B8 u$ o; w$ A! Z1 n    xor     di,di  `  h& \% F9 X8 F
    mov     es,di
. S* t( u5 W6 }    mov     ax, 1684h      
' \0 F3 M/ V) b9 F    mov     bx, 7a5Fh       ; VxD ID of SIWVID: V0 ^& w- B2 K8 M. }
    int     2fh
8 m9 u# `& g  b# [    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ U4 P0 x6 s# R; H7 u
    add     ax, di8 k: E& h; @, B& _5 o0 |# s
    test    ax,ax4 b* W5 Z9 l: q5 h: q
    jnz     SoftICE_Detected
3 f' ?) Y$ ~6 n% d( t+ ]+ R4 ^3 `+ `. ^2 V$ F  Q5 q% A
__________________________________________________________________________8 N* _( f; B. b6 M- v* r
' I5 q% k+ Q& P) |8 s& w
# A0 @+ B5 l) L7 G" [$ k& T
Method 05. }! g% }9 _6 _* R3 C+ G7 c
=========( P. T- c' \1 Q9 z0 w# J# f* l

6 Y8 {1 Q& O9 R& B* cMethod seeking the 'magic number' 0F386h returned (in ax) by all system1 c4 f5 u' Q+ U$ P
debugger. It calls the int 41h, function 4Fh.$ \. o$ E  S& J+ K
There are several alternatives.  0 }. j( u9 D- J* Z

/ o) [2 p% I, q+ _" |The following one is the simplest:7 G" h9 T. n& i0 L$ O* j5 W% g' h; f

% r1 k; z4 H5 o    mov     ax,4fh
6 O/ {( \+ L% K; X1 a4 i: A    int     41h
2 f2 k6 I$ o3 [* m    cmp     ax, 0F386. n. W7 S  D7 k7 B
    jz      SoftICE_detected  k2 D9 K* ^6 G$ Y& x8 [
, @8 ]2 U( B% ~
( D, A: K, j# n& M% p4 b
Next method as well as the following one are 2 examples from Stone's
& A( `& C' C% r/ z! }1 `' M"stn-wid.zip" (www.cracking.net):0 O. \( B9 q' i3 |! J; N

9 \9 d2 x0 T0 x5 z% e$ X    mov     bx, cs' H- W1 O2 R1 j+ P) H" r
    lea     dx, int41handler2& y+ ], |- s/ ~- F, Y
    xchg    dx, es:[41h*4]* W2 w9 b1 N" h& k6 @
    xchg    bx, es:[41h*4+2]' J; J0 {. B- L* \. O( h$ i
    mov     ax,4fh
, h: b0 K+ t: A0 d    int     41h! J6 N9 T1 d2 q
    xchg    dx, es:[41h*4]( q& I8 n- m5 H, @
    xchg    bx, es:[41h*4+2]1 ^2 L, e1 X' _7 {9 C
    cmp     ax, 0f386h( ^7 w% G  m* t/ V! J& R* |
    jz      SoftICE_detected
5 M& u& w4 N' P3 k: ~9 O9 `# i1 j- J% W/ ~+ p
int41handler2 PROC
* @' J4 ^9 C1 \  A& t& J    iret
+ I9 X) N$ C! X1 b/ |! |int41handler2 ENDP
" ?# q8 c2 O2 c) t/ w" z1 L4 q! d7 ?* U* U7 q/ i6 E

$ t) c7 t- j8 I. d_________________________________________________________________________
# }3 q2 v- _) l: }" b& z% S" [& ^) [, F1 t

7 o$ S5 W' K7 a9 b. |4 bMethod 06
! U) O. f& O" H) E* k* K, s# b9 |% G=========* }) D& J3 h) v% Q! V0 i3 L  K# v

2 V6 I/ l: [6 A% G/ T3 H2 u( l. \& m1 K# R0 w" V
2nd method similar to the preceding one but more difficult to detect:- Z* ]% E2 Z4 I; U
5 @$ ^+ X) I; A

, U4 F+ B) u; t( |- t& [( x4 Gint41handler PROC
9 s+ {" q7 {$ x. X, R+ f* p    mov     cl,al
7 S$ n4 A. g  d% E    iret
) Q1 w7 y* l. n% \+ aint41handler ENDP( }3 P% ~& e# u. X) u2 k5 L
! O& h  W4 P& i/ H

. A2 ]- O; g0 K# d7 w( |    xor     ax,ax) f. P! \& U  ?- l
    mov     es,ax
% B; n+ P0 B- r( ^  c5 ^) L$ r9 k    mov     bx, cs
* ?' t* S7 k: Y2 e; A9 v    lea     dx, int41handler
1 D% I1 E4 Y$ n    xchg    dx, es:[41h*4]2 ~5 h' K, Y" n' y* k! }
    xchg    bx, es:[41h*4+2]
9 a6 A( @  C. V5 T$ x# V    in      al, 40h
) ]- n: Q. K( r0 E    xor     cx,cx, I9 g& e; N& s1 C
    int     41h# ?2 S1 L  S8 {6 I
    xchg    dx, es:[41h*4]
, l$ Q! _/ ^4 v& H# w2 R, `/ Z    xchg    bx, es:[41h*4+2]. U+ a+ S5 J. \) J( \) H# {$ a
    cmp     cl,al, h" ]! T: r5 R1 j: r( R. {; O
    jnz     SoftICE_detected
1 B8 G! ^  p; D+ S4 E! g# N  l: P3 B* `3 G- A
_________________________________________________________________________/ @$ b9 y/ i$ ]- k7 M3 i! N0 {

; r: S9 ^) Q/ _8 pMethod 071 i! q& z% Y. }6 C. s+ ]! `0 F
=========
- {7 N  \7 y& F: _& ~4 E8 D+ Y. n) M- [) x6 b' ?
Method of detection of the WinICE handler in the int68h (V86)* `5 H9 o  h+ e

9 e4 q+ i4 f9 p, A    mov     ah,43h, o- e. ^- r% q
    int     68h. Z: s' K& t7 s# X& [7 y8 Y
    cmp     ax,0F386h
8 s1 @1 P# J/ @: w1 B    jz      SoftICE_Detected( t) p( f& u! p; e9 _# p
9 W# j6 m0 u1 J+ a. w. J  c- {
) _7 R, Y' q. _
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- [1 e1 D" j0 q6 t2 l+ g
   app like this:1 E& D# S  V2 _( I6 w, \

1 ^" H: N3 Z2 ]0 I0 q6 h& g   BPX exec_int if ax==68
( Z8 {2 D7 O& m) c   (function called is located at byte ptr [ebp+1Dh] and client eip is% `. ]# J# \* I6 ^& U6 s! w
   located at [ebp+48h] for 32Bit apps)
: z' ^' c- ]5 A; h8 d__________________________________________________________________________
6 w* B* s0 C% H: L/ R8 P. N% g0 ?# Z$ ~5 J" v5 n) I. ?* U5 b
; q8 G; t" d2 Z  j2 R3 x7 G9 Y
Method 08* Y& I  s- t. s2 ?8 p. Y8 G
=========
& _% j6 ~, {; |, ?# a
& `2 U' Y' W) M) }6 W& p' S  f! rIt is not a method of detection of SoftICE but a possibility to crash the
" X2 ~' t) Q6 v3 zsystem by intercepting int 01h and int 03h and redirecting them to another
/ _1 d% w' ]$ o3 N% U  Wroutine.
; D0 O, z. S  [( ], c8 UIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points8 X7 C' d! J1 p7 [% l
to the new routine to execute (hangs computer...)
$ I1 @5 g8 S% V3 K  o+ i: b- b2 z3 t' W$ N$ V! W
    mov     ah, 25h, n( ^" j3 n  d+ t
    mov     al, Int_Number (01h or 03h)
: \8 z  p6 h: F- z9 y    mov     dx, offset New_Int_Routine
7 ?6 E! c' c7 i7 V/ h# J    int     21h
6 s3 F8 S) v/ B) _# ~8 I" o- ]+ a
__________________________________________________________________________
  V/ e4 ?, x; D% Z1 X
: F& C: ?0 a& i* sMethod 09
$ u+ e$ f% m, w* M: Q=========5 u2 u- {+ c  W3 t9 J

, n2 E, D2 Q2 ?: P# }This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only1 P6 B' T# q$ a  Z. T
performed in ring0 (VxD or a ring3 app using the VxdCall).
& G+ F  u2 T+ B) p+ N  hThe Get_DDB service is used to determine whether or not a VxD is installed
7 ]- e; j5 Z% {7 ]% r" y# Afor the specified device and returns a Device Description Block (in ecx) for% M: j- j( U- F* _, G! [7 d" R
that device if it is installed.9 |9 r8 A$ v7 _5 c3 T1 r8 P

0 ]8 A& S( R% O& p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 Q3 c/ i6 b! q2 k2 W! U7 R0 C
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% A6 W, a' i/ q- h+ n
   VMMCall Get_DDB
+ |. i& L* M  Q- d& z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, }5 [/ h- ]( H  t6 D# b# i. M( P6 e- I; B* a; J8 C8 ~
Note as well that you can easily detect this method with SoftICE:
+ d4 }) D6 E2 N# k5 S  q   bpx Get_DDB if ax==0202 || ax==7a5fh) g( C* I& K3 k0 y
9 b7 v" f- v* y; o% M4 y
__________________________________________________________________________* k" G3 R( J' ^! p0 J0 [; `

) B0 ~; d7 z  ?! e+ {/ |Method 101 t/ a! ~' H4 E% L6 H
=========' U8 }& k7 e/ |, Q: x
4 \  T6 ~$ h, V! u  R$ Z  S! @; F2 {
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 `1 L5 Y) z" ?) @1 l  SoftICE while the option is enable!!6 @; I4 Q3 m6 y6 g( ?

4 Q- y, w% q6 DThis trick is very efficient:
  @" E! G; A, w6 |3 @9 w  i9 M  dby checking the Debug Registers, you can detect if SoftICE is loaded$ Z3 G: V9 Q5 J; h  n
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 V; m1 \# f& R
there are some memory breakpoints set (dr0 to dr3) simply by reading their
/ ?9 y& m* H; _3 M$ Rvalue (in ring0 only). Values can be manipulated and or changed as well
/ a% i7 [& T" j" q, B(clearing BPMs for instance)  Y" U6 F% s8 Z5 g0 g
# I1 R* h0 @: E" W
__________________________________________________________________________7 ]: [8 M, {* ~0 Q/ G

! S7 W) O: _, h5 C! bMethod 11
7 m6 v3 H; {' a* _" `; L. \=========
" G- G, F4 l3 m. ~7 f" d
" w* W+ W$ J* T. d" c% v- e$ t. HThis method is most known as 'MeltICE' because it has been freely distributed$ \4 [& U; {: k9 M
via www.winfiles.com. However it was first used by NuMega people to allow% C  _* Z* Q4 O1 @4 G. z8 _% Q
Symbol Loader to check if SoftICE was active or not (the code is located7 l: U' M3 h# o
inside nmtrans.dll).
- ]/ h5 Y0 }# B$ u9 U* @. B  ~3 n. }: k+ {
The way it works is very simple:
2 q0 F' B2 N  C+ O. Y0 HIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
3 R3 ^  p+ ~: e8 V$ b) U  W0 eWinNT) with the CreateFileA API.
7 o  g6 t' t$ J( a; A
' S% w/ E; R; |" l9 B, c$ L* gHere is a sample (checking for 'SICE'):
5 d. V; j) @* ^3 l) C( E( ?6 H/ F* v; g# D! k* q6 L+ X% ^1 I
BOOL IsSoftIce95Loaded()
/ J/ k; L0 P: A) s; g  l! L{
" n& Y' j& `7 ~$ ]& k6 }   HANDLE hFile;  
" o/ {! a/ ~8 |0 h   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 A3 z. q" ^. Q& E
                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ `5 q' H6 h' `  ~9 @& @" h
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ W/ a3 C5 Z' F2 r2 G   if( hFile != INVALID_HANDLE_VALUE )
' D' y* l. V+ b1 r" m' {/ j  U" u   {
% q6 `* H+ I  I5 p' J' y      CloseHandle(hFile);
% \5 g5 j! q5 ~) V( [) ~      return TRUE;
, p9 B& `- d9 E' V( b( W* V( J   }# f7 D7 ^- E' j1 f/ y$ e
   return FALSE;$ W3 T6 i6 @- S
}
8 ]; e$ A' x3 z  k0 r- T* L) d* L3 Z5 o
Although this trick calls the CreateFileA function, don't even expect to be
: _3 C/ a$ r& Hable to intercept it by installing a IFS hook: it will not work, no way!4 W5 u& E; W: \2 |- T* Q2 v3 u% x9 y: l
In fact, after the call to CreateFileA it will get through VWIN32 0x001F) V4 y. |0 g8 a& R1 V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 N$ k) n- F- z& `% P; c, U7 Sand then browse the DDB list until it find the VxD and its DDB_Control_Proc
3 m% n6 b) m8 Y) ?field.
' {9 U; I. o6 RIn fact, its purpose is not to load/unload VxDs but only to send a
6 O+ V: I2 L$ p4 h! cW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 d- T' L" W1 v  J6 wto the VxD Control_Dispatch proc (how the hell a shareware soft could try
! Y, m( @; C' C, F7 c* b, Dto load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 K1 R9 N: k# P: QIf the VxD is loaded, it will always clear eax and the Carry flag to allow
6 L/ G/ Y. T; h0 L* N+ I; @* Hits handle to be opened and then, will be detected.+ s1 O, w& c$ t/ k
You can check that simply by hooking Winice.exe control proc entry point+ a& R$ s# F( t% B
while running MeltICE.8 e' U8 P6 R1 d3 Z+ R, P
, C% P5 ?- ]% k0 Y, B. z
& J& k) e9 H/ s$ |* D
  00401067:  push      00402025    ; \\.\SICE6 M  h; h3 D# W. X! n* `
  0040106C:  call      CreateFileA7 s0 M# x8 f5 x( t+ `, }
  00401071:  cmp       eax,-001
  d, V' |8 y" p" @0 ^/ r# d  00401074:  je        00401091/ P6 \8 o+ @4 W$ ~% [

- h* A# l$ @3 e$ S' L/ H
, y" k( i+ ^& _+ k" {There could be hundreds of BPX you could use to detect this trick.
8 V3 m6 E9 a, O  S. m4 m-The most classical one is:$ g/ G( D4 }; R0 Q) q+ C: b. {
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
: Q" m1 O3 [% ]- B# T& E* d    *(esp-&gt;4+4)=='NTIC'
! V+ |9 l0 b: d2 H- J; y2 ?: e, a$ x+ A2 Z
-The most exotic ones (could be very slooooow :-(: ^" s+ i8 v* N$ Q, }3 H
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( w6 \4 u7 I; _! y  Z, f, p5 ^     ;will break 3 times :-(
) F" Y4 K7 x; d* m, O) G( f
' v6 Q, X% a4 w-or (a bit) faster: * X& C) T* ~% `: p8 a. S4 W. z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- F0 v; U0 m5 J7 h7 z0 z8 X- Y7 F% `
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, H( j3 D2 g* F! D0 ]     ;will break 3 times :-(
. E. {# l5 e- _" d$ V0 J3 \' g! j2 V5 Y) r0 D) h/ O
-Much faster:
% U) r8 n! y1 r" k; k   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' J7 K% b7 l; }$ ]# v( M
& o/ a, G* X, H8 @: @! ], ~
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
- X1 r2 O# d, D( Bfunction to do the same job:
' n1 u3 W+ r: t4 R# f- A4 t0 |" Z1 B. l& u& C" o5 K, b
   push    00                        ; OF_READ
, y$ e) a- @! P$ L  o   mov     eax,[00656634]            ; '\\.\SICE',0
, n8 p% t! b" k$ p   push    eax
. R2 b1 r' r+ a1 X8 ^5 C9 k% c   call    KERNEL32!_lopen
, ^, J1 K) j  }& E  `   inc     eax
( c" ^9 L7 e# {4 I   jnz     00650589                  ; detected
& h0 w0 V% ]2 _$ l- c' _% T% N   push    00                        ; OF_READ
0 s, c5 p; R" n; g. R6 T   mov     eax,[00656638]            ; '\\.\SICE'
3 @* d7 l1 g7 S9 ~2 s/ S6 g# \   push    eax9 D" V- ]/ N' p: K* ]
   call    KERNEL32!_lopen: x" {# m3 p; W
   inc     eax
/ ~1 j6 `, O* m# Y2 ?! X   jz      006505ae                  ; not detected
/ _. k0 Z+ K  l, `; x6 {& r) e2 D& ^& v& h) p9 G. F& ~% d  `

  f3 H1 g' G8 M2 W5 B6 K" X" |__________________________________________________________________________
# |) Z1 L" |1 }1 S
& j# R1 o. }- u( _Method 12& `2 }: K9 R5 _0 D
=========
. s4 p) l: C5 L$ V% v& H8 j
: e; A& q* S  r- gThis trick is similar to int41h/4fh Debugger installation check (code 05
  s" J$ d7 R4 n% P&amp; 06) but very limited because it's only available for Win95/98 (not NT)
  ]' t/ x- \! J: K7 \$ [as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ ?$ ~+ S& G$ K5 d: a9 ]/ p: e

0 B7 {- {- {: N$ ?, C0 {" ^   push  0000004fh         ; function 4fh
: }# |6 l8 c8 f8 T: m) I* G( S   push  002a002ah         ; high word specifies which VxD (VWIN32)9 q1 M0 G7 n% N; U& p
                           ; low word specifies which service; b  x6 Z  r# P% e
                             (VWIN32_Int41Dispatch): B/ l* G9 b+ Y+ x5 Q# A6 o- X
   call  Kernel32!ORD_001  ; VxdCall( A4 L, P& r* u. i9 J
   cmp   ax, 0f386h        ; magic number returned by system debuggers4 p" S; i$ N$ q$ L% Q; h7 f
   jz    SoftICE_detected% x7 D5 B7 P# K0 _9 y- c# z2 |

8 ?) k1 g1 L( f& aHere again, several ways to detect it:
7 _5 h, m( K$ S+ q- C( ?. r
) |% _' w$ c) t: U7 J2 h: @/ }    BPINT 41 if ax==4f
! ^' S; @4 w& j. w& I7 L9 a* M* g3 ^5 j7 }2 Q8 _* H
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 k4 q. j% S& h4 H
6 C# V: v: w6 P2 F9 ]
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 M/ X( L0 k4 H8 p( W

1 C3 ^) s5 K0 K7 T3 p& c    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 |* m8 U4 _4 E4 `, e9 z

* Q8 g6 P; a4 f* S3 P- X__________________________________________________________________________7 ?' v8 K3 p* \8 c1 j

& ~, t# v2 C2 K5 |+ P, {0 v, YMethod 13$ f' t5 p! g9 V2 {2 b4 Q
=========# g* S0 N& g# ~, Z/ z# E8 x
; K( m. I: T7 z3 o
Not a real method of detection, but a good way to know if SoftICE is, m. }1 I9 S4 z/ D# |2 b
installed on a computer and to locate its installation directory." f$ P7 O. U4 S/ ^" O. [- N3 W5 i
It is used by few softs which access the following registry keys (usually #2) :
2 F" U# j& d2 A$ v4 W. ]8 c( L
( @1 o. @3 ^/ R3 [0 O-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 O4 h8 g! s/ |' l0 b
\Uninstall\SoftICE
. A/ ]1 [4 [/ D4 }" f0 S1 X7 W6 y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
" i2 ?4 T: a0 G4 F- t-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" i1 p( N' \2 g$ z. x
\App Paths\Loader32.Exe5 A, n6 o( K& H( d3 h$ s+ d
8 l) @+ d1 N1 [& W" x+ N
' F) o, @) W9 e! ~
Note that some nasty apps could then erase all files from SoftICE directory
) |0 R3 ~4 |# E4 j4 N+ `* L, V# g(I faced that once :-(5 B6 N& G# K( x! G# X5 }/ Z7 Q+ X

1 A9 G. |0 F: M2 \) V% GUseful breakpoint to detect it:% ?' c& a2 Z4 A5 x

% P. o0 D; V8 p' P     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 o* o7 I9 K+ P' }2 Q; u8 ^
/ V8 Z# d  W7 c/ z( a__________________________________________________________________________9 I- ?* D" w* ^. `% }3 E- y3 U: a

+ Y8 X; U; M# F0 F9 j) p/ \1 V, g$ ?3 g0 ~
Method 14
; Z& a/ E1 E3 X, C" Y=========8 Z0 ~7 l+ J6 d1 m

6 _1 b: m: v" E0 I; _( b$ oA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 i: \: G3 j" D9 k+ X$ I$ Uis to determines whether a debugger is running on your system (ring0 only).! v" _7 o7 S" D5 ]2 _" u) |
6 X8 W; R3 q/ e8 T
   VMMCall Test_Debug_Installed' E: V1 x4 t* T
   je      not_installed  |8 `7 a& j& H# w- L. g+ x
$ Q3 G6 ?$ \. G; r6 b; u
This service just checks a flag.7 s8 V. ~0 e9 o2 [
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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