About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
6 r. A. o/ K% }2 b* {% v<TBODY>
- b3 i& c* ^7 V- H: q: S5 g2 |/ R, S<TR>: x" Z! h, v$ ~& n; ?. J+ z
<TD><PRE>Method 01 + ~! |) o! X* U& C& h0 m
=========
$ O  U# [$ _* k) s: E4 F/ h+ ^$ D* J; s8 s
This method of detection of SoftICE (as well as the following one) is
" u6 K: i: r  vused by the majority of packers/encryptors found on Internet.8 A, M, a( K) W' r* v
It seeks the signature of BoundsChecker in SoftICE6 y$ ^8 s0 |) I6 `) I4 m4 f

% }3 P* j8 H9 p8 h1 l5 ]    mov     ebp, 04243484Bh        ; 'BCHK'2 a3 M' [/ \1 c" J
    mov     ax, 04h
" `1 `9 q1 B! R- X" C8 n' E) a    int     3       & b+ }: J: ]- W# r7 O5 Q
    cmp     al,4
4 N( u: K# H% r- P8 N/ z. t! K    jnz     SoftICE_Detected6 i6 X- }2 G3 p) v0 O4 d
& A* M7 ?1 ?% B9 b) I' X
___________________________________________________________________________  h3 E9 n) B* R- _( l
$ s5 N5 ~: R$ n( }
Method 02; [2 X. m/ H+ W8 u4 d
=========4 T( P' j; S( Y

$ B9 L7 R* Q2 ^5 ?, PStill a method very much used (perhaps the most frequent one).  It is used
1 E) ~9 |  {: W0 ?# ?; _( Sto get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 T9 D/ V0 h1 t5 \
or execute SoftICE commands...
" G2 l' X: W: E# Y8 K7 xIt is also used to crash SoftICE and to force it to execute any commands8 g0 Y' V& {7 v, G) \+ F- P+ E
(HBOOT...) :-((  & O1 @& @* m! K

% F3 _5 R# |3 j$ M% U0 kHere is a quick description:
) S6 J$ J5 [: y, g-AX = 0910h   (Display string in SIce windows)
1 K; m- K8 A0 x. C7 c' I4 {- |-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx). A# z# N  d, A6 J/ X
-AX = 0912h   (Get breakpoint infos)
2 I! q  w2 e- f( Y" U  j-AX = 0913h   (Set Sice breakpoints)1 s5 w9 k: l1 f9 {! _" q: x
-AX = 0914h   (Remove SIce breakoints)$ Y1 c+ C/ q. J- N: e/ f

9 U% Q; E  N) r- F1 uEach time you'll meet this trick, you'll see:6 B  ~( K& X% E# ~+ A: ?
-SI = 4647h3 M  t% q7 g' `, }. b, D$ T: k
-DI = 4A4Dh7 n6 R( L; s! s9 c
Which are the 'magic values' used by SoftIce.) t+ A1 C( I' J! E5 d3 R' B  @
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
7 f+ b. |; F5 n/ ~4 h$ @* }
) y9 j5 k  L/ AHere is one example from the file "Haspinst.exe" which is the dongle HASP5 P: [- x6 F1 {& p
Envelope utility use to protect DOS applications:" g' k+ x2 x2 Y8 q% L

& A" {! S+ U: b9 B7 I2 o1 T: U
6 c. n; y9 b+ b' S/ |8 l7 v- K' t4C19:0095   MOV    AX,0911  ; execute command.
5 |" j4 Y1 ^( d5 t$ r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).0 O  {5 t/ J, Q9 Y( J! c# S4 {- C
4C19:009A   MOV    SI,4647  ; 1st magic value.
# k, R. r/ q! j/ Q* `4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! p2 d% @, u$ }$ I# H
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 |' o) U" O  n! Q
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute0 {* B6 O9 B6 s# G1 d- J
4C19:00A4   INC    CX- d* I4 Z' f5 }! P6 R! d& o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute  l8 v4 H+ L# y/ V! V7 j
4C19:00A8   JB     0095     ; 6 different commands.
( J- I3 }$ r& M, M' N5 s4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ z4 |; H3 |3 s6 r- ]$ m
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- ~4 T$ h: w) e9 C8 Y$ ^2 |+ e7 J" J# n# g2 f; Z6 E) J
The program will execute 6 different SIce commands located at ds:dx, which2 X4 v- ]" s: Q7 v
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, [, W* f, M- y) t) Y
1 x  ~3 Y: `7 w/ j* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 [5 w# f( e. k( P
___________________________________________________________________________
$ m  e$ E9 \$ v" A3 |
4 G! C$ J. x7 \- e( d8 c: A. ~, E6 F, I
Method 032 q  q' n$ b4 K7 `
=========" Z- R5 b9 i0 P# _" n; m" j

