About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; X8 G" m& o* e$ g" t6 ?( |. X<TBODY>
% O6 f2 z* e2 x0 A<TR>. h0 ^; e  D6 ]6 g: f' ]
<TD><PRE>Method 01
6 y$ ~, M" e9 ~% _) N& \- H4 t=========  I$ j- U# }* D: {" m3 F0 g

; I9 ~+ {* |2 S5 h6 N& G+ y  j, aThis method of detection of SoftICE (as well as the following one) is
* _8 s+ v- d3 f. h% bused by the majority of packers/encryptors found on Internet.4 }0 g/ n0 E4 X) w6 @9 G0 V
It seeks the signature of BoundsChecker in SoftICE
! |9 l* ~  l& J' M& G, g' [. x; d3 L  L4 a! U, ^
    mov     ebp, 04243484Bh        ; 'BCHK'
! S$ m5 a  q" o  d# y& K    mov     ax, 04h
3 m1 Z- c6 r$ u1 [8 g/ @    int     3       0 {9 D' w/ }( u2 t
    cmp     al,4) T, F( R. a4 t. t/ j' x: y
    jnz     SoftICE_Detected
0 [; A9 y: N3 _0 v2 w/ I: H  `, @  B1 V" p7 E
___________________________________________________________________________
( v, Y: L$ l+ w3 H4 N" ~
2 e- p  |+ i* u4 V& Q# ~" oMethod 02
' S* |; ], B. u; b=========) X! ^3 Z( x  E' d9 R
$ {3 B/ j' [* U$ {$ ^
Still a method very much used (perhaps the most frequent one).  It is used0 m4 g: H* O# o9 G0 X4 |0 f* m) @
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% T  Z# u+ G1 E6 Q( L7 ror execute SoftICE commands...
/ n8 x- i1 C% O; n, `5 N1 a) oIt is also used to crash SoftICE and to force it to execute any commands. a% h' c9 y: H* }: d0 @8 S: [0 h
(HBOOT...) :-((  * s* o- ^2 j& h
: p6 E& Y9 B" ~/ z# w
Here is a quick description:8 u0 ?! x0 y5 G
-AX = 0910h   (Display string in SIce windows): b6 x+ a" O- [/ s- K. g% N
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
$ v4 S4 j6 Q$ c6 B# f0 b-AX = 0912h   (Get breakpoint infos)
* B4 m) K  Q9 f: ~-AX = 0913h   (Set Sice breakpoints)8 Q- r: V0 J) |7 l
-AX = 0914h   (Remove SIce breakoints)5 K" b- _1 O; X

5 z) S1 v  }& PEach time you'll meet this trick, you'll see:# \. Y2 {- V  v0 V$ M3 T  d( Z
-SI = 4647h
( _& v. I3 `; J) T7 j+ R; U-DI = 4A4Dh* v$ }- _% Z5 n+ J. C4 w
Which are the 'magic values' used by SoftIce.. a9 w' n' n) `% p3 j
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 P( Q' T. N1 l
. }+ _1 |5 e' W% v* `0 v. {
Here is one example from the file "Haspinst.exe" which is the dongle HASP
1 t' b0 w5 [! l7 p# P) fEnvelope utility use to protect DOS applications:
* t  H$ v& }  s. I. f  T1 c4 s+ [7 T0 U

8 c6 w5 N0 O9 l! `+ N4 S4C19:0095   MOV    AX,0911  ; execute command.
' P7 W, @) ^! m! ~9 p3 I( v& }4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. Y6 j9 _7 Q3 q
4C19:009A   MOV    SI,4647  ; 1st magic value.6 k- |3 p2 U1 p5 M' `) t
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  }0 o+ ?, A: ^4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
$ N7 g* W6 D9 E# b, v3 |7 E4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
% j; j6 ^5 Y; B- ^4C19:00A4   INC    CX# g' @- m# y$ I6 P4 W2 s
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% \7 @  l! u" x  O+ v7 O
4C19:00A8   JB     0095     ; 6 different commands.  \; `  k1 e2 v8 R5 }
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." r1 L& c2 {) \1 Z
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :), y- D/ K: l# E# o( z" {

  ]( ?$ Q4 j8 d- G$ K1 l2 VThe program will execute 6 different SIce commands located at ds:dx, which5 C: {% A0 k; C
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- C' W: i8 U# [4 z
9 X% n4 R  Q& l+ l6 ?$ _$ Y& t1 J. Z" f6 v
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 _8 v( f. y0 y5 v' x___________________________________________________________________________$ \, {* ~. a4 x, k9 D
: ^# F) h9 s; x: R' T) X1 k
1 b- F; @% R5 U$ I' f
Method 03! j# B) ]7 W$ `
=========
* Y9 ~& f6 h" {
# d; O$ F* i7 \/ i' j% [. I# H, k5 xLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: e2 w1 y" t2 I
(API Get entry point)
7 u9 E: x- A- @        2 N8 ~* L, J8 U% [) Q$ p

