About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
" x$ d* g3 \* @) I& @- }<TBODY>
: e* f* y, z5 C( ]# P& D5 x* h<TR>: X% x) r% Q# I' `) ]/ T6 F
<TD><PRE>Method 01
. W7 r& f) {' [9 m2 m& A=========" D1 R* S( X( k

  n( K$ u1 \4 p  Q) nThis method of detection of SoftICE (as well as the following one) is: ?3 F* c+ j4 e" P; o2 s. O
used by the majority of packers/encryptors found on Internet.: _2 l( V9 }% w! Z6 X7 s
It seeks the signature of BoundsChecker in SoftICE
3 L; z% G: j1 v! K3 h+ P) B) w/ y, [7 a% z- A7 r
    mov     ebp, 04243484Bh        ; 'BCHK'2 n  W# o* R9 _. W; `& \( f
    mov     ax, 04h
8 X6 C! X( {  G: O7 F    int     3       + J9 S' J3 N6 t6 B' p! W. E
    cmp     al,4
6 Q! W+ J. T1 U( n    jnz     SoftICE_Detected
- U5 A6 Y! b: i8 [0 D- ?0 z
8 W' L1 ~9 \, Y$ V___________________________________________________________________________& D) s. @! d& ]
- v) l% t) k" ^% Q4 f% l
Method 02& \; ~; N6 h" s# ]4 {
=========' Z* j) R: b5 N3 z" E

. t' Q- t6 `9 i: V' J7 RStill a method very much used (perhaps the most frequent one).  It is used. Z8 O& H! O. Q
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 ^; J. X. s3 v- b! w+ \6 Jor execute SoftICE commands...
& X9 f6 ^$ F# u( f  pIt is also used to crash SoftICE and to force it to execute any commands
2 d! f  h; w2 a/ y(HBOOT...) :-((  
# K" l" N$ d' g7 m# h9 A8 g, w* ^# n2 g8 k  z( G9 ~$ ]
Here is a quick description:
1 [3 H' `$ P( W! J  Q- r0 A-AX = 0910h   (Display string in SIce windows)" ?' p9 J: J+ h3 G2 u
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% u, F' [1 x* q- q. W
-AX = 0912h   (Get breakpoint infos)
: a: K' V; M0 C2 Z. y1 \5 q3 [-AX = 0913h   (Set Sice breakpoints)
$ q' V- V0 v, C, }# }-AX = 0914h   (Remove SIce breakoints)
# w$ R! T0 v! A1 J* I9 k5 z
  v" V1 H( l' HEach time you'll meet this trick, you'll see:, Z4 Z" I0 V1 A% {) k6 m+ F' v
-SI = 4647h6 u* ~* _9 z9 P; W5 r
-DI = 4A4Dh; }* k8 G, G" s, w5 i4 ^9 v" q
Which are the 'magic values' used by SoftIce.
: O9 d7 P' H$ v( RFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ Q- H7 a8 x5 Q$ ?4 J6 ^' T* Y
2 k8 m$ {, R4 m  YHere is one example from the file "Haspinst.exe" which is the dongle HASP
3 O' ^9 h5 R- c% c. W! C! n. PEnvelope utility use to protect DOS applications:8 T6 \; O) P2 n; d# d& a# v) {

: b0 f+ W4 a" M' i9 v2 V3 B* o! a+ X3 T/ p* T9 ]
4C19:0095   MOV    AX,0911  ; execute command.
( _8 h  \6 {. p4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
' j7 k$ I+ A: A8 O6 S4C19:009A   MOV    SI,4647  ; 1st magic value.* u. ]- F" A2 y' h# J9 x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
* V, V9 Y" A8 D4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) q! x; j- ^  J# Z6 W
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! o6 u% s  `) T8 p1 C1 _4C19:00A4   INC    CX
  b' M9 A- l8 w  c+ n' Z, W5 @4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- ?2 S) k5 \# J( s$ U+ ?7 F3 y4C19:00A8   JB     0095     ; 6 different commands.; B6 ]8 X4 g3 `9 R8 k% _
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 z/ e$ O" B% e- N8 T4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
1 o' u) h1 v0 h0 u3 y8 v3 z2 B% L
. o6 b& a, b- ~' x( UThe program will execute 6 different SIce commands located at ds:dx, which
; K2 f- y% U, N; _/ q0 H. fare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.  K/ [& o6 t/ c, H

. P0 {: d5 p+ m0 r6 {  g* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 m- g. C$ x$ e: Z" g1 J
___________________________________________________________________________: I9 T) S5 I% q, J
; c1 P, t1 ?, ]9 x3 ?5 ?/ H/ f/ z

( w/ C# t  i, d  V& lMethod 03/ t* ?1 j0 n  L1 H0 Y' |
=========) c- m# E/ ~0 S+ M' q

0 O1 M5 G; Q9 U/ L! ^9 l% A! FLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( @& E4 D5 O' a! g(API Get entry point)
5 X5 w! J% y/ _) y7 _        * ^  h+ B4 n7 r6 w9 L$ `
4 F) c& j) [3 M. @
    xor     di,di, G9 E1 v2 k0 @+ ~4 A0 i
    mov     es,di
" l. F8 M* W8 \" C    mov     ax, 1684h       0 s% z$ k1 P/ D6 K9 ^- @" W% R
    mov     bx, 0202h       ; VxD ID of winice
- ^3 |: {6 {8 G; i+ t# h) P    int     2Fh
  i: w" H. v$ V+ d0 G, X    mov     ax, es          ; ES:DI -&gt; VxD API entry point) X8 W; H$ i* f- ~+ g- z, {
    add     ax, di' g) j( H* v( q
    test    ax,ax
: d; @, u( Z1 X; k, G0 ?6 y    jnz     SoftICE_Detected
9 y, P4 _; B& ^( ?2 `0 Y$ J
! c9 x  F* s6 }. _$ ~___________________________________________________________________________
. n: N1 K" s6 d. Z5 s2 Q& @) }2 j) T
Method 04$ n6 F) O* s6 e' w0 v/ r
=========
- q4 @6 p" r4 p6 t$ y  \" s# h/ V! A5 Q. a
Method identical to the preceding one except that it seeks the ID of SoftICE, x8 R; D- j- V+ ?* x
GFX VxD.  D7 z% ?5 f: K; q

! [# `- \, @( ?* S5 S1 C    xor     di,di
& J2 O7 ~1 P- }7 I3 p    mov     es,di1 X: `3 Z) g/ j# z! b
    mov     ax, 1684h      
& c6 A0 v* I, R1 R& p8 s2 i2 A    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ `) W" Y* [0 ^0 W
    int     2fh; m# X  I8 y% f- p# A$ H5 o' K
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- C! u8 r2 E/ K& }+ _
    add     ax, di" }  r$ U5 X8 z6 r
    test    ax,ax) n0 E% k% Z8 ~8 ^# u; q
    jnz     SoftICE_Detected
% s, h! p& L7 T* D7 }7 {
; j7 ~- P$ F6 W__________________________________________________________________________8 ?; ~1 |: b, b, Z2 d9 t) w
5 s3 |7 p; ?- t/ A4 Z2 p2 s. j

$ ?: @" u+ g3 u. Z- V/ F) LMethod 05
# z4 c% A- Y) ^$ n$ o7 Y6 c( [' Q8 ~=========
+ t/ J7 i. j/ z. J/ R4 X
: M. X1 D7 s0 t. ^: g0 s+ h$ nMethod seeking the 'magic number' 0F386h returned (in ax) by all system
  K5 ?( `5 l5 C  Idebugger. It calls the int 41h, function 4Fh.  D8 T- M3 j  s  h2 E2 @# H4 a! S
There are several alternatives.  
) ^: b9 y* c# P! \$ |
4 G3 v$ \+ B5 @The following one is the simplest:+ O2 V: l: u, ?& t

9 W! q% [" p# i" ~    mov     ax,4fh
3 k! o# A+ Q7 O9 ^1 u/ K- p0 }, z) g  h    int     41h
, T4 G# {. V$ T$ V7 ]+ `3 a( s" l    cmp     ax, 0F386- n5 I7 p2 a/ F# t
    jz      SoftICE_detected& M0 B$ n. H2 O* F! D/ H4 |* S

7 ]9 S+ k9 X& H$ X; \' C7 }( l6 p! M5 J1 p
Next method as well as the following one are 2 examples from Stone's 9 n8 v4 c+ h+ l& d
"stn-wid.zip" (www.cracking.net):/ W5 V: H+ r& G  b

, ]6 s1 F& M3 E9 k5 ]2 }    mov     bx, cs
3 n  K* t! W+ Y  n* p    lea     dx, int41handler2
+ z. N& Q  |7 K! v; h$ f5 N+ C    xchg    dx, es:[41h*4]4 n9 E3 X( _9 _' H( t
    xchg    bx, es:[41h*4+2]
3 ~% J$ l, @; }4 ]8 B) m8 ~: i( |    mov     ax,4fh
& T8 Z; K5 W7 L8 S* H. d9 Y    int     41h
+ ~4 F% O4 T9 c! H    xchg    dx, es:[41h*4]4 C  R/ T) _% x( s4 K+ L
    xchg    bx, es:[41h*4+2]  j( J5 ]: M# z7 P4 z" C9 M
    cmp     ax, 0f386h( V# K, r7 x1 b9 @) X
    jz      SoftICE_detected% o/ d) p$ [$ g2 E# N: Y( p

0 X; Y4 w0 m2 j7 i- ?' _int41handler2 PROC
9 [9 l$ q1 \+ b, s5 d- U    iret3 k# W9 C3 {$ B7 o
int41handler2 ENDP0 J( p- Z* o5 A) t

; s" `5 ?  Y; f8 l6 }1 E+ A& \  J
_________________________________________________________________________  A; X) R, v# R, @
( R, O6 I# k! m. E" e9 V- {
" l+ Z. n- Y- k9 Z! W, W
Method 06
8 R* l5 Y0 }* ~* N=========
; B' _) O2 F3 [6 L8 @. [. g! `0 W
0 y- o# G5 {" p; u. g
- E9 t3 W& ]$ j; v2nd method similar to the preceding one but more difficult to detect:- B7 v% c2 @. M5 R$ B6 U, O- n

  F( @9 s) H5 S2 ~( J$ X- h9 i  ?2 _+ k) ]& |: E
