About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: e* ~& c, b! b
<TBODY>
/ ~3 k( y8 S/ o$ n8 m$ ~<TR>
0 [. v$ C8 m' H; s6 ^' U/ `<TD><PRE>Method 01 % j6 `& F2 m& D) D5 s, Z3 K- ~
=========4 ]& R" k4 y3 C! y" o

9 W% d2 c. c! o) N1 NThis method of detection of SoftICE (as well as the following one) is5 z. o& f. w3 L; o! g' F1 z
used by the majority of packers/encryptors found on Internet.& {& t' K" a% T# R& f* s2 S3 h7 d
It seeks the signature of BoundsChecker in SoftICE
' t6 I5 M0 z9 c$ P- W+ W
$ ], B$ V& {# n' }    mov     ebp, 04243484Bh        ; 'BCHK'
" {: x3 _, k/ u, g. e5 K    mov     ax, 04h
/ b, _7 t  T" y: ^/ {    int     3      
* w8 U$ u3 y8 w: Y' @1 C    cmp     al,43 d5 ~$ K5 N( U" e* N8 }+ `7 I
    jnz     SoftICE_Detected
" E! b/ Z1 W9 ^( U+ t9 U
8 o9 M8 N4 `, d8 F___________________________________________________________________________  L# s, P8 b. S* x
' A  ^# j/ R2 |3 c% s
Method 02
$ z2 t4 {+ ]7 C9 V=========
, r$ ~; W) i4 t+ V2 j3 V% M1 l3 Y8 b5 Q' _; E9 H
Still a method very much used (perhaps the most frequent one).  It is used
$ g1 W9 }: z. f# Tto get SoftICE 'Back Door commands' which gives infos on Breakpoints,2 d6 B  _' H  @' s; H; A  ^
or execute SoftICE commands...
: J5 h5 g: E. B+ o) u( rIt is also used to crash SoftICE and to force it to execute any commands9 |4 g4 R% \0 x
(HBOOT...) :-((  * c# U) W9 y& m- c

5 y6 R$ J1 _7 z; H" y8 H: `Here is a quick description:
- P7 B* Y( u# \4 l1 E" E-AX = 0910h   (Display string in SIce windows)
! d" l: k7 j0 e1 E3 [  W" V-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 A3 s, u+ I( n-AX = 0912h   (Get breakpoint infos)
' {% P$ F$ H# q! F. ]% ~-AX = 0913h   (Set Sice breakpoints)
7 [( {7 Q6 E- F3 d1 V5 q, f-AX = 0914h   (Remove SIce breakoints)6 p  g3 O( e! p
5 l( V8 u, |# Z$ H5 ?1 g3 `' A
Each time you'll meet this trick, you'll see:
# Y; M7 ~% @* v! r-SI = 4647h& l2 W7 ]5 G! e. r
-DI = 4A4Dh% `  z/ L2 x; W( }: |8 @
Which are the 'magic values' used by SoftIce.
  A( z: d/ R/ b1 y6 y9 iFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 W' [* h7 t! a; {( r+ S

2 m& N' d+ r4 x1 hHere is one example from the file "Haspinst.exe" which is the dongle HASP. a* ^4 \6 J, Q+ Q" z' r* I$ H
Envelope utility use to protect DOS applications:4 \3 O2 W9 O+ L7 c" o
3 n1 M% l, d1 }

: n8 h6 b" q' k4C19:0095   MOV    AX,0911  ; execute command.' d4 s0 `5 x, V. o; g
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)." w& y! G" \3 h9 A& p
4C19:009A   MOV    SI,4647  ; 1st magic value.1 T" a% w  w9 g  m5 d
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 ]& I7 h9 e+ s* E6 t" B  r# d- A4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 Q9 ?3 q* l+ V$ L7 o4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" J( \# {" ?. o' a4 h; W4C19:00A4   INC    CX
/ ^+ T- {& O" G% [& Z, O% L& d0 R4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
+ y. ]$ U; f5 J& |% }4C19:00A8   JB     0095     ; 6 different commands.. a0 A4 m( ?1 m+ U( f
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% \9 U6 D1 E$ u3 z4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 e; o% l: f* M) p4 I  T% \) I

, d2 r4 [. a$ v8 s$ C! ^The program will execute 6 different SIce commands located at ds:dx, which" V5 w; q, P( ^4 I. ^# C
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
4 R6 T# W- j* u& N& z+ z9 ]1 i) ~% [/ i1 _
: E; B6 R; W7 Y4 \1 ?, F8 L* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
6 o/ r5 h( S4 k* ~# F+ ~! A3 f___________________________________________________________________________
! c7 T7 ^9 t" U4 `, _, d+ o# y/ v. w, C2 b5 N' P0 W' c

5 g9 B; F/ `+ y* qMethod 03
0 e% T9 Z0 u  Y, @9 E# j=========, J' v! }" t4 j" u7 e

% k5 x% I! z3 y* n% y/ h" @8 G& @Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; I3 [0 h1 w. U* w; o5 y+ e: C, }4 j(API Get entry point)4 h- H0 G- G4 o( W
        
3 D; }4 f" M$ {8 M- t& t! l5 s: d) m) C  D
    xor     di,di, u6 L0 U6 y  N9 X
    mov     es,di
. M: G& T& Y5 ]9 u% l5 H0 Y    mov     ax, 1684h      
# g3 q+ ~1 x  _+ V9 E$ ?- r    mov     bx, 0202h       ; VxD ID of winice1 i9 y+ L) \% z# f
    int     2Fh" i2 p( |$ u6 e1 P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 p) V& ]7 O0 P' v5 z! R
    add     ax, di* K) C9 J/ r+ j
    test    ax,ax# v" F! ~* p5 c. C! ^+ E
    jnz     SoftICE_Detected' q$ ^* O! l5 m& n: y4 x4 W
1 x  k' Q- G5 c1 H7 i
___________________________________________________________________________
$ A2 D4 o3 `6 w' u$ F: w; z& `0 Y: b+ }' p
Method 04
6 h  C  t" |9 }# @4 C/ t' Y  U) j=========
; k' [# \' ~- t1 Y) i( A: N
8 O/ w' e2 [  r8 w; n$ K8 Z. E; yMethod identical to the preceding one except that it seeks the ID of SoftICE
6 i. d# g' S; iGFX VxD.
# |) B2 n' ^5 W% ]2 b! A. R8 ]: ]* I1 {/ U- s2 o+ e
    xor     di,di$ Y! m* b( j+ {
    mov     es,di5 u2 |$ [8 e) S5 ~% E/ C' d
    mov     ax, 1684h      
* ~6 h: b' c/ P' T/ r1 `    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 e2 ?' [. f& t0 ~! _8 O7 r+ ?1 l
    int     2fh
  F6 H. I2 \/ [+ o& Z5 f1 a0 i  }    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% k9 s" Q9 _; P$ e- ^/ ~    add     ax, di
" D5 |% Y1 Q; Z, c    test    ax,ax
- `1 ?: U# B# L% r    jnz     SoftICE_Detected
2 a+ o+ ~/ q1 ~5 a& E* R: i0 q$ O( J# a, k' Z  t
__________________________________________________________________________
3 ]: `4 t8 u0 ]- \0 V9 L& j; B
; |; \  E  e) o3 l1 O3 I# n& y) \0 W+ K$ n3 z- v- p+ w
Method 05- O' \( @2 G  S9 B% Z
=========
* n2 `6 Z; v4 l7 i; N. @! {
& X- e/ @! F' JMethod seeking the 'magic number' 0F386h returned (in ax) by all system
( E" W( ]7 s" z: }8 }  Y# g) l- W9 E* Hdebugger. It calls the int 41h, function 4Fh.
/ j# K  V+ `; u5 ^8 HThere are several alternatives.  
# f5 e* J# x8 B4 p0 I4 D& R+ I: R6 E" \4 p) j: o
The following one is the simplest:
+ Y& z7 z0 D% @- ]' t. H! O2 K% T  |
    mov     ax,4fh
$ m& X1 m) n7 q2 {    int     41h  }/ Y; J5 G7 C. _* y- H
    cmp     ax, 0F386
$ P9 C4 n4 g0 \; A    jz      SoftICE_detected% G4 s5 [3 }: Q. h5 c4 p# q

0 [+ q. g9 d' g. N) g
3 b$ f( L* |) A/ eNext method as well as the following one are 2 examples from Stone's   s; E3 Z% t- m2 j/ F5 C; C
"stn-wid.zip" (www.cracking.net):
) l# i$ R( y. R* |
/ H$ p) q+ W0 Z6 M    mov     bx, cs" Q4 N& h" P2 d, }
    lea     dx, int41handler2
7 z5 r4 [( N7 o7 n# h3 H    xchg    dx, es:[41h*4]$ ^" V3 x$ `( l( S  `+ x6 r
    xchg    bx, es:[41h*4+2]
9 I$ }3 K7 W6 y* N6 L8 t- e& p% ]    mov     ax,4fh
$ j: r2 E* g3 w    int     41h( V+ Z2 o  w/ w+ B
    xchg    dx, es:[41h*4]+ X) X& b8 }1 e3 Q$ j$ k3 [2 @
    xchg    bx, es:[41h*4+2]
' C4 p2 Z- I" X+ B, M$ t* Y    cmp     ax, 0f386h+ B) m/ S' K$ P* z0 j
    jz      SoftICE_detected5 P! c0 e. x) a7 b' {8 C

: c2 `! P# f0 G% w4 }8 O. {6 wint41handler2 PROC' v5 j" u3 h/ w' u4 w( u3 ^
    iret
6 K8 a. W) M& |6 |/ i+ u% Dint41handler2 ENDP
' i' d" z3 Z, R, b. ~. j, S- }, {6 s) y2 T
+ J" h8 d! D1 c9 C, c- D7 \
_________________________________________________________________________* w4 h% y" }, \
2 p. P$ j& Z5 G% t% r) |5 B

$ {# i  q# u+ s. I  `# |  U/ d4 rMethod 06. n' R' M* n/ }: g' D' b& t
=========% L8 B+ ?. ^: B2 x* z* Q2 \
! Y4 @/ m9 F, o
2 m  C9 w0 v' C4 J2 L/ i( m
2nd method similar to the preceding one but more difficult to detect:! ^3 M7 f& c3 l: i

& l" ~+ @1 c1 X! s- H) I( y' d$ |/ g1 b' d( W* N
int41handler PROC3 o! a1 W; I" G' U& X
    mov     cl,al2 g! ], M+ p8 b, m- R: X- I
    iret
5 d3 R8 _* O* P" n5 I: Zint41handler ENDP
% n4 t+ w% G8 H+ a( X# A% J; _% {& I: t% E
. J! |* W; f- q$ F
    xor     ax,ax( ^# ^4 v, l$ @7 C0 t
    mov     es,ax$ G. A, u" k: j  W, |% E( T
    mov     bx, cs0 ~% s2 ~, m  u9 O. O
    lea     dx, int41handler
, k; g6 K' }* d2 H+ p5 a( b0 ?    xchg    dx, es:[41h*4]
+ J8 _( Z: H+ b6 g1 L$ b) H0 l# A% S0 d    xchg    bx, es:[41h*4+2]
6 ?2 r9 t1 |6 \6 \5 c4 Z) p  |    in      al, 40h# r: _3 k  c7 v: Y5 }% _
    xor     cx,cx
4 b1 n  ?9 Z+ V7 B; b. J# k; G    int     41h
# y! w$ q- t4 I5 ]    xchg    dx, es:[41h*4]
) A* F, M$ ~% N* F' H% P    xchg    bx, es:[41h*4+2]2 a& o6 P& N2 o' W) O
    cmp     cl,al
1 y+ }% r0 K! N0 W% t6 Q: c    jnz     SoftICE_detected
5 s' H5 Z' p5 |9 \# k
: O2 V& B3 t3 ]/ X! O_________________________________________________________________________
6 B& }! y6 B7 K4 }3 X* @! I/ b. p! H: B5 O+ [9 C; G' y) _
Method 07
9 K$ `6 |. d6 t' u=========
: a: c  P) g$ K6 y% q1 |5 E9 d- ]( v* i( J; l1 X6 B
Method of detection of the WinICE handler in the int68h (V86)
, H+ q9 `4 s2 U' a' j5 K+ n' k8 y. p, E2 T" v7 e" g2 v/ N+ F: x0 D
    mov     ah,43h4 t' q0 \. \5 d1 n0 K& d& b
    int     68h2 g! h. V4 M, U3 d- h
    cmp     ax,0F386h! s. u" I1 W0 k2 ^( K5 R' g
    jz      SoftICE_Detected
) }# d3 C  W! y- m- G9 ]& A8 }& B' g) Y) g) X- b2 M
5 t  r1 q9 l1 w( a# z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& s- u7 \1 R) f$ y+ @
   app like this:
4 H& i- p. @# d, Z4 u- A( @: r9 m  F- e5 G3 U: i
   BPX exec_int if ax==689 U; `& i, s( K5 I, G* d
   (function called is located at byte ptr [ebp+1Dh] and client eip is/ ~+ Z% n. p$ A: ?3 A! l" o! q/ N
   located at [ebp+48h] for 32Bit apps)  f0 W! J7 x- A) {/ w! v; \
__________________________________________________________________________2 `5 Y# y3 Z# }6 |- O: S

6 i( ~8 l- R5 N+ K1 d4 `0 c- Q7 l+ g6 c/ _! `- R
Method 08
% A( o4 i8 J4 M=========- X* i4 ?7 s9 O1 W# D) F7 z

) ]: W) J. a. ?) ZIt is not a method of detection of SoftICE but a possibility to crash the. T, X0 \% d3 n0 b1 l
system by intercepting int 01h and int 03h and redirecting them to another- ]9 W6 d8 x8 o; f" l  \
routine.
0 R6 s& l$ E. w" e6 ~  _2 FIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points. t3 \- q5 i3 K, W6 E5 t2 k  x. |
to the new routine to execute (hangs computer...)% J1 b5 F# W" A+ l# d
6 v9 X6 t1 y+ G7 g8 G  C3 @6 N) V/ o
    mov     ah, 25h
