About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 g# X. N9 u' Z/ y) c4 x
<TBODY>& U& j. Y1 c0 u2 H& ~/ q, x( U! a
<TR>
: r0 E1 k2 A$ O<TD><PRE>Method 01 - _' ~& R# X1 J
=========
, [/ j  B  V) u0 h6 @& l0 G. _' {' O; n7 n/ F& D% \
This method of detection of SoftICE (as well as the following one) is1 }& J; H/ V1 g
used by the majority of packers/encryptors found on Internet.
3 I; `6 D: [% s; Z) u( {  zIt seeks the signature of BoundsChecker in SoftICE  A/ U& K: u% l; h+ e& W
# t" W# |+ @" i" x' v3 L5 k( f$ G
    mov     ebp, 04243484Bh        ; 'BCHK'7 ~) A0 K! [& i' K! N
    mov     ax, 04h% a9 f4 h5 u8 \
    int     3       3 }) A) W6 P3 g3 {
    cmp     al,4  g8 I5 b. E  h5 y6 \( \  k
    jnz     SoftICE_Detected
  X: ?- O# j; B- z4 x
2 Q$ H2 A9 B3 T% n___________________________________________________________________________- Y3 H7 W) o3 q0 G. D

( x! g$ h. w3 y. M4 j( G! Q2 Y& z, m; ]Method 020 l7 I1 k3 n+ P6 B1 d: w% L! ?8 o
=========
- H' |8 h  m7 f( N
( p1 ^0 k. o" B2 m1 iStill a method very much used (perhaps the most frequent one).  It is used- Y1 Y' I, b2 Z" V
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 y& e8 B+ {4 p) q$ x0 D2 Z. ^
or execute SoftICE commands...
% L; x* |8 W  @+ `$ q( e$ v' m! P; iIt is also used to crash SoftICE and to force it to execute any commands
4 `( `: }, M' a& |(HBOOT...) :-((  
  |! F  Q* T1 p3 G0 h
