About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& F1 _& G3 U3 @' b% B/ x( q<TBODY>
( C9 G$ U! ~4 T8 z/ e0 Z3 P9 h/ `- Y- i<TR>
* B- s' o. ?, N$ v<TD><PRE>Method 01 & I+ J, i# U  x9 O* e6 t
=========# u) G6 {0 {: }
# w; n' e  B% E2 `4 Q
This method of detection of SoftICE (as well as the following one) is! }2 k$ c6 k0 p$ N
used by the majority of packers/encryptors found on Internet.
! i5 h6 P; ~8 `% O& [1 Y2 R; eIt seeks the signature of BoundsChecker in SoftICE* Q7 ~# m7 q, e  x$ p

7 h. \+ c' \3 C" o- Z: E    mov     ebp, 04243484Bh        ; 'BCHK'" [; `+ B1 T; O& A; _6 _' Q
    mov     ax, 04h
# `1 X# e/ ?7 h& n" f* |; a  w3 J: ~    int     3      
) {, e  Y( R2 A: c5 p9 f1 T    cmp     al,4
& u& j2 J' a2 O+ G0 A    jnz     SoftICE_Detected2 ~* ~$ H6 @# c0 T5 M2 P* [
8 g! W8 ^* {# q! Q) G4 @
___________________________________________________________________________
( K6 w: }% p: B8 |4 l4 ]: q8 B" U' F3 x+ L* b" f3 o6 S# |) J, t0 Z
Method 02
$ b4 r. B0 i9 f# @' B=========6 J" b, @2 l/ m; [3 {' s
, v( N$ R! G# C: b
Still a method very much used (perhaps the most frequent one).  It is used( Y% z& U3 D1 {7 v
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, x" O- N- h# dor execute SoftICE commands...
2 ]0 X- t% E2 z, u9 sIt is also used to crash SoftICE and to force it to execute any commands
, N: O: B3 F: K& k- h4 y(HBOOT...) :-((  
6 }% a  n' a6 o! O$ ?9 i3 Q4 w- ?# ]+ ~
Here is a quick description:
+ B" f+ k5 ^$ h9 u* k. t& _" y" ]. [-AX = 0910h   (Display string in SIce windows)' W' p* }1 @8 ^( @' |  [! R0 O  i
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)" h, N1 f# o" _1 O* o2 w
-AX = 0912h   (Get breakpoint infos), a, c) L+ o& k" {, n; f) D) D
-AX = 0913h   (Set Sice breakpoints)6 [4 r2 a) T# @; v) v) _# {! ?
-AX = 0914h   (Remove SIce breakoints)# U% x! E# R2 M, w0 p' j
1 S0 F0 K* P% D+ B$ S9 {- @/ Y
Each time you'll meet this trick, you'll see:! @! c# c; b- S& s
-SI = 4647h
2 N1 \5 j! p$ T9 Q4 `. J-DI = 4A4Dh
; g" d! P- ]" D. E; k# UWhich are the 'magic values' used by SoftIce.
# p; {4 Z# s6 Y4 IFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.( D+ f) r$ o" A* @8 R7 D) _9 H
7 A4 u; K' Q( w/ [9 `/ ^+ ^9 I  J7 E
Here is one example from the file "Haspinst.exe" which is the dongle HASP: e8 b- [" e. C( Y! H
Envelope utility use to protect DOS applications:4 d4 `& U! j, A) h& ?
6 H: ^8 T- v  j6 W6 w! |
" b  v( [1 g) u( ^
4C19:0095   MOV    AX,0911  ; execute command.
7 T0 i8 \% v( c! l0 k; |2 }4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
$ w  H4 K- d! B$ |4C19:009A   MOV    SI,4647  ; 1st magic value.
' ?$ ]5 w3 ]1 q4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: K8 `" o8 `4 v$ y0 p$ S- @: X8 y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 C2 I( \4 j( z- ?6 R0 b4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
2 C4 {3 a3 j* d; I  w4C19:00A4   INC    CX
& V* S. ~* f; [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( T* x% p8 O4 r. h1 w' u
4C19:00A8   JB     0095     ; 6 different commands.4 i! W: @# u" i8 W3 b3 w
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.* r' {; [& Q, T5 x; c
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, c+ X8 f9 @# R9 C$ A) G5 Y% |7 ^% R7 Q& u2 j6 D1 s
The program will execute 6 different SIce commands located at ds:dx, which
/ i+ S( u) j* W2 uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( B+ H4 `7 ]6 o
  b% e% {. M  l" g# u) ^* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 D9 V( E! J* _) v' E- O
___________________________________________________________________________
: y& }9 [& @( N! N! y
3 ~  m3 b% _+ s: r1 p; ]1 |. n. y+ Y  `0 H, N
Method 03
: ~& E& x% ^: O=========
6 ~* j0 S$ t6 Y/ ]' c) {( @+ n" @
8 R+ r7 o: M6 U+ U4 c  FLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  W# {9 E+ n% ~* X
(API Get entry point)7 y6 ~" f! r' r7 [4 C4 _
        
' q/ \7 B6 y# {1 B3 b2 H$ e7 {$ S0 @: Z. [
    xor     di,di+ h- Y/ X$ h" e/ X. o
    mov     es,di$ [% o5 y% F* h! ^5 O! N4 U
    mov     ax, 1684h      
- k; }  s6 o; e    mov     bx, 0202h       ; VxD ID of winice: r# u' P9 U4 s5 f
    int     2Fh( {3 m: _( D) V, `5 o8 i# a$ W" h
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 H' D- T  c- T. J* i    add     ax, di/ s% ]& M( L: q7 K, j+ d3 A
    test    ax,ax
1 x! f& b; X7 E    jnz     SoftICE_Detected' w! @$ J* U4 X

9 L/ f5 _- A$ T___________________________________________________________________________
: G8 L6 I) Q% T+ v7 M) b
: O/ y' X4 R  \5 r$ rMethod 04& v2 L- h  H. ?+ k3 W( Y6 P
=========" V0 j# `7 H- c* _* d

; V! k( N/ H+ P+ K" V' gMethod identical to the preceding one except that it seeks the ID of SoftICE# e; H+ l6 `) ]$ `; k  T
GFX VxD./ w, w7 L. x% U$ c( X1 [3 e2 e
) m, S6 n# Q/ V8 e: W
    xor     di,di! r1 D( S" K8 Z0 o- p0 n2 w' `' ]- n
    mov     es,di6 i: C8 \( @6 ]1 b1 B7 x2 D
    mov     ax, 1684h      
# l) ~. g; ^: c* }8 P    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 Y4 |0 C! ^5 t( g    int     2fh
% I' Z! b5 J5 x( `! x. Y( C    mov     ax, es          ; ES:DI -&gt; VxD API entry point, f9 V( e% O5 R: [
    add     ax, di6 z7 A. v, R4 |7 ]4 P( G8 i4 M
    test    ax,ax
" q' D5 V/ p6 a9 N% K3 F0 t    jnz     SoftICE_Detected
7 G1 ~! W. O- T! j# A: {4 T# o
* k, ^& I# T% }2 l$ i9 m/ A7 e__________________________________________________________________________
! T+ y1 o# k6 |  f8 Z
: h* I' Y% ^. c2 g" I) O# q0 q3 C1 a  {0 c, H6 L8 g. }
Method 051 K- i, @* u7 t
=========3 M( D$ h4 n% x, ^( a

7 {- ~2 Y9 r1 pMethod seeking the 'magic number' 0F386h returned (in ax) by all system
# r7 c7 L2 r' c. udebugger. It calls the int 41h, function 4Fh.
: v. d- k; P' P3 a% H) E/ t! @' WThere are several alternatives.  : ^. }; \3 ^# B( G5 C
& A. l: f' t* }- B
The following one is the simplest:
8 J# ^0 L* ~3 B4 T! t2 F
; [8 {: B1 q! I    mov     ax,4fh  g, |; p" I! d6 w$ M
    int     41h
" y8 k" h6 T& k, z2 L; x* ~4 f    cmp     ax, 0F386
3 k# V5 q/ \, {3 B  M  R    jz      SoftICE_detected% E# P$ _; H; H+ O9 {  l

* y- Z2 k( H3 X* y* Y
& C5 u0 b+ E$ @( {. X! KNext method as well as the following one are 2 examples from Stone's
. y/ l! A& t# l% E! R"stn-wid.zip" (www.cracking.net):
9 L" u, D! N* h) F1 p' r! E
( m$ N& A& V; Y4 ?% H" ~$ @    mov     bx, cs
1 u! M4 P: [+ L    lea     dx, int41handler2/ ^' }$ u# B1 l$ L2 u, n9 C$ c
    xchg    dx, es:[41h*4]
8 {- c* c+ h, @5 [! f: T; p0 S/ Z    xchg    bx, es:[41h*4+2]% \+ a  D. B; k% ~* ^2 i" P# N
    mov     ax,4fh
" n$ D  X* @& F0 s- f9 f0 p" U    int     41h- R& \& z0 m8 b3 j3 b
    xchg    dx, es:[41h*4]
% U1 T# e4 H) B  ^  Q$ q( O    xchg    bx, es:[41h*4+2]8 D, d8 [. B. v: O
    cmp     ax, 0f386h
8 z- e& ~" I4 M( ~    jz      SoftICE_detected
  x% M1 m5 P# o: s- x
6 {- \! [+ `- [$ z3 ]5 M6 o6 `1 qint41handler2 PROC
4 ]! v$ {$ i* ]% F1 {    iret9 k7 M: C8 \: H& V, M+ {1 Z
int41handler2 ENDP
+ y  @2 U3 Y% @0 G8 \% t
/ t1 m/ @4 O% Z1 Q8 }/ M" A/ c" R) t9 [- P5 K6 e7 x8 }& g( o
_________________________________________________________________________+ n1 [7 R; R- n
4 P' u" P" E, P+ d* @: B

6 ]) @$ Y. R) @$ oMethod 06$ Y! ?5 z! O$ ]  Q: |
=========9 n$ j) v# ^5 _! |5 b6 ~  J
) r3 j8 j" c; }9 N8 A

, U2 d" s8 T+ v% A2nd method similar to the preceding one but more difficult to detect:
" F6 Y3 x% D9 B6 M: w) ^6 r
0 M" F3 ]) E3 l: g+ `, H, T) i( Q& Z$ @& A* X2 P% W, h
int41handler PROC, H2 p: G1 ~2 |: {) x1 x% Q7 y! J$ V
    mov     cl,al  Y( o6 V7 J  q# ], B9 X
    iret
& z; [3 \+ c0 jint41handler ENDP
6 c" d; {3 S3 c. h% q3 W
! D3 Q& P+ Q- L% P4 W/ ]; i& M! b, Z) T1 U
    xor     ax,ax# m/ z8 M" j  u+ y. j
    mov     es,ax8 y6 W. E" F" S9 n* i
    mov     bx, cs
2 `; h- q/ P- x! o* w8 [# N$ T    lea     dx, int41handler9 O# ^. i& |# T( |& O  q
    xchg    dx, es:[41h*4]" Y. @6 G3 V$ M
    xchg    bx, es:[41h*4+2]
# f/ M9 ~& X+ Q0 r1 L/ U    in      al, 40h) E" i- y5 V$ v
    xor     cx,cx* B" M7 N2 Y2 P) O& u+ p
    int     41h
) f3 @& @! i: f: Q+ ^  y" h  V    xchg    dx, es:[41h*4]' _# @$ G' J% U) d
    xchg    bx, es:[41h*4+2]
# z2 a* V2 B& c5 Q, h! e2 u8 R4 J& S    cmp     cl,al- F, L6 e2 _. [( y
    jnz     SoftICE_detected1 V+ ^7 q& T; c5 v5 w
+ h' Q7 q! P1 R1 w4 V
_________________________________________________________________________* W3 i4 J3 O% c7 n$ V

( a. O, N$ f( a) p/ }Method 071 I' k8 d& H2 |9 {/ I: b. I, @) T
=========, `' R, |( c" F+ X, c* H/ g* a
1 M( m2 [- M7 P. f2 E  G) S
Method of detection of the WinICE handler in the int68h (V86)
" V) }: }& N  V5 M: Q& H5 L5 F! C+ m; J2 _+ s$ [3 j8 }! h  r+ [" ~
    mov     ah,43h
; ]6 }! a: ^7 `$ }    int     68h
  G3 J; Q+ o/ L" Z9 k3 G" {% i; a    cmp     ax,0F386h- x: n& x2 i" ?- j4 p
    jz      SoftICE_Detected
. D: m) x) x. x0 r: i! Q1 v- |" P" M4 H
/ T: g: z2 B3 J, f4 i0 C3 R* f4 K! @" H) I% ?
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& b2 c+ J2 ]) y1 C' m1 N# k
   app like this:% _7 b! K+ U# R) r1 G  m% q# i
: U, z2 N9 L4 F0 w1 E& C/ w% w8 Z
   BPX exec_int if ax==68
0 s  g2 j: H0 z   (function called is located at byte ptr [ebp+1Dh] and client eip is. Y6 ?. g/ U6 V1 U& w! I/ Y
   located at [ebp+48h] for 32Bit apps)3 ]5 m! m+ K: {5 r
__________________________________________________________________________2 D2 D3 Z, y7 }1 g- G2 r6 O

; F# g3 d' X8 h2 D' t* b! m1 N% x6 ~) t
Method 086 f7 n. ^# @; a  D8 Y: M
=========
) }. j6 ?' Y& u0 u% A' I" E& |, I. ?9 f
It is not a method of detection of SoftICE but a possibility to crash the2 p& ?' q% B7 q- ]
system by intercepting int 01h and int 03h and redirecting them to another
. ~" j3 x) p1 ?/ i+ aroutine.4 K$ Y% s/ D% i3 J
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  b7 R- E9 m% ~( y& ~" Oto the new routine to execute (hangs computer...)
8 a1 c2 I5 z3 a8 o6 P7 {* \% T8 j% W! e( M) E% S- U5 y6 m7 F
    mov     ah, 25h8 m, P( q# e+ s
    mov     al, Int_Number (01h or 03h)  r* M- e! Y1 A6 X, Y2 g
    mov     dx, offset New_Int_Routine9 @0 d2 Y! M9 X
    int     21h
( O0 V- f( V) m
5 P* G# m7 c7 ~  z$ u1 j__________________________________________________________________________
* x( \  b. W- q- a' V: z8 k0 q3 {
: s6 V- k6 w) x: F7 C- G! Q7 V, kMethod 094 X; i' ~6 K2 r+ S, R
=========' n. p' \) c: M+ ~; J

5 `; ]: L0 y8 B3 I  y: G2 DThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: Z# K5 J" w3 e0 H8 y3 X
performed in ring0 (VxD or a ring3 app using the VxdCall).# p' [7 F2 e4 _# I$ {; w; v
The Get_DDB service is used to determine whether or not a VxD is installed
3 g5 W4 k: I  K+ b( _$ [9 L3 Mfor the specified device and returns a Device Description Block (in ecx) for
8 t0 o: j/ _, S. E8 X9 lthat device if it is installed.
9 ^5 g9 C8 _+ Y* g2 ?: G
7 ~  d3 H; q/ u6 b0 U$ o9 K$ |   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID/ K4 g. S, s. @0 ?/ m7 ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
1 R( Z" P, q; C5 o. @8 S   VMMCall Get_DDB( w& A" r) C- v8 y
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed; M- E- N& S+ ~$ D* V
* u! N; \/ b6 B# T  i5 ~7 }
Note as well that you can easily detect this method with SoftICE:
. N' ?* W. `2 J9 K$ Z$ Y" i   bpx Get_DDB if ax==0202 || ax==7a5fh
$ r$ D- V: f- R& ~, z! l6 k6 `1 a# R$ w, t8 b
__________________________________________________________________________
( G0 m1 c$ _7 Y4 g$ ?+ z2 P8 \% H  J6 C6 L2 _9 l; a' `
Method 106 ?2 q* x; T6 P) Y3 `
=========
$ m; t0 [  ]$ t& ]
) d9 ~. ~* `3 H% n$ o=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) C! |5 S9 u: e/ j8 `6 z
  SoftICE while the option is enable!!
6 y# r5 `! M  @) ?8 r. u& Z8 }3 ?2 p7 U- t
This trick is very efficient:
) k$ c/ I4 z( Z& a( k5 h. Fby checking the Debug Registers, you can detect if SoftICE is loaded) g) [8 `6 _  ]8 w
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 {- R( d( X9 T9 J8 O- G* a
there are some memory breakpoints set (dr0 to dr3) simply by reading their7 I5 ^" V* F2 F$ Q# h0 b; r
value (in ring0 only). Values can be manipulated and or changed as well
2 {. H, P' f9 d% F* N(clearing BPMs for instance); m/ V% d( a- n( P; P* @

/ \, A) X7 n# D5 r: I/ ?__________________________________________________________________________  `+ z; X5 X! ?2 r( z
# d3 ~  R0 N6 Z- O3 m. Y5 G
Method 11
6 h3 f/ u/ @7 }2 y2 a' t3 `0 z9 {=========
. F, r0 n2 G  E* g* g, l: {* F# e; [0 `+ u& }& M. Z  S
This method is most known as 'MeltICE' because it has been freely distributed$ M; d! R0 e5 r$ I
via www.winfiles.com. However it was first used by NuMega people to allow! h& y5 m  Z' w- ?" O! Z
Symbol Loader to check if SoftICE was active or not (the code is located' N4 C3 _  ~, j& D
inside nmtrans.dll).8 ]# k/ p0 G4 c
5 i5 u% }& F1 X1 C7 ~) e( K
The way it works is very simple:
& \$ ]8 E$ ]% wIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 Z3 e$ {, i$ J4 S; f$ a: Z/ }6 Q! e6 W
WinNT) with the CreateFileA API.' i8 v+ X$ c4 V: ^( ?  {  e# _( e

' W+ j& F9 f2 k3 e, m5 NHere is a sample (checking for 'SICE'):9 v; Q+ v6 j/ d4 d  o" n
' d$ o6 c6 d# j! ~0 X
BOOL IsSoftIce95Loaded()) Y4 _* v. `. |( t/ f: p# \6 ^
{
9 x8 C$ G2 P4 N: s; e3 }6 N   HANDLE hFile;  
! y5 |6 i( |; Y, ~( R7 B! [   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: h' I1 p* D2 E
                      FILE_SHARE_READ | FILE_SHARE_WRITE,! S. n2 j" q8 R
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' g4 i. J/ O& y" d# k   if( hFile != INVALID_HANDLE_VALUE )' b2 p1 f1 i9 ?) J3 ?! }
   {
% @2 K& a0 e: E- ?; ^      CloseHandle(hFile);- ]9 U3 {# w! |* F$ T
      return TRUE;
+ L! y6 O# m4 \6 p- ]   }6 m2 Y7 A% I: Y/ f  Y. g
   return FALSE;+ {  S$ L( `0 q
}8 G0 f- B$ W% s

; R: S2 a8 ]$ k, U7 `5 w9 o! Q2 a2 QAlthough this trick calls the CreateFileA function, don't even expect to be
- L; ~- p& u! m0 {( R/ T' Oable to intercept it by installing a IFS hook: it will not work, no way!
1 \2 Y" D$ y' `  DIn fact, after the call to CreateFileA it will get through VWIN32 0x001F% a1 |% m. [) l* `+ W* S# O6 {6 ]
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: o# F2 J0 w- C. land then browse the DDB list until it find the VxD and its DDB_Control_Proc
' B/ `1 ^- k% X0 n; x" Ifield.
& w, S5 f( [9 F1 o$ X# `& A. Q7 XIn fact, its purpose is not to load/unload VxDs but only to send a
, z! X1 S7 k: ~8 o$ n: U7 CW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)& d- R3 z7 D! Q# e% t  Z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
0 @9 L7 O# F' B, X2 eto load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ k6 H9 R# x3 [1 y% vIf the VxD is loaded, it will always clear eax and the Carry flag to allow
' M- h4 U. u0 N& Z; g: o$ p3 n, vits handle to be opened and then, will be detected.
8 U( `8 u" ]$ U. {You can check that simply by hooking Winice.exe control proc entry point
& X. _7 b0 [8 z4 f* Z9 Bwhile running MeltICE.
' t, v' P2 b/ R7 K; P8 E6 M+ N! ?2 F0 i2 d
  K5 P9 ~0 s( P& D2 j
  00401067:  push      00402025    ; \\.\SICE7 Q4 i) I" r. T% }& l
  0040106C:  call      CreateFileA
5 z4 Y% Y  h! ]# ^1 e1 y. k  00401071:  cmp       eax,-0015 G7 w! B+ Q5 W) h7 V# P+ @
  00401074:  je        00401091" G  \4 N* J4 k. o

8 N/ T# W% l1 S* m1 ^+ J+ m+ S
& y% H2 k2 T" M) D# t1 R" [There could be hundreds of BPX you could use to detect this trick.
; c! P0 s$ I8 B1 v' O$ i& F$ z2 w-The most classical one is:: R) l' o; L8 I
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" q( D6 u% ^2 Y8 ]$ _+ E
    *(esp-&gt;4+4)=='NTIC'
- w# _: y  E) s# T! m1 i  d) v( v8 ]8 ~0 A
-The most exotic ones (could be very slooooow :-(
0 ?! a9 W' C; Q9 L" d- [   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  7 Y" q5 {7 Y$ V+ k
     ;will break 3 times :-(
1 K& L; a( z) m+ j0 o% H5 [- E. U5 _; [  ]  M1 H3 U; n9 Z9 N
-or (a bit) faster:
3 @( d7 h/ {" E; J, B( f! {   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')' K3 O- B, t# Q, Y
: f# ?1 u; O' C1 ^' x* S
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 f6 J  V$ o) \. I6 t     ;will break 3 times :-(; T1 c( M; S, T9 d1 E% t
+ ]& K9 Y  p! e7 x
-Much faster:
: d6 c1 g& K3 l' E! p8 A  M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
- g$ s6 @7 R' W- H( }
; Q, z9 g, f5 E) a- ~  w" }Note also that some programs (like AZPR3.00) use de old 16-bit _lopen  h6 {3 a3 W9 n$ l, V" N" i- r
function to do the same job:" r8 X( K' C7 P7 n8 p! E  j

+ d3 t* I  [% S   push    00                        ; OF_READ8 Q5 \4 A, D# L: H; R
   mov     eax,[00656634]            ; '\\.\SICE',0  B& J% _4 U# y/ x+ O
   push    eax
: o% i1 c$ u1 m9 s) f   call    KERNEL32!_lopen
5 j1 n) |# j( R7 m* D4 n$ M   inc     eax! V$ q3 }  ^: w+ v
   jnz     00650589                  ; detected
$ c* |6 g+ Q/ v; @   push    00                        ; OF_READ
* |* {) G" `3 F2 I, V7 t( I: y   mov     eax,[00656638]            ; '\\.\SICE'4 _5 ^" ?* u. E- T" W2 x0 z
   push    eax) [2 q; L: i6 @$ u! y
   call    KERNEL32!_lopen
3 I4 I; `% R5 P2 v$ z( U4 E1 D   inc     eax& U& j* E: I7 Z7 r* v  V2 t* Z
   jz      006505ae                  ; not detected
" L; \; ]' {. t8 m
) Y9 \; x% Z/ j, `% y& L8 _! i& y' w9 f) x* Z( j
__________________________________________________________________________5 B# _5 {" u/ _

0 l" A* ?. A3 |' U- \5 K3 r: e: OMethod 12  _( J" N( \: R' K
=========& S# e/ D% W2 n

+ s. I! z8 Z1 ]This trick is similar to int41h/4fh Debugger installation check (code 05' x( d  U6 r+ M+ t4 O
&amp; 06) but very limited because it's only available for Win95/98 (not NT)2 f' x6 @" ], S9 ^0 m
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.' A* }+ d1 m# D+ Z
$ t$ A5 h) ^" u4 n0 }7 ~6 G& a: l
   push  0000004fh         ; function 4fh7 u5 h/ \( l! b: ?" L
   push  002a002ah         ; high word specifies which VxD (VWIN32)
  g9 w: m0 O; H2 H- L& K  N  Y; [                           ; low word specifies which service
9 n" r% n  t2 _                             (VWIN32_Int41Dispatch)( d) O/ v- E$ E$ O9 [
   call  Kernel32!ORD_001  ; VxdCall$ S2 R- {5 o# L  f0 e, n3 a
   cmp   ax, 0f386h        ; magic number returned by system debuggers
: ~% h! l0 k* l" r) W' B! [; Y   jz    SoftICE_detected
! Z) b- e; b7 N$ |9 o+ M- W. z+ G  H7 f. i
Here again, several ways to detect it:' A2 y- w# a  k* g5 V! T( U& \& e
" t2 j  n6 k/ O% f$ \  K
    BPINT 41 if ax==4f& w* {7 Q3 [4 K9 X# g3 ~% J

$ b; ~' a1 }1 P    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- O2 |6 v- {$ D: f1 x, Y: r; o
6 l& ?. k5 F. K) g    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A2 N$ n8 z9 i2 f! a; b) f  Q% q
6 {  k. ~5 Y9 E- N( v
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' W) K, I  U8 w+ Q3 L' D

  }' D7 _9 @3 r- R, l9 [8 I__________________________________________________________________________
" _; y8 v( g* D! o( E( F$ }4 W8 J# T1 T" H: P+ [' e8 u$ W' v, w  g/ h
Method 13. y7 q- h" m" z5 I* `9 X9 I+ _- d1 y1 \
=========
. S2 H2 @! n9 c0 F& p
7 J1 n# L8 h5 v  n6 {  y- L  `: |Not a real method of detection, but a good way to know if SoftICE is
+ K! U" l' ^6 c3 C" Sinstalled on a computer and to locate its installation directory.
* v' j8 i' D5 Y8 \0 Z: Z$ T/ p, NIt is used by few softs which access the following registry keys (usually #2) :2 s2 ]7 P$ j  M/ U, {" {8 U. l3 S0 L

- [; \! m' v, y! X& B3 A-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' p8 P2 g1 [% d+ \\Uninstall\SoftICE
. E1 F  t* n4 }1 r5 |-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE' {# T; y) F: S2 C: l
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" @" g# _. t9 k\App Paths\Loader32.Exe
8 j5 a) M# N8 x7 ]* V
$ h& H, x  h& o- e8 w/ A3 k3 n5 B( {& z- `& P
Note that some nasty apps could then erase all files from SoftICE directory. d3 w/ K! u% G
(I faced that once :-(
7 `$ N2 A+ z0 W8 T% }
: R: Q8 z+ [5 |) e/ oUseful breakpoint to detect it:$ |0 q3 N9 \! ?1 N2 u
( I4 c# S$ J( h4 y+ i  I2 y
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 @2 i2 {. M! z
$ W: M9 }! H+ ~' R__________________________________________________________________________* E# C& M0 L4 K; Z# i" y; K2 l

: \, N! _/ D7 l+ V6 l9 b6 C, N
' l- I  I9 J# Q- LMethod 14
- b2 e" m, o2 F% f=========$ n: |' g, v% q

" ]9 I: G/ t* _# L: t! L5 QA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, p4 B& G, t% y$ J; A& D) S
is to determines whether a debugger is running on your system (ring0 only).9 [" I, H( c. I

0 h8 c' C/ V/ |% N6 m# w# y' {2 R: G9 T   VMMCall Test_Debug_Installed- Z! R$ T" I- w6 R
   je      not_installed4 |! n6 H5 G, @8 p: Y( f3 H

! }* G  E/ L( w$ q0 B) RThis service just checks a flag.
: u, K# q: U( t' F</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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