2 A. S" i) N. R* Y  w    mov     al, Int_Number (01h or 03h)
- I: o% i4 j' c( [6 t. t    mov     dx, offset New_Int_Routine# K- B8 i2 I9 Z  K% x& {
    int     21h
/ P5 z; I" I3 S. u  K$ {9 z" b/ Q7 z' ?' A+ g& C
__________________________________________________________________________  }; a% i' j- D$ F
/ k$ a* S# c. s0 `" g+ W9 ]4 J
Method 090 U5 `7 m$ N& m& R
=========
& W' t- O0 a8 R7 g6 E! W! X
; }4 L+ N" I3 UThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only7 D% G+ c. _3 h0 P+ J
performed in ring0 (VxD or a ring3 app using the VxdCall).: I% K/ d; h' ]
The Get_DDB service is used to determine whether or not a VxD is installed' k/ V1 A, B% b4 i9 ?" ]9 D
for the specified device and returns a Device Description Block (in ecx) for$ p0 M* x5 r; d  `
that device if it is installed.. d! M. N, P, y( L% r/ V/ R) u# [7 z4 h
: i1 G  V1 G( w" N1 I
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID) V, ^+ {6 n% {0 k3 V
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)  N% e5 |0 C( j$ e2 q: f
   VMMCall Get_DDB
) W7 `, y# N1 f- V& {9 v   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 p4 Z! v+ w7 o0 k' y
3 O5 j& x& f3 O( V+ k2 a$ G
Note as well that you can easily detect this method with SoftICE:
5 ~5 m- n4 v0 u3 n3 u: }' k   bpx Get_DDB if ax==0202 || ax==7a5fh% Q; I6 n/ j9 b) L8 s
6 F# P# e- d1 t
__________________________________________________________________________
: X1 t$ k" j( J, J) \- n- |( s
/ N% F" R, @$ S# E# zMethod 10- u4 k* T, U+ \) i
=========
; X9 d, Z0 @* k* Y6 q1 x0 M
+ `3 i+ b3 A" E! \=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ ]0 ]+ W" k, \- G& H4 e$ L  SoftICE while the option is enable!!( }5 F2 B: I/ _0 M- W/ Q
+ E& t  N" W- [
This trick is very efficient:6 S# p* M: ~# T( {( B
by checking the Debug Registers, you can detect if SoftICE is loaded
+ }# C% I& o' G3 N/ D% R. u(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! F+ Z/ w: s. E6 p4 L7 w8 a% W
there are some memory breakpoints set (dr0 to dr3) simply by reading their6 m7 `# U: r  f) Z3 M
value (in ring0 only). Values can be manipulated and or changed as well
: U3 G, J1 O  U* ?. s* }(clearing BPMs for instance)* s* O# V( |, X: z3 V% j( J( S
1 F- j4 O: H+ F
__________________________________________________________________________; ]8 u$ Z. X5 {; L' F

' M; G& R% T+ k+ E, gMethod 11
7 E5 m& f3 ?7 d  M( `=========" B6 W6 }! {  |& s) [
2 z( q. w/ K& h9 q
This method is most known as 'MeltICE' because it has been freely distributed
1 w4 M( H. H! [) M3 Qvia www.winfiles.com. However it was first used by NuMega people to allow
  F" I; ^2 f- ]8 Y% q; T  @6 o& YSymbol Loader to check if SoftICE was active or not (the code is located
$ R  q2 i8 L* Ainside nmtrans.dll).
- E, N( s7 h, n- R, p4 V3 D% Y6 ]9 F$ [" c, y! A& A
The way it works is very simple:
$ M7 Y! ?' G- Z0 gIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% S6 D9 O2 ]* E* M9 aWinNT) with the CreateFileA API.; v- y! @% Q+ }, t9 {: g  U
/ ~9 a! D1 w' {% ]# o! a
Here is a sample (checking for 'SICE'):$ `! j* x0 W  P) k& P$ o; H
0 p  p5 \7 e( w4 C
BOOL IsSoftIce95Loaded(). b: I, B# s+ C$ i
{( W" ]0 s) M/ Q( J: w, h
   HANDLE hFile;  
# b( x$ @  G, g! _9 {$ J1 s: T   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 B" w* o0 C, U' Y) p$ G! w' M% B
                      FILE_SHARE_READ | FILE_SHARE_WRITE,% a2 |2 }- f, S  e/ _% x3 \
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 g; I. W& y7 h
   if( hFile != INVALID_HANDLE_VALUE )
, d2 L( c3 @3 O& R; ~   {$ h/ E$ X. P' Q9 J* k8 f
      CloseHandle(hFile);9 j1 z( d; @8 S+ |) Q$ L. N% S
      return TRUE;: M- ~) P6 y2 h7 {* Y
   }- x1 w, ~6 E9 `7 a. A; ]( k: L
   return FALSE;: E# d% R8 H$ P$ @, c' O, X
}0 h& L" k; U3 T* A. m: K/ G: F

" c. W9 d" l1 {% D  r+ n; FAlthough this trick calls the CreateFileA function, don't even expect to be
( ?$ }  S7 b; w4 {" qable to intercept it by installing a IFS hook: it will not work, no way!
$ X: B! o4 H- H  U/ C9 LIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
* ]0 {7 ^9 P' r% P) y% rservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). Q; a) v! U0 Q& U5 p+ a
and then browse the DDB list until it find the VxD and its DDB_Control_Proc1 ^+ {+ H, r5 t7 O/ w( D
field.9 w/ O  ]2 x: V* j# l9 J
In fact, its purpose is not to load/unload VxDs but only to send a / r2 I  @! l4 J! \) G1 |) |) M
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ G- A( }- _! a9 G% ^% p( _
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
0 H# I' f0 O. U' j& G2 ]) y" Tto load/unload a non-dynamically loadable driver such as SoftICE ;-).
4 {! t+ J% ^7 D) e% D* G7 @If the VxD is loaded, it will always clear eax and the Carry flag to allow$ K( G3 ~. y8 H& e
its handle to be opened and then, will be detected.- N, j. ]. Z- W
You can check that simply by hooking Winice.exe control proc entry point6 M' R$ D# ]9 `8 I4 M
while running MeltICE.+ B' t3 P# X( H+ e6 {+ Y' G
: k2 d5 p$ [8 k$ @' Y& J$ r# D, f5 U
* n8 W* I  G( ?
  00401067:  push      00402025    ; \\.\SICE
2 j2 w. W  j/ f, ~, M% G% R  0040106C:  call      CreateFileA
% F0 }' J6 i5 ~$ g! R  O9 G5 a  00401071:  cmp       eax,-001
# Y( s& M" w8 A  00401074:  je        00401091
' K) C6 q: N) x( ]1 t6 U2 U4 A! o0 Z6 F6 h- B6 J
7 I  }* Q' {9 C
There could be hundreds of BPX you could use to detect this trick.
& j+ T( u1 n: S4 {) {-The most classical one is:2 m& \% |( J% g) s, X) x  |( D
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||: P& {+ H7 _) B; x
    *(esp-&gt;4+4)=='NTIC'0 K8 z7 n2 r5 x! u
; }, |! c- k' [. c
-The most exotic ones (could be very slooooow :-(% A5 R7 V3 J8 W& p
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & ~( f# A9 J& M# F% [' _( M
     ;will break 3 times :-(/ M- K0 {' ~3 n0 u0 i, ]

  w% G; |, y8 B4 u8 a, u-or (a bit) faster:
- G% p0 ~$ m7 M9 ]   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# s! b9 K1 A+ u+ ^8 a
. n4 O9 X) U6 n( }
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  " ~! A: Y$ F" v: h% X: N. B& V% w
     ;will break 3 times :-() J/ t1 K3 O6 Y' E  e6 R8 @
9 f8 P% B, u8 x7 H
-Much faster:
& W1 u& f8 W! `, O  C3 K3 t' q( n   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
3 e- }! m& F7 z' F. o
9 y5 o7 ~. z- v7 G! ]( a. x- w! tNote also that some programs (like AZPR3.00) use de old 16-bit _lopen5 ?+ b1 W, O2 j6 x& A3 F
function to do the same job:
) q2 k/ a/ Y. c* R1 n, N' r) D  K
3 H- a4 _2 u9 v  a5 x' p. ~   push    00                        ; OF_READ7 A0 r( l, }- l- T0 S7 p8 d& v  W( |
   mov     eax,[00656634]            ; '\\.\SICE',0
/ q5 H6 o# ~7 r" d5 b& i   push    eax* g, n5 ~8 o" i% ]5 p) F
   call    KERNEL32!_lopen6 h" [+ f6 h- w" V
   inc     eax
- P6 n  B" g9 j8 Z1 T) \   jnz     00650589                  ; detected4 _5 m2 g) {- [% J' {7 j
   push    00                        ; OF_READ& J* f& Y- F- ^3 c) L/ Z. d* l
   mov     eax,[00656638]            ; '\\.\SICE'8 Y! L* @$ r2 s; [" m* H- o
   push    eax
& q& h: b/ s' _, r1 ]5 p   call    KERNEL32!_lopen
7 p! k+ p' Z( N   inc     eax
2 p. i' m: `: m& r& V! l  F   jz      006505ae                  ; not detected
. U* R# |  R4 e, B/ I/ ]$ U/ `' w: E3 i& [! l' Y& J
* r/ s% Q; c5 S7 T1 y
__________________________________________________________________________
5 ~4 j, h- C& ^8 B! c& E9 Z* p5 f8 T- x
Method 12, @3 U& d  Y9 b3 o: U
=========6 ~0 y1 b7 L, i, f8 T! Q
( ^7 m! u# {2 ?0 Y- L, d
This trick is similar to int41h/4fh Debugger installation check (code 05
' u( j4 W- x9 l&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ ?& A3 R# ^. |' s- z/ {+ \as it uses the VxDCall backdoor. This detection was found in Bleem Demo.1 _4 Y9 m, H1 Y% B9 j

# ?6 O1 |+ ?3 G( U   push  0000004fh         ; function 4fh
4 b; A% L" h3 v) H1 i$ F   push  002a002ah         ; high word specifies which VxD (VWIN32)
/ P$ [7 A" r1 l+ A8 Y                           ; low word specifies which service+ `7 g8 g! L( s4 a
                             (VWIN32_Int41Dispatch)7 @; t5 ^; e! ~  K9 i) Q* S5 e
   call  Kernel32!ORD_001  ; VxdCall
4 y' n8 W2 Y. A9 {1 t- n- N   cmp   ax, 0f386h        ; magic number returned by system debuggers- \0 ?4 k# y, F$ ~( M
   jz    SoftICE_detected/ h/ X0 w0 R# m4 v+ `' l
( X3 x" U# _( y) C9 p+ M1 l
Here again, several ways to detect it:5 u* v: Q) r3 S! ~  v
9 ]8 R6 d7 F: t8 j! a. f3 D
    BPINT 41 if ax==4f. o! d+ g+ z+ i" H" d9 e+ W

. V1 y: ]: }  b* `% Z3 m+ g4 X    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& k/ \; W" h" C, {( N2 f
. |0 v( ]. N% \& y0 p8 H
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 n  i! P- a9 |& |

0 v+ @# B* `, D4 z: D3 r    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, o: q6 @6 l! b0 `% E0 Z
+ [1 V, T* C  v- r( y* A% ~4 U4 E8 t
__________________________________________________________________________
8 d4 f6 l9 I, F8 q! b8 O
9 v# I/ k# b) MMethod 13+ Y6 V" V' e3 p0 K/ m
=========
" L( y" h1 a# }0 Q& j, K9 P. m  Y
: a* J  ]- u; zNot a real method of detection, but a good way to know if SoftICE is
0 E% _+ _3 Y& }2 ]) a! \installed on a computer and to locate its installation directory.3 v, h2 i0 O& @
It is used by few softs which access the following registry keys (usually #2) :
1 N% Z7 X9 X2 J; x/ R5 v1 ^
1 g/ i# d# n  n: i' b2 n1 Z-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- e1 ?5 K: ]: Z9 J# n2 \
\Uninstall\SoftICE  I( N# m1 [& z: S9 N
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( [1 i0 I( a: p+ z-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& r4 Q8 _9 u1 \
\App Paths\Loader32.Exe
0 z* {1 M6 h3 r- R  f
: X1 B& U9 G7 o  O2 U" f" B
' h- ], i# Z$ P0 J" H5 kNote that some nasty apps could then erase all files from SoftICE directory
! j" u/ m( f, @(I faced that once :-(
" y8 \; a3 K2 i7 `% ?. R7 ?) y6 z4 C- F6 V1 D8 G* W
Useful breakpoint to detect it:
9 ?% v4 U6 b1 Q( v7 F  R2 |$ q5 ^$ ~1 l& u
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  s8 E. R% X6 X2 w% z  s. {

- p! K: v5 C4 y" s( u# Y__________________________________________________________________________
  i, B$ m* Y$ a3 ~1 r- r* i/ Y
: h; D5 C( f5 b2 Q) l; W
/ q) O% s5 M( p" YMethod 14 5 F. O2 P- K' p9 n9 l9 X1 [
=========4 j# F# @! R8 p5 y: h

' z- [7 ?$ A; n9 {# WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 D: I( _# o; G( k: u5 eis to determines whether a debugger is running on your system (ring0 only).& b  D# v5 V0 }8 f# b$ E  J! S- f
  C  n, U% k2 `3 m% c1 G, C
   VMMCall Test_Debug_Installed% z2 ~9 O# P+ u2 p, S) A+ k
   je      not_installed9 U' f( i' O2 H. N
9 T. s# o9 Y# n9 c0 r" s
This service just checks a flag.6 K1 J2 g+ Z0 e
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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