About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 m# `) i( j2 B; t! O) r1 V) |<TBODY>
( g" y  ?. D% I& u  S; Z1 i<TR>2 S) O5 l. ^+ F% B. I
<TD><PRE>Method 01
. r7 t5 d, ], {- G6 V3 Q" n8 @=========# V/ U/ v6 D3 w4 W

5 @5 e7 x5 @5 ~7 X% e! }This method of detection of SoftICE (as well as the following one) is
- x; z  q6 H8 O9 c4 Wused by the majority of packers/encryptors found on Internet.
  |: ?' Q8 d9 c  I- T0 X: _It seeks the signature of BoundsChecker in SoftICE
# ]$ @& F& w3 l) N  n0 K! I( N5 q6 @
    mov     ebp, 04243484Bh        ; 'BCHK'. X% z+ c# J2 ?; l' a- L+ Q( S
    mov     ax, 04h( _9 ?9 W) A% a, t
    int     3      
5 o3 n. c, W, e2 \    cmp     al,4
4 h0 O4 |# n8 m; \    jnz     SoftICE_Detected; A5 I1 H) l0 l: w. f( h

9 P! J7 p5 t- Y+ `___________________________________________________________________________
& n5 u7 _2 H8 \7 o% L' O7 T6 b7 Q" \) a$ m8 \
Method 02
7 P+ [% q0 O, ?  O- Q=========
8 n! l! r6 F3 L2 {9 k0 T" }& c1 {
) h) x- G3 \0 x& q6 H, |' y# PStill a method very much used (perhaps the most frequent one).  It is used$ L& J/ X* }; i
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ g) ~# K5 P* O$ Y0 y8 {( q
or execute SoftICE commands...2 j/ t  k; A' N5 Z
It is also used to crash SoftICE and to force it to execute any commands
. k) N9 x1 M( T& }(HBOOT...) :-((  
. s* U. t& |4 n, E* }8 p' ?3 c
, s1 r9 I1 i  V2 |, M7 I2 FHere is a quick description:
4 r# @/ k1 ~9 y2 H/ e% S-AX = 0910h   (Display string in SIce windows); a2 E; ^2 B7 k% s
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
7 y2 R0 ~" R+ ]0 l-AX = 0912h   (Get breakpoint infos)( o  A# q) V: C) K' T0 ?: I
-AX = 0913h   (Set Sice breakpoints)
: T) {" e7 y$ Q& _( ^-AX = 0914h   (Remove SIce breakoints)
# _2 c( c# X& b$ d. N8 Z  H( a
' \3 ]) |6 l5 d% l9 u4 A5 dEach time you'll meet this trick, you'll see:9 D  h( L7 H9 y
-SI = 4647h* X2 X0 R" j" i; x# V
-DI = 4A4Dh0 H3 ]# s4 Y: I( _3 j. h  o4 I7 `4 r
Which are the 'magic values' used by SoftIce.
! }9 G6 B' l& e8 f1 Z) s; |# u) R$ QFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.) D: }$ {9 Z6 R+ p6 C

