About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 v, ^+ `0 I0 Y' ]; _. O<TBODY>
0 e. c% O  c0 S7 K( M6 C' f<TR>0 a$ @+ g# K( _* Z7 x
<TD><PRE>Method 01
0 L, M, w& u3 x- G5 L6 w3 j=========
8 S; w1 \9 I1 l& l( O5 A6 S! K% _. H
This method of detection of SoftICE (as well as the following one) is* K. w, N7 ~  Y: \* K3 Q
used by the majority of packers/encryptors found on Internet.
9 q& V4 N5 Q2 DIt seeks the signature of BoundsChecker in SoftICE
4 K& l5 w2 d" P( G! v* H+ |1 E% G, {" G
    mov     ebp, 04243484Bh        ; 'BCHK'. h7 w/ W7 L8 [" _% F/ x, O1 g7 N
    mov     ax, 04h" D+ s+ E! a# ]! }( Q* O7 w( M
    int     3         u6 T; @9 R$ S* C2 e
    cmp     al,4+ i6 N/ ^% w' a. M7 q
    jnz     SoftICE_Detected8 m& f& J  i( N/ v' }% X
8 E' x8 o; T" W; ?) @0 n& f
___________________________________________________________________________8 b) T; ?9 Z* y; |2 a: a
% p. G! K( H5 m4 Q
Method 02
( {+ ?: j. _  f- b: U=========( i, Y$ G* `, F, U. T
5 r0 s' f' R: b$ X! q0 C
Still a method very much used (perhaps the most frequent one).  It is used7 W+ v9 C. N  S+ k
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 B; {( h/ _( s$ i- L2 F% zor execute SoftICE commands...
2 t$ p: ~+ l5 k9 s9 T7 i$ f+ X9 F$ bIt is also used to crash SoftICE and to force it to execute any commands. `* B, y+ O- o  o' a: u+ t
(HBOOT...) :-((  - K  o3 E3 s" }% x; y2 w+ T
  H5 f8 M! Z# `1 F+ D9 u
Here is a quick description:+ e: x" O! _+ S1 ?& O, Y
-AX = 0910h   (Display string in SIce windows)
# D9 p0 z$ x+ B8 S8 m( g-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 k: M& Q  b) @$ W-AX = 0912h   (Get breakpoint infos)
' Q+ J: J; h$ o3 p8 P, O-AX = 0913h   (Set Sice breakpoints). |5 h4 _4 ?9 e$ @! f7 S
-AX = 0914h   (Remove SIce breakoints)1 J: Y% E$ N* n- d3 h+ k0 I
$ V" U) E/ M" o2 B
Each time you'll meet this trick, you'll see:7 P& Y7 l0 }9 x2 H& D3 H
-SI = 4647h, j5 P$ A  q' P# s9 L
-DI = 4A4Dh1 N0 O8 K  E6 H' q4 U& d6 V, [
Which are the 'magic values' used by SoftIce.
3 e: u! u) [4 }1 i. A" _& {6 f" WFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.& @/ S5 G- g$ h

0 E) U6 T  r7 ]9 P0 {! s) ?  t+ dHere is one example from the file "Haspinst.exe" which is the dongle HASP
* K0 N  \+ p2 W; HEnvelope utility use to protect DOS applications:
  a; E, t) J8 T1 ^/ q