9 u  Y1 R1 N$ k7 JHere is a quick description:& t% |6 p/ [; b0 Z# \3 N1 q
-AX = 0910h   (Display string in SIce windows)6 B# N) e8 e0 f
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)' E& f5 R8 ^, u
-AX = 0912h   (Get breakpoint infos)
8 `0 }& ]( g+ r! z* Z-AX = 0913h   (Set Sice breakpoints)
: {( o6 U% w  |-AX = 0914h   (Remove SIce breakoints)
. }0 P  D7 p6 Y6 a) q: c8 T
( |# o- |9 }9 fEach time you'll meet this trick, you'll see:
2 A: S3 [- S* j6 e-SI = 4647h9 R' O! O6 ^; T) S6 W0 y
-DI = 4A4Dh/ O. t  |" N8 {  z
Which are the 'magic values' used by SoftIce." g1 d& C  ~4 T; x0 p3 ^
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ Q/ T. z, C) V1 }! |8 D9 i! B
( ?+ z3 B# y; k/ G( aHere is one example from the file "Haspinst.exe" which is the dongle HASP
0 f- h) g6 I9 s/ R( ?. AEnvelope utility use to protect DOS applications:8 ?; X" T) ~* j4 [% e

6 I1 b' Q1 J: h/ d( x  f0 }5 F; ?( d/ k! h% [8 j
4C19:0095   MOV    AX,0911  ; execute command.; K2 q. G2 [; c
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).0 ?( E9 w! S5 w0 C7 g: \
4C19:009A   MOV    SI,4647  ; 1st magic value.0 G% A' v# v" D2 P6 H" _
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.* U2 J9 S6 i' m3 ?8 D7 L
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ Z* g5 r7 @, d( A* t
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
1 d0 G# T+ U6 }2 i% Q& Y3 ~4C19:00A4   INC    CX: T' K. S; N4 ~
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 A5 k; |2 \! c" p7 q) g+ @- d4C19:00A8   JB     0095     ; 6 different commands.5 |4 d' J4 ?8 m3 A. j9 \
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& b$ B* P' I% y# P  j7 w1 u
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 d7 u$ Q* |2 N1 N5 j: V
* b" l, k1 z5 g- J9 u' L: y, G
The program will execute 6 different SIce commands located at ds:dx, which
) t4 s! ~3 Y: Z# u$ \are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 k$ {# M4 `* w$ p% g6 `8 R2 @. c5 H& H
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% K$ r5 j& b' a& ~: d! T___________________________________________________________________________% R: C: o& W( t' K9 T3 R* ?9 E
9 r+ q1 I& B) u' b

; R1 [! D* ]" C. _! B: vMethod 03
( p+ T1 g0 z: x1 r5 p=========
, N) ^; @$ M/ p# R
' ~4 d: T$ w" b  e$ \* iLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 }  {: g: y3 R) V0 G: o5 i( l9 D(API Get entry point)
5 s8 {% x! C' k        + j) D% w" W% C$ d" i/ t2 O6 @

. U: C0 V: t6 S) J/ |* C' d7 Y- w    xor     di,di9 Z" R4 K7 q$ V4 Q! W/ r2 ~
    mov     es,di
4 ]: }2 x1 Y  h  |5 j8 Y+ ?" T    mov     ax, 1684h      
- X- V  B6 j9 _  y9 F% A  A    mov     bx, 0202h       ; VxD ID of winice
" [. ^1 i/ @0 W( h3 X' j, S; U, Q    int     2Fh/ P9 H7 G+ ^! l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* [- I& u. s$ V7 n/ w    add     ax, di3 ^+ E) ^9 G$ f2 j. X6 ~7 W, _! p
    test    ax,ax5 T" }- R3 I# z$ K+ Q7 u
    jnz     SoftICE_Detected
% }7 I. N! S1 `/ S1 t- d7 }7 @! l8 }6 S1 p' Y) G8 X
___________________________________________________________________________# v: ]( i: F% u1 S7 }6 t
& U3 F6 N2 }/ B  d( {/ b: P
Method 04
8 p- {  |, p7 [9 X. Z1 o' o( y=========) f- O& e; d& S: u, p) V1 ~7 n: b
5 o0 j  o8 e" ]3 m2 d3 t. [
Method identical to the preceding one except that it seeks the ID of SoftICE" W! `' ^  {# N6 g* X* [9 s
GFX VxD.  P& ^: v- U1 G

( I! W4 y3 X  k9 H6 j3 U8 c& {    xor     di,di
  l) i# M: u9 L4 `4 y2 w( U* u    mov     es,di# U7 B* h; @9 X$ ^7 P
    mov     ax, 1684h      
1 C% X0 z$ `% Y% K/ J% N    mov     bx, 7a5Fh       ; VxD ID of SIWVID
/ O" N+ X  y, Z- C; T/ r( z    int     2fh1 T  D$ u! M" A7 V" A: U2 X- G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 }: }- C: ^2 \+ w! K) Y8 u    add     ax, di
4 M* V$ o- Q$ r6 S- m9 K! x2 v# @    test    ax,ax3 P; {" x& f8 a
    jnz     SoftICE_Detected& o: a3 l) E6 k/ w
3 U+ d$ ^7 n1 g* Q6 A
__________________________________________________________________________
" m9 w" o+ }/ E4 P- l6 W: J
4 |* r& |! y1 f2 ]6 u* ?1 y1 V, g9 _2 G1 W9 G1 \! J
Method 058 p( a# v: f7 Z
=========
+ w5 G; @- H0 G. O- v. F+ Y8 z% ^% c( J' Y
Method seeking the 'magic number' 0F386h returned (in ax) by all system2 \9 L2 ^; c, z# k5 I1 I7 D
debugger. It calls the int 41h, function 4Fh.
2 ]6 P0 C4 ]2 ~% V& C, _- s+ GThere are several alternatives.  
( x( i' ~( m/ g. x: S5 F6 h4 s- w# ?& }" {" I1 u% t
The following one is the simplest:# C* G5 r4 E4 ~3 h, U2 w
& ^$ ~4 K! n+ e0 D
    mov     ax,4fh
0 H4 I; h/ H& P/ x: o6 c    int     41h
* o# h' X5 O! T: Z6 O  v  i    cmp     ax, 0F386
, ]  C" T6 y+ x- d+ n2 n    jz      SoftICE_detected
0 W" R! D, k, `: ^" l* m5 o2 ^- b. q8 ]+ |

6 g6 M; `7 `4 rNext method as well as the following one are 2 examples from Stone's % b7 M5 ~3 y- P6 U7 u& O* h9 h
"stn-wid.zip" (www.cracking.net):
) u7 x/ @7 h: W/ l- E4 P: ]7 O* z8 ~4 L* w
    mov     bx, cs# n! m1 `+ L- K# d% f
    lea     dx, int41handler2' l* X2 _* Y  o( c: S
    xchg    dx, es:[41h*4]
( D% i. N4 C' Q, b- h6 `+ I6 ?    xchg    bx, es:[41h*4+2]( I8 Q* t/ t0 Z9 e( y2 a3 H) T
    mov     ax,4fh/ {3 b* q- `7 x1 z
    int     41h# P4 s- P+ t( q, o, d, l3 w
    xchg    dx, es:[41h*4]/ U  |, {# w, m- J' e
    xchg    bx, es:[41h*4+2]4 q- X+ D2 j/ w7 z) \3 D, L
    cmp     ax, 0f386h* _3 t* f* x3 U: L$ A( x3 y& g' z
    jz      SoftICE_detected  i; o8 t, m+ ]# f: q8 z

3 `, b- [4 ]: X0 @$ f0 }8 l8 nint41handler2 PROC
7 Z& i! s! G4 c+ D9 ~    iret: i4 R* f) V2 G7 Q6 A" h, }3 J" Z
int41handler2 ENDP
. Y) j, b1 o. M3 a. Y& F6 G) w  F; q) T. {
( M: M5 k2 ]! z; s# q
_________________________________________________________________________9 N( d& E) }* i1 n, i( v
  J) n1 z5 B/ f

