About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 K% g) r) D, Q; L1 d& [
<TBODY>
7 H- P, k& K2 j, Y8 s* h8 o9 \<TR>( w. H9 c8 j9 |
<TD><PRE>Method 01 ' E# g: q; o0 Q: \. t
=========/ I) O7 E: S! m) n+ c
/ i$ F6 i9 j5 V) x& h" ^
This method of detection of SoftICE (as well as the following one) is
# x! A+ l# P! ^' g$ t% g/ F; Jused by the majority of packers/encryptors found on Internet.
" @  W) g* ^1 d9 R; Z6 ~It seeks the signature of BoundsChecker in SoftICE. {; @2 {6 [5 Q3 }( Y: A8 B7 p, K
- e8 U+ M! n) O, b
    mov     ebp, 04243484Bh        ; 'BCHK'
5 g. T# o% I/ _% ?    mov     ax, 04h
: D) `3 V0 T' E- g7 L% ?3 T    int     3       6 g' p/ ~5 G  v% ?) X; N
    cmp     al,40 N5 \; d* S, i- V  s- Y# j3 N
    jnz     SoftICE_Detected
1 P% u; Z% K% J
0 o, e, s/ v! a& c* z3 Z$ \___________________________________________________________________________
: K' Y# h7 B' [
- R# E# M7 h3 h" D3 X9 cMethod 02
$ @6 w+ N) x. N  r=========
/ w9 S) S- V8 |; ^* S! F5 G! Q- ~! L" J; b0 D* n% v
Still a method very much used (perhaps the most frequent one).  It is used) n! J  p+ ~% d: s) t
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ o4 \# ^) @( U" S* q' bor execute SoftICE commands...
* X# X  D8 h- cIt is also used to crash SoftICE and to force it to execute any commands
* \/ e! \0 S' m$ a2 x1 j" C(HBOOT...) :-((  / g! a* L3 o$ s" C

0 s+ V4 C/ X4 O& n, _& b$ ^Here is a quick description:% i. O1 l- A* A% f
-AX = 0910h   (Display string in SIce windows)( I, Z9 l8 D! |" J2 z( J
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 V, K, w! {: J-AX = 0912h   (Get breakpoint infos)
3 O* Q5 w  }" h  E-AX = 0913h   (Set Sice breakpoints)8 T6 @- H; ?! `- H. w
-AX = 0914h   (Remove SIce breakoints)
1 d8 T. G: Z$ {" @9 g# Q5 Q2 [' O% i, ]! V& N& y5 u! a
Each time you'll meet this trick, you'll see:. ]; i7 W% j0 c! k5 M& J$ w/ G  y
-SI = 4647h& V, x  C2 B6 P' A" H
-DI = 4A4Dh$ q2 J2 q' [1 }* k* W% a* d
Which are the 'magic values' used by SoftIce.  ]3 H$ K- O0 I* \& t# J
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 S; E  K  B- w7 |$ h# z( \& l- a! R2 M  e' P
Here is one example from the file "Haspinst.exe" which is the dongle HASP
9 g6 V8 {" o' }& Z6 a- f) Y: iEnvelope utility use to protect DOS applications:
( j4 Y' G# ?, k5 J
+ b9 L8 ~( Y6 B- c; u+ K
% Q; q2 }2 d+ p8 B4C19:0095   MOV    AX,0911  ; execute command.) m$ ~1 T6 A1 B; A" i; d/ P
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- Z8 e" s# S" E* q4 G) ~2 w, `4C19:009A   MOV    SI,4647  ; 1st magic value.6 j0 l  e* g; ^( Z
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 C' a3 |/ w8 J3 \  b
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& x5 z. A& k, ^7 w8 j. ?4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  B% l; ?  ^+ E8 S9 n5 ~# I4C19:00A4   INC    CX
, f6 v6 L+ |6 E; I3 x4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute8 f6 H1 Y! o' H
4C19:00A8   JB     0095     ; 6 different commands.; W/ r7 F7 K( g8 |8 A6 @% y% D2 v
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
+ a4 H2 F4 v  S4 w. A' m: M4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  g/ O5 y4 Z* L' }

2 v. l% ~, |# `0 D2 RThe program will execute 6 different SIce commands located at ds:dx, which8 Q7 j  ^- N% s) b7 O
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 m/ k* n+ ^3 P$ Z- v
! l7 s  ~+ w$ d) h& X3 {4 ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 x5 v6 d- T: d5 X5 a$ E___________________________________________________________________________
2 e3 e4 N0 q( N  y- d, w( q4 j( c8 Q5 g1 k3 K4 r
9 {" j. r" F5 j- K
Method 031 |: K9 A8 V1 y7 q
=========: @6 e$ t- k- T" E
0 {: S& U( t  K. ]% r/ T. O; W
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ F: A( F1 X) x& K) U+ P(API Get entry point)+ J4 n) w4 Z' D- {$ S
        6 Q  a: }& Q1 n' `4 B  K% B
) Q6 m) X* U4 _
    xor     di,di5 v& F+ T. r  [3 V" L- S0 [
    mov     es,di% m+ o7 t' ^# t; d
    mov     ax, 1684h      
7 |' i/ b& ^; q    mov     bx, 0202h       ; VxD ID of winice6 ]8 I/ M: c8 d7 t3 s7 Q1 G# D& p
    int     2Fh
% ~' ?3 r. D/ [) w5 z& t; W    mov     ax, es          ; ES:DI -&gt; VxD API entry point( `7 p: R6 M, @3 ~
    add     ax, di
7 H; @! X1 k' n    test    ax,ax+ |* H, r/ U4 ^/ H  a
    jnz     SoftICE_Detected
& X; m& J0 D$ o. v# e& T, J0 r7 a$ y' p* K8 o0 ]) ]8 y$ l1 Y# ]% ?0 y
___________________________________________________________________________
: M- v1 x" b. R/ h1 I! k
, u, m/ M0 ^/ p# S: I$ k8 a: cMethod 045 G6 E$ x6 q  p- n; n% L
=========
* ~; j# l# X0 r% _6 X
! z. N) e. I& H. w  BMethod identical to the preceding one except that it seeks the ID of SoftICE  m  `" p& \% x3 I7 m
GFX VxD.
  P, |5 B5 \* H- o4 f* C8 T) Q) g0 F$ `) A$ u& C5 v
    xor     di,di
