About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># T! \1 y3 a- {& `1 o' g
<TBODY>
& S  ]' p8 _1 Y( p<TR>8 `" l  q2 z: r( p
<TD><PRE>Method 01 2 D& p. C5 Q% c" e
=========' K: @" w+ N* f$ }

  j+ q' m. J0 K/ f. V( G; i# wThis method of detection of SoftICE (as well as the following one) is
, i" c: G: Y9 m. ?, ?, Y9 {7 Hused by the majority of packers/encryptors found on Internet.0 x' `7 X6 k  h2 _, x1 O
It seeks the signature of BoundsChecker in SoftICE
# i0 ?# O1 G9 ]* v6 e, f% F) |
+ `$ Q' k+ _5 N# n% O2 S* U1 n    mov     ebp, 04243484Bh        ; 'BCHK'% m3 _  X6 a7 i. I9 \9 \. O" F! d7 z
    mov     ax, 04h7 x3 {1 c2 y, x# m
    int     3      
8 f6 Q+ {! i' P5 t    cmp     al,4
- o& Z0 g9 q( l8 q) j2 A4 f0 d    jnz     SoftICE_Detected' Q1 C! ^) t) m( f
! ~; O3 l5 g9 P3 N
___________________________________________________________________________
. [. e# r5 H4 `: F% T) o6 O% `$ _
& `5 ?. T, Q) Y4 Q0 U5 nMethod 02
1 V8 @$ o! h' h0 t7 ^  F7 m8 C% l  C=========) J4 v% i( M+ i: H; A9 x

