About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 \" A! L! a+ ^" e9 G7 n<TBODY>
  Z' N+ a* E) u8 d# o5 H<TR>
; e$ u8 N6 m' [! P) c0 V' ?9 n<TD><PRE>Method 01 0 \. L" w' M; c2 C
=========
( ~% S+ _$ L% y8 G. j8 w0 a; {8 S( g0 t
This method of detection of SoftICE (as well as the following one) is: p2 a* P; ?) H) S' }: @  X
used by the majority of packers/encryptors found on Internet.# T7 H5 }  h5 `# Q- [- r
It seeks the signature of BoundsChecker in SoftICE: p% d1 J# H5 {
- ^- k' T8 A, T6 O
    mov     ebp, 04243484Bh        ; 'BCHK'
1 M  r1 d: r9 _3 F# W3 v    mov     ax, 04h+ C* ~3 J: l  R% q6 F3 C
    int     3      
* _6 L7 K% G" t, q  Y/ ?    cmp     al,4
5 m0 C+ a5 p& `, V7 C    jnz     SoftICE_Detected6 P1 i' ^& w, g7 I1 _

2 Q$ {% u" C8 ~4 s___________________________________________________________________________
" C8 T9 l8 H4 s3 G- P
2 n& u+ C# A* V% T! @. y8 b3 KMethod 02
3 k! G+ c/ d1 a, J( W, m=========
1 O5 h8 \4 e; z; A8 _
: j' d  _" b; I. D0 jStill a method very much used (perhaps the most frequent one).  It is used5 t. ?# C: m0 m* ~
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 R& [4 F" t" Y" w
or execute SoftICE commands...
0 _  W+ U9 }$ Z2 hIt is also used to crash SoftICE and to force it to execute any commands
* F9 m: m6 j# m7 S% D" K(HBOOT...) :-((  ) b# E9 K% w* \9 V3 [

% Y9 P; U4 v- c( Y1 `  BHere is a quick description:
  D& d) f* T7 C! E% Z-AX = 0910h   (Display string in SIce windows)% x4 Q9 k- ~  i- S$ o& S/ V. z
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 @$ C- i! g6 R& {( V
-AX = 0912h   (Get breakpoint infos)
* J" g2 Y# M5 E# L1 O( C+ C-AX = 0913h   (Set Sice breakpoints)' t+ x. R! r: K; ~1 R; a1 Z1 z, \4 t
-AX = 0914h   (Remove SIce breakoints)
7 a4 w- d6 j+ J% h+ k1 v  Y; R; }; E+ x9 [4 K9 O! A
Each time you'll meet this trick, you'll see:2 t2 s/ O5 J. L+ G
-SI = 4647h
" M1 G2 Y$ J" A  D-DI = 4A4Dh
: j, `( ?- E9 @0 n2 EWhich are the 'magic values' used by SoftIce.9 ^. o- c/ _8 Y! @
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- V2 ?3 R# s$ f; x, m2 U6 m" n% i6 g8 d
Here is one example from the file "Haspinst.exe" which is the dongle HASP
) a. j1 z. x8 {- e. p# zEnvelope utility use to protect DOS applications:
( s& L1 z1 }2 H# L0 C
! {* L, D, \5 _7 W3 Z9 |0 k  Y# y9 P2 ~3 W0 _8 X8 l
4C19:0095   MOV    AX,0911  ; execute command.
& q  H3 h0 N! v  {0 N, o# m4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
6 |. a$ ?5 x' @1 }% M3 P4C19:009A   MOV    SI,4647  ; 1st magic value.- n) I) p' a- A/ F( ~! ^
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- V* u1 D  r( m( l; E/ V& X! V4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 o7 u* p4 M6 \- l& K
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" E, W' v8 j5 A  z4C19:00A4   INC    CX
1 G  b/ @$ a- y1 }) r" U3 }: t4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 p1 z- Z3 X7 y6 M1 {4C19:00A8   JB     0095     ; 6 different commands.
! Y6 z% A. g: ?2 ^: Z7 O* K4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: l0 C  b  y1 a
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 t* i7 r2 c( [5 S4 _( l
  \% {8 }* ]' l7 X" q" f- [9 lThe program will execute 6 different SIce commands located at ds:dx, which
# m& ?  V* U' M7 Q, ~are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. B/ o( U4 q* K. r' @

  o0 ^/ \* k8 j- O' f8 d" h* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.7 U% W" _/ T9 [5 f
___________________________________________________________________________. p* F2 L/ X4 Y0 C- K, H( ^& M
# }" S" i: S* x( `) ?

; p8 ?' k; s$ i& @# R/ y5 GMethod 03* v% o; h2 h+ r3 k& y
=========
: ?$ K/ P8 k9 _
5 ]$ G) D' Z# V6 g, }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 k0 K  K5 y& v6 _, I2 g* p$ G; u" b2 ?
(API Get entry point)# q  o, u. z$ X, r1 g7 q9 X
        , {3 z* B! I) \  Y7 r- l* D