& g- g; F* r$ R    mov     es,di5 X0 Z# H. k* d) O0 x5 f# }$ S
    mov     ax, 1684h      
7 M( `( I; S5 M9 \- b    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 D# G7 {% [% ^, U    int     2fh
( v$ k0 c$ R5 L    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" m6 H3 D1 }: z6 v- U' r    add     ax, di
( O& n, Z& K- i6 D    test    ax,ax& S; {: F% v( k: [
    jnz     SoftICE_Detected9 ]+ W2 _2 O2 O0 B( n: }
1 P8 m) y4 C1 _  e2 w) ?
__________________________________________________________________________% [- p) d* i% t8 z

% C* y, r/ S; S/ _/ \! {
2 h1 _1 |6 G" q, LMethod 05
6 d8 I" j1 N( B3 x% Z. l- P4 w=========
# E) S- `! r3 S5 g! ~& f* g! h
) Y2 r0 H2 n' H0 Y, Z) |0 YMethod seeking the 'magic number' 0F386h returned (in ax) by all system
- a( h- l& b* l; Edebugger. It calls the int 41h, function 4Fh.6 Z  h$ X% a9 C" f& ?4 ^
There are several alternatives.  
% n4 h0 \9 u) L% T9 i6 S4 u* N
  ~! h, U% o: P: H9 }% J% j* \' u: LThe following one is the simplest:; a) [, ~: C7 Z' {8 h

! ^0 W) n2 \! F( ?% B) |    mov     ax,4fh
' s0 }0 S& o: B& Y. x    int     41h4 w' N) J( |4 {- a8 Z1 T( u1 r
    cmp     ax, 0F386# ?9 c# S4 b" H- s
    jz      SoftICE_detected
- B, C0 K( |4 y
9 U9 `0 @' d0 V. Q7 v" g
; L: Z0 D/ m$ t+ ?# r- W1 JNext method as well as the following one are 2 examples from Stone's
* E$ }, B4 s# ^: R2 _* y"stn-wid.zip" (www.cracking.net):. m0 @  t( A3 F( y1 X

. U) M- }" l  \- x$ C) ?! Z    mov     bx, cs6 t0 p5 h8 Y* a( M$ ~! x
    lea     dx, int41handler2
" Q& s5 T6 e! l! y    xchg    dx, es:[41h*4]
+ p  m6 D1 R5 q# g" L    xchg    bx, es:[41h*4+2]; f  b4 P$ c- o$ {
    mov     ax,4fh5 N. D* }7 _) ^. k) |' X' z' T
    int     41h# M; i/ o  L2 \# W" C0 K
    xchg    dx, es:[41h*4]" }8 u& o  ~/ a1 P4 m
    xchg    bx, es:[41h*4+2]
0 Y: x3 i7 g+ E+ B- h4 j& r    cmp     ax, 0f386h
. Z, {6 M) Q* v! x* R7 b    jz      SoftICE_detected6 F# D1 J+ W! [
/ m  T( o% o# h: y' ]9 ~
int41handler2 PROC' \# K) y$ \4 M  o& m# t( V; z# L
    iret5 B. h7 S* G2 F( w4 p
int41handler2 ENDP; U9 d+ W. L; S& S0 m
( R5 D: x2 k- ]7 }
& n6 r# ~! U  ?  [! H' u; j
_________________________________________________________________________+ h* _1 {6 f" N
0 S( W6 w8 _% J2 R3 u' \4 D' R& S4 b
( ?, N" C( f* s, z
Method 06
! `8 r5 Y. z) H  b1 V2 E! u=========
: s5 g6 H5 e/ O: G7 [8 i# j% [1 q+ {& a7 p4 ?  P4 R

3 G8 z. K- O5 U( @- M, z3 ]2nd method similar to the preceding one but more difficult to detect:* E6 O# `; }: j5 ?% \" w6 L! e

: G" w/ `+ q- {  C) g! w
6 {* G/ b9 H) _% b2 ]% r9 ~int41handler PROC* L% ~5 ~2 t0 _  w6 y& B3 f
    mov     cl,al* ]$ U2 v# h4 C4 P1 I' _4 g
    iret
" N! j9 z8 V0 K, ^. V! pint41handler ENDP
$ c* L# R; C. N$ O. y: K; q+ z) E+ a# G. N- |

! s  D1 v4 I4 j/ g2 b    xor     ax,ax
  `: k" q% }7 x2 ?7 ~    mov     es,ax0 A: E" v/ K- W" b9 `6 E1 e! s
    mov     bx, cs! M- u0 h+ G) N0 _, z
    lea     dx, int41handler
7 m+ b2 N. p( u# i: U9 M/ d    xchg    dx, es:[41h*4]
0 P( Y) k" V7 j- r- q3 m2 V' f6 W    xchg    bx, es:[41h*4+2]$ k) T6 x, F3 m; N0 h( [  E
    in      al, 40h  P' s& P) m  q. Q% S3 W
    xor     cx,cx9 t8 ]" o. C3 w; K' u- n
    int     41h
1 P! }' X6 M$ k6 n# Z! Y6 X& y    xchg    dx, es:[41h*4]
: a7 g* F8 Q6 ~# M    xchg    bx, es:[41h*4+2]* D" t& u3 ~$ q1 V! s; @/ h% e
    cmp     cl,al1 r3 g+ h% C* j
    jnz     SoftICE_detected' b0 I6 d; |( G# r5 {, e( n. N( G

