About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) C# X  P1 T+ I4 U<TBODY>; _8 L' }% j" c1 ~) P+ s3 U
<TR>
- A* G/ V0 e# O! k+ W. c<TD><PRE>Method 01
- K! q% h: Y: S=========
3 [$ ]8 e5 f( p9 v* o. [
6 F* l5 V. B% R- {* A+ d+ x% K" MThis method of detection of SoftICE (as well as the following one) is- D( u% t" v% [1 i. q% v3 G( V
used by the majority of packers/encryptors found on Internet.
8 W$ ]0 l& u' U& V* [+ C4 q! mIt seeks the signature of BoundsChecker in SoftICE9 |* T7 `  y% F. F

2 [- z  Q' A; Q9 j    mov     ebp, 04243484Bh        ; 'BCHK'
' S; i' n2 l, v0 O' f# W3 L) F8 z    mov     ax, 04h
6 o, h$ T# e0 A2 |$ ]- N7 t    int     3       6 x0 o/ }) M8 O& d1 L6 Z
    cmp     al,4
% v6 I: F  y' X3 z, M, S    jnz     SoftICE_Detected
( c8 W/ ^5 W* n6 G1 A& q
% t- \( o6 b  @& z7 M' @___________________________________________________________________________
! ?' H0 i# q: O8 k8 F* v
1 g. U- ]7 @! w/ S4 w; PMethod 02
  C' \8 r8 G( U=========
; X8 l/ S1 w2 Z! ^+ z, Q% A
! B7 }5 Z3 ]0 ]Still a method very much used (perhaps the most frequent one).  It is used
$ ]6 t* I( Y4 xto get SoftICE 'Back Door commands' which gives infos on Breakpoints,( g+ D2 x  L% n4 o) K, {. o6 u
or execute SoftICE commands...
8 E7 l) S* Y* E5 ~It is also used to crash SoftICE and to force it to execute any commands- ?2 \0 w+ |; F& N$ X8 z& ]
(HBOOT...) :-((  
* D. k1 c6 h9 K2 o3 d1 [4 w8 \
& W# a$ S" \  y6 t. O/ I1 P4 [Here is a quick description:
# l6 y4 ]' Y6 r; [7 P-AX = 0910h   (Display string in SIce windows)
: c- r  c3 L: Z* Y" y* f-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)( Y$ u# J+ K* k) m8 g" T
-AX = 0912h   (Get breakpoint infos)
- h4 p' x. [5 h8 j( F: l-AX = 0913h   (Set Sice breakpoints)
, A2 R: m4 J6 d0 \2 d" X& q-AX = 0914h   (Remove SIce breakoints)% j6 n; s3 @# ~
6 b' F6 b' u  ?* M2 o# w6 N
Each time you'll meet this trick, you'll see:
2 R  @: o& A( @-SI = 4647h
+ g* S5 {- o. P-DI = 4A4Dh* x- h1 Y" @8 J) N
Which are the 'magic values' used by SoftIce.' U3 w, R  H; @7 T; A
For more informations, see "Ralf Brown Interrupt list" chapter int 03h./ f) p$ E. Z/ S. _/ t- ]4 g

, s( D; _" U/ ~) jHere is one example from the file "Haspinst.exe" which is the dongle HASP) B5 g) f9 z/ s
Envelope utility use to protect DOS applications:
, X5 p( ?  ]9 ?4 T! e, v
% v6 F, p- {: s& C# y0 C# T* M1 s; p  Z
4C19:0095   MOV    AX,0911  ; execute command.
  J6 m, Z# E+ v) K9 ]' k4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 F2 {1 D, Z: K- V3 b. f/ \# F. q, _4C19:009A   MOV    SI,4647  ; 1st magic value./ `, Q$ E6 Q! s5 y4 e& r, y: t
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 a- b5 ^5 w7 Z: U; K4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# o8 q$ Z2 d9 s5 S+ D9 w
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: ?  u, n6 M! c" Q% r4C19:00A4   INC    CX$ x# |. S. u0 b
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; t( \/ d8 V, c( N! s1 q
4C19:00A8   JB     0095     ; 6 different commands.$ ~; A3 t  H/ h
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.; S- t8 g& {6 J1 t5 U! [2 s
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ I' f9 s9 \8 i7 N4 r1 n
. C; U$ E& m$ O0 u$ d' R& AThe program will execute 6 different SIce commands located at ds:dx, which7 P* }0 K+ g6 U* w( [/ q* Q
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% \+ M+ T2 M$ O; Y0 t% |* I0 }& w# D. d' S; \# T2 d
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- I3 R/ w; a8 D  D  R, y  r
___________________________________________________________________________3 Q+ z. E7 s# _* [0 g3 A0 N+ t
  N! x5 |0 @% k5 y$ s; ?- l
& n, s3 s# x$ y+ P4 N' o2 B
Method 038 h. f- F7 s5 B( W' e  h5 m
=========
6 s  ^9 `# h. A* b$ r! n& S1 b2 e: ]7 Z+ z/ H
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( |) r2 H. P5 ^3 r) `
(API Get entry point)
% _& t' J8 Y7 A2 x! K0 B        2 {" [) I* Y& @0 E
; ^/ `7 q; O9 A! M
    xor     di,di
- T! K8 R( Z0 e  R    mov     es,di; o- _3 K/ X/ S! G+ j7 u! o
    mov     ax, 1684h      
0 K$ s# }- O' V1 A5 A" u* `  E" {    mov     bx, 0202h       ; VxD ID of winice
; K* R' k) V9 t5 y- J1 [, ^" m- Q, X    int     2Fh! k6 _: X  P1 s9 p3 Y- l# f0 U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 M: d7 a0 B* L+ u9 R! ^    add     ax, di5 }, A3 ?$ R7 i! C: Q3 @. m- x
    test    ax,ax
$ G0 K" [7 S: O1 F& Z    jnz     SoftICE_Detected! L- v( j* m0 Z' ~9 G3 S- w7 w" |3 p
, N8 e9 w% s9 P& J; T6 L# h
___________________________________________________________________________
) K; F( J" m( Q; u! {7 v/ B' p& |0 z1 A* t5 b  |0 P9 x3 K
Method 04
4 p0 E4 [& s# h. b) f7 E=========+ W7 B3 K3 f$ s& i9 Y  x
- g# }0 V  T+ ~' s. M9 @2 ?
Method identical to the preceding one except that it seeks the ID of SoftICE
! h. a2 O& d/ D- z/ c/ vGFX VxD.* ?3 d! j! H  d% w9 m( H* r/ _
  u3 A* y: e5 `  T
    xor     di,di
: a: T" p1 K$ G9 ^/ U    mov     es,di
& u# L+ y+ c9 @" C6 b% q( g    mov     ax, 1684h       . o% ]1 H+ D& s
    mov     bx, 7a5Fh       ; VxD ID of SIWVID9 S6 y- M' p- j6 w7 z. }( u  D
    int     2fh/ @8 u: V/ Q6 B$ F! y! G& L) k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point& ^9 M3 y8 i' z4 E9 O: I  j( D+ ~
    add     ax, di
( i3 p  I* j) d9 @/ c) a" V    test    ax,ax: ?% i5 _' q7 p
    jnz     SoftICE_Detected
; o, ~7 r3 [: c* @* \4 B! ~! O2 {; b0 F
__________________________________________________________________________: l1 n. }2 f" s+ i4 V
. N$ J/ j( Z9 z

1 Q7 T9 ?+ [: ]' ^# |; W/ `/ a' sMethod 05
2 N; [$ Z, F7 g0 u% f( f6 v9 z=========$ Z/ q8 Q2 U  F2 h) V3 d* L; i

# X! z4 f& w% |9 |$ ^- m' y0 RMethod seeking the 'magic number' 0F386h returned (in ax) by all system9 D3 d; l* }% x! [
debugger. It calls the int 41h, function 4Fh.
( B1 ?" x; v/ Z/ uThere are several alternatives.  
* E0 v% W: I- \" p4 f* `/ D
6 \, h& v) V* F% ^6 E# XThe following one is the simplest:
5 Z& Z0 T' S. c4 O6 r) E" E3 G
+ v6 m1 |, Y9 }# j    mov     ax,4fh" q$ V5 B' f2 [: l! i
    int     41h
0 h, s7 f+ D+ g( n6 F; p7 I    cmp     ax, 0F386$ Z8 U' E# @& g" c
    jz      SoftICE_detected5 N! q: `3 U. c: P6 K

( [5 E5 I# X, M: ]
, ]+ B5 J5 a+ D& H6 x0 _Next method as well as the following one are 2 examples from Stone's 7 R2 b# y' i& j6 F* ^% m
"stn-wid.zip" (www.cracking.net):
+ V2 S  p7 r1 r/ T- `7 ?7 x8 J! p  W% T! e
    mov     bx, cs% e8 |5 ^; v. _$ l6 I/ x& i0 W
    lea     dx, int41handler28 ?9 [/ e+ m/ q
    xchg    dx, es:[41h*4]9 a; m+ }# j: A2 o3 e
    xchg    bx, es:[41h*4+2]* g2 R8 u; T8 a
    mov     ax,4fh+ R( v+ S" v5 C7 p
    int     41h  `6 N/ I& y3 U
    xchg    dx, es:[41h*4]
: n: w' ^  J& Z9 A% g/ G" a/ C    xchg    bx, es:[41h*4+2]
% B. L1 y1 y: S    cmp     ax, 0f386h: l' F+ h5 a3 U6 o3 P: y
    jz      SoftICE_detected
: v* k! t+ C' x/ E2 w+ I) j8 G+ K  P+ c; Y) y& Y
int41handler2 PROC, k' _7 t7 {5 O: ]8 ?: O3 B
    iret0 e6 k3 u# {" x- T! v
int41handler2 ENDP
- L/ ^: M( g! k/ }0 s1 ^' }! q0 Q" t. n, ]; Z! }' ?

( h$ A; c) \% a3 j5 \; d9 ^$ r7 b_________________________________________________________________________
$ x3 }! O; |" A! m% i
* W" c) J& C$ X: e0 V. d' S/ h" Z
Method 06
& N1 {) z" a. V& d. Z0 y=========- M% q, @4 n+ \0 J' I

3 e/ m0 b; K9 H) u6 C9 x+ j% k+ d# J/ E* c+ l# n) U( i
2nd method similar to the preceding one but more difficult to detect:
2 K+ r! u3 b8 l1 H- e' |% D9 T% e3 P* d' }
7 X8 f( h" ~. p, l+ f+ }
int41handler PROC
( u7 y- K% v5 m5 W4 _  f- R    mov     cl,al
, D, U% Q. X$ l) A2 M$ P, ]    iret3 g: Z) w/ W' B% A1 D4 V! ?
int41handler ENDP( x, z0 @( t( m8 f+ |/ G
. x  _6 }1 \, s( _

5 I6 E) j( r5 y1 Z# ?# \" v    xor     ax,ax# c- Z. {5 B5 z, z6 C. o
    mov     es,ax
4 i: o. b# p7 T/ P, `7 {4 B    mov     bx, cs
$ e" U1 ?$ ]6 f/ T8 W2 ^5 y1 T    lea     dx, int41handler
" u( y) V' U! X7 x# ?9 {7 L$ U    xchg    dx, es:[41h*4]6 B& P0 L" h1 X( g
    xchg    bx, es:[41h*4+2]/ b; _" P5 Q2 G5 t
    in      al, 40h5 J' F8 ?" ]+ u9 t) x/ ?* _- H
    xor     cx,cx
& C$ @3 s( j- e& F3 x$ j    int     41h" q. z/ p9 B& ~, ]0 h) \
    xchg    dx, es:[41h*4]' S! s7 F/ z/ E7 E
    xchg    bx, es:[41h*4+2]
1 a' l2 \4 E  w+ d8 L8 y0 E    cmp     cl,al7 F+ c, E1 T: A' j
    jnz     SoftICE_detected
# a# j2 e/ O' s. N% ~0 |0 k+ _9 C0 g
_________________________________________________________________________
5 N9 \" K; v4 t! u! U5 `1 a
) d; Z8 b' j! s3 }! HMethod 07
; T) K  w( O* q. z( j. b=========
- M9 e: n- J5 X$ `  v/ a. h8 m9 @6 N# O* O- Y" g
Method of detection of the WinICE handler in the int68h (V86)
# t" J0 D! {2 p( \/ l% g7 f8 s. D1 K6 h+ p) z9 h0 ^
    mov     ah,43h
$ v6 d3 a3 b, V9 O& b1 L9 N% e    int     68h
# D+ w/ d9 @- N# H" Z2 e    cmp     ax,0F386h
4 Y5 w8 j$ F6 m# Y9 Q" o, e- X    jz      SoftICE_Detected
! ^# O; L' @# {% {
5 w: T+ ^, o3 i8 b) l
. o# _( w6 y0 h( {/ L$ |=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# B7 S( q) V: ^& f4 ?* @2 L! S6 k! D
   app like this:
* T: a# f" [' s! f# W5 A: y
0 z7 U, L* [' [   BPX exec_int if ax==68
: H# A/ V( H1 [# r2 e, I   (function called is located at byte ptr [ebp+1Dh] and client eip is( S5 [# C/ U- z# V+ L$ B0 l
   located at [ebp+48h] for 32Bit apps)
6 w* N- ]4 N; H6 l__________________________________________________________________________
- u1 m, d& K# M7 i6 B9 z
+ R" t" T( e& s$ m- M0 |& |
& K' s, ~' F7 ]3 i5 I' A- OMethod 08
4 A1 ]9 A$ L, {) K% W; m) _$ U=========
  R* l  N; o% m7 j2 ~6 A/ C+ j( c$ {0 L# d+ L7 n- n
It is not a method of detection of SoftICE but a possibility to crash the
6 R+ z8 X! m( [* x# Ysystem by intercepting int 01h and int 03h and redirecting them to another
5 t" e9 F& @$ L. _5 k; Lroutine.4 C" d2 y1 ^1 v; q3 E! E1 k
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 a5 @1 [$ v" K% g4 }to the new routine to execute (hangs computer...)
) N& U3 c- I! [: b% e( x8 l! l1 n
( S& K; n3 u' I& S1 C4 I& A; `& x% {    mov     ah, 25h6 `2 D2 y; l3 H. b7 D
    mov     al, Int_Number (01h or 03h)
9 S7 M+ ~1 K' v2 x! _0 K, h7 z; o    mov     dx, offset New_Int_Routine
, }+ }, _2 {0 T+ @. f" W+ j* w    int     21h/ c0 |9 z" M( j7 x& v) c' T1 `$ z

3 Z. Z+ ~0 n8 m* R__________________________________________________________________________7 T4 P) N$ U+ a8 g' J" M  c& }
- h& h1 y- h& i) x7 A
Method 09
& {$ z" o5 P' D# Q; c: y=========& |  o4 B; ~* _7 S5 p3 f

% V* v) ^' P3 x' }& Z  i. ?This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 ]8 v) J" v6 m$ ~5 V, S; T) Mperformed in ring0 (VxD or a ring3 app using the VxdCall).
8 ?# J; z+ U) s& k, K8 Y/ w- |# wThe Get_DDB service is used to determine whether or not a VxD is installed& B% w% J  H% A2 R# `
for the specified device and returns a Device Description Block (in ecx) for3 |( l* |3 Y8 i3 X8 k: A: Y, @8 D
that device if it is installed.  w. Q+ d0 H# k/ h) ?

$ b7 F0 w+ v7 \0 Q   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
  f2 z6 A$ J' B" }" T: a   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
' t- A* M" @) g( x0 D   VMMCall Get_DDB& t. l: u# [; X2 r) g9 O
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  m+ a5 k* `7 J2 N
% F! J7 _7 v% e, H- ?
Note as well that you can easily detect this method with SoftICE:  F. j3 D+ S8 J( L+ a! J
   bpx Get_DDB if ax==0202 || ax==7a5fh
8 M2 ^- n9 a) ^! E
  z" I6 s% m5 o# g% T5 c__________________________________________________________________________
( l" p4 \5 x0 Q# Y4 s8 [$ s6 d% |: D! Y8 q. A  z
Method 10! T/ R/ z0 U. `6 i5 j" L
=========
* j4 L' W/ f- M* ~) Y8 }* g" ^' h6 N: T. r+ F3 s; i% k  B
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 k) J/ I7 q. q- y! E  SoftICE while the option is enable!!
. P" V3 R2 v' P) Z* e$ Y- o3 V+ p
# w3 j3 n  z) T( v+ J- P0 `This trick is very efficient:; ?9 v7 Z* m4 g' L: K; k  y
by checking the Debug Registers, you can detect if SoftICE is loaded
8 S# f3 Q" e1 O- n- |. V' o1 U4 O(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
6 ^5 P2 Q9 u# b7 tthere are some memory breakpoints set (dr0 to dr3) simply by reading their2 N: `1 M9 @, ^
value (in ring0 only). Values can be manipulated and or changed as well' ]2 ^" Y; k) S# j- k1 T
(clearing BPMs for instance)' X. n3 d% ^5 v, l3 P' C0 i
+ M1 e( e, j  z; S5 K0 @2 T& h
__________________________________________________________________________
0 A7 Y2 V2 t' U$ J9 l% D& d6 \+ u9 b6 T3 R5 ^  A
Method 11
, u! U! V! M! R, x/ U: c=========3 L! N' o( p& a6 C6 B' V

8 W" j6 Z2 F% w# BThis method is most known as 'MeltICE' because it has been freely distributed
; F5 f/ o9 P/ C5 zvia www.winfiles.com. However it was first used by NuMega people to allow; G6 U4 v! V+ E3 `  t, J5 J* H* D# i* n; |
Symbol Loader to check if SoftICE was active or not (the code is located9 H2 T7 C3 h' l% W6 d' P
inside nmtrans.dll).
1 S& N( T2 B& F+ G, E/ H# l' Q  M* o, O; A- L& y& T; g, c, L
The way it works is very simple:# |- }; i% S! x' M9 e
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 L! S! \  W4 M3 Y/ U& R0 N* YWinNT) with the CreateFileA API.9 R1 G6 A2 a4 h% ]) \7 T: ]- ~

5 ~! r7 n- L( [Here is a sample (checking for 'SICE'):
& A8 n& [  a. B/ l5 V: X( h- v/ O1 O5 B. ?1 m6 m+ E+ a
BOOL IsSoftIce95Loaded()/ M, f- R0 K+ H  t, @  E
{+ B- g! W4 a; j7 L& U
   HANDLE hFile;  
$ Y$ H: b5 N9 w! g( x9 B; C9 W1 F   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& ~- v* D8 |3 ^* P- n                      FILE_SHARE_READ | FILE_SHARE_WRITE,  n/ J3 I5 m7 Z0 D' [
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 w7 |9 m7 W7 O0 h& m   if( hFile != INVALID_HANDLE_VALUE )
! x0 ]6 V2 z# \7 ^# f( U   {
. a  v) t- w8 p9 x- O      CloseHandle(hFile);
4 j1 u* h2 H- ~0 B      return TRUE;1 Q/ T. U4 N$ g2 u
   }
3 f2 p' ?4 S" K  h7 P   return FALSE;
6 t0 n* `) E- z% M}
+ W+ W, U4 X& g' |
7 L" E  Y! U. ?/ [( e+ vAlthough this trick calls the CreateFileA function, don't even expect to be
7 B! t  Y+ a. P' ^4 v: _  b$ uable to intercept it by installing a IFS hook: it will not work, no way!* o: ?  b9 a( @- u1 p' j
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
) `- E: A3 Z, S% Z$ y  jservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
9 x. a) |6 s* i3 Uand then browse the DDB list until it find the VxD and its DDB_Control_Proc6 n& {: r$ N4 P+ z% a* g
field.
: O" \% c9 G* pIn fact, its purpose is not to load/unload VxDs but only to send a , Q  R- ?: x( r. A! a! ~3 k
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# j0 u$ d6 ?; w  s( n+ O, Q/ B
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
& a, E# @4 S6 M& Tto load/unload a non-dynamically loadable driver such as SoftICE ;-).9 ~' }- a& S7 d, x9 z) M
If the VxD is loaded, it will always clear eax and the Carry flag to allow
. n9 a, n7 S" W4 q, \8 u& L% Lits handle to be opened and then, will be detected.4 n1 r) Y3 _! g6 Z/ ~8 Y
You can check that simply by hooking Winice.exe control proc entry point
8 F6 S) j/ ?0 [/ ~5 D* `while running MeltICE.: A, K+ q) O+ [# a- D+ C1 k% I; g8 G
5 ~5 a2 w6 @2 X8 v& C7 V- i$ e

- I! u' N& h$ ?' ]" |2 D, j; V  00401067:  push      00402025    ; \\.\SICE$ T: j4 G  U" d  P: }( W  ]
  0040106C:  call      CreateFileA
2 \) c: a& i& c% H9 f) \# e  00401071:  cmp       eax,-0015 J: P/ Q$ g7 ^* V$ y7 C
  00401074:  je        00401091' {7 r, }/ T( p) I% s& j1 {

$ C, W/ v7 s8 A
6 u9 i- b% S- h6 j! y% v! {% Y/ eThere could be hundreds of BPX you could use to detect this trick.
$ e; K0 L. X! p+ |8 u0 M-The most classical one is:
' f* K7 u. [" A/ g+ t/ l  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, z: n) l' U$ a( d, _+ c/ `/ E    *(esp-&gt;4+4)=='NTIC'8 ^6 m  M" r1 r/ F. x

! R4 r. H& ?: F) O. o1 U6 ?" T/ T-The most exotic ones (could be very slooooow :-(% q% M7 j% j$ {- G
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 ^3 G4 F  P+ L$ t* N% i' i, M2 R
     ;will break 3 times :-(
6 M6 F# ]$ f8 |& }6 Q6 ]% U$ F, L# I
-or (a bit) faster:
1 Q1 B* S  ~. `2 s: u3 t; G* i4 Z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 p/ M) P9 ^1 u1 _/ r' y

* y' c, I$ r  P( ?   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 D4 }/ ?* _6 y* ~6 N/ y
     ;will break 3 times :-(! l+ f& [' j, i, k  n
4 Y% a) p# t) p2 p1 ?8 j+ \
-Much faster:% \. a2 H1 s3 O
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
" w+ X7 N  J3 c9 i$ C* S, G5 ?! y. z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
& x/ y  c: t# Z/ s6 ?function to do the same job:3 T: k& F4 `5 j  {- g

& B  T. v: k2 w0 X% s   push    00                        ; OF_READ
' G( w6 G" C$ Z   mov     eax,[00656634]            ; '\\.\SICE',0
: ^/ g: f) o8 n9 h+ N1 |' Z, @   push    eax, U- \6 H; o" y
   call    KERNEL32!_lopen/ w, _; Y7 v+ a; _5 e0 C
   inc     eax1 K$ `1 ^8 E% r
   jnz     00650589                  ; detected3 N2 y/ c& H! D
   push    00                        ; OF_READ
: T  ^7 u0 Z5 B  I; G. `) p: e& N  k2 o   mov     eax,[00656638]            ; '\\.\SICE'
4 X( Y7 V( @! L, V2 `/ ^   push    eax
; U& M0 ?# H3 ~" w/ M2 C5 A6 t   call    KERNEL32!_lopen: O, b+ w+ t4 Z  U4 P9 ?4 g
   inc     eax1 A4 _7 f. k5 V: c, P% n
   jz      006505ae                  ; not detected+ ~5 b) ?" `# J  q  E! |
. e- C+ B( E* L' |4 R# b! T4 ]
8 V- l/ q7 ^8 ~2 w' _* Q/ z
__________________________________________________________________________, ~, y1 I, W8 C% N! Z
6 m5 e% \( G$ c4 \7 a9 |
Method 12
1 Z- D* _, i6 g1 G/ E6 K* e=========6 u# B( ~: B8 b  r* v( W

7 F6 l, q/ X4 YThis trick is similar to int41h/4fh Debugger installation check (code 05% \3 l) ]! e% {$ I0 i
&amp; 06) but very limited because it's only available for Win95/98 (not NT)6 Y, k$ i9 S0 z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 {& |3 ?4 [4 @, ~, D

/ f0 ?+ A2 ~9 p8 X' I   push  0000004fh         ; function 4fh
' v! k, P, X; P! T) \   push  002a002ah         ; high word specifies which VxD (VWIN32)
" n/ I+ {* s& m3 X$ g$ A( X: F                           ; low word specifies which service% e, D) U% v* \6 T! g: E
                             (VWIN32_Int41Dispatch)
9 d1 l1 a; f5 c: W5 }$ Z) d   call  Kernel32!ORD_001  ; VxdCall
7 `1 j- k: H7 ^0 F   cmp   ax, 0f386h        ; magic number returned by system debuggers* J  D; M( ]& j" @' o
   jz    SoftICE_detected
) i9 T; K) T  U' K
: h' b% d' \: E: z  s" ?5 G1 JHere again, several ways to detect it:8 F1 E8 E# G- c: `2 Y6 {. E4 K
. ^4 z8 f0 X6 r
    BPINT 41 if ax==4f* N( I& K  P9 ?# |1 H
* N, m  }  I6 h
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
# V2 ~. z8 S8 [1 _8 e) t- i/ s8 G1 p  I' z' T6 F' O, M# C) p! O% a5 l
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A# J: u7 }4 J4 d$ L3 y
7 U+ u  A: R. l/ F# c
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! G3 [( K! A4 e7 m. f- }
4 g4 h6 |) b4 E8 B
__________________________________________________________________________+ S9 s1 h9 A- E4 ?
/ n4 [( N7 g9 c8 `7 Z
Method 13& C! w" D* [) a: E0 \0 d
=========
" w5 ]6 i* F$ n+ y; Y; u8 R0 V* s% ~* Q( _1 ~7 E
Not a real method of detection, but a good way to know if SoftICE is
' J& X0 Z) G" q9 R; Q; ]installed on a computer and to locate its installation directory.; F3 _  q; c0 j$ V( Q& X
It is used by few softs which access the following registry keys (usually #2) :
: Q9 y. S% B# T& g% B/ [5 _$ g( B
# ^' U/ Q! S+ g-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) z, X8 q  E' ]  Y* t
\Uninstall\SoftICE9 ?8 x1 A7 j. k
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE/ I2 h" m9 S9 n$ ^% K& r. `, E
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" s" O+ S% K1 m! M& h0 @, u\App Paths\Loader32.Exe
, i$ U" K" J5 Z% q% Y, w  m
' J1 Q( W& t0 u+ f, R9 M/ a" q$ B, @& o& t$ L8 F' u; H( a$ {- i4 v. i
Note that some nasty apps could then erase all files from SoftICE directory
0 `- X, U3 A/ T- M" n(I faced that once :-(
5 F) f& E% A( |, y* x5 V& ~, H% \2 x$ x5 u9 o- D
Useful breakpoint to detect it:
8 Z. e% F3 n3 }3 h4 B5 J* \. \3 d
; Z! `8 y; {4 v, U4 m# x     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 B$ P; o! |" K, w% i
6 m& L# T; R3 [3 t__________________________________________________________________________- J6 Y1 Z9 m7 I

8 ~% i2 A, `; U3 N8 O3 k" Y) q3 R2 @/ O5 @
Method 14
4 H2 p, M" N: P2 J+ ?! B# [) m=========
+ C$ Z' |- }. H, {7 x$ y; b) ~" T- p' E# g6 G2 o
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 ~- h6 c6 v4 H. l
is to determines whether a debugger is running on your system (ring0 only).. G" n, ~3 M  Z& A  B
( D6 A) [$ ^6 @8 a5 V
   VMMCall Test_Debug_Installed
' V( w4 }3 o5 w8 }  X2 \   je      not_installed. d+ m* b/ r6 Q! Z7 R, [

/ z$ W% `9 ?! z) [, YThis service just checks a flag./ N5 o& j; R! ^% @- }3 T. [: ?
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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