About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( d3 N) D+ [9 `' L7 D  Q4 V<TBODY>& r( K# p! t) G' e$ v
<TR>7 i/ U( p; V1 p
<TD><PRE>Method 01
4 R; x$ @& g2 B. T3 \9 c=========
* J/ y. J# ~8 L+ A
& Q: S' I0 H, i9 g( x! pThis method of detection of SoftICE (as well as the following one) is
. n* G  L! w% j/ g2 s9 c& v- Zused by the majority of packers/encryptors found on Internet.
3 {( ]) z! D$ i" xIt seeks the signature of BoundsChecker in SoftICE( L7 s" C: U7 _  `
9 g& y  [) ~  T8 U% A' [: |! R
    mov     ebp, 04243484Bh        ; 'BCHK'% V+ v: t- \0 w) b" O4 o4 N  u
    mov     ax, 04h
- o6 q: R3 a# A- |2 t    int     3       ! Q3 K: l, Z$ J4 J& S
    cmp     al,41 M: r! `- o5 ]
    jnz     SoftICE_Detected" b! _* a1 H. H) V. y1 K, Z
) e1 R0 o( P* `" b, b, x8 Y9 u7 O
___________________________________________________________________________" r5 n7 b# S# K9 ]) n

* T% J4 _% M9 o, R5 W. ]' _Method 02/ D" X$ {) x, }$ V* d  G
=========4 I# L/ f6 i3 \; X% W. X# C

- U6 I) q6 G% l: [Still a method very much used (perhaps the most frequent one).  It is used
& o0 y: O9 p  I. J5 m' Q% [; Eto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ |$ b7 {$ \9 Z# l& eor execute SoftICE commands..., y& `% V( Z' u# S' p
It is also used to crash SoftICE and to force it to execute any commands
, h" P& \5 Q7 Q(HBOOT...) :-((  
2 z: j  O! n+ ]5 |1 r  A; T( F& X% e+ ^1 L
Here is a quick description:' Z4 \  Z. F  R
-AX = 0910h   (Display string in SIce windows)
8 F/ I5 F! F4 Z-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 c! s" t! I: S/ G& e! ?-AX = 0912h   (Get breakpoint infos)" s- S- W9 b9 ^5 q$ Q; u* C3 t
-AX = 0913h   (Set Sice breakpoints)
/ C: ]7 X) u" m+ [6 J9 ]-AX = 0914h   (Remove SIce breakoints)
. v% O" a" u. t0 j* J- d) c, Y% F% g, M0 m! j1 H
Each time you'll meet this trick, you'll see:
  C" P9 x# f3 \' |4 s7 G7 |7 O-SI = 4647h
