About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 G, w8 y' ~' q/ d
<TBODY>* M/ G$ G; P: j# O& f; B
<TR>
: Q* d+ c" P7 k<TD><PRE>Method 01 " Q; c2 ?9 {+ L* I+ Q
=========6 v, b! N$ y- t" d) p

4 T' I7 J8 Y% L) K8 c* VThis method of detection of SoftICE (as well as the following one) is
$ e& J5 C$ t5 F4 @! mused by the majority of packers/encryptors found on Internet.
' j# E/ o' d( A# c8 F" ]  H2 lIt seeks the signature of BoundsChecker in SoftICE( s7 @% g7 ]% A1 o
4 z3 U' b2 t0 N/ p4 {
    mov     ebp, 04243484Bh        ; 'BCHK'4 v8 K$ U! T1 X9 i" H$ t. n5 @' H
    mov     ax, 04h5 X: V& K6 C( q- u, Q. [
    int     3       ; z% r9 B' E$ A# D
    cmp     al,4
& ~+ c* c& @: M, E  \7 ?    jnz     SoftICE_Detected& s; n: X% F4 u9 o* R' H

8 n8 z! S* \$ x- ~7 }___________________________________________________________________________
- Q- R& w; Q. c- F+ d9 r
0 _- h1 g/ @  n2 w) d+ \  f/ yMethod 02
$ p; H* a% V' o3 I$ n% L=========
$ W& C/ r4 Q( m  @' J$ v. L9 q6 D) a6 G, |/ |! a3 W
Still a method very much used (perhaps the most frequent one).  It is used
* o6 }! i2 `% yto get SoftICE 'Back Door commands' which gives infos on Breakpoints,2 E; l3 A0 }, `' @+ K
or execute SoftICE commands...
! u: U3 N1 Y% u) X2 ZIt is also used to crash SoftICE and to force it to execute any commands3 J% _3 \1 s% X$ T; |
(HBOOT...) :-((  
8 m+ \0 N5 A! V4 W" _8 U. g  C6 X. c8 y+ i9 e7 b
Here is a quick description:$ d& t: p  s* C0 |
-AX = 0910h   (Display string in SIce windows)
+ [9 h5 A/ W! B$ k0 J-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx). P. P' Q' x: d/ B* [! I( C
-AX = 0912h   (Get breakpoint infos)
* @  n5 S& C' L-AX = 0913h   (Set Sice breakpoints)! \/ }: q$ b' G" l3 s: M. l
-AX = 0914h   (Remove SIce breakoints)
7 C2 N0 i9 M1 i! X% h) f; l- [; A- {( |6 H2 Z4 G( B$ V, C1 ^
Each time you'll meet this trick, you'll see:
. H7 E4 @9 R  A5 N( [1 I9 t-SI = 4647h; c+ @9 t! u. p
-DI = 4A4Dh
" e2 t  Z- D3 q3 \! a# K) SWhich are the 'magic values' used by SoftIce.
7 o* h# A% U4 A0 F% oFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, B8 o/ z7 E5 a) h) d% f
& H  s) C4 x' Z2 s/ u1 v. @Here is one example from the file "Haspinst.exe" which is the dongle HASP! `' v. x- u9 f4 u
Envelope utility use to protect DOS applications:
+ D1 t; ?( {" d' ?! u% R* S, l) L( J! e1 N6 e& ~* L

6 D" M3 o! k2 ~( }, J% {4C19:0095   MOV    AX,0911  ; execute command.
" i) V5 ]/ i  j  U7 I4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! A/ X$ n8 w5 n; [9 Z) a4C19:009A   MOV    SI,4647  ; 1st magic value.& x( o: f) H; F
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 M/ y) a  D. D% X) [& m* r4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
2 N, F# o; b0 A, n( P/ i, X; G0 t/ m4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- q1 t. p/ b) r$ c; F. `
4C19:00A4   INC    CX' ?$ M* `0 x9 l
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) J9 Z! J  x$ C  t8 s/ b4C19:00A8   JB     0095     ; 6 different commands.6 Q+ B+ R9 K& Y2 U; ^1 G. |
4C19:00AA   JMP    0002     ; Bad_Guy jmp back./ x& f% `0 h5 j4 m2 t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! D) g- P9 b0 u% I( f9 }; `

& T# p. ~: ^% h- f  {  p+ LThe program will execute 6 different SIce commands located at ds:dx, which
+ K. X; `9 p1 o0 N! o4 ~  Oare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% C; m" x- Z) E$ h
& M' A4 k" _5 W. s9 z7 l/ d* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! d- }- t) I  b7 n" f! e, L2 H% d3 K( `
___________________________________________________________________________/ f: g) y) Y  s' Q0 Z+ q. P& U- t

: u# o+ h9 p+ H  D2 K$ }6 ^% t
3 N" c8 o1 z6 XMethod 03
  i8 I7 Q4 q5 L  C+ V9 M=========) F1 A* N* }, i  ?$ M. N0 r- p

! \- y9 Y: j6 [) P7 s+ n/ ~' z7 W/ v2 qLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 M' t  q7 V7 g, e/ L. O+ ?(API Get entry point)
8 o! J( a( D+ j0 |$ @! _/ q        
: }* v' T$ q# x* x+ v0 H3 ]/ q4 C9 n7 H" c, J2 g2 G$ j7 Z& Y5 U
    xor     di,di0 V2 e( h3 ~$ b
    mov     es,di( l9 a3 F; U5 {4 H3 o
    mov     ax, 1684h       1 t7 Q. O0 z' c4 Q% }
    mov     bx, 0202h       ; VxD ID of winice
9 C) m2 p' T% g- p1 ]* g8 p- D, S    int     2Fh
4 ]; K9 |8 n; @5 A8 A, m1 A4 E$ |7 R    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% ]$ ?& ^, |9 r, k+ I7 S1 A$ w    add     ax, di
( A2 E' V+ K$ F8 Y2 O    test    ax,ax- V  [" u  _6 `& G
    jnz     SoftICE_Detected+ I1 d% F) C2 e9 ~

) M5 b5 q1 B7 ^6 H___________________________________________________________________________
: j: v7 I3 p8 I& ]* C" F4 H
6 H7 ~/ h) U$ i! CMethod 04
! y, \1 h- e2 Y% a. q8 N; n2 C=========# z5 y0 E# z# C! x: x, q1 i
% [1 }% q2 z( R) r( Y- f
Method identical to the preceding one except that it seeks the ID of SoftICE2 j0 y3 }1 W6 z# R$ P
GFX VxD./ q! p* ^& J* V& [, i9 i6 m/ Z
' M  X1 B; M! X. _5 g% J- A- B" Y
    xor     di,di
, k0 B# j2 X7 P+ J    mov     es,di
" M. M: X8 t$ L5 C8 n; Y. u    mov     ax, 1684h      
! j! j2 W. O1 u2 J* f    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ d1 m8 z3 r2 T' v! I. K+ i
    int     2fh
- R0 y3 }$ w! Z0 B; i7 y    mov     ax, es          ; ES:DI -&gt; VxD API entry point& ?6 s* I9 v  m8 [* d2 X, a
    add     ax, di) ]- m9 }1 n9 y4 J" h+ R7 J4 Q! G
    test    ax,ax9 U2 S, Y+ _0 J4 ]4 i. N
    jnz     SoftICE_Detected& ?1 ]1 L4 |2 |2 M8 _3 b1 L* a9 b* {

. u. S- |, m- T8 T( I" T__________________________________________________________________________
) c6 s& p( _% e$ B% l
% R9 {1 |! O5 s7 W2 N! |/ h. B1 \: p" y
Method 05
% f3 p8 d' i6 w! @# [. x" b- F=========  e* k) ?5 O& r% T% V. P4 V6 y4 _
3 y6 O1 s9 W8 o) W; A1 n9 J$ e& X
Method seeking the 'magic number' 0F386h returned (in ax) by all system4 I1 _( {, Z0 b6 b9 Y
debugger. It calls the int 41h, function 4Fh.  e; q  p) t+ M9 x7 [
There are several alternatives.  
* L. c3 i& J& V& Z$ u- ]8 E5 Z! a+ Q% g
The following one is the simplest:! f+ g6 v  F3 y+ t/ G" q
6 r, D& {4 q5 s) J" g6 J6 f# ]
    mov     ax,4fh
0 x3 t4 o6 u1 M( Q1 j' U! `8 T3 I    int     41h- M( f: F. i  @0 k
    cmp     ax, 0F386
& y: A. [- i. x$ r4 u& M$ @9 {    jz      SoftICE_detected
- I6 D$ u. N0 @- a1 A+ m
' \9 W3 {0 {  \& w- Q% U5 |6 L" \; E  L- ]) |# k
Next method as well as the following one are 2 examples from Stone's
8 Q  |$ Y( V: S2 R: Q  J: v9 z: J2 q  w"stn-wid.zip" (www.cracking.net):- u0 S! w0 p1 S
+ t( M# K$ z  X7 a; @" t9 V+ _  C
    mov     bx, cs
9 w$ E( {/ ~, g/ a9 o    lea     dx, int41handler25 S5 a, y$ w$ G' t
    xchg    dx, es:[41h*4]( Q- R' E, \9 d0 \
    xchg    bx, es:[41h*4+2]6 U9 W' x  f8 g7 |& S3 a- _. u" c
    mov     ax,4fh& m( j; B: D# B1 t9 _& c
    int     41h% o4 r( c0 d, h! m
    xchg    dx, es:[41h*4]7 b$ a7 q% _1 _( r' ?
    xchg    bx, es:[41h*4+2]8 f* q% w0 \2 d$ k
    cmp     ax, 0f386h
7 q1 X3 W( ?, y  p    jz      SoftICE_detected
1 x' t8 x) \; v8 o, O/ I( y. E, A) k2 H/ x1 \+ F( r
int41handler2 PROC
# r1 p; U  d3 @! }$ Y    iret. M8 X( m! S% T$ I- k7 A$ G
int41handler2 ENDP2 s+ b1 e6 @# Y) m, o2 P+ @
0 W4 L7 ?) i, w9 S2 [, R

! g9 [% R# ^3 h" f1 J0 A_________________________________________________________________________
8 F$ w. o: }$ }0 l8 H
5 K( M# v/ w; h+ O
* N3 I3 ]5 G. @  ^, m; yMethod 06
) r  E0 b9 _# v8 f8 G/ a=========
, _/ H+ Y* m7 f/ s+ k1 F0 f6 m, }: o! {. M9 [, S( K
$ q' |) L  y$ m9 b& S" ~
2nd method similar to the preceding one but more difficult to detect:7 B, d/ \) G1 M/ I% ]% W

. h7 K# U# F+ S& B2 i7 n+ z; P: ~7 d) l8 F7 W5 Q+ ?! c
int41handler PROC( N/ c1 R) z6 A4 G! ^
    mov     cl,al
( R9 H5 O, z# \$ i4 k; P2 Q5 D    iret
' n. V( t5 m6 M9 D$ I( ]int41handler ENDP# v5 w4 d0 P( T1 \$ I4 P
  j! O6 O* \+ t1 V$ ^' g* _
/ p: P/ k; D, [7 Q: |0 t
    xor     ax,ax! L4 ~/ d8 v* V; a5 G" O2 G$ M& ?
    mov     es,ax
6 k8 ~& l6 U( @. q  _    mov     bx, cs
# ~; x! b, ]; C6 |8 M$ B    lea     dx, int41handler8 z+ O/ V3 U$ K, n
    xchg    dx, es:[41h*4]' t  V6 Q, ^  q
    xchg    bx, es:[41h*4+2]5 c7 k- P1 M8 B7 v+ I! y
    in      al, 40h
8 }0 N  q" w: g8 [5 ~0 C9 x/ H    xor     cx,cx
6 ?" }  C+ x. U; n. E. H  `) K  p0 r' ]    int     41h
! W+ i+ U4 i* \' U+ N7 Y, }. O6 x    xchg    dx, es:[41h*4]4 J2 Q. A: m; l: T9 G
    xchg    bx, es:[41h*4+2]
& [4 g5 k- C( J8 A6 s& @, x3 l) U    cmp     cl,al* y# z9 W5 O! p
    jnz     SoftICE_detected
  ]6 y  k1 ]; p0 J+ i$ E+ g, C2 a3 h& l: L- C" M  F
_________________________________________________________________________
, t* B% J$ w3 i3 k; O  Y6 G; i1 I5 }" G2 A
Method 07
( A4 }9 ~8 t: E* k) j9 p=========
( {' i+ L& E/ {% ]+ V. _' r, T. ^3 Q* @6 d
Method of detection of the WinICE handler in the int68h (V86)) l. u0 n: n0 K4 V4 \
) V: c/ l8 p1 f. G( `8 d, B
    mov     ah,43h- E! j5 S0 Y1 X; s; S- J- X
    int     68h
  b7 X% ^$ M, W$ N: ~. N: q1 z, r    cmp     ax,0F386h- m" @9 m+ B4 ^* r6 H$ B
    jz      SoftICE_Detected. @0 o, G3 [" @

3 _8 S# R1 ~) g% S4 T/ F. C) R
- x3 r' A$ i0 R1 s! |- ]=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" q) x. x8 g; I/ l   app like this:& M2 j( R; ]6 a5 A/ T& J8 d: ^

$ @) {) Z# l, P! p( D# a4 I8 J   BPX exec_int if ax==68
9 H& t7 \" G2 ~4 `: A   (function called is located at byte ptr [ebp+1Dh] and client eip is
# L0 w: e  N$ K0 b! X   located at [ebp+48h] for 32Bit apps)
% [7 K: {; W7 T# k8 n. v! N__________________________________________________________________________
% c: V* [1 a6 R& _3 c7 H, M/ Y+ `! g7 j  T0 ?: J2 z: _! q1 o: C

7 f% s8 [0 R- \- V" L  |, {Method 08* W6 ?' Q: B7 n1 T, B- f" F. u1 c  ~
=========' I4 ~% }+ |7 \. m! Y7 @

" f5 k8 f+ h# J4 h6 tIt is not a method of detection of SoftICE but a possibility to crash the! B) I" f% w8 m
system by intercepting int 01h and int 03h and redirecting them to another
7 X. S: V6 @& `3 P: k; i* G( T" ^; ^routine.9 X: w9 F, s  u6 D4 ~4 Z' o
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points0 [0 ?0 D4 t& w1 t
to the new routine to execute (hangs computer...)$ y& F' o2 ^4 _$ s
: g4 {' @4 n+ ]( o" W. P1 ?  _4 m
    mov     ah, 25h! \8 l5 g! j5 T. G, G# |
    mov     al, Int_Number (01h or 03h)
) k" K( f; C6 j5 r    mov     dx, offset New_Int_Routine
0 w" R, o% F3 }    int     21h
. ^8 M+ j& D6 K4 ~
& f3 d( p2 f, p: B1 k$ ~__________________________________________________________________________
* E' R# {* M+ i9 u, u& ~$ m4 }( P1 c' ?. M% \/ d
Method 09
5 J* x* b& ]/ J" r=========
1 ?( O( H! c6 |; s, o4 ?/ C' b3 Y' W1 D( _
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; l! X6 m/ i/ Qperformed in ring0 (VxD or a ring3 app using the VxdCall).
2 w: j6 k9 S( {# R: @4 MThe Get_DDB service is used to determine whether or not a VxD is installed
6 S9 y  {- ]% _- \. G1 _for the specified device and returns a Device Description Block (in ecx) for
) s/ L% y, ~  H: g' x9 i: J$ Bthat device if it is installed.
, U$ O5 U6 v# W) y
( o* L8 s0 r; X% d3 O9 O+ W   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 n- U# h* z) b$ F2 \# X. h0 i   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 J+ z0 E/ U7 u4 b# D1 R. r   VMMCall Get_DDB: u" r. u4 `8 K) S
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed5 G) K5 M) E3 [
' |( l0 ?8 C* u& P5 z& H5 e' N
Note as well that you can easily detect this method with SoftICE:
7 c( Z; g* Z6 g0 o/ {   bpx Get_DDB if ax==0202 || ax==7a5fh
% R# Z1 u/ [1 C' {9 E/ ]
& {3 P* S6 t" x  s/ R0 D__________________________________________________________________________
: Z, B5 P) f/ ]) `
/ s4 u6 k7 v' t, `5 @& kMethod 10
8 y6 T  `; |* }=========: N. B7 _/ H+ L. O. ]7 j  F
# q7 [$ p6 K* S2 }) d
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
! l" z! C% e# V9 I2 L  SoftICE while the option is enable!!" j9 T/ E+ |2 A# M8 I, A) y7 N

0 \& |9 x1 l% v/ t& n/ b7 {  q9 QThis trick is very efficient:
  O0 t/ W% {8 p; k7 j% k3 U7 Bby checking the Debug Registers, you can detect if SoftICE is loaded
0 ^$ B+ c% N7 [! u9 N2 k(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) D5 j$ m  @5 g3 y: E
there are some memory breakpoints set (dr0 to dr3) simply by reading their- G' A4 T5 s* K( y2 P6 t
value (in ring0 only). Values can be manipulated and or changed as well. |7 T0 H) p% n5 O: v9 t
(clearing BPMs for instance)& ^# }; Z9 u9 U! x- M" a
! ~* Z# R0 S, Z# m; H" h& ]# w( `
__________________________________________________________________________6 w3 S7 z8 x- Q

/ ~" _8 S8 i$ J) T- j: T, jMethod 11
% |. E$ c) I- h+ v7 l4 J# g=========' q8 ?% V. ~3 X+ k
+ l& _7 @. l3 U* Y# E% G; a
This method is most known as 'MeltICE' because it has been freely distributed/ E0 x5 O; u, O4 I5 H, T* b7 q' P
via www.winfiles.com. However it was first used by NuMega people to allow
" k: j  a/ o; X! \, l9 D# c  YSymbol Loader to check if SoftICE was active or not (the code is located( \' r8 t# x) j, U6 U; O1 K* @/ X
inside nmtrans.dll).
0 C" a2 K! W. j
* I* b7 K1 r, p; k2 B4 IThe way it works is very simple:
$ }9 y4 l0 S& N$ e2 \  Q) pIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 [$ A% n, Z: g* n& V$ pWinNT) with the CreateFileA API.2 s3 M& S) ~+ X9 p9 O

: {/ w. y/ a9 ]4 ^% uHere is a sample (checking for 'SICE'):% m, u6 g5 B; m& g% s3 |1 v, |. W
( I1 p5 k2 W: E
BOOL IsSoftIce95Loaded()
/ B. D% G" i) ]' B/ ]{
  V: v5 ~% ?$ ?6 i5 @   HANDLE hFile;  
5 r& e4 h- i$ t" I   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ ~9 x- C; L) B+ L
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
+ z2 g5 m/ b' p" s9 H                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
, F) [& \" ]" @/ t   if( hFile != INVALID_HANDLE_VALUE )
% k+ L4 k5 v$ `" ?6 `9 \   {9 _- U" r3 V' B0 ^3 N
      CloseHandle(hFile);
( k4 R) G9 c0 ^9 X1 n( _& ~      return TRUE;
6 v5 f, C/ c. M   }
7 X* K' B) R0 t' x. q/ M( ]   return FALSE;
: k0 J- @  U7 c0 K+ M% z}
1 b2 ]: c; G) c& i( b
4 n6 x; s/ n. x& @$ B. tAlthough this trick calls the CreateFileA function, don't even expect to be- {' V% X+ D! r# E  B
able to intercept it by installing a IFS hook: it will not work, no way!  |2 T' O/ a+ ?
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
& \$ n$ t, g7 Iservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
1 G# N, U: r& S+ vand then browse the DDB list until it find the VxD and its DDB_Control_Proc& x0 t/ K0 P. w
field.9 E% W/ t% U9 {
In fact, its purpose is not to load/unload VxDs but only to send a
- n  p% V8 `" e0 E: A0 U) XW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 K6 m: |/ I- A- D
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 v. p" q: F  D$ x8 R; s9 qto load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 w+ X' W; I7 U  |* I- RIf the VxD is loaded, it will always clear eax and the Carry flag to allow
5 G9 L6 U9 D. L9 Mits handle to be opened and then, will be detected." N7 u$ M8 }- g0 M6 j
You can check that simply by hooking Winice.exe control proc entry point
* ~6 M5 @# [- ~0 n( R& qwhile running MeltICE.$ a! w% x. k- P/ c& u
. x3 U6 Q" \4 A; e; D/ e
; R1 i& K) D/ G+ b. g( V, B
  00401067:  push      00402025    ; \\.\SICE" a3 Y. P9 y) X" N9 R% f! o
  0040106C:  call      CreateFileA
1 F2 h3 x0 n( |9 y# P6 a  00401071:  cmp       eax,-0017 y: V8 d+ X5 R% G' u( M9 N: @
  00401074:  je        00401091
* |- M, m$ M7 y: Q  \
  b, `* R  V9 H2 z
9 N: M8 {. o9 N1 oThere could be hundreds of BPX you could use to detect this trick., r0 S8 P* v/ M2 N
-The most classical one is:
, C1 |$ [! T4 f0 D% @$ x- S  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 t6 r' }" |' }# T) v* z" ?* H    *(esp-&gt;4+4)=='NTIC'
! {) V( ?. R6 W1 m: Y0 l& i" G2 l" D+ A: C! m
-The most exotic ones (could be very slooooow :-(5 N8 p( [' a. `8 ^/ z8 i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 n1 \! X2 j; y6 P/ p
     ;will break 3 times :-(
; y  h3 b6 N# j" Z0 x8 e
& }' K9 @6 N% L4 n* r( [# g-or (a bit) faster:
% k. d0 t/ j/ X; E/ F& {- h   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
' R9 Y+ Q6 b3 a+ `1 P+ u* V& a/ D* @4 g2 Y. f6 c/ e# V' m
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* ?% T. y9 B; N# G% N     ;will break 3 times :-(
) \& Z3 x/ t/ H  @; I9 E- Z& Y$ d- J" L: b* ]& s
-Much faster:
6 A# y3 \9 R1 S$ V: J  q   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ g4 y& M7 W2 }* ]
: b& _# u3 y$ D& g6 RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
  L# {5 ^- L" e9 v8 Dfunction to do the same job:! ?: }+ c, l( }# [: G
1 n* H+ @* {6 c8 }# c: n& {
   push    00                        ; OF_READ
7 N! I5 h3 T8 U" ?   mov     eax,[00656634]            ; '\\.\SICE',0
% d2 e$ A" X4 W8 ~: `8 `   push    eax) Y& F( S$ U$ k& i# B( ]
   call    KERNEL32!_lopen
& h7 I6 I7 I; t  }   inc     eax( c2 c* H3 Y* M; o" u3 S3 }* P
   jnz     00650589                  ; detected" p) F; D- ~6 L+ n; s  z0 a
   push    00                        ; OF_READ
! }. J& e7 E$ J4 r   mov     eax,[00656638]            ; '\\.\SICE'3 U1 P7 J& ^8 w
   push    eax
( V; s3 [/ l) R! z# k   call    KERNEL32!_lopen
3 V+ M; m! V  J( w2 C   inc     eax
3 K# f5 v& y; ~4 l, A7 ~   jz      006505ae                  ; not detected
  ~% O) `2 x9 `( b6 S2 x  m3 G" H4 I5 r, T
; f& {% {$ \3 r' S$ W+ _4 _
__________________________________________________________________________% E) s5 c4 o) ^

' @' G$ m# x" K0 C! e+ LMethod 123 v7 ?$ [5 r& H
=========
- ?: g& y- @2 z; b) E+ A, {# z
) T, X4 ^6 I* n) mThis trick is similar to int41h/4fh Debugger installation check (code 05/ O* M0 T3 ]6 R1 B/ i; V1 R1 a
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
6 w* f2 H  b8 |; \as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ |/ q& B9 g% s! g3 m
- x3 e6 i, c3 J- q( @   push  0000004fh         ; function 4fh/ }; t. x4 e9 ~$ v
   push  002a002ah         ; high word specifies which VxD (VWIN32). n9 t# r0 o  Z' ?) B! e
                           ; low word specifies which service  p! g5 Q0 d  R: m$ k+ J
                             (VWIN32_Int41Dispatch)
" N+ W2 B! k" m/ a   call  Kernel32!ORD_001  ; VxdCall
6 `6 U: i0 L  L8 a+ t   cmp   ax, 0f386h        ; magic number returned by system debuggers5 E$ I! \9 g+ N' c
   jz    SoftICE_detected* a" e& ^2 c# R1 |$ G  q7 z7 C
+ Y, b. G* V$ P5 P
Here again, several ways to detect it:% J# ^( N' ~6 ?

/ j& n5 H9 w4 Q* D7 \    BPINT 41 if ax==4f
' c, H, b& s  L) {3 I. H8 l; }$ _$ {# t; L  R
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* L7 j' p/ ]. ?
5 o( E% u0 g$ }+ @3 t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A# O4 C4 _* X: q0 t: |
2 p. ]- ]$ j( Y: r* Z2 |, @
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
9 e  S" V4 f2 }1 ^! F( k  T# d5 r3 i  x1 d0 ~
__________________________________________________________________________
# w( y/ N9 M( I% v( m( X' H% Y  @; o1 S! Y% y# b4 l
Method 13; A4 S8 m) }) `: k% K/ _/ [, Q
=========9 Z6 H$ s8 i7 b

; x' A1 @# w, k. c( L5 ~+ {Not a real method of detection, but a good way to know if SoftICE is9 a0 J8 R$ p' F2 n
installed on a computer and to locate its installation directory.7 c2 G9 o, B. `$ |  I
It is used by few softs which access the following registry keys (usually #2) :
; x8 f8 B: r* o& z" E: ~' E; @' n  |! A9 `4 G
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) ?6 U) G* X# w1 r" [1 j! G1 ^
\Uninstall\SoftICE9 g1 c4 E! S( M3 f/ b" ?
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& `- a, ^: w7 q% g  x5 I7 r. B, g-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% j, s" d0 l' o( V$ B' \\App Paths\Loader32.Exe5 ?4 X7 i0 E+ i6 E/ _; l
' J% @$ t% O4 m& {. t

9 {) a4 O9 x/ W! z1 ]Note that some nasty apps could then erase all files from SoftICE directory+ M' X/ {' O1 A7 c8 e
(I faced that once :-($ Z6 ^/ r1 k! U1 L( J  \: C
+ T* L" q( ]. p  Z" G2 O! G) W
Useful breakpoint to detect it:
. R9 X% b: c& ^3 O9 ^+ _. n# W0 B4 U$ ~; T6 l
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; S0 i$ v6 C4 X9 t) {( t- f/ {6 i$ m9 X# C) _9 S3 m# N0 q/ T) o9 A
__________________________________________________________________________
! w3 x4 {' m$ s0 q4 G# \; ]5 S" E+ s
, a/ v7 @0 ~+ m, ]
Method 14 2 B, b, l4 d# h8 N3 ]! w1 i
=========
5 \3 \3 g; E* t) s3 F0 ?0 A6 e. q9 k5 w. K' [: `. [6 x7 O/ E
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 z4 \) [% p) Pis to determines whether a debugger is running on your system (ring0 only).
9 q$ R) E, X; i4 p& G. t0 N2 F" n8 L& s% O9 D+ h
   VMMCall Test_Debug_Installed8 F: x1 |0 S7 E) \' k- h  Z4 Q
   je      not_installed2 T( L$ n% v: e* `

& m+ u. @8 B9 o  A8 z& EThis service just checks a flag.
9 B  E; [  `1 ]5 u/ R: T2 r</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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