About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 l8 [' Q7 }- y. F
<TBODY>
& b3 ]) D7 ~- ]6 y+ @6 ?. {" D<TR>( K, a. }. W) X  m6 [: @  f! }7 N- Y
<TD><PRE>Method 01
0 Y4 }8 }- v+ C( [- {% s1 \=========8 O, Y& M) s8 Y* Z2 ^. E
; T' U/ b9 L9 f  s& k8 j" @
This method of detection of SoftICE (as well as the following one) is
8 `  ?8 Y" Q. F0 w% c2 v  Bused by the majority of packers/encryptors found on Internet.# q% c1 C. \) ]- |8 J" T3 j4 H5 q5 d
It seeks the signature of BoundsChecker in SoftICE% X/ b% |2 Q. u4 w* a* _
( Z- M7 v4 D0 j3 S  f' o* i. w$ s
    mov     ebp, 04243484Bh        ; 'BCHK'* w( E5 {: T' q! A" q' s
    mov     ax, 04h
+ e4 f: t2 J& B' n7 t9 [( [- y    int     3       ; A! h! n/ ^: O4 \$ @" X. y
    cmp     al,4* S+ x/ _6 h. Q1 O, s0 m) T; t& z
    jnz     SoftICE_Detected
* a2 ~+ c6 H& Y; N4 Z8 |1 ~4 `; |* ~' o+ [. I9 D8 p! F
___________________________________________________________________________
& H, N6 X0 y& ?! {
1 b; z( V  ]$ O1 ^) YMethod 02
; f8 s+ T) \. K=========, G' H# B, z$ S4 l) a9 {' x

1 ?6 z, p; n& F9 U# EStill a method very much used (perhaps the most frequent one).  It is used
0 W) V! u/ L) I5 qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 s$ n& v+ b( M  M
or execute SoftICE commands...
! J+ {, J* m' x& n5 x2 jIt is also used to crash SoftICE and to force it to execute any commands
# c9 [8 ]2 ]" f) D( y, ]+ X6 h(HBOOT...) :-((  8 Y4 q+ {5 ?: K/ V9 t; M

3 }) O" ]0 O5 Z9 o0 a+ ZHere is a quick description:9 o' Y+ g+ u* n; a
-AX = 0910h   (Display string in SIce windows). Q' H/ K. C' l, d" D2 x
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)2 r0 E! e, K3 I
-AX = 0912h   (Get breakpoint infos)
0 Z" ]) r5 X& j2 S" s-AX = 0913h   (Set Sice breakpoints); N. q# H; A6 J# T/ f5 d
-AX = 0914h   (Remove SIce breakoints)' f1 w: S, S% V9 K" Z+ _
& T' r* d8 j- u. R& R; A$ @
Each time you'll meet this trick, you'll see:  E/ w  M, C& l  |
-SI = 4647h1 H" B: m2 J; w  M$ d/ S! U
-DI = 4A4Dh  L) }: H- t: z( M& g8 X/ ?
Which are the 'magic values' used by SoftIce.+ U& F# c8 Y) q3 ~9 z. A4 L
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.  [) J5 `+ J- I# s) R
. G* w# o- \6 R; w9 {, N
Here is one example from the file "Haspinst.exe" which is the dongle HASP
8 ]7 n1 ?4 p+ \3 V' b2 V4 ~+ PEnvelope utility use to protect DOS applications:$ Z, F( v: I0 v* ], |, w
1 Z/ s  }! g/ ~* m
2 {2 ?2 Q+ `) w, H
4C19:0095   MOV    AX,0911  ; execute command.
# e- g' a% r& G2 q( i# ?  e4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 `! S4 I1 F& J" m) O% d2 W4C19:009A   MOV    SI,4647  ; 1st magic value." m6 K, u) v% f7 n$ h! H' v
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& I* _0 O; O$ @3 m% m8 f4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" Y2 U, L8 P$ c1 e4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) t- e" G1 c1 K' z- G1 K
4C19:00A4   INC    CX1 Y& x: G1 Z0 M" _+ W" u
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
% l+ k! v. Z- Y) y# I4C19:00A8   JB     0095     ; 6 different commands.
2 M; A# Q3 P. P  \4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 B1 l- t" D7 N4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% g- ?) ^+ ]: s5 q( s- v3 c( ~