* L# P. h% B6 l! m% c( @Here is one example from the file "Haspinst.exe" which is the dongle HASP
+ Y+ u0 x6 \+ X9 C& a* w0 [Envelope utility use to protect DOS applications:
$ K  a. F' g9 `0 Z" u% \9 i8 i8 `0 X
+ p# }- r2 j* b3 D' U, i
4C19:0095   MOV    AX,0911  ; execute command.# Y& _9 h* {. |
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, A6 b( e( d% @; X# s& ^8 Y. i7 U4C19:009A   MOV    SI,4647  ; 1st magic value./ T4 `. m0 u$ |$ q: s+ D/ X
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.7 p" z- T. i7 k4 q  J/ R
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" `( |; I# k, c: W9 f% D
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
5 n$ F  h4 {; S, ?) V/ F3 P4C19:00A4   INC    CX
3 }: ]- N3 U, Q0 P& g! S4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
+ g9 G% f4 p3 p2 f) m+ ?4 `4C19:00A8   JB     0095     ; 6 different commands.5 x! }. U* a( z& s) B: N/ \
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, L% d2 d, Y% d! U) l# \6 d4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 n1 }" K3 a) b: \8 n1 [1 F

+ }; T+ f  b! S* ]' }# wThe program will execute 6 different SIce commands located at ds:dx, which
6 {0 a- a3 q$ Z% L* T" Lare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. B& N! I' G+ v7 N/ P+ z

( E/ o3 o( F5 I$ N$ t! r* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' z" e5 W6 b2 q* x
___________________________________________________________________________
, f) b8 B2 U/ M6 q( w. `- q; [6 [( q0 e, I
) ?. `# A7 h6 V) W+ U& m2 H+ P" {0 S
Method 03
4 t3 ]. V# j: \0 i=========
2 p8 H& e, T) T& U" O6 y+ s" G6 y! Y+ {/ h
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ }5 X; Z0 i+ Q8 A5 D( i(API Get entry point)
* U) P+ c: f9 P& t  [5 D        
/ U5 e% f' H3 b4 o' ?* ]3 h0 y) ?  G7 `* _! T
    xor     di,di
" n) {5 _, @9 l! g7 k( O    mov     es,di/ @6 J* O  B9 B* @  a* ?# H
    mov     ax, 1684h       - k: a! e, S5 O. y
    mov     bx, 0202h       ; VxD ID of winice4 b) M2 @) y( \: G2 v8 l
    int     2Fh$ K: j& i! r$ x9 E1 H  ]
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 y1 ~% U. Y( `. y- E; Y
    add     ax, di
+ E2 r4 \5 {! }9 ?# @    test    ax,ax
2 v2 D! N+ d  C    jnz     SoftICE_Detected
0 e& [: V% G7 ~1 S3 J* n9 D; y
! j* |( S6 V  ?* v___________________________________________________________________________
+ f5 M! o  @& d4 ~4 O' a1 X- u" ]- T/ F) R" ~- S9 i
Method 04
# M! @0 t) u% g$ V4 l. f& h2 n=========0 `& P, Q/ t( N
6 O: }1 i* L2 R6 c! q% S
Method identical to the preceding one except that it seeks the ID of SoftICE
& E: [* E% Y+ MGFX VxD.# X3 O4 Z! k. j3 s  A* J: w6 U
% ?( q3 v6 ^; ~+ W6 v- k
    xor     di,di. F; L4 U' e8 h0 n, Q
    mov     es,di
$ b3 a7 k0 l  O) @) ]    mov     ax, 1684h      
- H1 E( _3 E  B7 q* p/ ^: H    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 n0 i% q* S1 H    int     2fh4 S- M( ?4 l: p
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 Q/ G. X4 d$ i1 P% ]/ T. w    add     ax, di) V' B- t2 U* `1 f: m1 ^1 v6 r
    test    ax,ax
% _  O% H* ~% s8 f    jnz     SoftICE_Detected
, X* A' V; |$ K* A2 }
, ~( o! |7 O0 g__________________________________________________________________________: j; M8 }7 \5 L+ J: R