4 P% @5 e3 Y: Y0 J4 F( P
0 @$ w) d$ W: c) R% c4C19:0095   MOV    AX,0911  ; execute command.
6 ?7 A) }1 ?7 ?: m4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! D; q! {! p  T! j/ L4 G% D6 R. _4C19:009A   MOV    SI,4647  ; 1st magic value.0 N5 @- }7 X) z
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 Q" t' k! V" y' o  _4 N
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)! d2 W4 c4 `2 }9 B4 N& A
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute+ W4 B; A: t' U4 E3 b
4C19:00A4   INC    CX
/ p/ \' X# e! f( c- {4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
$ j6 n1 g2 d- w5 F4C19:00A8   JB     0095     ; 6 different commands.9 D' k+ u: g0 R- a  A3 m* ?+ V" T
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: W' U; f! m  r' d$ p3 c* g4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 p, u/ l5 x: b- s" Z
$ y; S" }# _- E; \The program will execute 6 different SIce commands located at ds:dx, which
# g$ h7 T; k: k# bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& T# @$ \' Z% o

' R/ n6 D9 g( P% Y- s7 V; r* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.4 p3 ]1 U- \9 V) R  c6 K
___________________________________________________________________________# |8 I& M: |# r6 \# k7 o

) G& Y/ }4 Z8 b# V" O3 f8 D/ D1 q' H- h7 U6 O! L
Method 03! |" B$ Q- `0 y' f- c) x
=========: E2 A6 v) b+ U3 L% ~1 v  y7 O

; s5 Q: }" Q5 G) d/ e1 ?Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 d- K( P: u; P+ M( q9 U# r(API Get entry point)
9 @/ a; E% A1 X1 F        9 M( y1 h5 e! ?6 {4 `" r* S
5 X' Q/ I7 v4 C9 W
    xor     di,di) O4 W: w5 V6 Z+ _
    mov     es,di5 W2 b" S3 _1 A& F: O' g' o/ P
    mov     ax, 1684h      
4 `0 M. }7 j# z. ^" }    mov     bx, 0202h       ; VxD ID of winice
! C1 S) L* \& v. l! X: Y3 i    int     2Fh( J! X) m4 I' J/ j; ]9 w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 J- b! \, P7 G" Z; k( ]    add     ax, di* F# W( T! f" j
    test    ax,ax- X# P2 O; N, c, w0 V3 b" S
    jnz     SoftICE_Detected
- g* P7 I7 ]) Q, ~/ y
: g! K0 s1 }5 o' T; v( I___________________________________________________________________________6 b$ G" k% Y# V

. W" {! T0 W: gMethod 04
4 [" N8 U  S: c1 H; @=========$ H5 y8 b; i" q( M, C

* b& Q  H/ X, \5 P5 D* dMethod identical to the preceding one except that it seeks the ID of SoftICE
) e" j8 y; T3 _GFX VxD.
4 _! `6 ]/ f$ m' S2 C
7 [# i) C9 C/ D3 u    xor     di,di  I9 G5 ^. Z4 V- G$ q
    mov     es,di/ b: j# H4 B5 C0 H
    mov     ax, 1684h       6 x0 \) k; w8 b1 Y, w% t1 z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* t' [0 m  d' g& S    int     2fh! k) b, n  ^) z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# J" D6 y1 B- h/ S
    add     ax, di5 P% J! z! g' b
    test    ax,ax$ f4 z* l& }0 w" z. R
    jnz     SoftICE_Detected* T# G  t& K2 ?$ f* D  F: c
/ [9 n2 }/ Y2 r5 Y
__________________________________________________________________________
1 `' R  `) I$ R+ B0 f' y, C6 U0 D! k) W

3 F8 X. Z, d$ yMethod 05
7 `" w' t4 @: z3 W: f! u2 N=========7 F& j( K6 R2 ?% y
" L6 O2 V. f# y6 m' ]8 ~; `
Method seeking the 'magic number' 0F386h returned (in ax) by all system
& ?: {9 _4 U0 s3 p  ]: ?; \. odebugger. It calls the int 41h, function 4Fh.
% T0 O5 l* T, Y3 F0 e5 n2 k9 pThere are several alternatives.  
) i8 l' C2 l# R: O1 H% y8 M: j9 T2 ^
The following one is the simplest:3 p2 o; f2 L( X0 n

6 K" `4 V* v: b9 v; Z6 d    mov     ax,4fh
$ ~6 ]1 [2 K) D7 G4 j5 T2 a' Q    int     41h( f: c/ X; m' ?+ B6 W5 N
    cmp     ax, 0F386: h4 F+ Q2 s8 m5 h  N- G
    jz      SoftICE_detected