7 d9 H7 a, n9 G& F7 I' hThe program will execute 6 different SIce commands located at ds:dx, which1 R1 G5 z& ~4 J
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: W' |2 i1 ^4 I

2 u$ y- u* J! @, O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.0 H$ Y7 h% z# k! d" }5 U, j
___________________________________________________________________________! l7 |) z" q% _- I

# v' }  j4 j+ B. b1 q4 e
6 {: G; P' H" t: C& @5 G  @Method 03
+ `' N3 P- D0 ?8 z1 F  f=========
  c; b" M* ^5 H* P) g
- w4 S; m2 e/ N* {5 z8 V8 ?' gLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( ]8 [9 p; J9 k& V( O. t4 @5 Y5 @  S
(API Get entry point)
- p0 c6 i6 b! d& S- O; n        0 Q  Q5 Z: v* E6 h

$ P0 P6 c) ^% [+ ^    xor     di,di
" J& S+ j1 ?9 n, Y" U    mov     es,di
) E4 v$ Z! r/ M# ]. z+ {  C+ ~    mov     ax, 1684h       / K7 S' c/ Z2 @+ n# L2 g7 t8 c  K
    mov     bx, 0202h       ; VxD ID of winice
9 ~" I; X" z( _7 O9 A6 r0 }    int     2Fh
0 K6 D- x: \" i1 T$ P    mov     ax, es          ; ES:DI -&gt; VxD API entry point% l0 K: H: w: q, F, n4 O
    add     ax, di
1 V$ k4 l) r5 h: D# M. D    test    ax,ax
5 A. ]1 @* `% w7 Z1 L: t- ?    jnz     SoftICE_Detected& M4 ?! n5 z* I% @8 C
; \# Z& q% f( J. A) V9 ]
___________________________________________________________________________7 `" @- V. H0 L4 A  o
/ ~8 L& Y+ }8 M, [
Method 04
( U3 G$ E4 u  P( H& F4 }=========
. l- e. q% l! f: ?# m6 p; ]  S6 f" v% x+ U
Method identical to the preceding one except that it seeks the ID of SoftICE
3 g& z& S: f) S) xGFX VxD.7 B1 y* m. `8 p. Q0 w
3 V$ H3 }, A/ y& J5 Q
    xor     di,di% F! X# K& }  h
    mov     es,di
, }( t! c, X* O* C    mov     ax, 1684h       1 K8 T: ]4 S: b0 J& K5 E2 Y; K) X
    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 V, y, N1 J2 a. g9 u* w" v" }
    int     2fh6 d  n* J  W1 K9 j! p
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  y/ I0 N/ }# \) C    add     ax, di
* H+ ]& d& f9 I! a    test    ax,ax
' @# l2 K# v; y4 y& I8 F  ^* I    jnz     SoftICE_Detected: d5 Q, t( [! Y# I0 W& G% f
. d) ?1 M) T* V3 e( u* o/ G
__________________________________________________________________________7 j0 W: a9 P% A0 Q: |& m7 f; ^

2 u/ Z( ]: b% J9 Y4 P! Q, \) X8 C/ L8 ~: j- m
Method 05
+ R& s; L/ L  U+ f9 b* q0 N4 t=========
3 R# j6 H# M$ h# q" c) h& |) V, @
7 K8 ^1 i: E1 V& d) BMethod seeking the 'magic number' 0F386h returned (in ax) by all system- B3 n4 Y- S4 |8 \  C% a
debugger. It calls the int 41h, function 4Fh.
" u1 }( p% L$ C$ D& PThere are several alternatives.  
+ T& |* c+ V/ C7 Q5 }7 H( W% l# }( ?+ ]+ O( u, C
The following one is the simplest:
! y2 X" Y. b% C( _& K% w; `0 e4 |- g$ v" _6 I6 z
    mov     ax,4fh
8 M1 b6 q, j& f5 Q) f8 Q# N" t/ \4 l    int     41h- r% K* H8 g# f( z; {- E; v
    cmp     ax, 0F386