" D% S, ^8 ?1 W9 ]. {! I) r# ?# i. E2 j- d! v3 U* t, C" @
Method 05
; A* G) |$ w8 a0 c3 T=========' v* |8 \2 Q& M# Y( }
/ r! H$ _6 g+ E' b" l# l7 {, J
Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 B/ L6 ^( T, L1 Jdebugger. It calls the int 41h, function 4Fh.4 o0 w& z$ v/ t, W% [: A* o, C9 j* |( o
There are several alternatives.  
1 u' x# Z  @" K: n8 u( l
3 N2 w% o+ Y& d' f2 @4 x! _The following one is the simplest:
" U' K5 E; Z- k; z8 }, X7 l( ^7 f' _' i! v5 M5 D" R
    mov     ax,4fh
  i# I" S3 @0 f" b7 V9 |! u    int     41h5 ^: ?& k, h/ N$ M7 u2 [( K
    cmp     ax, 0F386
+ F0 k, i# G6 S! l5 i4 X1 D    jz      SoftICE_detected7 e. r: h8 Z. S/ ]. c

8 y6 {: X7 |& k3 O7 A& h% t: D# }( I" {( \
Next method as well as the following one are 2 examples from Stone's * I) K6 b) m3 u
"stn-wid.zip" (www.cracking.net):
' V8 y( W) U6 o; g% w
) a: i9 _5 }3 S5 D& I% j1 M6 q1 L    mov     bx, cs
) }8 k3 r% g& a6 B, E    lea     dx, int41handler2" a) O1 w$ v0 Q; z2 B/ e' X
    xchg    dx, es:[41h*4]
" |* c' R2 Q! b' K* R    xchg    bx, es:[41h*4+2]5 y0 j- e& \8 |- H8 q% f% h0 ~
    mov     ax,4fh
( }' R1 A; H$ J1 b9 U% o. i    int     41h# l1 D/ M( a) O9 ~: e2 G4 j
    xchg    dx, es:[41h*4]" Y. w# o( U/ t- q4 L
    xchg    bx, es:[41h*4+2]
+ T, Y2 {% I5 W    cmp     ax, 0f386h8 l% W/ v' X; w- h+ N0 d
    jz      SoftICE_detected
2 `, ?( d/ B, L
+ @! \9 R5 m3 ^int41handler2 PROC
8 H- |( J2 W( @- k6 a    iret2 c- i3 g& |# a3 x/ Y5 j
int41handler2 ENDP7 w8 C6 |, Q- ^; ?9 _, ^5 b: K& [

( E# ^1 L# `9 t, M: i& |) _4 K
( l4 H  {) }& C* W# [_________________________________________________________________________
$ i; G! \& O$ U
+ Q  O0 ~0 i$ T6 q  f7 b! Q0 b1 F
* D# j7 J( h# |# Z6 I9 H7 UMethod 068 R# W% r5 Y2 K' m  {# t
=========
; O  k" D0 `' v) B+ ^: J' [. t  u
, B. B, B- n+ _8 n* O4 e1 w
  l7 ^/ x' w3 C$ z2nd method similar to the preceding one but more difficult to detect:
+ z1 l* q/ w  @! C2 n* a7 V
8 ?" B/ o0 N  n: z  M5 O6 P7 n' O4 F! ^, Z
int41handler PROC
$ I, j/ S7 y0 u* o    mov     cl,al9 w' u4 L" o1 W! ~) x# w. L; r6 R
    iret
8 t6 ^. J% y- c& |! {int41handler ENDP' X8 g; k3 G9 d
  N& O0 ]( L9 J+ |# i

- J; @8 g% P( A! V$ T" k3 H    xor     ax,ax
  B* g/ `1 T- G7 ~8 n. G: T    mov     es,ax1 w, G9 ^& ^. i, g5 g9 ?4 |3 U: T
    mov     bx, cs
* e2 K4 T! u/ X& [    lea     dx, int41handler
# E/ p2 m$ g6 Z8 e+ r. V    xchg    dx, es:[41h*4]* W/ X. B, k& \. r; j$ v
    xchg    bx, es:[41h*4+2]/ f; n$ y1 h6 [9 i8 r7 e
    in      al, 40h
9 P, u7 m4 I0 l    xor     cx,cx
7 i6 q* ?( v* K, {) ^% a    int     41h* ~6 ?- U* M6 ]3 ?0 J
    xchg    dx, es:[41h*4]
$ t7 {, g6 A6 c  Q2 o    xchg    bx, es:[41h*4+2]
+ }2 V2 R( H7 O4 C, J' j    cmp     cl,al  K, Q) c. e5 m- N4 z$ \  q2 e" H
    jnz     SoftICE_detected5 [- g9 b$ L1 r2 N, l0 A

. M8 E6 K; I) F. P_________________________________________________________________________7 p& B" |# v. `+ t" M) {
) F# q& ~/ R$ l4 I0 X: W! u" ]
Method 07
& B* P: P2 I6 i) _0 ?7 j, ?0 A=========
0 c( k/ [; e% F, ~: ?+ N4 A5 M9 a7 N2 u4 A) t% \3 E8 K/ G
Method of detection of the WinICE handler in the int68h (V86)$ n0 i/ E+ a4 @0 S; d: a0 |# Y  Y2 N% g
1 V) k- v. d  H; q5 O' u
    mov     ah,43h% }8 J; B  ]' t. v* u
    int     68h- O. g& Q" B- Z) a" _) @; t
    cmp     ax,0F386h% b4 w6 y1 e+ D5 H* T- a
    jz      SoftICE_Detected
) A) \6 B" e% l) U4 y! d) A1 y- b