( V, _  k0 B# H% ^3 W; Q_________________________________________________________________________
5 K, d( e; x9 a: V9 S7 T
1 h" I- ]3 v  N  E6 DMethod 07
7 b" i4 [5 e, [; V, J=========2 G! C1 A  }* ]4 j

6 _3 I4 @  N2 }; h) GMethod of detection of the WinICE handler in the int68h (V86)
3 [7 B' k5 N( o  _9 M) f7 ^9 \5 l4 u' Q' W# o
    mov     ah,43h3 a6 u6 I$ _9 Q
    int     68h
& r, I/ p* a- j/ M    cmp     ax,0F386h
1 y1 L3 v0 X+ `+ L, Z0 `    jz      SoftICE_Detected
: s) l2 b( n( o2 _  e" @9 ?! S0 x: D' M5 ?2 ?

: `7 N) T$ K5 G' V) ~; p, R8 {=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ R# \% ~: h" t7 O* @
   app like this:
* D. Y" @$ ~! J+ V1 c' R' U& Y& _$ J' F& w' F9 M
   BPX exec_int if ax==68
2 B# r$ E8 h! `; j" T" Z$ w   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ i# W. j0 Z* o. U   located at [ebp+48h] for 32Bit apps)1 U3 r- a1 Z  B$ L4 p1 d
__________________________________________________________________________
) o& Z  p0 Q3 s3 S4 v2 K' p: w$ B0 z$ u* A2 P8 I! o2 k

; c  q3 }5 \# ^6 H6 v9 O! J2 iMethod 08
/ c) S* k7 D) h( r=========8 J5 I/ l6 b1 @  {) H7 u

8 U. q9 h" x( a- r+ {% h2 G! fIt is not a method of detection of SoftICE but a possibility to crash the: o7 G7 i9 ~+ V: x1 B$ |- M' m+ ^
system by intercepting int 01h and int 03h and redirecting them to another% p+ t" ]: i2 X3 U
routine.8 r8 Q3 X, k. z8 J( I
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
# k7 v- M4 Z) t$ h/ c. H# Tto the new routine to execute (hangs computer...)4 Y8 p0 H  v. l4 E( r  u0 C

8 O% c7 S. m0 Z! C; O7 D, \    mov     ah, 25h
- a* i: q3 q( `+ @; t. b7 T    mov     al, Int_Number (01h or 03h)
5 f% F+ x! j! r1 R1 H    mov     dx, offset New_Int_Routine( a( j% Z  O6 F1 m; W
    int     21h" o  V6 F- r( d. e5 }$ D" ]

" `- y, }9 f' |3 k__________________________________________________________________________
2 g3 B* U" Y/ H2 y$ @0 b4 u* v1 F8 \4 U& X! i3 o- G0 ]" {
Method 09
7 ?7 t) ]5 `- t=========
' r8 s& f: a+ q/ t, f
  ^; L6 v$ x/ ?" i0 \% _" fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only0 _' U4 V7 C" k; J: M2 y0 h
performed in ring0 (VxD or a ring3 app using the VxdCall)., o8 j5 f$ f# R  k6 f
The Get_DDB service is used to determine whether or not a VxD is installed
4 d  F% u5 h$ U3 R, ?for the specified device and returns a Device Description Block (in ecx) for5 a% B( j( g9 O7 [: r& V
that device if it is installed.' F+ {! E/ ^5 J
/ @+ S/ A1 Q+ q( L
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( j1 q8 U2 z% m) K   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ X7 |( b" [7 Z
   VMMCall Get_DDB
4 W" B% R! E  B4 |. ?0 }   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed& O- o$ _7 ~+ G- x- B; |6 x# x

# P% H# t* u8 O( v$ A# ~7 u0 cNote as well that you can easily detect this method with SoftICE:0 e& b1 I, ^: C8 k$ O
   bpx Get_DDB if ax==0202 || ax==7a5fh
# y% l0 K( u& r
* e' N" B7 g3 A7 w( G# t__________________________________________________________________________* G: u" H/ H, C8 E& K' g

$ \. h6 R, A1 o/ g3 ]0 B- j- }Method 10; }. l$ ^" X1 p
=========% ?& x$ x) F1 y: R4 t
! S. Y4 Z, l; M5 A" n' B! _6 `: \9 q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 V' u0 n) `" F  SoftICE while the option is enable!!
% B& ~9 M7 y7 S% `& ]3 p
( z' f& T9 `9 }7 X0 r' zThis trick is very efficient:- i8 z: k& a+ D) r7 _' n6 S
by checking the Debug Registers, you can detect if SoftICE is loaded+ @, z! M6 d; e1 l$ l2 m8 z
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if1 T$ [2 |4 o( X* n
there are some memory breakpoints set (dr0 to dr3) simply by reading their  O1 S) u# S+ y1 J9 q1 `* S
value (in ring0 only). Values can be manipulated and or changed as well6 l8 W/ J9 y- O* |
(clearing BPMs for instance)
7 I$ B2 c8 R  o7 P; m
  e* k& a6 @7 o__________________________________________________________________________: @4 c2 T% E7 q& ]) N4 t* q7 L8 E

