找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  w9 K4 e( n7 l. z7 V<TBODY>- ~' H* E2 F% t" F* i. P
<TR>
6 H0 I% f7 z2 S1 F: K<TD><PRE>Method 01
; w, J3 M  a0 y+ `=========
: i" }2 y) o# i5 L% }
' ^# H1 t* n! {# I  `* t2 AThis method of detection of SoftICE (as well as the following one) is
" R, _3 ~' j0 R7 Wused by the majority of packers/encryptors found on Internet.
8 y4 n9 O2 T4 Z( ~. Z; [/ eIt seeks the signature of BoundsChecker in SoftICE' \+ N& N: F0 n4 i4 e6 C

0 [3 s9 U2 q: u( j7 `    mov     ebp, 04243484Bh        ; 'BCHK'
; |, \& R; R. T+ X' \, @4 T    mov     ax, 04h
# J) r* o: Y/ |& X1 b2 v    int     3       * x: [+ b# d" u9 L% A0 d( k- K
    cmp     al,4" D+ R* W3 U' n/ f' O
    jnz     SoftICE_Detected4 x$ b6 K9 E( H1 }) e- R0 t0 K( e

5 H- g" e  \" W. W6 y+ D___________________________________________________________________________
( _( b7 W! G8 z& F
/ ~) k; G; n2 f& FMethod 02
0 g9 L% J8 J* h=========
9 O( ]# f) r2 d3 R( K0 L$ P
; y2 o: Q' k) U. k# cStill a method very much used (perhaps the most frequent one).  It is used
! c+ I7 M+ F- o: \to get SoftICE 'Back Door commands' which gives infos on Breakpoints,& G# P( G- A. ~9 I6 ]
or execute SoftICE commands...
. y- T$ _- g  m+ y- v  CIt is also used to crash SoftICE and to force it to execute any commands, z1 o8 [* ]. \# _# I
(HBOOT...) :-((  4 S+ n$ E0 X9 I7 J# G
. z6 e6 O& w) N* E7 S0 p
Here is a quick description:: Y! I2 z; `) t1 o1 ~8 x' U
-AX = 0910h   (Display string in SIce windows)
/ ]4 H5 _# l5 ^% U9 u-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 i* i4 ^8 \( I. E! E-AX = 0912h   (Get breakpoint infos)# }1 u6 z2 k% j" A5 T( \% U
-AX = 0913h   (Set Sice breakpoints)% d3 e/ e7 N7 p  n* I1 _
-AX = 0914h   (Remove SIce breakoints)
9 o) G3 w. V, n; G: W5 d" Y4 \' C% [& v" b3 B3 J: L6 T
Each time you'll meet this trick, you'll see:. t" @. E( b& S
-SI = 4647h9 f- P" c& v9 M6 p
-DI = 4A4Dh
5 d2 _, ~5 ?$ z/ AWhich are the 'magic values' used by SoftIce.
- u0 [; F; m) M% \8 w/ B3 @4 CFor more informations, see "Ralf Brown Interrupt list" chapter int 03h./ L9 w' }4 ]7 h: \+ E9 `
9 Q7 [, Y- X( t% C7 |  o  F
Here is one example from the file "Haspinst.exe" which is the dongle HASP
+ C- L% L$ V; h1 lEnvelope utility use to protect DOS applications:
7 u" t% S9 D: U3 j2 t- W2 {: m0 V+ M$ ?& E: `' u$ E1 F

, ~' u# u' U  L0 a5 j1 M% ~' Y8 ?; O4C19:0095   MOV    AX,0911  ; execute command.% P7 @) c& Y# X; G; g$ i& V5 ?
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 l! q9 G  \* O- @) \* r3 r6 Y4C19:009A   MOV    SI,4647  ; 1st magic value.' E. G' K  W. U0 \( G. J6 ~0 K
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 n+ R, z4 F5 H( j( ?- ]9 G6 ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
8 [- G9 Q6 i$ ]. y- ~/ Y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 W. T: v5 F' N. P" b- j/ L4C19:00A4   INC    CX( m7 r" M9 L5 ~$ W4 Q& O
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 e1 p: T1 P% J$ }& l1 J8 e6 d4C19:00A8   JB     0095     ; 6 different commands.! t/ Y7 x7 v4 W" B
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# m# c2 B  W# H0 h& s3 W
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& b5 l# J8 x, T5 S' t1 _) ^  H: x! }7 r; {& k) @7 @0 E
The program will execute 6 different SIce commands located at ds:dx, which
5 h6 C- p1 P- w- S5 t' r9 Y* mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
0 K, k5 }. f# y; r3 k+ Z/ G4 J; d1 W$ N+ b
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 p3 Y3 P& \" Y; p8 h* ~) b
___________________________________________________________________________
- R, ~8 w% N( s% Q2 L  J
" v  Z( [; ^: v, ]4 g' f' m
, v+ T( o7 D0 D* _& P( hMethod 03
/ U, y+ ], q) Y=========6 d" U# v+ ^) i2 T9 B/ M
0 u  T" J! J# @7 c7 q! }
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h; Z& ]0 o6 w$ X9 h
(API Get entry point)
- L" y, r" k# }4 E! x; L0 E2 R        
- k' m  }) d1 U' h/ P
* B, M1 y. d. I    xor     di,di
; ^0 \' M# `$ ]4 H$ ~/ a8 l    mov     es,di
. L4 @% t0 S, K( h1 i4 S* ~7 v6 F- z    mov     ax, 1684h      
- z$ D( b1 g* N0 L, K! O) ^    mov     bx, 0202h       ; VxD ID of winice
3 p3 ^1 p, G4 u1 v2 ~. v' B3 _    int     2Fh
( f: ]7 L" B& I2 T. d% u5 X  ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point. P& T! Q2 J* B& _& Q' n
    add     ax, di; P& K/ T; D# W# r; `
    test    ax,ax6 H3 R$ S3 @: h4 O/ r6 F: x
    jnz     SoftICE_Detected
7 |9 T. \9 _% o# ~8 \/ h. B
* F7 d0 Z* c/ F2 y2 F0 d  q$ H___________________________________________________________________________
1 t# y0 }- F4 u" L2 P$ ]
2 C. F# T; C& s" U3 \( V& yMethod 04; D% ~" ?! h/ ~
=========
& k. v8 i& }" S( P  I' I* e* w% b* `4 F  }* q+ P' C, z
Method identical to the preceding one except that it seeks the ID of SoftICE+ W. j2 Q' K7 t  ?4 D
GFX VxD.: v0 A: i" D/ l/ i+ r

! O$ b5 a  B9 r    xor     di,di
0 H1 \1 B. d: N% ^- B; `, j, \2 ?) P    mov     es,di3 m; @) C/ {' R; w7 O- O& p
    mov     ax, 1684h       ) }7 W$ z7 D& d: W' f$ f+ i: S' f
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 ^) L( F4 g  G7 T    int     2fh
$ w4 m; Z& T2 }0 p! m) f    mov     ax, es          ; ES:DI -&gt; VxD API entry point' Q* X2 w7 O/ e# ~) u
    add     ax, di
) c. d4 M0 ~" C% J  ^    test    ax,ax
8 M0 p( }% ~( J$ V2 D, ?7 U    jnz     SoftICE_Detected: `! X; s0 q  O  k2 P7 Z

. k4 s" r' _2 g# ]( G, ^- b3 i__________________________________________________________________________' w( g/ B3 o5 u  L3 Z% r: }* s7 L( y
8 z( J- N( Q( c+ G6 F- H

5 U" ~2 ~/ m+ X/ V5 _  A- a; L4 wMethod 05
% t. x& u+ q& \, \/ X  u* Q5 M=========1 C7 w  A5 c* B& n8 h1 T) e

' I1 M, |1 Y6 J( H) y" m% {Method seeking the 'magic number' 0F386h returned (in ax) by all system2 r# v) p! F5 f( y$ y
debugger. It calls the int 41h, function 4Fh.; t' j! Q1 I+ B8 a" P; H
There are several alternatives.  2 G, y' a- E8 D6 Z8 ]* e3 r: H# k
# ~* F9 |/ @, y& @: W
The following one is the simplest:
. ~$ }0 p; z9 [5 g+ r
" N& g8 R+ K8 x5 P, A# T+ L5 }    mov     ax,4fh
( `8 P  F% a- ~/ W9 R. g9 r- G2 t    int     41h/ }0 ^: q. ?0 d( X& F
    cmp     ax, 0F386$ r* G: u; i* R) K/ N7 p7 a! f
    jz      SoftICE_detected9 A1 H4 C4 N. {, y

& w1 r  n$ t. b! v% s2 W8 N) l0 o: U5 q: \9 G* G7 q* N
Next method as well as the following one are 2 examples from Stone's
* [& @: I8 l9 W! H+ ?7 T/ z' c; ~"stn-wid.zip" (www.cracking.net):& N4 k1 ?3 V) y+ E
$ q9 y# P4 t+ x2 x; }
    mov     bx, cs
4 j# l* I2 Q) z) W  M/ D, B    lea     dx, int41handler20 ?- i# j/ z9 f& X
    xchg    dx, es:[41h*4]
6 x, a/ c7 _. P; o* v    xchg    bx, es:[41h*4+2]+ N# S3 Y7 h, U
    mov     ax,4fh
( p$ y* J$ M( I2 W    int     41h
* f# W) c8 T7 H    xchg    dx, es:[41h*4]7 P4 q/ X6 A; J1 g# X5 @
    xchg    bx, es:[41h*4+2]
( m. O% o, M# u5 m7 L    cmp     ax, 0f386h
0 o/ R5 h1 s' K4 _    jz      SoftICE_detected
, s$ w( p7 w6 w: g% x' f7 g- E! m4 D  v  \, A
int41handler2 PROC& K; N; I4 }& j! c& W9 L
    iret% ^+ O' g8 E5 r) V1 H9 V! r5 h
int41handler2 ENDP& J2 w7 e) H! R0 Y

6 f- y# o3 R0 G% x% M! Y9 o3 n7 f. {5 p* O6 Q$ R
_________________________________________________________________________& d2 r) u) [# ~0 w  W- c

$ y1 v0 j1 U- Y  L% b/ y9 {" Q& e( P) d' z3 _( K, j
Method 06" K9 `  \$ ]0 l) N# B. ]8 q- p2 ]2 z
=========% G3 C$ j6 w# ~$ V5 I( n& u+ ?

& j6 t& p& I7 d! z( d$ {
( ~, P0 O) h0 a2nd method similar to the preceding one but more difficult to detect:
" M# ]3 t/ D, l4 \; F0 J; ?! d+ w" p) W3 a! T/ Y' V, A
/ |/ f( Z# X* _' t; @
int41handler PROC: f' z7 R& j0 j& u
    mov     cl,al
7 O+ v. b4 b7 a; X0 U    iret7 Z' O3 ~/ v6 o2 ?  c6 k- b
int41handler ENDP( Q0 L8 B5 k8 ~  A( W

/ c- Y% j4 t9 ^$ P9 V' {4 }" K2 C) b! K
    xor     ax,ax" E" ]( d' x8 S! o1 l
    mov     es,ax
/ F) ]2 O3 q+ L& G0 m5 Y    mov     bx, cs
' }" L1 u/ x, p    lea     dx, int41handler
$ K; ^: Y4 [( i    xchg    dx, es:[41h*4]" w- g/ M4 ?  r  ?$ l2 F
    xchg    bx, es:[41h*4+2]
2 F* f! \- ^3 c  X6 A    in      al, 40h3 z' U& [- {8 q. f1 ^' E. d
    xor     cx,cx
! N- x- d! e' [2 T1 t; I9 p' a7 |    int     41h
9 ^& w, Y  ]% H9 {, J$ H    xchg    dx, es:[41h*4]
- Q, l7 ^$ x2 M- {& ^    xchg    bx, es:[41h*4+2]
# o# _* Q& y) r. X- w$ Z1 v" p    cmp     cl,al
) J7 p9 W. a; e8 K! h    jnz     SoftICE_detected
; s2 l+ N$ n1 P4 @& ~3 m- W$ j& B3 ~8 h
_________________________________________________________________________
1 n/ X( W* ]. a2 v$ J; V: o, e
1 A2 F" T7 u/ Z. tMethod 07
! o3 n' y& ^+ Y: U=========
& i$ p  B  z2 W3 y# _
, T1 Y( V( W9 Y5 `2 k; T& ?% DMethod of detection of the WinICE handler in the int68h (V86)
0 W) ?! T/ e4 a
. a* W6 `6 o( g2 w/ D: h    mov     ah,43h# n# P- L! ~4 \( y6 U
    int     68h: e% J4 V2 [9 ?. t3 h/ K8 Q
    cmp     ax,0F386h
! Y, ^" @" a  X3 a9 s    jz      SoftICE_Detected1 k* V; \, c; s; S& m
0 @4 c) q$ N% d# ], a0 ~8 K; O$ o
% W9 b5 H8 ]# Y7 B" `6 P$ n
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
- z( Z1 H; Q2 K   app like this:/ p/ e. J) c+ t& O: y2 w+ r; p
! r3 H2 A4 Z% V2 V
   BPX exec_int if ax==68
2 ]" m' V" @+ @% J   (function called is located at byte ptr [ebp+1Dh] and client eip is
! x2 ?2 b* p& T   located at [ebp+48h] for 32Bit apps)3 |7 q. P( o5 \  L6 M9 m
__________________________________________________________________________
. i) h  Z8 u& k
/ x$ F3 W! M/ p- j* \* t2 d1 O/ X/ H) K/ A6 y9 w& A3 R
Method 086 R* g# P9 B, M$ Z7 W1 D
=========7 T6 y( b. X" J2 ^$ R+ \
3 H' B/ A) {9 A) g
It is not a method of detection of SoftICE but a possibility to crash the; a# L) r; u: E, F( F. {
system by intercepting int 01h and int 03h and redirecting them to another
( U' N; v& J3 U+ I, troutine." j, j% k) A% C) T8 f% r
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
# }& R! J. J0 Sto the new routine to execute (hangs computer...), D6 y! H" s. E8 [
7 A! _/ I$ B9 m6 G7 b1 K
    mov     ah, 25h
7 S; z- Y4 l: ^4 H  ~    mov     al, Int_Number (01h or 03h)* Z: g% s3 D; L1 x- _. S' d5 ~+ B6 e
    mov     dx, offset New_Int_Routine( V1 U2 X# |! s% T$ w3 k
    int     21h+ N/ d, [3 e( N: u$ x

  J0 ^2 N" A/ h! b% q__________________________________________________________________________  G) h. ]" ?7 v  a$ a1 l* ^- W5 A

0 M  t( y: s( a0 {Method 09
6 Z+ N7 f0 y% Z3 `8 C* @& U=========
* C' N/ _( S/ f. z" L2 M. f
; H( i; r; ?/ N: f; KThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only2 W, C: z( P6 k, d& A3 }
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 h4 H' \5 I# J. o; Z: Y4 qThe Get_DDB service is used to determine whether or not a VxD is installed) N7 y. f* y( q" I6 @* A' r
for the specified device and returns a Device Description Block (in ecx) for8 \* B) c: N" k# {6 L0 f. U/ b
that device if it is installed.2 k% S! J& S, x: R: f! m' D0 w6 x3 M
; q+ H( O+ o% u# D! ?  }+ p% t2 C/ ]
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ m! J1 m: s6 k. p. [; o: n0 u   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 h% X9 o1 J. L3 Q" ^
   VMMCall Get_DDB2 O1 i0 k1 @1 a
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* j! }8 l/ b( {) d$ v9 u

8 G3 g( e. \( F0 }; N. B6 n! DNote as well that you can easily detect this method with SoftICE:
" k3 ?1 s' l( i' f   bpx Get_DDB if ax==0202 || ax==7a5fh
8 i- B/ Y) W# N8 q& f2 P
" c1 n2 q& b; U__________________________________________________________________________
' d2 `$ [! p* _  N3 K  u; ?; R9 p& m" r9 z- C/ U4 y; Y
Method 10
9 a; z# }- X  Z! R+ q=========
6 V8 U: a! u: n6 D0 F) K
- m& {; t" W# t0 `6 h7 E% ~0 a=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
9 Q3 W7 ~* M8 s; v: d  v  SoftICE while the option is enable!!
0 F0 ]9 J; A/ `% f" r$ a6 U9 B/ W: w) l1 i6 P5 p
This trick is very efficient:3 f2 z8 j$ G+ d* `- J, w3 |/ n
by checking the Debug Registers, you can detect if SoftICE is loaded
' q* ]3 a4 _, [6 V# X7 t3 A; s(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if* f+ P# N. M( s$ [
there are some memory breakpoints set (dr0 to dr3) simply by reading their
6 E; |' i0 J- s7 A& }value (in ring0 only). Values can be manipulated and or changed as well
2 M5 O8 {2 H* }" j! c; L8 d* D(clearing BPMs for instance)
& }& ?, |# {& t, `
6 f; ]" C, U( u! p) c& V__________________________________________________________________________
8 W2 R# @; r" o% s3 m
2 N8 m" w, f. a; dMethod 117 G% H5 }% @" @* r! H7 Z
=========+ Q6 u5 `! a1 s: h/ v& V" ^* d

" m; ?' j) I* d$ q: KThis method is most known as 'MeltICE' because it has been freely distributed
: V" ]$ d' f' I1 ^- }via www.winfiles.com. However it was first used by NuMega people to allow% |, @& K! g2 t" c3 n9 B+ T( R
Symbol Loader to check if SoftICE was active or not (the code is located
( Q* X  u4 i$ I  V* yinside nmtrans.dll).
0 K" M# G, H! u! `6 ^9 D) ?' u$ ?, W* P. m
The way it works is very simple:
+ _0 H* C8 C0 IIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: S. O  _- x" ?3 N& o) \* Z
WinNT) with the CreateFileA API.
3 p' A9 |% u: O# ~6 ?0 |; q
+ f& f; b5 ]* I8 [' i; R! Z/ zHere is a sample (checking for 'SICE'):
9 D3 ?- e( M  m4 D' @4 q1 X; G2 {
BOOL IsSoftIce95Loaded()
' ~) d, }2 t& J. F1 T. e# s{
3 h5 ~2 R' O( H! e   HANDLE hFile;  
4 x$ v: T. B; y2 g& i3 Z% n6 `   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ A! n3 U( `9 s
                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ K1 U4 M  H+ c6 e
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 b: D( g0 X4 M$ c1 t* B
   if( hFile != INVALID_HANDLE_VALUE )' E; ~* l6 }& I/ f* u( Q
   {( _; O2 h# E' x" }) D5 v. c1 }
      CloseHandle(hFile);$ r) d6 ~6 D5 Y. a
      return TRUE;
8 F6 _: C# Y7 D   }
' Z+ Y9 [" {1 ?, w/ C) W; i" o2 F3 T   return FALSE;( ]& t7 x7 |1 [. B) y6 A+ F
}% i7 q: j4 l# |% F3 c5 p! w* I
4 n$ v8 L8 w( ~  f
Although this trick calls the CreateFileA function, don't even expect to be
* u. W% X, Z% U6 Y9 C: m' f! Vable to intercept it by installing a IFS hook: it will not work, no way!
5 `- ~# H" V+ r  `9 E) jIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 Y9 |, ^& h  ~; \, Uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( z8 R0 b2 l8 f  L3 g6 i! `( u
and then browse the DDB list until it find the VxD and its DDB_Control_Proc; Y6 ^) K/ F2 T  \
field.3 w0 D# N; s. {3 A2 I) f- r3 E
In fact, its purpose is not to load/unload VxDs but only to send a ( ]$ N. X1 v2 T8 a5 Q! {6 ?
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( C4 R8 P, c6 h6 [% t
to the VxD Control_Dispatch proc (how the hell a shareware soft could try0 g8 R5 k4 \5 ^) n/ I
to load/unload a non-dynamically loadable driver such as SoftICE ;-).: l  k# I" d' N9 E6 Y
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 A  S& ?  ~' w6 ?' u6 H
its handle to be opened and then, will be detected.5 |1 x( M: }- |. e4 ?( ?6 Q/ ~$ y
You can check that simply by hooking Winice.exe control proc entry point
0 m6 l" j) j3 j3 G6 |" E0 }* P, @) Jwhile running MeltICE.
$ x; k+ ~1 S- r0 w
3 C# ~( Q& U0 G7 B7 D; G( ?$ `/ T
  00401067:  push      00402025    ; \\.\SICE0 H% I- x& `, z* |# e! x
  0040106C:  call      CreateFileA
: o6 L' f+ g, ]5 p4 B. Q  00401071:  cmp       eax,-0015 s5 `- r& q8 ]
  00401074:  je        00401091% ]( P8 F" g6 ?: j  {  K' Y

* M" h7 _6 ~' D* ?0 j8 P$ S6 p  l; [, v7 I
There could be hundreds of BPX you could use to detect this trick.
9 P3 J' j  @* }( c5 c- B( C-The most classical one is:
+ W, l) `: P, b0 T$ ^5 b2 F* j  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% @) D. G0 Y# {: I- {6 A, T    *(esp-&gt;4+4)=='NTIC'$ W5 C# y% I% p! ?4 n* E+ d

( B$ r- [, S% ~7 _7 B2 ~- l-The most exotic ones (could be very slooooow :-(
8 C/ H# Q# A# G: c3 j+ R   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* r6 w& Q1 p7 Q, M2 c( T2 a; w     ;will break 3 times :-(
6 K% v0 {8 m& A! j' t* c8 `, p( H- U
-or (a bit) faster:
9 J8 M6 T  \1 [1 f& u3 Z. A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'); u! l- Z, H* \4 u
! h6 b1 G# n2 v  Y
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : @8 n# i6 D" r1 u1 ]7 M8 v
     ;will break 3 times :-(* |; r5 K' y) ?) o" p: n% |
" y. F2 Y0 u9 m! J% R
-Much faster:1 q' ~/ o% k* ?9 B, ]" D
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" _* T$ |  I3 s) r9 G& H

5 u4 P( \' F' W' B! H6 kNote also that some programs (like AZPR3.00) use de old 16-bit _lopen! a# t- J' Z7 p1 S$ R1 ^* K1 O
function to do the same job:
5 v% `# W' Q2 P. G# V9 ]7 }* W
; s% ]$ b, z; ]8 v) y   push    00                        ; OF_READ. p! `/ S2 _! `" ?. u* L9 l: f
   mov     eax,[00656634]            ; '\\.\SICE',04 a9 B& ?; ?- k+ V: D
   push    eax
6 h8 p5 b$ ~  s" R   call    KERNEL32!_lopen
& B7 v" w8 `1 k! V, ~   inc     eax) @% G* }$ H, u7 ?
   jnz     00650589                  ; detected& p. H/ `0 k, D+ ^# y0 t
   push    00                        ; OF_READ
( c: |3 X6 m8 y' e' k4 Z3 Q   mov     eax,[00656638]            ; '\\.\SICE'1 g- {4 G. O$ _
   push    eax
7 ^8 ]' D) r9 S" e6 S3 D4 u   call    KERNEL32!_lopen0 Y; O3 K/ Z6 I, e0 {9 ]' p
   inc     eax/ X) Y8 s9 ]0 ]- D5 K1 |1 h
   jz      006505ae                  ; not detected
6 q! O0 P7 W9 T# v0 E3 [; o% ?
& c* Q% Y# u! g' s  f4 N* |) K  G9 c9 H" s* |6 W
__________________________________________________________________________
$ i( U8 u, w6 }* V8 K/ h: d! k# m4 Y
Method 12
7 ]6 \- T+ _( ]& `# ~/ u=========& ~4 _. _% U6 V- H7 g* d

" {- E. _- V" E1 Q' AThis trick is similar to int41h/4fh Debugger installation check (code 05/ Q, I$ i4 T& s% U! d0 L8 @
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ O( j) {$ p: o2 O( zas it uses the VxDCall backdoor. This detection was found in Bleem Demo." u; l( g( O% P  F4 T9 b
+ S% Y! b8 w) [) g
   push  0000004fh         ; function 4fh; E7 C4 N3 s1 r, g; o/ t
   push  002a002ah         ; high word specifies which VxD (VWIN32)
: H9 Q3 H, M! v6 c/ J                           ; low word specifies which service
5 C3 R$ C+ d9 L" [' k                             (VWIN32_Int41Dispatch)+ s4 d5 b7 b+ H! e: R/ F
   call  Kernel32!ORD_001  ; VxdCall3 u6 t# v0 l5 J+ C( |+ }4 k4 i
   cmp   ax, 0f386h        ; magic number returned by system debuggers; W. M0 x/ c! I" p; |' D
   jz    SoftICE_detected0 G4 X% c5 |2 S1 T

, {/ s- q$ @5 n2 I- `8 \! s7 jHere again, several ways to detect it:; p0 n$ x2 M- f$ r! Z! |+ k% @7 P& v# c

: U+ l/ P) _! x# v    BPINT 41 if ax==4f$ Y$ W7 y1 p9 v- m

9 ^+ w: M8 i' ?% [* c  B7 d    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one5 G2 I7 @5 r4 H$ _

' Z: A, ?+ Q: F. a. F    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
+ J/ ^9 X4 |6 a
' z# t! Q8 ~" G0 V3 H/ M& H7 \) W7 \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 |* o) y4 U9 O1 h3 T) Y" v
+ T$ S* @& Z! k__________________________________________________________________________+ U$ T  u7 u) H; w( T- r6 q

5 @# p9 z1 `+ f+ B/ qMethod 13
8 I/ B) a+ ]4 s: z=========
, @9 Q$ }9 ]3 a" J8 K, a
* I. j6 r) T6 l2 h* G) Y; ?Not a real method of detection, but a good way to know if SoftICE is
; H; v" Y# \9 finstalled on a computer and to locate its installation directory.
6 {' F5 B: F6 lIt is used by few softs which access the following registry keys (usually #2) :. W4 H) S7 Q! }, ^- B

; t3 z9 E: V4 p& H  Y/ ]-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 c8 r  s" x; U6 H\Uninstall\SoftICE* I2 p7 |9 u. t9 _
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, h  P& `: c  t-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: b  {9 F; p4 v& m( M, W\App Paths\Loader32.Exe9 M' W3 a( A. {+ S  O
; K6 p$ c' s. Q. Y& @1 J! M+ Y: p  t, [
3 c8 k* ?+ L% M1 Y; c/ u# O
Note that some nasty apps could then erase all files from SoftICE directory$ M) S/ F4 r! C
(I faced that once :-(
7 t6 G' M7 B/ T+ I" s& {2 j/ v. p
Useful breakpoint to detect it:
3 A; t, h% v: C) n* C' a7 ?: t- Z% G# e+ L7 V9 c
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'1 b% @2 H/ b) K2 y' Q( e8 h9 Q

) o* Z- p! E5 P2 u__________________________________________________________________________( m9 s' C0 l0 U# C( m& Q
2 h5 q1 ~. `% G! n9 k4 W

' ]% N* s8 A' LMethod 14
. w8 t5 L8 P6 W* j=========
+ z3 G+ R! W* ^0 }- T
/ A2 B' u- F3 o/ R% z0 n# TA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, |. n3 R$ \* Z( @is to determines whether a debugger is running on your system (ring0 only).8 F& I, ?6 F% B& Z2 X. [& i7 q

( [) k2 P$ m$ r' S$ {5 m  I   VMMCall Test_Debug_Installed
4 ]7 v. p1 Z1 ^; i! e0 [   je      not_installed0 N6 J) |; w! A- |" d* j

! o! q; x5 U! E) zThis service just checks a flag.
/ S" A  S- f+ P9 D3 _</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-7 16:13

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表