About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>1 t1 a2 x& i3 r2 \( F
<TBODY>) y) r2 V  H/ I2 Q
<TR>
8 _4 I: F, i' S3 @2 D<TD><PRE>Method 01
6 N6 c6 ^" }" e=========
8 ?+ ]9 ~$ w8 b4 j5 ]. B4 d6 H3 o& \! w6 s, U' n* J5 a# C
This method of detection of SoftICE (as well as the following one) is
& O- u2 Q8 E9 j9 {- i' Oused by the majority of packers/encryptors found on Internet.$ c% w4 m; a* K# b1 M, M; a7 u
It seeks the signature of BoundsChecker in SoftICE
9 e" X* T5 j5 }1 M7 H: \+ }) z: }5 P; Q/ h( p
    mov     ebp, 04243484Bh        ; 'BCHK'
/ k& U, d0 R3 B# w. S# V    mov     ax, 04h
6 q: }& G1 m6 J5 H% ?& f# }    int     3      
* F$ x# s3 Q9 i/ l    cmp     al,4
5 E4 }$ ^, }" p! N    jnz     SoftICE_Detected
3 p" m2 X& f( V0 Z- I, \  j7 G
/ G9 ?5 e# C: I2 d___________________________________________________________________________
4 k( \# W4 q' z) S3 j7 H
) k6 O; _# Y6 C# [8 Z0 gMethod 02; f( t! Z8 y  ?- _
=========
/ ~  W& l) ~  f9 `# A% v8 z4 o( @& j
Still a method very much used (perhaps the most frequent one).  It is used
* ]) ]5 p7 x5 i8 q0 p" Tto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
; |% M4 |# g" I6 \. h% a8 m8 Gor execute SoftICE commands...
# W7 L6 b6 I  AIt is also used to crash SoftICE and to force it to execute any commands
0 h4 t9 A2 g8 l( Z. F(HBOOT...) :-((  / X* i# l6 M! e6 A9 \" B

. L9 \9 o. {; I2 K$ VHere is a quick description:
. ?1 P$ I2 U1 U1 ^-AX = 0910h   (Display string in SIce windows)
5 d! G5 V& d. Y  d$ A( v8 f-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. z5 K: b* `" i-AX = 0912h   (Get breakpoint infos)& |+ A, |2 n& |/ m
-AX = 0913h   (Set Sice breakpoints)
# N; |6 E5 a. O& G0 R-AX = 0914h   (Remove SIce breakoints)
% W! l8 U3 \4 c* k) c% u9 q4 C) h
2 j# ^) J' C3 m/ OEach time you'll meet this trick, you'll see:
) t5 [- n+ |' x% v8 e& J-SI = 4647h
" Z0 x4 f+ j) }1 F$ x( e-DI = 4A4Dh
' |+ @6 G/ _# d9 U2 ]+ QWhich are the 'magic values' used by SoftIce.
: ^1 {* t' D2 T) @7 H4 zFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- y) f9 P" u5 R9 c) |3 S2 y7 p2 V& P3 ?" x, H
Here is one example from the file "Haspinst.exe" which is the dongle HASP
7 h  i4 ?; Q* Q' S, NEnvelope utility use to protect DOS applications:
0 i; c' K5 c0 ~8 o, L/ W. |1 C) K

5 A# V1 A* b, J' i' b9 V4 g# f4C19:0095   MOV    AX,0911  ; execute command.: O- x' \" u0 p( V
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
$ z' ^  m, j8 k" C* K$ R- E4C19:009A   MOV    SI,4647  ; 1st magic value.
/ ?+ [& [) R* b0 g4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; A) X4 |* w7 P' P# m5 [' m! A
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 d9 C2 o5 i% X- s, o' Y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
3 W( r! J* H, f( M4C19:00A4   INC    CX
: A, l* p" o% W, X4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
% i$ T( s; h+ E4C19:00A8   JB     0095     ; 6 different commands.
) `7 \7 E8 I" \9 ~3 W6 K4 f1 S4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
; [' U2 z5 [( {5 p0 u8 N8 r4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)# O+ g/ a$ n" e% M/ W* D1 t

" ^) j) |! q# a7 D( mThe program will execute 6 different SIce commands located at ds:dx, which1 ?+ l: X# T+ D
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
: \4 O# i8 W) u0 T+ c! s, j# Q3 z' J" b0 e" S8 T( _: J
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
1 o) i, a: `  \) H& |; o3 i___________________________________________________________________________, J/ P: B/ {: k- P4 ?) D
# F" H8 |7 F- e7 ?& p+ i/ k

, k8 c* U) W: y. N2 q( m* d. DMethod 03* S) F& B3 F- F' B- f
=========
' M& m1 _, \) l, L' J  P. @9 I$ _6 N. U# ~: J6 X, [
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h; Y7 v% i( Q& f0 Y. u
(API Get entry point)" q( o/ @4 G& o9 R" `6 k* x1 |
        + k4 b8 h5 `& f* Z
5 h; c! P  I6 V9 v  C  u" a& a
    xor     di,di
5 `- C: ~5 _! ]9 L    mov     es,di6 }1 d" }- X- V" b+ y
    mov     ax, 1684h       ' l& x* L4 h& I, |8 o6 {6 X
    mov     bx, 0202h       ; VxD ID of winice
% g: F( t1 ]) w1 @- U; R    int     2Fh
" I# {) W" h% Z% [* C    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! L: a, F) ?7 M2 t0 g" t2 P    add     ax, di
! I' U% B" [" Q) s3 E& a# g    test    ax,ax9 W6 G0 _" m, y& {
    jnz     SoftICE_Detected
4 g$ D( o# \) r$ M. Y1 Q: Q  d# o! D& f) F: l
___________________________________________________________________________; B  ^, t" b: n: Q* x% h1 ?8 X) Q

0 S4 y; P5 i2 ~Method 04
+ n" r. U  h: d2 [+ t=========
& M2 M' F$ N7 E% v3 a- a# f6 h# n7 S% m/ o. A6 E7 H& u& \
Method identical to the preceding one except that it seeks the ID of SoftICE  T, }, K" T) ~
GFX VxD.
4 ~9 v. z2 [, e: `& g8 l5 j" _5 T+ [
    xor     di,di
7 l9 u* P& p7 C! S# \! t    mov     es,di- F: q+ p+ C' s  s& [8 d
    mov     ax, 1684h         w( u5 R1 `; x4 w! R# a' M
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. Q( S, s* j$ P. x: t" X2 U    int     2fh
  d9 i/ Q" @" n9 T' d6 a, {" c7 {* Y. v    mov     ax, es          ; ES:DI -&gt; VxD API entry point. F0 c* @% C! M; @0 g$ L! a' M
    add     ax, di
% o; ~, b9 |; ~- R9 F    test    ax,ax2 t" u! s- V0 K: C" p; H! ~
    jnz     SoftICE_Detected- u( _( {7 f3 T' U- [8 p+ V
0 _0 S4 H8 c8 E
__________________________________________________________________________
$ Q  V2 Y5 [6 }% ~7 k9 ~4 r: q$ f
0 ?0 E. b" Y0 n( F+ V9 [/ D  S
0 R0 y1 Q2 U( ]6 i7 m1 a7 lMethod 05
* W' ^! t1 J! L3 ]  I: m=========
/ C# B& S: p/ ]5 M
* L6 b- y. ?7 H$ D$ W2 xMethod seeking the 'magic number' 0F386h returned (in ax) by all system
. [" E+ C) j- X  Bdebugger. It calls the int 41h, function 4Fh.0 B3 R2 G* S$ I( ~6 M& c4 c0 [- ~
There are several alternatives.  9 @9 I$ F% `7 |; m2 k& k4 w

, n; G, o- ^, ~1 C3 O9 TThe following one is the simplest:
2 Z# Q& ^7 }- G0 F& r  c
  y9 G/ Y5 g! _& ~& M$ U6 |    mov     ax,4fh8 [& w* u' c$ ^! K5 Y5 y8 ~# U
    int     41h5 H' _; d- q2 F) j8 N1 |* T" m) k4 P
    cmp     ax, 0F3864 f1 a8 h* r& ^' D2 m0 C
    jz      SoftICE_detected) b3 D. t; g6 e
; w% j2 d5 t, R" ?5 Y. |  {
3 N( ^" I) J2 E9 c* h( L/ V
Next method as well as the following one are 2 examples from Stone's
  w+ A' k! _6 o"stn-wid.zip" (www.cracking.net):
7 K* q" g% N* D
& N0 ~( w' c! V0 Z+ H& A% [/ O& N    mov     bx, cs  X7 L5 h8 K+ o2 k  o* N9 z
    lea     dx, int41handler2) X+ ~- ^7 J$ S; [& q* ?4 U; d2 w  R
    xchg    dx, es:[41h*4]. ?! V, W- w* F6 @7 R' p* n
    xchg    bx, es:[41h*4+2]1 F2 c$ A$ U% H* B
    mov     ax,4fh1 ]* M/ d* l( r$ R
    int     41h
6 \  X/ v- }4 y8 w( L- C    xchg    dx, es:[41h*4]+ M  Z/ [7 T4 L% K7 I; ~, ]
    xchg    bx, es:[41h*4+2]  Z. k$ b) M' `* }7 C, J- p
    cmp     ax, 0f386h- K4 b( {( L2 \, C
    jz      SoftICE_detected
% A$ _. N. p  _9 D' ?% M6 l: b; c2 a$ a$ U
int41handler2 PROC+ P& d+ n" N- w& ?) K7 M
    iret
+ A  @' g5 m6 p0 Z. N- q& B* D# oint41handler2 ENDP
& R  w  H5 b7 @
4 e$ A% S+ h9 M: Y2 X: [/ d1 ?
9 h8 a2 y* b, _: G_________________________________________________________________________
" w" m6 q& T: p, s# e
: E( X/ ^4 s: A0 Q7 G% I
2 v; F% P. N% {& Z% ?3 E$ w  q' GMethod 06
) M1 h6 I, K8 Y9 e( H& ?, a=========
4 G- g" W4 A0 `* _
  w. {& y3 i' v+ T, R; B6 W3 z
$ h& b6 ?0 M- ^2nd method similar to the preceding one but more difficult to detect:
& f8 A% ~. p! o2 U* u
  |, s  \5 H8 r3 y
" I$ M$ t, d. o; vint41handler PROC
* y: D' U3 x* H5 Y! J7 C. L    mov     cl,al
) \4 I0 _5 k7 f. P9 J/ r    iret6 ]. _0 W1 S0 U
int41handler ENDP
, c* e  `* g, D3 q. \7 p7 G
  k' y8 s! `3 L6 \( A' A  \" F8 Q, p7 Q' g8 t2 j
    xor     ax,ax% e6 o, [0 V; F% l6 G4 j( }$ r
    mov     es,ax5 q" ~; v& @* n! o8 s7 l# w
    mov     bx, cs. c" D5 m! \# Z% z( d! m9 [3 V
    lea     dx, int41handler& o% D* X- W' n3 x& {
    xchg    dx, es:[41h*4]
& R( \( A2 k0 T' ]4 l    xchg    bx, es:[41h*4+2]
( [) s- n- h# s" M& k  ^    in      al, 40h
& u- k: j/ t  D8 I5 Y+ n0 w% r    xor     cx,cx0 V; s- }: Y! i9 n
    int     41h1 E. y  M/ g+ ]9 @2 z' @2 ~
    xchg    dx, es:[41h*4]" a6 z/ u+ }3 a
    xchg    bx, es:[41h*4+2]
! V) N# `" {7 _- u( y    cmp     cl,al* c  T2 X# E. F) L  @& y
    jnz     SoftICE_detected" X$ K% q: G  \% N

& @7 m4 O" [! F- T7 F# h_________________________________________________________________________
% l) S* U9 @  G( ^; t9 F  Q/ \3 b6 \8 \4 E0 E" N- [. s
Method 07
  `/ g$ n" G$ l4 ^; f: H9 h! l) s=========
; f# u8 J. {2 k% u$ a. Z# q, @1 Z5 m. h8 f$ e/ Y
Method of detection of the WinICE handler in the int68h (V86)
. Z- v6 M; j1 T" p0 n( G5 M4 W+ V' L' `" o
    mov     ah,43h- a# F' M% f, [+ a& q$ V
    int     68h
( M6 G. }9 L5 a$ d+ ]2 |    cmp     ax,0F386h* @$ e) w. Q% m' f1 l
    jz      SoftICE_Detected' e( Z9 b. s/ O: f

1 C' d% k7 Z5 Q  p! C+ [5 m1 Q2 W  I9 b' ^$ K
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit; S9 V! L3 I2 o# k# @, r
   app like this:' |* b  r9 n: Z: m( z( Z6 J8 ]

  N) U1 u2 G9 k( o: k9 F   BPX exec_int if ax==68
) W8 n6 `3 {3 _! z* G. }) i9 C4 T   (function called is located at byte ptr [ebp+1Dh] and client eip is
( F% M% \$ }. D2 k0 g# r   located at [ebp+48h] for 32Bit apps)
; S5 a$ P* H+ H" L0 p+ o/ Q__________________________________________________________________________" m7 j& o4 j* V0 e' J
1 ^1 K% a# Y2 a* `! Y% C

8 a6 G6 m  m/ j4 w( d% rMethod 08# X* t$ b) s3 ?( i
=========3 v; u1 K3 K* n& n8 ~
5 q5 P% S& }0 y
It is not a method of detection of SoftICE but a possibility to crash the
- Q  G8 x% S- O. Y- Asystem by intercepting int 01h and int 03h and redirecting them to another
( d: S% ~# N' c% K; h- ^routine.
+ X, `6 O- K+ f& [It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 ^! ]7 k& V6 }" d) cto the new routine to execute (hangs computer...)
% y" U8 M3 s7 ?1 F
- U3 {& q2 ?  d    mov     ah, 25h1 c. q4 s1 R9 X9 @# O2 W. Y
    mov     al, Int_Number (01h or 03h)
2 j9 l! Y0 A8 B7 B0 S0 \/ p# L    mov     dx, offset New_Int_Routine) v% {, _) H% a' A% a- E1 A* N( z
    int     21h7 k. s# |1 R& B2 X: k1 P) ~6 m
/ ?  E, @1 ^( n( I0 Y2 K
__________________________________________________________________________* V" A  Q; U. L5 k; f) |9 K
$ y8 C4 R- C; `
Method 09
" n  X0 M  o+ N# Q& X=========
5 ?4 f, L* U) `2 h4 M1 I" b1 J' I# a: I. M/ i$ P% x
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, {' t3 I5 t2 l7 o7 _" z, @% eperformed in ring0 (VxD or a ring3 app using the VxdCall).! r) m+ C, \2 i1 b; i/ P' j3 ~* ~' r
The Get_DDB service is used to determine whether or not a VxD is installed: a  @& Q0 T: A- X  ^
for the specified device and returns a Device Description Block (in ecx) for
3 c! Z. `/ E! p* n2 W3 I  W) fthat device if it is installed.- f8 _( a' ]6 K: ]  Y

$ @9 Q% O; t; _" g   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 x+ R4 N8 w& x
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
1 L9 t; t+ q7 y( \   VMMCall Get_DDB
/ v; ?5 v* {" B- _8 @; |5 E   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 |7 K2 R6 m* Q9 C: j7 W

7 I  T% P2 Y  _Note as well that you can easily detect this method with SoftICE:
# z- ]4 ]9 _4 {: I8 O) c   bpx Get_DDB if ax==0202 || ax==7a5fh; ]% A" L. F& b! S6 Z

8 y# u5 {/ D& d5 v' W: `  Y# s; f+ F, k__________________________________________________________________________* x) \6 f. S( _, z) P9 d
& }4 u$ u3 T8 ~1 n' o
Method 108 m3 w. I1 I2 Y9 i& E9 G, J
=========
6 G0 s0 E3 P; r2 B) l. G, {( K$ |; W3 d! h$ B
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ l6 M% z' n- e( ?( j
  SoftICE while the option is enable!!
5 x# U8 ~7 a/ {9 `- o" t: i1 H
This trick is very efficient:, A8 e# B, M, ^. k
by checking the Debug Registers, you can detect if SoftICE is loaded3 B4 i2 T% u* O# y+ O; Z/ Z9 G3 w
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
* C& T. p# t: o  ethere are some memory breakpoints set (dr0 to dr3) simply by reading their
, ~) [% D  W2 t3 J: ?3 e; E+ \value (in ring0 only). Values can be manipulated and or changed as well
" h" }3 [. U  }4 m(clearing BPMs for instance)0 l% S! E$ F% {: ]
+ ?% S7 u/ E* i# D
__________________________________________________________________________
6 H* |- |: L. A! L, n  ?7 a' d7 x
Method 11( I9 y2 W% C4 |$ O" y* j
=========; L0 s& j: q* s3 U% L2 c
  J) P- A  U) z6 M1 W
This method is most known as 'MeltICE' because it has been freely distributed( Q9 t! {) s) u0 ]$ f4 ^' |
via www.winfiles.com. However it was first used by NuMega people to allow2 D1 n4 c4 F  K9 D4 o, B6 ]
Symbol Loader to check if SoftICE was active or not (the code is located
  \% L: h7 i8 u7 K+ f+ iinside nmtrans.dll).* l+ l' {' g' p9 u

% C( u* k3 w$ m2 w, l# y3 eThe way it works is very simple:7 O3 {; Q/ Y; A/ J( i( H
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 b$ n4 b9 b, |; I3 o6 X. h; u
WinNT) with the CreateFileA API.6 @! ^& p9 y, y$ H8 ~1 g  Z+ u

! C; l. F* H- NHere is a sample (checking for 'SICE'):
; ^4 o0 H. m% d3 ]% `% x7 P1 J6 w7 ?9 s: Z: G) h: U6 ?
BOOL IsSoftIce95Loaded()
" x7 o3 U: T" H# X{5 [2 V/ Z+ s" [! g; A& @$ Z
   HANDLE hFile;  ) q7 _/ q5 E7 B& ?- A
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
, t6 e6 [1 U% Q/ m$ \3 Z: R                      FILE_SHARE_READ | FILE_SHARE_WRITE,* Z' U7 f  {5 x
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& m' Z- o; q# C! m1 E4 [! R7 G   if( hFile != INVALID_HANDLE_VALUE )
" m. V/ }8 n" ]% }9 j; b$ t8 [   {
* B" C  r# Y! m$ e- D      CloseHandle(hFile);
# ^1 l0 [0 S9 Q; Q      return TRUE;' E4 r+ z4 I, m) s* Z) H
   }
2 u7 d6 C; G9 P- L! w0 _   return FALSE;+ `5 v* Y3 g7 i
}
! }, g4 A5 l- \$ A7 ^5 H7 r" O+ L! k8 o7 }! ~# N: t3 U
Although this trick calls the CreateFileA function, don't even expect to be/ K5 v) T3 R  c2 T8 j" I
able to intercept it by installing a IFS hook: it will not work, no way!
4 v2 V' B8 k- J5 mIn fact, after the call to CreateFileA it will get through VWIN32 0x001F: S# F  |: ^$ ]' y, p4 @5 w
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
7 u7 ]; J  I# d: nand then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 H; T/ e  ]  t2 w  x4 Xfield.
+ t# I9 R. a! V; xIn fact, its purpose is not to load/unload VxDs but only to send a 4 B! i4 t2 `/ W6 q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
5 v/ O+ Z! T7 G" H& ?3 tto the VxD Control_Dispatch proc (how the hell a shareware soft could try
* |. {7 e' H- eto load/unload a non-dynamically loadable driver such as SoftICE ;-).
8 G# n, }$ L7 ^$ c$ a2 WIf the VxD is loaded, it will always clear eax and the Carry flag to allow; x# q: G. Y& Y9 ?2 T
its handle to be opened and then, will be detected.: r$ u. f9 z* P0 O  Q
You can check that simply by hooking Winice.exe control proc entry point
) v: w( w/ m1 g, cwhile running MeltICE.
8 g! W: _" V  V) l4 O, T7 k7 H2 C- ]+ I
$ _9 F* D$ F* b7 U  z
  00401067:  push      00402025    ; \\.\SICE
) \. L/ p  s+ p$ N: y! F  0040106C:  call      CreateFileA
% `( a7 }% i0 u9 o* J8 h" M4 _  00401071:  cmp       eax,-001
3 r0 r$ n5 o: `' Y  00401074:  je        004010913 X2 b2 s2 \9 {& c0 U' z
. [. D0 x5 w. {2 P, _
) M9 n( N% O+ c8 d7 O! R7 }6 p1 ]% d
There could be hundreds of BPX you could use to detect this trick.
% ^2 k9 q0 H+ ?7 k# x" \-The most classical one is:
# B: D4 r) m. C* p. k  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
. ~4 B1 c; ^: k+ s+ A, n& a    *(esp-&gt;4+4)=='NTIC', W3 V0 a( Y- D2 F: u

, n7 w- v) A; V) Z-The most exotic ones (could be very slooooow :-(
9 v1 M  y0 G  k- u  ^) I2 F   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + V9 ]. Q% W0 B/ J  h  [' R
     ;will break 3 times :-(
* U4 h: P( \( S' h( E1 r0 N/ j3 s# ^, D* @  T  Q3 c3 ]0 c: T. B, K
-or (a bit) faster:
$ [1 x+ O3 [" d4 v' W" N. V* E   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). ?6 V& R! }: X3 M' a& [1 ]

; b; |+ }1 K# `! W+ \8 l   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
2 }/ V1 {! g0 F; T     ;will break 3 times :-(# Z6 v  p% r& N% g; h# @  I( R

! J8 C9 l- E7 b, W3 \, G$ z/ p2 i-Much faster:
% x" g  D  [; S. ]   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'* z0 g6 V. v8 W

0 d: n2 F) R' I- bNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
- c5 G/ D7 x+ b+ c. Mfunction to do the same job:6 _" l% t7 P$ f  T" r

1 Y$ a5 }$ |3 `) p5 x0 o( S( y   push    00                        ; OF_READ- J: k8 [' ^1 Q
   mov     eax,[00656634]            ; '\\.\SICE',0
, Y/ w: R, q4 [( ~# f   push    eax' q0 D# K1 F# o2 f
   call    KERNEL32!_lopen
: k  D3 G# ]+ Q) B   inc     eax
$ E: {( J/ y8 K   jnz     00650589                  ; detected$ R* H# |* g' x7 n0 A8 [* v* ]8 {
   push    00                        ; OF_READ
5 G0 L) ^/ H' z  _3 C  q; d   mov     eax,[00656638]            ; '\\.\SICE'
4 X6 [$ T$ e# M7 S$ k' v$ O$ F   push    eax
/ x: i0 t+ @3 R  W! F: G   call    KERNEL32!_lopen
& m2 Z9 S( Y' J   inc     eax
9 x) ^9 ?/ V  ~$ ]   jz      006505ae                  ; not detected
, N8 Q* w, {+ V) @, x. p; I; H& c8 D1 B

4 k0 t- @" l4 O& _* q__________________________________________________________________________
3 L* |; T* s% b
2 ]9 J3 Z1 v/ _$ u& BMethod 125 o& k- Q  ]3 T2 S
=========- W/ {+ y; d0 l; G( a* S1 r

+ N, n! |# d+ mThis trick is similar to int41h/4fh Debugger installation check (code 05) g+ l. \1 h7 R$ s5 v
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
1 X( a% z9 x1 c$ Has it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 w( X8 }, C6 Z& R* Z) u, O- z# V/ y5 O! s# ~
   push  0000004fh         ; function 4fh
: Q8 w8 o3 l6 [& U6 n/ m   push  002a002ah         ; high word specifies which VxD (VWIN32)* V8 F# s! V4 }; X- G
                           ; low word specifies which service
* w7 l# a% F+ w$ b                             (VWIN32_Int41Dispatch)/ B4 Y4 v" h+ ^' S
   call  Kernel32!ORD_001  ; VxdCall
' ]: o% G$ K& D" {0 F+ `  B9 j   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 a9 q. M9 m' a   jz    SoftICE_detected' Y$ U  \+ q4 g8 ^+ v" `

5 r$ `! P8 i+ D( D. LHere again, several ways to detect it:
6 z. W+ b( F( E7 v# \/ f
" f8 v1 l1 G5 F3 v2 A, {$ M    BPINT 41 if ax==4f5 u5 ~' k0 U- v6 ?6 J. X7 q

! @; v# X/ w/ k9 w' S% ~, p# S    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 X1 r8 E  |. T
7 m2 f6 f2 r: P& i7 F    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A6 W  z% b! {" \- `' F+ F
+ I9 s2 b4 I) {( _% l! ?9 I
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 t  F: u' p2 F5 X1 \% ]6 f

% Y1 K. o$ ?/ \3 r+ X" h' e+ m__________________________________________________________________________+ J9 N8 K% x8 x

1 A5 t! Y! Q: M* m  pMethod 13
( W% u. V1 U0 q+ {0 G! y; n=========- o! E6 R8 E* e, I) S: k$ k
; [- x1 y0 P9 W/ ^* ~5 }! Q
Not a real method of detection, but a good way to know if SoftICE is
( h3 I% c: Q$ f: v/ Jinstalled on a computer and to locate its installation directory.1 o) `' h3 A. N# Q3 i" @5 R
It is used by few softs which access the following registry keys (usually #2) :
5 ]9 M0 x+ J# v6 u7 R& F5 ~# B2 z9 W3 U* b1 V
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 d4 ]0 d( F+ Y% U3 ?& s
\Uninstall\SoftICE. K# ]& e) c  C9 o2 \* k4 w  g+ _
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE" k: g" O; g; W9 t! w) j' O" y: p' U
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* U. a+ ]* \2 a7 J4 c\App Paths\Loader32.Exe
& t+ B% y- }( T& {: v' \1 W3 X- b0 r1 c4 |) @; ?: t7 Q
- I  I* \2 f, A) d1 t) \3 K* b7 Y
Note that some nasty apps could then erase all files from SoftICE directory
# K5 j# a' j8 Q0 y, A. Z(I faced that once :-(
4 M6 g, B- z  z: S2 ~+ F& j# R
* I; \. g  {1 d6 h# r4 MUseful breakpoint to detect it:) K$ j5 d* |; X9 x
  w6 A9 A6 Q  R+ Q6 s3 z4 C, _" b' f
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 |  l+ d4 l, a- h( s3 n/ U

. @" Y3 l) I7 {__________________________________________________________________________
  s& X7 G9 H, R3 _" r2 P& O. p3 k+ V# F
5 f  P3 q0 W8 Y" E
* |; c$ M+ z7 Y5 iMethod 14 . N0 u- ~+ @4 O6 U. C! B  U# S% G
=========! P' ~, g9 f! @

$ M' k% m7 B0 L; x& d" }A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# M3 m6 {* y" I8 Uis to determines whether a debugger is running on your system (ring0 only)." ]% E# T# L* z7 D& U

; e0 ?8 _3 m- `& R+ L+ e   VMMCall Test_Debug_Installed! b7 x! i: H. Z" b8 ^8 c, \. T
   je      not_installed
4 F6 r0 X" y1 e2 [1 V
7 ?+ ], j% ^3 H# H& ?This service just checks a flag.
3 H: ]) J. {; T  e</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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