- h$ E# E" O7 B: k( `7 B8 `=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# O4 S0 O2 N4 X4 k
   app like this:
( X  c3 d( {; r" v4 X) Y$ y. j. y. a% h( z: x3 j9 X
   BPX exec_int if ax==68
( @- H  I) e( p' E# W1 V1 a" y3 w7 d   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 t' f% H; H3 l- i* o( ?   located at [ebp+48h] for 32Bit apps)9 J7 v  f5 g! o
__________________________________________________________________________+ @& l$ E9 N3 E4 r. S# V; k( @

3 m. P+ r& l3 k' o7 y: h! V6 M$ T5 k' ~/ L2 m! Z- d2 C: `' w- _
Method 087 l3 z: `0 m. K" l+ O9 U. X' y+ t
=========
; p( g5 H  O  U! o& P" K
/ ~: c9 Q0 B! l( h4 ~/ ZIt is not a method of detection of SoftICE but a possibility to crash the/ e& ?3 s& B2 R4 E- F
system by intercepting int 01h and int 03h and redirecting them to another  p0 N- w4 I3 P- F% v1 T
routine.8 y& S+ _2 u; E# x8 Z; z# x; g
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
8 M5 ]: `& I$ x1 A; A! A8 }2 Bto the new routine to execute (hangs computer...)
; d( _* D# D* I, C+ z
0 o( r( j4 Y% [$ l, l    mov     ah, 25h
% D4 e5 @4 Y* m! j( G    mov     al, Int_Number (01h or 03h)9 w9 z8 b; m. p
    mov     dx, offset New_Int_Routine
! h* ~  h$ f. B! p4 U2 W    int     21h
" l& i* M' @. k
  W3 X7 a: C2 A__________________________________________________________________________9 `* O7 S8 J+ M+ W. n1 G+ q

2 y: X' _( [6 T& Z0 jMethod 09! z8 N9 U6 v( |& W
=========- J  d+ F* f* J4 }& S3 u/ ]1 \: u
* O( g, X5 c; t
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: r- m' U9 |8 P& g) Y2 Y& p
performed in ring0 (VxD or a ring3 app using the VxdCall).3 r  y' Z  e' |! Q# @
The Get_DDB service is used to determine whether or not a VxD is installed" u' a2 e4 p5 m: z" a! G8 H
for the specified device and returns a Device Description Block (in ecx) for
7 K, I5 ^, O3 k; ^; {# y3 {that device if it is installed.9 _9 D9 l1 p2 Z( v6 B# E- q
2 l* k0 h0 H, A% {& v, t
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( w4 |& d. B1 j1 N6 L: f1 I( a" O   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
. T* |$ |+ |/ A, `# ]/ T   VMMCall Get_DDB& {  ~6 c, A$ O5 H2 E
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 |/ y3 v7 T) I3 ~' M

. P  O9 _: R) e( a: P* v* q* kNote as well that you can easily detect this method with SoftICE:% B* a; D' `! |4 e
   bpx Get_DDB if ax==0202 || ax==7a5fh! F  }* b0 O& R$ l  W0 B
! h9 e( j2 O+ k$ z7 ]: l4 ~5 l
__________________________________________________________________________
! \. s) y* Z$ p; a5 j" O8 l4 ^  K
7 _6 S+ k' E/ _. m4 EMethod 10
. u7 p( y0 A9 P=========
* i  v! |$ Z! C; @  x& X0 k( u
# ?8 W! q" l- D$ ?=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 @$ [  l6 x5 W+ D# V5 d& ]3 H5 v
  SoftICE while the option is enable!!9 G. l& z, u8 z$ c
1 z3 D1 o7 r! N; p: {
This trick is very efficient:
: u8 E: C5 e+ kby checking the Debug Registers, you can detect if SoftICE is loaded
& b- `  Q4 r' a- K- {/ i, v(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 `2 P8 v4 S' R5 F4 H% G( r; o' lthere are some memory breakpoints set (dr0 to dr3) simply by reading their
( B) t' J2 X3 q- s$ {value (in ring0 only). Values can be manipulated and or changed as well
( X/ C" G6 l0 @0 _" a(clearing BPMs for instance)
2 a8 i, f- v' w1 _9 `1 [( @' p
4 s3 J* X/ y! b; u( C& O/ e__________________________________________________________________________5 m2 ^# J  S9 l0 n
9 J' Z6 f$ G) p7 i8 i0 g$ Z6 e
Method 113 i# X0 _2 y9 ?4 O! J- _
=========
  w% r9 \' ]' S. F" H2 n( z, \7 h' p8 S2 z& b8 C& s/ k
This method is most known as 'MeltICE' because it has been freely distributed& E1 S! i% R+ t) y6 b- Y
via www.winfiles.com. However it was first used by NuMega people to allow/ |& e$ R. ?5 K7 X
Symbol Loader to check if SoftICE was active or not (the code is located1 B. h# F) _( Q6 R% s
inside nmtrans.dll).
# F- j7 F0 X' I, @
6 P! s) L) C+ c; I6 L, s, SThe way it works is very simple:
1 ]  X" \) G2 `- @It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
! N7 }0 o+ Q  B6 LWinNT) with the CreateFileA API.
6 V- g/ z$ i) D5 p, o) K7 H. q: E  Z
Here is a sample (checking for 'SICE'):
8 R1 v1 ?* @7 D4 s( Y- K- ~# F6 S: Y  n% }
BOOL IsSoftIce95Loaded()
0 c& H# v! p8 o& E' i% k2 R{& t" ^4 `0 C2 l0 \
   HANDLE hFile;  3 F7 I% D" h1 q  N
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
  s1 c. x2 O8 _0 ?6 k* \7 Q) B                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! U) s% f4 }5 |                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 E9 K8 d4 I( f" ]# M   if( hFile != INVALID_HANDLE_VALUE )
  x) n1 D+ P6 k5 [  F! O: g6 I   {8 Z5 Z: D" i3 [: u5 t# h7 T
      CloseHandle(hFile);+ S1 a  B3 f# b: p. L( h
      return TRUE;
3 i# q3 ~( `# @2 S   }2 H* u) q  `3 n3 p
   return FALSE;- z% Y3 n% i: `6 \; p
}8 b# O& W8 P& u# z( G+ _& ^! R

7 U  D/ G% D& u, O! A. hAlthough this trick calls the CreateFileA function, don't even expect to be0 J. p. y* G8 ?
able to intercept it by installing a IFS hook: it will not work, no way!7 z. d4 O$ P2 q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
! U: Y1 J$ Q/ v: @service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( w! h  A0 v9 y6 J) ?3 {! r3 _5 v
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
8 P% A9 f3 {' z: c; ofield.
- }! @! U) C4 e: N, W, y& jIn fact, its purpose is not to load/unload VxDs but only to send a % ?* A; o; N3 `/ x. q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 x' m, j' J3 p) a
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
) d, u% h8 z/ v# xto load/unload a non-dynamically loadable driver such as SoftICE ;-).
: e; E' Y8 J. ]If the VxD is loaded, it will always clear eax and the Carry flag to allow) J# @- m3 b# A+ b3 _& l5 e
its handle to be opened and then, will be detected.
# W/ D7 s  K( Y+ XYou can check that simply by hooking Winice.exe control proc entry point# b7 C5 b5 J1 S6 K2 _
while running MeltICE.
* t$ W2 U' _; W' G8 z5 H5 \+ \5 Y2 m7 Y3 ~4 x8 M8 z. m9 P8 A9 o
$ k' J; z% v* r+ [# E2 D7 _
  00401067:  push      00402025    ; \\.\SICE
  u8 r9 }5 C5 |  0040106C:  call      CreateFileA
