About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ X% ?2 |% M9 t( g* k<TBODY>
( X! [( I4 L% h' d2 P$ B8 E<TR>
, r/ J0 S5 s# K! L<TD><PRE>Method 01 - U* g. _  v3 o. G& q" m
=========$ _: K  r) ]  P0 R# y
7 K) u& K/ Y3 D$ u% Y4 l$ S
This method of detection of SoftICE (as well as the following one) is$ G& [# G5 z6 L9 K1 K4 I5 B& I
used by the majority of packers/encryptors found on Internet.
* V3 \4 G6 W4 a% A0 G; AIt seeks the signature of BoundsChecker in SoftICE& J+ G8 J2 b0 K8 c5 n/ X$ N. u
8 ?1 L" S% `# g. m
    mov     ebp, 04243484Bh        ; 'BCHK'
2 }$ U8 r* o" a) I    mov     ax, 04h, a0 i1 t, y( w1 v# x& @4 O# o
    int     3      
7 f2 y1 q8 w5 |& V; _+ r+ p    cmp     al,4
4 g! H7 @$ r. W) g$ S' O    jnz     SoftICE_Detected
$ p* R& b$ J7 V- i0 ~
! e7 u; r; G5 q# A0 D+ @1 z! I___________________________________________________________________________
* E' y* P$ d$ w5 a2 l& y9 f+ G) I! W) G2 r2 ~+ ~; n; E8 p4 ^
Method 02
5 z/ {( q- Z0 Z=========  c; E6 B8 w, B" I3 [8 @9 V
" l1 O( m' Y: E+ \. z, U
Still a method very much used (perhaps the most frequent one).  It is used* j, ~/ @% {( t  u' q5 A
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,# g* e, F0 Z% R8 w  F+ {
or execute SoftICE commands...
- n% `2 r, y. U5 \. o) v4 [It is also used to crash SoftICE and to force it to execute any commands
: S: t' x9 n2 W$ ~/ r(HBOOT...) :-((  6 D/ {  a$ }. O" m" y& R

, Q. ^- B6 e; y8 S! g% aHere is a quick description:: D5 a7 U! Q8 k
-AX = 0910h   (Display string in SIce windows)
' p, R7 G% m5 j8 m- r7 r' f-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! C& F. B( J; `% R( g" O
-AX = 0912h   (Get breakpoint infos). z% H; b' \* \' `+ p  ]
-AX = 0913h   (Set Sice breakpoints)) s* ?" ]! B, D- [" Q& E) a4 V2 \
-AX = 0914h   (Remove SIce breakoints)
0 R$ Q5 i7 I2 f' \; G$ G
/ C/ H9 y! X; w$ Y) F  IEach time you'll meet this trick, you'll see:
) Z! P4 ^: `/ P2 r0 Z-SI = 4647h, R/ s' B& {  p: d) x
-DI = 4A4Dh7 q9 \& p/ c* ~7 q+ ~5 ?6 E
Which are the 'magic values' used by SoftIce.
" Q' M4 a! |1 l3 x* I7 zFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.& x& E7 M3 ?4 Q5 L
$ z1 M2 {0 a' n4 u( T- k
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, W/ O7 S. M( p( ?# e) J. VEnvelope utility use to protect DOS applications:) K( D8 u" U! P* |7 @

' ~7 B( U' S4 C" {# c  \; e, w  z* o8 n7 W' ~, l
4C19:0095   MOV    AX,0911  ; execute command.; B' m$ p2 T. w* }6 {0 J
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)." @  a& Z1 I& G3 k% m( m
4C19:009A   MOV    SI,4647  ; 1st magic value.
4 N9 Y2 \& s0 \4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
7 ?0 L! f: B% z& f4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" R7 M: O7 Z+ U1 r6 u
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute8 c  ?& T: s' b5 Y5 W
4C19:00A4   INC    CX
+ O+ }( V7 C* V! H! ?7 D* m1 T1 j! V4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 n+ ?+ Z+ M; F  m" S4C19:00A8   JB     0095     ; 6 different commands.
  P6 f0 X# |- p5 }4C19:00AA   JMP    0002     ; Bad_Guy jmp back.! B2 H, ^8 ]7 @  E2 O, A
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ o) L8 l% T3 u9 M9 E+ P4 i( z" l& Q' B2 C
The program will execute 6 different SIce commands located at ds:dx, which2 b  S( H( B4 I. _) @
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
2 F0 P$ U0 k9 v% Q) B8 g% `6 u* u* n4 h0 |6 e
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
  L/ \3 O, W' v: u___________________________________________________________________________
* l: K- m, N1 i  W4 r+ l$ U* P+ k  Q/ o8 ^! Z0 t
9 v1 t- d( b1 d/ W+ i
Method 03
9 t' d! C7 A; p* g/ F1 ^! r=========
+ H' V3 U0 T6 H5 j% y* m% C1 ~! v8 Y+ g
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. C5 z: P. N7 f& u% F) J
(API Get entry point)
; p! m6 I; `* n  ^, }$ {# m        5 f6 u7 h+ B5 I7 e2 T! t
0 j2 M% z' N6 t: g* j6 a
    xor     di,di
8 A, m7 X8 M4 H) c    mov     es,di$ t; |; z: a2 C# I- x$ E9 [$ w
    mov     ax, 1684h      
& R# M0 d0 ~$ ^4 j! f/ M2 ^# ?    mov     bx, 0202h       ; VxD ID of winice  C# W; F% I& f6 K" N5 O
    int     2Fh3 y' c% ~, Z6 a/ N7 X: ^& }3 T
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# ?# F  U& Y: B8 Q: k7 D
    add     ax, di  v1 I: X5 B5 {+ P8 S/ M2 T% z
    test    ax,ax
: K, y& d! N  [    jnz     SoftICE_Detected! v# c3 v  t5 s6 o) j/ ?. C0 s
& e- e2 t- f& h) \& i! K, s% a
___________________________________________________________________________/ [% V: y* `- Z4 w

8 m* L- J: Q+ M( W! a2 c% h6 oMethod 04/ |+ a2 a+ W( h0 V: ~
=========8 C3 j, S4 N, J; z9 @  h# ?
" Q; ^7 [6 t# N5 k- P
Method identical to the preceding one except that it seeks the ID of SoftICE6 J8 K# L' U  [0 C1 g+ G! Y9 X
GFX VxD.
2 N( v4 c( ]- ?/ j. r$ l- E( W! ^! |- u* [3 a2 K. R& Y  n
    xor     di,di
1 B2 i! {1 {1 T6 ]1 x    mov     es,di: R: }7 X; q* A" o7 f7 e3 _
    mov     ax, 1684h       3 ?8 o* \: h1 t: V4 [6 N  L
    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 h# M$ ]& l& f! z2 K% U
    int     2fh7 M/ O( i  v$ Z, Z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ t4 {/ X/ i% [6 ^* U+ c7 X+ `  x
    add     ax, di
% H3 M: D, ?" E- o8 I    test    ax,ax3 i% J" w! W* M2 s! o7 ?) ]
    jnz     SoftICE_Detected
2 a0 k: q7 O9 r$ K' g1 z
: z. h1 y( T+ a8 z- }/ `__________________________________________________________________________5 A  U/ @% T. h# Y8 s6 V

% l$ z" e. I+ g7 |0 v: w
# q4 x& E& j* nMethod 059 x8 \, F* e$ \* [. w
=========$ H. c! X* X' }" b7 Q% N) @* x
  w2 |$ A" W9 W( S( I
Method seeking the 'magic number' 0F386h returned (in ax) by all system
+ `" I3 r0 S1 s2 tdebugger. It calls the int 41h, function 4Fh.1 l8 e0 t6 X' p0 K0 x: x* M
There are several alternatives.  % U% \$ b2 i' ?4 u
, y; R. l7 p% \. [8 a
The following one is the simplest:
8 u& i$ d- ~+ p5 a/ R: u
0 O( A  z* y1 J# F& d( c    mov     ax,4fh- `9 z  b  `1 G- n6 t  y* f
    int     41h
# f9 a! r3 }7 \+ f    cmp     ax, 0F386$ d, i6 [( j: h$ `1 r* G
    jz      SoftICE_detected
( p# E0 k' y3 s4 c
7 T3 x& e% A- s6 \& u1 ]: i5 B
# u- r- f" y) ?2 O4 h) X2 iNext method as well as the following one are 2 examples from Stone's
% ?  }; m: J4 Y3 a; b8 j( `4 d. A"stn-wid.zip" (www.cracking.net):1 g' e0 G3 s0 a8 L* X4 b: f% E
8 l. y' G9 c: Y- E; R/ v# ?
    mov     bx, cs- F3 n; v0 j( p5 @( H- u
    lea     dx, int41handler2: ~$ n0 \% {) M. A1 A
    xchg    dx, es:[41h*4]" _) P# g  e4 n
    xchg    bx, es:[41h*4+2]
& Q* _: k' |- ?) f' a) I) S6 b    mov     ax,4fh
# ]6 R0 ]) C: C( \% p# m' x% Y    int     41h/ K! J: J0 |) h+ G2 ]. E- o
    xchg    dx, es:[41h*4]
' X/ b- \9 i) r% v: o0 c    xchg    bx, es:[41h*4+2]
# U( K) E8 h0 D8 }8 c9 E! F) T    cmp     ax, 0f386h  N3 p/ b  \6 [! O& I
    jz      SoftICE_detected0 O$ k% Y) P" P( h! v1 c/ U
& P0 p" M: d% m( L- J, [
int41handler2 PROC
8 S; ^% U1 _: ~" I    iret/ u2 g: V! v  n$ T' C0 S+ z! O
int41handler2 ENDP
1 ^7 {' E9 J5 Z3 {; [% a
, P6 s" Y* ^4 w8 U. f
* E5 F, A* O+ ^/ F_________________________________________________________________________
% f4 S3 Y" t. ^9 J( r% e' @: R( u8 u: W" i- Q) i

' K" F2 {! d# i  L/ zMethod 06
. q; ]* E$ s& c. }=========
+ c2 ^' `) l, t; }( C+ m. Y/ ]# d8 K3 e

0 O' |) ^* x& H% w- R, o1 ^2nd method similar to the preceding one but more difficult to detect:  S% K. x8 l2 L* q+ W
/ g& j$ e/ x: O% I9 n$ U
$ c: K$ z. Q! z8 _! D2 m6 b( D/ ?
int41handler PROC) q( Z/ e, V' J
    mov     cl,al, F% _: I) G! x1 A% e7 I1 y! B
    iret
7 B, ^' w* X, Oint41handler ENDP$ G4 |2 P' R. U% Z6 G0 Y; i
1 Q7 w* d! w& w
2 r- M4 r! [: V0 ^
    xor     ax,ax; }+ \( b- M# T% w7 n* z
    mov     es,ax
9 O- P0 L. S" F' O+ T    mov     bx, cs
' c5 S8 M. `- Q2 ^" G+ I3 Z) o8 \    lea     dx, int41handler
' X- P' f" R4 ]    xchg    dx, es:[41h*4]
" u( F  a9 d( K* o5 ?6 _% G    xchg    bx, es:[41h*4+2]
0 C  j9 L" f9 u7 X    in      al, 40h* G! V. ~# I, |  ^( E5 ~
    xor     cx,cx. Y2 l  ~* X6 ?, ]  \2 v
    int     41h
: l7 @- d# x$ U& B  B% ]% K' O    xchg    dx, es:[41h*4]
. c: Q9 e# F& @% ^- Q    xchg    bx, es:[41h*4+2]
& X, c3 f( c+ V, c    cmp     cl,al- i$ q9 p1 [/ G+ @+ \9 ?; |- u
    jnz     SoftICE_detected
# p! U" y' Z! {; m% ?; p$ ?! P1 ?- _( a7 M, b# Q4 w2 |) K% |
_________________________________________________________________________) Y- Q, _/ _/ v6 T& r

) r" T: d6 d" g5 e7 OMethod 07
  s7 I) {8 l* T' p  P$ U=========
. Z$ h5 T& F- ^6 I6 T+ L
5 `6 S0 W  _1 p* ?7 y+ m, {* oMethod of detection of the WinICE handler in the int68h (V86)1 n6 [, S/ ^# D! P$ S

/ y3 O3 h6 x' G' C  C! V    mov     ah,43h8 ~# E& O0 C" S3 r- H$ X
    int     68h
2 `% L: c6 [! \2 ~    cmp     ax,0F386h. C6 v9 p8 _- v) u5 K6 \
    jz      SoftICE_Detected* ~6 o  u0 i3 ~# O
( n+ T4 y; S) r

4 H: {1 q& d2 G& V- f; Y& T=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit* F/ z; _4 }. H' _+ h9 r% `8 A
   app like this:- a) k+ y2 K* D7 o/ R4 z, h' L
" |: a, g  u* M
   BPX exec_int if ax==68
8 Q$ F( G$ p' d7 k/ @( K/ N& A   (function called is located at byte ptr [ebp+1Dh] and client eip is7 X* D  C* L# B' D
   located at [ebp+48h] for 32Bit apps)
# Q5 u! L4 _2 R8 t# D__________________________________________________________________________& y1 Y$ K' o. z0 f7 L( v

9 v. c0 l6 ~, k; {, L: r
2 e: K; Z4 i0 g; @Method 08$ R1 D* R! a7 t( ~  W, R
=========
8 U1 J% y% g# \; _6 W. [
: z# T; H' K. m" L+ vIt is not a method of detection of SoftICE but a possibility to crash the
/ z5 P! G  ~/ R+ \! msystem by intercepting int 01h and int 03h and redirecting them to another* T7 X' f. i3 n# W( }
routine.
2 a7 H7 U* c/ ?+ ]% b* IIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ I- E+ m7 v* ]to the new routine to execute (hangs computer...)8 R& k$ F* l$ {& p( b& J& m
" [1 g7 @. d6 q- T5 [
    mov     ah, 25h
+ z. v$ K# @) e    mov     al, Int_Number (01h or 03h)
, H1 T$ m0 j3 D+ `) O+ Y9 g4 l6 b    mov     dx, offset New_Int_Routine
4 o6 q* Y# z# u. o' g2 k    int     21h
  H* l# P1 T8 F7 I& X  P" Y1 @
( r' V4 b8 I' C* A/ Z4 z& n/ g__________________________________________________________________________
8 w9 M: t1 E9 h! ]! {) |0 g, m7 c% P, I& j/ u6 j7 Y! X
Method 09
6 k' A3 z$ ~% u' q: w" |/ B=========. |% u% ]- T' I7 h) n. H1 A+ X0 m) y
+ d) u, t, e' ]( {% N
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ F0 X8 S9 V4 |9 X# @2 Q: I9 a, Uperformed in ring0 (VxD or a ring3 app using the VxdCall).2 z6 z5 g& |1 \6 V$ a0 t* ]
The Get_DDB service is used to determine whether or not a VxD is installed
1 S. o) T# k4 e' |! vfor the specified device and returns a Device Description Block (in ecx) for% j+ c" J: h- U" y9 H9 F
that device if it is installed.
1 j" l* k: b) Z/ ^+ B. N+ E
) N( X+ ~8 u. p. B+ @+ e   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! P+ ~. `# |% B0 {# m   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* U3 J+ ^" c. T3 W! @
   VMMCall Get_DDB
9 I" Q% y* V8 b$ b9 E   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
# S; S* S- b& O
/ a# x, H+ {3 J" }8 \) _* N9 hNote as well that you can easily detect this method with SoftICE:
8 z/ V: L! p& v5 ~+ c2 g   bpx Get_DDB if ax==0202 || ax==7a5fh
/ `1 _, C) k, c) t4 O+ H4 B' U& Z# d- Y. v
__________________________________________________________________________
( g" s/ S/ r" \2 s! k7 X
( L/ Y7 l# \: I  i8 _) eMethod 10$ W( N* C; V; @2 @9 i
=========: |* M0 d4 ]) d+ w

8 j. K  d6 |  |) d+ G; ^=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 O/ ^4 D& ?# K- d  SoftICE while the option is enable!!
0 W) |4 e# N* Y. `+ F( \$ T" t4 R4 c2 X$ t- B; t
This trick is very efficient:; w9 N3 m& z" A* c' R( d
by checking the Debug Registers, you can detect if SoftICE is loaded
0 y3 Y0 h1 N* e(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if7 v7 C& O- ^6 K$ C( e5 }' S
there are some memory breakpoints set (dr0 to dr3) simply by reading their* h8 e1 n3 {* L* W- e
value (in ring0 only). Values can be manipulated and or changed as well6 n  H% L" y: Q* X. B
(clearing BPMs for instance)1 A* M- i( H, ^& v, \2 q
: m: G- |; H% b3 [! O0 I* V
__________________________________________________________________________
9 _- i5 j2 C- f+ k
/ {. ]$ D' z, w' P6 FMethod 11( q' n/ `' e+ P' n4 ~+ s5 W
=========4 Z% k+ _% e7 u8 w0 {' T! P; z
' A4 y5 Q+ t4 G7 Q" s
This method is most known as 'MeltICE' because it has been freely distributed
! W3 f0 q( \3 Evia www.winfiles.com. However it was first used by NuMega people to allow
" N8 Y" G5 y9 b$ y+ h7 h+ m( u* GSymbol Loader to check if SoftICE was active or not (the code is located# ]# o0 I4 f& {1 L
inside nmtrans.dll).
/ b- N, T( A% r0 j% E6 K2 v0 q* D: g, ~0 @
The way it works is very simple:
( R4 F, Q+ l* C5 ]. r$ \4 oIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% M9 G0 m$ K# u6 I. I% n
WinNT) with the CreateFileA API.
$ R4 K# w. M- K  a+ {4 O: b& M- Y+ Q* v' E: ?5 C$ v# o# I9 b( {) e8 E% q
Here is a sample (checking for 'SICE'):
( V$ _1 O* L* \) e: g
& p3 J! o/ u5 ?BOOL IsSoftIce95Loaded()
3 F4 O- Y% b: `5 e) m{
. I. E9 {5 b4 J! G0 G   HANDLE hFile;  . U7 x* a; g9 B2 y( t% v! ]' }! R
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 Y* u( K; h3 i                      FILE_SHARE_READ | FILE_SHARE_WRITE,2 U. r& s; F6 k, |& @8 ?
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 X5 T. M. P% T5 B
   if( hFile != INVALID_HANDLE_VALUE )
* A/ L( c, m; G# j   {
  q0 K! |& h" X( D, f0 f      CloseHandle(hFile);% P, q* p' N+ Z/ \) o# \
      return TRUE;' r. h; T0 G- u" W/ x4 S
   }" N' \$ ^8 f- P/ F
   return FALSE;! b2 B' e' Z4 c1 L$ n
}# o" E4 T4 v& o
; ^" v8 `' m( v2 a: b
Although this trick calls the CreateFileA function, don't even expect to be
/ o% q5 W" @4 a7 hable to intercept it by installing a IFS hook: it will not work, no way!& K2 _1 r2 ?  ?" \: P7 [$ W; Y
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, t9 O  D. F7 qservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
4 A  e3 E, J( m! S- m" Land then browse the DDB list until it find the VxD and its DDB_Control_Proc$ E# I3 n4 m3 D( E  L1 q" V
field.3 Z/ r- O0 Y  d) ?& O
In fact, its purpose is not to load/unload VxDs but only to send a
! c, B& F( f8 u- U+ }W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  @7 e; L! A  x& v& T5 ~1 @9 f2 v
to the VxD Control_Dispatch proc (how the hell a shareware soft could try% p& m) B, `$ R
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
: h. x, S7 Y4 t& d$ [2 ^If the VxD is loaded, it will always clear eax and the Carry flag to allow+ x( Z) p+ j1 c; f
its handle to be opened and then, will be detected." h1 T) X* b' `# X
You can check that simply by hooking Winice.exe control proc entry point' D: z9 s" u. n4 U% x& E
while running MeltICE./ \) M3 [3 b) S9 ~! o
& I# y- T! p& M: f% ], ^

& D( t$ R4 r3 L1 j( t* O  00401067:  push      00402025    ; \\.\SICE& E; V' r( g: J9 @
  0040106C:  call      CreateFileA! C& k6 E" g0 j
  00401071:  cmp       eax,-001
( M3 U. Q( _* L4 f' M  00401074:  je        004010918 u" x  I4 {2 f$ [- F. E
6 |3 w( l. I4 Q, U
5 S4 h. h2 l. ?: h
There could be hundreds of BPX you could use to detect this trick.$ L1 Z/ o. L# ?% `
-The most classical one is:2 Z0 {6 L- N1 C8 h
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||! m) y/ d0 X5 T2 p0 b0 g% f8 \( W
    *(esp-&gt;4+4)=='NTIC'
. a; G, [- y& E$ i1 y8 t3 L2 \/ o4 {2 K" S; _* n
-The most exotic ones (could be very slooooow :-(8 H% i( \+ {3 n4 x3 g3 f+ k
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% [% X: F: F: e     ;will break 3 times :-(
: P* G% O1 `# |1 K8 K1 o% i/ Y: E; L1 g3 ]) r0 R2 P% k/ q
-or (a bit) faster: ; E6 o" G' I/ H7 o
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')8 }9 E* T! Q. n0 ~. Y4 \1 S
: _$ t) ]8 _' t1 p' d
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 v7 x, l+ c( X) x; u2 b! W     ;will break 3 times :-(
, J/ {% _: R: V4 Z, N& ]" s- s( |9 e/ d4 h' Q+ k( S
-Much faster:
. m" ^/ A6 V% C0 N5 L   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" j; S: l+ O7 R# z$ v$ q4 e
& m5 B2 _0 h9 d/ H* c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
5 ]8 B& E! o: P! O8 _* @/ Ifunction to do the same job:
8 ^' R+ c0 Z( M. T5 z% z2 b+ E( [! u% n- z) t
   push    00                        ; OF_READ' n  n: d! F, c
   mov     eax,[00656634]            ; '\\.\SICE',04 K' m7 P2 }5 ?% t
   push    eax% z: p. h; g6 _* y
   call    KERNEL32!_lopen; E1 X. o" ?9 `$ G9 C
   inc     eax
9 g; v& p; G2 M2 n9 v+ f6 h   jnz     00650589                  ; detected* E$ p; t( x" H5 u) p- S1 ~
   push    00                        ; OF_READ
2 `8 q  r% r2 U: `   mov     eax,[00656638]            ; '\\.\SICE'+ G5 t2 E3 a- X. T
   push    eax" r# a  f. S6 ~5 I! t5 g1 Q! t
   call    KERNEL32!_lopen
0 f$ J$ _. ^( J$ x0 F& Q' f   inc     eax
- ^! L/ n1 I9 ~   jz      006505ae                  ; not detected, |, U" u- d. Z
! m; _* z' F1 m
$ C- H8 E7 B2 S6 N) Y2 A& b1 i
__________________________________________________________________________, s" P! K1 a6 p" v# y

, M& u4 W! j6 V2 L3 Q3 [Method 123 W; z% \( c9 ]. W" o5 W# }# ~% c8 k
=========1 B, W) U4 ^4 E6 L

8 Z2 O% S3 a' vThis trick is similar to int41h/4fh Debugger installation check (code 057 ^/ n7 }0 d. f$ [7 n; G
&amp; 06) but very limited because it's only available for Win95/98 (not NT)* P3 @  i% ]& e
as it uses the VxDCall backdoor. This detection was found in Bleem Demo./ D& ~* V& R: [" B1 T: L
" V' [3 Y4 x* a- Q' X# A
   push  0000004fh         ; function 4fh
# J5 _1 r  |: h   push  002a002ah         ; high word specifies which VxD (VWIN32). a% R6 Z  }  N$ \" i
                           ; low word specifies which service
8 F" S2 p3 e' O8 B6 X                             (VWIN32_Int41Dispatch)
, z3 x) [, K0 ]# S2 O; A   call  Kernel32!ORD_001  ; VxdCall
$ I0 ^' O( Y; F. R$ C   cmp   ax, 0f386h        ; magic number returned by system debuggers0 f; U5 R, h* C6 l
   jz    SoftICE_detected  X# g, t; O& B0 h. g1 F/ t6 |
  B4 [1 f. K9 I: \# [
Here again, several ways to detect it:2 _. Q7 ^$ a+ \$ m, y6 s! `

! N5 g& V: E3 r1 F9 N" s/ P; u    BPINT 41 if ax==4f, f: V0 @9 G5 M' h

4 q  s% w$ z! t" j9 @$ a' C    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! u- h+ N5 v3 j' w
5 y  V3 {- Z; X2 a2 `0 u    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 B  i# \# _; W
+ p1 o+ x3 q2 }8 z. w5 s4 B. G. W8 [
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!. ^* \$ ?, N4 V6 U

- t' q0 W6 p, J+ ?# p! `+ P__________________________________________________________________________
4 r$ k/ n* M8 v  j: j( L5 ]( V, e4 t! p. \( n; ?
Method 130 z0 J. z$ I/ q+ C/ o( h, v
=========" P+ f$ M" `5 L, {7 m6 O

% ^1 X) A+ U$ [0 H6 _& Q( ]% WNot a real method of detection, but a good way to know if SoftICE is
% h1 _: z/ m& i5 G# z! P% yinstalled on a computer and to locate its installation directory.* M1 _  b$ V+ a' I! O
It is used by few softs which access the following registry keys (usually #2) :/ c  j  d9 h8 c. H2 g- _

9 r4 b1 b3 y  ~. n. }-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 e3 r7 J. b7 L\Uninstall\SoftICE
9 C  `% w- k: s- q/ i) _2 V-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
7 _4 {8 \+ y, |5 N  N-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. V- `4 T% o5 U1 o. @
\App Paths\Loader32.Exe
4 H/ z( T+ C. X1 w* L
' P: M; a+ z6 m7 h5 f$ G& S/ |; q# [) }/ A1 f! P  K
Note that some nasty apps could then erase all files from SoftICE directory
* U! s( M; {7 W/ {7 [' @(I faced that once :-(" [$ S2 n4 k0 t: v$ d. H0 z

: J: D" p- f2 b, p8 ]! M( RUseful breakpoint to detect it:5 ^4 l) m' Y2 c; w3 M

' D- t# v8 J% i' z+ _     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ r4 k) M. q: @

8 P4 F1 ?) O. [$ o. Y+ K7 P) {__________________________________________________________________________
5 w) z2 J. g4 n& J* P( f3 k- T; k6 K5 N& H! ?) U3 G' [. Q1 y3 ?

; z* C( p9 O0 s1 DMethod 14 0 w8 W3 B1 ^& e: v% @0 D
=========" I/ l2 K) P3 ^' J6 B/ p6 U  ~! q

7 G3 D* v% E" N* a; `A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ f, s5 G* ~8 J+ \4 {
is to determines whether a debugger is running on your system (ring0 only).
0 I& |9 d; p8 R$ i4 L1 U; @8 W4 x1 U" C  W* H# W# N5 e
   VMMCall Test_Debug_Installed& l4 |) _7 x  O8 g5 i
   je      not_installed$ M: S; q% r6 J$ |  R7 ]
& O4 F) z& ^: D: t1 H3 X: p  n& v1 {
This service just checks a flag.
  Z. O2 f) L& n& z+ w! X2 |7 p8 b* [0 [</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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