int41handler PROC
" K2 e$ a) \& p+ `+ |    mov     cl,al
% u( A; J/ f* k# t/ u) s3 d" T0 {    iret( w0 }8 Q; z( F
int41handler ENDP
$ \% \' @5 B  G; m" m
) ^7 g+ }" D& A4 k; ?5 m
/ K4 l2 t, T2 w0 ?2 E. A( v9 j    xor     ax,ax
5 y# l" l! a, ?& K1 e) O  [    mov     es,ax. y  f7 n) c5 V3 L# N4 U0 v9 X8 C
    mov     bx, cs
6 B9 M# H3 d4 R" Q3 Z    lea     dx, int41handler* {, i: v0 o3 r0 m& w$ S
    xchg    dx, es:[41h*4]
* |$ S3 H6 _2 p) P, Q5 t4 n9 J    xchg    bx, es:[41h*4+2]8 }0 n: e  r! J: ?+ e* C& B
    in      al, 40h( _7 N; c1 Q% O- S: L; }' R) W
    xor     cx,cx
! F+ G) p, ]0 `4 v    int     41h) z  g+ k9 \$ {/ s; I
    xchg    dx, es:[41h*4]
% p; p: M! ~7 m2 T# `    xchg    bx, es:[41h*4+2]
# ?2 D  m* p0 H: o    cmp     cl,al+ G4 _4 t  C% i( ?
    jnz     SoftICE_detected* H4 ~4 L$ Z4 Z. X! h

