About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) k3 j8 |: [# [( b( t  N+ k" I
<TBODY>
1 \( N* }% s" W) c/ V) v<TR>
, g  _6 R: V& O5 l<TD><PRE>Method 01 " z4 T0 o3 x0 Y" O
=========+ j* X; I; D; ]- Z$ {9 Z. D' |' K

* w3 H/ T- T+ d# M6 HThis method of detection of SoftICE (as well as the following one) is3 H; U' S2 E, p
used by the majority of packers/encryptors found on Internet.  l0 L# ]* B: X
It seeks the signature of BoundsChecker in SoftICE" T/ Q) g, L9 @4 x/ C! \
) |! `, I% Y" N% w; f" N) V: P
    mov     ebp, 04243484Bh        ; 'BCHK'
) G. J8 e1 c! E    mov     ax, 04h0 R- c( e! y! y* r% S2 e% u3 z5 W1 |
    int     3       $ _0 L9 D$ G/ v( H
    cmp     al,47 k- c' [8 G: e. L6 n9 Z5 x
    jnz     SoftICE_Detected
, w. R4 a' ~- G' ]9 ?8 ]
, k  C8 L. v( K+ d___________________________________________________________________________
2 P6 g  s: n! S4 {0 O
* l% N  L" n8 u" B. TMethod 020 R) t+ [% c' A8 u4 b
=========" G  z% G+ i4 j+ d' |1 B

- \, i1 G6 `  ], ^# t3 sStill a method very much used (perhaps the most frequent one).  It is used! O% i& R; e$ C3 F
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
. K9 V2 I: `0 hor execute SoftICE commands...
  T8 `: F) d- S6 ]It is also used to crash SoftICE and to force it to execute any commands2 ]; q& [. [. n' G; K4 \8 W% i9 X
(HBOOT...) :-((  7 l3 x- k! f7 D

( G5 ^6 s8 r  y# UHere is a quick description:" T! Z- G9 G6 I* i3 f+ t7 O
-AX = 0910h   (Display string in SIce windows)
- S8 _- q; l9 W" H. ^6 `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. w9 w6 k) B' m-AX = 0912h   (Get breakpoint infos)
2 n( a  i! r( I# z! v  t-AX = 0913h   (Set Sice breakpoints)- P! B- D6 M* b3 ^+ x# G
-AX = 0914h   (Remove SIce breakoints)3 {( c+ N/ k, e2 E8 T- M4 u
! G" c3 h  Y% ]6 n
Each time you'll meet this trick, you'll see:) L! S, f1 m+ i8 o5 g
-SI = 4647h
! ?: c3 \4 t6 R& ], B: s- }2 ~-DI = 4A4Dh
" P& y$ ]8 k6 h/ \; V& `' PWhich are the 'magic values' used by SoftIce.( R- M) m0 A# ?5 @9 y) ~
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 C" d+ G( o- k# O5 O+ g' G# B( G7 v* j' I$ I% |6 D' b
Here is one example from the file "Haspinst.exe" which is the dongle HASP* ^( U$ G8 O) y4 ?+ ^) F5 F
Envelope utility use to protect DOS applications:& J4 R' c( f* i+ f4 T

9 H. j1 _8 y+ {3 N6 S! |7 i0 P4 P2 ]3 [% R7 F* V
4C19:0095   MOV    AX,0911  ; execute command.
6 T: ?: x1 c0 C* N4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; }  Z9 l) y  V$ f
4C19:009A   MOV    SI,4647  ; 1st magic value.0 |/ _0 D$ A/ a1 w; n; c
4C19:009D   MOV    DI,4A4D  ; 2nd magic value./ Q% w: X( Y. L; F0 ^. G
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& s! e4 E' M( K  i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
8 O' f# i  p+ ~; V; P1 u1 @4C19:00A4   INC    CX
1 v# |- Q( u5 b& E( j4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute4 l# t1 L# j0 m
4C19:00A8   JB     0095     ; 6 different commands., j! |) w0 m. T2 E) S% k1 c) j: _
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 y9 P5 Z2 A% l' {( F9 A
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 A6 U  i) [2 l3 v4 c
( H4 i. u1 K% {0 C" A" j' N9 J
The program will execute 6 different SIce commands located at ds:dx, which$ f9 J+ \. u: v6 [
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
; K' S) w  ~4 _3 }& A  p
) S5 H/ a+ s9 \" G* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* Q2 G$ n) l: H% P3 L, u; T
___________________________________________________________________________0 J  O! [" L3 O7 |, a
9 V3 X0 ]9 J) u8 A9 L

  H& z, u1 o, ], a" Z) YMethod 03
( c% C( P) S: ~=========4 j: p2 p  f/ J# u, Y
3 o* g! `/ A5 e( O: n/ y
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
2 O/ }' a3 b$ L2 W% q0 R  ?7 t(API Get entry point)
1 x+ R) F' u5 C; v1 T        
3 `; \3 v, W5 j' O: X) |" J
5 U4 i3 n; F7 ]( E" v! i% X1 u6 R    xor     di,di
! J, H1 \% f+ v& e- o  S; S    mov     es,di/ i( C6 `& D4 D: t0 s0 s2 s3 Q+ w
    mov     ax, 1684h       & e# Q9 C1 c5 v6 U
    mov     bx, 0202h       ; VxD ID of winice
3 r/ {2 z7 Y" `# ]" R) }' @8 p8 q    int     2Fh
  L( J. `8 P0 }* z$ G- d    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 e+ d: u* U$ i$ w( t9 k& _    add     ax, di4 i* r, K5 Y* r9 g1 t& L
    test    ax,ax8 }# \5 }' z7 g- h
    jnz     SoftICE_Detected
* `, f0 p1 e8 a( K/ U- O- X
' W. e- \! R4 W! K8 r' o  V  m___________________________________________________________________________6 I2 i9 G0 a$ L1 W! S7 M
3 M/ ]' s% i2 v  e, f) I
Method 04. A: W2 T! m. h( I+ G1 v3 t
=========; o  T/ i7 v! g4 Z6 y
* B5 D2 p9 O5 s) K9 d5 u5 `
Method identical to the preceding one except that it seeks the ID of SoftICE
6 T5 M. w0 `: R5 N  J1 tGFX VxD.
7 P  I+ a* o9 q5 X7 i& ]2 q( o4 F7 ~% S. G' R1 J! ?
    xor     di,di
9 O8 z  K5 ^# Z/ z    mov     es,di
( E; O0 g* t& K( b' ~    mov     ax, 1684h      
0 _5 R: c. `& P4 g) }    mov     bx, 7a5Fh       ; VxD ID of SIWVID
9 D: }. h' J, V7 c5 K    int     2fh
2 m0 x9 j3 \7 x/ E& W) j% v% M0 E: a    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& s0 i- B. r9 D; q* Q! o4 d: m' p; v    add     ax, di
3 Z, q( f5 m! ~* ^3 r    test    ax,ax) K) Q' y# V; S2 C' o
    jnz     SoftICE_Detected
' H8 ?2 A) E8 k8 V  ?3 A0 x# c4 j. L8 P: w0 U" T1 F) [! P; \" [- D
__________________________________________________________________________& U! s1 ?" n" r+ c) v7 _& F
' E! S3 U% V; J. @8 ]" R
. n% K. K/ C3 ?  I) e" ~
Method 05
8 q9 N. G, F/ z/ G' H7 z" i; U=========* V1 P5 I3 u! A8 h  G

  X* Y# Q; _  {7 \6 U' X7 RMethod seeking the 'magic number' 0F386h returned (in ax) by all system9 f% P8 @) r% e' q
debugger. It calls the int 41h, function 4Fh.& W" ?$ y. C2 F7 x
There are several alternatives.  - Y0 q6 f. t) g8 _+ ]" A

9 X$ |) v5 {" F' X- F8 r$ \1 gThe following one is the simplest:
" d: W; Q' E1 t1 d, L4 K8 g6 g. T, G; o* h  q
    mov     ax,4fh
9 h, s5 `( c8 u7 Y4 v4 f3 E* S    int     41h
, d8 ^; U6 t- Y% n: ]    cmp     ax, 0F386
' V( r# ^, m! W6 c# I    jz      SoftICE_detected
* s! b; R2 a. i& r+ H8 n& J0 a# k! `6 t( i2 b
/ H7 A- F8 c2 j; v% {/ `7 b
Next method as well as the following one are 2 examples from Stone's
6 w9 |* P5 @* E3 Q: W9 Q1 X5 z6 }"stn-wid.zip" (www.cracking.net):
8 y1 \; @" ^2 g5 @, I) N! N2 p1 ]. h: b9 d% [
    mov     bx, cs; _" P% y/ i+ W$ G6 V  o
    lea     dx, int41handler2  n% j9 O: y& L8 f
    xchg    dx, es:[41h*4]+ l" d$ g# w9 ]/ b4 y# W. o
    xchg    bx, es:[41h*4+2]/ M/ S4 h* O5 q, {- X- P
    mov     ax,4fh
% c+ D6 j5 `7 m' b    int     41h
( r. s7 n- m2 j  \' X+ [7 q% p% Q    xchg    dx, es:[41h*4]
9 O3 Y$ G  I% y    xchg    bx, es:[41h*4+2]
; M  d6 q1 R; C2 o9 g* F    cmp     ax, 0f386h, U# g6 [4 o  ?" F* L2 J
    jz      SoftICE_detected
( i" s+ T5 N6 t$ R, c% I$ _3 U( K' a. L7 w# B, F* ^5 l4 {
int41handler2 PROC
, H9 x- n9 V1 g$ p    iret# i+ r5 [- Z1 Z, T% n7 ~
int41handler2 ENDP0 v. P( d1 H# O5 K8 J* @

) G) m0 E0 }, k' z* \9 S; T# Q# E8 p' o
_________________________________________________________________________9 {0 C- H4 H) _: M. T" m: u
3 s4 x: T! h2 _; b1 j
) }8 l; ^' b8 z) D9 ~
Method 06! l& R4 B9 u4 e
=========; H) Q1 H6 k9 s' D+ w( g
2 }+ j* F" a9 ?0 `0 f5 x: d) i4 d
7 J( c; m: o! k# v% P. D# U, P
2nd method similar to the preceding one but more difficult to detect:
0 t# G4 X* B4 s  ~
5 l/ U0 m( d0 r$ y
% T) L  h6 T" D( ~int41handler PROC
4 b! p0 g/ v' r    mov     cl,al
2 `$ [' r. ]" Y    iret/ y8 l  I  e0 L
int41handler ENDP
) R) ]( S  J- H- b1 L# z8 q
! F! V( p# p  w- a  R
3 H+ y& Q" H2 H. M! V0 X, c6 D    xor     ax,ax2 j; Y  C" D  d) y
    mov     es,ax6 K' t% Y  a: I/ r, C/ e
    mov     bx, cs
$ W) N# E4 h- d8 f: R  H    lea     dx, int41handler
7 l6 D' {8 `9 a    xchg    dx, es:[41h*4]
9 h) s/ D% ~4 a. O    xchg    bx, es:[41h*4+2]
8 @# r: i- P3 C5 c) o    in      al, 40h3 l# Y( G' Y/ d2 x  Y6 D/ X/ N9 f
    xor     cx,cx% I7 o7 b4 P! T) O/ f( }
    int     41h8 Q$ H4 M  g3 F* ^
    xchg    dx, es:[41h*4]* G" i% X1 T) T* e2 N
    xchg    bx, es:[41h*4+2]
$ g( a: r- b* y# ~! S: |% z    cmp     cl,al' H- z3 R+ ]# p9 `* l2 b
    jnz     SoftICE_detected
" p$ E' z  ~% R* W
# T# ?* V* @$ B  K/ b_________________________________________________________________________
) ]( ]0 \5 l; d4 v+ J: C* ^  b6 K- n/ j/ x& }) @$ i0 @( o9 A" A
Method 07: u( R/ P3 t4 n) W; h4 K7 O; |
=========+ h$ y& h, i, ^( f" i" L1 v, ?' z+ s

5 q+ c1 s1 M: }/ |Method of detection of the WinICE handler in the int68h (V86)
8 a1 W% V" t) [5 z( V: T& T* J( J7 s% a
    mov     ah,43h
' j; u6 r8 v. }7 W& Z- s    int     68h
: F1 ], e, A) s4 F1 x; @8 f1 P) Q    cmp     ax,0F386h
* U+ ]. l3 d4 i+ p2 {    jz      SoftICE_Detected
( H' s7 f; E* _6 @) H
% C/ ~9 v9 }9 l4 Q  [9 k# K* m# e, F( y) R: R, K
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
! m( P7 [& P0 v' D   app like this:
1 I! E$ s1 I! n8 G* h+ m6 y5 k9 y
   BPX exec_int if ax==68. U% w  c) t1 L% Z+ s
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ U  U. Q9 o' @) I3 O" ]& B   located at [ebp+48h] for 32Bit apps)
3 ^4 O5 y+ P8 |# W__________________________________________________________________________  S8 `* h" b9 z: s" r

9 N7 C9 Y, J. E. R
2 B) h* x! ^3 `: b+ eMethod 08% d- z6 r' T0 j
=========, A8 Q8 t, T! G

4 N# ~) s; e6 u: ~4 i- BIt is not a method of detection of SoftICE but a possibility to crash the
' V6 [' b, Q$ Q% Tsystem by intercepting int 01h and int 03h and redirecting them to another3 ]: z) T6 f0 \. Y. M1 |( _
routine.
' {* J& |& L0 L0 H5 ^It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 U8 P( r" U5 [# M. d$ L
to the new routine to execute (hangs computer...)/ p0 e. a5 r, j
1 l9 u* Z( }5 f7 U* [, X6 v
    mov     ah, 25h" c7 @7 R! r  E- ^; k
    mov     al, Int_Number (01h or 03h)
5 h$ i2 \6 |' U+ ~    mov     dx, offset New_Int_Routine7 R8 E: \8 c( O" m# m# |
    int     21h2 ?" @' e  F4 n/ B; [- H
, J/ [, p6 V  g. p
__________________________________________________________________________0 y1 o) e# [$ v. H" L) U0 t
* Y$ b! O) M: d: V0 g
Method 09
1 _/ D" X! a5 d& z=========3 s  }, {. y+ }' t5 z8 z( L
. ~! z- I6 o% y2 Q& ]
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only2 x4 n6 }% B$ G
performed in ring0 (VxD or a ring3 app using the VxdCall).
  ~6 q: Q. T4 ]& YThe Get_DDB service is used to determine whether or not a VxD is installed' @, {% }1 d  F6 b, z! j
for the specified device and returns a Device Description Block (in ecx) for" |# Z0 G& s% Q/ s) W6 h
that device if it is installed.
. K7 T4 S- j" D2 x
9 ?  o& B  h+ v" T1 a& ~# h   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 q# F! }* R+ T1 H3 S   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% r# t- G- W3 ^! t8 _6 a9 d! [, G   VMMCall Get_DDB" @2 I0 H- [$ @; u, l( X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 V$ j! G* n8 i. }" z! ^5 {* s# U6 E' z  Y5 D  `& C& d
Note as well that you can easily detect this method with SoftICE:
$ ]1 K& k8 }/ I- t   bpx Get_DDB if ax==0202 || ax==7a5fh
, H- g; ]0 O; |, _7 i: w3 J) C! B' `/ t" s4 f8 X
__________________________________________________________________________. j4 y, I; ~5 R3 X: v$ z  F+ u1 K