6 ]+ G! k) o# ?( X; l8 I  x4 JMethod 060 Z# s0 f! E# m* H
=========
- O1 S4 f7 g* F- C
5 ^; E% G; X8 p( O7 j
) S( K/ c% P6 h4 e, w2nd method similar to the preceding one but more difficult to detect:( X: h' g2 S$ E/ b. ~; b
0 w# ^9 e9 l3 c( C. x: w( j

! t6 J- ?& ?% V- J: u& [/ Fint41handler PROC$ X: O3 ]+ h% W1 ~- ^
    mov     cl,al
, U8 Q1 L0 V, }: J# }( s    iret
2 Z4 M; @( r6 n4 e' O* S! o, mint41handler ENDP
- y% |) N+ c3 c0 s; t# q- o8 z  W( t9 F: K* ]

6 z+ T2 |8 I& H. G. Q6 Z    xor     ax,ax- o1 \* @1 Q( }$ }
    mov     es,ax& e) `! _' z  B* g$ y% F
    mov     bx, cs: i  s8 K0 U0 g$ ~, t2 t
    lea     dx, int41handler8 z  l  H" e  {
    xchg    dx, es:[41h*4]; L5 g9 R9 N: m( E7 ?8 s
    xchg    bx, es:[41h*4+2]
; e% m# ^7 t( z4 j# a$ ]    in      al, 40h7 L( e9 B5 c/ x- [  |
    xor     cx,cx
, ~* r/ R; j/ u9 r    int     41h* G: t8 W6 A7 Q& I
    xchg    dx, es:[41h*4]- K5 B4 \7 X( K: A+ G* A
    xchg    bx, es:[41h*4+2]0 j8 [3 m1 t8 }( a
    cmp     cl,al, w7 N/ ~" O/ c
    jnz     SoftICE_detected
  i# p! G! [' l* ~1 q3 M' K  N  j2 G
2 ]. J  X# \" L_________________________________________________________________________
$ T- R6 c* Y0 V* ]3 f% Y1 u
7 m+ L( Q9 U; R/ H( ]Method 07
0 e* u2 J/ [/ @7 W5 E=========
' t3 Y3 d% @3 f) J- r& \1 u7 D0 F* y1 x0 I0 e; v
Method of detection of the WinICE handler in the int68h (V86). `3 R! S% C7 W# e) y- H! I" o