2 U3 e1 g  g1 v8 cLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. J0 `& S8 \( g
(API Get entry point)
' g( ?0 k. e8 N3 |( w1 x5 q6 I        
; Y+ ~! T0 a; i. E# O+ |" e: j+ F3 }: G& X, s7 p( X5 C% Z3 F
    xor     di,di
. o' s" s1 |4 V. s9 V( G9 J) ~5 T  W    mov     es,di! `# {& ^3 Y' d6 I
    mov     ax, 1684h      
  H; I9 Q( Y2 f) z  h+ y0 z( M    mov     bx, 0202h       ; VxD ID of winice$ t% J  |7 G" Q( [9 u
    int     2Fh
; ]* J# [! E. `, k* s' l    mov     ax, es          ; ES:DI -&gt; VxD API entry point# O* L, k6 t1 X  \( C
    add     ax, di  i2 A* f( P. A3 c
    test    ax,ax" r3 r7 k+ y( W5 k
    jnz     SoftICE_Detected+ t& {; H4 C( [- ~% H
! {0 V' Q9 s0 l3 b9 i
___________________________________________________________________________5 j4 g/ ?) S0 n: H/ @  q
* Z* F- J( A; _! }
Method 047 W+ A$ @; l9 ?' N
=========$ H: k6 X" Y2 H; x# \0 ~, C% V

) m, Q0 T0 t+ _# C  WMethod identical to the preceding one except that it seeks the ID of SoftICE5 x! u6 |# `  }: D2 z
GFX VxD.
  I3 D! C* ~) `; j3 ^0 F; N2 Q6 B6 l2 J
    xor     di,di4 u  R: @$ ]+ e; M& E! T& ?7 d
    mov     es,di
4 |4 p; B2 n& ]0 b2 G- c    mov     ax, 1684h      
; U! \  E3 G! s# x    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 z$ ~: K  y2 I5 p* p
    int     2fh9 v4 D) i7 s  f) P. k4 }, A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% [" g  ^% X5 F- \2 H( F8 B6 o
    add     ax, di
( ^% T, D6 k2 ]/ Z) |' T; i, m    test    ax,ax2 t) o% m% @: ^
    jnz     SoftICE_Detected
& ^6 Q5 z* t; T: [: O
% _  ?  T0 L8 a0 y__________________________________________________________________________  g% H3 Y; x% Y3 |

1 y" D2 W! ?" R2 ], d8 j7 A; O4 `5 f# C% o
Method 05
* Z: {8 U8 q" v=========
$ ]( O$ _6 I/ Q: ~1 r& ?; O6 Z
: N" N& s. W' o  P5 [% ]5 n9 Z3 C/ J& bMethod seeking the 'magic number' 0F386h returned (in ax) by all system7 L/ S9 F  @! k9 c9 T' z
debugger. It calls the int 41h, function 4Fh.
7 U  T( l4 f  `) ~/ r# L6 r! `There are several alternatives.  ) \/ t% E. t4 Y5 U5 ]

8 I: C( x4 E: ^The following one is the simplest:
1 A# {( B( s7 X0 _0 ^8 l; G# d" \( {' X$ C* _" h3 K
    mov     ax,4fh
3 e. R1 R# O# j7 `2 ^; r    int     41h5 n6 c' [1 }7 C
    cmp     ax, 0F386# M9 _" [( \( R/ U9 m; ]8 d
    jz      SoftICE_detected; @  Y9 j6 {1 ?1 \. N
" W! ?; ^4 ]8 \) P. w
: D) |  e8 a3 y6 ~/ I, n1 y
Next method as well as the following one are 2 examples from Stone's 4 f% F% }0 z6 ~7 P& x. g
"stn-wid.zip" (www.cracking.net):
- G( N% O( a( h) E* v  w$ m0 w" z5 {
    mov     bx, cs1 Z% e7 t+ o4 ^. n, l1 k
    lea     dx, int41handler25 r0 J) F9 T1 D% P  r6 r
    xchg    dx, es:[41h*4]1 o& q( `2 k- `
    xchg    bx, es:[41h*4+2]
0 W: v7 [7 X$ l9 r  }7 X    mov     ax,4fh
- i5 b" t- ?2 b+ j# B5 K    int     41h8 \. I) h, a- e1 E
    xchg    dx, es:[41h*4]
% j$ C) J8 \* o( U7 A9 _" b* ]    xchg    bx, es:[41h*4+2]1 M( t* E, e2 v0 R* z# [1 j
    cmp     ax, 0f386h6 h% S' c  F. @. b" Q  D
    jz      SoftICE_detected
& I2 J, {, {; E1 x0 l/ d9 \- `7 [, Q; c: ?  i" x5 S
int41handler2 PROC
6 L3 G6 X6 e2 r4 R( P    iret+ P$ s8 ^0 S7 H5 @4 @0 T: M4 l$ Q. O
int41handler2 ENDP! S4 ?0 @( q0 b8 n; y6 J* V
* v* s8 t; l5 Q' }
  N+ f# ^9 l6 d7 G2 r) }
_________________________________________________________________________. t" m- o$ t( P) Q0 ~( `

% Q& j9 e$ ], ]0 T2 i$ N/ d' r6 j$ w5 x5 }) Y$ R
Method 06
- R0 Z# `8 J+ O, h# \4 ^( E8 P=========) T6 J/ L& b( L

3 o! \) ]0 O) H8 o/ }0 n. Z  d% W  N5 u: \3 }
2nd method similar to the preceding one but more difficult to detect:6 h# n7 N$ r( p9 I: ?8 T' D/ S