0 y6 b2 Z  [3 x2 z) d  00401071:  cmp       eax,-001
3 g; V/ R0 h. q0 q7 S  00401074:  je        00401091! _; P+ a* ]/ G) H5 Z

9 C5 N1 x6 u" o; G' U
4 @# p1 o  |2 |" cThere could be hundreds of BPX you could use to detect this trick.
0 a# K3 D- M% Y. {( x-The most classical one is:
( c6 ?- q8 ^& i, ~  c  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 L5 l+ q8 `* k7 [5 B# Q    *(esp-&gt;4+4)=='NTIC'
& f7 {0 N) {3 k
2 @( ^: V2 ^( \. E5 q-The most exotic ones (could be very slooooow :-(: \% Q- P  C: ], H. R
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  8 r8 R8 ^: Q4 N! I; |1 L) y2 q4 F
     ;will break 3 times :-(
, Q2 g# K8 B& T( J! J0 t/ K! e6 q4 V* `6 }; \
-or (a bit) faster:
" q$ @- ?3 O* c9 L  I$ O: J   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
( d6 s- G$ a, ^% L: B. y& x( A' n' @# m. Z9 \5 B
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, h6 Q# P6 M9 o- A' P     ;will break 3 times :-(( s( g' T  o6 M* V: H
' U9 t9 |( K. ]% N# G
-Much faster:
. T6 K2 U. |4 q7 e! a   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! T$ h* B. [9 m: I3 r$ P+ J; n, H6 l, k) w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ e7 C' @& J0 t* c" b7 Yfunction to do the same job:. a0 o3 Q/ y% d7 N3 p4 L+ i" k2 a
, _3 V8 g/ |  L& L; e" g
   push    00                        ; OF_READ
% k8 v) o% ]1 {" G  P   mov     eax,[00656634]            ; '\\.\SICE',0- F2 G: j1 x! R6 S* L$ R& J
   push    eax4 _0 M3 J- j- N8 f3 N: v! n. _$ ^# D
   call    KERNEL32!_lopen9 L/ ?8 p& g" [( O$ F# ?; D: w8 a
   inc     eax
; F$ S: k* }. B/ N$ V, J   jnz     00650589                  ; detected/ x0 H, f; Q- F. R/ W" ?4 n
   push    00                        ; OF_READ1 H0 ]' g. c  K
   mov     eax,[00656638]            ; '\\.\SICE'  z" D1 W. Y: u+ c, }
   push    eax5 t0 |  ?8 i, k+ D& {
   call    KERNEL32!_lopen
) S4 P: O) m8 a   inc     eax3 W& I  T( A$ R# t1 h" i! `
   jz      006505ae                  ; not detected
1 d# ^6 E$ }$ `' i' v7 s/ i! B& Q
& X% l  u$ W/ ]+ [  P* ~, F
  {$ O, L: r: O# V__________________________________________________________________________
9 u: l1 b, |# s( W. E3 D' c% [# K$ E. P3 p
Method 12- m' J& U) g* e! Y. d; Y
=========
' r+ J* {7 @2 Z/ M/ r& t
3 ~, Q/ u+ F' n9 e* Q+ I! S& [$ tThis trick is similar to int41h/4fh Debugger installation check (code 05
( W1 ?/ V+ E5 X( W+ w+ K&amp; 06) but very limited because it's only available for Win95/98 (not NT)
) ~/ V5 Q, D8 Gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; j5 ~6 c, x- H' U% p' u: s$ Y; P! }. V/ ^9 G0 I# r
   push  0000004fh         ; function 4fh" M1 s$ K% {6 ]. t# q" K) w
   push  002a002ah         ; high word specifies which VxD (VWIN32)9 ]; U0 [. B* B8 q+ M% y
                           ; low word specifies which service
7 g& J  F# X, u4 g3 s                             (VWIN32_Int41Dispatch)4 y0 V9 \  a8 q
   call  Kernel32!ORD_001  ; VxdCall7 ~' M4 h: V  A4 w1 Z& w
   cmp   ax, 0f386h        ; magic number returned by system debuggers
/ O6 p" _3 \5 M) s, W) j   jz    SoftICE_detected) p5 s! M3 q- m8 e4 m7 k

/ @* K# x+ @6 ^( b3 j! BHere again, several ways to detect it:
3 K  t1 A) a' r- P: F* W$ G; G2 ?, @; X9 @1 \
    BPINT 41 if ax==4f
