About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 K9 j' j4 q3 z, }& C: D
<TBODY>
% }2 r; B+ ]7 q9 H8 B<TR>
* A  y6 Z+ z+ z+ g  Q<TD><PRE>Method 01 ; f2 _8 D+ H5 r8 r
=========/ g6 z& M! G& ?8 u) P/ x) p' [

% \8 s+ u4 V, T( x9 o' C1 r3 H7 H. DThis method of detection of SoftICE (as well as the following one) is. \0 v) M& s: T  ?& ]
used by the majority of packers/encryptors found on Internet.
. J4 U9 g; L& `8 W* ~/ u( H8 {It seeks the signature of BoundsChecker in SoftICE
6 m( j+ {- {# N1 i6 V% ?9 w! i* ^1 Y: C1 H+ ]2 |7 o+ v
    mov     ebp, 04243484Bh        ; 'BCHK'
2 v; P' h2 ^. i    mov     ax, 04h
& I$ p0 s% F0 ]  h    int     3      
+ E9 z4 |( u) G3 X* W$ M- q    cmp     al,4
" r' ^2 A: r" Y! H: ?    jnz     SoftICE_Detected$ q* n- A5 ]' \! y* l5 z1 ^
- ?6 ]% _6 e2 |/ u
___________________________________________________________________________* }% l5 u. I: W3 p5 X

0 s2 y( O! b3 u# Y* {/ h  uMethod 02
, `4 z2 b. h1 u' T1 a: ^( d=========
; Q; E5 @& {; d4 `- z
0 _/ G. z, P3 `# x1 X( s9 pStill a method very much used (perhaps the most frequent one).  It is used
" s' E. P' D4 h) L# K+ ?8 @2 _; zto get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 U  }9 @1 C1 a, Y! Q
or execute SoftICE commands...
3 ~' U2 y0 Q6 U. fIt is also used to crash SoftICE and to force it to execute any commands
) v2 F0 X5 x( u% x(HBOOT...) :-((  7 s( `' \& i. @0 j- g
- r8 ]. w; l" I
Here is a quick description:
0 }& ^, {& u5 E% H& P-AX = 0910h   (Display string in SIce windows)1 I  T0 [0 x( b) a) O. M: o
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) @3 U3 D, B1 I+ l( e+ A-AX = 0912h   (Get breakpoint infos)
; v, m" K5 s# |% T5 A) G-AX = 0913h   (Set Sice breakpoints)! @1 x+ J8 B8 R1 [. `' L+ H
-AX = 0914h   (Remove SIce breakoints). p0 ~, G; R6 X8 y1 |* _. ~  f
1 w- O/ W" T* ^  k
Each time you'll meet this trick, you'll see:
7 P2 h, q/ N" }0 h6 }+ V9 H4 B  j-SI = 4647h" w# K8 R  J$ p3 g5 _2 c; p, t2 Q
-DI = 4A4Dh
; I  @% W0 ]2 q  C  {  Z: rWhich are the 'magic values' used by SoftIce.
* ^4 o% X2 t( a. ?  X3 S6 g. dFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 b  w! U2 r. D8 n) N1 [. Y, z) A2 C+ r+ R+ u0 v7 K
Here is one example from the file "Haspinst.exe" which is the dongle HASP
/ n/ B$ Q) |* f9 XEnvelope utility use to protect DOS applications:$ z0 N8 w% K- q; r3 F2 J. G& X  F
. H. [: p) B! M/ A4 m

* q( Y( \( R" ^$ N4C19:0095   MOV    AX,0911  ; execute command.
, c( Z/ d1 i% v4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 a% l) Q/ u" i9 B# a$ X
4C19:009A   MOV    SI,4647  ; 1st magic value.* H6 L% _* r9 u
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 Q  [+ z7 K, m3 g/ ]
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*). U  t* c% i3 Y3 ~* y8 L# I  i5 X
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# u5 Y1 L6 |+ V% q; a/ v4C19:00A4   INC    CX2 `  l: |( Y, b! q. B/ J
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
; G4 m6 _9 k$ E, i5 H' w4C19:00A8   JB     0095     ; 6 different commands.' F9 O& a" K0 ]" ?! `% R; J; R
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
# y4 _* F6 N  h. ?$ I# D8 _; p4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)* A; h0 c9 M" k8 }: g; _- J( c; k

/ e& N6 u4 U2 o, E4 `5 b8 {& E! L! VThe program will execute 6 different SIce commands located at ds:dx, which+ i( ]9 g/ T+ I; N5 o) Z
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
" e' E( N' o- _7 V
8 o$ ]7 r/ I) p$ I, x4 d* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; `* `4 @' r' s5 e  t+ M5 [4 H___________________________________________________________________________% k0 x' |3 _: @# U) B4 t, L7 D# _) _& ]

% W% N$ {9 \! O( A. h- {  e
3 g- n6 N2 X/ [Method 03
& B2 \5 k- e4 F/ L( k. H. D7 s- u=========
6 [/ g! l- j  d
$ @9 v' @1 h; u8 KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 Z" }: M4 {, z& m; D6 r4 b
(API Get entry point)7 d+ y( ~% ~) S4 m: H
        
  N2 y* d$ n' i( A+ |& |
2 O" A3 j8 C; ^7 c% U" Y    xor     di,di
" J. W, z$ z9 ]; e    mov     es,di& N( n: m" R9 g: y3 p2 ^
    mov     ax, 1684h       2 m/ V# N- f& Q* n- m: a
    mov     bx, 0202h       ; VxD ID of winice
0 K# e" E# \5 K& B6 J    int     2Fh
3 c" v  A* w9 \% H    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: k5 O0 t/ @4 c( v) N- X6 g5 b    add     ax, di
, g( o' v* K( M    test    ax,ax
0 R# |$ f9 `. r    jnz     SoftICE_Detected$ l- I% Q% U/ v* X1 ]7 l

; o/ Q, {  T1 o( p; Q) h___________________________________________________________________________
' z8 d, L1 k6 x0 q3 j( b
1 W! I. ~  i" W+ T7 e' @Method 04
$ Q/ M9 k7 v& W& Z; K' B* J0 }, M=========
* G9 c2 \3 `9 D0 H* S8 y
5 ^0 x- ?. L. l% J! F. S, UMethod identical to the preceding one except that it seeks the ID of SoftICE
8 W2 x9 d  u( q4 \' dGFX VxD.' v3 S7 _* d2 K8 O
' h* p* A$ I$ [5 \( [. O( |
    xor     di,di& h! \: J: G2 E; Y7 u% p) U7 w# y
    mov     es,di+ L" X2 Z5 t" H) v1 A$ h: d0 |
    mov     ax, 1684h      
3 D0 }" ~& Y: S* Y! o1 Z    mov     bx, 7a5Fh       ; VxD ID of SIWVID' Q; E2 ]  N/ @( [: M6 t: s! F2 X
    int     2fh
; W/ n% {5 l8 S8 Z! Y& _/ m" Y    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 N+ X. q" p# F6 J. x) d  H0 f
    add     ax, di. g* f7 t1 T, x% z* Q
    test    ax,ax
7 B/ q7 d. o! d. |( A8 k    jnz     SoftICE_Detected1 u" c4 y* m- T0 W, X. `

  [7 Q2 a% k' B__________________________________________________________________________
8 x; K# N) f. u" R$ _- B/ e, r
. d" G7 A; w5 G7 K# N
! h  J2 l, W/ j# T2 ?2 Z, fMethod 05& u8 s  e- c; I( H: r7 U3 a2 ^& T
=========
/ l/ v2 y& r! E& O1 T/ z" Q7 w; R" x5 |8 {; w- Z! h3 I5 V
Method seeking the 'magic number' 0F386h returned (in ax) by all system; k* [6 E: m$ y( r+ M1 ]' e3 U
debugger. It calls the int 41h, function 4Fh.; q. ?# N1 {0 D
There are several alternatives.  / y: n0 W& J6 T3 a7 w# _

( g" o& g1 A! e' D+ j4 ZThe following one is the simplest:
0 ]; i2 u0 ]& X! c  v- |) e7 H+ i$ k. A" c5 M
    mov     ax,4fh' s& g7 @$ v  @0 K
    int     41h
4 q9 o$ S9 v7 i    cmp     ax, 0F386* _  A; y3 t- ?: `) g8 n; e( ^1 A
    jz      SoftICE_detected9 z( n1 l8 e8 Y5 s7 j3 G

# R7 P8 M& Y, }# H8 y6 M& Y4 s6 k. ^, {$ g2 z
Next method as well as the following one are 2 examples from Stone's
, q( x. z2 M/ |; S* W"stn-wid.zip" (www.cracking.net):
' E5 x! t/ C4 p% y( u4 O' ^  Y: u, c. e
    mov     bx, cs6 l& i+ x/ @. R* R2 h
    lea     dx, int41handler2* A; i! Q4 U* P1 C5 h
    xchg    dx, es:[41h*4]" s, @9 y  {7 _( I, s- C
    xchg    bx, es:[41h*4+2]
9 ?5 L6 m" b4 C* t    mov     ax,4fh) f( F- O0 {* y! D. z! q
    int     41h2 \+ l" n4 Y+ v7 j3 {' X, J/ S  s
    xchg    dx, es:[41h*4]/ c0 U6 x# Q4 F1 u
    xchg    bx, es:[41h*4+2]
) T4 Z* M2 u# V4 [# R    cmp     ax, 0f386h! N: Y% Q4 W5 ^5 b# P, l5 M3 T
    jz      SoftICE_detected' ?2 J! x6 V; ^$ @1 ~% V/ [0 h
1 {: s9 }$ \( F( k( G3 w9 U
int41handler2 PROC
" w; g4 c/ h* i) b6 [5 p    iret
) V" e2 d4 g! P8 t7 b/ wint41handler2 ENDP
9 X& }6 R5 T+ [8 r1 w
2 s# r4 L. q- [; p! b6 _7 f' I9 f2 z* q, ?* O- a2 B% `
_________________________________________________________________________
2 E8 A" K: _' b' }  t; R6 i; ]
) U1 m: v: z# Z% k7 k& a: @" m" ~
" V# a2 j% w( A5 J4 AMethod 06$ B/ n) a* J3 f1 V2 Q: L
=========
  e7 c/ j1 z. {* o/ p8 M# b% d0 g0 t% ?  j( [5 F

) O) A% R9 I/ H- ~! ~; E2nd method similar to the preceding one but more difficult to detect:
5 k5 ^2 w$ ?0 [: [; n* |6 i$ \3 X% _
$ T4 c7 N0 D$ G- m# U  h' |
int41handler PROC
$ @( R( O/ q; G    mov     cl,al
  s* Z3 Z' Z% H! C    iret/ F5 e+ _3 p7 @* _) B7 |+ u
int41handler ENDP
# O- @* C( \" x8 C; M4 Y3 O% ]" r7 \) ~+ G: Z# T, z: l

5 y# u+ j7 U- ~! z    xor     ax,ax, ^) `: }, N5 ^, c. M' A- D5 ~& @
    mov     es,ax6 D& @0 R- q; z) d/ h' r7 D3 @) k
    mov     bx, cs
3 h$ i, a+ C; h    lea     dx, int41handler
4 R( ~4 i; h: r8 j, O: C1 y  z    xchg    dx, es:[41h*4]) K6 @8 \: ~5 ^5 p
    xchg    bx, es:[41h*4+2], R6 e9 c: G: \
    in      al, 40h6 i- t; P: e; R2 o  W0 h- _
    xor     cx,cx
3 ~8 k+ C4 v% {# b1 T6 s    int     41h
6 S$ P  i1 \4 a. ^+ g    xchg    dx, es:[41h*4]# g' F" l$ m- K# L5 k( ]# ~
    xchg    bx, es:[41h*4+2]
- d( [, i4 S) q! R" ~& M: u$ e    cmp     cl,al) H, i4 i. t$ x, }6 @' O# J, b
    jnz     SoftICE_detected* S4 A; [5 y& ~# s0 A" \( E' t4 L

2 ~  @4 T" j0 {_________________________________________________________________________
. P% w3 t  y3 x( }! h$ f  l; N0 e% _4 X, t1 c9 u2 Y
Method 076 t+ R  w( Z( a3 z& k
=========
0 p) K9 l* Q6 ]. I3 e- s; h; k! p- y' K* M/ G, k
Method of detection of the WinICE handler in the int68h (V86)( j% F2 ^+ M3 }# j
* Z% b, Q" T% ?: {7 t# [/ @% T% z
    mov     ah,43h
/ Q9 p; p- P/ X; B% ~    int     68h4 E' f3 J; W2 X% q; K
    cmp     ax,0F386h
9 O- {- J5 r$ H$ R& e    jz      SoftICE_Detected- O* q" _/ O. d" y
8 m" H4 B/ J! l# f) o7 u
$ p- E( ?0 c& o( I5 ^' V# z# u" i, k
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) Q* F1 M: n" p- A; q' |1 o& ]
   app like this:3 W0 N" e( ~. E6 E" J: A

  R& X/ k& f4 h   BPX exec_int if ax==68
+ z- B3 A' Q. e) W* C4 V( W  R# A   (function called is located at byte ptr [ebp+1Dh] and client eip is% a2 O2 D, E6 F# s; w! o/ D& p
   located at [ebp+48h] for 32Bit apps)
% j- v+ _/ D* a: v( z. u1 G__________________________________________________________________________
) P& x/ j* L6 m& Z4 a: j/ n4 b( `
. f- M: o' H- L+ I5 w: m
Method 08
& t( n% p* d% t& i% ]  T=========
5 s& a* u& ^2 z" h0 B7 _/ o) b0 n$ _& }6 u4 h+ r
It is not a method of detection of SoftICE but a possibility to crash the4 i" b  p: H& v/ |
system by intercepting int 01h and int 03h and redirecting them to another1 D: ~0 m/ C. [9 D4 \- {/ |" t
routine.! l, a" a3 b( Y) S  K- M
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points- r8 ~6 }2 k+ H- g, O4 K- ~
to the new routine to execute (hangs computer...)
1 B1 O. `% h' y, D) o7 d
& y, Y$ m% N! m( Y# P% H) N    mov     ah, 25h
  `3 q. r8 Q2 ?2 M" O7 Y    mov     al, Int_Number (01h or 03h)! A8 a2 V! \' D' z, I4 C
    mov     dx, offset New_Int_Routine' F  `) E. m& z1 F( E6 F9 b
    int     21h5 e1 i- y+ T: q% e
, l- r: \& v( t4 D2 G& J
__________________________________________________________________________
  E! |5 K4 ?9 f- C) O9 `" x1 \* }0 {2 _4 ~. q. g* n
Method 09
9 u6 @1 I# C+ s/ A=========
+ B) Q' L3 f9 z7 i5 _! C
7 @- t, I% L! V, m4 jThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
: Y8 a% C9 c) }2 g/ uperformed in ring0 (VxD or a ring3 app using the VxdCall)./ n3 ?( u8 @9 o; O, V
The Get_DDB service is used to determine whether or not a VxD is installed7 s# ^$ }! l2 j: v: J
for the specified device and returns a Device Description Block (in ecx) for
3 n  O3 m1 N, A/ s1 H0 ]( ?that device if it is installed.
% q9 X1 `3 W3 [5 _6 h% [
. `+ \- @7 M" g& [   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 F- B. B$ R' D; V' @
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
, f# L) G( A+ P   VMMCall Get_DDB/ I- e1 v) d7 X" @' q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed) D6 {$ t: u' s% g& H4 }

* f3 f" S$ D0 V+ z6 R. I+ B$ T6 xNote as well that you can easily detect this method with SoftICE:+ W& }* h! G& |( L
   bpx Get_DDB if ax==0202 || ax==7a5fh
. C. j0 E& Q$ H
1 F' O, R1 }$ l9 E- `6 z3 m3 f__________________________________________________________________________
- ]5 I, P8 O, v2 g
% C3 f7 `" t3 Q( L$ H( iMethod 10) t+ O) t# G+ e! A4 {3 T( x5 L# |. \
=========
2 ?9 \) v! L. c+ T. {  M
! Z. q! s! M0 y, y. N& U=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 X/ N$ c" l* D- n; J
  SoftICE while the option is enable!!: B8 D+ b8 i- K+ @! s) r" h3 E: Z

9 H3 Z" ~  `  y0 \( b+ D$ IThis trick is very efficient:6 ?. Y7 V% }$ b. k8 t# l) p
by checking the Debug Registers, you can detect if SoftICE is loaded
$ a' V. W% d9 ](dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 ?# x: J2 G( R! r8 N
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" I9 ^' M- n! G+ n7 Uvalue (in ring0 only). Values can be manipulated and or changed as well
* j  S; b" i/ ?; b  Z: T; S(clearing BPMs for instance)5 l7 ?8 ?% @4 v1 O3 O7 y; L
: |1 Y4 r$ i2 w9 e% h/ @; S
__________________________________________________________________________0 G$ a: s5 J  L4 o% {0 O/ z
+ f4 x) \% a, P8 p9 E" _
Method 111 G$ b/ O% p/ f# p5 X
=========
$ w6 {/ T7 L* c. |% L: F
$ d, B# e1 }! S9 I2 v, _! CThis method is most known as 'MeltICE' because it has been freely distributed
% D- Q) I5 _  |1 K/ a3 G) f/ |via www.winfiles.com. However it was first used by NuMega people to allow( i2 i$ j- i" a$ U  X
Symbol Loader to check if SoftICE was active or not (the code is located, V: t. M9 z% e+ D+ \
inside nmtrans.dll).
  P  d) K" Q  F+ |( a1 z% w" G
& I! h% q6 C3 ?5 V6 TThe way it works is very simple:
( j+ m) X+ m  B7 s9 oIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# I3 a7 Z% I: t9 qWinNT) with the CreateFileA API.$ C" m: h8 [: E* a. V
! ^: |" T3 ]9 K+ ?0 x( a* j; ^0 u
Here is a sample (checking for 'SICE'):
9 o' w5 P& P/ R# Q; c0 \8 L! N& O3 ~5 C$ K3 ~8 d
BOOL IsSoftIce95Loaded()
! s% M. S$ O# B- f{
7 G3 Q' `8 m5 E5 @5 e" Q   HANDLE hFile;  5 e: @6 f/ K) ?- _3 X; D0 I
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 ]$ E& R! ^8 m                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& `( L' k' b, W# g- M& f6 c5 V                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 ?, [8 l5 E* ]: x
   if( hFile != INVALID_HANDLE_VALUE )1 ~% K. W$ A& i3 a) J6 r( N
   {- \, k$ V; O8 X3 H( y4 A8 ]
      CloseHandle(hFile);
$ Z9 Q6 m% i" T* g, G+ @      return TRUE;) Q2 k$ R: K1 r* Q. _5 m
   }
/ s4 A3 H8 n, q. O6 P8 N; ^   return FALSE;
: f/ _! Q% N$ [# U3 _9 g}. V0 ^, Y" x/ E, z, S9 G- @

) j' u6 L- i7 @% ^+ I# i  uAlthough this trick calls the CreateFileA function, don't even expect to be5 |6 M6 p2 Q/ U$ _' r# Z  g
able to intercept it by installing a IFS hook: it will not work, no way!
3 L  J! R4 G, y% z8 V. J. mIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
6 R& n7 ]0 e, ^$ dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 O( Y5 P9 K' e4 Oand then browse the DDB list until it find the VxD and its DDB_Control_Proc) Z# w& I1 \# V0 \
field.
3 p. M/ M; I7 M! N! F5 dIn fact, its purpose is not to load/unload VxDs but only to send a 3 a3 k, E) a, O% F
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ k8 n* `3 I: }8 M
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
9 O0 A% T5 c9 w! r* g2 }to load/unload a non-dynamically loadable driver such as SoftICE ;-).% F/ u- V2 J. U* n
If the VxD is loaded, it will always clear eax and the Carry flag to allow3 h. B9 i# x* j2 n$ Z$ d" m
its handle to be opened and then, will be detected., p+ ^3 A! @! ?+ A7 T0 t2 q: ^
You can check that simply by hooking Winice.exe control proc entry point/ F4 I& e& O/ l; _
while running MeltICE.
2 R. }. F0 r5 X+ a: }8 f0 V# q
& F7 u! {) ^/ w# T7 G  M
; a2 W0 T" b6 g; f- M  00401067:  push      00402025    ; \\.\SICE
  X3 i" T1 \( M" \& D: w$ X  0040106C:  call      CreateFileA
8 h+ L! _: D: Z, D/ u2 I! V8 R0 v6 {  00401071:  cmp       eax,-001' ?; g/ O( N$ y6 U& c; ~
  00401074:  je        00401091
; Q( H- N0 P4 E) o4 r$ _
  u: [' l. C" e, J- A
9 y# C4 v' M  U( t1 u% dThere could be hundreds of BPX you could use to detect this trick.8 l: I( Q) o6 @
-The most classical one is:. P8 `! B, c- J5 k5 u1 C3 ?
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- G3 t3 u; Q! O2 p, C# [    *(esp-&gt;4+4)=='NTIC'
( g+ o! c7 A, d& X, P! B1 w$ g9 s. I0 a4 q- N4 W+ Q. n
-The most exotic ones (could be very slooooow :-(3 d8 k0 K1 C9 O% q  U% }
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 Z8 Q3 e' ]' z! }2 H     ;will break 3 times :-(. h: [' U3 b+ @- ]; A2 v9 }. H# v

7 _& z- ~) Z6 J+ s- _  L( R-or (a bit) faster:
* g6 K& L) j6 N: \   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): [% J" G  S8 B, f" N

6 r* P% ]4 B6 b- N( S+ O   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 N' a7 L' K" {) z# d6 c5 V9 ^# B: E     ;will break 3 times :-(1 B4 l2 ~# K& R) A' U

7 S: q) G6 i+ F3 X2 W0 `: M( h-Much faster:
2 q# O1 z: Z7 D& H5 t2 }; B9 s  v; x   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% L" }9 x3 e1 B! e: o
+ |# F: o  _5 x# `1 @. K8 w9 T
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% b" i, [/ C% G& D' Q
function to do the same job:
3 K2 h, `& O) p" @' E1 w
; U+ L' ?0 J+ B1 g5 o& X3 v   push    00                        ; OF_READ
+ z( a1 H; S* l( l1 q   mov     eax,[00656634]            ; '\\.\SICE',0( i" I' x- U# E  c3 r1 B' l
   push    eax8 \  d( f5 C( ?" d  }( B
   call    KERNEL32!_lopen
7 j% `  c" q9 |1 y$ o1 a   inc     eax% G4 \. ]( Q- r. K8 j; K
   jnz     00650589                  ; detected9 w/ M& v7 [. P5 l1 e9 f7 F
   push    00                        ; OF_READ5 N" I: g; d; d0 M4 u" a
   mov     eax,[00656638]            ; '\\.\SICE'
  w4 L% D! }. {6 M. |8 H   push    eax
4 A5 w" l) K) q2 r! n5 y1 e! D   call    KERNEL32!_lopen. q( X- j4 `! |$ M# A) B6 `' Y0 V
   inc     eax6 g- P$ d) ]2 I7 E
   jz      006505ae                  ; not detected
4 e, y; S1 d; P, i6 r1 `4 Z( U% R+ r7 p; e) S$ P" y
" b4 A& b. h5 b* e
__________________________________________________________________________. A1 s9 {, B. t# k9 ~" p" y0 \
% ^! T( S: X  U: u, w, y/ o0 O4 N' C
Method 12
) m7 y! o  |, N  o/ |=========
: Y  o0 Z! P" N( [5 a
5 l' \9 u+ p) o- U8 R6 ?) NThis trick is similar to int41h/4fh Debugger installation check (code 05
" [  @2 E" v6 W0 b5 L+ L5 k&amp; 06) but very limited because it's only available for Win95/98 (not NT)' r# E, m. v1 k( _5 m2 b% C5 {0 X
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.& \- N: h% _* o8 d5 h, ~( n

! @* \8 V" K" A   push  0000004fh         ; function 4fh9 Q  L! |4 M+ X( V9 p9 S
   push  002a002ah         ; high word specifies which VxD (VWIN32)7 c. U8 J2 d! x! S  e5 \& S
                           ; low word specifies which service
# y/ Y; R0 O+ i4 t4 y7 I                             (VWIN32_Int41Dispatch)
: R: S+ E6 t% P: i   call  Kernel32!ORD_001  ; VxdCall
7 i! D3 r9 v; K   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 e1 q* z* h! e1 ^   jz    SoftICE_detected4 e% B5 `4 Q9 ^4 s: d: n
" k3 g8 `5 [  H
Here again, several ways to detect it:
% w* k) q- H! K9 S6 v
7 F) A5 B* f1 u    BPINT 41 if ax==4f; Q/ r( S+ h9 U7 o2 m
+ q  x' I% O! k' D" O
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one( t, i) `4 C& m! \! f2 }" w" I9 |

3 i+ g" {( Z  y) ]% D& \    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 F( p. M: ~$ c0 b, l& |( x0 H6 a6 ^  _& F
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!/ b7 N1 \# J$ d$ \- k9 x& Y
( U0 E5 f/ X5 S4 s! q1 R
__________________________________________________________________________% f+ i$ ^4 |* W1 n$ W

) k# z4 A- v6 i, q* A6 S7 fMethod 13
9 C8 P) B0 ^' y6 O! I& P5 [2 ~' e; p=========% J0 y2 O. `/ [, f, X$ \& |9 V

5 Z  t6 ]) d; z, GNot a real method of detection, but a good way to know if SoftICE is& }6 P$ _% O2 Y6 X7 I9 I) A$ R
installed on a computer and to locate its installation directory.
- A1 K% H( L  X6 s7 C! ^It is used by few softs which access the following registry keys (usually #2) :
4 g. Q! g3 j3 t9 m9 d! P
$ M. _; s" J+ ^8 a3 |8 x) b-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 K1 o8 G& z/ D
\Uninstall\SoftICE
" M$ K' T* g4 i: u-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 P* w2 P3 B* y: Z% G' l1 C. r
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 t1 p" D5 ~9 r# W2 c) I
\App Paths\Loader32.Exe
" R: F9 ~7 B. X- b8 K# `8 |1 B' T: c

0 `0 D  w# j7 |6 ONote that some nasty apps could then erase all files from SoftICE directory% b& F* b9 V  l- y/ Y1 l; X
(I faced that once :-() A5 D" f  c) L5 Y* r1 \
4 R7 n/ Q+ P" `  H4 Y+ X, z
Useful breakpoint to detect it:, x$ {# x- V6 F. J- S( ?+ g
2 B0 Y2 `" ^1 I. c. C2 z
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
( ~. @" C: e9 \" `
% I; R3 Q4 q$ t7 B( e) m__________________________________________________________________________8 \/ ~' ?0 w) E* x- W% e
: s3 @# j( f4 \# [

4 L. ?- `) B; G( s) q  y. fMethod 14 0 Q, M! F6 {5 r5 U. A2 k9 P
=========8 x) G6 i9 ~7 k  [

( f( S# A4 U, {4 i; `6 xA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* Z3 }; D. O1 v& j* i6 y! ^
is to determines whether a debugger is running on your system (ring0 only)./ e4 m1 T. ]- C1 P& H; b

0 B# g' A5 r- @! }   VMMCall Test_Debug_Installed
7 c7 A+ o, x6 ]- E   je      not_installed
/ x3 ]( j' X' P) E
- k/ F2 a: ^4 _* ?  w/ s  rThis service just checks a flag.
" }7 L( O  Q8 H& {, X* @</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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