5 b" L3 S: p7 y3 ]4 n. y
/ q* ]! j2 e% Y9 d0 N* D" |1 \% }' f" M* {& W$ V0 u* D: m
Next method as well as the following one are 2 examples from Stone's
8 L& H# S3 L) w! y  p"stn-wid.zip" (www.cracking.net):
" e' q9 T7 b0 h; U/ S: @
% A' C  h6 c" \  C3 D( q; r    mov     bx, cs6 C3 F/ M3 s3 W
    lea     dx, int41handler2$ u8 g+ l& [6 b# F
    xchg    dx, es:[41h*4]
7 e* S) O* Y% y, a: R4 t    xchg    bx, es:[41h*4+2]# {9 K) x8 q& k/ P
    mov     ax,4fh
5 ^, i4 t/ n' N$ `    int     41h/ [6 l' Z, h4 `, M" {. F
    xchg    dx, es:[41h*4]9 Y( O( H7 T% N: F3 D: L( L# `
    xchg    bx, es:[41h*4+2]
3 H5 A5 i8 N% p    cmp     ax, 0f386h
, p) w$ a- y" Z1 B    jz      SoftICE_detected
  {% a- u; C5 z% t6 p% l! F
6 J: V; G  `4 s+ n, a- W- kint41handler2 PROC5 Z" y0 z" L; U8 W3 `2 r
    iret
! s5 r( f1 ?% B. sint41handler2 ENDP
4 t: g. L7 H; N5 Z; r# u5 J) L6 z! J/ D" a+ U$ s

/ e) {  P$ F# w& A+ s_________________________________________________________________________- i$ g1 }5 Y$ Y4 e
; r" s5 |) U) C3 R

* q  s9 m( J6 ~$ T* t4 IMethod 06
" b# O! P. Y. V1 z=========7 u# ?7 S) N) l2 p$ [
# ~2 f( G& \" I  P& L4 F. r7 l5 ~/ [8 S
! g9 M2 o# E$ N& `2 d, E
2nd method similar to the preceding one but more difficult to detect:
) g' j, B3 f) w- i& D
3 K4 x3 W- i, k& x; D8 i
& h8 ~7 @% k1 ?9 ]' _  Tint41handler PROC
9 C; p9 ^4 G+ }* l% ~& |    mov     cl,al
( V3 ?* R! I- b& a    iret
  x6 l, x0 I) m1 Gint41handler ENDP
. m+ c) X( \. n$ l1 i  \( |: d/ T0 ]9 f) Q
5 L! {$ v9 h- J- b. q
    xor     ax,ax
! o- o1 |1 P) n  h    mov     es,ax
6 q% N2 u" ~/ `5 g/ Y7 v    mov     bx, cs
  B# L6 n) S7 f' z6 J4 n    lea     dx, int41handler5 L  O9 o, p% |' G
    xchg    dx, es:[41h*4]1 T2 X: N% A) a% s
    xchg    bx, es:[41h*4+2]8 c. x' l$ ?- N4 i! @8 Q# h8 p
    in      al, 40h
" z% |6 }! U" k6 ?- f    xor     cx,cx
3 s, i0 A, b! @" T, G. T2 ]/ h    int     41h
' H/ S4 B8 P; N. A! s8 Q6 b    xchg    dx, es:[41h*4]
9 w: m! K7 z3 @6 \    xchg    bx, es:[41h*4+2]. k$ A$ k- Z) L) S+ u
    cmp     cl,al