3 E# O$ F7 X/ L- W( n# uMethod 11
& r4 W# ]7 l6 j; W) K=========. w( ~, s. N# I4 ?7 [

  `! p1 o" B' k9 T2 v# `; K, h0 fThis method is most known as 'MeltICE' because it has been freely distributed8 I" q' d9 _  Y0 s' j+ `1 m
via www.winfiles.com. However it was first used by NuMega people to allow
( G# ?5 e: O/ D/ V* {. X/ oSymbol Loader to check if SoftICE was active or not (the code is located
7 a/ u0 ~( m; Y9 D: o" h( J' Q1 F3 {inside nmtrans.dll).
: ]4 O  w$ H- f5 j. B7 S9 i, S* Y" e- m" }( v. e9 D
The way it works is very simple:' ~+ U* |9 T) j! W$ t
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ G" m- I3 \' w$ p. }4 B
WinNT) with the CreateFileA API.
! u( o# S6 L% \- F4 b4 {) F' [/ A; A1 _! o) N3 X
Here is a sample (checking for 'SICE'):
9 }6 o7 G5 N1 k) Y9 S. ~8 P) I! N3 {2 D, b: d( R  y
BOOL IsSoftIce95Loaded()) h6 _8 i5 D+ S2 R2 _& F5 o6 x. Y
{8 i/ \5 F, V4 u
   HANDLE hFile;  - X: ^) Y+ B+ C5 U. d5 Z# m4 s5 `2 f
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: R) d# F6 ~2 \# Z9 ~0 e% B
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
" F, F3 U/ ?% b! E5 a: ~                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);5 n8 J( n5 G) `( ~9 X
   if( hFile != INVALID_HANDLE_VALUE )