$ c0 k6 V8 V. p* C, `2 y* s
5 C' G, o4 S* n; C* @    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* S: E% }# I$ h

" L8 X% w. U$ M    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A, a6 @5 r# e* U  O% X
6 z/ H; w2 c# ?8 D% g# f. d
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 [! t( K7 ?! F/ }
/ |2 L2 M4 Y- Y7 H9 b
__________________________________________________________________________
- y) e. P/ p3 y1 m
4 B3 l5 O. F  v; j9 }' A8 HMethod 13
2 ?2 C4 k( v" r=========. N# _% `6 c9 `% V! J. I" g( x
% r6 ]0 S$ W, i, F2 e$ e+ e
Not a real method of detection, but a good way to know if SoftICE is
* o6 E7 \9 C. D. \8 E& ?installed on a computer and to locate its installation directory.* p8 l' s# Y! W' J2 d. V: ]  W) @  l
It is used by few softs which access the following registry keys (usually #2) :
; n! ]# f/ e0 s+ g* `2 g$ m- x( R0 Z! }( k7 L1 X0 I
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# q. ?  d, I( K
\Uninstall\SoftICE
9 f$ o  |9 I% Z7 p# E-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  ^9 p/ O2 N0 p7 m
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 F6 o4 Z% r# b( o( k\App Paths\Loader32.Exe
. W: J! @  P, d& b# S* A4 h  o8 [, J. e% a$ U
6 v6 }+ r- m3 W3 [6 m5 r
Note that some nasty apps could then erase all files from SoftICE directory, o, ]& y" z+ b+ l1 x4 l
(I faced that once :-(. F" i1 c* q  o" H
: Y$ |: [* z) L) N/ M( f
Useful breakpoint to detect it:) H3 g# R) A  `- V

1 T/ L# }- Y5 }7 `" z) D     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; y, T$ n; t2 Q+ A3 ]" _9 b- d4 S1 J, S. a8 i
__________________________________________________________________________
7 g5 x% N7 ^% B* |6 g4 ~
* ^! M* w: Y$ f( b2 S7 [' G( T# x1 S4 P( U
Method 14 1 I* I8 v8 g, l7 b. E
=========
7 h' ^* {  m$ U! r+ g: D" S: o' x% K: R
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, q# ~4 y  k5 M& A: F* Lis to determines whether a debugger is running on your system (ring0 only).
/ }4 B! N" I& w2 Q) f, h4 C) u" p7 U2 a& [) E, ?
   VMMCall Test_Debug_Installed  f9 w4 g& X+ M/ B
   je      not_installed
; |/ U* g! z3 t% o
6 W$ m' z0 n  a- [2 mThis service just checks a flag.- c8 T" O) L7 o% S+ r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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