4 P! y& E4 a, u; X! b    jnz     SoftICE_detected
+ j5 `1 n" F4 N  R% g& Z: `) z2 ~8 i+ w; B/ ]$ }# |0 o
_________________________________________________________________________0 \: u" m8 _' o- t2 K8 R
% [# m- l8 [$ P- d8 Y( c
Method 07, u6 o. ~6 Z5 w, _* N% j5 \1 a
=========( f0 P9 y1 e) u7 j2 Z! g
3 k/ M8 r+ W5 e& K  F. b. y  o7 s
Method of detection of the WinICE handler in the int68h (V86)
: @6 m. O& u! |& v
/ e! l: w: f" x3 q' t5 N    mov     ah,43h$ |0 m" X1 N' C: t
    int     68h
/ y7 m) z# ?6 I- p    cmp     ax,0F386h
7 h* `0 ~6 F2 j- t5 e( z$ g0 p7 z    jz      SoftICE_Detected8 P  `6 W5 k* z; E* }5 P/ T0 ?& b
4 A- v7 q! q  b, j5 y- U8 V' t
0 z6 x9 b  M4 m" L6 b6 O, J9 H% V( o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" ?* H' V% t0 x! b1 L7 j
   app like this:
, E1 {. b/ L5 a2 u. o: t; W, Y) Q6 Z& A5 \
   BPX exec_int if ax==68
1 ^0 m, W# j& b2 d. J   (function called is located at byte ptr [ebp+1Dh] and client eip is# F' p0 E+ h8 C( m4 C% t: U2 _% u
   located at [ebp+48h] for 32Bit apps)
" f& j- \6 a2 E2 j. X2 h__________________________________________________________________________9 Z# [, \7 {4 H" {
/ P  @2 B4 z0 V7 ~& I) ]
" I! |7 O! m; k2 Z* _8 J
Method 08( t0 g' x5 h. T; o$ {
=========9 K8 X5 D$ b9 u. ]# _: d. S8 g/ b
5 J# i# W* V6 ?! Q% w5 k% J
It is not a method of detection of SoftICE but a possibility to crash the
" K4 {+ z2 A) ^3 @. ]1 dsystem by intercepting int 01h and int 03h and redirecting them to another
0 v5 U* r+ D' z& oroutine.$ p4 z- o6 G8 q& B) m" ~
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) D; d- o5 x- T" w" `* S7 Z: ^3 x
to the new routine to execute (hangs computer...)
4 Q1 D* W0 H4 j, @' M8 s- `) W
# Q: s4 {! p2 V* E. K    mov     ah, 25h
5 ^) p3 _! n2 z+ e    mov     al, Int_Number (01h or 03h)- c3 z) r6 [2 }
    mov     dx, offset New_Int_Routine
& O4 p; q- C4 d. Q% @    int     21h/ f2 @* o+ ^- A  ^! \1 e9 i

. N! ~: F0 D5 w6 y2 O# V__________________________________________________________________________, k8 C! f. v0 V; h* _8 D3 }7 c3 U

2 c/ G& I2 C1 [7 P6 iMethod 091 K! Z" w. R* L6 i' e
=========$ Z! e( ?9 @9 h) y7 b
; ^# g' i8 Q; `
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only7 Z* h7 K8 z; L# J
performed in ring0 (VxD or a ring3 app using the VxdCall).
+ I2 T) B+ v: TThe Get_DDB service is used to determine whether or not a VxD is installed
& k% m0 Y1 ~' n/ v1 I1 Wfor the specified device and returns a Device Description Block (in ecx) for
* U6 S) R8 p8 E0 N: l! Ythat device if it is installed.
- q) M; [: L9 L* ?" {* [8 t& N+ t. m6 l* U: `9 E, `3 n
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID! L  ]0 p8 P; R" p. t; k
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
3 ~% J( H. ~1 x& Z. Q0 C0 M   VMMCall Get_DDB, ~' h' T5 B  T7 }
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! G  A7 @, x$ c* U0 S; X6 m  K  g' S! h