8 z# G* c5 i$ _( c' T. U_________________________________________________________________________. \, j) D/ F) d! C' F( z# a

4 Y. I9 M& S6 `( vMethod 075 P0 i+ w/ @% S( `& Y. ^
=========
. y) }) X0 Q, i5 [- _  m- j1 d- b: I0 O5 _- E* ^9 A& K
Method of detection of the WinICE handler in the int68h (V86): M! c6 X$ ^. u" M4 U( }

0 C/ r* o/ b7 m& s0 r6 ~9 k    mov     ah,43h
3 E7 ~6 V9 q1 o    int     68h6 E2 d/ C* S3 Y' K9 a- w/ X# f
    cmp     ax,0F386h
+ w) _  o" h3 h2 C9 ~3 d    jz      SoftICE_Detected
5 c: m/ }0 M4 n% z- v4 w
1 t: ?0 v* i6 W+ v! R+ Y6 ]6 D7 u, z  A+ r5 q' v8 g
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
6 F, W$ p  b9 V  K+ y   app like this:
, ]) g  B% P' l! `1 ]: J  X+ Y* w: z& P4 r8 b
   BPX exec_int if ax==683 `( s. B6 t$ P1 E/ ^2 w9 z
   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ j  O- L: \* V" M) h$ M9 E   located at [ebp+48h] for 32Bit apps)
/ _3 u" G1 X1 M; ^9 Q1 ^__________________________________________________________________________
" Y% k& {5 z4 [2 \, d3 i4 H0 s' H$ G; o6 `/ b. p& b5 R9 y
: y1 ?- K$ M$ F9 p
Method 08; P1 Q+ J2 V7 T% s6 b: h
=========
4 L1 `; G# U# N
; }" O+ P# S% b& L2 j+ e% |* ?It is not a method of detection of SoftICE but a possibility to crash the
' k# R; s2 S, S& dsystem by intercepting int 01h and int 03h and redirecting them to another
4 p/ `5 [( j$ {% x" Proutine.* s: b% @1 X4 p! L) S$ k
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 e$ u0 ~) z6 V' K; j; a, Yto the new routine to execute (hangs computer...)( D" Q# D6 R! @: d
/ X4 l4 V, L" ]) Q% W9 O
    mov     ah, 25h
, x1 R! @. G9 Y8 Y, Q) k* c; ^: h; ^4 U    mov     al, Int_Number (01h or 03h)
9 \6 [& I+ ?7 D+ P/ `2 x    mov     dx, offset New_Int_Routine3 g/ T  A) t* s# E, u/ W
    int     21h
$ V& u0 A- @) X: ~: t" T' i/ }9 x4 Z+ y; y
__________________________________________________________________________
5 E( p  F: ]( P$ l" n9 P5 Y  \9 o' B* P
Method 09
/ ]+ o2 R* Z' R& u2 S1 h9 L( F=========
0 b: Y, S0 Z# ?( X; S1 h5 z0 g. X  V4 m% l. e- L+ n
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
3 R& ]" p6 E. \performed in ring0 (VxD or a ring3 app using the VxdCall).
, _9 h2 P- b! |The Get_DDB service is used to determine whether or not a VxD is installed
& N: s7 M9 G" i! zfor the specified device and returns a Device Description Block (in ecx) for
$ C' Y! K7 L0 D7 Mthat device if it is installed.: @  c. X  ]# p4 N; n) [

$ H( f  N+ {" X, @   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID/ ~- |. \; A" d; p
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% L5 h  E& D* B* S! A
   VMMCall Get_DDB
' g8 |- Z3 o4 j" _   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 {# o: ^* x4 S, ]9 g+ Y( g8 i, J7 J$ ]$ N" U+ E
Note as well that you can easily detect this method with SoftICE:2 {+ p  d) w. I
   bpx Get_DDB if ax==0202 || ax==7a5fh
& X6 t! I- f  f7 `7 a& u; d/ \6 ~' b
, i; J; ^8 c2 }6 ]0 F__________________________________________________________________________
0 C0 D. S$ f4 L* a: Z& ]' P0 T& ^
7 x) v" X9 L& O% S# @, {$ MMethod 10
% F- [' z' I: T, {& A& t=========
) j4 Z1 C7 d' x5 `  f7 @0 j' D: d
2 |- w* h  M% C8 z" P( V/ j=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 G$ {' j+ f; O+ F$ D( r
  SoftICE while the option is enable!!
8 S8 D( P! ~8 R! b5 C7 N5 U, t+ _- W3 J+ T+ r' ~+ H
This trick is very efficient:! D$ R; F- ]& P# E0 f! V- B
by checking the Debug Registers, you can detect if SoftICE is loaded3 ?- ~4 E  F" U2 N* V. @
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: q* x4 o( s0 L) v2 G* Q& A6 p" wthere are some memory breakpoints set (dr0 to dr3) simply by reading their  A+ |7 {$ K' E5 C& X$ M# j4 Y  a
value (in ring0 only). Values can be manipulated and or changed as well# ~7 o  I1 Z' k! Z( |' q- ^; e5 g
(clearing BPMs for instance). I3 m' ]+ ^7 K! Y
# m6 T' p. K. P( B0 `" b% H; ]
__________________________________________________________________________4 ^6 Y$ _2 m/ c$ K5 R

( v0 F. v. T7 T) |, g! R( ?2 pMethod 11
. K3 i, N: r5 G=========7 b; H& q) ]& c) Z8 w5 @2 w
2 c  G) W( o5 _! @2 b
This method is most known as 'MeltICE' because it has been freely distributed
4 v) r- H) m# ivia www.winfiles.com. However it was first used by NuMega people to allow
, `( K( Z7 \6 M0 r. `* _2 Y/ z& PSymbol Loader to check if SoftICE was active or not (the code is located* y& j2 z1 I4 \; D$ ^2 X
inside nmtrans.dll).
# i8 C" L: ~& f0 b8 b; Z0 u
' y  w, ~( e9 O6 R! ~/ a/ ]The way it works is very simple:: y, E# y7 [$ |; [9 V/ T, q( Y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
$ Y. W3 }% t2 m8 WWinNT) with the CreateFileA API.8 h2 z# T3 x, j6 Q4 a$ j! y# l% w