* D% h, N2 x3 H7 x/ a* K& E    mov     ah,43h2 {$ T: R0 C# ^; h6 x( d* t
    int     68h$ ~/ Q7 _, c6 K6 Z- c6 l% ~
    cmp     ax,0F386h
; E( C- R) M0 M$ P9 O    jz      SoftICE_Detected
3 g1 y# R3 l- U$ c- E
. E4 \3 f: f0 I# N
4 v% e3 f. s- B, V7 R- G/ U7 D=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit7 _, ^/ Z: q5 H- B* J. n# K9 x
   app like this:" |) u- ^! x+ O% O7 o. K% X

% z& C# J7 t! G; V   BPX exec_int if ax==68. H  `) G4 z1 N2 F
   (function called is located at byte ptr [ebp+1Dh] and client eip is  d( m0 `  `% N( _
   located at [ebp+48h] for 32Bit apps)
0 ]0 j* t5 w9 `/ C__________________________________________________________________________
2 T0 C& ~. Y$ K; q' O- }$ T
2 T' P) s7 `8 `1 |' N2 R7 `2 T) f) \, R
Method 08& c- j6 J' ^# f1 y* B
=========8 i% v& N( i" b6 ^9 o

5 S4 k  S5 i3 b1 EIt is not a method of detection of SoftICE but a possibility to crash the# l6 k; N) }  ^% L! y1 x% r/ Y1 r
system by intercepting int 01h and int 03h and redirecting them to another, G" c* Q) r  H2 I! C3 H  d# f9 c
routine.. J. J- f7 i* n
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ q+ w. L% k' _4 W- A. a$ j: q) _to the new routine to execute (hangs computer...); l4 K! }) `% _6 _' Z
8 \& u5 K$ P/ t: ]* G
    mov     ah, 25h
  B2 E  u/ q' X  \    mov     al, Int_Number (01h or 03h)# Z! ^1 c9 I% z8 C' X1 @
    mov     dx, offset New_Int_Routine+ Z9 `$ h, |0 S
    int     21h
) g3 l  d, _3 h$ M* E
  i2 k9 s5 i8 n  R__________________________________________________________________________. H# ]/ r. q6 c, R/ H
9 j+ ^1 e1 J" L7 P/ n* w
Method 09$ G# y+ l6 @; v- L
=========
7 ~' ~$ m1 o5 o/ C- Q% l! x5 k
  \& n$ q6 Y5 b$ t" OThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ a% s2 j# ?! z# R! V# P+ k% K+ ?performed in ring0 (VxD or a ring3 app using the VxdCall).
0 _' E$ B' }: r$ g7 wThe Get_DDB service is used to determine whether or not a VxD is installed& P( @% b9 n" {- _* A4 T
for the specified device and returns a Device Description Block (in ecx) for) j. ~, b1 l) F8 o, U: j
that device if it is installed.. O7 @7 z, R( R9 P4 H# F

7 z6 f3 h$ i2 R2 J   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
' g" \8 q. Z! N" `- d) O/ o   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ E& I  r( B- W
   VMMCall Get_DDB0 R2 H! q: `  q( B  P
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
5 w* K7 p& I* S& F2 h) p' w5 m# j" i0 T6 u2 q# U
Note as well that you can easily detect this method with SoftICE:
) H1 n1 b$ V, Q. c) |  ?* g   bpx Get_DDB if ax==0202 || ax==7a5fh
" f4 ^: _, Q8 {
1 z/ ]( z( w, R7 Y' @1 x__________________________________________________________________________1 ]. y2 o4 E9 }# Y) M" O

) g! c$ _  h. g( |Method 10
: D5 x1 [/ V  T2 p- {; g8 F4 G=========
3 |! y" x! r2 W  P: Z$ Z2 ]9 E8 B/ ~6 k) ?; G; b$ n0 Y9 d
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
( j# w4 I, R$ [, f3 _/ b  SoftICE while the option is enable!!3 d  H9 V: M- x2 P3 j1 N
! t( S' S# K& J1 z
This trick is very efficient:0 t. ^  Y: q( h) U% I
by checking the Debug Registers, you can detect if SoftICE is loaded
! M% h  }$ t; K4 z1 \6 G. x(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ A/ w( F6 ]% u& g% O
there are some memory breakpoints set (dr0 to dr3) simply by reading their+ k& r& p+ X+ z) A: S2 a
value (in ring0 only). Values can be manipulated and or changed as well
! u( o5 Y/ E0 @6 E(clearing BPMs for instance)
3 a0 |2 w: l" h, u7 d( f4 q1 s3 q( c9 L8 U# e' M6 ]9 D9 ^  M% L1 R$ @) s
__________________________________________________________________________
8 B/ y" T. Z9 L1 F- l- c
* j) B, m) P' E2 @; d! SMethod 119 j/ q% Y+ f  H! J2 S7 r: e% T% ~: q( e
=========# m: f4 t* Z/ ?( o0 ]) d- S5 i3 |6 x
- N* c9 B1 j4 g; h) a& Y( P# _( o
This method is most known as 'MeltICE' because it has been freely distributed0 X# T' C# [& c! Q
via www.winfiles.com. However it was first used by NuMega people to allow
3 U; m. t, X2 Z6 q: T; P% kSymbol Loader to check if SoftICE was active or not (the code is located
6 e' z& z8 Q0 @  ~) ]* k, V& @inside nmtrans.dll).
" v- l* I" }! T% p
1 X) a6 ^. ~: v' XThe way it works is very simple:
' ], M- }* W% _; W$ E: i* J, J4 ]It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) R3 v2 S# B* ?6 H5 o
WinNT) with the CreateFileA API.
2 C% w3 V3 C% h
3 Z# ~! U* [! [$ yHere is a sample (checking for 'SICE'):
/ c8 k) i" F, p' z1 t" g. P
5 Z: \  `/ f$ }5 s1 p) i* xBOOL IsSoftIce95Loaded()
5 t' ?, |6 d  a" U1 M, P{- m$ R& i2 a: A5 n  l, x
   HANDLE hFile;  2 t% s) o' [  c# u+ ~
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ K9 _0 P+ q2 L" {* R/ P" W                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. v, v( Z- G) v9 c0 ]( m: [                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 M' J, ~4 [) J1 |0 U! P* A   if( hFile != INVALID_HANDLE_VALUE )  l' v  U3 Z3 y# a/ u/ c* R
   {" m* v; n* m! w4 p- t, p$ {) T
      CloseHandle(hFile);
' x* t% E" `7 v% U% s      return TRUE;( T8 E7 m9 ?, |' |' ?* N) A
   }3 ~* U1 |6 U2 k/ \
   return FALSE;7 s0 T/ z) A) ~( c
}
3 ^1 l3 c% h+ k4 `  [; m) @" a5 B
Although this trick calls the CreateFileA function, don't even expect to be. \& F* i* l8 I$ _
able to intercept it by installing a IFS hook: it will not work, no way!
0 Q7 z: I9 ?) c" wIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
3 h( D8 F$ p. c  [( }2 A% Yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' z( k& J9 }5 w( D+ z* H+ E' D
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
1 V8 ]) d8 j# Q& N9 nfield.: W/ p7 \5 f( y& h) |
In fact, its purpose is not to load/unload VxDs but only to send a
) k7 M0 ~6 |# a$ |, i+ tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( n( G% t' \; Eto the VxD Control_Dispatch proc (how the hell a shareware soft could try5 X) r7 E( M1 ?* f
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
  V4 o# y( M1 C6 r  i- iIf the VxD is loaded, it will always clear eax and the Carry flag to allow
4 N: b5 Y8 Q9 m8 yits handle to be opened and then, will be detected.
8 i% c# `9 u8 K8 U  w) O! e9 OYou can check that simply by hooking Winice.exe control proc entry point& h5 o& B8 w& U$ n
while running MeltICE.
6 j7 f8 n* k# s( _  g% S
) J% W  x- V+ {* F( D8 ~' k* c* ?0 d7 o( E! P9 z( ?7 X  o, V
  00401067:  push      00402025    ; \\.\SICE
0 h$ [' M9 g. g' \- U3 w3 i$ l  0040106C:  call      CreateFileA" e6 g5 {- ~/ z% z1 h* w
  00401071:  cmp       eax,-0014 q0 [: _1 ]5 B8 _
  00401074:  je        00401091
! m' c" @9 {7 A& P7 p* _
* h+ v0 ]5 b( B( B. r$ H; R" c: @  x4 I, A( d- U( y
There could be hundreds of BPX you could use to detect this trick.. R9 C1 E- G) W# a. t  Y
-The most classical one is:3 N5 b& h/ a8 G& e
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 H& ^& r& a1 f  u+ H/ b4 O/ o& ?( v) A
    *(esp-&gt;4+4)=='NTIC'
6 Q+ J" z6 \' e
" R& v5 ~1 g$ W2 d7 E-The most exotic ones (could be very slooooow :-(
, u# V3 P$ j. C2 `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
$ r. m$ m( I7 {9 c+ E, U     ;will break 3 times :-(8 V. A* d* p- ?* A: s

, S8 U& z& F" k* ^1 E-or (a bit) faster: ; Z2 U' }# p- K0 z1 I) _' a
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) b& u; G, ^9 P* b$ j0 X

" R: h3 q( i+ w- v9 }1 d   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ S# I* U$ C; B9 s% f     ;will break 3 times :-(
( l- D, ?8 x, j$ z) w9 u; m* K# H+ w8 {8 w- w" {, n4 M( I
-Much faster:
7 F  L7 ~9 }0 v; k   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' V/ e& _2 u$ U3 i! d0 H1 i4 ~7 K5 ]! B3 h
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen. P' K5 p6 q$ k, |) @  M8 R
function to do the same job:
( ?0 C2 D$ U) s8 Q6 s* W; e
* \4 [; N6 D7 f7 O* y6 f   push    00                        ; OF_READ4 U. N9 u" t+ Q. n4 v3 x' l8 j4 s$ q
   mov     eax,[00656634]            ; '\\.\SICE',0
! s& @5 u5 r7 Q$ _: {4 X   push    eax" V6 E0 o5 ]. O% |4 {- S" V
   call    KERNEL32!_lopen
% D1 F% J' I6 ]" {6 t  [/ E. `   inc     eax3 Y' ~/ F% J" ?& _  M6 l& B. U; H
   jnz     00650589                  ; detected/ N' q  e3 X' R  F# H2 l* m
   push    00                        ; OF_READ
3 ~1 D+ Q- I0 _4 r$ W4 h) [   mov     eax,[00656638]            ; '\\.\SICE'7 m" u  c" u" l7 ^7 F" t
   push    eax
3 N% i! L% q& S- v; V$ {( f* \   call    KERNEL32!_lopen
2 y; Z2 `7 K" Z7 d! S/ T: Y/ f   inc     eax4 I7 p2 G8 M8 D5 a
   jz      006505ae                  ; not detected' A/ C% j! H; C0 r0 {8 H' r" c( m
4 {! e2 H- r: Y& f

' r  `( B% H; W- E__________________________________________________________________________
. ^8 u" n6 V5 C4 U
$ r5 _+ p7 B3 KMethod 12; I1 T/ Q: i6 N2 S; i3 G
=========% {: L) u3 x/ h6 d; }' x8 G) A# f
# T9 o4 P; V7 A' N* X. z
This trick is similar to int41h/4fh Debugger installation check (code 05
8 T, F: m" ?0 h( u- Y6 h( v# `&amp; 06) but very limited because it's only available for Win95/98 (not NT)" M7 [/ j0 Q2 _1 P' f
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 V/ ]& q6 l2 A" a7 r& S  b* o
  T' R5 T1 H; r. |
   push  0000004fh         ; function 4fh
5 `# d5 B+ H* e   push  002a002ah         ; high word specifies which VxD (VWIN32): T: E/ K( K( E1 u
                           ; low word specifies which service/ ]5 o% G* H; s9 ^2 X) G
                             (VWIN32_Int41Dispatch)
# u% \/ X0 ~6 E% Y7 [7 N! _   call  Kernel32!ORD_001  ; VxdCall
5 u$ ~+ y; _& R# Q' L9 Y   cmp   ax, 0f386h        ; magic number returned by system debuggers' D- x. Q5 J) ~
   jz    SoftICE_detected/ ~: D: }5 U9 ~& C. U) v) P' G5 H

; r7 L1 t1 n* s4 L9 O! sHere again, several ways to detect it:
5 o! E" r# K0 ~, \$ [9 t& E7 Y' R
0 m; I9 A' O5 w. s    BPINT 41 if ax==4f
9 f8 ^$ p8 j, _
: C9 Z  B3 E( V4 ?: ?1 @    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one; n' ], G3 u) Q9 K; g1 R; @5 H
8 d5 n0 ~2 {5 b* A4 }. |8 r6 C3 G
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A$ N; \3 M' w! Y" Y
8 F: `' {5 M/ |& c; y
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 q; a0 y* ]( I
1 ?; H- @4 ^  ^9 K# |
__________________________________________________________________________$ P8 S2 x; y' X. M

5 Y6 e- O( p6 RMethod 13
8 k; S* b& n( M# |+ D+ P% A=========
# _' u) A5 Y# C
7 j9 ?2 ~2 Y. I6 TNot a real method of detection, but a good way to know if SoftICE is
0 i2 T6 D" m) q- \9 _% K4 tinstalled on a computer and to locate its installation directory., B! J, R/ f; u) u  E
It is used by few softs which access the following registry keys (usually #2) :" g; D3 F* N: {1 X! l5 k8 H
" Z, Z4 `2 q) h, X8 o
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( b9 b8 w. S$ m4 u\Uninstall\SoftICE; S' h2 H8 @. ~
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- v- v. p! J0 W1 J7 _" B' i-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 Q2 `1 j9 P; B" L5 f\App Paths\Loader32.Exe
  S2 i5 |/ A4 d" o+ i8 i" U" Z# H( S$ O* }% ]1 D
1 m4 D1 c5 [5 L
Note that some nasty apps could then erase all files from SoftICE directory. P; |' q5 R% D
(I faced that once :-(
5 l. v* v( U' u  p! V
* I: Q* B* w/ o7 ~) x1 e; l" AUseful breakpoint to detect it:
8 v+ r4 \! G( G# |) G) M5 P1 q! j$ N: S5 {
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
- O1 n+ F3 \+ |4 p/ q) F, |- N; I, d* q* z4 `
__________________________________________________________________________( T0 D6 U7 Y6 Q# X; M

4 q5 ~  i, N( p; k% Q9 X, f
, }6 j% w' m2 g( RMethod 14 # ?: c; ^! n1 C! ^, p0 a
=========( y( ?4 L% }' ]7 b

) o/ [+ j2 W4 \1 k, H. a0 \A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
" q3 V* a# X, `; Cis to determines whether a debugger is running on your system (ring0 only).
' s$ V1 q5 P  ]" ]; a. e4 t! t% Z0 c% K% l$ G
   VMMCall Test_Debug_Installed
+ V9 E' w) W/ h4 t: S2 a+ Z   je      not_installed6 p% f% P5 H1 X4 ^
' D2 _" d9 \+ e' e" b: F4 G  m
This service just checks a flag.' Z. Z% L; ?8 v" h# O# B& D. _; k7 L
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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