2 f+ ?& l. Q. P    xor     di,di
0 }, V2 {% b2 k    mov     es,di
, f, b0 M/ q/ N2 N, P$ [" y6 {    mov     ax, 1684h      
& i9 |' ^' |* @& I3 C    mov     bx, 0202h       ; VxD ID of winice
1 |0 \* \. h* B3 K0 q    int     2Fh
2 h& n3 I  Y$ ~$ a    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ b' |4 z0 J) X9 Y    add     ax, di
8 P. j+ m( {. W6 f    test    ax,ax$ u0 m! A9 S: a
    jnz     SoftICE_Detected  Q, z5 q7 [3 e7 [

3 F2 I5 T8 F" K8 F- X___________________________________________________________________________. ~: i- h3 T5 ]
/ x- K0 l- D5 |$ E' W) y8 J
Method 04
* C7 T; g) ^, l& S+ Y5 B% B$ L: x=========, \6 V- E8 e( \3 {
( ?; t% h+ `& `: w- V
Method identical to the preceding one except that it seeks the ID of SoftICE; w& k' U, p7 g/ k/ G$ U9 A0 {
GFX VxD.
# B2 r: _+ K  A4 e/ t: g$ L& L+ }' m0 i' s0 J1 Z) Q7 u" V$ D
    xor     di,di0 a6 I# a& a, s9 w# |
    mov     es,di
6 s0 ]$ F. T- r# n) a    mov     ax, 1684h      
6 q" e/ `! i+ j2 J& j$ N! S    mov     bx, 7a5Fh       ; VxD ID of SIWVID; f: h$ y; p$ ^/ \' H
    int     2fh
8 t5 A* E; W2 w# n; }    mov     ax, es          ; ES:DI -&gt; VxD API entry point& [0 X" Z; c" [" [% v) o
    add     ax, di
, p" ]- H9 x/ j$ k6 _- @: c    test    ax,ax
4 I; b- Q. ~4 M1 c    jnz     SoftICE_Detected
4 P6 ?# n6 l( n8 U# u" _! H* t
- I8 c2 w5 N! n* j. ]! k0 Z) J4 `__________________________________________________________________________
: `9 c8 V2 r; I6 ?5 y3 `+ P/ r+ V# D) ?9 P7 ?( a" _
3 ~) e5 P/ y& h$ X0 |
Method 05
' R4 j/ k# C  T7 i5 K=========9 F2 v; Z; p& J  Z  Y

1 h0 P" N& P- u  l5 XMethod seeking the 'magic number' 0F386h returned (in ax) by all system
9 q8 Q6 l: |, F+ D2 Qdebugger. It calls the int 41h, function 4Fh.1 Y: A! K6 L, e1 P$ X' K1 L' d
There are several alternatives.  , T3 z- ?& k, i2 ?# `, V
1 m/ X: W2 L+ }5 i
The following one is the simplest:, Q  ]8 D, Q+ ~
+ w9 J  m8 L& \. O( ~- E
    mov     ax,4fh
. C1 l  J2 b$ c; ^0 f    int     41h7 C  }) I! H. r' M/ c
    cmp     ax, 0F386
' H9 a4 I9 q2 L8 {    jz      SoftICE_detected. [' C/ n$ j! |3 f6 |  B- |
5 ~2 z4 {$ f  E+ O

4 J9 I9 K; i% o' M6 K; e7 ?' Z$ cNext method as well as the following one are 2 examples from Stone's
. {% A( o4 z% c& l% o5 `- {6 s: s"stn-wid.zip" (www.cracking.net):" [: k6 z- a5 @$ R
: g; d: c" x) o% Z# _
    mov     bx, cs# w$ \) @$ y, S
    lea     dx, int41handler2
9 `9 e3 J  X' x    xchg    dx, es:[41h*4]" V0 `( ^* ?7 K9 J+ [3 b/ B
    xchg    bx, es:[41h*4+2]0 B( W9 U7 \: V6 Z8 _
    mov     ax,4fh
3 d0 J7 o5 \3 T  ^/ n" l& o    int     41h
% s) s- e. H4 Y; N1 x; W; Q% I    xchg    dx, es:[41h*4]* d  U$ B( o& w( R/ V
    xchg    bx, es:[41h*4+2]
  i4 q( E1 [& @7 j, R0 ^    cmp     ax, 0f386h
9 r* B7 r9 v; B/ J! I    jz      SoftICE_detected
# ?5 j! ^* r; l) ]$ \
: e9 q# Z% t! G" C% gint41handler2 PROC0 s+ }& Y$ q( o* f& T" ]( O; e9 ~5 X
    iret
0 `( G& o. ?0 q* n$ ?; U0 Lint41handler2 ENDP
& u+ x! z" ^7 T
8 {& w$ `; g; t+ \" g0 \
& Q# T0 Y, L9 H5 G: b8 B_________________________________________________________________________8 T* I' Y: r- L* o5 l2 L* n4 e, E
- D2 |/ |  p0 _* L) q

+ R3 B6 d/ p8 _+ b+ hMethod 06
* p, J  x, t$ N9 Y: z7 ]3 \0 ?=========
7 d; v- G, z* @- I" s
. {6 ?  S" i0 z- s
" B  H. t5 j6 d$ o) u, [* e; n2nd method similar to the preceding one but more difficult to detect:+ J! u5 O! _1 ?1 s3 N* K
% p& o5 D# _- j  }$ D. d9 t. Z  S' S
+ z0 ?: K+ W" ]8 T/ X
int41handler PROC
, U4 v2 H% Q/ G) c    mov     cl,al- V( t: ?0 P! w+ J# g6 y
    iret
0 w# }8 K0 i" e% `4 qint41handler ENDP
% I3 [0 J! {* a+ f$ ]& C- V4 K3 z

% J9 V+ V8 w( p2 V' h    xor     ax,ax
4 f/ d4 i; V6 B* k* E4 w    mov     es,ax
( M6 I' T; m5 n( ^; B! n- O    mov     bx, cs5 Q# T* l/ A% z+ j: X+ m1 ]
    lea     dx, int41handler8 }, D, r5 G& o! K; ?& m; c3 \
    xchg    dx, es:[41h*4]
2 d& o3 x/ n. ^9 e    xchg    bx, es:[41h*4+2]" \, p- h1 W+ @  S" x- A
    in      al, 40h
, l9 D$ t. V( ^7 ~" Z    xor     cx,cx6 b4 Z: n* [/ ~3 {* M1 `- c
    int     41h& K8 ^4 ?) J$ i; u' _* Y
    xchg    dx, es:[41h*4]( Y9 E9 W: E. b+ v9 c, Q9 W( F
    xchg    bx, es:[41h*4+2]( m7 F! B' f* S& j  c! C
    cmp     cl,al
+ _: Z1 [& A1 l( k7 S6 F) I5 J* e    jnz     SoftICE_detected
3 d+ I( Z& }8 _2 W  t
& P3 Z1 g9 o$ O3 ^_________________________________________________________________________
0 w5 c( G9 x0 C3 }1 g5 ]! Y; E+ Y) ^* }
Method 07
7 v1 F) I1 I6 w=========
# O4 K5 I, v" Q# }/ |, `* \, U. X9 t& k9 ]
Method of detection of the WinICE handler in the int68h (V86)
5 R) A- ~  P: s! {7 Q1 T$ p4 k2 l2 b" e4 P6 S
    mov     ah,43h
; U( [9 @! r; z4 M    int     68h
) q$ R% z3 X  |    cmp     ax,0F386h
+ ]" t, E5 y& Z$ d    jz      SoftICE_Detected
) s' ]9 r! @( Z) R
( Y, G  K( J3 p5 }
4 e4 k' Z. e" i. c=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 a. L+ K: b# ^7 s8 b0 M2 |   app like this:1 e4 F  K7 {, J4 R
7 R" T. X+ ], R% f8 d, Q$ D$ ~- \
   BPX exec_int if ax==68! D6 c# \) Z9 B& j) p& v% t( P
   (function called is located at byte ptr [ebp+1Dh] and client eip is
* T% i4 C. O! U6 v5 k' Q) {/ ?4 _   located at [ebp+48h] for 32Bit apps)1 F$ k6 l* z* e* ?* k" {: F
__________________________________________________________________________
7 ~. Y* T( @: j" n* r: f9 `2 j' i- Q  v- p
' s& I" \! O: ~: J7 J' u
Method 08
7 u. _+ a9 i/ a=========" b* `( g: V" \; i+ R$ Z# v

' @5 D/ R% e$ i+ _It is not a method of detection of SoftICE but a possibility to crash the! ~4 P* N8 ^- W; }
system by intercepting int 01h and int 03h and redirecting them to another' V8 e9 m2 ]5 i$ j( q! H$ @; j
routine.9 W8 Z9 c/ R) {) a* ]* f
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ M7 z) O9 c' _6 M1 {to the new routine to execute (hangs computer...)- U$ i8 `* [4 j* ~) w
3 s8 ?3 ?4 m. v
    mov     ah, 25h8 {! A) {4 p/ q! m7 i" a
    mov     al, Int_Number (01h or 03h). E1 r$ T4 H9 ^" y& _6 [7 a* _8 Q
    mov     dx, offset New_Int_Routine
, t& K( k, C4 E: R7 v2 b; y    int     21h
5 x3 `4 D! V1 k
7 m. d1 X" \  `+ s9 I* |5 `__________________________________________________________________________
9 F) t0 o/ M) y; c8 D+ \! @0 @$ R% C3 k* @7 Y
Method 09
  G" w' }( K, n- F& L=========
8 T& D2 q. ^9 @: G! Z' E* {' E& l- n9 }4 m
+ I+ \2 t2 e7 F# q9 i( P- J: BThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 S# |6 r8 U% y- Wperformed in ring0 (VxD or a ring3 app using the VxdCall).
+ j- y- ~% Q+ \- K: oThe Get_DDB service is used to determine whether or not a VxD is installed
8 d/ R( K0 b+ N- i* I8 O; C$ m2 ffor the specified device and returns a Device Description Block (in ecx) for
/ Y5 i/ a4 D6 x" p4 w1 Z7 d9 Nthat device if it is installed.
% e% C" g* T- J$ c9 n
% X& y  Y' W: ~. n) Q   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID. e, }' r2 W6 l+ d0 B, `
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# H5 v2 F* J+ E/ ]% b, x   VMMCall Get_DDB* ?% X; L) `; d" F4 N
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  {9 ]- j) f! X# \0 Q
. }) q! N5 R7 f% P- WNote as well that you can easily detect this method with SoftICE:$ O$ W2 S6 L1 I) J- v
   bpx Get_DDB if ax==0202 || ax==7a5fh$ T, W, ?& g- t+ p5 @& K- u
% N' j, Z) a0 s- v
__________________________________________________________________________# z1 d3 L3 [& f" g' a

' s, A$ v8 D$ g! W# r5 R9 pMethod 10' S+ i1 ~1 [8 V2 v  y9 H
=========
1 a% d( a" N+ K& e) y; o" t$ p5 ~  ~$ U4 P7 @7 z6 O# `+ K) T" O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 n- ~) g* ]% e8 P/ n" T3 l
  SoftICE while the option is enable!!
! X" X/ [( m; N- D, t  g2 V$ s; a) _
This trick is very efficient:
& s. d8 p' ^4 K+ Zby checking the Debug Registers, you can detect if SoftICE is loaded3 M$ a. G( C' O& Z/ E
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if" S: \! z" |: [( `: @
there are some memory breakpoints set (dr0 to dr3) simply by reading their, c6 g% {- d, Z9 j) A
value (in ring0 only). Values can be manipulated and or changed as well
6 Z; W* b* ?8 z6 j, `4 G(clearing BPMs for instance)+ A& G& k) p- _- h0 q1 [
) g& J2 [% L) D
__________________________________________________________________________
2 e# L+ n; E2 p: s# s' r
1 V( W0 t& @8 F  z& x. k3 }) VMethod 11% T) Q8 }3 M' Z4 R) Y" B2 k
=========
8 v! i. l5 V4 P! t+ c) f+ |9 e5 K' h- \, ?
This method is most known as 'MeltICE' because it has been freely distributed
) T0 C& l; o  p, wvia www.winfiles.com. However it was first used by NuMega people to allow" t7 i+ ?" U8 b1 j% ^3 m% B
Symbol Loader to check if SoftICE was active or not (the code is located
! n! d2 a: x/ a1 [inside nmtrans.dll).+ c0 R9 [) P6 X* E* U- w
) V, t+ j* l* l0 `, `8 j
The way it works is very simple:( ?9 S  _  Y# N" @8 \( F/ _
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- S- l  V0 I0 B* V
WinNT) with the CreateFileA API.
  C8 y( e  T3 a( E" [9 ]7 R( a5 \& v) G( q- h8 V
Here is a sample (checking for 'SICE'):
8 ^  f; g% D. v1 V3 ]3 [- _
7 `3 f7 U8 h* m5 j  y/ qBOOL IsSoftIce95Loaded()
+ U3 @* l' m, h  p{
. m3 p  k9 m- a, q" E6 N   HANDLE hFile;  6 E. F  K! \$ @2 n3 M
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% `9 H$ \% M/ O8 ~& W& l# `0 W1 q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 x) E+ w2 o$ _2 A# E8 z3 |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! P- I4 z: i! U" y+ ^6 d   if( hFile != INVALID_HANDLE_VALUE )" a, S# s/ L# E7 i5 i0 x
   {
0 ~: v3 o1 ~  G) l" |3 H      CloseHandle(hFile);- t1 P6 e7 x+ E5 c# H0 ~: P( ]1 M# g
      return TRUE;
# R/ y. K+ f) e6 x   }+ k5 p2 u& O. V1 g
   return FALSE;" @# J+ v  ~- O
}
  ~6 a% ]/ X5 Q/ r$ a
6 Q% T6 j$ q$ C. c8 z! K( ]Although this trick calls the CreateFileA function, don't even expect to be$ r0 ]5 o7 ]8 g. [# e$ `6 Z  u
able to intercept it by installing a IFS hook: it will not work, no way!
2 \) g8 L, E% UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 o9 [, K. N8 k& s, a' Jservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 l1 f% `" }* q, y
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
8 ?# |1 v+ M4 ^+ I$ L2 gfield.3 J+ S5 N- }4 @6 r2 d! w
In fact, its purpose is not to load/unload VxDs but only to send a ; h, P+ U: {( T
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 n  ?; H4 c1 `5 y
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
& ?) u1 o# S: n7 pto load/unload a non-dynamically loadable driver such as SoftICE ;-).( ]. p+ O, T. t6 m) u- D9 U
If the VxD is loaded, it will always clear eax and the Carry flag to allow# x( i$ v2 u  k
its handle to be opened and then, will be detected.
$ G& @! p, d2 n0 }0 l. \You can check that simply by hooking Winice.exe control proc entry point
2 ]' d; S9 J" A  B3 I7 pwhile running MeltICE.- ~- _2 |! R* i0 q

' C) _# \$ V, O" _
1 `) ]5 m" ~4 q6 v9 W  00401067:  push      00402025    ; \\.\SICE
1 R) c+ }/ ~7 d# }7 x8 G  0040106C:  call      CreateFileA8 C$ m4 ~! @/ G% D, b! b: `
  00401071:  cmp       eax,-001, X* n9 R; k( B
  00401074:  je        004010913 l* F- h; l+ B2 Z# c( r
) j  e) w  W- y8 |. C, ^- \! P

# }" Y! \, C, OThere could be hundreds of BPX you could use to detect this trick.5 c# d9 a& N' `6 N8 C" v$ }
-The most classical one is:. A1 v* V1 u1 A. b2 K
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||6 U: v) V' k/ ^  U4 V7 Y, I* i% M
    *(esp-&gt;4+4)=='NTIC'
2 d* d( K+ o3 s& M+ p5 m6 ?8 N
1 ]. n0 V* y, ^" x9 s-The most exotic ones (could be very slooooow :-(+ J1 T" d' K8 J0 d
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , ?! w# G3 A$ T7 A+ q5 ?/ O8 C+ K: E
     ;will break 3 times :-(' m9 C+ _- J& d0 N( d1 S
* }9 P( D9 I, a  N) ]
-or (a bit) faster: 3 J3 S! f. X& X4 F4 Z3 Y  L
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ V) Q9 ~3 G: k/ V; ]
4 c7 e2 I( \7 E' m4 U$ C% R. |   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  % `& [1 @( L6 u+ a4 T- v0 l' G
     ;will break 3 times :-(
( M3 L  ~% y) t5 h# C# v; v) c8 ]9 I( M
-Much faster:
# U) _% [7 S& O5 @1 h' ]4 C   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV': y1 F% |+ I9 L, ?' t' U. A8 K

9 Y5 t9 I, T8 F3 Z- V2 MNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
) C9 U% ~7 v" S5 I9 Z7 ffunction to do the same job:$ U1 m: p2 y2 @5 M% ?, e$ a" @1 E
/ o' y3 m* j2 @/ g( C# T! p
   push    00                        ; OF_READ' |* N# z# \1 \% _7 R" e
   mov     eax,[00656634]            ; '\\.\SICE',0
3 K% ?( M# a, C  z   push    eax' i: G! x5 V, {) o
   call    KERNEL32!_lopen
2 C2 c1 L) i2 h; {/ ^# j( [   inc     eax: X! ]/ y: [3 l# |! ^  e
   jnz     00650589                  ; detected
; @7 w: r$ Z& \6 z, \   push    00                        ; OF_READ, D- p8 x( |# Z
   mov     eax,[00656638]            ; '\\.\SICE'+ l; S7 ?  c4 c( y- B
   push    eax# v0 D+ T/ O& f$ G
   call    KERNEL32!_lopen: u4 m) P* ]$ A7 o7 P* `
   inc     eax2 B3 g% S% W! x; W6 t! R. W7 Z
   jz      006505ae                  ; not detected
- z& u8 h6 {- R7 M* t; P7 _4 A
/ a0 m# ~. B; C3 C
4 j* l5 f3 t4 v5 L9 g, X. O3 ]8 j__________________________________________________________________________+ x" x) Q' P) h

# v, I& ^  S5 d. r7 LMethod 12
: w1 \+ V: i# W/ W) M4 a0 R=========
6 `" F8 ?$ A. Q* t/ _4 j4 B- y) ~3 P0 ~" Q# L+ N) n
This trick is similar to int41h/4fh Debugger installation check (code 05
. B  ?8 n1 D3 e: ?( p2 \&amp; 06) but very limited because it's only available for Win95/98 (not NT)2 M; F8 z6 ]0 U2 F
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ p; V9 I6 w" |2 U5 l% K; @/ l( l* F
   push  0000004fh         ; function 4fh8 r! Z, ^' P6 \6 Y7 \/ y8 ^' o5 _) M, _
   push  002a002ah         ; high word specifies which VxD (VWIN32)0 ^5 c6 [' ]& V2 b9 M) F( s, W
                           ; low word specifies which service5 S- e- {, `: D2 ~- U
                             (VWIN32_Int41Dispatch)2 P% I  U- r" w% x% L5 _0 n+ @
   call  Kernel32!ORD_001  ; VxdCall  L7 }& g# n2 Q; ]
   cmp   ax, 0f386h        ; magic number returned by system debuggers3 ?8 H2 X! ?9 x. L- W* K
   jz    SoftICE_detected" v: u" D, c  k1 q$ |1 F' K
+ D8 C' v5 `6 M- e( h
Here again, several ways to detect it:
; V6 G% h: s0 p3 ?8 n
0 F7 E/ ]1 V6 o1 x9 e    BPINT 41 if ax==4f1 M7 q$ d! K  Y& g

+ I/ Y/ @) Q; m. m' F8 |+ V& R1 p    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one% w" Y4 d0 i( p; ^; s
7 w" D5 j5 l9 m7 j2 U: b
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- B+ v/ o  p. i- M1 c! ~* k, s
1 C! ^. Y  I% B" ^    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. R- |/ `; Z: b8 ?8 p/ F! ]
$ p* x& @# {% L' i  N  u__________________________________________________________________________
6 r0 t# R( G( i. {' y" Q( G3 L7 Q
; S7 U+ F' A. dMethod 13- H- M: _" q, O/ S7 @
=========
( x7 Z/ z# f; Z  E6 l2 P; {5 y: u/ l3 W/ W4 \0 S/ G
Not a real method of detection, but a good way to know if SoftICE is3 L9 m4 b6 c! O9 T, ]# k) G) m
installed on a computer and to locate its installation directory.
( k4 B5 ~3 O/ ]8 ^& HIt is used by few softs which access the following registry keys (usually #2) :
! W* u1 Y4 |2 {" s# V  i  l# [
: M6 X/ W8 i9 ^! G, _4 p-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) s. k1 `9 u0 D% i' R: O& ~
\Uninstall\SoftICE8 c1 f  d! Y) z: W$ L/ [4 p- e
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
" V8 _" g8 q% {1 e-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* w# ?, V6 w5 U! F7 n. d
\App Paths\Loader32.Exe
( U' c( n# a% {) D( W9 Z, C6 P+ Z2 f1 M! K

- B  ^* l; y4 q% Y: G2 a1 PNote that some nasty apps could then erase all files from SoftICE directory1 G: y9 V/ @. m0 e, C* `0 T& d$ r) k
(I faced that once :-(
' ^" u3 q. F8 }2 S% C
) J6 d- U- s3 p0 I. P# u$ GUseful breakpoint to detect it:
- K; Z4 \7 K& _; _: z! M  U: E7 a) [! M2 Z# P$ U2 }: V
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
5 v  Q7 ?8 n2 S' n! {
) z& \; W' `/ r* E4 c8 Y3 o' i; y__________________________________________________________________________+ b8 q2 S+ E2 L) s8 `  D

- ~2 l( Y2 _: o! V! p8 w( G
5 o- M% H6 M! Z+ E  kMethod 14
, B5 r% v' e! z=========
3 p) t; ^: S) S6 p( B' t3 @: B4 G) i: _3 ], j( o; x
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose1 z: p% `5 v) Q0 m
is to determines whether a debugger is running on your system (ring0 only).' L7 |" {  Q5 p9 D! u8 U

' G" M' d% }; B4 @; t- ]   VMMCall Test_Debug_Installed
6 T) ?# X# ~3 S& b: |7 X* e7 h   je      not_installed
) R" p2 ^0 W! C) g7 i; K2 R$ J  n5 f0 @2 ^5 a
This service just checks a flag.0 X; j  E) o$ K$ u, r" I
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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