& {8 ]4 k5 I' N+ l6 U; [) UNote as well that you can easily detect this method with SoftICE:
' v. C: ?7 H# B. P   bpx Get_DDB if ax==0202 || ax==7a5fh
# \. Z+ l3 T5 n* Q& A8 G' S3 m
; V2 ]2 `2 ]3 S* F2 D& \+ T; q7 M2 C__________________________________________________________________________" M3 v; f4 P2 o" Z/ R! f
1 a1 V3 \. ~. z' m% a+ c' O
Method 10( X( P3 S; Y0 ?: {$ V
=========
6 ]2 d- j6 V! p3 L6 W+ e3 H  p0 f8 Y, E$ A+ p( ^
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 M: C2 \8 R' Z/ G  SoftICE while the option is enable!!
$ H. J! D3 B8 d
: l+ I6 N, K* \This trick is very efficient:
5 o( H6 F# |  w- T6 `by checking the Debug Registers, you can detect if SoftICE is loaded
6 G6 [% H- i! N(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" ]! y4 L' l' q# o2 w- z0 U8 |7 r8 p4 ythere are some memory breakpoints set (dr0 to dr3) simply by reading their
" H# J% `  A. k4 T( Fvalue (in ring0 only). Values can be manipulated and or changed as well% x. b* F( y5 _" a, I/ V
(clearing BPMs for instance)4 f3 D; i- B" @- [0 X# `! P

, o$ h7 Y: |7 A1 ]# g6 c4 ]; I__________________________________________________________________________
* M9 r; Z% c8 m$ d- u& u7 q& V$ \: [; K( p* ^, X( j
Method 11! g5 M5 c8 J) g; [: e
=========
0 i7 L( p- L/ q3 q: r6 Y  |' [" a  }4 N1 w3 l: A- S
This method is most known as 'MeltICE' because it has been freely distributed# _# Q( |2 Y  T* B
via www.winfiles.com. However it was first used by NuMega people to allow5 @: O6 m  S% m3 n9 k
Symbol Loader to check if SoftICE was active or not (the code is located: ]9 N. ^% d7 f4 j$ g
inside nmtrans.dll)., B2 B* ~$ S4 L9 J+ H
! t+ N  u; c- t, f9 ?4 b8 N
The way it works is very simple:
' h; p0 p* \/ b8 W8 yIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
8 M0 d; r$ H, H2 s( w0 J) g; T% BWinNT) with the CreateFileA API.% l$ b' @1 ~- Z1 m, ^7 l
2 j! N' n2 x' j/ D/ c, t
Here is a sample (checking for 'SICE'):
# S. F. A6 [4 n$ @! e5 u; I5 T3 O5 l# B! Y4 Q
BOOL IsSoftIce95Loaded()
, X3 x( z7 _1 L7 ]0 N- g{
" w( |+ ?/ _- e; @' ^: M* h1 _   HANDLE hFile;  0 H" K7 \2 z6 q; P4 N
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ x' o' ?( J8 l  x9 U7 U# x- X                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# A+ Y& K8 r: {. N# C                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);% T: U- a6 x, i# p4 n+ W. ], f
   if( hFile != INVALID_HANDLE_VALUE )+ T1 k. x/ P6 ]
   {$ l( d  i' v" D) a# A6 {. J5 _  i
      CloseHandle(hFile);/ A  `2 W( U- d8 {4 C. z
      return TRUE;
/ q6 G" H- L) J4 P   }
: S  z' e. Q+ p# z2 g( W' Q   return FALSE;% {  ^) Z8 d/ X( Y  S
}/ e1 i+ Y& ^, H' p

1 o& R4 B0 C1 d9 m, N3 M1 g+ X$ MAlthough this trick calls the CreateFileA function, don't even expect to be
% J$ [& Q0 Y6 r# }8 V# Z7 Sable to intercept it by installing a IFS hook: it will not work, no way!
& Z- K( w& K1 a5 B) aIn fact, after the call to CreateFileA it will get through VWIN32 0x001F# c. O" K6 ^1 P4 b* j2 i2 E3 p5 {$ t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 N; b+ g0 Y8 X+ w* Y: f
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 s2 Y! ]# G3 ?field.
) E6 d, ]+ R. E; c" VIn fact, its purpose is not to load/unload VxDs but only to send a
5 ^5 K) J* D# o, M; kW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), T- x% a, _& K0 i6 ?
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
% ~+ j" a2 m; `- M( Ato load/unload a non-dynamically loadable driver such as SoftICE ;-).
, \4 ^! h1 v- d" ]) Q0 b3 g1 AIf the VxD is loaded, it will always clear eax and the Carry flag to allow
, ~" Z+ H5 M) p0 q1 rits handle to be opened and then, will be detected.( q7 O' y1 C4 X4 l/ T" H3 d  Y
You can check that simply by hooking Winice.exe control proc entry point+ g! r. u1 c% y7 i5 O
while running MeltICE." D# e: z2 x0 g2 c

. b/ e  i: {6 E& g$ p6 E: Z6 E1 L, T6 ^0 F
  00401067:  push      00402025    ; \\.\SICE: t' [/ J0 H3 i
  0040106C:  call      CreateFileA
' z, W  n# _4 X( Y) o  00401071:  cmp       eax,-001
& r0 f# f1 O# c  00401074:  je        00401091
" T4 |. Q% B/ f9 p& h5 }, B9 p  L; B& |5 ]8 S2 E, ]6 A: w

% ?' s4 c/ w- {( J  K1 ~* o) X4 ?There could be hundreds of BPX you could use to detect this trick.: F1 W8 r; C" T* B7 M
-The most classical one is:. J3 k8 u4 l- D  ^+ [& x
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||8 X/ H2 ^5 e" y, `, B# C
    *(esp-&gt;4+4)=='NTIC'
0 V& k& f5 _, l. N6 H  y+ V
& z" _% S8 U: l0 a-The most exotic ones (could be very slooooow :-(; d1 p) P8 k* ?, W: u$ D. \' C
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " k3 v3 Y6 M/ C/ }3 q! o. l! u
     ;will break 3 times :-(
5 s( R" a, m2 ?# h  ]0 z' D# x1 n
9 W3 V' D4 s7 n4 U& v0 g-or (a bit) faster: & H' D1 y2 b- G8 q# K
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')4 ^5 t: E; h% X- I

. A3 [0 U4 m; Z% _$ i( r   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  8 j# G, D* S5 X9 d
     ;will break 3 times :-(
% ~) L  X, I6 P- O* t# X9 v% y9 o; E8 J! N. D; w2 W+ ]9 s
-Much faster:! Y6 G& E( C( u, ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 X9 n  `0 ^7 `! o. s

5 z7 s% w% B$ Q# Q; h4 YNote also that some programs (like AZPR3.00) use de old 16-bit _lopen% P+ T- V% M% j  h% P
function to do the same job:  J5 L0 s- E/ d+ g- e8 r8 n
2 Q5 \' t! D# }( K  _
   push    00                        ; OF_READ
* g' P# T4 Y6 ?   mov     eax,[00656634]            ; '\\.\SICE',09 z9 C# G; {. D4 a' E1 X
   push    eax" d. J2 F0 c# v# @# M
   call    KERNEL32!_lopen
8 J9 @7 B! y9 B   inc     eax# z. L: b; h" Y& j9 |- m. F
   jnz     00650589                  ; detected: H( b/ j" R/ f1 P( H
   push    00                        ; OF_READ0 G) |, A; @1 `1 w! D
   mov     eax,[00656638]            ; '\\.\SICE'
; ]8 a6 L* K* j6 m" n; p   push    eax& ~0 [& V7 ^6 j% |3 b4 R0 P
   call    KERNEL32!_lopen
& G5 _1 O3 y8 h2 c1 G   inc     eax3 ~+ r* r+ N7 h8 z$ W/ @# q
   jz      006505ae                  ; not detected
- q; s6 o0 _# w8 v2 }) w% S( F8 R: M6 @3 E8 X) r

9 |6 w2 E6 Q. M/ R. R__________________________________________________________________________  K2 M% i  {% r4 i+ D
- L5 U9 `4 b6 R" }4 S, a
Method 129 z$ f3 \2 L: a3 q
=========) H- S1 D7 |. S) }- n: ?# I
# _1 H- R! V4 F9 l5 Z! R* l+ x' S
This trick is similar to int41h/4fh Debugger installation check (code 05' k  t' O' s8 n5 ~  U1 P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)5 w" ]" V$ f) Q6 B4 H/ Y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.4 ]* O% A; e' S$ w6 f
6 t6 Z4 ^$ T' n+ C) L9 H8 Q
   push  0000004fh         ; function 4fh
) x' d% U" v1 a; Q/ y   push  002a002ah         ; high word specifies which VxD (VWIN32)
: o0 i. q7 I7 W. J: O+ c                           ; low word specifies which service
- ~0 g# L- u! y8 n                             (VWIN32_Int41Dispatch)
9 p* E, o) S9 H/ Z   call  Kernel32!ORD_001  ; VxdCall- l  ^; F- `0 a
   cmp   ax, 0f386h        ; magic number returned by system debuggers% T: B- }; P! c2 ?  R
   jz    SoftICE_detected
/ F, T! [" {% T& _
, \, s0 h& V& m' {/ eHere again, several ways to detect it:
0 ~6 m! i/ D+ ~: R/ d1 u
6 o5 u8 O2 z! [+ P    BPINT 41 if ax==4f
+ Y: S3 U+ {7 ~0 |7 [! u# ~0 t' C& T! p& n3 T& j$ a
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) W( M- T" v) a& d+ E: @

9 B! t( A% G  R0 ~    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) E. K5 _6 l2 H# O7 [

- x5 ^: w, S3 Y+ Z) o    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
! i- k7 f/ i% C' Z) i9 o$ b& ]$ y0 a6 \8 T! ~
__________________________________________________________________________
- V4 Y+ b7 h3 t
$ K* [" D# ]1 u; D8 {6 UMethod 13
( T  u5 {2 f0 n=========: N6 D6 D7 a, q5 j

$ l. k$ T# X! A* [( z5 INot a real method of detection, but a good way to know if SoftICE is5 N  S/ \/ }. J3 q/ i- J) s) U
installed on a computer and to locate its installation directory.
* N1 R$ q" C, e1 Z1 c% s" I: j* ]It is used by few softs which access the following registry keys (usually #2) :0 f2 C! |# I9 H* J% h  |7 _
4 @. y7 u: D$ v6 n4 m# M3 v
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- x# r# G* d- c
\Uninstall\SoftICE
7 w3 @" b7 N( t& k8 P-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# F/ e- T' F2 I+ l# V-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) ]2 s) E, F3 o4 \1 G$ S\App Paths\Loader32.Exe  z; C& _# b" y) U* r- \- [
1 ^# _3 c) j1 D! t! e
' I7 r. B+ A; r! `& H# U
Note that some nasty apps could then erase all files from SoftICE directory! v; W- p! S; {2 ?( Z: [
(I faced that once :-(
9 n5 k( S4 W1 ~' Y: V- o/ `7 M% P
Useful breakpoint to detect it:
1 G( I; l) V7 S% a
* Z+ C8 k. H, s     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ f8 |. F* `/ }7 U8 `
( j" E9 P- P6 r1 s9 ~- c  z3 j
__________________________________________________________________________& ~  k9 u  Y' R/ ?( l9 ~2 n4 B3 I
+ A) D9 Q/ K4 Y% k% z# x% g

$ ^( ^7 o; ^4 [6 w: f" cMethod 14
+ m0 a$ h) t) w( K6 v2 F=========
/ j6 T9 z  d+ m# E5 F2 ?. \
# e+ x. e. h2 Z  c$ f' H- wA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 O+ i7 g; y" R  n
is to determines whether a debugger is running on your system (ring0 only).1 Z- {  j! J9 W, {1 D9 l

& M* L8 b& O* z6 Z( N1 V& x) Q   VMMCall Test_Debug_Installed: @/ W1 @* T' b! k0 S& h
   je      not_installed5 S9 ]' p: N0 L5 O$ P0 l
/ u6 n0 v7 n: F# g; S1 @9 y
This service just checks a flag./ Y. A; A% x, l0 y! z  H. O- g
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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