About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) t5 I1 l! i& J; o- z$ y<TBODY>9 i$ c9 c1 [: k
<TR>
3 W2 ~: d' U( _( _  {! o% r, \<TD><PRE>Method 01 & s! ]; f3 B9 D- d) n
=========; _4 x2 N4 m+ q5 A
) u) \: z1 A, I" Y- j8 J# Y
This method of detection of SoftICE (as well as the following one) is
- ]; B- U. X5 G2 z. ^used by the majority of packers/encryptors found on Internet.9 c% Q1 O8 Q0 m) d" q# T. l
It seeks the signature of BoundsChecker in SoftICE
# T  J4 U  S# j" r6 t
+ `3 s0 @2 Y, K% n( Q. t8 d    mov     ebp, 04243484Bh        ; 'BCHK'
" b1 J- {4 r- I1 G# \2 f; v    mov     ax, 04h: a3 r$ M9 F$ |. g" _" U/ B
    int     3      
- p/ F$ d6 M" T5 R5 S+ V" t* r' t    cmp     al,4
! |$ l) D) @" \8 V3 z    jnz     SoftICE_Detected
% C9 k" U. g6 X
& X( _2 M6 u) N! L) `9 {! D4 g___________________________________________________________________________5 `* l6 W$ Q" h( V$ X
" q! N! T  V' b; Q$ t  z
Method 02
: R% V' ~! H8 w=========
6 ~! S/ [; F* `1 [0 ^( S
5 B4 |" _4 D4 O! n  J2 S& S3 dStill a method very much used (perhaps the most frequent one).  It is used
6 j- U6 X+ i% L; W, `! f. mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) |" {  s& b5 v: xor execute SoftICE commands...3 u; h( h0 t, w+ Y8 ]' B* R3 _+ c, G
It is also used to crash SoftICE and to force it to execute any commands/ z- j9 E4 \( \: u/ E! R  U7 F6 c
(HBOOT...) :-((  
, W' M! `+ r4 I& F& S0 [* \# D" ]' k
Here is a quick description:
- P) v) [. L$ Q4 e6 h-AX = 0910h   (Display string in SIce windows)5 L: T# i( ^' z( J8 H" J
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) @" ]  ]3 Z( j; B
-AX = 0912h   (Get breakpoint infos)  w5 X0 @; T9 o
-AX = 0913h   (Set Sice breakpoints)
& R) X1 @% i3 c+ H" U# o$ s) p-AX = 0914h   (Remove SIce breakoints)
; @: \* |: d- g+ l; O  k4 j# D: `( O0 X9 Y1 Q" v: [. n9 d. a( Z6 |& k
Each time you'll meet this trick, you'll see:
$ t$ i! [1 |3 q* X-SI = 4647h, s2 F$ y+ k: n6 r+ C: T; Y
-DI = 4A4Dh* v2 R2 B2 e+ ?% s; b' g& l
Which are the 'magic values' used by SoftIce." S  s* A# _/ p; q- V
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.. n" i5 {8 G1 t5 ?+ R! `  n3 o' Y

( y/ p/ ^% N: q( t8 |1 P5 O3 hHere is one example from the file "Haspinst.exe" which is the dongle HASP
6 v$ i  ^$ ~' K8 g# [" pEnvelope utility use to protect DOS applications:
. X3 z5 y( {3 R8 w- c2 Y7 c- Z8 W; h/ E$ `$ K$ R
5 i. n; b; T2 P4 S. t- j
4C19:0095   MOV    AX,0911  ; execute command.
2 q+ H/ a$ V% I/ r1 D$ x% I4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 B( p+ M& p  O/ ~3 J8 B
4C19:009A   MOV    SI,4647  ; 1st magic value.4 E: q2 q9 l- k: o/ {* H# C" U
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.4 O, V! L9 u) }) Q' T) J' J
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- X, c/ V6 r0 Y8 |; b& b4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ [' v1 v' b! e8 o. z: t
4C19:00A4   INC    CX
3 h( K( R& T" N- S4 j$ s% I; W- I4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- D! v7 `: Z* @* q9 l. [4C19:00A8   JB     0095     ; 6 different commands.! x6 I' }* s, }, Y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  V. h( n' `, @. `4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 J3 G# @1 O- p: o4 ]0 w) u/ E/ }* \% p; h
The program will execute 6 different SIce commands located at ds:dx, which
& G. f; p# I5 j) @are: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ b  |* M+ ?. w" b6 `' k1 W7 s1 k# Z2 E

  j7 ^9 |" f/ ^* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ F, b# @/ t5 p! i# I; }
___________________________________________________________________________8 p8 ?5 c, O1 T/ ]

5 W, A4 N+ O: \( o6 t+ F5 d$ M' @: g0 f
Method 03) m6 A' i; Q" M; z! Q8 e
=========" E! q9 h' `# d" m; S0 j/ l
) M- N, c9 W( S* Q. \5 D9 }. M
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ r& y" t; t: d! N3 H
(API Get entry point)
% Y6 X( ^  ?. q2 R9 N, n( N        
8 p; q+ i: s6 K) n6 d
& I% y/ R6 I/ b3 v, v3 N; j8 o- @    xor     di,di
6 o! O  j! w  p: U    mov     es,di
7 d' [3 q2 `+ N5 Q    mov     ax, 1684h      
9 u1 S' ]: }9 d( |7 r5 }3 s3 V    mov     bx, 0202h       ; VxD ID of winice# C) Q7 o  b( Y
    int     2Fh
, ]/ U" m1 H: a$ u! ~' o7 A$ L    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ }; M8 |1 G8 g    add     ax, di
0 i; p: d: T2 }/ v, y( {3 ?    test    ax,ax2 W! R0 D: N- I) I3 E' b
    jnz     SoftICE_Detected2 |/ }) c% s4 t& G% ^& J  v2 B

' F. M+ S/ x( r( j9 @___________________________________________________________________________
. Y  V( l; o& ~+ f1 }
) C  z8 A5 W- F  H2 p# K0 jMethod 04
+ Y3 [' E. @7 ^=========* [; w, Y/ R2 j9 V  ^
8 p% n' h* E9 Y
Method identical to the preceding one except that it seeks the ID of SoftICE
1 `# a0 X, o' {6 |0 l6 tGFX VxD.
( n3 w  P) v4 p) l9 }
( l! P% ]/ V$ t5 Y    xor     di,di: N* R0 ?; B- ~! b1 k
    mov     es,di- Z& V, a$ h5 v5 f
    mov     ax, 1684h       4 @' \6 A5 `, V+ {! R
    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 {* E# j/ G2 f  e0 f' U
    int     2fh, s& P& `; Q3 I8 E0 {) i- ~
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% d; G  W8 p. C6 T, l, l
    add     ax, di6 E/ y3 K5 z8 m2 A9 V
    test    ax,ax
! C2 |+ a( d& w6 F0 T' o) K6 d    jnz     SoftICE_Detected2 F% m) t' b( ^* M$ |& B2 n

* q# x; f( L* r; z0 ^7 o# e5 _* n5 `__________________________________________________________________________; @' `3 H9 a% L8 ^  _
! h3 @; z* D7 i2 K6 l( Y
! T  d: m2 u: k( }) E6 O; t
Method 059 Y+ K. N/ |5 ~6 A8 M5 x1 x
=========
/ G0 \8 X9 ~' f; L( t: j
/ p. B9 a$ k! ]3 z$ W$ `3 vMethod seeking the 'magic number' 0F386h returned (in ax) by all system
% K9 o/ I7 a- Sdebugger. It calls the int 41h, function 4Fh.
; c# w8 z! W# T6 b& zThere are several alternatives.  
! J7 s0 V: i! ^3 C
7 E; B+ ~$ g) F" tThe following one is the simplest:
' l0 ^% V: a4 B3 L: ]  k. r* B6 }1 M9 Z3 f& D* r
    mov     ax,4fh
/ p$ t# C, W! A2 n/ H7 W    int     41h0 R2 U8 C% F5 y5 f6 ~  P
    cmp     ax, 0F3861 q/ h8 Q! b  Y1 h2 T
    jz      SoftICE_detected
; |3 q! C2 I/ j% F7 J) Z5 B- O. H! [0 A

7 _6 E9 k) J! i1 w1 h! W& SNext method as well as the following one are 2 examples from Stone's
4 d. h% I7 q/ W"stn-wid.zip" (www.cracking.net):1 `8 P, Q, a0 m! A/ {5 y* q

  x- ~. K1 P& u- Q, p    mov     bx, cs
: J4 {5 E$ n& I5 e3 Q' _- o; J$ m    lea     dx, int41handler25 ^$ k, R3 \! |9 m" ~( S
    xchg    dx, es:[41h*4]
3 S* {- K" S* ?3 |% ~    xchg    bx, es:[41h*4+2]+ a0 b* ?" m: F; X& M
    mov     ax,4fh
  f1 E& l) L0 ?' C& ]1 {    int     41h( ?* R1 P3 T6 F
    xchg    dx, es:[41h*4]% x" E9 a, m  _4 }
    xchg    bx, es:[41h*4+2]* y  R% m  R7 k" ]  L9 c0 x3 ~' `
    cmp     ax, 0f386h$ B- o7 r* G8 A& M
    jz      SoftICE_detected
( t2 z) t7 _/ N" c7 E) t+ B- Q7 {4 e% q# b# ~- S# i
int41handler2 PROC
0 g4 p6 Y+ M; g    iret
- x! A' U7 h3 E; |int41handler2 ENDP
9 [5 B0 a2 R! J" f6 N
+ D0 s" _5 c; Y; ~2 x$ N
- y( @- j6 `# v8 S" B_________________________________________________________________________( W. d* N" Q6 h: _
1 P! `% Y1 ]: w! O* e

# I$ }& S; M$ u0 lMethod 064 S3 E2 R$ F. ~- c7 d8 L
=========8 \0 s+ q8 U2 C' j; E% R
. H8 }& ]0 ?- ]4 k  ~' o

7 o; Q6 W9 w; M8 v2nd method similar to the preceding one but more difficult to detect:/ w) v- r3 r4 {
. y; c! D! U! O/ j+ q. P: _6 l
7 @" D- p! N- x
int41handler PROC
  K0 O) t1 m6 S3 s+ M    mov     cl,al
' e6 W+ c* r& e  Y  g    iret. @1 m' C( {' R: s9 _+ z  M
int41handler ENDP: E0 G. Z- _6 h% P! p; P

8 `, ^( T# z1 d9 q: D* w7 W2 Q0 ?2 X3 v: r/ ?6 Z/ ~* H
    xor     ax,ax
+ a. a7 o5 g3 p    mov     es,ax
3 s3 o& e$ S# n' y, p" R. K    mov     bx, cs/ v/ m9 q. x5 T1 D6 w' k( v
    lea     dx, int41handler
) x: h. ]! H' O    xchg    dx, es:[41h*4]
2 K! K( l! |' W( w    xchg    bx, es:[41h*4+2]* I6 C' @+ t9 h
    in      al, 40h
+ u2 U. y, u, r    xor     cx,cx
) G  b% i) r% ]9 W  v    int     41h3 |" u+ u7 ~- H- W
    xchg    dx, es:[41h*4]
% G8 G" I3 e* m( E" R0 I    xchg    bx, es:[41h*4+2]( r4 K0 [, _) W: e' v
    cmp     cl,al
1 p! c; f# V( k- Z    jnz     SoftICE_detected
6 |1 e0 m  j! E: g; n2 s1 [% T/ q5 n1 g( e0 c
_________________________________________________________________________: V* R1 A" B+ }1 \; t

7 s& i1 p# I: Y1 j% H$ HMethod 07
) B' ]& H) v: t) L=========
1 C0 G8 q# B, F' P* G
7 x+ p7 f/ j  N/ R, Z. q4 e$ eMethod of detection of the WinICE handler in the int68h (V86)* f. o2 t& z; V# G7 |6 A, g
+ _; Z) L' @/ K5 \' N$ F0 @; l( e
    mov     ah,43h+ i% w/ W; C, P  V) r# K
    int     68h
; c9 J, T2 y1 x. B- O* C' q    cmp     ax,0F386h
- b7 \  s) X- `4 r4 D8 v    jz      SoftICE_Detected: }$ B6 m; q( W1 |6 |
+ w* C: a( j. J8 R6 V4 Z

% z' R. h$ `8 d4 J5 D# ~/ f; I=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 ?: ]# ^# B1 g7 X   app like this:
) y+ G+ f6 ?9 j2 i& y7 s* C! v8 ~+ l. a: t
   BPX exec_int if ax==68) D2 V* j% G) U/ }" I  ^0 P0 u) O$ b
   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 L0 i; Y5 S" I# ]5 \& {   located at [ebp+48h] for 32Bit apps)" G7 o$ A9 k# T# x  o& D- N
__________________________________________________________________________
6 o3 T. e, V( Y$ S; G
; R( ^# L" B2 i. w* S. U) g
( k, m/ ]9 [+ K+ WMethod 08* F$ D& g0 K7 m, i* i4 p7 Y' x/ ]
=========9 n+ H& T% t! u$ X5 z+ l

# ]( G9 p" O& EIt is not a method of detection of SoftICE but a possibility to crash the
) {3 |. R5 T/ L8 b' r- k2 Lsystem by intercepting int 01h and int 03h and redirecting them to another9 e" S- T- K) Q& A' }" p4 P9 m0 _
routine.
/ _# |6 o1 {' NIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
9 W9 b% x! |4 d, x, Vto the new routine to execute (hangs computer...)7 z; ~. a' Y2 x8 L7 Y0 \+ e
) h0 P5 G. q* u6 f8 U
    mov     ah, 25h; o  _: W% n0 r; z8 z$ W( b
    mov     al, Int_Number (01h or 03h): J* I& d0 a/ ~' N
    mov     dx, offset New_Int_Routine7 ]8 Y9 L. S) h. g! z, b: i
    int     21h
- N# p+ }& W- V7 Q" s7 x# D1 V7 a  J
__________________________________________________________________________
6 N; U& p* _' F
. M7 d4 Z6 @+ n, TMethod 09  S$ L7 b4 C7 C/ B4 m
=========
. @9 k4 ~) X$ M& c# I
9 l% _& y) q* |( bThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only# b3 Z7 E$ ]* A5 j9 I
performed in ring0 (VxD or a ring3 app using the VxdCall).
* K/ [" ?) C* YThe Get_DDB service is used to determine whether or not a VxD is installed
1 n0 \7 O1 h0 a' W1 H6 u* n, |for the specified device and returns a Device Description Block (in ecx) for
% k8 X9 [' i6 o& i* D! [/ {& Bthat device if it is installed.4 b/ {1 E- D& K2 P

1 p  u* j4 U+ h8 [, e   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( ~' l, a/ r4 d; [# m  g$ m- E3 f   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
+ C5 r3 w. u* p2 ~: D' V/ I: D" r9 d   VMMCall Get_DDB
1 T. S, ?6 s7 ~9 B   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* c9 u% i- X, j
) m4 ]# M9 t. N& @4 _Note as well that you can easily detect this method with SoftICE:
9 v7 b* U2 f/ R; @   bpx Get_DDB if ax==0202 || ax==7a5fh! s0 N! U' |8 G, P* g# U9 A
, ]0 B& n& ]" S1 }' L+ R+ f1 Z
__________________________________________________________________________  v- c5 z9 [% \5 I

1 o/ z4 ~; D. A+ k9 pMethod 10
7 G8 n. |' a0 f& L: y. N=========
6 B4 ?8 r3 F% y4 Y: j
4 l2 @- H2 b3 U5 ?% D4 L=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 w& V& K8 p, P3 Q' o9 n
  SoftICE while the option is enable!!
1 \9 v, r- {0 W+ G4 v! _
) [' u+ _9 @" I  G: I8 a4 nThis trick is very efficient:/ G. r- l- r9 ]8 S/ v( }5 @7 K, B
by checking the Debug Registers, you can detect if SoftICE is loaded
  s$ Q, l! @3 X0 X; g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& Z, B/ \  w( m
there are some memory breakpoints set (dr0 to dr3) simply by reading their5 N, u- i0 k3 r+ e/ f
value (in ring0 only). Values can be manipulated and or changed as well& r: W5 J/ X6 J# u+ e( _) V
(clearing BPMs for instance)* f) L5 G, w$ K8 X- Y4 b
. u* x# [/ l; l4 N
__________________________________________________________________________
' F- T8 F3 J( \2 Y
  h( P( ]& M; JMethod 11; s+ V! U: n0 ?8 p. _
=========. }1 v- |$ d( M  O: U

+ z) y' S/ ~4 I& LThis method is most known as 'MeltICE' because it has been freely distributed
. d2 d$ l3 I7 A9 t+ [via www.winfiles.com. However it was first used by NuMega people to allow
" c* j$ p/ d4 D# \Symbol Loader to check if SoftICE was active or not (the code is located
( D& t: c  H; \6 N' Winside nmtrans.dll).  Q/ ~# Q$ x- {) m

5 ?4 C$ ?0 K5 SThe way it works is very simple:3 P2 @( L5 [3 S" }. n. ]) ?
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- f) z9 _4 \( }9 F7 E7 a0 N& Y5 p9 \
WinNT) with the CreateFileA API.
" Q- n0 K3 L) D# Y
, j8 v* i% _+ IHere is a sample (checking for 'SICE'):9 r' c/ y2 x8 h& M
; l" \+ r# }* G( m
BOOL IsSoftIce95Loaded()( Y9 r4 G, Q4 d7 M, h/ S
{
0 _8 y  U9 [: f6 L   HANDLE hFile;  + X& _4 \1 `+ m1 D, s; L
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% d% V. e; w0 R
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 A7 t" r/ d* R1 \2 s6 m! }                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 k* A1 i. j! x8 s
   if( hFile != INVALID_HANDLE_VALUE )8 F( C2 J/ X! ^# i" V. Z: Q
   {
' h+ ]5 a) S% l9 J6 ]: O      CloseHandle(hFile);
# I6 \" l- o! s( Z: p7 K      return TRUE;
! b; s* C+ ?7 L9 D   }# k% U. F' |7 D2 X9 [
   return FALSE;
; ]; w7 }7 t4 _; t$ m4 v& X}
" {6 h! L: z7 ^8 K; K: e5 E& f* I& m7 _0 s" a
Although this trick calls the CreateFileA function, don't even expect to be4 \" ^* z0 a& O; K) c
able to intercept it by installing a IFS hook: it will not work, no way!
" m) @. B$ v6 f, PIn fact, after the call to CreateFileA it will get through VWIN32 0x001F& J3 s9 R; v- h0 z. z, A
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 n: j# u4 b3 f! B3 n
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ L% B* ]8 I# b+ _- v+ V9 q5 m2 C, j
field.$ [6 l8 i0 ^& ^# M9 d
In fact, its purpose is not to load/unload VxDs but only to send a - T- {$ L& e0 d3 L
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 G! B% Z9 y1 j4 ~+ `4 Ato the VxD Control_Dispatch proc (how the hell a shareware soft could try  M. L8 i* h6 a  a: T
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
2 O% h# {/ y8 `8 PIf the VxD is loaded, it will always clear eax and the Carry flag to allow; O$ c6 @* m1 e: b
its handle to be opened and then, will be detected.' @7 C  Y3 ?4 |# ~! f3 d
You can check that simply by hooking Winice.exe control proc entry point+ m: q6 m3 E) L
while running MeltICE.
! C5 Q. |  K, P. H
/ {4 l  z' f$ f8 @+ Z
! V* \( W! B& E7 z# @7 O' V  e  00401067:  push      00402025    ; \\.\SICE
8 `' ?: p9 p- v( I' U, \# w  0040106C:  call      CreateFileA; x% b0 t  H' d  w' f/ W3 F
  00401071:  cmp       eax,-001) s! L6 G) V& ^* N: O& k8 ?
  00401074:  je        00401091
/ z) E' s+ n2 M$ r8 H+ y0 s
6 ~+ F' s6 j; J2 r
$ }0 D9 E  R8 w; oThere could be hundreds of BPX you could use to detect this trick.
( N6 \4 B  M; {5 M+ u: r! y-The most classical one is:
" \$ h$ L( b( {- {$ v( _  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, i' J; g! b0 W; S- U$ _! X4 i; g    *(esp-&gt;4+4)=='NTIC'" D8 N0 _! Z8 h9 i: E
, {8 t: R$ A' Z7 m
-The most exotic ones (could be very slooooow :-(
$ @( w2 y3 c1 G; |   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & `( T9 x: d1 o$ t& w
     ;will break 3 times :-(" y7 g7 u8 ^! Q* L3 P
) z# d1 H+ G! S( b
-or (a bit) faster: # N1 g5 F7 F; P# _; G, F1 S: q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')7 z' j! O6 Z7 R$ Q- p; K
- f" f( ~0 n$ ^* S6 n3 f- J- `
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + {2 n& Z) N: Z3 n
     ;will break 3 times :-(
% e5 N) b; _1 V  Y' q
# O- m; D( k8 l0 E, T& [-Much faster:
9 G5 I9 X+ ]: B; x- J   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'# i1 i& Q1 d) m4 g9 O$ P% b

: D- y, }9 D' {) O- Y, M- yNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ q% q$ R, {  q- }" [) d# x7 ffunction to do the same job:
6 q# n4 s( z9 t7 B' ?: z2 P+ ]- k
4 n7 E  z' {, d5 b- ?) b4 j   push    00                        ; OF_READ" l6 T) i' [. p6 a$ x: T& W1 G; ^9 }
   mov     eax,[00656634]            ; '\\.\SICE',0" B5 l, B6 v6 y) c% Z
   push    eax; ~( }) o; X3 I! U3 B
   call    KERNEL32!_lopen. h9 u: u& o1 n! d0 C- J
   inc     eax. X9 }6 b- R3 U2 N3 A
   jnz     00650589                  ; detected
( d# G0 _& E  X0 U: a   push    00                        ; OF_READ5 B( C' ^0 X9 \8 Q/ l
   mov     eax,[00656638]            ; '\\.\SICE'
1 G& @. s) |9 I" R/ Q   push    eax
' h5 ^4 ^1 }1 J: g( w- I   call    KERNEL32!_lopen# T7 T# c. i2 D9 c
   inc     eax, u3 R( v% ?% V5 C$ a
   jz      006505ae                  ; not detected5 _$ ^* h# K4 I: I' k  h
9 H2 J- N5 w6 N$ a; @( M
% l3 F- p0 ?5 u$ w, Q1 I, V1 Y
__________________________________________________________________________
& M: S% a! m9 U" y% |5 i, T' v2 j
/ m% O* @1 l, o/ C; A5 Y  @Method 12
6 q& e! C7 t% [6 E=========$ U: p6 ~! t  f$ X; R/ X: ~

! F, M* Q9 [: F% I2 V9 |6 s, xThis trick is similar to int41h/4fh Debugger installation check (code 05
8 {- Z. `+ A6 R7 \5 N&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( z& d$ C6 y: r; V8 ?4 f& F* w- }as it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 ?; z6 ^6 A0 ]/ i. L& c! X
! n! j$ }: B1 z1 \# q0 B
   push  0000004fh         ; function 4fh
, U& |% a; ?' K" m3 p( K1 i   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ c, s, S2 v5 `. x6 @                           ; low word specifies which service$ N  c- H6 A3 {) g2 j' c
                             (VWIN32_Int41Dispatch)
$ c; S$ U: c" u+ D/ _$ ~   call  Kernel32!ORD_001  ; VxdCall+ U/ K* l/ B. t# c, T4 }2 I
   cmp   ax, 0f386h        ; magic number returned by system debuggers( ?0 b" x; V0 q6 M; E1 V% o
   jz    SoftICE_detected* K; l4 b9 M0 A# B
7 D* H) ~) N5 Z
Here again, several ways to detect it:
6 d! q5 i6 o0 Y6 R5 y) ^- J" N+ q4 T+ U' D0 B3 Z% w
    BPINT 41 if ax==4f' n8 {7 |1 s- D+ t( q

7 c! n1 z( [/ _' j5 V( ?$ @    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 O6 f7 s- F  ]9 s& G# f
- p( f# |; X4 _
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 |% M# s3 M. y& q: k
1 l% Q9 L% {# \( [. v5 a
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!" R/ Q# v( d3 m, b0 A, m# b
- ]. E- A6 n& ^: o
__________________________________________________________________________( C" X+ r- w  z# `+ {. h1 G
( s, h! A; s$ G3 d* g4 F
Method 13
" s! e, T% [# D( S1 ^=========" y: B0 H! T6 }; |

+ D4 s& Q6 d  Q/ PNot a real method of detection, but a good way to know if SoftICE is
+ u: b: x3 c; _. x' Uinstalled on a computer and to locate its installation directory.2 f1 w; x: U0 v
It is used by few softs which access the following registry keys (usually #2) :
4 W, J* Q8 G" W4 Z; ?+ {! i1 H, d( y' X
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 J  H6 a* j- @5 P# B. P- q* i
\Uninstall\SoftICE
) _4 x! C* H0 Q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
. p& K$ C6 @% g. L-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  B7 [$ Z  {  ]1 b9 E\App Paths\Loader32.Exe
1 A9 n" y# X5 z, H0 o' ~
6 m8 I4 ]: w* {  q. X8 ^" z
8 }: Q( `, l0 w/ b" ]. MNote that some nasty apps could then erase all files from SoftICE directory1 E! w: |" i) i- H. f  b* ]" p( N
(I faced that once :-(
( Z4 y( r2 l  n6 V- k5 }0 o4 d# i) E) P" X
Useful breakpoint to detect it:
3 z4 T' z+ _+ X+ x+ j8 V* P- c8 K$ \7 k( ?& E" i
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! H- V+ a! C: W- y; C# P  S
5 |$ x2 P& Y5 I1 ~
__________________________________________________________________________3 m3 p2 \* V4 C9 J0 g) R
7 G2 ~* M, A/ X* m
- i! M+ f$ U1 @# F' X4 Q2 w
Method 14
9 V0 g2 j$ t/ X3 _# u=========
7 L6 O5 Q" `3 z% q9 {1 z0 k
8 E; }  A8 J. a, _7 y9 {A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% t: n, l$ b6 x- ais to determines whether a debugger is running on your system (ring0 only).
9 ?) j$ v( s; j) C- `* @- Z( d8 k  }5 @# t! ]
   VMMCall Test_Debug_Installed
  j% z4 m/ O1 K( N   je      not_installed+ k- P3 j. |! e. E# D. t
! d  x$ d' Y' H* w: ]+ V( ?
This service just checks a flag.3 W' R: X, Z# f) _- r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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