+ T+ V- f2 k. |/ c1 N2 i    jz      SoftICE_detected9 n# G# ]7 p2 Y! o

5 g0 `( |8 q! h/ x- S. D0 R1 w
" Y$ J; }2 v% @+ c. SNext method as well as the following one are 2 examples from Stone's
$ t" \3 t% ?" c4 ?/ t: `"stn-wid.zip" (www.cracking.net):- k8 C9 [( K+ L# R" ?  ^
2 q. L3 n$ z+ y9 q1 D
    mov     bx, cs
  r/ H. S% B5 T1 @# K    lea     dx, int41handler2
, {; ]" Z( q/ R    xchg    dx, es:[41h*4]
( F; Q& l/ q9 I; \    xchg    bx, es:[41h*4+2]" G! x% p; T! r+ v' V, k
    mov     ax,4fh
5 B9 n- A$ [# D( z4 H    int     41h
; p5 w( c* f( `  U0 ?- Y3 I    xchg    dx, es:[41h*4]& `% E, m* y, `& E% f1 Q* {
    xchg    bx, es:[41h*4+2]& R6 ?4 Z# r* {) y. k3 ?7 ^
    cmp     ax, 0f386h
1 e# q8 I: @* x6 B' f    jz      SoftICE_detected* A! t9 ^5 j8 @3 |" R' ]) e8 `
- T) `3 p( Q0 ^8 d$ n
int41handler2 PROC0 W) V3 c' y1 Z
    iret
: _% x4 W4 h- O5 D6 q/ i' [int41handler2 ENDP
1 D" I! o2 P6 S9 F5 E1 S
, I& ?7 o- x. k/ _
4 D6 u2 g: P2 q! P$ I% [_________________________________________________________________________" G) _; j7 M4 {* n" v
6 V$ o! N! Z% {7 \) }3 `
# Y' A3 J1 X; m& X
Method 06
. d. [: t3 S# C& b: c=========9 a3 d. T  j, j* W) O
. |- j6 }5 P* n6 D' M. _' X

6 v" h# _8 Q+ M; r2nd method similar to the preceding one but more difficult to detect:2 G3 U. g5 x- T/ S  M
1 Z. F" ?9 W! k, H' V8 P' a
/ V+ {4 ?! w) _0 R6 ]
int41handler PROC( q  u: f) j- J
    mov     cl,al
4 S! _8 T( S. B3 J    iret
  \, w% o5 _6 L* P5 G! jint41handler ENDP: B& i1 c7 H6 V  z
0 D  L/ K  R; ^! Z

- L4 V, Q) L5 ?, S; S    xor     ax,ax
: T9 k4 Y4 g: B4 A3 m+ s    mov     es,ax
) p# J$ k6 ]6 V+ F2 k7 n    mov     bx, cs# L" [9 U* \( K2 X! R
    lea     dx, int41handler" \. k) Z/ j5 H# o9 ?+ Z6 c( p
    xchg    dx, es:[41h*4]
, l: p7 ?& R' D& a) }6 X- ]    xchg    bx, es:[41h*4+2]& I5 u( U5 w; S3 `  D  M' H1 Z+ ?
    in      al, 40h
. d6 O5 U: [7 o( I    xor     cx,cx
4 x0 b4 a0 t, r6 \! U/ ?8 n' R, @4 m    int     41h
8 ^- }& e! H5 m% c4 o! E4 j) [    xchg    dx, es:[41h*4]3 e& {, t, W" l8 Q  M6 J2 T' p" T- }& L
    xchg    bx, es:[41h*4+2]0 }; w- ~( L4 a' N, X/ ~$ r
    cmp     cl,al8 V2 e, E  `* j0 U# q
    jnz     SoftICE_detected0 X  k% D/ }6 F
9 U$ h  B, ^5 Q
_________________________________________________________________________, P. ?" Z$ E2 E0 w
* f# g- j0 Y' E- f
Method 076 `- G3 q. x1 `9 J- Z
=========
% |' s" S/ w- L8 T" x
8 ^- `6 l: p. fMethod of detection of the WinICE handler in the int68h (V86)# J" `8 ]! b0 I' c' A5 u
) j6 w8 e7 N% j1 e3 Q4 Q8 m1 K' f
    mov     ah,43h
( E: s3 @# N' S( u; A* |2 V    int     68h
7 u4 S8 m2 H& n3 F! ?    cmp     ax,0F386h6 r* g- y9 G) M2 F$ P: g; t2 m
    jz      SoftICE_Detected- \" y: V+ U9 Z1 L: |0 k- p

. ^& F" j) a6 ?( v  }
9 `) T& W; F3 b/ \/ F=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& r) W) X6 X. u4 o5 G1 k
   app like this:
5 u: i6 \# `! H/ S/ ]  ]3 m& g+ D, t* @6 a7 u' y
   BPX exec_int if ax==683 H: h9 l' ]$ Z! o% J0 A
   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ g, `9 R# L7 f9 N9 E   located at [ebp+48h] for 32Bit apps), E* D  X, r5 m- s* `
__________________________________________________________________________( V8 F- o4 F1 f  h, _2 h  _
" y( p, ~/ y) L% k
* C# O; F9 n. e. w8 _7 z# m
Method 08
- S* z7 r! S% V- t! f0 x0 V/ k=========& C; P: ?6 n* g

, ^9 b: d0 H' Q! A1 k* uIt is not a method of detection of SoftICE but a possibility to crash the
* V& U+ |) F4 q' \; |6 x. }system by intercepting int 01h and int 03h and redirecting them to another
) k0 o- p" }" Y; F: [3 Croutine.1 C5 Y* ]5 R9 P- b1 F8 d
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ f2 I2 ^2 z8 H+ ]+ ~
to the new routine to execute (hangs computer...); n% k- O1 C+ S( q1 W

( G+ b8 ^1 E5 K    mov     ah, 25h) S, S% ^5 T; E* D+ v8 y
    mov     al, Int_Number (01h or 03h)
, ?% G3 F$ E9 G+ O# T' |$ r    mov     dx, offset New_Int_Routine- m6 K# l% x% d4 h
    int     21h5 ^: v. S7 o# |% K" u
& x: R5 C  I+ a  S( ]# b+ X
__________________________________________________________________________$ l; ?3 Q* z- ~4 R* _

3 j2 F" |+ q1 pMethod 09
3 k/ X  Z! P) I. }/ V% }% u/ K. k=========
. E2 A: ?, R3 \" V
6 s; ~: k$ Z, D1 A- u+ WThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 L# |( w$ i  K5 w8 c1 nperformed in ring0 (VxD or a ring3 app using the VxdCall).) h6 g2 l6 F: }) G/ x  G
The Get_DDB service is used to determine whether or not a VxD is installed5 e2 R6 x8 R& j
for the specified device and returns a Device Description Block (in ecx) for
% Z0 }) R' R7 E$ T6 jthat device if it is installed.$ ~' U8 Y3 |9 K4 i
3 k$ o" c/ A  h/ N9 l3 ]
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID0 f! n# ~4 J$ G; p9 Z0 R
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 f3 l! S$ @7 T   VMMCall Get_DDB
3 [7 C  `" P  i0 u$ N8 K   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! d( W( x8 V, W

3 b9 e" d4 }, ^8 M- HNote as well that you can easily detect this method with SoftICE:
2 G, L% x; _/ y8 t# R( P   bpx Get_DDB if ax==0202 || ax==7a5fh
8 u8 o7 d( ?1 y; T/ A; x" C
( o1 L( L& K" P) s1 T__________________________________________________________________________
8 `) o- L0 e8 ]. i; T  l8 {' w: q  _1 ]' ]5 s( V+ @6 C
Method 10, B$ I/ L, {! W/ U" _- T# j
=========
  ~. Z& n& A7 M7 I) q: S, t6 ?
) v! P9 E" j4 g' S2 |% @1 p) @, [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ E, d- \1 @6 A: l& e4 H  SoftICE while the option is enable!!3 N  M+ F; }9 b, a  `! G
2 g; o+ v: B- j/ e7 [8 W' L
This trick is very efficient:% T- h! Z( k& C! Z3 Q% a; h" u
by checking the Debug Registers, you can detect if SoftICE is loaded
6 P9 O3 m. F/ v: l* Y: x5 H(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
3 S% C% x; W- }1 kthere are some memory breakpoints set (dr0 to dr3) simply by reading their
5 m) C) x' w" h  \8 zvalue (in ring0 only). Values can be manipulated and or changed as well. h( b: w  ~( V5 i6 Q2 c9 P
(clearing BPMs for instance)& z7 k$ j( m7 S6 e- k1 X6 c; D$ o. u
: U' H/ Y6 X% r: n5 g. O9 O/ f: \
__________________________________________________________________________* ]( {- m: M  ?  F+ `9 R5 N) n
1 e1 q9 z9 q8 X- B! Q/ m  W0 K
Method 11" b# ]$ W; _) b. y
=========
  {* g2 A+ M, v  ^+ B1 R. {$ n/ v7 r  S
This method is most known as 'MeltICE' because it has been freely distributed5 K6 D5 z4 `+ s4 Z
via www.winfiles.com. However it was first used by NuMega people to allow
1 D% F# r* D! I9 v6 HSymbol Loader to check if SoftICE was active or not (the code is located+ T2 X$ g1 a* g. e, `
inside nmtrans.dll).
' a: T8 _  V) t& t9 @2 `6 n9 D: l) f+ _) y' E
The way it works is very simple:& b$ S4 H; h+ R
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 f' V1 ?. ^& N* F9 G3 y7 `& _
WinNT) with the CreateFileA API.
# _# m5 x7 Z0 E2 p2 D# R1 h/ V2 p- d4 T6 k0 ?/ H
Here is a sample (checking for 'SICE'):
& o: `1 Z$ y  m4 O; |8 h" K5 b3 L7 u3 F
BOOL IsSoftIce95Loaded()
" W& u: X, v  F( G# X: i: A4 V0 D{
3 e5 ?  }% J3 B2 {   HANDLE hFile;  
* p8 b1 _9 u  z8 P2 P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' I# o# m& V& B+ [" W
                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 h- ]! g) k( c7 O5 Y
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);5 A- `3 S; Z) L% b1 F; f
   if( hFile != INVALID_HANDLE_VALUE )" E4 \/ j8 F# k9 f) u
   {2 v# }* v. K, U1 h
      CloseHandle(hFile);
* A& R: O( r# ]* T1 Q4 Y      return TRUE;: N8 Q( Z+ W0 C/ |' ?' ]
   }1 P: z0 g$ W2 w* f8 P2 x
   return FALSE;
2 ^8 Q/ q! ^* F}
# t) t* h. y2 s1 f6 O/ ^
8 y# S. K7 [/ Q' ^Although this trick calls the CreateFileA function, don't even expect to be
& c( m/ S5 n7 k* vable to intercept it by installing a IFS hook: it will not work, no way!
, s$ ?% V* R/ b' j0 iIn fact, after the call to CreateFileA it will get through VWIN32 0x001F8 Q6 P  u0 o- C8 s) U8 G
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)& G, u1 X% ^% [$ `7 L) v6 {
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
3 M! O% P1 ?  n: O4 f$ {- Nfield.6 W. @$ Q6 g0 [9 r1 W  s
In fact, its purpose is not to load/unload VxDs but only to send a ! q* u. Q6 x3 H$ e" M
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' m+ R: _, {3 P( R; A2 Ito the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 `* l4 _+ J- m2 e# v( C: X) uto load/unload a non-dynamically loadable driver such as SoftICE ;-).; `1 P: l$ s7 b' @. i4 Z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
; z! [& ~3 i) C5 Vits handle to be opened and then, will be detected.
- F- c9 m2 ]5 G6 c* B. _You can check that simply by hooking Winice.exe control proc entry point; C% B' O3 Y3 m; L7 d2 l* _
while running MeltICE.
: \  R2 ^/ n, R+ Q8 D: q
5 S9 D0 ^2 z; c5 T; i1 V# p5 g' Y: v# J+ c0 Z( v) v
  00401067:  push      00402025    ; \\.\SICE- ?. d% G; t/ ~' g& `8 j
  0040106C:  call      CreateFileA6 Z$ a7 l: C. i5 t& _
  00401071:  cmp       eax,-0010 g  D+ w) g2 h. \
  00401074:  je        00401091