( d3 n: {! |$ y& F9 ?. h3 V6 PMethod 10, H# C( E  r3 ?2 y$ N
=========. s0 g, j' d1 i; ^+ a0 Y

3 L$ D5 d- O) D' r( A1 ^! N/ K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% ~* {, K5 D# ^8 E/ t/ q
  SoftICE while the option is enable!!
6 @% e: i& a$ \7 V9 U$ E* u
- Q/ n/ x' l4 T1 n, k( CThis trick is very efficient:( N3 ^8 T% q* C7 Z- u( a' L0 W! B
by checking the Debug Registers, you can detect if SoftICE is loaded
* m1 O; L% O9 J( b7 t4 r2 ^(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
0 @/ ~8 E! u$ wthere are some memory breakpoints set (dr0 to dr3) simply by reading their1 s+ z9 z" X4 p9 H& Q9 G
value (in ring0 only). Values can be manipulated and or changed as well
" J! n, |/ t% i0 U(clearing BPMs for instance)! [' V% x9 ?: c4 W  h
9 E# l, B: {, ~, x
__________________________________________________________________________) a* F3 q1 A- Y. k2 S2 J' i

# O' D9 |$ ?& _. m6 zMethod 11& P7 b0 U4 N; w7 L" H
=========5 r# c7 z' \; Y2 o1 l

5 d( y3 _4 q8 I+ ?/ LThis method is most known as 'MeltICE' because it has been freely distributed6 _9 n+ y4 C' z+ M" h" Z
via www.winfiles.com. However it was first used by NuMega people to allow7 ?3 d5 n/ x2 z" X$ a# A
Symbol Loader to check if SoftICE was active or not (the code is located
6 a2 d- w' X" |7 c2 R$ R8 qinside nmtrans.dll).
, F1 N( o" W/ K( T. R! F" Q5 k# q  j: i; j0 H
The way it works is very simple:
. U5 r3 o% n2 R+ R* gIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( B8 ~. a$ b' L, c; c2 jWinNT) with the CreateFileA API.
+ z% _8 l! V) N7 L3 \; n5 i
7 A+ \8 `1 k+ B5 H) d) W& VHere is a sample (checking for 'SICE'):( o( p. v. a  ?+ n8 O0 a. S+ @
6 o( y2 P; Q+ a- G, L
BOOL IsSoftIce95Loaded()
2 f  O, O. @1 e4 P9 I$ R: {{3 Z9 X, j( a2 p9 A+ ?
   HANDLE hFile;  8 q, I" L8 S2 A$ h4 s
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 I, U* o) s' z+ V0 z6 \
                      FILE_SHARE_READ | FILE_SHARE_WRITE,% U* j# x( ?6 b& X" Z- r+ p8 i
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 L+ W. R* ^3 m; F
   if( hFile != INVALID_HANDLE_VALUE )
' E: `/ U, S; \8 h9 L   {
" n  O+ k( |( z! ?) }( p      CloseHandle(hFile);5 @- d' O. Y2 y7 b3 S- n
      return TRUE;
: @% [$ \1 q7 k( C* Z   }
: t0 V: j5 Z& w0 e" m4 T   return FALSE;( S* f" [+ E! v3 [. X4 }' k
}0 H, @! V) E- K, g0 \
: o: H& m5 B$ B$ v
Although this trick calls the CreateFileA function, don't even expect to be* p7 {1 C; O. b- M# Y
able to intercept it by installing a IFS hook: it will not work, no way!7 Y9 b& O( F0 Q5 h7 _" n( B
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: ~+ p9 I$ D7 v
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
/ q1 V+ `9 S8 M' ~and then browse the DDB list until it find the VxD and its DDB_Control_Proc
. Z9 z0 @: k& H3 C2 afield.# \/ y0 w$ L8 f$ K8 G/ U! Y
In fact, its purpose is not to load/unload VxDs but only to send a
( H" u, M9 T) p* mW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. d; n" D- ~9 Q" a& a/ ?% Y7 c. ^to the VxD Control_Dispatch proc (how the hell a shareware soft could try
! ^! a, }; p9 U% Ato load/unload a non-dynamically loadable driver such as SoftICE ;-).: k6 {: |3 M1 g( f9 x8 f. S1 ]+ R
If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 Z, _0 Q& v) k$ ]  Wits handle to be opened and then, will be detected.0 o' R. x' T; E, v
You can check that simply by hooking Winice.exe control proc entry point
8 l4 w. L: }2 \) ~while running MeltICE.0 d9 o; ^7 n: e" c4 Y
& H! }3 S$ M3 f3 X$ x/ T

! R1 [1 \. D/ M/ M  _4 D  00401067:  push      00402025    ; \\.\SICE
9 C/ s; T. C' s" i  0040106C:  call      CreateFileA% K. y+ m1 @* ~: {; {' ]# D
  00401071:  cmp       eax,-001
; C2 W8 g- W. O# g  00401074:  je        00401091
9 @& n9 Y) p7 i9 o) l& A
* q6 k6 [* w' p7 f8 Q) l4 l0 [% R
There could be hundreds of BPX you could use to detect this trick.3 a' F  E. a! X" L( m
-The most classical one is:
) [$ X* L( v" P$ ~( z  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* h  Z* p1 J9 m$ D! M* `  Z# p    *(esp-&gt;4+4)=='NTIC'
) D9 j2 }. V& u& u1 T9 X5 k, Q8 s; U. l7 D  \4 N
-The most exotic ones (could be very slooooow :-(  H. p8 K/ z9 w5 t9 J' K
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% {! J) ?8 ?! P1 {# K9 n' b$ i  P     ;will break 3 times :-(9 n1 `7 l% c  g, M

/ \+ v+ Y3 d1 ]! c-or (a bit) faster: * P# h: B7 ^3 O$ V
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 \$ t1 G/ J  w1 ^* E! ^9 r- Q# s( q) [
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & m# ]: ^  G# V$ f7 V/ F/ H. ^
     ;will break 3 times :-(
( |5 K- {8 z  v, H* |* s) ~! {! d' T+ K  J* p6 b
-Much faster:* O1 Z  V6 V6 w: K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 }8 ~( t; S. K3 B

. t, ~) E/ m3 y1 q( UNote also that some programs (like AZPR3.00) use de old 16-bit _lopen% N5 A) u4 `9 A6 J
function to do the same job:
; q, {- G$ j+ E9 f. q
! c4 K6 c/ _' T4 i; D# s, O   push    00                        ; OF_READ
- Y6 K1 ?6 O- [' Z! j+ o7 N   mov     eax,[00656634]            ; '\\.\SICE',03 }0 \7 a* @2 ?
   push    eax
7 w* W2 R: e& b% @7 a   call    KERNEL32!_lopen2 o. I1 D6 c8 A
   inc     eax
" W2 }# y6 |# T* m$ ], X/ p! ~! M   jnz     00650589                  ; detected* T+ I. H3 \" h1 m' P0 _; a% ~
   push    00                        ; OF_READ
, {* z. a1 F8 @/ e: ?& n   mov     eax,[00656638]            ; '\\.\SICE'
: W8 p- P" ~/ F7 Z. @5 l3 H( C   push    eax
2 L1 m( ~6 t# }+ a7 M   call    KERNEL32!_lopen
2 o8 b0 f9 n; R$ D. X/ i* S   inc     eax9 h' c: o$ A) D6 @' r
   jz      006505ae                  ; not detected
3 h" c2 L! f0 ~' _5 T6 M, P3 p$ Q; z$ D9 c' E; j
. |" Q' _6 v% r
__________________________________________________________________________
7 e4 f& D/ v3 a. Y2 e% M7 l# Z1 a! W6 l
Method 127 e8 l8 A& ?4 X1 l& s2 `
=========4 Z6 m; r# C+ X9 a$ c

( d% F  S) o3 [/ xThis trick is similar to int41h/4fh Debugger installation check (code 05$ {1 T8 J7 l& Z( @4 N
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' O! x  Z; n$ Y6 Kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.: P" Z) S- j. l" a5 O) ^
! g! V) Q" Q/ }1 Z3 f8 \) C7 h
   push  0000004fh         ; function 4fh6 ]+ g% N: {  A! V4 L9 F! N4 k  ]
   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 w  q8 ~; o% P% R3 ~- `                           ; low word specifies which service; ]# j$ ?7 Y' h1 |2 u
                             (VWIN32_Int41Dispatch)
2 Y5 I& a2 ^9 \4 p8 ^2 W: \1 M   call  Kernel32!ORD_001  ; VxdCall9 q1 e$ r( h, @5 K, \2 x, _/ D
   cmp   ax, 0f386h        ; magic number returned by system debuggers) z* v) m% Z' W1 @5 @+ j- N" e% u% \
   jz    SoftICE_detected: s/ L$ g& o/ }: w" u* a

8 V- `9 i7 q/ \- h3 X- R8 l; ZHere again, several ways to detect it:6 ?8 }. C7 P$ ^, H. H, S
0 e; _$ f* x; j# J+ B
    BPINT 41 if ax==4f) ?4 T/ N! k- H5 W: z
4 F+ P5 @! z( x) t; q1 O) O- [4 M, {
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
; [0 I9 j7 j" l  q1 q7 f: K' n! h2 Z3 x8 c4 R; @1 {3 r' e
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 u) d$ r5 b3 o' r3 j8 `2 Z2 K6 F
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 F# F) O% j1 f% H2 `
8 M" a! V4 L8 L5 ~3 ]& k
__________________________________________________________________________
, {  X4 Y+ n/ s6 j" J
8 |* z3 ?( g; o9 u6 N: qMethod 13
' ]  C" N; J0 D9 U=========, S( r0 y% M( F% Z' V$ a( f
+ E* A$ @* Y) f
Not a real method of detection, but a good way to know if SoftICE is5 n- h& A  l% H0 R- Z4 f9 N
installed on a computer and to locate its installation directory.2 Y6 U" w1 ~  |; n' t1 H! d% d7 ~
It is used by few softs which access the following registry keys (usually #2) :- |' w* h8 z9 s% b" s

( j2 Z4 r# Y' @. ^. P-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 U, \+ p. K8 T
\Uninstall\SoftICE
# [0 I, P. \6 K- n7 ?-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* @0 ]; t4 {( V. X+ W, Y, G4 o
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! h3 r& _6 K) ]. z6 u( S\App Paths\Loader32.Exe+ m' Y. ~6 O1 n4 r* y

! U- f( {9 @) ^- n  K9 k" ?2 d+ e  ^
Note that some nasty apps could then erase all files from SoftICE directory
; t! f' w( Y4 n4 l8 d(I faced that once :-(1 I) q# a( ~1 o! t" s+ [' n

8 C+ W7 O2 `+ \4 OUseful breakpoint to detect it:0 b! K2 m9 P8 ^8 l3 e
4 O2 Z$ ^0 ~" Y9 u* j, r7 d* e8 e
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! E; O6 G+ |2 G3 R1 w6 U6 j

8 U* W. t  i5 `: g& x4 G__________________________________________________________________________
! a0 h. H* X8 K, q8 E# J# Z7 T" @+ }

& V+ m8 u" g; d& T5 X+ f; ZMethod 14
% i8 d3 g- O, A5 j$ w& V=========7 [, o3 K: s+ M" \
6 g; ~- N1 t3 F
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ F) ?2 c) `7 `5 B3 i* Lis to determines whether a debugger is running on your system (ring0 only).0 T# B  L; j* ?: @. q2 `; n! d7 ]

' D, {5 I/ \3 O$ s# X; v/ s! k3 u   VMMCall Test_Debug_Installed1 J. i( u7 {2 U7 N8 B) ]
   je      not_installed
- T0 T. P: l. R' ^4 A/ m; F* k6 l, \; v/ `5 j# S
This service just checks a flag.7 M0 e# k7 Z% q8 N, [3 U0 ?
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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