1 D# a5 @7 c2 o% d0 ZHere is a sample (checking for 'SICE'):
7 e* k* U' Z  H- Z( K7 B2 P# p
+ C* p9 n5 v* U  T) i+ e/ g" wBOOL IsSoftIce95Loaded()
: F, k$ X! y8 h  X, I# h{. X# N  ^. O4 ~0 [" b$ d
   HANDLE hFile;  
7 W1 S% |% F+ c- Z) V, V( e5 t9 p2 U   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ G" H5 k0 @1 X                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 J" D$ H( J! n  @
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ |3 `+ c' c) f( L   if( hFile != INVALID_HANDLE_VALUE )
" w/ T, P3 x/ B0 Y3 L7 _   {- E8 h+ Y7 S. Q9 F' j1 K; X6 X
      CloseHandle(hFile);
* w$ C0 ^9 }& m& Z/ x8 |      return TRUE;( s4 J& Y/ R4 t/ |
   }+ ~$ ^* O; E' C6 p
   return FALSE;
9 x( z, J& r$ e# [8 K9 r2 |}( J2 i. T3 w8 b

2 a- `/ H$ G4 J+ I9 D5 nAlthough this trick calls the CreateFileA function, don't even expect to be
8 h6 f. T) m. O( E" q. Xable to intercept it by installing a IFS hook: it will not work, no way!8 W7 L6 [' m2 L& ]/ k7 z
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, E& o, J+ N- s4 U7 `; _/ |service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: v; }7 U1 K0 ~  g: T3 mand then browse the DDB list until it find the VxD and its DDB_Control_Proc
; Z7 z9 I& o0 W, b3 x1 \* k0 Zfield.' f2 g3 k/ _2 S! s9 b9 U, Y. m
In fact, its purpose is not to load/unload VxDs but only to send a 3 m& H+ P4 ]! x/ ^0 C: J9 N
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( |6 f3 M0 q" C; D) z# x! dto the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 d/ J& u! L( @to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" s2 v9 T, b; |. R$ d% WIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 \+ H$ K- \2 m0 `3 C4 pits handle to be opened and then, will be detected.& D" y. ~' ?0 b3 i  |7 G* T! s
You can check that simply by hooking Winice.exe control proc entry point
+ A+ \! e; B5 rwhile running MeltICE.7 ]2 I+ r2 \( E) J5 U" K

) O( r, _$ e" r* n3 D( ]: j) p* e1 F
9 }  s5 U5 U8 |' u  00401067:  push      00402025    ; \\.\SICE
+ D& @. L) X' ~, W  g  0040106C:  call      CreateFileA6 m  X+ K  a# w; ~, _; F7 ~+ t
  00401071:  cmp       eax,-001