$ V) a- V! x: D, ~: d/ U% D- X. C& x$ ]) I; I6 v
int41handler PROC
  ~  k. F7 @2 x1 X4 q' Q    mov     cl,al1 a9 x4 E, R3 x0 `* y- h: g/ |/ m
    iret
+ o) C+ E6 N, t  g1 H. ?int41handler ENDP
- X3 z$ A# S8 N* j/ Y
" V- B3 D6 ?5 @. ~( A$ M, j+ M2 E/ Z2 Q
    xor     ax,ax
. S$ v1 X& i5 k5 G    mov     es,ax
3 }4 X  Z3 ~( }# n    mov     bx, cs$ Q4 m! g2 h# T
    lea     dx, int41handler
2 \6 l7 S1 T% G9 ]5 N    xchg    dx, es:[41h*4], l! `" [0 T% p# Z) d% ?. W$ l# ?
    xchg    bx, es:[41h*4+2]
5 `4 s( [4 u" I9 L$ r    in      al, 40h9 G+ p2 j4 A! x/ p
    xor     cx,cx7 a" X" ~' ?; {# R
    int     41h3 z4 x3 f( S# g; z* d- N
    xchg    dx, es:[41h*4]
* N6 U5 v. ^3 M/ h4 z# z8 A    xchg    bx, es:[41h*4+2]
: k2 b$ T) a8 a% e; x- |7 U* ?; N    cmp     cl,al
# M6 Q( J5 g% [* H: ~    jnz     SoftICE_detected0 W' f. ^7 I& ~* M9 u* b( C
% N% z1 R& Z2 `4 o) y
_________________________________________________________________________
. i. ]$ D5 V. `$ M" R' i5 ^+ k7 n
5 v2 [( e" Y* K- B+ K" W. `Method 07* x4 q4 l4 e) z  B! U1 X
=========
- a# o- I7 D, h9 |2 H) x4 P* L- w7 r
Method of detection of the WinICE handler in the int68h (V86)
7 J7 B* [$ G. ]0 Y2 u# m. ~( F/ B& \/ b! y6 ?. q! U
    mov     ah,43h) P3 _  K2 L$ _! c& W
    int     68h
* l9 y3 w1 o3 y% s) e  N* M- ~9 ~    cmp     ax,0F386h
) f' R  O6 A9 Y# K    jz      SoftICE_Detected) t6 o8 a9 ^3 Y  g3 s
7 m& _: J5 V: ]# T/ {0 d
$ m2 R$ M" w, ^8 ~+ d5 C% g, }4 A
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& l0 s8 r6 ^+ c   app like this:7 D7 C/ \  X- g! q
6 ?4 n/ j0 h4 P0 V* E# l5 [
   BPX exec_int if ax==68
1 C2 v( r0 o3 v; C2 f   (function called is located at byte ptr [ebp+1Dh] and client eip is3 g& Z% I8 f7 k* |, I/ i- }
   located at [ebp+48h] for 32Bit apps); j& Y2 B' G' B$ G  }& A
__________________________________________________________________________( R" A, E& R4 s9 G* V

' x7 t& G* D6 R# t* L
) I4 m$ X, ?. ~8 x# ^Method 08' Q+ d( L: S! k# U/ b3 i8 R
=========
+ O( ]7 N, h- j5 d+ i+ f7 M+ K. z* I. g0 C% z, O5 f% x3 B! s0 t9 j2 Z
It is not a method of detection of SoftICE but a possibility to crash the/ i0 R) N6 |! V
system by intercepting int 01h and int 03h and redirecting them to another5 L/ X5 l$ Q' h3 ~
routine.
8 u0 ~9 l% z, y% U$ ?8 w) oIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 [1 X! p6 U% U: Nto the new routine to execute (hangs computer...)( g) p* \, w7 E' J1 t

: x2 i& |$ T1 i    mov     ah, 25h
1 m! X, V7 q) |  O" h3 {    mov     al, Int_Number (01h or 03h)
' U3 g( s9 p! ]& D    mov     dx, offset New_Int_Routine
* Q7 s+ Q8 U8 I' E3 H    int     21h
/ F7 \. i0 b, Z0 a  S. q
* r6 Y" Q: f+ h$ d2 [2 V; i( e- L__________________________________________________________________________
1 M" a/ b! n4 E' J. a/ w) T1 @  Y' x! s" h2 Y( S! B7 H
Method 09
! N0 K" ^* S. V: k2 Y3 X  u=========. W% S4 t: u0 b  r* K
3 T4 Q3 b$ i2 K
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! R. I  m! c0 |  i/ [4 L+ e- yperformed in ring0 (VxD or a ring3 app using the VxdCall).8 A" O- ]9 x$ \! |5 R
The Get_DDB service is used to determine whether or not a VxD is installed
8 Z4 ?# m+ S5 bfor the specified device and returns a Device Description Block (in ecx) for/ p3 K0 B2 Y; C$ n( v. v
that device if it is installed.4 V- f4 K# x7 X2 P- p' ]* J
5 P; N% \4 f+ d  u4 j
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
) W' f. M4 V/ E) E   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# g1 D3 @: u+ `2 t* Q   VMMCall Get_DDB
9 S. w+ U: B9 B# V   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. L8 L& E" {! \8 j
: m9 ~9 e& Y7 kNote as well that you can easily detect this method with SoftICE:" z# g8 B; X& S* b8 F$ H# E
   bpx Get_DDB if ax==0202 || ax==7a5fh- }& _  j- _$ R2 l

2 ~% p4 \7 Y, j3 @. @__________________________________________________________________________4 t7 C% I$ B8 H! g& l

7 o  T! m$ w8 [8 K3 n+ \Method 10
; i; `. @; @/ h2 B- `1 L=========
( \# @! S7 k1 c" D0 `
" f9 s1 g7 ~0 Q/ [7 m; H=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: s, ~5 [1 z- w1 ^7 {6 |6 y
  SoftICE while the option is enable!!3 t+ T- |8 H6 B

$ W- q8 V' u0 t) nThis trick is very efficient:% c2 m% L: @$ h4 ^' A  z
by checking the Debug Registers, you can detect if SoftICE is loaded3 f& i8 R' N; T5 C, [
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, S' ?4 z& Q$ \- N! u
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( l1 R& g' ]* svalue (in ring0 only). Values can be manipulated and or changed as well
, r. v" D" j; p7 ^9 E, y; B(clearing BPMs for instance)
3 u, y5 i" v+ U1 M5 f1 m9 w0 V
% w- r5 X# T$ g__________________________________________________________________________2 U: x0 O* Q- `4 D' I9 }2 ~* ?6 \
2 e' ]4 Q3 w# w$ K; p  b
Method 11# K% A; N7 t) b" t6 ]) \  f
=========0 d8 s$ |  Y% A' k+ @, V7 f9 W' \
5 x( H& }  K# ]! x3 |$ \$ X
This method is most known as 'MeltICE' because it has been freely distributed' ^4 m" R7 k; h; F/ ?+ t
via www.winfiles.com. However it was first used by NuMega people to allow
; j/ E+ b1 U& i; XSymbol Loader to check if SoftICE was active or not (the code is located
8 d! o2 s6 l; p/ E" m6 J3 Hinside nmtrans.dll).2 Y3 b! }3 u) o: L( f2 g

6 v1 h& o3 ^1 @0 C' D' s& O' H8 `' NThe way it works is very simple:- x; U: i) [* ]$ X, X& g  a1 r4 Q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 _4 F. B( e* J; a( }2 G+ v% P4 aWinNT) with the CreateFileA API.! ~: l' i/ F9 n* U3 q6 @6 U9 |, W
; U7 ?) O* `1 _, D: B+ }# C
Here is a sample (checking for 'SICE'):4 r5 \* Z2 H3 D0 i) q. i0 I. h

& y7 Q, W. e; e0 K3 z1 sBOOL IsSoftIce95Loaded()+ p4 [* o0 ^* M6 w  ~
{
' k: s1 M- r& b8 T/ o0 }2 p+ _   HANDLE hFile;  
' S* g% L5 ]. p! Y! p2 ^" ]8 p   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
, Z0 S. C+ p) V4 u                      FILE_SHARE_READ | FILE_SHARE_WRITE,. U- z9 _% \* ~
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);8 @  p1 [0 n# g
   if( hFile != INVALID_HANDLE_VALUE )
0 a# \# [' ]7 g2 i! y0 O2 ^   {+ A( O( ~' z& i4 n: K4 G* I# E5 g" }
      CloseHandle(hFile);7 P. ]3 t1 W6 b
      return TRUE;
5 B  [( v* H3 A! b3 T' k   }
" H9 h& V$ q6 w5 {5 B9 z+ b5 q   return FALSE;
, B6 Q' D0 Y- N; \0 i1 x}, {9 c" j3 E. Q+ r" f8 U! z
- y+ D9 s6 i/ s7 {
Although this trick calls the CreateFileA function, don't even expect to be
+ M' A- N, T  ^) W7 Lable to intercept it by installing a IFS hook: it will not work, no way!
& L" t" z( S+ |In fact, after the call to CreateFileA it will get through VWIN32 0x001F
4 Y! O! e+ ?( }6 T, b! zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& e/ T! v8 V/ E# v* A5 @! Gand then browse the DDB list until it find the VxD and its DDB_Control_Proc, w6 f, b; N4 z/ y
field.
* F& T$ P% H$ a5 E# }In fact, its purpose is not to load/unload VxDs but only to send a
; }7 q# }1 p" j) iW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 @& y+ t, O& t( C
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
% \6 x$ @: o# R/ Z" bto load/unload a non-dynamically loadable driver such as SoftICE ;-).
% R2 Z0 x) i, F3 b% Y0 UIf the VxD is loaded, it will always clear eax and the Carry flag to allow
& j5 T+ p! u) g, a3 [its handle to be opened and then, will be detected.$ d) S- E: x+ U; Q! i% x
You can check that simply by hooking Winice.exe control proc entry point1 v; l0 u, b* A: |
while running MeltICE.; N1 U0 r- g  Z# G3 s

! R% I9 u" B% \) G% b1 e6 R* }; ?2 d4 Q/ c2 p/ |. [: n# f
  00401067:  push      00402025    ; \\.\SICE
! z  x* x% y6 A: W  0040106C:  call      CreateFileA
1 \/ ^7 x6 m' _+ a' O  00401071:  cmp       eax,-001
# P+ i) O' z5 w  00401074:  je        00401091
: f0 ?$ u: P# Z( a9 w- k4 ~6 r- e5 @" I! {4 \# w% v. V

  I' d& Z' t: j0 U/ N6 hThere could be hundreds of BPX you could use to detect this trick.
8 ], Y$ F" r% i5 E* I7 I2 l: ]! X-The most classical one is:
0 ~. ^( ]* p8 @% x. E$ ~) C  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 C2 N0 e8 a9 ^$ ?+ `3 H% O* M- h
    *(esp-&gt;4+4)=='NTIC'
; G+ S$ _' ?% G2 S! R7 ?  D7 }2 p8 t; P2 p% ^9 i& K7 v9 \7 x) P! E
-The most exotic ones (could be very slooooow :-(; I* f( e! p& t9 k- K$ o! W4 @' @
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
8 p' i( u) U0 l9 [! e# R# ]7 p     ;will break 3 times :-(' y0 M9 |/ c, e9 N, d3 n! `/ o. j& I. R

: u  H$ q6 t: R2 p-or (a bit) faster:
  Z5 u4 w& ?1 e0 ?- v   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! a2 e6 l1 T3 E
4 U- W8 ^6 ?5 g% i# m
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 d3 w9 H" f% z7 E$ U3 v9 B; o2 R0 k, a
     ;will break 3 times :-(
$ E8 h5 ^2 ^3 o6 u. n6 l2 q' G  o$ n! [1 I9 E) w+ s! E; @
-Much faster:
6 V9 I# x6 g) c! ?& ^* k   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 e. s) ]) A0 `) I* V+ J

, R' p# h6 l" |- jNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
. j1 Q" r3 G' G5 Ffunction to do the same job:
( S) D/ [+ b$ r8 b- j8 h% `2 d
   push    00                        ; OF_READ- l5 N$ d3 c" @# {' T' B8 g
   mov     eax,[00656634]            ; '\\.\SICE',0; T( ?2 J  x* V+ v/ t0 k
   push    eax; _  _% @$ [$ S* `  g+ T9 t
   call    KERNEL32!_lopen- b5 s# ]/ E# e& \9 e7 b2 a( e4 t0 Q
   inc     eax& O$ p' H0 C( @& k1 \) I
   jnz     00650589                  ; detected4 Y4 y' R6 V" U
   push    00                        ; OF_READ
" ]. ~4 E" [# ^) }8 A3 S   mov     eax,[00656638]            ; '\\.\SICE'# c8 A" [3 F& s+ |( o
   push    eax8 P# q7 }) T# o" ]
   call    KERNEL32!_lopen
& P; i0 B+ H# ]   inc     eax7 Y& `7 C0 D+ {; [
   jz      006505ae                  ; not detected
4 Y( O- m0 [& D  i# H7 ]
/ Y7 U0 }$ Y3 i" E
+ A) k5 o  D4 e7 P9 d, {1 K8 [__________________________________________________________________________
, m7 X3 L+ {- P# Q' @; z
9 u* q, m$ L3 K5 a. uMethod 12
4 L* Z- P# }6 D* {; N# Y8 L=========) L/ G8 ^  V- f, T$ U9 V
$ J, L9 d0 h% ?5 R/ T5 i
This trick is similar to int41h/4fh Debugger installation check (code 05
+ I4 z# c+ ?1 {  F; T+ c- K; r( K( V+ O&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 }8 i5 h# ~. {0 `# M+ h
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( S- J/ A+ p: u) ^; x  n, n3 c% T
& r4 {0 g8 Y/ ~6 `! ~   push  0000004fh         ; function 4fh
  I. c/ F3 E& w  f6 Q5 M! ~2 |! e   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 h* T0 C4 G7 Y" W3 L( N                           ; low word specifies which service) i$ K% q7 n$ K9 v* h
                             (VWIN32_Int41Dispatch)
) z* J$ f0 ^  g! Q8 B  h   call  Kernel32!ORD_001  ; VxdCall
5 e+ L7 a9 J* A; o  H7 ?   cmp   ax, 0f386h        ; magic number returned by system debuggers/ y# k& O/ p3 W  F5 o4 L' G
   jz    SoftICE_detected
" p. q( O# }% U$ m  j4 P" J0 B- }0 Z- Y9 N6 u2 G
Here again, several ways to detect it:
1 w  w' F5 W9 r5 ?2 ~4 l, j$ ~+ c5 L" P* u+ S
    BPINT 41 if ax==4f8 M9 w+ o2 h* X9 e2 w8 n! j

' R5 F) U6 _/ g    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 y5 ]3 o) R$ h! s' j1 K
0 J+ ~- E6 ?! m1 F- a$ r
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
) m7 S1 W5 `% k' ?1 Z+ D" X7 u7 _2 ]" `- v3 `' ]# J" e
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 n; ~7 y+ [, V: B7 R% y) z3 U$ ]- b$ g- J$ w$ g
__________________________________________________________________________
7 O4 C& k! x* |
1 k% D8 o$ J0 F3 pMethod 130 L2 R4 _9 |! w3 @) `8 l
=========
- V3 c0 y! U% Z# d7 Q0 U* H: A6 }* }. q" w4 j, y$ @( J
Not a real method of detection, but a good way to know if SoftICE is
9 C% H+ S6 a5 W. d! E8 dinstalled on a computer and to locate its installation directory." E5 _" y3 \$ S- f& |7 B
It is used by few softs which access the following registry keys (usually #2) :8 B' o: Q9 X3 x
7 n  R) M! P# j7 I
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  g: T4 {1 p* p) R7 G& N4 c5 ]\Uninstall\SoftICE5 B6 e/ I" O! G3 y  w4 D, J& H
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( h# ]1 t) I) x- b4 G
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 m' |) j. W/ f$ x4 y\App Paths\Loader32.Exe
. Z& q! Q$ Y( W/ H" K/ l$ g& f9 y3 S8 M' `

5 Y/ V) `' P" J4 H! pNote that some nasty apps could then erase all files from SoftICE directory! l3 i, W' D& P- a7 x. T
(I faced that once :-(% \5 D0 K, @2 M" k' E; I

, c1 g/ U8 o4 I  p8 L* }. w: ~Useful breakpoint to detect it:
8 M6 e8 s' M8 P2 ~. _  h7 c% [0 k! M6 x: t: M
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 H& n' n; l. w6 o+ O1 Y' Z

. t1 m/ k5 q4 D, J: n& J/ S) H  e0 L__________________________________________________________________________  F! }( @3 R7 F
0 u+ M7 N( ~+ f% c/ v
" q! M7 [& u) e# ^( _1 y
Method 14
7 H; Y$ L! Q4 v9 B) @/ }1 S=========0 e. ^9 }2 g- B
, E4 E# u$ c; e
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
& @7 v% c  N) a3 f: Zis to determines whether a debugger is running on your system (ring0 only).* G; r: I. x/ u% K: G4 N9 y$ v
4 \- Y1 b2 w+ Y+ v! }
   VMMCall Test_Debug_Installed
, O: R  N& G& O. b   je      not_installed7 _; q* K* A4 u6 y
5 J0 g2 p6 i2 ]$ b
This service just checks a flag.
9 U! f$ k1 O: [2 S, G  Y</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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