% k# }4 u) u/ y8 K- V7 h    xor     di,di
/ Y; d' s: I% @4 e$ x; U8 U    mov     es,di
: g, H6 N, C; r, p, V    mov     ax, 1684h      
8 a# h  t5 ~& }* ?% g    mov     bx, 0202h       ; VxD ID of winice6 ?" Z' d! U, h
    int     2Fh
) N0 x, s; X! h# Z! |- b0 ^/ E) G    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 Y  Y# O5 O8 m% J3 W# B( G( M
    add     ax, di
# I4 ]: }" P" M8 l  [: ?1 w    test    ax,ax# M5 i0 k. h( U1 q' ^# s
    jnz     SoftICE_Detected
. ]+ o9 ]" P" s$ y- l
9 f- n$ K8 b' k! L6 @___________________________________________________________________________. K0 Z" W& W* U5 G
9 Q' F% U. c  D! _
Method 04
/ o3 T- F7 o' C- U8 ^=========
; G; i. |9 K0 m0 |+ x& D" C4 _. Z' ~4 G/ Q
Method identical to the preceding one except that it seeks the ID of SoftICE
7 E* n5 Y- E% D% y! P- d! Z" AGFX VxD.0 A6 U( y, k8 I6 t! V9 B! u
' T( I5 y4 ^% Y& p
    xor     di,di
: c* R# X9 n% L! d: h+ ]" m+ D1 M$ ]    mov     es,di
! l* u" |: ?  |- {. d    mov     ax, 1684h      
) d1 M9 ?  q0 Z) ^( y9 y9 A    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 O  ~" S7 f( ?, a) ]    int     2fh
; B% l5 U: m2 G9 q! g9 l. y    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- b( I: H0 x1 ], W  d& ^6 t( P% s" H    add     ax, di4 n& A' m7 n6 [. l
    test    ax,ax) E/ Y+ U/ n5 H! {$ j8 L; Q
    jnz     SoftICE_Detected  X) \) u1 ?2 |6 e; f
; c+ Z2 _8 ?6 O8 w) I$ f
__________________________________________________________________________
+ e) J3 C6 U$ w; D/ _" F3 @4 d) H( g7 C
- t- d7 o: H4 l3 ], a! @1 w
Method 05& i! @* d4 ?/ G  j# J6 `) R9 e6 P
=========" m! w% T& F% v