4 ~3 `. {8 U5 i- @3 q  00401074:  je        004010918 v5 s$ X4 M; g! p* v
1 l, f- w6 `! m* W' C
4 H5 Z3 d3 ?! N8 |: E
There could be hundreds of BPX you could use to detect this trick.
6 j1 Y/ R3 N6 Y' L8 T( E% o& ?' N3 {-The most classical one is:+ B1 U% U6 [; f5 n
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
  A1 c( N: P  W0 _, [( s! L1 P7 P0 F    *(esp-&gt;4+4)=='NTIC'
! P4 E- x3 R; n/ o: l4 i
8 p/ ]% x- a( a+ j! n5 a  u-The most exotic ones (could be very slooooow :-(
) |6 \  B: |( A# U( {7 f! f" a! V   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 K. I1 [0 s1 z+ O
     ;will break 3 times :-(  v9 l$ J5 R$ y
9 k1 j) A* I- u2 [$ n
-or (a bit) faster:
) z, g( V& z& S$ F0 F# N1 O   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 x; P4 F- F+ F$ d5 _
- f/ R( R4 B7 R, v! f   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
: A9 c) ~2 |1 A% w, M" O- e     ;will break 3 times :-(
/ N6 B) R9 Y+ i& X4 H
1 C$ H, y$ ?# o% C  i-Much faster:1 R7 u7 i$ Y5 m
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', a! L0 x/ }8 B6 b8 f. W' `; L! k

. \) U: v1 p9 fNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
' }: T& f# S; |/ x* s, ]function to do the same job:
3 x6 F3 a5 C+ X3 q. g/ C/ M/ g5 I  d+ N( f+ w( q
   push    00                        ; OF_READ
& v9 Z0 w/ P- A( Y; q   mov     eax,[00656634]            ; '\\.\SICE',0
! Q) F' T* i% {$ r   push    eax
% l! U8 y' k" k- ~/ j) c6 n   call    KERNEL32!_lopen
1 O, S& }8 ?$ n! S0 p   inc     eax% @- k  v% I9 D5 s
   jnz     00650589                  ; detected# H  W. T) ], e) T4 g
   push    00                        ; OF_READ( S" C# d. j( J: C; A
   mov     eax,[00656638]            ; '\\.\SICE'& T8 a% D  r4 j
   push    eax
! w4 h% _$ o) j  Z5 w: P3 c   call    KERNEL32!_lopen& B$ Q# e0 r3 m# Y6 u
   inc     eax# B( t3 M% B8 A
   jz      006505ae                  ; not detected
4 O5 Y7 [+ \" C. J
% `( J4 H( v3 }! m4 @3 g% @2 U
  T8 k. Q& X+ l. f% j5 [4 M* \__________________________________________________________________________
8 a) o$ E0 z: @* V: O/ Y) ]; D0 L( v9 ^
Method 12
# L' u: j! s! \- ]# E8 q6 U0 y=========
. o% C' \5 X8 B$ Y& T
+ L6 ?9 l1 e3 w8 n3 |& |This trick is similar to int41h/4fh Debugger installation check (code 050 x. F8 {$ a5 b# C! w
&amp; 06) but very limited because it's only available for Win95/98 (not NT)' X$ I# L7 V4 p. ^  w
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 g7 i& l" i$ P3 T+ ^+ m7 q/ ]% b9 L
   push  0000004fh         ; function 4fh
0 L5 ?: i/ V( Z6 O. S+ z- J   push  002a002ah         ; high word specifies which VxD (VWIN32)
5 T: u$ s8 w4 v0 Z                           ; low word specifies which service* [$ }- c$ ^' N9 ^: R& X! t& {4 v2 Z
                             (VWIN32_Int41Dispatch)% y% V# Z% _7 j% Q0 {
   call  Kernel32!ORD_001  ; VxdCall' x8 `- n6 ~2 e
   cmp   ax, 0f386h        ; magic number returned by system debuggers
' G8 L$ |& e7 }% E   jz    SoftICE_detected
: }& b' f8 D8 M2 {' C3 Z4 H. j" j/ c) C4 M& q) I
Here again, several ways to detect it:
+ P& y8 t% D! T* [, W/ X  H1 R
8 L/ [) [$ a4 A' F: l    BPINT 41 if ax==4f
5 [$ C" }" c: R' E* _
% T6 Z' A: v* b    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& b9 M/ r4 L5 t& l
) T, [2 L/ P5 |* r* Z# S3 V1 E  u
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 u# V  z; D& T' s( m/ n
) o- B: a% v- F, s/ O7 x; F
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 U* P) a$ y6 e: d2 o% K) Y
2 {7 K6 ~, w* Y$ J3 R  I
__________________________________________________________________________- o- ?5 j; u; S* A* O7 S

0 u, i& V" u0 U, u* Y% p6 K; t3 sMethod 13( b- y$ v' ^! K- {( \
=========
+ |, w4 {( \7 E3 C+ Z' Y+ V. l- m* K' w1 Q: h, G4 A$ @7 R
Not a real method of detection, but a good way to know if SoftICE is
+ y: Z$ F5 ~! T9 Z5 Hinstalled on a computer and to locate its installation directory.
+ V" B* p+ Q( G, a, c9 WIt is used by few softs which access the following registry keys (usually #2) :
- }9 G. G, U) x) F  A9 |; |
6 w- E0 P0 V2 X( J-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; K& \0 |% M! b8 C" u0 B: r
\Uninstall\SoftICE
' K+ J5 H( |$ r8 |* I3 o: s4 D: \7 [-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% P5 c! Q/ r. ?4 G. E, ~5 Q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: _  G) Y; W9 d
\App Paths\Loader32.Exe# H' D9 }" q3 v3 b8 q0 V

" ]% O( ]( P& e" [( J1 ?% c, Z( j7 j7 g; u+ y2 b
Note that some nasty apps could then erase all files from SoftICE directory
& U& _$ _% D3 h# J( I  F(I faced that once :-(* c3 e1 A/ Y1 G; |; j% g2 B2 H
6 y/ r. h9 k& |' {
Useful breakpoint to detect it:
" ~' p# r% }4 j' Z( L9 g
8 `2 O# y8 l( R, S# U$ Z! y+ p     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 A: m( ^, L  u' F3 X) f4 n0 |7 c# |% H  M1 ?+ G- `2 V+ ~
__________________________________________________________________________/ J. h; o5 c- _2 O, C$ Z( M- G( e0 D

- ^8 s( `# L+ n- e- y% m  F+ D! d/ C# c  o3 f' ~9 W
Method 14 ( y: d' y, P6 y7 |8 I2 U$ H
=========/ w6 N# W! x/ V* n# s4 w

3 ?. }5 U1 _# sA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, |8 K0 T' j# g# t. U
is to determines whether a debugger is running on your system (ring0 only).
) |7 m' _& U& l& M8 a
0 Z) M0 i1 J+ P   VMMCall Test_Debug_Installed- n$ |7 W4 G" @) ]' `& ?! U2 D
   je      not_installed
4 P) `9 g# [. F6 h* M& S. p5 n' f( `( l  L- W) f. X
This service just checks a flag.
0 T5 X8 z0 J8 ]' T</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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