* ~' H# e) p4 h$ ]* i  Q-DI = 4A4Dh
) W% }5 z0 H! g8 e( fWhich are the 'magic values' used by SoftIce.
3 P, k3 I6 r1 D5 M- gFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
. R; N9 i5 ~! m# Y7 @, P7 Y0 U) o, v0 ?1 J6 a, {
Here is one example from the file "Haspinst.exe" which is the dongle HASP$ w! W7 t) y! W. S6 ?$ q/ k
Envelope utility use to protect DOS applications:
- D& T. g0 V0 z6 U& S, i
1 |; {4 d/ H, h8 E8 g
# L" g3 g+ P3 r4C19:0095   MOV    AX,0911  ; execute command." o6 F4 A- f7 {& V1 O
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 ?2 i9 Q7 W. ^6 E% P, z) N3 s+ m
4C19:009A   MOV    SI,4647  ; 1st magic value.
( g# Q( L( `9 S$ v7 W) ^4C19:009D   MOV    DI,4A4D  ; 2nd magic value.1 ~) \7 \% o3 T  T0 ^1 C6 p
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ B, I, L- C8 d% U9 \6 L4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( c9 a% Q1 f7 f, D
4C19:00A4   INC    CX
8 R4 J: o# z8 i4 e4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# r% B7 u2 B. v0 I- C( ^5 X
4C19:00A8   JB     0095     ; 6 different commands.
9 v7 c0 \( M7 d$ Y# @4C19:00AA   JMP    0002     ; Bad_Guy jmp back.1 |2 h8 a: b. \% N6 u. j4 A8 Z
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! r+ J, u, y* R: v1 o& w
: }" w4 _# O* M. r* T- Z% x3 Q
The program will execute 6 different SIce commands located at ds:dx, which1 K' T! G# S0 B0 f! b8 q" G, Y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% `2 k! W! e1 G9 r( D0 u9 L/ a8 V; U5 T) M7 H# j8 {
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., e5 Y+ s5 f8 C  f7 Z6 l% z
___________________________________________________________________________1 e2 F3 G" H9 I6 h8 A# m
( |: \7 O% j: F/ B: Q- G

1 `, e: n9 {: t9 HMethod 03
1 ~  S% x8 ^! J0 P7 j. g! N=========
: v- ?  ?0 Z; P( @
5 Q, v" t. \0 |; LLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ y% }# ]( g& F& P2 \; g. `(API Get entry point)0 w% U% Z& Q' D$ V
        2 l1 p) m! w* o' X: \9 ~

( J. |4 Q- ?1 f2 t4 R7 q    xor     di,di0 D4 l8 h) I) @6 u' S  W. I
    mov     es,di
, l; R6 w6 S* U; q* V    mov     ax, 1684h      
% |" W7 i& ^# i; h( c1 G4 z+ C4 S    mov     bx, 0202h       ; VxD ID of winice" L' O& N% S! p1 l: H5 g4 p$ Z" i
    int     2Fh$ t) f6 x9 |2 @  C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  Y3 T2 v$ \( [+ Q
    add     ax, di
. }& }0 ]& O( V& {: g! H    test    ax,ax! i2 I$ D9 X" n. w' J+ G; @( Z8 i
    jnz     SoftICE_Detected: R% Q; V* X/ @# E
' Y: i" j- h8 b! [0 g
___________________________________________________________________________
% c7 r; u0 Z% l8 O6 D( C
! y4 x- h# {" A1 _Method 04
% ?; I, m& M1 _$ N=========
, `, n9 z* a; R5 U1 M1 \+ |! G+ k0 S- \7 M$ b7 p- O
Method identical to the preceding one except that it seeks the ID of SoftICE. p3 N8 y, Y4 L6 ~, t
GFX VxD.% p0 }' C% u1 }3 H0 }

2 F: D' X2 T+ w0 `( o4 e! e    xor     di,di  u3 |# B# }  H% r
    mov     es,di
; D- x6 B& ?2 U3 L/ H    mov     ax, 1684h      
2 A8 [! {! Q) S) U# B6 ?4 @' x    mov     bx, 7a5Fh       ; VxD ID of SIWVID
' [0 X& j1 i" v0 [+ K' T* H; \" ]    int     2fh& U3 G0 n9 i+ ]' T( c1 C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* H; r( b* j0 X1 l( Q+ w9 g' ~+ N
    add     ax, di4 x2 Y8 B/ Q' Q( E  ?( l8 U2 _0 n8 S
    test    ax,ax2 `4 h8 p& J- H
    jnz     SoftICE_Detected+ X' W4 P6 A+ V  |( }4 j
2 x# N& [) N. b' x/ |
__________________________________________________________________________6 M) l& O* c  z# D: c  r3 m6 P6 }
" A! _5 d/ h; n: ^( E; @
) D; ?' c; x2 [3 T0 z8 P
Method 05
* A4 r8 `3 S( v1 F* b% ^=========& B  B" F/ X, ^" O

& U9 Z  b$ {  d5 kMethod seeking the 'magic number' 0F386h returned (in ax) by all system' R3 |' X% h- F
debugger. It calls the int 41h, function 4Fh.
0 N# W+ C; W+ d$ T, pThere are several alternatives.  
5 y/ m9 G# W. g% i. P+ P
" f" B/ s8 \" P1 H! lThe following one is the simplest:: Z& @: G: T. N: K

6 ]3 P# |+ O  X" k    mov     ax,4fh1 C0 |4 L1 |+ U8 |- w
    int     41h: f- Y# R5 z% w" E
    cmp     ax, 0F386) w# S% o" Q6 {$ ?2 Q( x0 \
    jz      SoftICE_detected
- G- z, p4 S' {. d: r0 g4 p$ ^9 q  L/ T' L# t6 i
: N6 P9 G$ A1 f1 k
Next method as well as the following one are 2 examples from Stone's
% Y9 u; q* y& {! {) w+ _"stn-wid.zip" (www.cracking.net):2 k1 O' b1 p, p5 p. R# F! ^

* U  @, H! z2 a9 _1 [    mov     bx, cs6 P  s9 s, n: [7 |
    lea     dx, int41handler2- J' G% g2 C' }7 H
    xchg    dx, es:[41h*4]
$ S; D7 Y: v6 {- X4 I) [# r; q: u- H    xchg    bx, es:[41h*4+2]+ J0 k$ a3 A2 X& t/ Y1 O! [
    mov     ax,4fh
2 b  g% l; v& r* R7 J  @    int     41h! O3 s4 P5 L% l. H6 U1 T
    xchg    dx, es:[41h*4]
  o6 a+ m+ A" y5 ]! I    xchg    bx, es:[41h*4+2]" Z6 G4 r2 I  E* J
    cmp     ax, 0f386h
0 ?+ j  n9 a2 P, N  g    jz      SoftICE_detected8 ?& ^( |  K5 I3 Y
# Q5 V) D& y( |, |8 K* {% ^8 I9 t
int41handler2 PROC
7 ]5 B% J& u1 H+ e4 t' C    iret
! q# y/ O4 C  C0 Xint41handler2 ENDP6 ~' X0 ~7 m: S  {- h

7 t/ l" H' n% R) B' L7 ^0 B. a+ h/ K+ S" ~# e& |( G
_________________________________________________________________________
, l1 S3 V9 m* ^( e5 K) q* u" Y1 C3 h4 J5 d

- a# z5 X' e) M, K" d' YMethod 06
+ p' Z, ?' q: P& Y- G. T=========' q" O+ F* G: Y8 f3 t! \
  T8 C6 `* m3 m. |+ Y7 y4 J4 s
# {1 J% _( a* |, b; o# C
2nd method similar to the preceding one but more difficult to detect:+ J, K' U9 q3 Y3 H6 F. \2 u. _6 O

; e  t: I5 w5 K" a$ p9 i" @9 k+ y1 t2 }& t5 }7 l* `
int41handler PROC1 `: d6 y5 F& ]- l+ l" u" c3 R; {+ D
    mov     cl,al
& f) J7 V+ P/ R' F    iret
. p' R7 c! R2 k0 O9 C) o' o, Iint41handler ENDP
' z7 ], F0 c+ [% B' m; e2 T* b* p1 L0 U- X: f. A

; B+ P" `3 P8 T+ }; V    xor     ax,ax. E6 Q$ l) S! N1 O4 C8 S
    mov     es,ax7 ?6 K9 f' }! l
    mov     bx, cs1 v! Y& @* z( g" w4 r
    lea     dx, int41handler4 L& M( K& Z1 K! t! k' K8 [
    xchg    dx, es:[41h*4]
4 B, n% |" M$ B/ h, R* y9 f    xchg    bx, es:[41h*4+2]
7 C; F  E' q2 m( h; u! l, {    in      al, 40h( b  j' z/ J2 Y( L7 ^
    xor     cx,cx: E/ M2 A  y0 |
    int     41h
4 V/ u3 g- O% ~. O6 n    xchg    dx, es:[41h*4]
: Y' z2 ^5 F' C" T  n- n    xchg    bx, es:[41h*4+2]
& B: M- K- d8 M+ X    cmp     cl,al" v1 ]7 L. M5 e7 a
    jnz     SoftICE_detected) }, }! ~3 o9 g, p. ?
6 a0 l* G$ @" y, c- {; Z
_________________________________________________________________________  R; x& i4 ]1 _7 R$ b# g( W
8 |7 G8 J2 A( N& Y( u" b$ g( Z* Y
Method 072 n' G4 p$ c8 _8 |
=========
% L# o. Y& S  c' X/ m: w6 ?9 k( ~  _' g1 z7 \$ Q/ [' W" E; [5 X
Method of detection of the WinICE handler in the int68h (V86)& G& I* N! B; @. P5 d
) W' ^9 c/ h% u
    mov     ah,43h1 K9 ^1 q1 b% g4 O& p3 o7 U
    int     68h7 ^& {, K3 q7 Y. Q' B3 o
    cmp     ax,0F386h' E; w' @1 v) l8 w( g/ a
    jz      SoftICE_Detected& M7 z2 g0 m$ s  p+ [

. Q( T$ C3 v+ A+ n1 t+ Q( ~  X% L  B& K( }
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
; f* R  Y( ]* H& `: T' ~   app like this:
) R; J5 U) H3 E$ I3 N6 l# ?- t5 i2 h% K1 M
   BPX exec_int if ax==68# Z& j0 ^3 \. a/ p! q
   (function called is located at byte ptr [ebp+1Dh] and client eip is
' s0 |6 d8 f" c8 B2 I   located at [ebp+48h] for 32Bit apps)+ [$ n6 A  B' H6 M5 q
__________________________________________________________________________% w/ p  L+ ?8 ?! B" E

5 y& o8 h9 l8 c1 }3 R2 q
6 x9 {' u) E  f+ tMethod 08
8 f% `. O5 X" a: ~3 r9 k& q=========- c# l3 H5 ^. ]* ]
: a: T5 l( `* @* S! G" Q( y
It is not a method of detection of SoftICE but a possibility to crash the( h3 L' @+ Q! ~
system by intercepting int 01h and int 03h and redirecting them to another& P$ I$ v  T/ ^6 T, s/ b
routine.5 v# f# P# J, p; g
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
( G/ d+ u3 |. B/ Fto the new routine to execute (hangs computer...)
2 d9 v+ H( [. `, ^3 C
( X! [# f1 F& x- F" L6 o    mov     ah, 25h# {+ O+ ^. D( d3 B1 ~) u' h
    mov     al, Int_Number (01h or 03h)5 ~# p( a3 x* u( R5 x) d, ~
    mov     dx, offset New_Int_Routine
  L! d9 d0 i- H* B7 n; f    int     21h8 n7 K/ m. g  f/ q# \9 ?
; V( P9 [8 c' G
__________________________________________________________________________* o1 z4 k2 p5 r

0 ^% w' K+ y. i8 n  QMethod 097 ~8 E4 f$ }) A
=========
) h1 q2 }0 c4 R1 e4 R9 v$ V* ?- f6 A
; _% E. {: S# fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  u. n! Y  y7 n/ u
performed in ring0 (VxD or a ring3 app using the VxdCall).
8 Y" C  R3 W9 Z3 MThe Get_DDB service is used to determine whether or not a VxD is installed" g! T3 v" Q" o$ {8 s9 ^# A" u
for the specified device and returns a Device Description Block (in ecx) for# U4 U- `; L7 o2 ], r* m* g
that device if it is installed.
& `, m/ j# a$ g0 I8 E' P4 Y) z2 F$ R3 P- N" o
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID/ b/ j6 l# Q7 @) E: j9 Z9 X" i
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
* [( s* X; b- Y7 h- y* J   VMMCall Get_DDB
1 e- C8 m5 V+ H7 W" c: x% R% k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ B9 u3 \; w  T7 g; ?* J# p9 g0 V. k8 y9 u: p5 @: A
Note as well that you can easily detect this method with SoftICE:
9 H( ?; Z, T! w: f" B  }   bpx Get_DDB if ax==0202 || ax==7a5fh
! U+ V3 X+ w1 o7 J
4 D3 z: }, Q3 S7 A  q3 u__________________________________________________________________________8 H# Y6 H1 r! Y

  i2 R& c7 ?! g* v9 fMethod 10
' k6 s/ j, M: ?$ x=========
3 I  O& }, Z4 E. C$ E5 S9 e3 c2 y2 i( ?  H' f+ l: Z; Q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& a+ ~0 V" _" j# b  SoftICE while the option is enable!!8 ?9 s( {0 d6 h, t6 s

& V+ `1 \3 Z2 D- ?This trick is very efficient:: w/ S8 G4 u  m3 l4 x0 E7 a( t8 p
by checking the Debug Registers, you can detect if SoftICE is loaded4 A' U" m1 |4 L# D" v- W7 X( N0 V
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: t- V$ X1 s. @. Qthere are some memory breakpoints set (dr0 to dr3) simply by reading their0 q: t( p# A  M+ Q- p4 Y
value (in ring0 only). Values can be manipulated and or changed as well
4 m# A  i8 F# m  ~(clearing BPMs for instance)
/ H, k, |! p8 E1 u/ y; M; v( I; }; N# |/ ?4 R1 k5 B' j
__________________________________________________________________________  P5 w2 x% A4 l' Q2 L

2 M* r# e6 Y' vMethod 11& r  ~; a: b2 Z8 P3 K# E/ r  X
=========
- U$ Z8 E+ t' M4 @9 f3 ~' ~$ j
: \& G5 d2 v- ]/ tThis method is most known as 'MeltICE' because it has been freely distributed( o( @1 ]! x. C' v! I! }. y
via www.winfiles.com. However it was first used by NuMega people to allow$ X/ _( Y0 I7 z' O8 S+ b
Symbol Loader to check if SoftICE was active or not (the code is located
* |: Z8 f. E5 a/ O8 f6 minside nmtrans.dll).7 F, k& j8 D* i
  d8 @  N% z% V( d( v
The way it works is very simple:8 a/ l  q  @8 |' x, q7 @
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% m- L% n5 L1 F. pWinNT) with the CreateFileA API.$ S  R$ k% c: C3 G2 \& A4 u

( I7 \, r" ]) N  R4 hHere is a sample (checking for 'SICE'):! Y- k0 n0 c  V6 @
1 b1 v4 e6 @4 e: t
BOOL IsSoftIce95Loaded()/ S) v$ C/ G3 p, S7 S, h: }
{
4 J8 l' r) h" x; l4 j   HANDLE hFile;  
% l7 E, @6 n8 S8 U; {' u- I% c   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 I* x1 x9 A4 r) h- I# |  s+ E
                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 ]0 }- t2 r" ]; U  t7 u, x5 _7 X
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ B7 }% M5 u# j1 j   if( hFile != INVALID_HANDLE_VALUE )
4 q, o8 }" |9 y4 c+ x3 c+ H7 a% V   {) f% G. Z" K! N+ B4 f" I
      CloseHandle(hFile);" \8 U6 m6 U9 ]; z) d( A( H" m
      return TRUE;. T% G6 W% ?& s& ]
   }( m0 a" `+ ^, _+ D) A
   return FALSE;
: n% _3 `+ W& I9 Q6 m9 s# W}: I1 b! a2 Z; h- o& c4 H

* L, z  h1 W* x' b, rAlthough this trick calls the CreateFileA function, don't even expect to be8 V3 G  Z) I3 G$ Z
able to intercept it by installing a IFS hook: it will not work, no way!
0 ]; I. u  H2 a1 E; {In fact, after the call to CreateFileA it will get through VWIN32 0x001F
7 T$ U, F! t9 }8 I  R! Z8 |  U8 o. bservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" X2 G  I8 V0 k9 z' i! Oand then browse the DDB list until it find the VxD and its DDB_Control_Proc( R  T) I0 I3 G& V* |6 Q
field.
- l( I% ]* z* |) A/ AIn fact, its purpose is not to load/unload VxDs but only to send a
; G$ D/ B+ R! X4 @W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). o/ q9 ]+ ]! }
to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 E2 i7 m7 Q) |1 _$ Z9 t0 \) E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
; X5 B- B8 @+ u  ^4 V" e, y- o8 V- XIf the VxD is loaded, it will always clear eax and the Carry flag to allow0 |! M' p$ L# b4 e. B6 {- U4 `
its handle to be opened and then, will be detected.+ E: U' ^6 |3 c* c* L6 w5 ]- J
You can check that simply by hooking Winice.exe control proc entry point
: y; u' ~: o- f6 wwhile running MeltICE.
7 W; d. N. l5 O, q" w9 n& F/ h" J, L& z; k. B, _/ ~* I5 A+ ?2 h% V
( [5 M3 g# o5 W2 D6 }
  00401067:  push      00402025    ; \\.\SICE& l6 W- k/ G6 U3 \
  0040106C:  call      CreateFileA* [. X8 f  |8 }% K
  00401071:  cmp       eax,-001
& w5 j2 S% [2 G# f; J  00401074:  je        00401091
  s+ z/ v/ O% X+ F" p3 f, P( I5 Y3 }! D3 {

. v& C6 ^& U6 a* S& m6 k9 h) u# cThere could be hundreds of BPX you could use to detect this trick.9 A) l9 U4 }7 [) K, t" G+ R# w; x
-The most classical one is:
2 E% V& P5 K3 _% `' r) ]  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||( k7 @5 e  f, q# q
    *(esp-&gt;4+4)=='NTIC'
. T2 V+ {$ t% a0 C- p6 h' ~- K( c# S) L* Z0 j: U
-The most exotic ones (could be very slooooow :-(
" c' K7 o9 b; m# k4 e$ E9 W   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ J: V$ b+ K$ t# L0 ~* t     ;will break 3 times :-(
4 K/ ^8 p2 R- c) B5 X$ [! |6 n& w7 y8 j  b2 v
-or (a bit) faster: 2 ?+ T$ i7 a# i/ @( O
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 T8 _: Y4 E7 U% G0 L: S9 |
+ s$ W. }1 }# t6 A
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + T7 X! C1 l/ ?
     ;will break 3 times :-(5 \- q( d& y1 g1 P& s  ~1 T" r1 H
! q( b* Z! R) \* \$ G
-Much faster:. \- Z8 j1 A9 M/ k$ N) P2 r% \: @& B
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 ?0 M( B: ?; r& y5 ?0 Q

. W- S- j/ c3 w6 X) \# \Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
' T7 c" |; ]7 u. q' N' Q7 \function to do the same job:  ?: }- u( j7 a0 |

$ Q/ X' Z. q- B% X   push    00                        ; OF_READ% q* B5 N) E. |$ X$ z" E
   mov     eax,[00656634]            ; '\\.\SICE',0
' |# U& H2 [. k( e   push    eax
9 @  [$ U# \( Z, C- N+ f7 j& x   call    KERNEL32!_lopen
) f7 m  {" o% V. F" t( o1 D1 Y   inc     eax
6 a3 K+ j% U# U- F3 q- q% N   jnz     00650589                  ; detected
* Q$ f, f1 A% X4 w& m5 x5 p, w   push    00                        ; OF_READ9 H) Y1 a( O" a' x% w7 ~, _+ h' z- I) q) M
   mov     eax,[00656638]            ; '\\.\SICE'
; I  f3 Z5 Y  c: j: R+ m- E* g   push    eax& H; H# b( }' V3 @
   call    KERNEL32!_lopen( g5 F6 _; v7 E; a7 u- ?
   inc     eax
$ A% K7 C0 t$ e8 o" B$ F' \% y+ @   jz      006505ae                  ; not detected2 N/ Y5 X4 }6 @8 O

0 O2 z! k( R: z: @
! P1 c/ a. [3 f4 h__________________________________________________________________________
7 Q* a! k% b! {; [- E
. s+ q5 X6 |  v7 T8 D5 CMethod 12
5 Y1 @' x0 i$ C3 o=========. K* y" ]$ W& w

: H% W0 p. a) C0 p# s2 LThis trick is similar to int41h/4fh Debugger installation check (code 05
+ P% Y) T! L3 ~0 @&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% d9 l- o5 ^: ]as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( M7 c( C' Z* @
5 n  ^2 T! {2 Q2 f7 a, }- S6 S% x. A   push  0000004fh         ; function 4fh
0 V) t8 w& n9 p5 S   push  002a002ah         ; high word specifies which VxD (VWIN32)# ~5 S5 Z, ~& J) V- Q+ i! E. n2 U
                           ; low word specifies which service
* n+ ^2 Y  D% H/ Q1 F. w' ?                             (VWIN32_Int41Dispatch). h/ e0 @* K$ [8 Z1 n
   call  Kernel32!ORD_001  ; VxdCall- R) J  v3 x4 e8 K% E/ n
   cmp   ax, 0f386h        ; magic number returned by system debuggers3 ]! E& L- S' s: G0 y% x
   jz    SoftICE_detected
+ t; l0 p. u" l  O
( h$ e2 |1 A' S" JHere again, several ways to detect it:
0 ?: S* r! |+ c" u0 Y2 p" \6 ]+ {0 L( @
! a; A: _* X; I5 p+ }5 U    BPINT 41 if ax==4f+ r9 a( l6 l- L$ v
' B- d. L( A( A9 E0 ^
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 z, {( D  `. N( _
% p: L4 o% }( O; S* t- m  T& Y" O    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ P5 x4 F2 y+ s' e+ W
6 Y  s" f+ {4 v$ J9 r: s8 P    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% V* Y) [& _: |$ V" ]4 f
  a6 k+ ]% |) [- |
__________________________________________________________________________
( B4 G% }  m* M: Z2 j/ q' a2 Q
: t: q: T* v  J; FMethod 13! a4 u9 J" i. O: R. v  S
=========. k; Z  U4 w, y3 S* X" a

4 z7 U5 n! j3 F7 k' r$ ?Not a real method of detection, but a good way to know if SoftICE is
! y& |: m6 F1 c4 m4 n+ }( [. yinstalled on a computer and to locate its installation directory.
! Q$ e0 _$ N4 b/ J) Q+ C( mIt is used by few softs which access the following registry keys (usually #2) :- r: ~' l2 B0 E3 {% E

/ j5 B4 }* v; u2 u( b* Q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- O; n1 _% F3 D4 v1 W\Uninstall\SoftICE
/ H* k( N: R2 e. }-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
8 v2 B7 B$ ^/ K* I3 f# _-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" v3 A0 g' E' ]8 k0 @- u3 o5 H
\App Paths\Loader32.Exe+ [# S1 G: R$ \& f4 w% G
  o. o( M% z1 M' R) v

) i1 j$ L! Q5 G) O1 qNote that some nasty apps could then erase all files from SoftICE directory5 z1 y4 u- M, T" W5 S1 f
(I faced that once :-(
+ Q$ d0 z# C4 O( R; A5 m# H# i1 {+ V$ K; O- d4 w2 w
Useful breakpoint to detect it:
0 `3 O* g9 A8 P- e8 c  i
0 Q! A2 g# F( V7 N; A, ]     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* O. L' T3 L& Y4 }, G
  `% M8 A- n2 N. i. x
__________________________________________________________________________7 b1 O% N. X! C, ^5 a. W8 Z+ B- l& {! t

# C: O$ t9 e, w8 n2 E. L/ p/ I2 H
Method 14 8 u1 r' w2 F2 v. {) o
=========# b/ d: S: \6 Y9 J8 U5 h& f
% w" g  V: x! u! R2 o/ [9 C4 q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose  P9 r) v7 y1 y( b
is to determines whether a debugger is running on your system (ring0 only).
* P) h+ X5 U7 A  i$ y# y. j' B, e, K
   VMMCall Test_Debug_Installed( a! |; g+ m& _! Y7 o
   je      not_installed* j; R5 l4 g  m7 k, ]

% L# z4 w# J& \This service just checks a flag.8 a: o$ m" n& c! A: t4 ~3 m$ M
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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