About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 ?- U& w5 F& j' _/ E: p  a# {<TBODY>) t5 v* Q6 B2 J9 a5 ^: |
<TR>
1 `3 h. g* ]8 v- F- z' o<TD><PRE>Method 01
& T# r: ^+ D% _" P+ a6 v! }=========0 J, I6 G* U  s
/ R3 n. {# l+ u6 q! F
This method of detection of SoftICE (as well as the following one) is
# Y6 }5 @3 L- t6 B1 Y% X2 Vused by the majority of packers/encryptors found on Internet.1 O* \, e0 ?/ e# O- p# l( I5 G( k
It seeks the signature of BoundsChecker in SoftICE! K5 ?0 B! c- a+ Y

  X! K+ ?9 f; T! A2 h    mov     ebp, 04243484Bh        ; 'BCHK'
4 f- u+ F; h- E0 d, C2 V& v    mov     ax, 04h4 d" d$ C  X" T. {4 o
    int     3       & q$ I; {+ M; [2 }+ z, D
    cmp     al,4
3 d: E+ I5 I9 A- q$ t    jnz     SoftICE_Detected0 n6 U+ h$ {% }
" x9 b$ S7 A3 V2 z* ~9 x6 Y7 I$ V
___________________________________________________________________________+ |1 Q5 |3 v6 y& z

+ k# G& j; w( r( t% ?Method 02. ~& ]$ W9 R$ v. B/ @4 L
=========
; D* C& b' E  @$ x" u* [" C8 n
Still a method very much used (perhaps the most frequent one).  It is used4 [5 |& k8 b9 F
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# L& l+ P& {5 r0 R# j; n$ h+ mor execute SoftICE commands...' p* H% U6 V8 {  Q
It is also used to crash SoftICE and to force it to execute any commands' {, r7 v- E# C# V/ B8 V
(HBOOT...) :-((  
2 J( a; J# D+ H3 F' i( ]1 Y3 O# V$ {" @. r; w; e) H
Here is a quick description:
, k# m4 X  B& ~9 K  m$ m, }( R-AX = 0910h   (Display string in SIce windows)
# b  v4 D6 B. L, \$ x1 [0 {) r-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): }' x+ r+ @) n$ |' x. L" ~. i' O
-AX = 0912h   (Get breakpoint infos)
) Q  |( j6 V- w' H-AX = 0913h   (Set Sice breakpoints)
7 P& X: J4 {# z2 D-AX = 0914h   (Remove SIce breakoints)
( M( H+ |; R9 n$ f( m" M! n
2 X# t* L& M2 j; CEach time you'll meet this trick, you'll see:
* ~( }2 @: S$ T' V: s-SI = 4647h& D+ J3 W; n5 E" u7 {; j; w1 w
-DI = 4A4Dh
2 H# c  E7 K4 {$ t, v. w4 }  W& @Which are the 'magic values' used by SoftIce.. U9 k* }% f7 k% Y3 u/ j* t
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
; \; n6 G1 [* i# V, `
4 C0 v, Y; J" m8 z1 RHere is one example from the file "Haspinst.exe" which is the dongle HASP
9 D. O3 e6 f! P1 |! |- TEnvelope utility use to protect DOS applications:; |5 N1 ]" B% g% K* s

