About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ \. `8 z# I2 W$ x<TBODY>
" Y5 u, F+ M- I3 D<TR>. ~1 `/ C6 @" S9 e& C$ ?8 U! L( k/ [
<TD><PRE>Method 01 , U% o+ n# o% n# b3 v9 T
=========
0 n; D# B  K5 I' G* f4 ?" v* V
This method of detection of SoftICE (as well as the following one) is
# d2 s$ S0 p; O! W  a! |8 ~. \used by the majority of packers/encryptors found on Internet.
7 j4 t( B. p& _. y1 s; B& h& KIt seeks the signature of BoundsChecker in SoftICE
7 {* T* a9 O# M8 n4 V+ O4 o0 J$ j( P4 M' E" v7 t/ J
    mov     ebp, 04243484Bh        ; 'BCHK'! @2 F) q$ A$ k& [, k$ U, w% ~$ @
    mov     ax, 04h7 I; A& s2 ^% u, k  x
    int     3      
5 x4 `! w4 A6 W  m    cmp     al,42 \+ z- N! x5 L; ]- C8 h
    jnz     SoftICE_Detected: A* T1 G* c5 a+ e/ `) U7 N

: R0 R/ A; t0 B+ t" e3 ____________________________________________________________________________$ d# i" i- Y3 [  \0 J, Q

& A; x2 R- K$ C6 ]Method 026 D* \  b9 o4 x% I9 w
=========
0 K, V, t+ }3 z* T, }2 [# a0 X3 t. [& j3 p7 N
Still a method very much used (perhaps the most frequent one).  It is used
  y) E; U6 g1 M0 r% N& Ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,
