About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* i* V$ Q! m# ^* I  b
<TBODY>
% h& W, n$ @) `6 z1 Y1 o; B<TR>
0 Y6 E7 m% _0 E  L$ l0 m6 H; V! q<TD><PRE>Method 01
) q" P, p8 n- `7 V=========1 b$ t( D9 L  C+ H3 m* N
, r7 h; {9 e- c6 K6 E! y
This method of detection of SoftICE (as well as the following one) is
: ]# e. H/ A+ ?+ b. jused by the majority of packers/encryptors found on Internet.( u6 q/ O: w0 ?$ [4 ?
It seeks the signature of BoundsChecker in SoftICE
* ]" }  K! q) e# }6 V! Y$ g5 f' ]
8 ~% [( ]! k; t2 L) s, s    mov     ebp, 04243484Bh        ; 'BCHK'2 h3 j; |& L. X: G' ^  b% S
    mov     ax, 04h7 R* K$ h8 t7 p) P
    int     3       1 m) [" j  _" f8 p( t" H
    cmp     al,4
! i- b3 r5 ]8 e; m5 |) j    jnz     SoftICE_Detected" s8 ~7 }" k6 I( ?
1 H) c1 |. z4 C( |2 ?
___________________________________________________________________________$ R* s: r5 e/ `) N3 P, b7 S; \  s# B
! g, \8 ]) i2 B+ n. _0 ]5 Y' M
Method 02, P6 l" q# f2 X% Z5 \) {3 @
=========
) t6 `: G& H! L$ e1 p# O7 q
8 Z8 C2 i  f: H6 HStill a method very much used (perhaps the most frequent one).  It is used/ t& V/ m+ Q, f% @
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,, S  A1 Q  H2 b! |/ i- I/ K
or execute SoftICE commands...9 }; P; v0 |+ S: r2 l
It is also used to crash SoftICE and to force it to execute any commands
3 I: V4 I2 v. [" C8 D- B" q(HBOOT...) :-((  
5 G$ f+ d) O  `/ V& y4 `. W
2 N; t- V* d. O" P6 }Here is a quick description:
/ T% q8 X" j1 v" n. Z% @2 D-AX = 0910h   (Display string in SIce windows)
. s/ b) s0 @9 x2 t/ b7 |-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)( a% p4 Q# r4 b' V8 f
-AX = 0912h   (Get breakpoint infos)
' `9 P7 ]  c: ?/ t: K3 W-AX = 0913h   (Set Sice breakpoints)
% S$ ?: T% E; @7 m) v" L-AX = 0914h   (Remove SIce breakoints)- W. C+ Q; f; r
" |% i) z6 F" ]5 V5 i
Each time you'll meet this trick, you'll see:9 q8 O! p% G+ k
-SI = 4647h
1 n3 n/ ~8 i$ s* y1 t-DI = 4A4Dh
, h) A. K- q! J3 G; LWhich are the 'magic values' used by SoftIce.# T0 R; ^5 L: W0 j  L* {( z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.) Z: k$ O4 {. k+ r5 @- I
2 |$ }& I2 T: ~* ^! M# ~0 t
Here is one example from the file "Haspinst.exe" which is the dongle HASP
& @' {( x9 z* o. [$ A; g1 fEnvelope utility use to protect DOS applications:% B8 c, U3 H; C1 u5 g
; a; O, a, O; C% v7 D' Y% R* g! ~
: M# r8 t  x4 H
4C19:0095   MOV    AX,0911  ; execute command.
: A0 S. y& z- b# J5 j4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).1 Y$ ?# p) H& a% l8 b  m) w8 Z* z
4C19:009A   MOV    SI,4647  ; 1st magic value.
3 h. N+ B/ @, [" q  B4C19:009D   MOV    DI,4A4D  ; 2nd magic value.# `; y  {/ q2 ?, N
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ X6 G0 C) o4 [: ^
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" [. `8 }: l* J0 o0 c& y9 H- ^
4C19:00A4   INC    CX% W8 Y1 O7 f6 A" z; X9 ^- v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 X; R3 t( q* u) T* N
4C19:00A8   JB     0095     ; 6 different commands.# q4 T* Y# R: a8 N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: F0 J' K5 }1 ~
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 ~) N0 ^7 J( f8 d; d3 g$ o
2 m4 P1 o; t- i- ]' m8 MThe program will execute 6 different SIce commands located at ds:dx, which4 V: c, ~2 J2 ~  d' L* A  S; x) R0 Y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% B% P7 w6 X" x: r, \. J) p% }
8 ~, W% a4 H* z# ~+ B3 `
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.. m9 u, P; E" v: b& \, c* p7 `: B  L
___________________________________________________________________________
6 L- G: f$ S9 l3 k: ]7 F0 @3 M* P. e* H3 |% n; r) S
2 C) c" C- o- x$ g  v7 O+ z  P
Method 033 ^; K$ D; J3 Z( ?  [& z
=========. Q6 K* v% U+ S' S4 n6 U: Q, Q4 s5 u

2 Y+ }, {$ |" i- K5 [' V$ u: ~Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h7 r0 z0 `0 X7 J9 c4 {
(API Get entry point)
( W1 F5 a; n( v( ^9 X: w- I        
3 Z1 i. G6 ?1 t/ r* r2 M2 V
% Z* I! C! d+ [0 e" r4 H    xor     di,di" V, W; d0 e$ n( V1 I; a
    mov     es,di
1 r& C0 i/ L, L! m- F; k* U3 O    mov     ax, 1684h       ; i& k" _. M) C4 Q) m. e' Q9 x
    mov     bx, 0202h       ; VxD ID of winice
+ s; Y7 G$ k/ Z+ n2 o! q    int     2Fh
2 \/ o. k5 ~* M5 ^" S/ A4 @    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  [1 \2 }/ M- r7 N) ]) ]4 H9 H    add     ax, di
  I2 A* T, D1 q7 P3 X% m; |    test    ax,ax  ?5 C2 |8 Y, Z, q- g
    jnz     SoftICE_Detected
7 t% B7 e0 R9 \( Q( G5 n) s
' p4 \2 ^: b1 o___________________________________________________________________________
9 j* M4 c! x1 `; u; |/ e0 x! h8 f9 n4 ]. n" c
Method 04, q$ `" G+ i# a, ]1 [% m: `* J  \
=========
6 s' j" {# U( C8 l7 u6 a/ k& j2 d
, Q1 Y4 Y  I: tMethod identical to the preceding one except that it seeks the ID of SoftICE
& I3 z, c+ C1 V" k7 bGFX VxD." m# F. C' C+ F6 o

: k. h) d  g$ I5 W    xor     di,di
" ?4 H) Y) x: T" b9 ~4 j3 O1 A0 V    mov     es,di
* ^; |: n, Q( j* Y    mov     ax, 1684h      
5 `3 [9 U, {. F- r: Q8 T' N" X* q    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 ]  W5 v/ j# m7 _5 n2 X1 h
    int     2fh% r7 G% u/ T: [3 ]7 U$ V
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 u0 p% T" g6 ~! `    add     ax, di
  J% G7 r5 N1 E9 _: z' k0 h* ]    test    ax,ax
( T3 j* m5 \: U9 ]! O    jnz     SoftICE_Detected* X: H9 g. U" }0 J$ d

; n8 \. h! B% N6 }# f2 e8 l__________________________________________________________________________
& I) j. b3 a; K; c2 F; E  E7 |9 \6 a' r: X+ }

6 G  Y! N8 G9 o# {5 CMethod 05, v! n. c7 E- g3 _9 p
=========
. Q6 y' ]- e+ ^
" e2 x% [" s; W7 J4 M5 hMethod seeking the 'magic number' 0F386h returned (in ax) by all system
6 e7 f/ A1 Y3 S, ~, ]debugger. It calls the int 41h, function 4Fh.  i2 c; L4 n6 J' {. K# G; I0 ?
There are several alternatives.  
* v4 f; y# H, X0 y) N  Y" T6 \8 o# V$ o
5 I6 h! e4 i: m( U8 mThe following one is the simplest:
) _9 Y# v) F0 w: J8 u& Y$ S6 ?! |+ P, d# O1 b6 A' z% y
    mov     ax,4fh4 f3 q  e2 T8 ~6 `
    int     41h! P  S7 ?* h& w" @$ A' a2 l# M; ~
    cmp     ax, 0F386
: o4 ~! P# L' {( j* f  d    jz      SoftICE_detected. d  f9 L0 i; f* m' u7 f

$ h+ W& M1 P9 H. L! d
, |& f3 p6 Y2 H" d4 a; w) }Next method as well as the following one are 2 examples from Stone's
6 a" _' z2 T5 p8 d# l$ y2 w7 `"stn-wid.zip" (www.cracking.net):6 i! j6 h" p" N0 o9 _  \0 X

& t+ Z$ E6 N" H# w    mov     bx, cs$ A( r6 k  ?7 H
    lea     dx, int41handler2' o1 L" h! w6 e" ^6 s4 q9 o! G
    xchg    dx, es:[41h*4]
+ K9 }5 a+ w5 k+ ]3 G& Z' v    xchg    bx, es:[41h*4+2]* M. u0 ]8 `6 v, X4 T7 O
    mov     ax,4fh
6 r1 B* D3 I+ z: O. v9 z    int     41h4 Y! z6 D9 D( B0 _/ u7 e, K
    xchg    dx, es:[41h*4]
* c0 o" ~1 {" k5 H0 w    xchg    bx, es:[41h*4+2]
( ^" d9 V: o) v1 S, |0 g    cmp     ax, 0f386h8 {0 h! q' E( L1 C8 A' }
    jz      SoftICE_detected7 o- V$ i$ T7 N1 d- Z8 ~* Z; ~

1 r7 B( \5 {! n; N7 B- qint41handler2 PROC' [2 E2 }3 f6 [7 w5 f: V: m
    iret
* e. l, V  I8 H! Bint41handler2 ENDP
1 C* ^( w1 X( X# V6 Z" @& J0 a& o4 ~0 W: R
+ L: u- N$ j& c  S+ f
( M; m0 u+ d. T5 h  [_________________________________________________________________________' k5 a. {' k  O& Q4 S7 P
9 T! j0 u, C3 v% u
: O2 ?3 T7 D& f- Q/ M
Method 06
) j5 B: \- O4 I9 B5 c=========0 T% V* ]% Y! C9 [
. b8 i( Z- V4 b8 @6 @5 f! v- X
: n! [/ @4 @* `. ~- U1 \# D1 s
2nd method similar to the preceding one but more difficult to detect:) X7 G8 |. l2 Z9 x! _- F7 j

  O, f- X: T" F2 ^
& f1 ^9 p3 B0 hint41handler PROC. J; d, t' E8 K  v. W, L( X
    mov     cl,al
4 A$ L. s6 J/ p+ ^    iret
) m, E4 J1 U- y* J7 rint41handler ENDP
' Z! @4 h8 @. a2 C' y2 ?7 T+ X: z2 b. @9 Q4 |

+ A4 X7 B" Z5 z    xor     ax,ax
- U* P- j0 j, P, V( u; b    mov     es,ax9 i9 r( a0 n: p0 J% G" |
    mov     bx, cs- q# ?+ ~6 I+ F$ r
    lea     dx, int41handler/ @' I; T; X( \, W7 j: m7 |( ]
    xchg    dx, es:[41h*4]$ H+ e3 E& v0 K7 x6 @% |
    xchg    bx, es:[41h*4+2]4 w9 ^, x" l3 ]
    in      al, 40h
# [( S8 A) L9 y) g    xor     cx,cx2 I* ]6 T2 x% p4 N) ?5 ]
    int     41h
5 O: \8 p" l; F! I& i    xchg    dx, es:[41h*4]
3 W- `% k* \( a/ l5 a* Y' o    xchg    bx, es:[41h*4+2]( J; z& D. {" b% v. u- E+ i0 G
    cmp     cl,al
0 x. l. e: F! ?' a3 [    jnz     SoftICE_detected
) H5 p9 D% I9 f. R1 p& G- [, W; ~, k" k. Q8 ?) U4 ]" K8 v
_________________________________________________________________________% Q8 s6 M) m3 _

+ v; i: I2 R. KMethod 07
6 U0 u0 R  ]+ H  u=========
+ ?' h2 A, R  h7 `6 m
4 W( G4 Y6 ]! ~! Q/ j1 C5 AMethod of detection of the WinICE handler in the int68h (V86)
# R2 o( B" x, w2 N; F# ~7 z( P1 P$ K6 O, N3 R9 P( S5 X
    mov     ah,43h
4 Q" {$ s: ?+ R    int     68h
8 h& a4 ]# \8 U0 y) u/ I    cmp     ax,0F386h, y% t% t; a8 T1 `% m
    jz      SoftICE_Detected
3 v/ {" X9 l5 A4 t4 p8 K7 X! F; P! `9 M. m. t

2 u- T3 c2 l+ k) P6 r% P1 R# L=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) a. ]- x# k( u   app like this:" E' e) k) d- N5 q( c- c2 b/ `
4 P; X+ y" a, {0 w$ u
   BPX exec_int if ax==68
- v4 S6 W( g( e7 h- p$ q   (function called is located at byte ptr [ebp+1Dh] and client eip is
  o  U0 o3 x8 b0 K! O   located at [ebp+48h] for 32Bit apps)+ M# F: }( [) T2 ]4 a
__________________________________________________________________________
; W* ]5 X" W* V+ ~: B
( O: r; M: ~* U5 f1 E2 D
. K. i6 P5 `4 bMethod 08
* L& X& }3 f% f/ A=========6 u5 K0 }+ h+ M1 V; q
5 Z$ p* d) t1 n
It is not a method of detection of SoftICE but a possibility to crash the( ]) X& H+ F0 N: {6 P0 J
system by intercepting int 01h and int 03h and redirecting them to another) ~* A$ I. R9 i3 M
routine.- i. a0 q, {# V5 ^5 \
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points% x4 e* o9 [) g2 N
to the new routine to execute (hangs computer...)
+ M- K+ `' k! `# T) E3 h, |7 f3 d1 @2 g: o- Z( j$ t0 n9 a
    mov     ah, 25h0 \; l: J0 s/ F3 \( B+ U
    mov     al, Int_Number (01h or 03h)! d! p/ C$ ]) u; L4 ?
    mov     dx, offset New_Int_Routine
! e, F- c' ?3 H+ V2 i0 X1 H    int     21h
) s9 L8 p" P% B4 x4 [( {* y& v- ?' m/ W& {6 s9 D( s2 @
__________________________________________________________________________+ v  x1 F# J! l! `. W

6 o7 H  E4 ^, q! n# \& m$ _1 E; q1 iMethod 09
! b. x& V, O/ x6 w) x! ]7 R- u=========
  }2 P6 X" A0 X2 I7 Q% x& n8 o0 h  L, F
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 e% s. P5 `; r( z9 ]performed in ring0 (VxD or a ring3 app using the VxdCall).
- W' r; V3 R' m' UThe Get_DDB service is used to determine whether or not a VxD is installed- {, u9 K# ^2 X% B# h$ G) o
for the specified device and returns a Device Description Block (in ecx) for6 V$ D/ Q' B( o" W0 i, f3 a$ N( z6 I
that device if it is installed.* r7 b6 ^& j9 u) P8 d9 m

4 U! Q! h4 D$ d# d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& A, s/ {" n" {8 a4 q7 t% n
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% h% }" C; V+ w% H" T
   VMMCall Get_DDB" _5 Z' g! r" q" k' y; X  r
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 P$ F! d+ ~" S. j' x
  O) y# {2 j& h( T, V0 pNote as well that you can easily detect this method with SoftICE:# Q( o9 G# q. D
   bpx Get_DDB if ax==0202 || ax==7a5fh" U( s9 Q( ^- S0 I" F

( c% f( X: M! n5 e, T: u) y__________________________________________________________________________' b4 c4 G  w/ F# U
8 u( k. Y+ a4 l0 U  x
Method 10
9 A3 R5 P; ^' k3 C/ `0 k3 Y=========
1 w4 L% A. g& I% n8 B9 ?1 I# b. z- m' v4 `
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- F: ~* B$ _+ s/ u7 f  SoftICE while the option is enable!!
) D( U4 V5 c/ ^5 h* H
2 t9 u8 O+ X6 R( jThis trick is very efficient:# N9 f# ^# r; D6 w% C
by checking the Debug Registers, you can detect if SoftICE is loaded8 o) Z) _* P) \3 Y& ~
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 n% `1 Q* V* t0 B0 Fthere are some memory breakpoints set (dr0 to dr3) simply by reading their
# F- {* l) X8 t" C& _value (in ring0 only). Values can be manipulated and or changed as well
* J0 \5 O* q0 f(clearing BPMs for instance)
8 T$ v7 I" \/ P9 v+ {' X, S3 ?% K* H' D4 `8 a# i) C: M
__________________________________________________________________________
0 @! w8 N. g5 G6 |' b( z: Z  D& t2 x# o4 R0 C
Method 117 v' M6 m- i+ M" T: ]
=========( e' X7 [. s- E% E5 i* t* ?$ }

& |% n# g: r# ^. V" r/ C2 M5 ZThis method is most known as 'MeltICE' because it has been freely distributed
% |6 {- p" c5 b4 k0 b- qvia www.winfiles.com. However it was first used by NuMega people to allow( @. X9 D; _& o
Symbol Loader to check if SoftICE was active or not (the code is located
0 n% K6 x. K; \% `0 Y6 [inside nmtrans.dll).+ M  a6 ?" I* H" p1 B0 O& C2 ~$ a% z

% Z. y9 v, V$ X( Y! fThe way it works is very simple:
% ^2 P) A$ h2 k$ x8 y' \2 pIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for* e3 @) }9 Y' V
WinNT) with the CreateFileA API.
: H: m! C" s: c/ s1 L5 X# m( z+ U1 X3 {9 F% S
Here is a sample (checking for 'SICE'):
) o  `; N4 \0 D. X# {9 N
8 G( b" G. l5 o9 ]; zBOOL IsSoftIce95Loaded()8 K! N: ]% v3 e4 Y* M
{
. `+ K+ N: t7 `6 h. d$ \  X   HANDLE hFile;  
1 L2 F: S6 S$ @4 W7 I4 o   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 q* x8 c8 c$ p$ t/ w
                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 D+ H" G" S( I- l
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 M/ p/ L2 C* w& m: M   if( hFile != INVALID_HANDLE_VALUE )$ D- _& d. ]! Q1 E5 r0 `! C! s
   {; ~2 _' v+ H* h2 V
      CloseHandle(hFile);
5 F7 L) P+ r7 s& Z2 z0 k, D      return TRUE;
# k3 Q# P2 j2 n# l0 R   }
4 }+ e* q( @* i   return FALSE;: U/ }2 @$ v" l3 R( r  M5 M
}
2 V- t8 b2 u3 p
: E' }6 G, W$ T8 jAlthough this trick calls the CreateFileA function, don't even expect to be3 O2 j" Z+ _- G2 u
able to intercept it by installing a IFS hook: it will not work, no way!
/ O" D* Y2 l9 ^3 {" vIn fact, after the call to CreateFileA it will get through VWIN32 0x001F- @  B  I3 m& P3 o8 @  c
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& A$ b6 \+ d3 V* H; V' ~$ A9 H5 Dand then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 n+ T1 i; Q; Ffield.' P) D+ R, W3 t$ ~) G/ `
In fact, its purpose is not to load/unload VxDs but only to send a
1 X+ ?8 v4 Z$ x% H; f8 G3 wW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); s" W, S  I1 r
to the VxD Control_Dispatch proc (how the hell a shareware soft could try: o/ q! Q- T9 W+ S6 P# h
to load/unload a non-dynamically loadable driver such as SoftICE ;-).: k* i2 j& b0 d" G) o; d( k: k
If the VxD is loaded, it will always clear eax and the Carry flag to allow# o% u; o' Z/ o$ I1 n' l3 f
its handle to be opened and then, will be detected.6 q+ D* D" V0 r. L/ h: ]- N, S
You can check that simply by hooking Winice.exe control proc entry point! j/ \# s+ o" Q3 ]6 X' P% ~
while running MeltICE.& N. Q4 S2 s" y: B! E7 O/ A

/ `: Y; X4 K. p- @' e9 i7 [* k, {8 x' w4 Y
  00401067:  push      00402025    ; \\.\SICE) ~( _, Z1 p3 q- u2 o4 z
  0040106C:  call      CreateFileA& C# Z5 @1 n% ^5 {
  00401071:  cmp       eax,-001
/ l1 n1 y7 T* N* \  00401074:  je        00401091
6 [5 O  H  w. Z" ]6 I) V
( f5 E5 J0 y) h9 ?. h% m; K! L
There could be hundreds of BPX you could use to detect this trick.
2 b8 B6 y3 s# B( f. l8 q! @-The most classical one is:
' |; |+ f/ `# a! V' L: \0 N  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* _- _5 a* k' S$ z( p    *(esp-&gt;4+4)=='NTIC'
' J7 J, [' W% b% }) k% i$ o, e5 d8 M1 U; Y3 V* `1 M4 `
-The most exotic ones (could be very slooooow :-(
6 O0 {* ~% b) y! Q1 X4 P   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . S( v4 j0 {5 Q
     ;will break 3 times :-(
( z  T& J+ G0 R! N5 G) S: T0 }. x
# \) G# Q( @. R5 B% Q-or (a bit) faster: 2 H- J+ o+ _! D4 Y/ F7 T- E0 S" N. C
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). h( f% e6 ?; Q# {' R5 W

. A" }0 O, S) r7 W7 I   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) I: f+ f. L: K, W
     ;will break 3 times :-(
* T% T; l! g/ y; `; s2 P, W/ ~" s$ o- [
-Much faster:
' ?" E- v; d( r   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
5 j: C* Z& K+ g: \6 n6 F, l9 ^2 h  I! Y, U
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
, v& M. s6 F0 z. S" v5 z- Q: }function to do the same job:
( C0 d* I: n& N3 G3 x" e8 W: }" J
6 e' A: z) Y9 N6 K3 Y0 U& |   push    00                        ; OF_READ. ^$ ]+ @1 z; o0 f# W' ?  W: m
   mov     eax,[00656634]            ; '\\.\SICE',0% \3 Q- h) v( i9 m1 R  h
   push    eax
( `, X- X9 ]4 M6 Q: i$ U! a" Y( E   call    KERNEL32!_lopen( a" t% P, m; u2 k) T, i
   inc     eax
; _2 m. S/ P0 C% \( C' x   jnz     00650589                  ; detected' w! ?  v' F0 h
   push    00                        ; OF_READ
, Y0 D1 T' n. G5 x3 m   mov     eax,[00656638]            ; '\\.\SICE'
7 A$ {$ y/ C6 N* m# E5 j  y   push    eax* B2 f4 D) i) H* ~( [, K% \
   call    KERNEL32!_lopen5 d, N! {( t- T8 Q, l4 L
   inc     eax
' K. }9 D$ F6 V) ~6 m   jz      006505ae                  ; not detected
: M, a- p2 q# Q" D2 A+ R0 A
# E3 d  \1 P! }) f! F! e  o- Z2 Z+ s0 E% t7 y2 J- N
__________________________________________________________________________
% w/ D  m% T. N! e9 ^' v, m
4 r1 b. Z# ?0 u6 I; D) z9 iMethod 123 N, Z; [( x& T) q6 I' |
=========
* K3 [0 I" r9 f; a, C# I0 l* ]% f% o: J# F# `: ^
This trick is similar to int41h/4fh Debugger installation check (code 05
4 l& \' E3 M' e  Q1 y: g&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ {# `+ X9 E' x+ T# q0 a
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ _) \6 @, {& ~/ G
4 c' p; G% `7 F( L% R$ U4 n
   push  0000004fh         ; function 4fh
% H3 d  K5 r- X* R- Y4 ?! W   push  002a002ah         ; high word specifies which VxD (VWIN32)
  M) Q0 I; U5 w9 r0 N  [                           ; low word specifies which service
9 M9 A. ~: Z( m' k* x4 x                             (VWIN32_Int41Dispatch)# y; Z7 d2 c0 }& O9 r2 G9 V
   call  Kernel32!ORD_001  ; VxdCall) I6 a3 y' J7 Z8 r. F' a9 `
   cmp   ax, 0f386h        ; magic number returned by system debuggers3 J$ T4 x! A/ }' w3 C& ?/ t# c
   jz    SoftICE_detected
) H  C/ H! L' y9 s) d! e5 F  H( D
Here again, several ways to detect it:
; e4 D9 t5 i. O7 m0 U) Q* W& H* l% J/ U1 [" S2 g
    BPINT 41 if ax==4f9 R- E, D+ e$ |( N! O

8 X7 P3 e' I4 V6 f) x    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) R, P6 [9 i* y9 k3 F' J. \
8 D% _; v4 n8 ?3 }3 c    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 y: J# z# l* h2 @0 n

7 c7 [  {2 ^+ W    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 @9 C( x% c/ q. j0 e1 ?
/ N# r3 a+ R6 W. j, O+ g; L__________________________________________________________________________: s0 W" V  q2 f& [' a
$ Q6 v; j1 x' I9 ~4 B7 g3 p
Method 13" {/ @0 ~  m  `
=========2 r0 J7 E  h; ~: _( ]$ y* L

+ H0 X1 @7 Q- k' `( r2 aNot a real method of detection, but a good way to know if SoftICE is
; a  H3 D5 O8 F- U/ H0 v6 C6 zinstalled on a computer and to locate its installation directory.
8 V! y/ ?3 ?) {) DIt is used by few softs which access the following registry keys (usually #2) :3 Y) L: `7 D2 J) r5 P7 A+ A

1 T0 N1 u" A7 l5 K6 e-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# j4 W* d; s' E; _* O  U\Uninstall\SoftICE
8 n6 ]) O' |; V/ }-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) O+ e8 U7 Q7 @8 R! W
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( \) g( L' K9 l' h\App Paths\Loader32.Exe
$ y8 o* M. o8 \/ Y! [7 P& m3 p
2 \- Z; A! U6 p7 T, D9 P% M7 J9 k7 X
# S" ]4 M7 t" V5 ^" J) pNote that some nasty apps could then erase all files from SoftICE directory
) y/ u2 ~, K- O2 S2 e) N: B7 l(I faced that once :-(, ]& e; y8 @! e

2 D* Y$ i$ Q. m* m: J$ V( a) y( vUseful breakpoint to detect it:
% J; v- s6 U* o7 X7 C; x# I: e  r2 C% \
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
5 D# R& n' \: i
( w% m! Q- z' \__________________________________________________________________________
% j: F. D/ I+ f" X, q0 p- K
3 }5 l4 A# N" a+ u# f$ l1 ?' o0 I# k, p, I7 |- d" ~
Method 14 7 R: O" _# y  ^3 L0 v) I- {, Y) W
=========1 Z" i, b" O1 {# i% h+ A  c% B
9 {' |/ ?- Q1 E1 O. m. \
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; X" R0 {5 k4 W2 L; lis to determines whether a debugger is running on your system (ring0 only).: ~- W$ W* n+ f* d# {3 d. g6 p: Q8 B
. j. k- r+ c4 \
   VMMCall Test_Debug_Installed" S* C/ V. j3 y7 C0 U6 w5 |
   je      not_installed. h& p0 i/ H8 G, s. q# X

8 o9 j0 j5 I8 \$ ]& k, `+ {' n# o* UThis service just checks a flag.- y: W- \7 \6 B9 ^0 {; v- |
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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