$ I8 G  z( e' i
( ?, I3 s: w# `+ f0 G4C19:0095   MOV    AX,0911  ; execute command.9 c" d( V  r% o& H' ~, ^
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 [: X& i6 c5 ?4 p  F* U7 ~( ^8 F4C19:009A   MOV    SI,4647  ; 1st magic value.
. S& v! J& a/ ^; p6 F/ [: u' _+ z4C19:009D   MOV    DI,4A4D  ; 2nd magic value., w8 F7 N0 e" H* z. `/ O( m
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 h3 Y8 o( N, C9 y! m4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) ?: g$ v8 B; i
4C19:00A4   INC    CX' v% p1 x; |  A' i) Q1 I- A
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- O3 k. m) G  s7 U$ P
4C19:00A8   JB     0095     ; 6 different commands., x9 v- ?" V$ L: g( i! X# X$ ?
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 V7 @0 R/ o( e7 C
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: ~, Q4 ?* b' {" @6 p) E" ~, i9 d! i- r4 I! E3 }& H. A
The program will execute 6 different SIce commands located at ds:dx, which
6 I; {* t5 `. G2 j5 mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.+ A7 I, ?, z1 f& n

3 Y$ l! [. x! q4 |* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." x5 c2 m; v8 q: M& P
___________________________________________________________________________* P0 N( p* S8 f& X+ x

5 D  q/ l% T( k) ?* o: V+ n: B7 E) c; X& h( y# _2 T! k; X
Method 03
& j. l& i! ]0 i, k=========* X6 L' }, R5 t0 P" t. S

: d7 ~  }! i* b/ Z, q% g2 T: @Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
) D0 x. m, E9 V' s4 Z7 F! a1 Q(API Get entry point)( l& C! F% C& L$ f3 w2 L" L$ |
        
) `, {- k/ Z$ |. f5 Z7 V8 C; R" f6 D. R& k8 D, C* ]$ X
    xor     di,di2 _- q1 d3 }8 g! S' ?( Y
    mov     es,di
7 P  n9 e; H- Y: U0 J    mov     ax, 1684h       8 p$ A5 H  Y8 q8 e3 T1 x5 a4 {. _; @; _
    mov     bx, 0202h       ; VxD ID of winice
% l: |* o. {1 {) g    int     2Fh0 @' p% R  M+ ~3 y. f2 F% ^+ W% j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( o, N* b3 F& ?$ V. z5 Q/ j; J8 n
    add     ax, di
6 Z, e% n& l0 `3 P% H4 h    test    ax,ax- E  n: y! S6 Y, X" g
    jnz     SoftICE_Detected
, K& x6 a! ]- d
) h' X+ e7 h  W+ `" T___________________________________________________________________________' X9 `% }" ~" m7 Q3 c

' R% D7 T* T, I8 TMethod 04* r' {& ^  G9 {7 v* _. ~( b, @
=========% ^1 j! \/ V3 l# n. H
. N, ]' K" p. |$ K' k1 A
Method identical to the preceding one except that it seeks the ID of SoftICE0 W; O- @1 k6 P) z0 ^6 y
GFX VxD.
- m! r1 o; T+ D! Q( B( r' T3 q+ N6 m
8 c: x8 i$ F, Y. ?/ B    xor     di,di
. \6 l& x$ x8 G* _5 V. o3 A    mov     es,di, F* `3 W9 f  j( B$ o
    mov     ax, 1684h      
5 p% L- {! K. Y& ~& \    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 z+ U) @- p3 j. f
    int     2fh9 \; G$ e2 V. ^3 p6 C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" u. ~! W2 X9 t8 H    add     ax, di& {3 t8 X. F* b
    test    ax,ax
& C1 Z- u9 C) [. E, O3 z( U% y& G! r! E; K    jnz     SoftICE_Detected( i8 \# V& o* T
, v/ M! P" X( G/ u3 r+ {5 u
__________________________________________________________________________
8 D$ D6 @4 A" O5 n) z
5 _/ g5 Y, r  w3 A# k
; y' p: N7 ]3 g3 }9 K) F8 {Method 054 w; w! Q) l9 u
=========
3 i; e5 h' U+ h. H& d. _8 g
7 `2 o. E0 [% K0 T+ r# QMethod seeking the 'magic number' 0F386h returned (in ax) by all system
; l/ S+ n2 F; G; Z9 i0 Vdebugger. It calls the int 41h, function 4Fh.5 W2 N/ @2 n+ k0 O6 }- g
There are several alternatives.  
. g7 r! V7 N) o+ N
* v* q/ _& l9 o: L0 m/ t7 JThe following one is the simplest:  z1 w& J7 n& x) J

' `% x& ^3 f% l" q7 D    mov     ax,4fh$ S5 ]$ ]5 o  s" G# D* O
    int     41h
" l# V; o8 `9 g5 J% c% C    cmp     ax, 0F386; B' Q' ^5 O4 C; |+ A3 [& I/ D
    jz      SoftICE_detected
( p1 E; [1 _! S8 ]) D6 @) d
7 Q; l0 Z$ |) \
& x' Q; W2 |- y6 `+ nNext method as well as the following one are 2 examples from Stone's
9 t4 v/ `  e* P" L5 z+ J2 I4 `  \"stn-wid.zip" (www.cracking.net):
; U' f+ V' C" \" m) H. s% ^
2 g6 b" c( J# S0 ?6 t6 ]# t    mov     bx, cs' R' b& }4 k" G4 S6 T0 v: T8 [
    lea     dx, int41handler23 t+ N# g& O7 _6 T
    xchg    dx, es:[41h*4]# e7 b) n9 H5 I* v$ h" f: j* X
    xchg    bx, es:[41h*4+2]
5 s7 g. o3 o. U8 X" F    mov     ax,4fh
9 b' s+ S+ @# w8 Y. y    int     41h
8 I3 s3 U& f4 o* K' X' q    xchg    dx, es:[41h*4]( J) P- {( G+ y0 ?5 C: Y
    xchg    bx, es:[41h*4+2]8 ~/ C$ K7 K8 L4 J! Q; Z1 j) S
    cmp     ax, 0f386h& T. s: O% H* i1 Y, G; p! q7 z8 h
    jz      SoftICE_detected
" E4 E7 W/ u1 N) G# i; V* H& s" o  U
int41handler2 PROC
3 X. j7 k; j# u6 d+ s4 f: @8 G    iret
3 C. ]1 g7 j+ P: L; l) l; lint41handler2 ENDP
9 E* ~; Z/ u+ A) J
( T. u9 A  M+ e" R$ |- f1 C( b
6 s& m+ Z8 p8 S7 {$ O8 Z_________________________________________________________________________
- r; b0 h- k" M) v4 K6 p' x# V" L  S+ y" U

7 V& n  f. N( D( g  mMethod 06
0 v; R- t* e% H4 I+ ~2 y0 L=========
* B" t$ f$ J( u  z; G- O
5 Q2 _7 x/ D2 q( l5 Q" R5 r6 Y4 B# V' x0 A3 X% C
2nd method similar to the preceding one but more difficult to detect:
( W3 q' X( D) ^. u. R
% L9 T  I5 _7 L, b
' F; K3 s4 r5 }0 ?$ q2 gint41handler PROC+ ~1 }  e% P& R! s& g" j
    mov     cl,al: P$ I3 U: S) v# _6 c
    iret: l" b: L6 y$ O. l8 V4 s  w, q
int41handler ENDP6 B; X) ~6 c: j4 D4 h  [; a( x* d
( w$ x4 r0 g* c- M
; p3 C! n& l/ S- i. C% `
    xor     ax,ax
0 A3 T+ {  {- g1 a( d$ p" _6 d    mov     es,ax! l) O) O, g( e/ A
    mov     bx, cs
% f+ N7 _8 C/ k- r; f8 S& L    lea     dx, int41handler
5 ]1 n7 |1 a+ k7 G' y, p, |    xchg    dx, es:[41h*4]
3 Y" g& ?' N/ {/ V/ n2 k8 E    xchg    bx, es:[41h*4+2]
& o; X! V' i+ p/ m# K( z, l    in      al, 40h1 I3 w/ `+ I, p% a+ W6 u+ X
    xor     cx,cx
1 o( i# _3 b( E$ d9 s    int     41h) p: ~$ C7 i! a5 l( N& E  b1 ]0 K
    xchg    dx, es:[41h*4]
$ ?; ~" a$ e( n9 }7 ]+ L( z& \    xchg    bx, es:[41h*4+2]3 @* Z- X7 h5 k: D
    cmp     cl,al
% [3 T& Y1 g5 m- J  L3 q. @  |    jnz     SoftICE_detected, L- w7 [- D: `! i; T, ^7 r

6 l: k( v) f5 C1 A- O- O" c_________________________________________________________________________+ I) e9 v  U% j+ K7 Y4 @( L
* g, n) v8 T  t0 b8 A. Q' b
Method 07
8 ^3 J6 Y' w6 _; A+ e( H1 K  T$ F( }=========
  f" X/ Q  _% f9 T
/ Q1 O9 a' Q4 a$ d; ^/ S: tMethod of detection of the WinICE handler in the int68h (V86)
* L7 o! Y$ K( b9 k, o) W! m
3 m, }4 Q- _* m5 h# z    mov     ah,43h% b- p8 S$ m7 d
    int     68h
& Q7 |& L$ O. \& ~! R$ C    cmp     ax,0F386h' K$ w& }1 O5 B- g
    jz      SoftICE_Detected
, R7 A3 a+ Z: z" g* C0 ^7 {8 x7 m1 b2 d% Z  r# u
9 O9 Y. H" t( O& N' K
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
- h( v7 ~' ^* C" e( @3 k. k9 M   app like this:
0 C6 R# F4 j% b2 Z2 ]5 |' l+ ?
+ ~- M5 T' B8 A9 d/ o) F   BPX exec_int if ax==68
# F* i  T1 U7 c! n, `! |+ s4 b   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 v9 m% R8 j9 k$ }7 K( S   located at [ebp+48h] for 32Bit apps)
5 s4 g5 _: G8 E! ^: ~__________________________________________________________________________' q9 W0 a/ X6 i% y& ~

, |7 p: @/ v  K7 c( m# ]' l( k1 W
* J& Z! ^$ f8 a1 `Method 083 V" S* v( X4 j, ?. u; p' c
=========/ U0 K' A- R1 l' L5 P

8 _' V8 p/ L" \! e3 qIt is not a method of detection of SoftICE but a possibility to crash the
3 y* P" C, {3 J- U2 A8 U+ |# ^system by intercepting int 01h and int 03h and redirecting them to another( @1 S0 [0 I- X8 s# f  h' y
routine.4 z( D3 H3 \+ U, Q# d
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' I. U8 Y, n6 q& `, [* Tto the new routine to execute (hangs computer...)
5 Q7 `9 a/ A& t, d' l& z0 |& _3 f7 [4 `6 |8 U
    mov     ah, 25h
6 O  ?. k" f* r. @    mov     al, Int_Number (01h or 03h)
" n: p( h7 P5 W    mov     dx, offset New_Int_Routine& {+ b. W6 G1 P- u6 K3 x
    int     21h, J1 D- I% O$ G. m  [2 u! k, D
( V; G1 v0 Q  ?( M3 W  f, H
__________________________________________________________________________, U, ~2 c6 J& G" r2 @

" y! b5 ?' e3 o; [- K$ ZMethod 09! d3 U/ @9 y3 K) i7 {' l
=========! }9 X5 d) @$ ~9 f  S3 I$ b. \. Q: `

, p0 p+ {4 |3 m4 H3 u6 CThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( g! A' T; s  F2 m
performed in ring0 (VxD or a ring3 app using the VxdCall).
* C$ ^( n0 ]1 G$ p4 HThe Get_DDB service is used to determine whether or not a VxD is installed. D1 e3 a6 {8 G5 d3 O0 `5 |
for the specified device and returns a Device Description Block (in ecx) for6 s# L- h* T! w) d! Z% X$ J, }) b
that device if it is installed.7 a, R+ Y( |, H5 C. c9 b

# _. m" r7 L0 ^! r" V( a2 b) x   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# \. {: @/ R! s+ }4 R4 Q, t
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); T4 h4 _) d1 V, X
   VMMCall Get_DDB
# N2 Y/ R4 b1 A0 W$ R) c1 f   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' G+ u4 B2 d- A0 }" F( x  C
- @! z$ O5 @5 R7 u, pNote as well that you can easily detect this method with SoftICE:
, w2 _- r" l& I+ G% N; [   bpx Get_DDB if ax==0202 || ax==7a5fh9 o8 O, N/ [5 k9 r  a

0 w/ f, S5 v3 h/ w* T+ @__________________________________________________________________________
$ X' ^% K% ]& _3 T* L
2 `: d0 x" @1 Q& B: T$ H" ?Method 10) D( ?1 L. n6 [. S8 P" Q* O
=========6 ]/ Y, I) o% R0 }3 Q# H/ u
4 f4 W6 X; s4 Z) ]2 f- o, v0 X2 \
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' H' F. p0 R4 @$ E  SoftICE while the option is enable!!5 _3 g8 U3 W! q2 p6 O

$ x$ y6 i8 W6 V% ]& z8 w, CThis trick is very efficient:
, b# x% f' n( rby checking the Debug Registers, you can detect if SoftICE is loaded
7 U! W: D  X: r' W) T" f& g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; \) {; ]( z* S& i( k4 F9 R! z
there are some memory breakpoints set (dr0 to dr3) simply by reading their$ G* B: D- d1 v. J/ A
value (in ring0 only). Values can be manipulated and or changed as well
; J  L4 I0 ^% C; h. U  L9 R7 l(clearing BPMs for instance)
2 `. D6 g1 k7 @
1 L* R2 s6 f7 ?: U, b# \; h__________________________________________________________________________
6 p& k1 Q- o8 K- _- `" ?- J+ e+ }* d9 E7 b# o4 {0 R3 t: [
Method 11
7 O% F% N. G. v! h+ l9 f=========& N9 z" @7 C1 t- V$ s: z# W
" V1 o0 t% d1 B1 N
This method is most known as 'MeltICE' because it has been freely distributed
9 p& h+ V5 g5 q! Wvia www.winfiles.com. However it was first used by NuMega people to allow4 Z7 h5 d7 r' x( {: m. P
Symbol Loader to check if SoftICE was active or not (the code is located$ S; F2 `- x& _. l. \: {7 m4 I
inside nmtrans.dll).. ~4 C$ T4 L5 Q
  u* M* S- G9 Y6 Z# G/ P
The way it works is very simple:
  r3 o4 ~; g+ ^! E" n  o/ l) k. c- yIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) S1 }2 m" [( n- r  ^# D/ V
WinNT) with the CreateFileA API.
$ I3 `1 a0 c8 Q8 ^  R" I' s" a! y: m9 U8 g5 N
Here is a sample (checking for 'SICE'):
2 M3 I' q/ N4 p  q% O
6 a0 W8 b7 A- Z' n! gBOOL IsSoftIce95Loaded(): T% ]1 |' @0 L: S# s7 Z
{
+ n, @1 W, |  [2 Z   HANDLE hFile;  
* ?+ P* F& E( C5 l  ]* d   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 O& B- [( e7 ]( ?7 ^7 Y8 b/ t% {0 C/ O                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% c8 ^( L+ E0 S+ u- I" ]- B: g                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* L5 t- P9 L3 q" Q   if( hFile != INVALID_HANDLE_VALUE )
1 k2 B, O. u3 b$ Z( {5 q   {
3 A. o& W& R9 c' d+ g1 h, a      CloseHandle(hFile);- S9 k* `! c6 j3 O$ c
      return TRUE;) c4 o3 C/ m. X/ I
   }
% B/ W0 n9 H- U4 A3 e   return FALSE;
: x4 B8 d3 [3 V' Y}0 e( O6 O+ V; G: x9 T7 B
" x* f& K1 I' `% C2 I% V" z
Although this trick calls the CreateFileA function, don't even expect to be
, q) f( Q4 K% m0 L: E7 Zable to intercept it by installing a IFS hook: it will not work, no way!( J1 ?! }; b0 b; J+ P2 i0 ^/ K1 ~' i
In fact, after the call to CreateFileA it will get through VWIN32 0x001F4 ]) ^8 P$ M+ T1 l0 L
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)4 N, Q( r6 b* I3 q' v
and then browse the DDB list until it find the VxD and its DDB_Control_Proc1 j7 C5 A* |9 H
field.
) V$ c6 s* V* d  G4 d; FIn fact, its purpose is not to load/unload VxDs but only to send a
% ?( _! X% q& @/ y& e9 RW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, E% x/ G- g0 L" N4 m1 E4 Y6 Kto the VxD Control_Dispatch proc (how the hell a shareware soft could try
  H; `3 D- e" m9 lto load/unload a non-dynamically loadable driver such as SoftICE ;-).
* Q( K& n( H2 S" H3 H# }2 uIf the VxD is loaded, it will always clear eax and the Carry flag to allow0 x9 n0 o4 h+ a  i4 Q
its handle to be opened and then, will be detected.
: r4 q+ ~4 Y! t5 Y3 x+ M$ z4 fYou can check that simply by hooking Winice.exe control proc entry point- N0 c! j+ G: }; c8 s$ t* l
while running MeltICE.
6 z/ B7 B8 W. B) O' O, C1 t4 D3 z
5 ?# o5 S7 M) {. p! W. n
  00401067:  push      00402025    ; \\.\SICE
8 O& u+ M7 @+ W& P0 P2 X. b. U9 S  0040106C:  call      CreateFileA! e8 {+ B+ t/ H5 L' O- d
  00401071:  cmp       eax,-001
% ?, n4 D) S7 }: z5 F2 S; c; W  00401074:  je        00401091! y, b: A; o( x- C

; D  g- b  U- e: K/ F! D! `$ q
/ v  L; D. V* D2 pThere could be hundreds of BPX you could use to detect this trick.  z/ ~+ H* X7 U6 [; x5 B
-The most classical one is:5 q" S) D/ V' G* p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ E8 a1 h$ S( o$ P' t    *(esp-&gt;4+4)=='NTIC'
$ T2 [9 l, v7 x9 ^7 B2 H$ D$ ~; U# C6 M9 q
-The most exotic ones (could be very slooooow :-(4 A$ A1 ]! J" u& b# j
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    T' P, T8 B  q; G) G3 X- u
     ;will break 3 times :-(
6 O6 ^* v+ J7 h' n, o# B( H9 G- M- Z/ Q" s. }) L+ V' `( r
-or (a bit) faster:
- b# n$ q+ _9 f7 q0 ~# Q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), d! Y2 w* p" k8 }) Y
- ]  G1 E& b5 h$ k9 T: Z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 @' @1 N; Q5 C1 t+ Q: \& W" S- |     ;will break 3 times :-(
0 }$ _( Y( [( B+ h2 ?! S3 D' K: |+ \5 N* }' A
-Much faster:
/ e$ d. |/ U/ F0 X' h4 x5 B- T% S   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. m  Z/ p' U' W' U( w
7 l( h$ L3 W; I
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen9 d* C- j/ ^" p& E# L) N# _
function to do the same job:% F/ i0 y% A! y

1 b; @1 f. Y  y$ \6 j3 e+ a& e   push    00                        ; OF_READ
6 W8 f/ L. _$ m7 F! t- n- ^   mov     eax,[00656634]            ; '\\.\SICE',0
9 q. o8 Y% T$ r+ P+ n   push    eax
8 p, `! _! V. {- C   call    KERNEL32!_lopen
2 ~8 r0 r0 |: T* m   inc     eax# t: F  u9 x/ s$ F
   jnz     00650589                  ; detected
. T: {9 N' u5 K, J# b& j   push    00                        ; OF_READ
; ]% @: L) `) [   mov     eax,[00656638]            ; '\\.\SICE'7 {9 u: X7 G/ m
   push    eax. X7 P8 r( C. S$ B1 n
   call    KERNEL32!_lopen
2 [+ F. U7 h) K. |* T   inc     eax, o; Y. P+ @0 g1 I7 [
   jz      006505ae                  ; not detected: [; Y1 C) e2 j% J6 F" {
6 o6 O- D7 l+ t; I0 G7 @$ A- h

" N+ N4 ~) x* z) z: Z# m__________________________________________________________________________
8 y7 F" d6 h) k4 X! s( Z
  q8 B- ^) M- C* z5 B" VMethod 123 k. n: V% I. V; ^0 N! d
=========
# U; c9 r' u) P. \& d5 f, h- M$ D! G5 [" z, B
This trick is similar to int41h/4fh Debugger installation check (code 05
+ Y8 D, s% U4 {$ z! ]1 h&amp; 06) but very limited because it's only available for Win95/98 (not NT); G& e* V! ~  t( K0 k, d
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.1 L, h) p+ ?  F/ h3 J( I3 k
- a1 h1 N- q0 n7 h: p$ K: c
   push  0000004fh         ; function 4fh/ Q- p0 n3 B2 y. A0 L3 W* [- S
   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 \- o* A7 y+ ?                           ; low word specifies which service/ _! q: _" Z3 y; Z/ ]' A
                             (VWIN32_Int41Dispatch)
* J9 z2 C9 p, {" o3 X  q   call  Kernel32!ORD_001  ; VxdCall
$ T% Q6 Z0 ]. ~( J   cmp   ax, 0f386h        ; magic number returned by system debuggers* X. |, v( o) x1 k- z  h
   jz    SoftICE_detected5 I- M: W; ^4 _0 x4 R  n! H

# E) m2 @2 n( ]' DHere again, several ways to detect it:4 O. q" h( W& w2 d
7 s' D. m3 K* n, ^6 ^1 b# i9 U8 O
    BPINT 41 if ax==4f
# r# q; Z5 B6 X& }6 j6 I  W6 W5 m- v% N- j
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one4 G) q2 ]4 u7 c, z8 f8 C, i

* c. I& ^! }1 U% j, `+ C3 }    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
4 Y% Q# J8 f9 H. g4 s/ K
: W) D( G8 t4 N. J) w    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* y7 s( ?) K+ c1 J3 F' K" y$ D& \. R
( f; P* H+ L1 s' m2 T2 Y  c; m) t" A__________________________________________________________________________
1 j" _+ h* A6 _( N
- \. i3 L7 Z  Q0 jMethod 13( n# q0 `$ J8 c3 |! N
=========/ v. @; Y0 S: |5 k
/ x+ k+ t! j$ a$ F
Not a real method of detection, but a good way to know if SoftICE is$ }9 ?6 u: K7 t
installed on a computer and to locate its installation directory.& b1 k: U. Y2 [! y
It is used by few softs which access the following registry keys (usually #2) :
2 ]5 R, i2 Z+ K7 h
, c! o( [. D0 h4 k- f9 ~. {4 F-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* `) P8 d" p: n; v) z6 [
\Uninstall\SoftICE
0 e& U2 L/ a3 }8 D/ d3 R-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% B! e7 t" R$ l6 [0 M9 ?7 r5 [2 z8 Y, u
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: E5 X5 o1 K& H( Q) }  R\App Paths\Loader32.Exe) s1 h1 N: m# d- N. b# ]
3 [1 \3 A; q1 e5 i$ L: A3 D( F1 O

. s# }5 e+ @" LNote that some nasty apps could then erase all files from SoftICE directory0 Y% L2 _, F. z( [8 i
(I faced that once :-(  ]0 `! W# @, i, ]: S

: F  e& i# T4 q6 q/ ~, k# v# zUseful breakpoint to detect it:
, T5 }0 |5 E. G  K, i/ V6 b% i: j* d3 u) o& b5 x
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) G0 L; h( p7 t3 U
( K& ~4 S5 I# \, x" b__________________________________________________________________________3 t6 l0 Q8 x9 ^3 ?, p3 Y# |7 r5 ^' e  ?
( _0 @  |5 n  X9 j  n# _
. x7 i. s6 t: Q1 q& ~" A, C& W: z
Method 14
% O' F1 L' r2 {( j1 v$ R" l=========
5 h4 c* }* V. w3 ]$ L: a; H$ l8 h1 }9 r: h
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
' k* S2 g' F2 V: s  w! k& X& His to determines whether a debugger is running on your system (ring0 only).
. v# B& [  W$ q
% u% s6 B% C4 f' l   VMMCall Test_Debug_Installed
- |& s8 ?0 I( O; g/ v' j1 t  g) W- k   je      not_installed
9 r" e8 Z, L+ k+ E( S1 x
# Q1 G0 V- ]0 `  e' A& t1 y  OThis service just checks a flag.
( h' q7 g+ D6 \+ f</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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