About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  [" q8 ^4 B) ^  q' z<TBODY>
7 b5 P  I, \" S& |<TR>; E9 d3 w, {  ]1 q. u7 H
<TD><PRE>Method 01
2 b7 F' ^$ J  Z0 l& v3 d1 [' S=========3 v# E  d- c5 ]; T* i( q$ J: E
# |, L+ F" i1 e  f$ J9 f* U# `
This method of detection of SoftICE (as well as the following one) is
; G7 Z& \# ^# v! s- a7 aused by the majority of packers/encryptors found on Internet.
" i% [) O& N: o2 t0 j5 g) iIt seeks the signature of BoundsChecker in SoftICE, e3 s& N, ?* z/ x! E
3 X8 _% Q+ |. ?5 B8 q: N! D
    mov     ebp, 04243484Bh        ; 'BCHK', G2 M- Z: ?6 k: ]
    mov     ax, 04h
+ n0 k$ M8 u; Z. p, R1 P% P    int     3      
! s+ Y6 q" H0 K( j' ~/ Y1 S& n    cmp     al,42 b2 M  c1 v; t/ s
    jnz     SoftICE_Detected
) ~% n9 b7 Y/ t" A2 B
- n, g& A+ P( K6 ^/ y___________________________________________________________________________% F2 F2 f* t" E% f
$ H1 z* Z/ S5 k+ H1 r/ d. a
Method 02
  A1 ~/ G' d( X2 p2 u, d! e=========0 r4 }0 h* i; c+ d+ z; G( S

' K5 k/ B/ a  j+ _  FStill a method very much used (perhaps the most frequent one).  It is used
- G6 f( M+ G! y0 R& `& g% Lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ f8 h1 W. H5 T5 t8 vor execute SoftICE commands...
4 q( D; U' K& s: N% QIt is also used to crash SoftICE and to force it to execute any commands: g: p# L: Z( N0 J
(HBOOT...) :-((  % L2 t2 i: x3 B* L! z8 _
- Q/ r2 b5 D4 a% c1 b4 d$ R
Here is a quick description:
1 H- _6 a% K) N" y-AX = 0910h   (Display string in SIce windows)
+ [6 c* _" c8 `5 O) b2 E-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% Q3 d% j8 q% V8 U, P
-AX = 0912h   (Get breakpoint infos)1 [$ I) {1 {* u4 m4 z7 C
-AX = 0913h   (Set Sice breakpoints), d8 L1 I1 D7 m; X5 r
-AX = 0914h   (Remove SIce breakoints)
; l! C; i8 B1 Q4 g, d+ U8 y+ {0 g- b7 o1 E9 \( j4 ^
Each time you'll meet this trick, you'll see:
( \* H! Q. k& h* w-SI = 4647h. J$ \6 q. m: F. Z  t. ]" s9 \
-DI = 4A4Dh8 m" G% \& D# ~9 R7 Y* `6 l( |) ~
Which are the 'magic values' used by SoftIce.
- w: m, m) \% d% w' \$ k. w; tFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ B" Y) |  d2 j! M7 O! d
& C: E2 p: B( |. v
Here is one example from the file "Haspinst.exe" which is the dongle HASP1 O+ ]9 c. r+ G' {
Envelope utility use to protect DOS applications:
8 b1 p& v) J7 a1 m8 w0 e
( X& h: Y) u& E7 [. q4 ?. {
: d/ M4 v7 \. B0 R7 ^& [4C19:0095   MOV    AX,0911  ; execute command.
% j: Z3 k" F0 o& ~4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
$ V' U) j. T2 r& O4C19:009A   MOV    SI,4647  ; 1st magic value.
0 E1 n# v2 [8 `/ y8 i! Q, d4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! ?' w+ B( O* l" c
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# B8 {, r+ M( N. e# n. n# ?
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! T; e/ V8 V3 U7 y$ Y! R
4C19:00A4   INC    CX, J: Z! B; L# T. e- {0 H9 j7 A
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
5 v6 C* V7 b- F1 m4C19:00A8   JB     0095     ; 6 different commands.; x3 y( |+ c1 }
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
" s% M: b8 W$ l) U/ }: L4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)) V9 T  U$ J4 H8 f, P# q% J0 @' ?

" D1 C6 n! x/ I- _The program will execute 6 different SIce commands located at ds:dx, which
1 W2 C! n" V! A# B* ~: @are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
$ c8 i( Z' S- G$ ~9 b7 d  Y+ I. O1 Y+ V4 w% ^# u
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.0 e# W  P, j. K
___________________________________________________________________________# J# p2 u! D( V5 e- I" M0 I" R& q
8 M  B9 U) X6 A) r# y4 u5 F# H
* f) ^1 e) U' b: W6 t$ D7 a# I# ^
Method 03
* b0 j( k/ {' b9 m4 H=========
% p. C4 x) D, A! N) J1 a* Y0 ]
9 d  n  f6 z1 ~Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, [) q  u# V* V0 ^
(API Get entry point)
( b; y1 P" y1 b# a5 O3 N        
3 D) w; x' |1 n3 t; Z1 z" t8 n2 t0 r
    xor     di,di& N! |3 H7 p! ~* G, r( i
    mov     es,di
+ ~# F) ]5 {9 a8 U    mov     ax, 1684h       ) L- a5 g' \2 `0 b6 U# Q+ `8 T& h
    mov     bx, 0202h       ; VxD ID of winice& ~& [, f7 H$ D2 a) b, Q2 F1 Y& q. R8 Z
    int     2Fh  t( q8 F  P* j7 [4 W8 G! U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; W; x* C% L9 d0 X
    add     ax, di/ d9 }: Y. Q5 U; w" F8 _+ S2 t
    test    ax,ax0 P! Q! y+ P* l( I5 A
    jnz     SoftICE_Detected
8 }5 J8 i- t  {5 X& S1 B! ~5 V  e' N% C$ V9 v
___________________________________________________________________________
% W7 L. B! U( n- V* B( n; x( Q. ~( W& m+ ]- f0 Y$ k- j
Method 04
, |- J( S* |4 I" b& [1 O+ |& D=========+ g) l. M/ \8 v2 g$ u& W
  h1 G! L! J* l+ f5 q' n, y
Method identical to the preceding one except that it seeks the ID of SoftICE$ j+ `3 O6 E) \( d- v- N
GFX VxD.
( U% v: s( D& T# ]1 A
! m4 x7 j0 f2 `% I5 X    xor     di,di
# j  W4 C3 k9 |" t) l4 `    mov     es,di
# H3 Q( i/ d0 J) y8 g% X    mov     ax, 1684h       " m& k' W$ y+ M, s5 v( X
    mov     bx, 7a5Fh       ; VxD ID of SIWVID; H7 P" D( I' i0 g9 C; N
    int     2fh+ \) L; y3 ^# ?( U% D8 A, X& F
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! N# e4 ], i" l! r6 e5 k    add     ax, di+ ^. n2 X8 v& z7 U2 H# H
    test    ax,ax
6 L. i% `* C7 X7 W; w  F. ?    jnz     SoftICE_Detected
" h, N+ \4 H" ]5 ?, I2 R: @2 [" r3 V6 ~$ s4 }) I' ~4 M* n3 b' ~
__________________________________________________________________________
3 ?4 ^3 j, Q9 A* p' H+ z, t* D. d+ d- |$ h; x

( _) j, }2 Y+ M0 G  r% g6 VMethod 05
* f$ O8 M0 c0 q  s& a. V' b=========
/ W+ ]( |% [6 ]% B
- r4 c; A# u' zMethod seeking the 'magic number' 0F386h returned (in ax) by all system/ Q, G& I" A( Y5 L
debugger. It calls the int 41h, function 4Fh.
+ W  p" q6 C0 N: MThere are several alternatives.  ( y6 E- O+ O( g0 h+ o$ p! C
9 @% B# v' l: l$ q: v
The following one is the simplest:
) G' Z. M* B  g$ h8 h
8 p3 ^- L% L* X7 u! h    mov     ax,4fh
  M$ |+ C2 _, @6 A# Y' X    int     41h
- Y0 M" ~( L% \0 V7 W    cmp     ax, 0F3864 f3 h9 {' b7 E4 `' w
    jz      SoftICE_detected
9 H- X1 Y  q* X5 C, G8 A( L1 B9 D) n! Z1 S/ L! u  L( T  I! l5 i

5 H# \. d  s- `( B& N% ^Next method as well as the following one are 2 examples from Stone's
: r% `$ R# W$ H5 |" m"stn-wid.zip" (www.cracking.net):7 z: [, U/ E4 k  W: Q

1 Y. Z# B; t% i/ ~' q    mov     bx, cs, {7 j( j9 V: R6 k( j5 k! R! e# T
    lea     dx, int41handler22 A6 Q* N  E* h$ ]
    xchg    dx, es:[41h*4]
; a& A; s7 }0 x6 F5 [3 E1 X7 O    xchg    bx, es:[41h*4+2]
. g9 R2 Y8 _% Y5 e    mov     ax,4fh( V( p9 m; C& B4 `' R* X( d$ S
    int     41h
6 B' x' O& ]; R( h    xchg    dx, es:[41h*4]+ K+ P+ ?8 l& l0 b7 c" \9 d
    xchg    bx, es:[41h*4+2]
3 O; j- X/ o" n) _, @/ S    cmp     ax, 0f386h
# `$ Z! y4 Q2 p) G$ I    jz      SoftICE_detected/ \' ^9 o0 B) |# Y2 l' z

$ Z- I0 ?: s$ H; J" m# D- B/ gint41handler2 PROC
6 V! z* ^# Z# ?# `9 }- \    iret; m, P3 V- t" z8 e+ F
int41handler2 ENDP: X2 y5 ]8 Y* _5 m$ i9 x/ g! \  t5 K% A
& G# B  x! t/ h
& P( s# {3 `& ~+ Z7 ]
_________________________________________________________________________
6 a3 j* J0 u3 x4 P' h% c1 ~# l. C' R
# F( r3 I7 b% q' O$ z( d/ C
Method 06: t' z" ]$ w( Q& j& W5 |5 h4 E. r  E: k
=========
. l) k* r% ~- [/ Y" s  M* z: m3 _% t/ Y/ P" @

# |: y+ A" X6 H- V4 w; N2nd method similar to the preceding one but more difficult to detect:
8 w+ m% f% W- B$ M% {$ A5 S
6 ^& @+ T! N1 w( b
7 _2 t( H# j% r" ~9 I# u2 Kint41handler PROC( @8 a, n% Y" `
    mov     cl,al
. y0 g: D) l( J. n3 N) C    iret1 M2 p! b3 }5 O1 a8 v/ s
int41handler ENDP2 W! k5 ~0 s; M1 D  R/ M# D  ]

# X6 f( r: Y" j3 m& j1 v
# c  s+ N9 V; E4 \    xor     ax,ax: e7 T6 D- ~9 K. N- ]
    mov     es,ax
! e: A% Q7 x' F) b$ P: p& }    mov     bx, cs8 x+ H/ q' }; U' K+ V& G  Y- z
    lea     dx, int41handler0 ?) i6 ?$ W* T) A
    xchg    dx, es:[41h*4]% M+ E' t& S- z  l& X1 }/ |
    xchg    bx, es:[41h*4+2]
6 u' O: n7 h/ |    in      al, 40h3 p( n0 O9 y1 Y
    xor     cx,cx
: Z* R1 t* e/ x7 s: T- d3 S* A    int     41h; A' @9 |3 g% N2 ]
    xchg    dx, es:[41h*4]! p) Y, ~% s+ C
    xchg    bx, es:[41h*4+2]; ]3 E' m5 D9 u4 ?+ ^- Z6 W! I
    cmp     cl,al
* o  _+ _  I: O    jnz     SoftICE_detected
" L# g# e; m5 a$ y8 b
# b5 c9 M( d) y$ E_________________________________________________________________________
% j: y! w0 [, }, J
/ J, l9 ?" S8 [7 {- |; f! @Method 07' `- M. j/ v) ^) i$ ]8 T
=========- v5 J9 {2 z  ?
1 R7 o, H2 E7 o4 ?# [, W2 C& P
Method of detection of the WinICE handler in the int68h (V86)
% p8 |1 |# ]7 n% [% S3 u' Q1 T; H6 s- ]: S9 ?) `; L) N
    mov     ah,43h
0 ]5 D3 a0 Y1 q: }, @8 ]    int     68h7 Y6 n$ {+ U/ V
    cmp     ax,0F386h6 l# T* {4 K2 e, E# _& U) J/ Y8 I
    jz      SoftICE_Detected
  v9 n# M( o9 ~2 w- G4 t  D% n$ Q2 W/ Y# C6 l8 x
! F9 t5 k" @1 a
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 F0 l# ~; X. S* D' X* h9 q& J   app like this:
5 W$ A* g% n! X7 J- \+ V
8 m9 r  Z5 _) Z# Y" o' F   BPX exec_int if ax==688 @& X# D7 ^  P2 m% z
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& T% T5 a. _% F# M# X' K2 D' [   located at [ebp+48h] for 32Bit apps)
0 L7 @0 r, p& h: B__________________________________________________________________________
$ k2 e6 D0 d1 R- z0 r& z! g3 x8 O" ?$ ~" _3 r6 o
8 w2 d( [; _( a( ^
Method 08
3 c; V+ R1 S' P% K  q& Z=========3 E% l% }, P$ |9 l4 q  v  T  O  d6 y
9 A/ E, E$ H+ B  a$ q5 `3 F+ |
It is not a method of detection of SoftICE but a possibility to crash the8 i' j: q! M0 m- t. g
system by intercepting int 01h and int 03h and redirecting them to another
3 W- d$ b* V' c. J& |8 T2 Aroutine.* S: }2 G+ E: w) S5 s
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points  \4 D8 g4 w, Z$ ]! m/ R
to the new routine to execute (hangs computer...)1 A; Q, [# G  g. U: ?
1 N4 L$ J& e8 N/ U9 _7 y8 y
    mov     ah, 25h
- }2 _- |$ w1 R( z4 _5 ?  v$ j    mov     al, Int_Number (01h or 03h)
! r! U% x, S1 s9 F4 f( @    mov     dx, offset New_Int_Routine
( y( C( @3 {$ J    int     21h
+ z4 x) f% ~; D4 P# K( x& L6 B5 Q/ _6 O  H4 _, l
__________________________________________________________________________
* h( J8 c2 s7 d2 G; j5 r! U% i# G: K7 z' J- G' \+ z# z
Method 09* z/ p; q5 G, T% H$ I
=========
/ D: U3 R  h* R9 k% R' Y% m4 h* m  {6 e
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# R! u" u7 k5 i$ a# Yperformed in ring0 (VxD or a ring3 app using the VxdCall).' e! o# D% N7 t6 f
The Get_DDB service is used to determine whether or not a VxD is installed
* o' K* O( ?! _4 ?for the specified device and returns a Device Description Block (in ecx) for
" _1 z4 E' H4 Q8 S8 }& X6 Pthat device if it is installed.
% Y0 x' Y) D9 a% c
" |4 X1 ]! r6 B   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID' d4 s+ P% X& y) ?, K/ I
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)5 X& F- Z5 R9 A; H, m; o
   VMMCall Get_DDB
. u# t2 x) M/ \8 F   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed0 Q5 P* K  M: ^/ L; W% r

$ m) {, I  @: f' \% BNote as well that you can easily detect this method with SoftICE:5 L. W& s; x3 }  V
   bpx Get_DDB if ax==0202 || ax==7a5fh! L! R; X7 i% p. }% A4 N/ X4 F

  B; _: @* H4 \3 E* A* \- z__________________________________________________________________________5 Y% z( ^0 K, L& G1 K0 ?

3 E& r" w* W+ L' BMethod 104 {6 [, ^7 V2 A! L& m: G5 \& f
=========
: _0 L. B0 Z5 X# n* J% a' Q2 b' q, M4 f4 V0 Y! y
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
7 B# }! O  ^7 }- D) h" ~  SoftICE while the option is enable!!5 x: i/ [" ]7 b0 n* A& T

* r' s5 w* t( k% A) `3 EThis trick is very efficient:( r7 Y6 c* d1 D0 P3 ]4 T3 j/ A. E
by checking the Debug Registers, you can detect if SoftICE is loaded
8 ?, Y* A2 s& Q8 `6 A0 ~, ](dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if+ ^0 v2 n6 p; Z5 O! c
there are some memory breakpoints set (dr0 to dr3) simply by reading their! ~. L- E: Z, l  |3 @. w- d( B
value (in ring0 only). Values can be manipulated and or changed as well! q5 W: W! R; X' o& v
(clearing BPMs for instance)
0 R  B! s/ k( v6 j7 z, m( ~3 R! n  P: L! j  M
__________________________________________________________________________
! o2 S, Q& I' k& V, d" J" c/ u9 n, ?7 S0 l' }% a* ~
Method 114 ]; m% [1 ]3 _0 t! s
=========
# O) s+ ?  h3 H7 X+ ^) q5 f- y4 Q1 |, ?. \" L) @5 q3 q* U
This method is most known as 'MeltICE' because it has been freely distributed
' ^" w7 n$ y9 zvia www.winfiles.com. However it was first used by NuMega people to allow; U9 V4 V0 u* j
Symbol Loader to check if SoftICE was active or not (the code is located
/ z( e, b! c/ yinside nmtrans.dll)./ Y* `7 d/ K$ f  c( T
8 z2 o) B8 e/ R" \0 A$ V+ ^
The way it works is very simple:" @3 r/ f8 G9 X" b; u! y$ g- z/ k
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for0 Q* d9 {) N" }/ \9 M
WinNT) with the CreateFileA API.
$ n: {5 R( O" ?& P3 j! v" H. ^  F& ^; A, r+ s; H% q
Here is a sample (checking for 'SICE'):8 F3 o8 X3 F$ o( x: z

$ g% j% ^7 e% c& V8 ~' B+ e$ `& iBOOL IsSoftIce95Loaded()
# ^0 X8 r/ O6 y, Q$ c) J3 V{3 @8 O: X, b7 t( O, v9 G) |1 R
   HANDLE hFile;  + d6 n" R( @8 ^& H! ]& g  k
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 S: k% w8 Q& c1 V. T+ w: v                      FILE_SHARE_READ | FILE_SHARE_WRITE,
7 f1 c( Y- W; }5 T                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);/ A0 G/ g  s4 Z, J+ v( t
   if( hFile != INVALID_HANDLE_VALUE )$ R5 `* W$ J+ J; P4 G
   {4 }3 N2 k6 a9 K  A$ ?2 ?1 J
      CloseHandle(hFile);, M' q1 t: }' @0 \* Z! _( _; V9 V
      return TRUE;
$ ^+ [; _7 m7 I: K   }
/ L# r% D0 X4 u# O) W# U) h5 `) q   return FALSE;
7 k9 L( d5 _$ r; @; K1 z}
) |$ \6 o/ `& N% A
  Y1 b& q3 J& }5 o! a3 QAlthough this trick calls the CreateFileA function, don't even expect to be
% M# I! }' @8 |6 G3 w8 Iable to intercept it by installing a IFS hook: it will not work, no way!
. C7 l1 N0 e% y7 G$ _1 p# MIn fact, after the call to CreateFileA it will get through VWIN32 0x001F2 |. B" e6 j1 A3 Y  J, ?
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 [5 Y( [: T' ?and then browse the DDB list until it find the VxD and its DDB_Control_Proc
; l( u! b+ c* l; L0 g# Wfield.
: I# u4 q2 ~$ q. N4 ]In fact, its purpose is not to load/unload VxDs but only to send a
8 g) D; @8 b% ?W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
& Z9 ^8 f0 t  z6 C2 _1 ~/ c) vto the VxD Control_Dispatch proc (how the hell a shareware soft could try8 r0 c8 M8 Z* W* @6 Y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
) K$ d3 _3 J& x4 U$ W5 U# _, U* LIf the VxD is loaded, it will always clear eax and the Carry flag to allow
9 Z2 S1 m; N# r+ iits handle to be opened and then, will be detected.1 J% N8 p. {5 T
You can check that simply by hooking Winice.exe control proc entry point  B) q& i% ^9 _
while running MeltICE.
* V! Q! b+ n6 Z1 h  O# s
6 m( d6 g7 a( B, X( {) c$ l5 o( E+ |
  00401067:  push      00402025    ; \\.\SICE7 u6 Q& P5 Z( \' k
  0040106C:  call      CreateFileA
: D2 |% P& T( S2 U  F2 Z* v  00401071:  cmp       eax,-001
8 [$ u( z- n; ~  00401074:  je        00401091! Y( n+ G6 z6 v2 n$ _% \

+ Y7 a2 l$ x; I( T2 O( J: G* q, Q2 P; y6 Y: g6 s
There could be hundreds of BPX you could use to detect this trick.
/ f1 G% q4 a# A0 K( Z9 I-The most classical one is:  \7 e4 y, o2 z
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 y/ b- G4 D# F# y" z% K
    *(esp-&gt;4+4)=='NTIC'
* {  u; v( l3 d' d
4 O( H) g$ t0 z4 a( f, ]/ o  I-The most exotic ones (could be very slooooow :-(3 j1 F( V: K# y( Q9 c
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " O* \  S" ^9 ]2 ^1 |
     ;will break 3 times :-(
- E: S$ Y, R6 a7 q' a' X
2 m6 g. r3 B$ E/ _- ?2 H! I-or (a bit) faster:
) r, s. w; @$ M8 t% m   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
& ]2 |! P' C$ z6 ^6 j) J% x9 u% t, ]" y2 P" B0 w3 W
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  * p8 z/ i: h- V1 P5 V
     ;will break 3 times :-(
; s: n( B1 ~) g5 u( d3 ^% P: \1 \4 R# Y- ?
-Much faster:; R8 I: i) m6 @5 ]
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 K. Y: d# ^3 e* m6 R5 B8 y' ?
; t  o' q. A9 [( u# d; L
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen  x" M, t" q& X
function to do the same job:
6 M* S9 I' C7 H" L* m( J* T8 C8 s/ o8 Z/ C% J" Y% N
   push    00                        ; OF_READ
7 |* [- ?( V- `3 \   mov     eax,[00656634]            ; '\\.\SICE',0" c9 ~) p& ?; C+ H
   push    eax) m! R- f9 u  n6 R/ A7 j- s
   call    KERNEL32!_lopen
/ {0 Q( {) \* z, S9 R& N% Q4 {9 W8 K   inc     eax& O8 n! ^, Y  R( |: a; P
   jnz     00650589                  ; detected
6 n/ s5 Q' C3 c' ]: i' O   push    00                        ; OF_READ
: J! y; I) |. l. S& ~   mov     eax,[00656638]            ; '\\.\SICE'
8 w) g$ D: j+ S( R0 g   push    eax9 @+ v. J9 t; P8 I0 M9 Z' D
   call    KERNEL32!_lopen* x; M0 e: q' P; a8 w+ I
   inc     eax
% r3 {0 E3 ?# S- t6 h2 n   jz      006505ae                  ; not detected& C! U8 S( h4 I3 c) u: U; f# _

2 ?6 B# ?" o1 H+ g
+ d' R( h5 j3 W: U__________________________________________________________________________+ E+ e8 ?3 F* K+ l5 ?
* u3 t$ e& @& f# M, j3 A
Method 12" `! N( J# ^4 Q9 [" S: E  @
=========; i' e, r5 N+ V  `

2 H" N- j( A) Q$ G5 U$ xThis trick is similar to int41h/4fh Debugger installation check (code 05, [, d: R* V2 e5 W. o' d! [6 V$ ?5 J
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, d" `9 q5 |% X7 qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: o; k' k7 Y; Q( f) J1 x7 w8 q, z7 A
   push  0000004fh         ; function 4fh
/ o6 L! s4 ^0 f0 m$ B   push  002a002ah         ; high word specifies which VxD (VWIN32)% c. i) Z4 @, k) m/ }
                           ; low word specifies which service+ H# B& \9 ]0 z% S/ g+ b+ G$ @
                             (VWIN32_Int41Dispatch)
) e7 x  j0 y$ ?   call  Kernel32!ORD_001  ; VxdCall
. Q7 K/ T8 [8 l# Q0 y1 d1 h- d   cmp   ax, 0f386h        ; magic number returned by system debuggers
' ^0 V. B9 R" h4 U" x" x! x% b   jz    SoftICE_detected
0 ?8 D: h, P  f+ p0 ]  Z4 L
' h" S* N% J& c3 ~: WHere again, several ways to detect it:( [4 d: h2 [4 M# m+ x, ?
2 w1 f. i/ M7 c9 m
    BPINT 41 if ax==4f8 g, N5 k$ O8 F# x( M+ _8 `/ u# h7 s

: d( _& k6 B& }4 ?    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
* M& L8 i+ T, S! p2 `2 H/ m
2 p; S$ u  i, }" }    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" i, L+ \3 {, Z1 l. {7 C6 K8 L( p

  Q$ S  v3 J+ ]. Z" v    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!; ?; p. Z" Q! o0 s" A, h. `$ D6 F

; w4 D4 w, l; W8 a__________________________________________________________________________% a; i+ y6 i; |+ _) U& n

4 ]" w) @% S! vMethod 13
0 x# A3 H! I; e=========" v" c: s9 p1 y7 Q5 H

( v" v1 M% E. H0 A! d8 O4 gNot a real method of detection, but a good way to know if SoftICE is' ^  L4 ^5 B) j* t& v' R% c, T0 V1 e
installed on a computer and to locate its installation directory., Y+ l; d% y& @# a
It is used by few softs which access the following registry keys (usually #2) :0 B5 j, p# K/ j

/ w& t+ ]3 ~0 m- @' N7 g$ ]-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 n1 M2 C3 _9 t; \, b\Uninstall\SoftICE
% l) F" ]1 Z% h) \/ k% ~( }-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& x: X) B0 X& e5 @-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' _: Q6 Y8 e. y\App Paths\Loader32.Exe" \$ @' c% k9 S3 V' b

/ ^* S. }" e" b3 w# o+ x; v1 |' S! ~! o; m
Note that some nasty apps could then erase all files from SoftICE directory: w% M+ P; L$ e0 p% n+ Z
(I faced that once :-(
3 W. c$ t& F7 U0 A3 C6 F. G7 d! ^2 p( }# d7 f8 g4 f
Useful breakpoint to detect it:! ]) @; x( [$ o; h1 ^

, |# u5 m! f/ m% ]     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ i$ [/ R& s. v5 L% D( J" p* _/ H  S% D: L
__________________________________________________________________________1 v, f3 x8 o: l8 A$ L6 q
9 R% P2 }! H4 w( }3 K

- G% V" R7 s( pMethod 14 ) D: K4 d9 ]9 }' [" ]. T5 E7 ]4 W' m
=========. w& t, I' ?. C  U: _, e+ W: ]

2 p! ^# k& |) C6 c: x7 NA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 g$ U4 ^/ A& z0 q" T' W: v, `7 i1 Jis to determines whether a debugger is running on your system (ring0 only).
0 [+ E. D& v: |9 G" q
! u7 P3 `2 b: i* x6 J* v   VMMCall Test_Debug_Installed& `4 O' G+ z5 U: N1 q: I
   je      not_installed
0 }5 k0 y9 C. c7 t4 H
" a  `& y- J, `- }8 nThis service just checks a flag.
: w6 S. p. ?; \, Y' p" |! D</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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