$ S& `9 l) }) i" D$ ^! TStill a method very much used (perhaps the most frequent one).  It is used6 h* _3 O/ e/ ?7 H( z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 `7 V2 p% M+ {3 H8 c* K. J
or execute SoftICE commands...* h+ U+ X4 X, S. _! ?5 l1 Y- F
It is also used to crash SoftICE and to force it to execute any commands
2 V7 B* @8 z( W/ y(HBOOT...) :-((  ) b# @  A. Q" K, c/ O

6 S4 y4 Z: K6 I" p8 A0 O+ I8 ]Here is a quick description:. ]/ w1 Z  P( f" Z2 w( x
-AX = 0910h   (Display string in SIce windows)
( G4 S  z) ?: ~7 w+ C* ]-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)* a% P  ~  l7 j
-AX = 0912h   (Get breakpoint infos)) o- c1 e& J. }
-AX = 0913h   (Set Sice breakpoints)" D; v7 e: z) w' s8 e/ u, P+ \/ X
-AX = 0914h   (Remove SIce breakoints)6 N" a+ \- ]! f! @; W1 X
( h1 Q" Q" A1 X: d) a/ v* j* X) |0 d
Each time you'll meet this trick, you'll see:
+ X; `1 O$ |& U3 @2 Z-SI = 4647h; u. Q- g9 T2 h( ]! D% d% ~4 T
-DI = 4A4Dh
7 h  D9 N- s) k# M. XWhich are the 'magic values' used by SoftIce.! m; L2 Y. s, W3 W- o
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& d4 D8 |; ?$ N9 I' b' t$ W4 U" [
  R5 [( n7 X2 G, I& g, O8 ]Here is one example from the file "Haspinst.exe" which is the dongle HASP9 S! f6 m2 x; N- I3 R- c
Envelope utility use to protect DOS applications:
& B0 L5 Y5 J, s5 H. o
1 o4 h8 P; @3 p* v+ z3 O# L, I
* n" E/ G/ D6 P4C19:0095   MOV    AX,0911  ; execute command.
9 `+ f: M$ A. z8 i9 n4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).0 S- N* m  ^. t
4C19:009A   MOV    SI,4647  ; 1st magic value.9 [5 h+ w' l8 a3 {
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
% u# q& e) M9 M6 Y3 Q  Z4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 k# Z" i( x$ H: B+ y6 m
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" B; C. V6 k8 i# s" @; x6 d( X, p4 V
4C19:00A4   INC    CX
" {; O8 B1 V0 u4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
. O- R% n; Z; _+ d2 i9 P4C19:00A8   JB     0095     ; 6 different commands.: \2 F9 v7 {$ p1 i' x9 S7 J
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 t% o  t# `7 ^$ s: ^* s4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
4 d) Q" q1 E' P# u- V
" ^5 o- j. k# l  |The program will execute 6 different SIce commands located at ds:dx, which
# H, x7 t* V& ~9 Q3 k$ Bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.) o& ^8 F! j+ E. I4 k  T
4 B8 \4 w1 v2 v+ S8 F1 T* o  H
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.+ Z# \# Y  Z$ M2 H4 o6 N
___________________________________________________________________________2 I" r) P! \7 D  ]8 E

0 p! v0 I) V' k& O$ {7 F6 E, ^. |; O9 Y
Method 032 U6 v& a6 [8 D- |1 @) i1 ~7 g7 S
=========
- |1 y4 z$ ]7 D8 a6 O8 |9 D0 T  y2 n0 B& P; f0 T
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h- K* u1 v$ g9 V4 H2 x4 p; |8 c
(API Get entry point)
1 U/ L7 w, c( R# g# c2 h6 ]        ; E5 R. x: f7 I  Z/ x, J$ z+ u

  Z* s6 v9 `5 o5 c+ u    xor     di,di
4 {& y; i: h! b4 Q1 W2 r/ f! {    mov     es,di9 p2 ^7 L' A* F6 o( Q
    mov     ax, 1684h       + ?- w) a# D' \; R
    mov     bx, 0202h       ; VxD ID of winice
6 C6 f" R0 C" d8 q  f    int     2Fh
2 T" G$ S2 K3 D1 V$ d9 Y    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 n- U  j0 L  Z  d( t
    add     ax, di. b# Z' q: E1 i0 \% F1 {' S
    test    ax,ax6 ]3 X) j2 j% H% r/ Q' C
    jnz     SoftICE_Detected
5 U0 B7 s5 h  N) V- u$ L5 }$ `- F9 S( W! S( ^
___________________________________________________________________________
' S  a/ ^9 z" @2 H0 a
, h7 A+ i+ I9 \Method 044 l8 `- o+ `( i/ B- l* f* ~# H# I
=========# S6 H. s8 {+ L0 L4 r* R
) g* o! V. K: k8 y- z( c
Method identical to the preceding one except that it seeks the ID of SoftICE
/ P7 P$ y$ {, h6 W/ \6 N1 z* GGFX VxD.
: U& e, Z7 \1 e
. f  F$ u; L# {# y0 u    xor     di,di
& ~5 F# V5 ^0 _: V' \8 \    mov     es,di
3 ~: Y0 P; I% @6 g: L/ J. D    mov     ax, 1684h      
4 F  }- N5 b, m' f5 e/ x% i: U    mov     bx, 7a5Fh       ; VxD ID of SIWVID, F4 J) U* d/ h+ f( B
    int     2fh" \" Y3 E5 V( z; L# j/ ^
    mov     ax, es          ; ES:DI -&gt; VxD API entry point' [# L% e1 I$ x" v: P
    add     ax, di
$ p9 }" I1 f  u6 {+ a# u% Y    test    ax,ax
8 y9 S0 A/ T9 r$ ~, |: C# w# a    jnz     SoftICE_Detected
9 b  K+ s+ R6 l0 o+ w8 _# f
9 Z! w/ y! c8 `) Y8 D* X" O__________________________________________________________________________
7 |7 {& h1 y8 o1 Z
& I& ]2 V( k7 ~# B; p, X
2 o# B- _* ]& g7 W2 qMethod 05" y7 b& W6 }9 ]
=========) e2 W: r6 q& a: g+ s0 V+ V9 S

& @1 O3 M5 T9 y  z0 G& c; ~0 t# oMethod seeking the 'magic number' 0F386h returned (in ax) by all system- G5 r" O% S: Y2 n0 l! v
debugger. It calls the int 41h, function 4Fh.
: t1 q5 p4 m5 Y+ [+ }% \There are several alternatives.  
8 M7 Y3 F1 U! K- i& r, A1 o
8 h9 B7 q5 g+ O. {. LThe following one is the simplest:7 H; s6 H: f: V8 a+ o* T  d1 w
( k9 b, C1 G$ H. D4 G9 a% A
    mov     ax,4fh2 q, j7 d4 J3 u# T) g+ t- c
    int     41h" s% F/ ~' r$ d# m( {7 J- b( V
    cmp     ax, 0F3868 B8 p( a5 R# v) J
    jz      SoftICE_detected0 `9 q( L* }3 K2 r
4 O' Y' S: M' g6 h8 d; ~

' C( k6 P# ?! n' I% U1 h1 q( t8 yNext method as well as the following one are 2 examples from Stone's
6 W1 y% i6 W6 m. G- M4 }' t! ]"stn-wid.zip" (www.cracking.net):
; B+ d, ]) p' l0 p5 F  a- S" A& _9 _  T( @  z* n7 V, M1 J- R
    mov     bx, cs
% m! J8 s$ E8 d+ D3 m* ^+ [7 \7 D    lea     dx, int41handler20 a6 E7 ]0 H/ q* E/ r
    xchg    dx, es:[41h*4]
/ c! ~3 w2 r$ k% f; [    xchg    bx, es:[41h*4+2]
: R2 t2 @9 D5 S2 E+ @/ f/ V, y. ]' G    mov     ax,4fh
" T( z2 r7 J, t    int     41h
* m! |, S% s3 S    xchg    dx, es:[41h*4]/ J* o. H8 r3 a: t
    xchg    bx, es:[41h*4+2]' O3 Y, @. G' e& g
    cmp     ax, 0f386h) {/ F5 R) h3 }2 a3 P) n+ h
    jz      SoftICE_detected