% Y+ P+ Z8 m  t) fMethod seeking the 'magic number' 0F386h returned (in ax) by all system. ^- e% q( X- h6 J5 [
debugger. It calls the int 41h, function 4Fh.$ A2 S$ P( X! w0 C7 ?
There are several alternatives.  * e& q# P! t/ {3 f1 W2 m
! W! J. l- v4 k; m* C
The following one is the simplest:
2 v4 C" [) m+ [/ ]6 b; a9 S7 b  ^* j
    mov     ax,4fh! b. \% H! k' R- I
    int     41h
. ^2 K! i1 c8 @) W4 w    cmp     ax, 0F3868 c1 M  P  A, B, r" j9 ^/ T/ _, |5 x
    jz      SoftICE_detected
5 i# a/ }% Z& }
  m3 ?% z1 k! _: b
9 b, N4 s) x, T% R: n- z# n7 i* rNext method as well as the following one are 2 examples from Stone's
4 K7 m5 p: k; V8 q, u7 G"stn-wid.zip" (www.cracking.net):' N0 W6 M% G2 D6 R$ z& p) z
. ?: o4 f% H1 i( e% U( L" s- t
    mov     bx, cs
' T# L8 H) g/ e  r    lea     dx, int41handler2
/ C0 O3 w* l" ?. |  r# \1 R. z( r    xchg    dx, es:[41h*4]9 w$ z$ ]6 b+ G: e6 r
    xchg    bx, es:[41h*4+2]! c$ T+ Y7 R* s# Z$ _
    mov     ax,4fh
$ F1 P; A7 Y+ I+ `    int     41h
4 |! b# i* g4 w/ H    xchg    dx, es:[41h*4]6 ?3 K4 ]0 n# _8 v! m( U$ z% g
    xchg    bx, es:[41h*4+2]
" n. L1 o* }. b# u  s    cmp     ax, 0f386h
2 j  t& J6 j( J    jz      SoftICE_detected
4 E- x% \) q; y( ~8 {- A, V# M  ]4 p4 I
int41handler2 PROC1 `1 \7 ]+ W- ?! y9 W. s
    iret
/ `, ]) o  e9 F2 w4 m* ~; Z% f# c4 ^int41handler2 ENDP
6 q% q) R) y: G/ M( x. |. ~: l6 X& n) w: I7 n/ c  o
6 f, P$ W! H: e$ i2 m4 m
_________________________________________________________________________
+ u$ a; r( k0 h* y0 s4 h: q. D* ~7 z0 L0 R# j$ b

; K1 p# S' _5 y* ~2 U* o5 |Method 064 ]0 v7 \. I# M  b% V
=========+ \4 x+ q# b; W. M1 R
: i: f+ [) `7 F) x& x

( m+ c2 c$ t1 _. M5 m2nd method similar to the preceding one but more difficult to detect:, J0 d( A6 A7 n; L
1 \! _+ I4 E% y$ K3 J+ A
* A; A" {; s/ C+ h: l1 M
int41handler PROC
) G, z. A0 t. c1 F3 B    mov     cl,al
8 C( e1 ^& o8 f6 L    iret0 R7 i0 b' T+ _5 c, M6 d
int41handler ENDP+ R/ ]) k5 [- Q

( ^4 F7 y% l; ~( m( t3 V
  k7 ^! p5 L- w: u. `+ o+ L    xor     ax,ax
$ A  r- V% F  U4 z/ C8 [4 p$ z, N    mov     es,ax
* m5 T" Y$ H7 X9 @- i7 p    mov     bx, cs. f8 _7 m! |3 H1 a
    lea     dx, int41handler
! Q  s3 w3 Q# ~- O    xchg    dx, es:[41h*4]
  c: L. a7 x( E9 \    xchg    bx, es:[41h*4+2]8 W. T. s/ i# T- D
    in      al, 40h7 p5 ~2 V8 t/ F, z
    xor     cx,cx
4 X& i# z+ ~( y- b4 h/ X  c    int     41h! s2 r8 y- ]6 q; L/ K" \7 `$ u6 Q
    xchg    dx, es:[41h*4]6 h; s8 O; x) N
    xchg    bx, es:[41h*4+2]
' M( T( u, M) k$ K    cmp     cl,al1 o% |$ I- \8 A* k) `
    jnz     SoftICE_detected& b& s# Q7 R$ \  J- B0 t

1 O1 ~" }) n( \( e. W. ^. M_________________________________________________________________________
, L8 t4 t7 a% m: O, _: E2 O1 c/ U7 X" h* }( t& _4 |7 I1 C0 |3 g$ w
Method 07: s9 [( d- c$ i7 ?( \0 z, n0 `5 v5 d
=========9 e. Z' r! S* b

' ~- ?& Z( M- K, g0 rMethod of detection of the WinICE handler in the int68h (V86)6 ]+ n! ^( Z8 ^/ c
8 n+ b, a# V* x8 O) L" P) x/ K0 g
    mov     ah,43h
. H* s1 ~) @6 g0 O2 s# M    int     68h9 N3 S2 a; Z9 }5 Z$ B# N
    cmp     ax,0F386h' I  u0 K# t! t. W2 c% {
    jz      SoftICE_Detected7 _% |$ r2 l3 s% L& F

9 c2 S" \/ b, F! e' E6 P0 h0 R2 y+ o' f6 ^
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit0 {( e* D; M: u, ]  i9 i- K8 }4 T
   app like this:* m% M+ c1 V. e' _

7 X2 }! t$ c0 c5 \/ i0 H   BPX exec_int if ax==68
) M8 t3 |4 G6 i# a+ u   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 I. e4 B' u- c7 y   located at [ebp+48h] for 32Bit apps)
3 `5 [2 W9 Y3 y$ _6 y6 L0 |& E__________________________________________________________________________
# O+ H# E) R0 Q# J8 A4 P0 \6 O
2 Z4 I! }8 \( L: p
- k# ]# u6 e; _2 zMethod 08# N" I' c! f0 A
=========
! ~! s! B; ^& D: q. t4 p1 q- S9 K' U+ t8 o6 l9 D$ |/ ^
It is not a method of detection of SoftICE but a possibility to crash the
/ n: D- F) Z2 _$ }5 e1 e6 B- Asystem by intercepting int 01h and int 03h and redirecting them to another% U: ^0 F/ R% w' p; Z; O  b
routine.
. i, F/ |% i, A% v" iIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
) h2 X1 O/ ?: L! ^+ f6 v* w5 qto the new routine to execute (hangs computer...)
- G' \% _3 S* M, z' b! q
* `' ]6 t) Y% t  a0 g% w$ k6 O/ o: ^    mov     ah, 25h( F. `& t4 [2 [. g: U. _0 `
    mov     al, Int_Number (01h or 03h)$ n# M2 ?) P8 a) c8 [- U9 `1 x+ L" b1 \7 c
    mov     dx, offset New_Int_Routine
) T4 c1 L1 R. K  D- w7 D5 q    int     21h
) K9 M+ o; `2 h, h2 T1 t9 e2 U! S
__________________________________________________________________________
8 ?; t, V3 g  g1 g
( i$ z- v# V* Z2 M$ H( g6 IMethod 09
9 ^9 c- u  t) a0 _; I& O, f7 X=========
# r" [, b5 Z* H4 b( {1 I: B
4 ]% i4 E6 Y. O" [7 xThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( j6 c7 i  S' y; C9 S; M0 \
performed in ring0 (VxD or a ring3 app using the VxdCall).$ i" V* Z5 @- L2 e
The Get_DDB service is used to determine whether or not a VxD is installed1 r& h9 y- x. d' h9 Q2 J
for the specified device and returns a Device Description Block (in ecx) for
" H  B# w6 r2 Y" u. H1 a7 ethat device if it is installed.
0 s% B3 I" l6 I2 D! v+ v6 Y$ C: N  s! c! Q  c% L
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 n6 h6 \, c* q8 `( X' v2 D6 Y
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), n) U9 U9 K, |8 |
   VMMCall Get_DDB
% i' x- |, `+ p. I! g: a4 a   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* k8 `& m7 ~( e6 C& z7 v
+ K9 C3 |: Q0 ?6 X9 S* \, W6 S
Note as well that you can easily detect this method with SoftICE:
: S* f( k$ ?5 e( X( G# F   bpx Get_DDB if ax==0202 || ax==7a5fh
2 W+ g. ?' ^5 u' p9 V6 J+ W/ V7 Q3 G1 m  t& `( ~  v- A. ~
__________________________________________________________________________
& D5 h* S& {+ i! `& {( U
" i' X+ j) \5 A( e7 i5 lMethod 10
% t; c' F! e1 w$ Z=========- y- B' G, A& }. e$ Z! c

! q# \- d+ I0 l3 w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 i" b- Y* M- h) z  SoftICE while the option is enable!!
$ F7 a( k2 T$ u: k: K! ?% \2 l" a! v3 c
This trick is very efficient:& r* I- I$ U1 m4 y! m% V9 J
by checking the Debug Registers, you can detect if SoftICE is loaded+ r, }/ n, a& M5 j/ }6 U
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ Z6 t6 h2 E1 m: v# U
there are some memory breakpoints set (dr0 to dr3) simply by reading their7 Y. A% Z. E! b6 I3 n4 Q4 J
value (in ring0 only). Values can be manipulated and or changed as well
4 ^3 {8 \# f9 O1 V6 a; u(clearing BPMs for instance)
8 r1 P9 j; R+ ]3 V! J% x
5 D1 ^' |3 g4 m" }+ v* o__________________________________________________________________________3 v! N) C& J4 E" E& Z
- i3 Z2 p4 A: {) z
Method 11& r/ s! S, K3 J; \  N1 H! ^
=========
, F, G; C# f' }% A8 X+ k9 F8 e2 Z, N7 W$ }0 u
This method is most known as 'MeltICE' because it has been freely distributed
3 }! K6 l# d3 f0 T# N6 Nvia www.winfiles.com. However it was first used by NuMega people to allow
* \: |7 \- l1 O: `& ^8 y0 P) dSymbol Loader to check if SoftICE was active or not (the code is located6 s4 X! j7 t3 r! }6 I
inside nmtrans.dll).
3 J: z% O0 }/ f( x+ }
; H2 {" s. F* h. j# B4 c1 ~The way it works is very simple:
% U* _$ P0 A; ^: H: x5 C0 eIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
7 n7 v% [# K2 t. q; ^7 x4 CWinNT) with the CreateFileA API.
+ K; c- x( b, y) f: \* T& ?3 |0 H  M% K6 h- s0 N5 z
Here is a sample (checking for 'SICE'):; P: B  l3 P- J( I8 S* d* @
; c  ]8 e- x; N1 ~) }9 D$ \  x0 x5 u7 b
BOOL IsSoftIce95Loaded()
2 a- n% d5 c3 Q* j1 j( a  [1 p{
2 l; R7 ]( q4 Q8 N( w/ w   HANDLE hFile;  3 A! @) ?/ i) n! l
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 o; Q  Y1 l9 A" t
                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 ]' |4 X8 T/ ^( X) O% A* [
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 G! G, C- x: i   if( hFile != INVALID_HANDLE_VALUE )
2 }  C: s: l. |% }4 N   {7 ]1 h9 p; I. a. {" T' c; Y1 s
      CloseHandle(hFile);( r& y& P' o' d: ~3 G
      return TRUE;5 E+ {) C! V2 i* u2 c
   }
5 ^/ O0 X; }  J* y9 c   return FALSE;5 @) ^0 U  l3 n( y$ T
}
/ ?% N  ]5 l2 p0 ~& Y
9 t* k4 b2 s- w; DAlthough this trick calls the CreateFileA function, don't even expect to be
* Q, s  ?" }1 Eable to intercept it by installing a IFS hook: it will not work, no way!
( x$ w, p' d. e, W' k/ NIn fact, after the call to CreateFileA it will get through VWIN32 0x001F; c4 H* a4 M( p; }# J% d
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 s6 }; O' D% z4 A6 [1 g' h- iand then browse the DDB list until it find the VxD and its DDB_Control_Proc- z- b! i5 M! V1 r8 g- h
field.. [$ D6 }( k5 q" I
In fact, its purpose is not to load/unload VxDs but only to send a
8 l6 |* D4 T( p& m1 gW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- L: O* o( H6 h6 V. H( n( k# R6 Wto the VxD Control_Dispatch proc (how the hell a shareware soft could try
  `9 g' P) f3 J* d6 Rto load/unload a non-dynamically loadable driver such as SoftICE ;-).
! U1 v5 Y& S4 JIf the VxD is loaded, it will always clear eax and the Carry flag to allow
! ~( S* Z) x/ e+ d' ]its handle to be opened and then, will be detected.! z. q5 S! v: |6 S6 P3 O
You can check that simply by hooking Winice.exe control proc entry point& H: M2 F% S2 e
while running MeltICE.8 q' ?% O. D4 ~4 s

, W0 H8 i2 b1 v6 c, R- \. f: z1 O
" o: R$ t; c6 x0 S5 Y' |  00401067:  push      00402025    ; \\.\SICE
7 o0 `1 c& G+ J2 R$ q  0040106C:  call      CreateFileA' V: H$ u- L% C9 C% @) w9 G
  00401071:  cmp       eax,-001
3 Y4 g1 w6 W1 X  00401074:  je        00401091
- A; _3 i4 k4 H( k3 n2 x( l3 {& k7 s* ]
1 }* Y9 I4 G6 S6 B
There could be hundreds of BPX you could use to detect this trick.$ j& [4 n' a2 X* K% Q, ^8 j1 v
-The most classical one is:
: l( k4 P; d/ m" U% j, h/ D  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; t2 E6 q: t  \% L- f5 Z" N& w    *(esp-&gt;4+4)=='NTIC'0 o6 B, W3 R" z9 n! P

+ e# A& v) q7 b- J- N-The most exotic ones (could be very slooooow :-(' L+ y5 z& [7 }9 ~" i$ F- ~% @6 l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . L4 t6 S$ m) d8 F. x/ q
     ;will break 3 times :-(
6 U- e* _( G  o. T- X
, C6 s9 O) U0 B6 I8 J; N: p-or (a bit) faster: 8 a" V' P) I) i
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
* T  f1 j/ i5 W0 A& M
- t/ b5 u- Z# d! D   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  . T0 t. M3 _' j% V" Y
     ;will break 3 times :-(2 Q4 Y& _) C9 \: v" y/ M. Z

, J! ^4 Y8 P" V9 n* o; Y6 x-Much faster:: K; I% J0 I6 a
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'/ ]. z5 F4 A5 W

5 L: i' w, ?: v; x7 ^& U- a7 ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen/ z# E: }7 F  I( ], U
function to do the same job:* R  j4 ~) ?* [! v9 S' k$ [& k8 i
0 z% d- |+ D7 a) Q' |+ d
   push    00                        ; OF_READ
. J# c2 A8 V  J9 O6 i   mov     eax,[00656634]            ; '\\.\SICE',0
: I. p/ b* j! Y* I* w   push    eax0 ~) h8 U0 f# V3 D( I0 {2 o
   call    KERNEL32!_lopen+ W  b' s" q  ^
   inc     eax3 P: |: J) G) R
   jnz     00650589                  ; detected& \# j1 ?* }( r, T2 g+ X
   push    00                        ; OF_READ6 {8 e7 l" `1 Y" B+ _
   mov     eax,[00656638]            ; '\\.\SICE'
7 E" _! X# e4 d5 ^+ ?   push    eax
* T, G0 W% u" @; V- D  S( r. u   call    KERNEL32!_lopen
/ q/ X4 ~) m+ _5 J8 `   inc     eax) V4 t0 Z* ?! @) G5 F
   jz      006505ae                  ; not detected
5 o3 z. N' V& w& L
$ l( e  w# d" |  n+ T1 Q" N0 \1 Q( X
: M* V* r0 c# `  k__________________________________________________________________________
, q' s# R) f4 k6 B( c7 f; @/ u1 B% L* f* `' {) {; a
Method 12
# @; \1 H2 Q, h. ~! s) E=========$ ]# @) Y3 R% u7 I1 t' R

) [" ^* l& Q- G* nThis trick is similar to int41h/4fh Debugger installation check (code 05$ W6 |1 r1 }: c& m( e% d
&amp; 06) but very limited because it's only available for Win95/98 (not NT)' {: f. B  w, b+ R# ]  e
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 b& I9 a/ `: ~  m% p4 D$ }
4 E" k. G, \/ u. H( m/ f: H   push  0000004fh         ; function 4fh
! D% b, G3 _. e" g* ^' t9 B7 j   push  002a002ah         ; high word specifies which VxD (VWIN32)
* t2 I( Y9 y& R                           ; low word specifies which service
' I" S+ U, I, O! c: o7 k                             (VWIN32_Int41Dispatch)+ {/ y4 g% G# h; R: W
   call  Kernel32!ORD_001  ; VxdCall
# r8 N# K7 s& V/ j   cmp   ax, 0f386h        ; magic number returned by system debuggers
& B9 o3 m/ H# b' i* p0 i- B- b   jz    SoftICE_detected1 b7 \: C1 o9 n( f
- e2 }4 b, E8 g* T
Here again, several ways to detect it:) Q* e$ }% i: n9 N8 N& L3 `
2 u6 Z% S9 `. g& Z0 N% h/ g& e: o
    BPINT 41 if ax==4f9 Z' G7 {; I& {& X
4 J. E/ s5 s0 J& ~6 B
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' V! a- f! Y0 q$ Q/ @
. R* y8 M, Z1 a+ O4 p9 j' A
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
2 m6 W! n$ J6 b) i- a7 d
* C4 c  E6 i* }4 k    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ J$ k# v- m! P" R* y; N( n) ?- Z# |' {1 P1 T
__________________________________________________________________________5 G' o5 t" q) \& z
0 I' M6 O0 f4 ^5 d1 Q: Z3 ?
Method 13
  n9 m. C5 K4 g# i+ ]: a6 }/ U0 ]) q=========
, d+ Z' v$ X" L
7 \5 V0 j& D0 w% M0 qNot a real method of detection, but a good way to know if SoftICE is1 q" k, c. `0 d9 U0 L5 r* S7 T
installed on a computer and to locate its installation directory.
: Q3 `! m3 u! U' [It is used by few softs which access the following registry keys (usually #2) :1 x% `2 m( F. a3 D# m" y* y% O

& C' d7 g" a# k# S! R-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 a1 R1 i# X$ V5 l& M: C
\Uninstall\SoftICE- U. c0 z. }2 k" A2 k1 C
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
7 \2 e5 l# ^4 A" m# N4 K) F% C0 }-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& L( s1 p* s8 b: l$ e\App Paths\Loader32.Exe
1 ?8 n7 w) X: J4 X" {/ u5 g9 D) t+ b8 v1 X" c

% b0 R2 O; q; K4 f  t. fNote that some nasty apps could then erase all files from SoftICE directory9 M" L0 f3 J% y* n5 u1 X
(I faced that once :-(8 t9 u0 b% O* [2 R8 v) y+ ]

% v9 c$ z' Q3 x2 [( tUseful breakpoint to detect it:
1 C: I9 I  p5 s  S
2 r9 l: x/ z4 T     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) O3 C' t( l4 I8 F9 X2 g! D: y+ W# X9 ?+ m
__________________________________________________________________________# L& y( ]) ]9 ?4 G' q& v9 @0 u
" W8 d+ }* U3 m$ Z- o! f; g
3 [& \- k- E- q4 w9 D
Method 14
+ M# S' I) X$ z6 K=========
4 ^  R3 \' T/ l+ t, y
* W$ k+ |0 Q6 ?; [  ~" ]9 c8 `A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
" o6 X% r# q5 cis to determines whether a debugger is running on your system (ring0 only).; V7 n5 a. Y% V2 L3 ~& G( n8 w) Y$ G
9 S5 D: @8 l5 V, K
   VMMCall Test_Debug_Installed; s! ]( T  @$ Z3 i; H0 `  ?8 [
   je      not_installed
- B0 B0 C. ]/ k. ~" _' [' h1 P6 f, N3 V9 v) k+ i3 n& y; v
This service just checks a flag.( [, l2 R. W0 Z/ h0 j
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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