8 _5 {/ ~- z, Q6 L9 m/ t! \   {
. M3 F* M3 x2 ]7 G# U$ |& z% P3 B. k      CloseHandle(hFile);
) r  o- J- G0 s* d. P      return TRUE;
* V: L  k  r) A2 H   }: T6 S! W  ]! ]4 g1 S
   return FALSE;! C$ J+ _0 F6 B5 c
}
$ w  F: W6 T9 E' F
' G( o, H9 Y8 UAlthough this trick calls the CreateFileA function, don't even expect to be
; B& s# c7 H7 j8 u% v2 [) zable to intercept it by installing a IFS hook: it will not work, no way!
, R* c$ V$ f! o! v: r. n$ XIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
# t8 |- @# k  k% w# Eservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; Q9 T9 z0 X7 i& J! Zand then browse the DDB list until it find the VxD and its DDB_Control_Proc
! D# V, M4 Q) f3 Tfield.) w3 f! K# a& z- `- Q7 i
In fact, its purpose is not to load/unload VxDs but only to send a " i1 O$ m( h  k: _
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- w) I4 ]: j8 x6 Bto the VxD Control_Dispatch proc (how the hell a shareware soft could try
0 A, f: a. `+ k: {0 Nto load/unload a non-dynamically loadable driver such as SoftICE ;-).
( q, s5 h' x7 d# s* q& v4 cIf the VxD is loaded, it will always clear eax and the Carry flag to allow2 A) u; j) ?1 V* ]/ X. c
its handle to be opened and then, will be detected.9 {* G( L+ H8 M$ {/ K2 h" |7 C7 [
You can check that simply by hooking Winice.exe control proc entry point; A8 k# k- e+ J& q
while running MeltICE.
; X8 ^( m; k" k' g  N  M. c# [9 O9 ]& a3 }1 Z

+ y2 `- R8 s5 R( o2 x  00401067:  push      00402025    ; \\.\SICE, v  N" v( P% g! [8 e7 l
  0040106C:  call      CreateFileA* M' @4 U0 R+ d4 ?5 a
  00401071:  cmp       eax,-001# U* q5 A, H" }& c- o
  00401074:  je        00401091
7 Z2 q9 \  J/ n. P- R3 Z% R5 m/ c( g- t# O1 l0 U: o
2 L# Z) [7 X$ {, @2 r. w, i# S! T& n
There could be hundreds of BPX you could use to detect this trick.$ k* k' D# a" w$ |0 l. ~3 q7 |
-The most classical one is:( W8 f2 {9 R0 K3 @9 s" s
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 }# C; i# o( l% f" m, H2 k' H
    *(esp-&gt;4+4)=='NTIC'
( w1 |% o& b( F) c: _$ b4 c/ r3 \2 @/ U7 r2 \4 u
-The most exotic ones (could be very slooooow :-(
- v7 }" \$ Y, e3 X3 T4 o! w   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 ^+ ~! f, S- b4 ~* P+ a     ;will break 3 times :-(
; H6 D* v3 {( h# H* D/ v/ B% j; \
& i) G5 s/ r  J  Y0 Y3 Q-or (a bit) faster:
( C8 \( X4 C8 v% m8 Z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# l! k% w" F; q: d, `1 m+ u! l0 C  _. |8 J# Z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& X# F# _" f8 n. T3 G- z     ;will break 3 times :-(% _$ Y% w* Q9 `
, U: u8 Q2 ?1 y5 S2 q8 F/ n
-Much faster:
* k6 g8 U) B5 [( x; D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! b; ]! N' P# R; v) M" Q, B; A) e$ e+ T) ]/ n. ^
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 w9 g0 ^. v8 V8 r& z2 n7 wfunction to do the same job:
, s2 c/ w) P, B+ S& H- F# h  O! v0 a3 x9 Y# V! K- g
   push    00                        ; OF_READ
  i- B5 R* v& @- ?0 X   mov     eax,[00656634]            ; '\\.\SICE',0
9 d; t" k, G8 I0 j% W3 p. m, [   push    eax
* D/ k# L& b& A) |/ E& j* I! m   call    KERNEL32!_lopen6 H9 u' G$ U3 w8 ^5 ^9 [
   inc     eax
( K9 {' t' L7 _) E   jnz     00650589                  ; detected
- {6 K& N- A" ~) n   push    00                        ; OF_READ+ V) l9 C; @* T( A" q0 k
   mov     eax,[00656638]            ; '\\.\SICE'
8 L" u  C8 Q( I   push    eax
! w8 l/ ?/ }0 u; r: ]   call    KERNEL32!_lopen# T' d7 V3 r1 \" F
   inc     eax
& d- m9 C' {" U6 z* L   jz      006505ae                  ; not detected
( l) I5 K9 X# W' ?, W7 {# k
: X  t* P  M6 g. z" s# w
. N6 K" R9 o$ G3 J__________________________________________________________________________! b, t! E$ m, ~8 L# w4 H

  E( Q2 [) O  V/ d( Z* V  JMethod 12( M, D: j' y4 L) v, z$ ?
=========4 t% z& e6 e, s1 Y/ }/ D) c
- j& P* ^8 A8 P
This trick is similar to int41h/4fh Debugger installation check (code 05
" t. I1 W, K) J& ?1 `2 k* T4 m&amp; 06) but very limited because it's only available for Win95/98 (not NT)  p8 R  X9 T* w. O/ D1 c6 w7 R
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ i! s2 ~$ z2 z+ x' u8 n1 J  Y5 @
; `% [9 @; ]; h( m# E; l   push  0000004fh         ; function 4fh
* I+ U. i1 t! s   push  002a002ah         ; high word specifies which VxD (VWIN32)
. c0 ~" V, k# Z                           ; low word specifies which service' Y7 k, I- ~( e
                             (VWIN32_Int41Dispatch)# H) [9 ~6 J& h4 {! ]- i9 U" n
   call  Kernel32!ORD_001  ; VxdCall
  z2 {3 c- ~3 @3 S- M6 W' A   cmp   ax, 0f386h        ; magic number returned by system debuggers
, K& V/ w" u+ D3 R8 @2 R. ]" p   jz    SoftICE_detected. d0 j. _3 R. F# e6 k
" R- B' S& Y$ e8 A6 K; U; r, I  y
Here again, several ways to detect it:9 ]1 C+ g( M9 q: n% \9 L
2 L" i  u& [; n$ |
    BPINT 41 if ax==4f
9 T/ o8 V% F& F. D8 ?2 g8 Y! I4 O; D
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 U/ h% I( P8 J: o

2 J, X( a5 C9 ]/ [/ y8 I    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( B- W2 f, i- f; D/ s+ v
: X# Z, C. a9 e& f# U
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!+ }0 H" e+ h3 Y2 k6 U: b" [
3 J" o. t0 ]( z" @2 ?9 m4 X
__________________________________________________________________________/ Z9 G$ h& _  i/ T2 ?* X- }
1 L/ K9 T$ x  g8 o% m6 F2 d4 Y6 C* Y
Method 136 a1 J% V/ A( x6 \! {) q. i0 i
=========
: Z( b  I5 F  {* d7 j1 s4 P( y/ z5 U) j6 l
Not a real method of detection, but a good way to know if SoftICE is
3 ~9 E: O3 E  _/ U1 `( ]4 N, Ginstalled on a computer and to locate its installation directory.* M( d  C4 b* p  T0 X
It is used by few softs which access the following registry keys (usually #2) :; L3 y! U( Y! i
+ ]6 O$ R, i( W! [5 O0 z
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) T( v7 A: w2 \" h. l1 e
\Uninstall\SoftICE6 p/ E% d" ]7 M$ M( |
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
; q) d- Q; W7 r; [-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; L* w/ ?; {! \9 {+ o
\App Paths\Loader32.Exe) s$ }2 X$ }5 c4 ~# P4 ^* z
" q, J0 C) M$ Q' m; O

& a( P: Z6 F9 O; _8 t, mNote that some nasty apps could then erase all files from SoftICE directory
! f2 l  {7 |, X( S4 ?* z- v(I faced that once :-(
0 l: C% C% u. q  J4 E3 E, C) E4 h/ \2 m9 E8 f3 ]- L, g
Useful breakpoint to detect it:
  k; H& M% n) ^. F" v6 G8 n
$ c+ \9 p5 b+ `& W) m* ^" n# Q# W     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 L/ ]$ F" [( J( j* z
: f8 J4 q' F2 h' z) ___________________________________________________________________________' a( X6 m: z! g( ~+ K, G% g

" [; M+ M* T' ^1 u1 R# O( x6 f2 ]
Method 14 & ~* }9 ]$ Q$ y' k  I: |) W
=========
% m/ a  r1 A! |* \% e. |# y# P+ k, c% K* W" l: @
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
. f3 b3 w8 t4 M4 t; b' D& pis to determines whether a debugger is running on your system (ring0 only).( z" {& K  |, i0 |: [

; M1 |$ R4 G8 C$ G4 G6 k1 r   VMMCall Test_Debug_Installed6 q3 @3 S+ @0 `) {
   je      not_installed
' {1 X4 P1 W6 t, R$ C
% _6 H0 V- ]" YThis service just checks a flag.
/ B, C/ X" @+ J: j! B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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