About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, a/ r5 J% P$ E3 [; R$ s<TBODY>
+ Q, |; E9 o( |0 _4 _7 `<TR>
' G5 X/ r. t  t' I<TD><PRE>Method 01
" p9 E0 C; ?" A=========
2 n# K' C$ F% Y
! z& l4 w) g6 s6 W+ x3 O  ZThis method of detection of SoftICE (as well as the following one) is1 T* v/ q% C" `* \+ f; E; r+ o
used by the majority of packers/encryptors found on Internet.' [7 D9 d, r4 {8 _- [
It seeks the signature of BoundsChecker in SoftICE
! b9 X9 }) O  ~: `( W, [) y( k. u! r" }) \8 i% h  s" a. s
    mov     ebp, 04243484Bh        ; 'BCHK'
  k0 t0 L9 t* U4 M    mov     ax, 04h
6 G% X. \; y: q9 y5 Z7 V) r    int     3       " f. Q; ^$ X8 a% I' N$ M
    cmp     al,4
1 r' t8 Q9 ?1 F& X% w    jnz     SoftICE_Detected9 U$ K$ K( {% B5 A( A# I  `

" B, l0 D4 i' v3 t# C) ~___________________________________________________________________________
! U- z7 k+ y! Q* p' I# |6 _$ m
1 o/ ^) h. ?% u2 f* \% Y9 J( WMethod 02. `6 ^2 Y, a' N1 p
=========% T! s. _5 L6 g# c) X0 U* t& r# K

) }$ ]1 i5 {0 k, m6 `/ nStill a method very much used (perhaps the most frequent one).  It is used
$ i* F3 A# W3 r* O+ Jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,- L2 n( D5 I0 Q9 N! m0 V% T
or execute SoftICE commands...- i+ f7 H. L# H
It is also used to crash SoftICE and to force it to execute any commands
% ~9 m4 z, S, f  [% C(HBOOT...) :-((  
  K! l/ n- I8 J( J6 ?6 F  o+ }" [1 t+ i
Here is a quick description:
+ t: K0 U7 l6 I; w5 {4 R-AX = 0910h   (Display string in SIce windows)3 n8 t& b( {: v) @
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 e; L  s) p& X. m-AX = 0912h   (Get breakpoint infos)
$ \# v) _- J1 ]4 F) P-AX = 0913h   (Set Sice breakpoints)
1 L% M4 I8 z  B-AX = 0914h   (Remove SIce breakoints)' F$ _6 [$ M5 q+ t  \  O, p

8 E: x0 y  z0 m# CEach time you'll meet this trick, you'll see:1 ~) h3 R. X, b# p: f/ _% ^+ ^
-SI = 4647h
2 K' b' j1 [, l* c-DI = 4A4Dh2 x* S' K' `9 w8 {# {( ]
Which are the 'magic values' used by SoftIce.' {7 O9 j  e9 M1 i7 O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.1 _# |5 p) U& a

9 z' ~% V# @  CHere is one example from the file "Haspinst.exe" which is the dongle HASP4 g8 X  T, l+ g  G1 R
Envelope utility use to protect DOS applications:
; ]2 F+ R/ ~6 I" S% p' ?; o9 x, x3 M4 K# R3 `
8 {, ?. J! z% ^( d1 {
4C19:0095   MOV    AX,0911  ; execute command.: ^( T6 w, m2 Y: @5 n& d
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 C3 K5 f( u' x9 `3 E
4C19:009A   MOV    SI,4647  ; 1st magic value.
. c$ D, E( p0 R1 W% [5 [4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 a/ Q) m) A9 c& y: O9 b$ z6 C2 J
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% A2 e, p3 t# P2 ], F  L
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute3 W2 V; N! g# k0 A2 t& I
4C19:00A4   INC    CX
8 B  U  ^6 Y4 E8 d# s% e2 v4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
/ T- c, ^& |5 h& z/ S0 {; m% E3 ]8 u4C19:00A8   JB     0095     ; 6 different commands.
! X$ u) M. O* J8 F4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% ]; [; Y% I# C0 d5 n6 s- B4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 `$ }* U- u! `3 ~1 ?$ r3 P* ]3 D% o6 z
The program will execute 6 different SIce commands located at ds:dx, which9 k1 S2 y' p0 M0 ~5 ?$ ?2 C8 Y! ]
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- u8 h) K6 a. ]( u  R
& K" G+ @1 k  x- F/ b1 }* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% Q  W# M! j3 c
___________________________________________________________________________0 q: w* S: a. B

7 W8 f6 q; e  B+ G! o6 Q
* v1 s4 [0 K: z& T" ^Method 03
- T$ H! g- H6 I( N7 x* |( H0 c=========
2 ]/ J0 s9 P" G4 M) O, e
, S- i8 R& B' ~8 U, i3 DLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  G$ U, C( i' b' l4 `7 Y
(API Get entry point)
  Z4 b# V% i! ]        : U% z- h, H* F) r* {6 T

4 ^. k8 K) w/ \* x0 |+ o    xor     di,di
! ~  @3 T6 H  y3 y) N    mov     es,di
2 t4 {" O) B$ X, d. K    mov     ax, 1684h       ; T4 x5 \  H& R$ i; @# n5 S) ^
    mov     bx, 0202h       ; VxD ID of winice6 V, D. e4 z) V2 A1 W4 o
    int     2Fh
+ L& x' {% K; \, |2 N7 z0 k    mov     ax, es          ; ES:DI -&gt; VxD API entry point- o6 W' H  Z: W. q: G
    add     ax, di; a7 N, Z% x9 k
    test    ax,ax
6 g( ^  Q: ^) p/ @    jnz     SoftICE_Detected
( ]% }% L8 E/ }' X8 S5 s
8 ~  \/ x# @, a& ]% g8 D- |  s___________________________________________________________________________( p2 e4 z9 T) s& z' u

# u+ O# X4 `# E9 v7 I, wMethod 04
" P( g3 s5 g' g( I1 R' c9 v$ }=========
! _8 \% D% d8 O" r8 k" \/ N8 `) V8 F: I! b" i4 h2 p- v* W- G
Method identical to the preceding one except that it seeks the ID of SoftICE
8 m% B1 G" V* C/ iGFX VxD.0 J! L( F3 h/ H7 {
- p2 w  ^8 Q" J, v. D0 X
    xor     di,di
+ |2 X/ D2 ?+ z3 W; @8 U0 s7 u    mov     es,di  B) A" J% z+ j2 V# C
    mov     ax, 1684h       # t# ]& g, ^1 i7 v
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* ^$ L" i# |5 F    int     2fh, `( L  `( K  f$ @. A8 G6 O, |1 @! k1 E
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 }7 `6 o# ]" X' q
    add     ax, di
1 b- ?0 R" N7 z) |; r  c6 k    test    ax,ax" a  H- b5 \8 f6 V
    jnz     SoftICE_Detected, R; x+ b5 z4 n  L: S& I$ |8 Y

- h8 X$ e. c1 Q+ X__________________________________________________________________________9 n5 y) ]. d6 C9 [
( [. s4 x" b: L2 n: i* N

7 \! E4 s; v2 p3 [5 AMethod 05' Z8 z7 ~/ o% w7 _! R3 P1 i1 v
=========1 K% r9 b) X3 I' M* [) G
+ M0 d$ o  K1 ~) p) @6 n" N4 L1 A
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- {- T4 T3 z. }5 M* T$ \& a$ p' [1 zdebugger. It calls the int 41h, function 4Fh.
/ g+ b. ?  q8 C! k5 X( I, ]There are several alternatives.  . O& b" J$ D6 Z
8 j  A+ B- R; S. M. W" x2 q3 m
The following one is the simplest:
/ d4 l  [5 _& C  o$ o9 [
, A* N: C! A  q    mov     ax,4fh/ l- [. Y! {/ `: D% a% o
    int     41h, T0 V; k5 ~# A+ Q( E! N; l
    cmp     ax, 0F386& p* y. K5 M  |: l; Q
    jz      SoftICE_detected
: W9 x% G6 H* n* [$ r6 E) [5 L
, x0 {* g% |8 {& f3 E( J# L5 r) D, x* \1 b6 U. c0 C9 @# p: L
Next method as well as the following one are 2 examples from Stone's
; E+ _& E3 T) l# Z5 y1 z/ U' t. {"stn-wid.zip" (www.cracking.net):
) ~: [" |4 ?0 ]5 l& b
6 b1 I$ R3 `, @    mov     bx, cs
8 a$ V. V. n9 L& \& X$ {3 k' R) |    lea     dx, int41handler24 Y! o: v* @$ \1 N
    xchg    dx, es:[41h*4]8 r/ d% M1 ~( q5 s' l9 {4 y
    xchg    bx, es:[41h*4+2]
( T! t* }+ K8 E' T4 K' E8 Z    mov     ax,4fh/ t8 L$ M- N, W6 i' O3 G) U
    int     41h4 d/ ], R4 H4 c* r# `
    xchg    dx, es:[41h*4]
, S- Y6 k% j: d    xchg    bx, es:[41h*4+2]- Z, ~5 ~! }! Z4 c1 x! z
    cmp     ax, 0f386h0 D3 P" d* x1 V1 B! B
    jz      SoftICE_detected* T( ^, q2 z5 E8 [

' A' a1 ^' P5 e2 p( j: `1 aint41handler2 PROC  g$ E; l) ?* H4 f4 ~
    iret
( \" q6 j% u/ o. r0 k: I4 K% G& f7 gint41handler2 ENDP: k% j" U4 |, }) r, [, g% f
: p8 S; j0 a: D! S8 ?
7 e' ]7 i( R+ V9 S% J
_________________________________________________________________________) Z+ D0 h% K6 B" e
0 F/ A" }7 @% u6 L$ ?2 Y; ?! D
. F! Z! a: i+ a, m7 X/ n
Method 06
4 t8 E* H. L/ a/ |! H=========
5 o- {& B" J0 s# R/ C4 `( J% n0 W
3 c: e5 F! F. u# C) r
7 M& G0 M+ E$ T8 h  Q. [2nd method similar to the preceding one but more difficult to detect:: o5 M9 h9 [5 H( L+ P$ h2 i
9 j: `+ F5 [* N6 @

5 [/ p# n# _. D7 i1 {& `! Rint41handler PROC
- I& g: ^) |& b+ d# p- B    mov     cl,al, o* l- J* |/ B. s7 Q
    iret
* _% x& e0 C6 [: f3 n+ n# Bint41handler ENDP  N0 ^+ l* S/ Q' K5 Z. M

. |& }$ ]8 U% ]& R' N8 O  ~, T
; ~. q8 a# B  z& r( d    xor     ax,ax- H* L5 m5 s" _2 F  M
    mov     es,ax
8 I0 q+ g; e4 O) b# {    mov     bx, cs
6 v" D$ V* R: ^5 W    lea     dx, int41handler
+ O: |9 T) d! u# N7 ^  ^- {* B    xchg    dx, es:[41h*4]
2 B- B% d0 a# \  R" }% W+ C    xchg    bx, es:[41h*4+2]1 _7 ~! [4 E$ ]; M. B' P, d
    in      al, 40h- s& `' b* \9 {1 n
    xor     cx,cx
. \: O+ W* [" ~. j3 y! A, A    int     41h
: |% `- s! ^4 b( U! X5 N0 Z* ^( B    xchg    dx, es:[41h*4]0 r9 S7 p' m/ _* F2 N  G, W) j( \6 ^7 U) G
    xchg    bx, es:[41h*4+2]" ^0 Q* r  }& Z3 A: T
    cmp     cl,al$ D+ q+ n' V2 c6 D
    jnz     SoftICE_detected
" I0 l! x# Z+ V) j, l! \; G0 G) N. h  z) N: P0 Y
_________________________________________________________________________! ~) p/ N: I. W1 I# W% p
1 X4 P+ V6 N; S6 F) ]( W
Method 07
6 {# z; `( c5 B2 {% @1 S=========
, [0 q4 u7 X" q& M
2 a  k% x0 s/ TMethod of detection of the WinICE handler in the int68h (V86): p8 V. n7 f7 L

5 y$ d8 v. q) R9 n1 P9 [! x$ |! A    mov     ah,43h: P1 T* N. K' j# d- J7 `* Y& c
    int     68h4 |4 U) l) N5 ?- d; ?
    cmp     ax,0F386h' I, s% o: P3 ^
    jz      SoftICE_Detected7 f3 ~0 s4 c+ x5 [4 ~! d" S

6 K% Y9 M! A" G' A4 E) b" ~( v  ?: a' H4 a: }7 w* S! B
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 v' ?; q0 ~! {  i3 c: G   app like this:
9 p) m- A  p: @" n  |2 N$ d. R. b. e8 D1 [) v4 g; x! @
   BPX exec_int if ax==68, f( g( z7 [2 O# C
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& Z3 @: b1 k7 `2 o0 o   located at [ebp+48h] for 32Bit apps)
: ~9 h% Q* L0 v9 ^4 a, o) e__________________________________________________________________________8 ]* J0 q* F/ \0 i9 ]
8 J% d9 k  T  Q! l# ?! T
. m' d1 S, b1 k/ [- \# y. F+ f
Method 08' f1 I$ T7 ~: H/ p- k
=========% {2 c! [) R1 ^* }/ x$ s, i+ }* Q6 i
: x* T. ?0 I( ]: a  N  W9 {* }
It is not a method of detection of SoftICE but a possibility to crash the
4 B) M9 `4 u4 Ssystem by intercepting int 01h and int 03h and redirecting them to another  Y* M& \* L. {6 N8 q9 `# {, W
routine.( r0 b7 I% K# q) S. N9 |  {
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points1 G* g5 h/ `4 t, R
to the new routine to execute (hangs computer...)! @7 T& {# r$ N, S. @2 S
1 U0 g6 O4 p; G. R0 u- x
    mov     ah, 25h
- }0 k1 F: v* i    mov     al, Int_Number (01h or 03h)
" o* h# Z$ s" [8 h- U8 J    mov     dx, offset New_Int_Routine* l) j9 T+ O1 Q+ d/ x
    int     21h
" Q& F( |. G" A- P4 D& X7 @* l0 i: o
__________________________________________________________________________2 @# }* `' K5 t, Y" w& |0 E

9 X/ Y1 }+ Y5 HMethod 09
% _( c& w% W! [=========; s8 a7 j' ]$ N4 D4 O

: ^; c4 J, [5 U" T$ E, ]2 dThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! {8 f( z4 z2 F. {2 W' zperformed in ring0 (VxD or a ring3 app using the VxdCall).2 ^$ O- n8 ?$ p
The Get_DDB service is used to determine whether or not a VxD is installed
$ ^5 i2 `: c% T8 ^0 @4 A: C9 s7 m% cfor the specified device and returns a Device Description Block (in ecx) for3 D0 j# P, E8 o: ^/ ?! ~; k2 g0 c8 S% u7 c
that device if it is installed., A8 h, V' u3 S+ F' D. ]! O( R
/ q- w  v/ S+ V: P2 i  X! ]
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; Y& q) G$ W" g# W; N5 f, ?/ N& L   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
. U7 k. s, |& u  w7 X   VMMCall Get_DDB5 |- ]% o3 w5 X) ~+ I  k$ U
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
) C, F: d  U" s" T# P+ n" W9 u  L# O1 [5 E& O# y1 I
Note as well that you can easily detect this method with SoftICE:! [- @. n. c8 v  j3 I" B# {
   bpx Get_DDB if ax==0202 || ax==7a5fh
- w* c$ W& _$ k& M* @
$ l2 S# w2 @( Z$ b0 M, t__________________________________________________________________________
' o( b& n1 R: |6 p- B# E8 A% I- Q) ?/ |: t4 O3 `
Method 10
" J! o" ]1 B5 v! w=========
0 A" d; {$ x. P9 \, f9 m4 x  L) D- c- c$ U4 h$ j
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ J* d9 S( T4 Z
  SoftICE while the option is enable!!( o( J8 f+ d! M

6 [5 Z3 o% k/ h% }% A$ N5 \This trick is very efficient:0 }+ I: ?/ u* `0 t! r3 U! R7 k6 R
by checking the Debug Registers, you can detect if SoftICE is loaded
* w0 R% ~- O5 D( H1 O(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ k/ P8 d# L8 w) c  n5 t8 c
there are some memory breakpoints set (dr0 to dr3) simply by reading their
2 J6 g+ s$ Y& [- _7 Y* ^value (in ring0 only). Values can be manipulated and or changed as well; e) p( c' @6 T, I& X
(clearing BPMs for instance)% N* Y( ?3 L7 E

2 E2 w2 a3 @; J4 m+ \__________________________________________________________________________( J! `+ N, ~' t, X# i% h# D  ^

6 `+ r6 ~% y/ N' \& E7 ^' V- `Method 11) _7 N; F7 s, w
=========
5 ~5 k( g- ~8 [7 R  D( r( g7 v! Q8 X, X3 X" |0 Y
This method is most known as 'MeltICE' because it has been freely distributed
/ e# W) m3 I+ c# B9 S" C2 gvia www.winfiles.com. However it was first used by NuMega people to allow( h8 K/ f7 {. C! O8 G$ R+ R
Symbol Loader to check if SoftICE was active or not (the code is located
* x2 o& J0 @/ R% V3 f8 s" l, Ginside nmtrans.dll).
/ H+ N6 P% F9 A0 y/ k: \/ e1 O" V9 t% Y2 a0 H5 t+ H
The way it works is very simple:; X/ z6 i. k- x  o
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
! ]0 a8 C# T  bWinNT) with the CreateFileA API.
9 L: O- [* q* {# @. A  d  P5 ?3 G+ E5 [" R! f0 \( m
Here is a sample (checking for 'SICE'):) Z$ h; A. P% S5 m3 [; Z
( u3 t, m( i' K5 s& Q& ?8 W
BOOL IsSoftIce95Loaded()$ c5 F# b4 d5 [+ F8 z/ I
{
- z! b8 S: c3 Y0 A; {" A- m4 Z6 I   HANDLE hFile;  
6 h- u. z+ E. x3 \9 q9 E4 b   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 X8 X3 f& ?. N
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& ~- t0 k3 [; ?$ B& @4 [8 b                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 T, v- Q* @! Z- m
   if( hFile != INVALID_HANDLE_VALUE )
: j* @2 f5 p) b9 c8 a7 ^   {
5 `3 h; J" B, o0 J" @. |8 u      CloseHandle(hFile);
# x# j$ ~7 T/ \. E      return TRUE;9 L: h: g8 \* y( F" H
   }
) c3 E0 g) p* y( y  T   return FALSE;
* p# I& b3 ]: y& `}
" j6 E( Y8 S! K4 C5 t  A
. E0 }- h" ?: ~& ]1 z' LAlthough this trick calls the CreateFileA function, don't even expect to be6 o& m# I; F( p7 \/ q
able to intercept it by installing a IFS hook: it will not work, no way!5 N: J( h* }+ ]6 A# l$ W
In fact, after the call to CreateFileA it will get through VWIN32 0x001F8 [5 ^+ `' `2 b* k: C( Y
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( m2 N6 B, n  `$ v& _( L3 nand then browse the DDB list until it find the VxD and its DDB_Control_Proc9 g. x2 @- w" o2 c4 H8 @$ z
field.
$ ~( y7 c7 R2 M( |: z9 _% @! aIn fact, its purpose is not to load/unload VxDs but only to send a 4 @! ]5 |6 y7 y1 {% C/ k% C
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)- q" I: E+ b  Z' v  P
to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ j4 \( J" p; f4 u! N: D. m' b* K
to load/unload a non-dynamically loadable driver such as SoftICE ;-).: z. o' R7 j9 S5 b9 K. r
If the VxD is loaded, it will always clear eax and the Carry flag to allow
( i1 b1 u5 ~( ?) x4 Jits handle to be opened and then, will be detected.& W! R( w3 z& R+ P8 V* t
You can check that simply by hooking Winice.exe control proc entry point5 o. `3 Y( Z3 `
while running MeltICE.
  h2 S3 C8 D. e* F. S, D: l* f$ e3 Y) g5 k

7 D8 Y* P: |6 X6 A6 h/ S! ^  00401067:  push      00402025    ; \\.\SICE
' n  M, @9 U" l( N- u  0040106C:  call      CreateFileA
4 R* P$ o+ S* x+ D! L  00401071:  cmp       eax,-001
+ B7 U- O" L  m' Q) D5 L  g  00401074:  je        00401091
( ?* i* b, W% I! N8 W, j
/ ~$ z% r% e( r4 v' S* d5 `: N) j- x: ]& b3 n0 w
There could be hundreds of BPX you could use to detect this trick.
) a) A! R+ y9 `; i; a0 }-The most classical one is:9 a5 A6 C. K. S
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||4 s3 p' `) n8 L- w1 |  V( z* @" _& Y
    *(esp-&gt;4+4)=='NTIC'
& {$ W' ^2 T* p) v( r% q, B( m- X% P4 v' C% b, `7 m. S2 g
-The most exotic ones (could be very slooooow :-(
9 m! o6 K. m" F# e1 L0 g8 }9 L   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  o, `0 I1 A: m- Q     ;will break 3 times :-(
" b* ^5 {8 a9 W0 t# ^
  s. p8 X! c$ [-or (a bit) faster: 8 [4 `1 h5 a. G% q- k. X6 K
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
8 N0 ~7 Y7 X3 F5 j( @) |2 |
7 L8 A& G, D/ `* i   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 s  M6 M! A% f  @; Q  D
     ;will break 3 times :-(
; _' U: i4 ?! R4 |, F* M; ?0 S, ?7 L4 i* A1 m
-Much faster:
/ P6 |$ M3 b0 q   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 r) N4 g( `" e' U; E
' a8 x' X. B. |! ]! `& S4 x
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 w, H5 ^3 n* n( Cfunction to do the same job:
- X- d2 \3 ?4 f& l; Y8 v! U- \9 z4 C9 Y7 Y9 g* W5 z4 M# k
   push    00                        ; OF_READ  J7 M6 G, y. Y8 U1 e
   mov     eax,[00656634]            ; '\\.\SICE',03 j5 o+ H6 {6 {1 l8 g" T
   push    eax
; Q; p1 H( P; E: C& T7 Z' g: Z   call    KERNEL32!_lopen6 \3 N3 Y" ?; P0 t2 R, n* G. H
   inc     eax
" ^% T& I9 f$ A3 k   jnz     00650589                  ; detected
; x7 S9 L$ |* F; s$ y9 C   push    00                        ; OF_READ
2 P; \, L/ C9 `, H8 }   mov     eax,[00656638]            ; '\\.\SICE'
6 B4 d. x$ M/ F2 P: b   push    eax+ E) Q) Z7 R1 L  a. A
   call    KERNEL32!_lopen! z. a7 Z! p% p, ?6 y' S9 z
   inc     eax( @) }2 T6 _9 V' T+ |; a
   jz      006505ae                  ; not detected
. D2 e: z7 t  t) W% ?
7 _8 A' k# l1 ^0 E
& _% H% V# y& B) j7 `& p. Y" e__________________________________________________________________________/ x5 ?. H" k) k. p

8 r! Y! N" K6 R  l% NMethod 12
8 j1 Z" Z  B: [, X" {3 X=========
5 N: J" Z+ N* h6 H+ e4 O
/ y+ H8 h5 `8 D; |- z* HThis trick is similar to int41h/4fh Debugger installation check (code 05+ d# G- v( N( O$ Y
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: M: V% q8 L) b& T# J! s1 \as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 v8 |1 m9 L; q! t% {; S. V

' u6 e2 v. x, E+ {4 V) V  x   push  0000004fh         ; function 4fh& r: T+ b# k$ T
   push  002a002ah         ; high word specifies which VxD (VWIN32)+ V+ s9 m% ~" J7 N0 c( {: {$ F+ G
                           ; low word specifies which service; b9 R1 q/ u* L" c) P8 p/ |
                             (VWIN32_Int41Dispatch)- D+ \' |+ }" C2 A# V; w
   call  Kernel32!ORD_001  ; VxdCall' i; C; L! g1 o2 w8 H
   cmp   ax, 0f386h        ; magic number returned by system debuggers7 h4 k0 k% W* Z. Z- U
   jz    SoftICE_detected
9 h( n6 R2 {3 u, {2 x7 s$ |% J2 y$ i
* A2 e: i5 |2 }( c5 A+ p$ DHere again, several ways to detect it:
& T5 Q- q+ R; D3 j3 @0 ^. P  a& {
3 A" K- p( O/ l5 b    BPINT 41 if ax==4f+ i0 P/ @  A* {' h: _9 z
% R' j1 w- L& E1 T& ~, d$ q% V! c! q
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* c4 r# }! S8 ~: b$ {% L* \
. D9 W/ h3 b% P: T3 G3 h! d
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 s% \# H* E' S$ J' B
& f1 \( B7 T; W' i. \) q: p
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ t& H; e$ z; |& ]/ r4 p' \5 @. q: M2 t* V
__________________________________________________________________________3 ]* e) `- _* W; w: o
$ _5 o+ H* j5 K
Method 13
1 q. x8 K) K' _) |# ~# j=========) i& Y, Y9 X1 S9 O0 Z( c! L4 X
. j- r9 Z! B( ~
Not a real method of detection, but a good way to know if SoftICE is+ P' z- ^% |- C" Y5 y8 I; D+ d
installed on a computer and to locate its installation directory.; U, F4 C% o6 w& a7 u/ v
It is used by few softs which access the following registry keys (usually #2) :
& ^; E, v, O& D2 h: p9 s! D# N9 D1 }# k* _
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 K+ j5 E- i8 k/ i* v  C' u3 V* G) W% b\Uninstall\SoftICE
4 U8 L" D. S. \-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ o# D7 b3 n0 M7 {-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  M' }4 [: r! n  \4 u5 [\App Paths\Loader32.Exe' s; w& P2 ]7 p
! Z' p, I( u0 }1 M( Z& N' @

- e) t. s8 u0 w) @) @Note that some nasty apps could then erase all files from SoftICE directory5 w0 H7 d  y; K; E$ M6 h
(I faced that once :-(. o# k2 Z6 J( T( L( b, c" h2 e: y" z

7 w  e( ?9 b" o* R. @2 x5 x3 }Useful breakpoint to detect it:
" p& n, U( p$ m
+ U; s& F1 {+ t! N/ u/ X4 E$ G1 h     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; m$ Y# ~: T8 f3 |4 y8 Q
  F# ^* l+ z# R) `$ M6 o9 m__________________________________________________________________________) x7 ]" \( T  D

+ {. t* C) x; R+ l' H
0 r1 r; O; R( j, ~Method 14 / }5 u# k& D# w9 T2 Q  ^+ R
=========* {) a3 N7 ?7 x, k
7 ]) p; \  l# I) A2 ~% y: `
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 Y, Y# w( |% w' }8 {: D
is to determines whether a debugger is running on your system (ring0 only).
- T# ]/ J8 e0 w3 d$ x5 I
3 z: F' _# M( X4 \4 y) T   VMMCall Test_Debug_Installed% t# F4 z2 N* A" c) c( r
   je      not_installed
/ M! [6 e, B$ ~% K; @/ N  B& n; R- J8 g2 v
This service just checks a flag./ c1 `9 N0 _5 A9 _2 |
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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