. P# Z7 X3 n$ e; ~6 P" F- Vor execute SoftICE commands...2 U( x; T0 x" h, w# b
It is also used to crash SoftICE and to force it to execute any commands! O- E: N" @/ a
(HBOOT...) :-((  1 h1 n4 {1 l4 J0 a! p: G

( t5 @: b& S7 P. @( H8 iHere is a quick description:
- t' r( l0 H9 g6 A/ M# i' s-AX = 0910h   (Display string in SIce windows)% K& ]/ p( n4 C. _. Y
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! t. c+ z8 q( ]; U-AX = 0912h   (Get breakpoint infos)3 X' E- T% Y6 E1 }
-AX = 0913h   (Set Sice breakpoints)& @  L* E% {8 u" t6 U$ w' W( l
-AX = 0914h   (Remove SIce breakoints)
8 _9 \& a% U# r. |2 z) q4 _7 d7 {4 a! Z
Each time you'll meet this trick, you'll see:
* j% h# J& U/ i9 ?-SI = 4647h1 H6 h; B; o1 c0 F$ v: Z5 ^. |. e
-DI = 4A4Dh
) i% ?* D7 M# R; i2 y1 @: o- _Which are the 'magic values' used by SoftIce.% o$ v; W' w! _
For more informations, see "Ralf Brown Interrupt list" chapter int 03h., q. Q& B  e; q0 a0 b9 a9 `
% ?7 V) f$ ~9 e6 O" h* S
Here is one example from the file "Haspinst.exe" which is the dongle HASP
% d& |6 @/ g) ^, S( X( fEnvelope utility use to protect DOS applications:
6 e" q% [( L3 p/ w" s. k. b# f$ J/ F) b. u

% e5 p  c( |! I; t3 Q  F4C19:0095   MOV    AX,0911  ; execute command.
: P; v" i7 b! w4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
$ p. t6 T7 [/ }+ F4C19:009A   MOV    SI,4647  ; 1st magic value.; B5 i; j& y7 K: E
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 R' H5 W6 \) G* V( O" N- }+ ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' M4 @3 E* n, o4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
' o; R' s+ n9 `4C19:00A4   INC    CX9 I& V6 k7 i5 I! ~8 \$ n! {3 b+ w
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! `2 \9 v% b9 |; O+ ~
4C19:00A8   JB     0095     ; 6 different commands.
# H6 C$ \- T3 Y; h/ I5 ^7 |- Y' ]; k- o4C19:00AA   JMP    0002     ; Bad_Guy jmp back.) Z: x: j' m' y# G5 J
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)3 P0 O7 p! U! T( P% h

6 `) u, N# r/ I& _7 V/ mThe program will execute 6 different SIce commands located at ds:dx, which2 M0 @. g& q( p7 R8 D% R
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 @2 i$ |( i  r' ]1 Z3 U

" |+ `4 K3 R0 d5 w( b+ W3 R. u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 q( I& F' }2 k; i- d
___________________________________________________________________________
. i8 O$ C' l7 Y) @, R- k
9 C0 C& [3 C* p+ E: h2 @. h$ V  `6 M4 b- G. e, D9 R0 H
Method 03) E* I* ^) C( z: a& G8 L
=========* `, g7 i1 H: Y. _1 R" [' V

6 s: o5 }$ V1 k4 w+ {* j0 pLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ s$ ]3 n, H5 K2 p! u8 P
(API Get entry point)6 G! x% l3 q: J8 F- n! c
        ; |  {. j3 t9 ]  R' L6 ?/ U
' i' \# k7 B# f) O( J* o0 ?
    xor     di,di$ c7 T; Z, w/ ^0 T# D" Z# S
    mov     es,di0 x( ^1 f# l8 v1 ]4 a
    mov     ax, 1684h      
$ m  j  f4 D; q+ [1 e5 ]    mov     bx, 0202h       ; VxD ID of winice
8 L$ N' e9 H$ i/ x$ i1 w' s$ _' @' ^    int     2Fh
: E$ I+ {8 c4 e( y; O    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 ^# L* y1 V& V& f. |( ?
    add     ax, di
! O: n' e  z: _2 @' o    test    ax,ax
8 U* x! p. z. q/ T% ]    jnz     SoftICE_Detected5 X/ q: h! [/ G( _5 |

0 ?' _  ]6 U( g& D0 G$ \$ Y* D; j___________________________________________________________________________" n! @6 O/ F7 ^3 F6 F+ n
. z  |' Z* n2 U& N
Method 04
  l+ h' r) e" @7 v=========; Z  G: w4 {+ R' J5 q' l* n
4 P* Y3 Y+ K# Y; W* i2 n) g
Method identical to the preceding one except that it seeks the ID of SoftICE/ l' h& l  v) A( y$ g) Z6 f
GFX VxD.6 W/ r. Z( y. H. s7 o
' @3 Q) }8 g' S7 I$ G
    xor     di,di6 y1 W, I7 z* t( j7 |
    mov     es,di
) _) ?! d8 f8 x3 x3 T3 b    mov     ax, 1684h         W5 M8 f, j: V. i; A, d
    mov     bx, 7a5Fh       ; VxD ID of SIWVID0 i/ ]. I) P: P: F  m. Y& Y; v
    int     2fh* T2 {6 p1 }2 @  W7 j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ ?! D7 r0 q# v2 ^$ ^# {
    add     ax, di
4 L) m! `7 {( l/ X    test    ax,ax
2 b+ K3 R4 F4 l( ^3 [+ w    jnz     SoftICE_Detected; S( u/ o; M) X
- e$ p- {$ w/ N% k0 p
__________________________________________________________________________
& P4 W0 M9 _4 ]" }) n  f2 M. K, l) o) R$ ~2 X  `( \  K
3 @$ w# S- x8 ]/ ?! C  @
Method 05$ u& d2 W3 o: q- P' B
=========
2 N. x0 E$ ]. l# m: U' K
) w- j# O/ ^) u6 ?Method seeking the 'magic number' 0F386h returned (in ax) by all system
) |3 [, x5 ?+ B$ }' A7 s3 `debugger. It calls the int 41h, function 4Fh.) Y4 @+ I( x! x) C
There are several alternatives.  ! ~# b' q3 T$ h. O. ]
6 r9 x' N5 n/ G. _. d
The following one is the simplest:
. Z( f$ x) O6 M# @0 f) k0 M7 u# \6 t, p/ a- w5 J( ^
    mov     ax,4fh
/ B# f/ @. \9 l8 f/ _5 E" x    int     41h
" ?* M" ^! o3 h, ]" M% X8 \    cmp     ax, 0F386% ^7 v0 j1 @% @9 _. m7 L1 ]
    jz      SoftICE_detected
1 j: x) e3 s2 J& u( o6 S  P  x
4 V. P+ q7 Y& y2 d# \. d* E0 g
Next method as well as the following one are 2 examples from Stone's
- X- A- A& m' A"stn-wid.zip" (www.cracking.net):4 T7 H/ ~7 a! k/ n! @

: I: V; I2 Q+ y6 Y% {6 H+ K& u    mov     bx, cs9 M. V; n4 {- C, X
    lea     dx, int41handler2  Z$ q, {2 X* u) P7 f: u
    xchg    dx, es:[41h*4]7 K- B3 N) U( {; k
    xchg    bx, es:[41h*4+2]
1 g1 Q- S5 X8 B& k' z; d    mov     ax,4fh6 R/ x$ b2 h6 w: s. E4 J
    int     41h" h3 x& B9 r! ~" V6 K
    xchg    dx, es:[41h*4]
1 e  z; a* j* j7 P/ o% }, L% X4 k    xchg    bx, es:[41h*4+2]: m" G- W& g/ O$ K- N) n* h3 s, `
    cmp     ax, 0f386h
& \6 B3 m! w9 |$ I, a* {    jz      SoftICE_detected# x+ u* ?  ]2 @  x9 d/ D: ?, r

0 Z: l6 f* h, P5 _6 r0 B, I' rint41handler2 PROC
/ L$ i- |" f" d0 R% ~9 S    iret
1 s2 L* E: h( l5 i) zint41handler2 ENDP; ?& X" {: L( r' {1 _1 ]4 q

0 D4 B) N5 m; E6 f! D% K! T$ B7 q) O/ r
_________________________________________________________________________% v* b. I" w) y% t, P' Q* |; a

1 c9 Z, Q; Z& x9 H: c) n7 ]% e0 o  i% D( W0 H
Method 06
5 f; `" }9 J' A- F5 A# Y% P=========5 n: s$ T) i& ~2 ?# Y
& f6 U  h* f# n9 G# t

5 p( g5 T% L5 k6 N/ j+ j- k2nd method similar to the preceding one but more difficult to detect:
2 ~8 X# i. A) T. c% z  G5 G* t* z! V
1 x* _" f6 R; H* E' j
int41handler PROC, G& K0 n2 |( P3 m1 B
    mov     cl,al
3 i9 Q' d# w) z/ i* e' B    iret
+ d8 p* w) |: `int41handler ENDP
4 u/ G$ S$ M/ f) K, h2 X7 S+ C/ {. k( j4 F4 e$ o5 t
+ d1 s4 m- K& y+ p: u% _0 e% F2 E
    xor     ax,ax
: Y0 n+ d2 L) k! E6 o0 s6 R, `% Y1 V    mov     es,ax6 w% V5 p. h: n, T2 p3 }
    mov     bx, cs
6 s' B0 r; d8 u! ]0 J# z* A: v1 H    lea     dx, int41handler
% u$ y. n) j  p) w    xchg    dx, es:[41h*4]
; W. I: m' p, s  M$ w    xchg    bx, es:[41h*4+2]
! i0 T3 i6 M4 l& a, u* H& S5 n    in      al, 40h$ T) u" W+ C* I7 V( ]8 J4 }9 K
    xor     cx,cx6 x, f1 g- j# R( r' ~9 E9 V
    int     41h9 z7 r% Y. O3 H0 y7 q1 N/ c0 i; ~; n
    xchg    dx, es:[41h*4]
! }6 ^5 O) q3 T+ w4 Z7 ~8 K; j    xchg    bx, es:[41h*4+2]+ }) W9 m. s6 Q
    cmp     cl,al( g# k2 c2 l1 M3 ~
    jnz     SoftICE_detected
6 {% G# ^) a  ~$ q* p' K! @: f7 \' `: \2 g
_________________________________________________________________________! u' i8 B) K. F* |# @

1 W2 X8 {4 n6 ?: B( GMethod 07
, Y9 X' @* }, {6 P7 h- W=========* m8 m& W: C7 `( B8 q; \

) c; Y# e% E" f4 SMethod of detection of the WinICE handler in the int68h (V86)
6 X7 H' R! O3 t; J, [
- A. k3 \* y* T1 q+ j8 s    mov     ah,43h
7 {% A8 B' n' Z: m    int     68h
% D  u7 J8 {  [0 p    cmp     ax,0F386h! f% W% x% q# w' [5 ]
    jz      SoftICE_Detected7 M7 E4 f. [$ e

3 m% c! a* S  O; [* c0 r: {$ H& p) R, C& w1 M
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 s% j6 A) B. ]9 d9 V2 o   app like this:
" Q5 i6 p+ ^; o% X5 c. Z1 ]/ B% _1 ]8 f5 e& v0 L- R
   BPX exec_int if ax==68& V+ h, d3 [$ l
   (function called is located at byte ptr [ebp+1Dh] and client eip is# L; @/ y$ z$ I; U
   located at [ebp+48h] for 32Bit apps)6 Y& b4 u% N7 d  H; n5 u: s
__________________________________________________________________________
; g" p* d7 F1 R
! U0 N2 O( _6 h% y" F1 C9 M  |3 }- O* T! p5 h% g$ N
Method 08
1 [8 j' N1 O6 U& K5 N6 r& v1 e% u=========& C) t" ~: j4 v* s, b! N
% J1 b- I3 j+ l4 `" W* L
It is not a method of detection of SoftICE but a possibility to crash the  |0 [; T! |' A
system by intercepting int 01h and int 03h and redirecting them to another
9 Y$ E$ X6 K3 \# g% {routine.
- ]: d3 u8 A, ^5 f: pIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( h7 R! I2 g! Q4 z& T9 H
to the new routine to execute (hangs computer...)" A% ?( W0 s" t
6 i& Z1 d# J7 }; A
    mov     ah, 25h- F* P. ~- l; z9 R+ G! ?
    mov     al, Int_Number (01h or 03h)9 T# P0 ^& Z" s$ R4 o6 M: X
    mov     dx, offset New_Int_Routine8 J! I5 n& P4 z9 Q% O& X; N6 b
    int     21h) j8 Q# `+ w2 }4 N) D6 K& J0 @* N

4 _* A  P2 m. Y9 s__________________________________________________________________________
* ?# j) s+ P2 X" M2 R
+ S! T1 o3 ~7 s2 L; M6 i2 z: K" uMethod 09; G6 N( a! `8 E/ g$ R
=========
4 A) z( J, p& s% k/ n- l3 L$ @# ^+ E  r' U' U
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 F/ N! n2 J' h
performed in ring0 (VxD or a ring3 app using the VxdCall).
, H' O/ g, o: y4 t2 P) P/ R9 _$ ~The Get_DDB service is used to determine whether or not a VxD is installed
% H% T5 M0 K5 q3 K# q( K" q( y/ afor the specified device and returns a Device Description Block (in ecx) for
: Z8 s( z" Y: t; s6 ]$ nthat device if it is installed.
4 s2 z: E9 R) u0 m' c( g3 D  A4 D! W, K0 d9 `
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( N+ \: K7 Q/ J3 d  r( I
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), ^3 [" B, h9 M# C) N6 @+ Z
   VMMCall Get_DDB( ]6 s* m, L" W4 U. o
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
5 W3 D" W; {* l7 |& N4 ~
$ v' n7 e7 N0 n5 [% H  p% ]6 E2 cNote as well that you can easily detect this method with SoftICE:( p5 d# z, E5 ?- k7 F" n% U
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 C9 C$ u. \1 @. l" P5 p( k/ h) N+ z% ~0 R
__________________________________________________________________________
7 b+ x4 U3 y/ e
0 s/ }) P! E( e# L2 OMethod 10
+ W+ y& a- ~. @=========) n* D. R# V, H% n; v# r9 p. \

" x3 g8 @+ T: m5 M- T=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 Q6 L$ v6 i; K- J  SoftICE while the option is enable!!
, j2 G: _$ n7 s/ H" D1 ]9 J. m) r' X, J6 g0 I& ~$ {9 i$ N
This trick is very efficient:
. ?: E2 A3 x5 j; v6 g( wby checking the Debug Registers, you can detect if SoftICE is loaded" B0 d. h2 M  F1 E2 b1 }, ~. ]) I+ k
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) d2 \7 q9 L& W" A& K3 q. p
there are some memory breakpoints set (dr0 to dr3) simply by reading their
- [. ?9 x7 F. m4 Yvalue (in ring0 only). Values can be manipulated and or changed as well9 a7 m7 z$ n% ^
(clearing BPMs for instance)
3 W. G) g1 _8 ]/ g3 X, I' ?: I
) v" \& B9 S& j% v) P__________________________________________________________________________- J& }% ^1 l6 O+ Q; ?+ _: G

4 Q9 V  E- ?, ^0 C! NMethod 11; Z; f" U2 @/ T9 m( U- ?
=========
) {1 ^" w/ B' a+ [" w. j' h: g1 K4 F
This method is most known as 'MeltICE' because it has been freely distributed
' ^  G# @) u& y, z* Y0 A+ a2 Zvia www.winfiles.com. However it was first used by NuMega people to allow
$ p$ R6 t7 U! S% }; i$ S, F  [' I) OSymbol Loader to check if SoftICE was active or not (the code is located8 b8 J) a1 [; _; s; k( x& s
inside nmtrans.dll).7 A7 X. L# K/ @7 ?
4 ]: n+ ^/ ~! T- i
The way it works is very simple:- p/ M9 {6 d0 ?: m5 P. J8 x
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! t  I  v4 R4 ?0 v
WinNT) with the CreateFileA API.
6 {- C' g4 d4 p$ Z- t
/ o/ q+ \! `4 m7 E5 M$ f7 \8 \Here is a sample (checking for 'SICE'):7 i4 S7 A! A* R# b" I) `
9 q  q+ U9 j/ m- y- [4 N" o
BOOL IsSoftIce95Loaded()4 l4 ^- f$ A  T: Y  N
{* {# M5 \; I0 H6 }& j: e! w) J
   HANDLE hFile;  ! b1 p% z7 u& ~; u( S$ f- H
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' L9 e8 o* u* }: Q+ |$ M                      FILE_SHARE_READ | FILE_SHARE_WRITE,, K+ H  m% D' [0 T, \
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& q1 W5 d6 R+ T" A( M1 N4 ^
   if( hFile != INVALID_HANDLE_VALUE )
$ E+ P0 L( T' ?1 m3 q  g6 X   {
3 {, r# R& I/ H      CloseHandle(hFile);
3 W7 J9 f. ]# Z6 W) }5 f2 F      return TRUE;* K4 I* ~% W3 R3 o, O" X: a/ H
   }' l* B" W  Y' u0 o; y
   return FALSE;/ C6 r* p3 L. j8 L& k' G
}6 l/ R2 r- ^1 p( t' e# |; H

' P- C" O& V/ c5 s8 xAlthough this trick calls the CreateFileA function, don't even expect to be
# E- J. t7 Z3 d, V- zable to intercept it by installing a IFS hook: it will not work, no way!
( C1 _2 f% j  o1 H# ^+ DIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
- K6 Q* L8 s$ L- xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" D" }8 w, }1 g/ U1 {0 aand then browse the DDB list until it find the VxD and its DDB_Control_Proc+ k- [. U$ _" ]) B! h+ J8 k& J
field.
) e, u1 z- g: `0 [* VIn fact, its purpose is not to load/unload VxDs but only to send a
2 W( I) e. D4 e2 @W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( I6 m/ Y8 q% V7 c
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" t1 t: q7 X& eto load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ s( W' y( d9 i1 x! t4 O. b* eIf the VxD is loaded, it will always clear eax and the Carry flag to allow
5 ?& H! O) K3 l. ~its handle to be opened and then, will be detected.8 y+ K0 \, z* f. d9 x
You can check that simply by hooking Winice.exe control proc entry point
$ F. {- n/ ?2 s1 uwhile running MeltICE." U; ?; Q, C9 v% ]

/ E8 C; c( X+ b! t) t5 U: Y& A+ Q5 d( R
  00401067:  push      00402025    ; \\.\SICE# ?) N6 x: s9 X3 I6 Q5 ~, L
  0040106C:  call      CreateFileA
! M- B0 m  V0 i" z5 e# I  00401071:  cmp       eax,-001. ], L( [0 V, r3 s, a: g  @
  00401074:  je        004010919 u* U# y0 w; Y. _1 L& }: }4 Q4 J

5 A2 x' q9 A$ l5 b2 U) u1 f) V5 y' V# C: W0 i
There could be hundreds of BPX you could use to detect this trick.8 n4 w$ Y" w% K6 t- n3 [) a5 ?- u
-The most classical one is:0 A9 r5 M: G: g$ G
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ s& a) v; i% u' H
    *(esp-&gt;4+4)=='NTIC'
4 F; @, z0 D: ?2 Y: L
- g- I- U, k) X( @$ p-The most exotic ones (could be very slooooow :-(
4 {& m, O# C, n3 r+ b   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, F) u0 z& ]5 \# n: D5 ~* w3 o     ;will break 3 times :-(* k; R$ i. w  j, J) A
+ Z9 J, z7 }1 s, H( v8 M
-or (a bit) faster: " g& u4 s5 Z! f- o" @/ y
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) {/ ^6 M) y$ `( A9 p: Z  V
- m. {1 Q" [0 c2 ]) f5 q8 d0 o   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 W4 `+ `* O4 w& a5 B     ;will break 3 times :-() t4 i8 y. t1 ~  u: R0 @
$ L6 T7 y, n" @7 n- |" R) u
-Much faster:  e3 M8 E, K1 K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 P) s3 G( q, e7 C- i1 _
0 d, h5 b3 B% f' h% t, ^% c3 HNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
# H  \, D: U: c- Ffunction to do the same job:
% `- m3 D3 h) c, _
7 W; Z5 f& p& I) y   push    00                        ; OF_READ6 {3 \8 \) D$ r
   mov     eax,[00656634]            ; '\\.\SICE',00 O+ G1 s( X- w
   push    eax  p  {! R  T4 ^- \
   call    KERNEL32!_lopen/ C2 |  x3 K' ^& q# K; l  P
   inc     eax
; S- F) Z7 q1 J! w) o8 [   jnz     00650589                  ; detected9 O1 Q" y8 g$ e& V
   push    00                        ; OF_READ; O' y0 a. v& b+ y
   mov     eax,[00656638]            ; '\\.\SICE'5 o. l2 @4 v& y# x
   push    eax
' K8 S# f) f7 E  u   call    KERNEL32!_lopen0 q: ~  s$ p7 Z
   inc     eax7 {+ D3 G* |# F7 I/ ~
   jz      006505ae                  ; not detected
+ m0 `7 z2 A, u9 [
; m$ u, o5 C+ x2 J" |) b7 r
- A: W- J7 u3 c* o, P* a__________________________________________________________________________6 l" y! o9 t4 e( v' L8 x, w% j, j

- z5 W  v: \( b2 R; J' i. TMethod 12
" P$ Y7 o- _, h# R/ N/ f=========
; W6 Q8 i# X0 L- E  [2 R3 |" ~% n" a- Z
This trick is similar to int41h/4fh Debugger installation check (code 050 G) H; C" S, c5 o
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% _' s8 d+ d% D4 F" vas it uses the VxDCall backdoor. This detection was found in Bleem Demo.' j8 L+ c0 P% d% e; y9 U, L% N

3 }: @: [2 d) ^& L+ z. e   push  0000004fh         ; function 4fh
# z; w( f! n, [8 u  M   push  002a002ah         ; high word specifies which VxD (VWIN32)+ Y6 s! Y) J7 y- T( S
                           ; low word specifies which service
' O1 ~' x  ?. X( \: w" A4 q/ i                             (VWIN32_Int41Dispatch)
( B* _2 i/ ^0 S% Y5 M" R   call  Kernel32!ORD_001  ; VxdCall, P/ O' J. t) p* q
   cmp   ax, 0f386h        ; magic number returned by system debuggers$ |  W9 ^( X* x
   jz    SoftICE_detected- S5 m" ?' O( e7 I- X% M

; _$ }1 q/ K- ]' J3 l1 y% |Here again, several ways to detect it:
! M( v" G* _* f( ]+ G' B8 y5 z1 p
    BPINT 41 if ax==4f
  x0 e" z- J+ u- g* {/ _7 S( W- {  V3 q/ m% o
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* b; D$ J" m6 r, H4 V# c4 y% J

( }0 R, C% [. j6 p1 D: N4 A) U    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
2 Z/ O, J3 R* h# z& m* @" V
3 X. l& H0 w1 `* }+ ]9 l    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- T+ E. L' C' a) T, p  k! h' n& h* I! n/ H* l; h# E1 f
__________________________________________________________________________
" R6 A  D/ M  F8 D5 t; ]4 T$ s7 H) |6 W0 ?) j8 B; \
Method 13! G: M# T1 E& y' r
=========
; ^4 ?# Q8 U/ [6 R, X& p0 R  B/ _
% C2 B) N6 L8 c* V" F, w' iNot a real method of detection, but a good way to know if SoftICE is1 {# Q/ @- `9 V! a0 t3 n7 q
installed on a computer and to locate its installation directory.
/ u2 V$ r0 o- {& t4 DIt is used by few softs which access the following registry keys (usually #2) :2 k2 h  {9 `* u/ g. l) Y) C- c  N

3 T. Z1 t- K6 s9 @2 H. N-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' a0 g/ Q& [2 e: |. q, v( W9 k\Uninstall\SoftICE; e. P2 }6 u: t0 Y- t& w# g
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
4 v6 J3 W+ D5 L-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, k! U2 ?6 r) _; M1 E
\App Paths\Loader32.Exe; m& x3 o3 i, Z3 f* K  ^9 K

9 B  I( U/ w/ i; y6 j+ P
, @% r& z: f( F; X! D$ d3 YNote that some nasty apps could then erase all files from SoftICE directory0 X; V) J) B" j9 s4 {% w
(I faced that once :-(! c1 J/ O) H. r+ _- i, e
+ R& y$ {, u% @8 b  X1 ?$ M
Useful breakpoint to detect it:
& ^: L2 t- `6 W% @+ d2 y7 }' ~" K- h; R8 C5 n1 F
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ j6 L! Z' J; q5 `7 R1 @( K; D# ]1 J+ {
__________________________________________________________________________  {+ c4 V  A6 V# ^8 X  ~* S
* K) T+ `  m4 n
, f" N/ @9 K1 B- |* c: H8 B7 p0 i
Method 14 + \0 q8 ]4 p. {, j- P
=========+ n& Y6 W! x5 D0 C4 F- X- ^- x8 |

- o: g' J3 c, Y: @A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 [0 z7 Y; E) J4 p: \0 W) c
is to determines whether a debugger is running on your system (ring0 only).7 r9 U& W! G: |8 Y& |1 E# ^
( i' n3 L3 K- W; [2 p+ O  o: [
   VMMCall Test_Debug_Installed0 E. c! |" m+ o4 ]) o) M$ Q6 O
   je      not_installed
4 k9 h6 b/ s3 P4 H
+ k6 F% M* q8 V8 F$ lThis service just checks a flag.9 c3 s0 r; h; G0 d3 l
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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