0 N! s7 g! \- E+ h: x( B3 ~- z/ e6 W; R" }5 A! U) P% Z6 m4 Y

# S! I2 |0 m0 J+ i5 oThere could be hundreds of BPX you could use to detect this trick.$ s- r+ d# @& Y5 U1 P
-The most classical one is:% d' O6 Y; Q1 p6 {9 _9 O4 L8 e1 L
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||, }9 Y( d5 u+ _( A1 g. B
    *(esp-&gt;4+4)=='NTIC'' q7 N: t. j9 f- M' ?0 e+ B2 I

1 _' K" ~/ M8 A/ z8 ?6 L' x8 p-The most exotic ones (could be very slooooow :-(
2 W, ?; v- k% y5 j& k/ `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 P) m4 v( L! U5 R
     ;will break 3 times :-(! G9 Z: y$ u' _- o( c5 {. Y

# B  L1 s) {7 Z8 p; m-or (a bit) faster:
8 h  v, k" R2 F   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! H7 n. ~) K4 A
9 Z  O2 D6 j$ \6 n( l
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # B5 Z( G/ \2 ]) A6 b; D
     ;will break 3 times :-(( ^0 Z% t- m" B; Z

- w; k; h  R) e) U8 V( q5 U1 f-Much faster:
  d& l% h) a# }& p   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 Z6 U$ B9 a! i  L3 e% W

0 K0 x: n: d* b1 Q& o+ R7 V3 R. yNote also that some programs (like AZPR3.00) use de old 16-bit _lopen% {# R  M, f3 G$ H# f
function to do the same job:/ ~& P$ a3 H0 T0 q
. F# t2 o% w% H# l
   push    00                        ; OF_READ6 M$ x5 V% ~7 [/ g
   mov     eax,[00656634]            ; '\\.\SICE',03 ?. u) e3 o& |7 L9 p: m
   push    eax
; C! |3 j8 U4 _3 ?# p( z4 Y) p   call    KERNEL32!_lopen8 y1 }! p1 K5 B) y6 \. Y5 i6 a" o
   inc     eax
. p. g0 A" x7 t' X: E% T$ u6 Q   jnz     00650589                  ; detected0 d5 e$ v) {* E3 [
   push    00                        ; OF_READ
7 W: K. L) S$ S$ k   mov     eax,[00656638]            ; '\\.\SICE'( }3 H( B+ X* ]1 R! x4 }0 D" }
   push    eax2 R/ ]1 a2 V6 O8 W, }/ Z- Z& |5 M
   call    KERNEL32!_lopen  r+ [" o) f1 `  l# E$ q8 B' C0 X% V
   inc     eax
+ t& h( G2 Q9 ?. Q   jz      006505ae                  ; not detected
( @2 Y: V6 ]0 H1 S
0 u/ Z2 I0 Z: m5 f) E4 n5 i5 r1 F; W- H8 g: `0 L
__________________________________________________________________________
& }5 b! u! c0 D1 t4 q0 z' _0 I" f$ f0 @2 `0 K' F/ P+ S; ?; U
Method 12
( a7 X) F$ _  s9 F=========- m5 \) N0 M) Z9 U/ u
2 ^3 w8 i4 h7 K- o. G. o
This trick is similar to int41h/4fh Debugger installation check (code 058 E* s! l1 v# R3 @7 E9 K
&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ A% n5 ]9 H; `* |" j9 t
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 N$ F& O3 @) h5 f' T' {+ D8 g: k! F, V  f7 S4 o
   push  0000004fh         ; function 4fh
8 g4 F+ G* t& @6 s6 r5 i   push  002a002ah         ; high word specifies which VxD (VWIN32)
) E4 s8 r3 U4 v& E2 W                           ; low word specifies which service
5 t, W, Y1 h; L3 |                             (VWIN32_Int41Dispatch)+ `* S4 F  i1 V7 t3 k/ M
   call  Kernel32!ORD_001  ; VxdCall
( `$ c+ b; Z% z   cmp   ax, 0f386h        ; magic number returned by system debuggers
' x1 ~1 w- L0 E8 k5 B   jz    SoftICE_detected
6 a- D, Y' k5 _6 f. R8 P) N2 E5 ?% g/ T/ T! F6 L& b
Here again, several ways to detect it:
& i7 v+ N) E8 F8 N+ T3 T
1 E; H9 n- J7 j) _2 Z' u$ m6 L    BPINT 41 if ax==4f
. L/ u# v' o. C% J" S- x+ i
: V7 T7 f) U9 \5 O/ c    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& I) `$ `. c% z+ j, R; j* r5 A! z( E" S- z  N
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 a  F# G# Y; ^# {% U  @. F
* c# S) N$ @& v& D) B    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 t1 q$ G( l, a$ N, @% y+ R& @
) x' z( x: |2 J% z' I9 n; k0 t
__________________________________________________________________________
8 y) y1 C/ Y# Z' ?2 ?
( h% z' C+ V4 pMethod 132 u& I9 |% p9 T. e( O- A) E
=========
: `: C5 B; x& E
  c. s* E, m: E. D2 N/ PNot a real method of detection, but a good way to know if SoftICE is3 z* ?; t" a  m% C0 M2 [  o; A6 \
installed on a computer and to locate its installation directory.
0 T+ ^. `/ _# I! k; g8 N+ j. {It is used by few softs which access the following registry keys (usually #2) :7 ], M$ R. o+ C. C

) Z0 H' b, f7 d8 [# f  i& k# h. O-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 |* b& {, W0 A6 H7 D: R\Uninstall\SoftICE
& a! E) K  e! T  u, w% }7 N% B-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ `$ `. W5 }' C' s6 z  I/ Y-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( D5 ]9 d  q, w+ i
\App Paths\Loader32.Exe
1 u* P  h) B) `* c" f0 k' x# Y  V7 W4 `

; Y3 H- G2 ~4 E" e1 p9 fNote that some nasty apps could then erase all files from SoftICE directory
) r3 {/ ?2 W6 l: l- x(I faced that once :-(
; D5 h% u7 M" Z. Y( t  H# u0 G) ?  l/ g: Q* h
Useful breakpoint to detect it:$ x. [1 F9 h7 M" X* P

* S7 N; d. ^5 k     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; z0 X8 O0 B+ ?& ]+ i; I1 G, B- D* q# H
__________________________________________________________________________" l+ g5 A6 s! Q7 v
0 ?6 Z/ K6 t8 `* d1 f, T

% o" g! K( _3 B5 J+ R0 `Method 14
8 c4 {4 l) A) |; D=========' n& u% G0 t8 d0 s& G; ^- @, ~+ P! s
$ D4 H' |1 {; B7 {) D  f
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 N0 F6 T/ f8 ]  Z/ C9 e' u% }is to determines whether a debugger is running on your system (ring0 only).
5 }0 d, C4 ~8 W9 B3 z) J: j3 _/ ~. _9 n9 c
   VMMCall Test_Debug_Installed
9 C) `# l! R: ^; I/ e4 L) W1 g   je      not_installed+ \# c2 J' m# T% U, [# Y+ l* N8 r( v

/ }3 }( j; h& SThis service just checks a flag.$ h7 X; S0 c  h! Q# A+ A
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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