About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
4 I" \7 @4 j% h9 Z! ?<TBODY>& F. c. R( e: s6 ?, ]$ t
<TR>
5 G7 [/ `  ]  {% }+ o9 V4 j2 i<TD><PRE>Method 01 ! y4 ^% a2 d1 D
=========
' h5 v( ~1 d$ c7 q7 E7 s- I7 Z+ K: ]; ?/ E
This method of detection of SoftICE (as well as the following one) is
: t2 u* d2 t& U5 u0 Oused by the majority of packers/encryptors found on Internet.
- W- w. V, e' I" Q7 yIt seeks the signature of BoundsChecker in SoftICE6 v4 p. k7 n; E7 @( i0 b
* ^3 ^1 U8 h+ o4 W" D
    mov     ebp, 04243484Bh        ; 'BCHK'
( b0 P, u4 ^* `6 V8 j) z& U    mov     ax, 04h
4 @( _. Q  e% k% @: J    int     3      
$ D- o* y& D- g. ~9 [) b( e8 @    cmp     al,4/ P/ [' p+ o/ O, S( C# I6 E* ?$ W5 f
    jnz     SoftICE_Detected
1 I% b6 {0 v' L! t9 K; B. y1 c4 q8 V5 i1 u; v4 ?* x6 Q& ]9 p8 S
___________________________________________________________________________  G: i. U: u& i( M  Y5 ^* B  F
: M% |4 f% w! ]
Method 02
# t1 o' D; D  `! H. z. ~=========
, b' v* d0 A( _! a: ^- [1 o" w# v' r0 a+ G
Still a method very much used (perhaps the most frequent one).  It is used* |5 R" G5 Y* q& y5 O
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% i* ?; z9 h0 r: t" tor execute SoftICE commands...
' ?; ]8 p: B5 ?# p* B$ {It is also used to crash SoftICE and to force it to execute any commands% M. A! Q7 e& S3 b; O9 i! a' Y
(HBOOT...) :-((  9 b. ]% n( K/ ~2 X& v; L

$ y- s7 r1 {* R; m0 z$ \Here is a quick description:
) K4 z! g! e: k( d) ^-AX = 0910h   (Display string in SIce windows)* f6 D  {2 L: U) }2 o
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& c4 J2 }: d( p! G+ W/ [$ t3 h-AX = 0912h   (Get breakpoint infos)( U7 t/ s, ~9 P$ {7 _% m5 d
-AX = 0913h   (Set Sice breakpoints)+ l! M- g: w# |. i! [2 x
-AX = 0914h   (Remove SIce breakoints)$ G. Y, f; C  U2 W1 M
  _) {' R/ ?! {5 m
Each time you'll meet this trick, you'll see:
5 s1 K+ A8 m. _9 t8 k-SI = 4647h
1 z" [: s0 B' }0 A2 c$ @, R-DI = 4A4Dh+ @' e9 Z% Y. w+ V
Which are the 'magic values' used by SoftIce.  }) u% b6 S+ A/ g, J$ v. m$ I! u
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 M. I1 {& {5 H5 D5 v( {. F. X- v

2 t$ G1 f* \0 p5 f, I! \. AHere is one example from the file "Haspinst.exe" which is the dongle HASP
1 g& G0 G7 p4 X5 @Envelope utility use to protect DOS applications:
" |" x( U3 t+ z7 p% ]3 d8 t, W
. Y8 {5 g! |) y1 ^. {; p1 }( v7 A$ j9 B+ \: c
4C19:0095   MOV    AX,0911  ; execute command.
. X; ?  Z3 I# j1 t4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- w5 T& q( [  F1 \, h# v
4C19:009A   MOV    SI,4647  ; 1st magic value.
' \! m- u/ V3 C% f5 S: V( J! t: N4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
/ x8 W( P' u4 f, Q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" C' q) D$ ~1 H4 X
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  ?9 S+ f8 F* |. U4C19:00A4   INC    CX
! N* q/ `# i0 B9 H% F4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( D6 v: H" X1 O4C19:00A8   JB     0095     ; 6 different commands.
$ `# x/ E; m# t& _+ \4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 E$ j2 f  J, K+ B5 r5 @  B
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :). _' s/ ^$ }' ]9 F
9 M+ ?  j7 X) p2 Q  N2 h
The program will execute 6 different SIce commands located at ds:dx, which0 c8 z4 |: m, f9 f5 G$ E
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- h. R" Y: Q- ?& Y6 v, _3 i$ S, L$ l

0 V( q- b- \$ W. |8 Y: z. t" u0 b' y0 ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& a4 `0 K  s9 q' }* N6 L___________________________________________________________________________3 z+ g9 O' f  p6 x' b% y) `; {+ S
* t; b9 Y" v  x% p; s

, z% g! C3 t2 _Method 03% l. m% s7 D  H- x2 U1 x
=========4 P! c1 L- S& P2 l

+ {; Z1 u+ x9 T' w4 A, HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 c8 q1 r2 W+ V
(API Get entry point)
0 u1 Y3 D5 e' \% r( _! l0 I        # M  P9 r9 k8 L; ^% G! ~8 V# c7 f2 Y

6 V+ ^8 P6 z0 A9 H) g+ U    xor     di,di- k! }) b/ a2 J4 H5 i
    mov     es,di, H7 q; Q9 \6 j- J  v* B
    mov     ax, 1684h       5 C3 v8 ~! Z; N$ \+ B  y
    mov     bx, 0202h       ; VxD ID of winice: |1 t  t# @' F! ~/ S( h3 R
    int     2Fh
8 f" R& X; q/ _8 p) b& p    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, b3 ~  L) T. z; L/ ^    add     ax, di
1 L* r& q; M  b  o+ q! r    test    ax,ax
+ H6 j& J! C6 |8 t8 [, D# s: C    jnz     SoftICE_Detected
( W8 M* [1 f1 t% d; v0 l9 g! c
; g8 K' W3 j- x7 @: _) s___________________________________________________________________________) S  E1 r/ O1 k1 g) Q' ?

: j. s- W% M  q7 M( pMethod 04; U' g) J+ e+ L) ?3 }
=========# ^- ]3 G) f5 ^5 s

! V7 G& l! ?$ ~" g$ F2 _Method identical to the preceding one except that it seeks the ID of SoftICE
3 k' f9 C' ]' a! I7 T2 G9 A1 xGFX VxD.4 g5 g( t% C& G: w8 t
1 K  O3 G' d$ b$ V; ~6 m# v" M* N2 Y  j
    xor     di,di
7 j* b6 V9 i2 s* C- Q    mov     es,di
5 i2 z$ h* ?* Z/ a9 c% l    mov     ax, 1684h       $ p1 ^8 j0 [& k+ j" l/ K
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 c( B2 u9 c; R$ X2 B    int     2fh" e7 n& ?6 Y) ]& e" N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( h( _8 M) K/ |, A9 D: ^6 t
    add     ax, di
8 s" ?6 P8 E- I, X1 P: C. B    test    ax,ax
4 P4 Z/ D4 e# d6 t+ J) ^! s    jnz     SoftICE_Detected; H5 T7 L% X! V* x, \) r

/ N' W4 N$ ^, t: w  P2 S: R8 A, m3 M__________________________________________________________________________
0 K4 G" t, d  U) ^. i3 w+ d& A, j4 g- _+ X4 _
/ f' P+ c* A- Z, G* j0 {
Method 05
$ F# j* @+ l3 B( \5 @& c2 g=========/ x9 ~& g. z! w: n& J4 k* P( X

/ V) f' g. z" g. B  ^Method seeking the 'magic number' 0F386h returned (in ax) by all system; h) y8 b4 Y( ^/ k1 H2 P$ W, N
debugger. It calls the int 41h, function 4Fh.
6 m4 f) ]8 ?4 W4 z6 K* |8 [There are several alternatives.  
9 M8 d% C! Y/ R* n! p
; C# {+ n, M7 h9 h5 h) [% BThe following one is the simplest:
8 g/ B! Y5 f) i( m( U6 v2 @8 ~8 A- j, P- A$ o
    mov     ax,4fh3 c* H2 Y/ T9 [6 j( n
    int     41h! a% k9 C# ]9 }# |- S1 k: |. Z
    cmp     ax, 0F386
) ^( k+ k6 N4 @; D+ q. B    jz      SoftICE_detected- @% v% p- n  Q

. m5 ~- Z6 T/ l+ b& N2 Z$ G4 w( U, ~& d& Y& @; f- N' P
Next method as well as the following one are 2 examples from Stone's 1 r$ d" t* d) s5 V
"stn-wid.zip" (www.cracking.net):
7 f; }: e7 d1 C& K2 i
/ `8 [( F3 B6 s( D1 q9 ?( x5 G    mov     bx, cs7 U1 B' W2 Q3 r6 L3 c0 o0 k
    lea     dx, int41handler2
( U+ h: ~6 \4 |  a! N    xchg    dx, es:[41h*4]
( i* N9 A4 K- u! x# ^8 I  U: v    xchg    bx, es:[41h*4+2]
( }; b) [+ l5 Z! O* u/ {    mov     ax,4fh' |2 E4 m% g- E! B" z
    int     41h) ^' d+ ^% O3 Z9 ?, S+ R% K! B8 C0 v; B
    xchg    dx, es:[41h*4]; l* z1 P6 J$ E0 p7 \8 g/ q4 }
    xchg    bx, es:[41h*4+2]
; e- J, s) q3 L5 s6 Y) W2 _    cmp     ax, 0f386h
/ O; ]& e9 J% p$ F8 d, ^3 H4 V    jz      SoftICE_detected
) k. r  i2 V6 t& e, k7 F- g2 a6 w3 L/ H" A/ D, X: v, _# r
int41handler2 PROC! f/ I" O" y7 }$ Y- G
    iret& U, M8 h( W0 u, v  Q2 p
int41handler2 ENDP: R4 V& g. O# u, r. \4 ~

; W% s: d& x/ ?  Z3 v1 i9 P' @
  }% y2 P# H: v2 M_________________________________________________________________________
* N7 {* _0 s- v2 i& k( ~% j- W1 t7 O$ d) h" X
& f+ p" A0 u9 g* S3 P- B
Method 063 y0 ]4 j8 T& ]2 ~
=========' M( {9 m$ M5 E! k( l$ G( ^6 h
, J3 v7 j* J' k( G5 I
' n& N8 [% w! a/ @4 j% T& W
2nd method similar to the preceding one but more difficult to detect:/ k$ R3 m" c8 Z) y3 c/ W

4 O% }8 C  d$ d, I) g
2 S$ @" Z3 ?1 h0 O' g: gint41handler PROC
: C: e$ _+ `1 x3 p    mov     cl,al8 [" i) r* B1 T3 h* K( e
    iret
) G# d# s8 V* ?int41handler ENDP. K8 b( l$ g; n) g6 G* ]3 V

( ^2 T2 V! ~4 a5 ]1 E# G( f% k1 F2 `2 w  d4 M( u" \/ [, {6 W
    xor     ax,ax
9 x9 d, q% r& H" @/ P$ L* N: D7 ]    mov     es,ax6 `. ?! R( C8 B. L$ K1 `
    mov     bx, cs' f# m2 l4 M0 p$ S- v5 a
    lea     dx, int41handler
, c3 K1 Q0 @$ Q( S1 O% D3 l$ L( B) o    xchg    dx, es:[41h*4]
1 V" R/ t7 K* |; s4 d% Y( _/ k    xchg    bx, es:[41h*4+2]
4 r& O! j3 \. z7 {  P    in      al, 40h
: Y& W6 S( A3 J' w; J0 j    xor     cx,cx
/ h8 U: [/ d4 W9 r    int     41h, h: G- g3 ?" b+ S  Q
    xchg    dx, es:[41h*4]2 K4 q* u) i0 Q4 o- v( s$ m% H
    xchg    bx, es:[41h*4+2]
& ~4 `1 D* n, J# ], P    cmp     cl,al
: P* C1 ?2 w( \2 n! n8 B    jnz     SoftICE_detected
: R, ?* m" |' j6 n* }
5 L. k8 F! g$ [" l_________________________________________________________________________7 B( C6 Z' t7 e+ t  |! ?; K/ M" M

* I' `2 L3 }% v+ B  Z, @3 J* TMethod 07
: L9 x0 F) U# M9 s1 z3 Y! U$ \=========
8 Q! z. S) z$ k0 s
* u% G  ?+ t4 s, ?9 ^9 @/ MMethod of detection of the WinICE handler in the int68h (V86)9 t* c' k7 N) m! h( q

' ]- x8 _" x8 Q( B    mov     ah,43h
5 p! _2 F. {0 b    int     68h
; Y, \, \) H3 S1 ~' b) T5 k    cmp     ax,0F386h8 B! f) K( P' _8 t3 v$ ~
    jz      SoftICE_Detected1 Z) t! ]* N* e) q! N

! D" X1 C3 |1 y; F
& _: y: U4 U$ m, z3 h=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 Y3 m/ Y% k1 M$ ?! B) R0 W   app like this:
3 t( l1 m2 O! Y+ A: y$ P) u
, |% a/ [2 j$ K   BPX exec_int if ax==68# [8 H+ X* x) s3 O" f) d
   (function called is located at byte ptr [ebp+1Dh] and client eip is
( T& X4 K) W9 W! a   located at [ebp+48h] for 32Bit apps)" q8 X/ M9 @& g$ S$ [* z. B* |
__________________________________________________________________________; x- j7 N. U+ Q
2 `3 K1 H. e. U( _
' v9 s% S  f9 ^3 U5 ]1 O
Method 08
9 @# A0 ?6 c! o+ z" _( v=========
2 X: P' I  p6 _' \) @5 K$ F  y, _; `8 G0 Z& Q
It is not a method of detection of SoftICE but a possibility to crash the5 b* o# {' Y0 o: |7 ]# j% d; L
system by intercepting int 01h and int 03h and redirecting them to another- K1 u; l  T- G. s* \# \! B! k( r
routine.
; E# E2 T9 j% H. v* r+ z5 @It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ O- U0 S3 h& r
to the new routine to execute (hangs computer...)
% I/ A- X  C4 Z# @; I& E' `$ {8 E8 z
    mov     ah, 25h
6 V+ n! S* R6 e) r    mov     al, Int_Number (01h or 03h)7 j. u$ l* G4 D5 [) G  s
    mov     dx, offset New_Int_Routine6 O5 }3 c0 [/ o  X
    int     21h
" o$ R  r& I" V* L% w/ B4 @
' T) U5 S4 Y9 _; y/ F1 I3 t__________________________________________________________________________+ C% k+ K7 O. J8 u
7 o( L  T/ [- ~
Method 09# A4 a7 s  Q7 ?' U6 `
=========" s+ \2 `; S3 i$ P9 \

' y# `8 ~. v. r" e5 V. oThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only& x1 Z1 d& Z1 M+ m: f
performed in ring0 (VxD or a ring3 app using the VxdCall).8 M* r1 B5 @" z$ D% O3 t
The Get_DDB service is used to determine whether or not a VxD is installed
6 q, k5 V1 J7 U. a0 w& Wfor the specified device and returns a Device Description Block (in ecx) for
0 y2 A$ {# g9 R$ e- ithat device if it is installed.+ p5 k4 }6 T3 p- h

. m9 Y8 b- \. W/ f9 R   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 ?4 j* M9 q8 P: Y
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
/ P2 Z# g1 W' `9 w9 N1 j   VMMCall Get_DDB
! N% \4 ^: t; s1 S# @0 D$ A   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
4 n& F8 Y% V/ b
' @6 v6 ?6 p0 }* J1 [8 kNote as well that you can easily detect this method with SoftICE:6 D* p+ d$ Q' R$ }
   bpx Get_DDB if ax==0202 || ax==7a5fh
' V. Y" \0 ~2 T$ d% C) L6 c
/ U4 s+ O( |- ~. F5 a( j__________________________________________________________________________: q5 M, G+ a/ @

0 }! y" \7 Y' w& \6 c& [% B& m& u8 }Method 10, M9 U) O" M$ O+ Q% F) V+ `' Z3 J" V
=========+ h$ o/ ~) v" s

! j6 X# v5 h& F. Y# X6 A5 K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# c8 c" u3 j" w7 ^8 Q8 j
  SoftICE while the option is enable!!
) \9 j% q* ?* j+ p7 _8 i3 s, x
" I7 L7 a7 J. y* EThis trick is very efficient:" C9 d$ P) r/ H% d+ K) M8 d
by checking the Debug Registers, you can detect if SoftICE is loaded
4 R$ W* A' p8 V% o, M5 M! l(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( @3 y+ o- j: \/ W+ E3 [7 v- m9 W
there are some memory breakpoints set (dr0 to dr3) simply by reading their( v+ v- p) ^# F& v3 X7 [5 j
value (in ring0 only). Values can be manipulated and or changed as well9 P) z+ J$ P; C" v
(clearing BPMs for instance)( R; c7 J- P8 T% P; M/ H% o! w- @

( t+ `  g; V# O2 e' J, \__________________________________________________________________________6 v# [$ P. O" L/ r8 d

8 l6 v2 R4 Z9 e3 }( sMethod 11
6 u6 I+ V8 E* b- l- [" G* _) V9 T' B! h=========: O4 \6 R4 v6 a/ n( O6 _6 Z: s& P

. [  X' S) q& o" ~This method is most known as 'MeltICE' because it has been freely distributed* b% C7 C( x# N  d  p) P. V7 n3 \) X4 p
via www.winfiles.com. However it was first used by NuMega people to allow
: ~* E; D, a& f; D1 _/ @  ?Symbol Loader to check if SoftICE was active or not (the code is located. N; j2 l: T* \5 F, D9 k
inside nmtrans.dll).
3 k. ~" w' B: \5 J+ d1 Y+ `7 T
7 v$ \, E  x+ h0 W0 W2 NThe way it works is very simple:
1 K# _) p/ T. g% V2 b5 R+ mIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
8 T0 R* D: ?! x- j. RWinNT) with the CreateFileA API.
+ b, G3 Z. _6 `+ Y
1 r. ^5 M2 U8 b" ?' h5 c7 n8 {Here is a sample (checking for 'SICE'):- B2 s" \! R0 r/ o4 f& }
$ {: u% o" W6 t" ]5 z5 I. F, Z
BOOL IsSoftIce95Loaded()
' }; ^% v! |5 f  c/ F{. ]& p. y( q. u; L
   HANDLE hFile;    V4 N/ u' _' C: v5 W7 }% t% f3 ?
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,2 I1 D; p6 }' F+ ^9 @
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# ]: y6 E0 }- R4 N6 E$ p* h# {$ j! Y                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
% p8 G$ z+ G3 G2 _9 _# G7 a   if( hFile != INVALID_HANDLE_VALUE )
& `- T: ]$ f, O+ _5 Z# O0 i% m) o   {
/ e3 t- q# {( e3 S      CloseHandle(hFile);
% _" C+ K9 U) n9 H" Y% e' q9 P% d      return TRUE;
+ C; R, N2 p4 }, A   }
7 V8 ?7 Y, B2 \  y- r# r4 r   return FALSE;7 X3 g' ~% V: K2 n: y
}$ m$ u/ e  l7 H  K. @) j; f
# U" _7 E; S: b4 ]8 Y$ a3 g) p8 {
Although this trick calls the CreateFileA function, don't even expect to be8 h5 W- {# }( n( V: X, C
able to intercept it by installing a IFS hook: it will not work, no way!
) v% U- w5 ^5 zIn fact, after the call to CreateFileA it will get through VWIN32 0x001F8 J( M6 o3 {% F- ~: C
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; a/ ^- R1 V* n  Pand then browse the DDB list until it find the VxD and its DDB_Control_Proc8 t4 Q5 ^0 p$ R2 f
field.. V; n! N( @0 W, k. p" c+ k- V0 N. o
In fact, its purpose is not to load/unload VxDs but only to send a & v3 M0 e$ \! L9 n4 p8 ]
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 z  W8 K4 l- p( i" S2 e/ [! Z7 g5 @
to the VxD Control_Dispatch proc (how the hell a shareware soft could try* l# w) q0 ^% x6 ?
to load/unload a non-dynamically loadable driver such as SoftICE ;-).2 Q- ?/ U& ^. o: ~
If the VxD is loaded, it will always clear eax and the Carry flag to allow$ q2 x2 z8 O) k9 i
its handle to be opened and then, will be detected.+ m6 r; H% a3 j5 S  W3 v
You can check that simply by hooking Winice.exe control proc entry point
' a4 v0 [( C  r3 F5 y8 V9 _" Vwhile running MeltICE.
! p/ ~1 k$ \- {* i  p+ _. B
8 |4 X* _( W+ e& o  r; I, r4 i3 L: N- y$ H2 h) ^
  00401067:  push      00402025    ; \\.\SICE' h) P6 Y# ~. N& w
  0040106C:  call      CreateFileA
3 |4 t. R" r. b* g9 f  00401071:  cmp       eax,-001" Q# _6 S( M; M- r
  00401074:  je        00401091
* e$ N- O1 K& R* o* x
1 s( B1 k6 |% j  V- M/ r
( p5 ]) b! C; [2 GThere could be hundreds of BPX you could use to detect this trick.
1 T5 S/ C( X. F  |-The most classical one is:( e0 k- s6 A" c- a0 S8 H, ]1 Q1 k
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
: R" A0 _( ?$ N    *(esp-&gt;4+4)=='NTIC'
; I5 @( s* |. ]5 F1 ~, m( R
5 Y  T$ P: [* j. Q5 f% {. D-The most exotic ones (could be very slooooow :-(
- w. Z8 v, D# J" E% e   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  2 [$ t3 \& T4 u) Q6 U5 H: ^8 O
     ;will break 3 times :-(: g# B4 r9 Y3 f$ h2 o+ R- f

$ ]; d) `) n7 G  n8 x-or (a bit) faster: 1 Y6 u4 Q5 k2 x2 h
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
5 ~, @$ W- {5 p  I
; _' \, U1 H  m+ x$ d( X% I   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
$ o) h( G' U/ N& h$ Q& p' b: o     ;will break 3 times :-(- i' `) z; a2 c! L  {
/ o5 G; ~  Y: \8 a* z( x% F) B$ w
-Much faster:3 _# a2 J& C( ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% |% S$ H9 W% l* H. W( W
: f+ o" q" z8 x- c+ k& }- m* Q: LNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
, \( h) k- A1 v' o4 [0 ]7 x+ `5 ofunction to do the same job:2 U9 _5 W6 O& }
. Z- D% q8 `- P4 ^. z6 r
   push    00                        ; OF_READ
' C+ C5 n9 ^5 {7 I   mov     eax,[00656634]            ; '\\.\SICE',0
; z* H; z' b  a   push    eax& U7 q7 V6 K: l: J& b6 p
   call    KERNEL32!_lopen
0 x5 D. q. F( T/ `9 D# W   inc     eax0 L# c( Y! f; G! @; D: L
   jnz     00650589                  ; detected
1 ^7 p+ e  u  g1 O7 x   push    00                        ; OF_READ1 @0 |! h3 d% s$ i- z4 p
   mov     eax,[00656638]            ; '\\.\SICE'! ~9 G. G9 ^& m
   push    eax$ C/ f  |; T# B. d9 g: W, \3 _! J
   call    KERNEL32!_lopen) a8 K, s4 a0 _: S  X$ Q
   inc     eax9 x9 J! W* ~( y
   jz      006505ae                  ; not detected! e! Y/ \$ S6 |( M6 o% M, ?7 ~
/ j. \3 B! z) O6 N
; i/ ]7 S1 Z, O$ b6 j0 {
__________________________________________________________________________2 l: G9 F  S+ V* `1 N3 Q* b
4 a7 Q# ?0 e1 j0 q2 y' L+ u
Method 12
& j, f6 }7 d- ~7 G8 j" x" W=========
% D2 F7 S3 g2 i) E2 s) I0 x- M2 A! x7 u6 u& g
This trick is similar to int41h/4fh Debugger installation check (code 05# Q( Q$ v( O% j3 K" B
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- W1 v( x  W5 b. tas it uses the VxDCall backdoor. This detection was found in Bleem Demo.; L5 T5 F1 p4 N+ Y  W1 X: D
7 `5 {7 k  Z; E6 j& @" _
   push  0000004fh         ; function 4fh) O4 q* [6 q5 }5 P
   push  002a002ah         ; high word specifies which VxD (VWIN32)2 ^$ Q+ B* @( E* R
                           ; low word specifies which service
& L$ \# D6 b% R, x                             (VWIN32_Int41Dispatch)# L- j9 e' h! W* e
   call  Kernel32!ORD_001  ; VxdCall
* Y* U% C: g: X0 c! ^" m0 `) ^, O0 T) d   cmp   ax, 0f386h        ; magic number returned by system debuggers! d3 |1 h$ q: g8 f$ x
   jz    SoftICE_detected8 ^" a* @) p% {* a: b

/ j2 t6 d; s9 ]& g; C) }7 ^7 G8 R7 SHere again, several ways to detect it:
+ ^/ ^* C) I0 Q$ V0 Z" t$ m: z% Q( W4 O; @  @2 N3 W8 s0 `
    BPINT 41 if ax==4f7 b6 `- ?8 `8 t6 X2 q9 ~( |. }

& A, N$ N! Q0 i( ]6 S; g# V# k    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 s- j0 G( h4 I$ G! Q/ D+ \: U0 S9 G
2 h5 z$ Q' t( w! l! S
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' a& ~9 s. I& V5 e$ z
: o8 F+ t5 M+ u" ?    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* E4 d" Y% i2 H7 b# s9 s. O
" U! [( f6 l1 j/ s__________________________________________________________________________8 y: p: F. ?; `

# c; J4 {. E" z( O( y- ]$ `4 lMethod 133 L' d" a" D) b8 D6 M; O
=========& b* U# \$ t$ h! F  Z
1 w4 O' Z- _3 x  N% a5 m6 k, [
Not a real method of detection, but a good way to know if SoftICE is
# U8 u, B# C' m+ ]installed on a computer and to locate its installation directory.
" |% H! F6 c/ X+ f! CIt is used by few softs which access the following registry keys (usually #2) :
" J% n& Q' B6 u/ K$ g
" A: \! F$ V& m* I+ G% U- s-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 F8 _/ o2 Y2 [" P* C, f, B5 c! X
\Uninstall\SoftICE/ @0 b- u4 F; n* Z
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, F5 h! v) ~, q4 h. s! {
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" s8 L6 F; b5 A+ l) j! g
\App Paths\Loader32.Exe/ ^: ~5 H4 f3 r, Q% v$ n

% X/ C2 I( e2 j
4 [5 T( b( ]+ g9 U4 R- I7 G8 MNote that some nasty apps could then erase all files from SoftICE directory
5 L( p+ Y7 c# ^  k8 g- D6 ?( F(I faced that once :-(
. \7 w8 ^2 A2 C4 R4 ^& a. h# B* t9 q9 H9 j( [8 `+ O
Useful breakpoint to detect it:  k3 I; h% [5 d7 _
; J/ k( z# E' W5 u# t  I, g
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
4 \4 c. Y- t1 R5 e; x3 W: f
( c8 x+ D% U% V$ a__________________________________________________________________________0 R3 r/ o: }7 h' i
+ C: T) B& h8 ]0 E  F/ P
+ l) k+ w" Y; Y7 ]6 f  T
Method 14 ! `+ k, r; @" O7 m- g4 l5 F
=========" L# [' A$ e" P/ j4 Z& ]5 W: V
/ f/ e& C7 ?0 @' E  _' _
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) U2 N# K9 J) J1 z2 _/ N! Kis to determines whether a debugger is running on your system (ring0 only)." p0 q/ x- v- T( {
. r. W- |" H3 B
   VMMCall Test_Debug_Installed
. _! U9 g2 ~$ x5 n, W3 j   je      not_installed5 ]/ G* A2 O0 Z
! |. g) I, B; o! o& z& C9 n2 S, B  ]& ^
This service just checks a flag.: O. ?( K  E' J3 T3 d+ J
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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