9 _3 y. d! s% [9 I
: X; a; V, f1 [# \( B# Mint41handler2 PROC2 s  j' Z6 `& F2 D
    iret) p+ F' m$ |) ^2 R$ g' b* p
int41handler2 ENDP' t% j9 `2 p7 q' S% u
) {  S# ^/ J( c* ^
' N: |( Y+ f+ {' Q6 [
_________________________________________________________________________
* P) \, S5 w% k  h- T! d6 y, k7 x! F$ |3 z0 ^  H6 B5 B1 p4 ~6 C
+ z0 \, I# G. _9 C& O; d
Method 06' y% s9 w5 X$ P6 Y/ b! Q; F+ E
=========
) [8 }) x+ U& b* Q$ u7 f+ P% I6 J$ Z8 X' o

( V* |+ K$ W9 l- r! B2nd method similar to the preceding one but more difficult to detect:5 \2 w$ O% J/ A5 E: c
5 Z' ^  ^. x: D$ W
- @" P7 u2 h6 q& i- D3 [
int41handler PROC
3 N# Q$ F' F! H* [" C    mov     cl,al
' _* d" b( l5 Z  c    iret, n- j! v  C0 r4 H( y* H3 l
int41handler ENDP
, h1 H% d6 M( d' o9 r7 C6 d* x+ Z3 e+ \% m9 _
5 z5 D: E* u* Z1 r9 W6 P
    xor     ax,ax
. ?# D+ s" F1 _& e, \. {    mov     es,ax
% D7 ?& {9 {& u6 h    mov     bx, cs
3 }0 w6 }, i& J6 @$ k* S    lea     dx, int41handler
/ }0 {* g" _. z    xchg    dx, es:[41h*4]
& W' L$ g3 \2 T$ J7 u    xchg    bx, es:[41h*4+2]
2 T6 ^, h$ {4 r0 U% U7 T8 s    in      al, 40h: X& `; c8 I7 N( D* W
    xor     cx,cx
# i8 [! e0 D2 P# ^2 m    int     41h+ J: ?$ ?% V9 I1 D7 c( K5 S
    xchg    dx, es:[41h*4]
3 I- z% s6 N% [5 Y    xchg    bx, es:[41h*4+2]% _2 @9 j/ ?* ^9 X5 L. B
    cmp     cl,al# X2 ^: `( V" Q# {; a: ?
    jnz     SoftICE_detected
! E( ]; J' F, X) R) u; M
) W1 p" I  u( P- F9 W_________________________________________________________________________5 y$ ]/ }+ Y  c, z+ h4 `6 y
; @3 d% [1 B' _" u, [
Method 07
! y/ \1 x8 ~, k7 t) r3 M* k=========3 w3 K$ Z8 A$ e2 A
  c2 \( ?8 b, O' {+ ?& |4 g
Method of detection of the WinICE handler in the int68h (V86)! X4 a' b/ R& o- z7 N
( G6 P0 }) e7 Z3 t- W" B% i) D
    mov     ah,43h5 q- `$ e, S4 Z8 @) h0 u
    int     68h- A0 ^4 y+ q0 A2 F" x$ b
    cmp     ax,0F386h
; c# V% ?0 Z4 P; u: \( T' k    jz      SoftICE_Detected
) K* Y8 {8 W* C; C' [" `
: O0 a. W3 C. d" f  _: _/ ]2 S: S6 k! S& O3 o2 c. h
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit( H8 O- {' D! [" s
   app like this:
/ p, H& i8 g; J+ k. J9 l" K$ Z8 q; S# H) R. J/ m5 ^
   BPX exec_int if ax==68$ J) X+ `3 B4 `( r" T# g$ q1 H; `
   (function called is located at byte ptr [ebp+1Dh] and client eip is; [5 g% T, B1 H5 B8 {
   located at [ebp+48h] for 32Bit apps)
! X: j6 ~2 K8 H9 I1 H6 f0 S__________________________________________________________________________* K) R  e# o# ?6 T* t  f

5 U( K- \7 G: O3 u0 p
5 ~6 w1 Q2 J6 i4 W  A, x" MMethod 08( t6 k9 ^, M" v+ b0 q, Q  k
=========
+ V' I  k6 W+ V# v7 l0 `" S1 r
* o/ t, O3 z' y# ]It is not a method of detection of SoftICE but a possibility to crash the- x8 ^1 }9 F- ^% J# K+ o0 {
system by intercepting int 01h and int 03h and redirecting them to another6 i4 S" z8 n# ~+ h4 X* ]; @
routine., }9 ?" z5 Q( ]. N/ \' D# @
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& w4 O4 [6 \; c7 H
to the new routine to execute (hangs computer...)
. [4 ^  p7 Q4 m) S) k: x+ g+ I" L! R/ Z* p  N6 }
    mov     ah, 25h
- n$ H2 d+ u9 b% E- i    mov     al, Int_Number (01h or 03h)
! C- s% t, S* f) s5 l    mov     dx, offset New_Int_Routine7 A4 \$ ]! t: `: j: {  O
    int     21h
3 v0 }. \2 I4 Y- \# [) s$ V+ V2 O2 O7 Z/ U) X
__________________________________________________________________________( u& h1 L2 y5 E+ y6 \& W' G
+ O# z+ A4 x! Q; j$ e; B1 L" t
Method 09
' H: A' v3 B1 D' n; L=========
7 q3 B7 g& y! z; c9 u) i4 F( C0 H8 e! C! Y% A, \# @1 A9 l% E
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only8 Q3 b2 y. m' c5 O, c( Z+ d
performed in ring0 (VxD or a ring3 app using the VxdCall).$ ?5 L6 t, w" _/ R
The Get_DDB service is used to determine whether or not a VxD is installed( M3 u# B3 X3 v6 J  b
for the specified device and returns a Device Description Block (in ecx) for, Z$ ]1 L9 T4 u, `9 U2 `
that device if it is installed.
1 i/ v9 Q7 `. r
# E" N0 ]1 x' M$ D5 Y: C, b   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# k. o  B* q& S0 n% v   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% b9 t$ v1 M5 E0 ?1 [3 K- K. X! @; W1 z
   VMMCall Get_DDB! G' q1 r3 V+ o6 h7 _$ B+ `4 g
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed( Z, L% r" x5 s, [( y. Y  S0 k& a

, A% d9 o* F* h+ e" y, n! Q' v; cNote as well that you can easily detect this method with SoftICE:
/ V( R9 v/ n7 e6 i9 R# I   bpx Get_DDB if ax==0202 || ax==7a5fh( |0 g1 V% S7 {: F( |( g: [
7 K: N- G, `) \9 ~: `/ T
__________________________________________________________________________  K% A0 {. [+ ^1 V1 B- E
& _6 V6 f4 g3 _2 {' w; f
Method 109 l8 h' o$ `: n& ]% S1 q& S
=========; k: J3 a2 ^# [  t) r
2 D# a+ u+ E" u0 I
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with8 k' j4 o5 _' H) ]: S7 m& a- u
  SoftICE while the option is enable!!% C1 m% {9 y: @3 D$ f7 Z4 N) h4 I
% s! _5 R. s1 r+ g
This trick is very efficient:1 D' z* k. L' i# F* S4 O
by checking the Debug Registers, you can detect if SoftICE is loaded
* G/ L4 ^1 Y4 ~$ X(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
+ `, b  ]( m) E2 I5 othere are some memory breakpoints set (dr0 to dr3) simply by reading their1 a3 d3 [5 m1 L+ e! h9 {; }- q" C
value (in ring0 only). Values can be manipulated and or changed as well. w, N* e. E' L& `, h
(clearing BPMs for instance)* X, ^8 U3 k+ [, e' [" C; Y
, M" b- C9 }" ?1 D# M
__________________________________________________________________________* e  a& e" g% X! p" d4 ?( _' N! X

4 r. q! y/ j( B( N& W# p: z) `9 fMethod 11, r5 c+ g' I% V3 \4 H
=========  L# g5 J3 I" q2 E( M2 k

/ q9 L, Z9 J  a. G5 RThis method is most known as 'MeltICE' because it has been freely distributed- r: m  b' J4 p2 H; c7 P
via www.winfiles.com. However it was first used by NuMega people to allow) T3 P3 L) ^& R. h4 ?
Symbol Loader to check if SoftICE was active or not (the code is located
. Y9 N6 J; k& g9 @- M) x+ C- t2 [# _inside nmtrans.dll).
! b! a1 H2 b3 }
* L" D8 j% H8 e; [% s. l) \The way it works is very simple:) M$ O6 S5 j: L9 v% o
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# o7 \" K9 \( f8 A4 |1 |WinNT) with the CreateFileA API.
4 q. p" i7 y& r' [( [+ S* Z5 F
$ S1 |1 W8 |* e- y: lHere is a sample (checking for 'SICE'):$ Q/ c! c! f; N: ^7 ^# Q3 f
$ u' U3 Y5 w, v6 F" r1 p, m4 `
BOOL IsSoftIce95Loaded()8 u- a& ~) V9 x7 f3 ?
{
( _" L4 `+ B' R( ]8 ]6 B   HANDLE hFile;  & @. L! A# }0 _
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,- e. Q4 L3 @% _8 f
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! q- g! C. D0 m9 I' R                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( F  i' e- u8 v5 Y0 \   if( hFile != INVALID_HANDLE_VALUE )6 }0 |* p# |& ?
   {# i2 \( }' u7 x* ^
      CloseHandle(hFile);
* C2 D* {: a! N; h5 c/ S9 l: @      return TRUE;
* _) a: j. _5 N, a; a4 |   }
, T- ~3 i2 a3 @8 u3 K3 l% t   return FALSE;  j" m! D7 {& l  n2 Y
}
4 w# t. a* w$ P& t, D3 e
0 E" i5 ^; ?% b1 F" {; O: FAlthough this trick calls the CreateFileA function, don't even expect to be, Q/ G5 v3 u5 L) N: C
able to intercept it by installing a IFS hook: it will not work, no way!& M* g0 [) r# A/ E
In fact, after the call to CreateFileA it will get through VWIN32 0x001F0 m# p$ c- W! W" _$ C
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 g: W4 |8 h" j* {4 yand then browse the DDB list until it find the VxD and its DDB_Control_Proc: o2 o+ w, d6 Y: O' @1 A
field.
; o# ]' E( r( y7 ?1 OIn fact, its purpose is not to load/unload VxDs but only to send a
" C/ j: [) @( ]3 ^- V' e  Y2 A' P- ]W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- [1 G1 V) y5 z) ]# bto the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 l+ q$ i, X- d. {4 tto load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ k5 I. U6 V2 V* v; V3 Z6 L% KIf the VxD is loaded, it will always clear eax and the Carry flag to allow
/ ]+ V4 l! b  l) r9 L% nits handle to be opened and then, will be detected.0 V0 n* w1 Z0 |" U/ Z3 ?, C+ \' O
You can check that simply by hooking Winice.exe control proc entry point6 E5 O' q  K1 c. s
while running MeltICE./ j7 G  {  D$ P8 Y: V) }- [* q7 [
. u& T, z# F1 X
* P. S% b2 n) t/ z
  00401067:  push      00402025    ; \\.\SICE: @* p8 |# w! G# `4 z
  0040106C:  call      CreateFileA0 f* F! T, n. t+ h# }3 S: ]' K+ D# {
  00401071:  cmp       eax,-0016 ^+ f% d7 F8 z; i/ l" F& u
  00401074:  je        00401091
( w4 k" h; j8 q
! i' l8 M/ M1 G& V* g  W- I# l( K8 O/ M
There could be hundreds of BPX you could use to detect this trick.
* J6 E9 l$ F7 T' h/ R1 p0 b2 U-The most classical one is:" n0 d1 Q6 s. y: \
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||  J3 z( Z; o, ?6 a9 b- q4 U2 h- }
    *(esp-&gt;4+4)=='NTIC'6 d3 o8 H# J1 g& U$ r. }
7 \% \: S5 _' e" ?! _( p; E
-The most exotic ones (could be very slooooow :-(
8 ?# l. W- K1 w. h) T9 m   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 H" Z/ V: S" `     ;will break 3 times :-(
8 o8 W' u+ b& Y5 H; T9 ?" @6 C7 k0 H' y6 N
-or (a bit) faster:
) o% N3 l- h  ^% b8 w/ \- R( C9 R   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
" h( t! \9 V* q" u* h. d' g4 V& Z6 _6 q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  , R" f7 p6 |% S. E- S. S$ n
     ;will break 3 times :-(
7 N& @, L: ^) H) y/ u2 o8 K0 N- w6 |# n& s; V. p
-Much faster:  _% n+ f+ \, G2 w6 y& \/ S* e
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. H2 V. F8 x4 a) ], X6 D* |
" L  O  `: h8 W2 eNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
0 M/ U9 V% M+ e9 K7 T! afunction to do the same job:  }" t% C/ @1 V# _

+ g! i& t$ h9 e5 ~# m* `$ y+ N   push    00                        ; OF_READ, o" U6 Z( @+ o$ M4 {( k( n
   mov     eax,[00656634]            ; '\\.\SICE',00 h/ U) m* \2 [0 V, l
   push    eax. J4 @2 Y9 {5 \- U
   call    KERNEL32!_lopen
: L: h+ O3 W0 }1 q/ d; m   inc     eax& z: l' y% M/ d& n- [9 ]2 l
   jnz     00650589                  ; detected
$ T4 N( u- m4 F" @' ]. P   push    00                        ; OF_READ! g- R: E7 G/ A3 e/ G5 B
   mov     eax,[00656638]            ; '\\.\SICE'$ _1 d8 Y8 I* x) H0 e* P
   push    eax* O6 N) {( h& i% E$ N& e8 r
   call    KERNEL32!_lopen
( u5 b7 r7 ~% P; p6 I   inc     eax
, \2 b# s  y& T* {1 ?   jz      006505ae                  ; not detected1 _# P# Z& D* e, v0 X( w  k
- x0 t# u5 ^8 w1 v( r

# c; ^* L) T4 g: F! ?# \__________________________________________________________________________! c# L3 y7 Z/ M+ l8 k

- z2 N/ z8 _2 d: E. n, U. Q2 oMethod 12
5 P2 @7 E  P. v8 G0 E/ `0 Q" G=========
+ c" z, x6 `( e) E# {, c; X" P1 V2 L/ u( J) O* @
This trick is similar to int41h/4fh Debugger installation check (code 050 ]0 u. x0 Y8 W' a: B. I
&amp; 06) but very limited because it's only available for Win95/98 (not NT)" o2 r4 ^0 i) r+ a, B; Y) a8 }
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
5 d2 M1 c/ l: L- O- M' Z% E1 o( C  }7 A7 W4 n0 F
   push  0000004fh         ; function 4fh0 e* {  b; m8 n1 u0 s
   push  002a002ah         ; high word specifies which VxD (VWIN32)3 E9 g4 l3 s$ f: C+ g* }1 M7 y" r# i8 l
                           ; low word specifies which service9 ?& f. C3 e: I7 i0 s  X
                             (VWIN32_Int41Dispatch)
2 N1 }7 Y  {- V1 v- {4 n0 L1 x" n   call  Kernel32!ORD_001  ; VxdCall# j$ j9 ^6 r$ k
   cmp   ax, 0f386h        ; magic number returned by system debuggers/ g' B, O* x' g  Y5 H1 u+ z
   jz    SoftICE_detected4 }$ h4 O/ q: S& a! K) U- a5 u' ~0 W
+ e& {. A# f1 ~( I
Here again, several ways to detect it:$ g; q5 }+ {) D- B' }

  k* ?( Z: n& m: u- m# z  K& [    BPINT 41 if ax==4f! u. r8 V+ O) q4 ]# f9 D& C
4 n/ W. j& k& J" ]
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' f% S( i( \3 `( N- t

+ h, V7 m: `) T' O    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* J+ F: a% W& ?: W: `* `  P: R8 F, M8 t

7 u, a) Y6 ~- ~6 l$ v. B9 C    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 b" y6 K; m. G5 T* F  K( S

; B. a- C' u" q1 ~3 s" ^8 @5 {9 a__________________________________________________________________________2 b* \: L5 L+ l9 [7 Q( H  ?  [: x

  u/ q' L  a% q1 Y3 _Method 13
( v2 J! e. ^+ c. |0 n" g: p=========0 d* G) P1 g4 o$ N1 b6 |. c

2 g5 _$ z! P" B& w2 G: N0 `4 J. SNot a real method of detection, but a good way to know if SoftICE is
6 z" ~8 t5 d- M6 Q- F3 Ainstalled on a computer and to locate its installation directory.4 F' ~$ i6 o/ f
It is used by few softs which access the following registry keys (usually #2) :
) M7 L: n/ d, f* I
0 N- r' j) K( x# N-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 E. v- Y( F) D# d! H; k\Uninstall\SoftICE
% g* S' O" G* ^; p8 @-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# A9 c2 ?1 T( h$ F- E/ r-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% _- K5 H- {1 Y7 k\App Paths\Loader32.Exe
+ ?/ ?# A( O5 S; `- Z# o$ @& g7 W# @0 U2 F! }& R! `5 J1 c
! J+ F+ a- F$ K1 O- `. r
Note that some nasty apps could then erase all files from SoftICE directory
7 b  c& s% `; X9 `& D7 y2 J, U9 M(I faced that once :-(6 _& }2 H" ]2 N- P
* m+ j( X" y, J; [
Useful breakpoint to detect it:& u0 \! J8 W8 b5 X
8 p0 d! j2 W: @" a& d, r
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 B/ r. j' g* {" y) S4 [9 y. [- u" B/ D
__________________________________________________________________________
3 }2 M0 L4 o( [# C  {7 n) q1 Q7 L0 ?# e/ W

6 J! B. T2 a, D7 K! C* Z- n, P6 JMethod 14
* l: w1 t5 Z' A# N7 \=========" }) `; U. B6 P0 d+ ]
" a  H$ d1 @/ P
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 g; h0 r. u: @2 {9 D1 R* i
is to determines whether a debugger is running on your system (ring0 only).
- u6 Y# {  A9 C7 ]$ C3 ?1 @
$ y7 G6 O% h. ]! e9 ]2 o   VMMCall Test_Debug_Installed
5 ^2 m) f% H+ T- s: A* @6 H   je      not_installed. H8 A( k  z$ G+ \& S4 O0 R: Q

. c3 o: \/ x- WThis service just checks a flag.4 K  @5 T4 F+ d7 @# O- Q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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