About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 }! E2 P8 W( l$ g$ }" y* d
<TBODY>9 A5 s& ^! t( p3 U
<TR>8 K3 T+ t" m( p( C
<TD><PRE>Method 01 2 ]9 e1 y$ D' ]
=========: c$ A" G* U* H8 A
+ t" u% E! _& X( \0 m. p: i& [
This method of detection of SoftICE (as well as the following one) is
7 W' V) `7 M4 [& f1 j0 a8 c5 W- Jused by the majority of packers/encryptors found on Internet.
6 G: z- o+ \, q- _$ pIt seeks the signature of BoundsChecker in SoftICE* j" x  n- _% W* _" @+ x

  ^+ f2 Z. ]* f  S0 D# j. R' ?    mov     ebp, 04243484Bh        ; 'BCHK'
! H- s0 v6 @! A) |8 V    mov     ax, 04h
% l+ E8 y* W- \+ F3 G( J    int     3       2 ^+ y- |: ~; _! ^/ A
    cmp     al,4
0 @( @/ z: B( U5 @' d    jnz     SoftICE_Detected
7 u) h$ y1 o3 V- `2 J6 A$ {
+ t3 {2 V) p, B___________________________________________________________________________! l) ]% o* ]' F" z9 y
# l9 R6 `  o/ r1 c- [5 e
Method 02
6 S$ n) M% o3 ]3 k) J& J, }, [* b: S=========
, y4 h( y) f5 W( N. M) v+ s8 ^, L% o% K* u$ A* g% U
Still a method very much used (perhaps the most frequent one).  It is used) `& A: i5 ]9 N+ Y/ Z) l. ~8 [
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 k; ^! y( q" ^0 x7 oor execute SoftICE commands...$ S1 c5 Z- M6 b( M* c9 ]2 Q8 i4 N
It is also used to crash SoftICE and to force it to execute any commands  W* F5 {2 \( Y  r
(HBOOT...) :-((  5 `; X% E& U* C! P: Q

: h. Z6 `4 A. y  y/ U" y6 K$ RHere is a quick description:
( f' Z8 X1 J; |0 J-AX = 0910h   (Display string in SIce windows)+ i# \; L3 ^# d* }
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- U2 d' Y  S2 P3 B
-AX = 0912h   (Get breakpoint infos)/ I9 z; y. z$ V+ u% i! S6 K
-AX = 0913h   (Set Sice breakpoints)
  }! u1 t+ p$ c1 R-AX = 0914h   (Remove SIce breakoints)
+ t5 e4 g$ {3 N" Y% T+ u$ k, Q; A$ ~# b3 x
Each time you'll meet this trick, you'll see:
! z2 Z; s6 T% g-SI = 4647h0 g! v) v! @; r: r% E/ Y7 T
-DI = 4A4Dh4 j; {: e$ w, T" y' X9 L& t, X
Which are the 'magic values' used by SoftIce.
& M; a1 \, w3 j0 C. `+ vFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.' Q8 k, [2 `( x* X
5 a8 y( j3 j/ w0 I
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, z% p9 Y# |- q4 @- OEnvelope utility use to protect DOS applications:; ^9 \& z- V% n1 l7 U2 @; A
+ z  ^$ d5 x3 x5 T* U/ O

! p4 V  D! |1 M3 m9 q4C19:0095   MOV    AX,0911  ; execute command.
2 [3 m1 R( ^5 X, _4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
6 a5 P; }& J7 j# T/ Q4C19:009A   MOV    SI,4647  ; 1st magic value.6 S% D* G. S& _3 R* [' w$ c2 Y- G
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! V( _& _3 x, c4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 h2 e7 m# Z. i' {( M
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- `! N9 U, G' i& f/ M. M/ ?5 A; g4C19:00A4   INC    CX' N: k, A/ x7 @& A! ]# k/ d
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 J6 \) _( w* t7 u2 Z! |4C19:00A8   JB     0095     ; 6 different commands.
( {. r5 F7 W5 j+ s$ y/ d+ t4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 S) g5 I* M5 O. q# }
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- P  C4 h1 \5 w: x9 F6 Y9 C3 V  R( H3 a2 H" V2 d( }
The program will execute 6 different SIce commands located at ds:dx, which
" z4 B' Q5 {9 L2 J) ]are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! F& }: m! Y/ ]. ~2 A& C  G7 {' @# _  K0 i6 {" J' o+ H. E
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
# @- V  d- Z% ^) X1 J___________________________________________________________________________* R  E7 H) o  u
3 R! Z/ N2 e' {. |7 y  F
0 L! S; U/ M7 m: x  _, q" w
Method 03
# z) k# j8 a& @7 J3 v9 n=========$ n# m+ F3 |% h0 {) \4 |' ~1 ~

3 l- A. L% a4 V# |+ |& tLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; E, B3 g0 x8 s' h  @(API Get entry point)4 o- J2 l) O# V4 V
        
* B' v7 o5 j4 f3 F
5 x4 P, A- R/ R% k    xor     di,di
: u5 r4 d+ O- a- Z    mov     es,di
' z! w- O: k2 ~' h% \4 ?$ P    mov     ax, 1684h      
/ T5 \+ y, j& X    mov     bx, 0202h       ; VxD ID of winice
: ^5 q/ _, Z& c8 {    int     2Fh2 U# z" O9 L- r! s! ~7 L4 L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( t1 W+ H; i6 M4 T0 \, u9 k" e9 s
    add     ax, di/ h. ], I! f) T/ E* U/ R
    test    ax,ax
/ S1 j  k# k: S$ X) \  B. A    jnz     SoftICE_Detected
6 i& A: k% y7 B; L7 z
: k" \, U* c  p% d# I8 y/ q___________________________________________________________________________1 R" N" x5 X! E
4 {( B4 d8 P3 \- K& d! R
Method 044 J) I: b% t7 s/ h6 |
=========
9 L& B0 W5 J" t$ m; U8 O3 }! c/ c. m9 p* o* }
Method identical to the preceding one except that it seeks the ID of SoftICE
/ t  W6 [9 J  i$ J, n( U1 MGFX VxD.- i- r- G! E" \) Y  V' C
  B" N& C! h2 b- V
    xor     di,di
0 @* L0 i4 l, o  v; l9 n    mov     es,di! e" J* o1 a2 R0 E  A
    mov     ax, 1684h      
: W0 @( L. U' s' x    mov     bx, 7a5Fh       ; VxD ID of SIWVID; m$ m" d9 E; ]4 {7 ~. \* ^- K( f
    int     2fh" t4 ]0 R( h) F( o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. q7 x7 C3 m7 {$ u( Q, `
    add     ax, di
! t, E0 K5 a% p2 R% P    test    ax,ax! o3 ~2 ^8 ~$ n& I4 q
    jnz     SoftICE_Detected
  i  s# v7 i, {0 Q6 V) }
+ _/ T1 ]* I' @# R& I__________________________________________________________________________
" V; T6 d, U( e" i8 u5 A6 d! g4 v7 n) `. N2 O. n
/ M9 o0 @  K, O% m; P3 F- Y
Method 05
3 `3 G* P2 V( H- j) o. S+ m=========* S0 X2 k% E- B: N# ]5 Q8 [
, I3 e0 d7 N2 A1 K) u+ V
Method seeking the 'magic number' 0F386h returned (in ax) by all system0 e' k* i: w+ ]1 J! [: M% ~" I7 d
debugger. It calls the int 41h, function 4Fh.
* b% ~1 m6 z* T1 g/ s$ Z% KThere are several alternatives.  
/ u$ G: j! S4 N: \6 L  p' O6 T6 I5 ^7 j2 d0 J4 h
The following one is the simplest:. q2 |1 d* ?7 `* h6 _

0 P0 y8 p5 e: g3 S) c1 I4 k    mov     ax,4fh
% i' d2 t, [( }- G6 c& C    int     41h$ h' J9 t9 H; A, l: |; M
    cmp     ax, 0F3860 K7 C1 d$ _8 F: \' k+ @3 _
    jz      SoftICE_detected# ?. Q' C! B  _7 v
' D6 u+ O) E/ t) h5 F) g( e& h( _

+ j- u! O3 z/ W; o0 [# _. INext method as well as the following one are 2 examples from Stone's
* b( s) |7 z& U" I. `6 C5 L+ U"stn-wid.zip" (www.cracking.net):
" v/ ?) j  Z3 Y' y
5 Y; R) n5 g2 i& |6 M  R    mov     bx, cs
# q' `& h4 V. g; X3 u' z9 v; B    lea     dx, int41handler2
' q. Z! F2 @& H  |  ^0 v& h) P9 M    xchg    dx, es:[41h*4]) O: U; q+ L; T
    xchg    bx, es:[41h*4+2]
" Q! s# m8 u( k0 s& d    mov     ax,4fh
* r( v0 U$ u- s3 o    int     41h, Z/ {) D! G3 @* j+ i
    xchg    dx, es:[41h*4]7 w. m; z4 e3 k; ~  n9 z8 U
    xchg    bx, es:[41h*4+2]$ x4 b5 X" _2 ^
    cmp     ax, 0f386h
5 E6 R4 i4 b0 X" G  w0 h; o    jz      SoftICE_detected
) r1 m" k: _6 k& M; Y+ X2 z* Q" x5 B9 d" E
int41handler2 PROC  R& T/ ^$ q$ f
    iret
& w' o3 m; j" }  Y7 E. @/ Hint41handler2 ENDP) ?% M8 r7 _: i6 z( j) d* I
7 L' }+ K% w; e, `  T- z

! M7 @4 q/ [6 {6 \5 ?) z, \* ]_________________________________________________________________________
3 L2 }; _6 G+ `" l  o" n. {8 q5 k
* ~& r2 ]4 u$ N9 C8 H9 r# }# D) I+ O8 H. x
Method 064 v# h) f3 V. k, V0 ^
=========
( p2 I( H8 A. i/ W; H$ B2 P
0 {4 J' W) Q3 B) A; |
# r' t$ h$ c6 E/ v$ |$ C2nd method similar to the preceding one but more difficult to detect:1 ^- B+ x8 i( h, m) s, t) l
: ^- v, T* p7 m; B, F6 D5 p
" U2 _) A( C3 z) z+ A" k: d
int41handler PROC
1 B3 K$ W  P( Z' \# N' X4 e7 W2 Z/ R    mov     cl,al" Q; i3 Y+ n3 K4 c/ o
    iret
: v1 j" Q4 Q; {# Eint41handler ENDP1 _$ D0 b, k; o* f8 Z! F

2 f- p( L* n0 G  K  g  i7 L+ E$ X- V$ j0 t5 _' m
    xor     ax,ax. Y' |7 w/ G. @4 u! E
    mov     es,ax
3 P5 s* e+ L9 d    mov     bx, cs! J" n6 p9 n7 i
    lea     dx, int41handler- M) T) ]; E. r7 C
    xchg    dx, es:[41h*4]
. N. o8 b  b: c9 @( H, ?9 g& Z( I* \; o    xchg    bx, es:[41h*4+2]
# _# c$ E& Q& i* ^; x3 t* a) n# {    in      al, 40h
& t, @# s1 m& O    xor     cx,cx
/ [" n5 S8 i& G% e/ \- j$ E& [    int     41h
5 }' `' j( e  l4 r3 F. E6 d  y9 b    xchg    dx, es:[41h*4]8 D% P' ]3 h! i
    xchg    bx, es:[41h*4+2]/ w/ m' O- j  O  E5 v
    cmp     cl,al+ H0 }' `7 r' R; u
    jnz     SoftICE_detected/ X/ s+ p- e/ n

1 g8 J, J; E1 \# t_________________________________________________________________________2 n3 P% N, p( _
' W6 c; C9 o9 }; S  F+ B
Method 07
- i. e& Z7 t' {5 m3 }( I=========/ a* s( R, X9 a7 q$ L

& J4 U$ W" H3 l1 BMethod of detection of the WinICE handler in the int68h (V86)  N. S+ M5 T. B

) `! h9 _6 A5 j+ g8 T$ I2 ~3 P    mov     ah,43h
! E" P) ^+ U' e1 M    int     68h
2 P& W% ?& G/ V" i8 K1 y; ~+ h/ m0 d    cmp     ax,0F386h
8 I& P/ i; R5 S1 Z$ B# Y/ q" u    jz      SoftICE_Detected! L" C& l0 C6 T% Z

9 [4 _1 X4 i, M
! F4 F" u  v: e# w=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit6 B. ~+ O* [6 \4 U  I; l3 s
   app like this:- A/ Z" W/ U$ K: G3 i9 i! V
# U+ W) d" i6 q% w1 D+ |7 Y
   BPX exec_int if ax==68
* y7 s9 T# N) n& B   (function called is located at byte ptr [ebp+1Dh] and client eip is% W) e& y. d% I8 ]
   located at [ebp+48h] for 32Bit apps)$ m+ c- V9 Q1 t' U! {# ?
__________________________________________________________________________
& }2 g" Q) z' @; W1 d, M% {2 {2 M. x* U9 H/ N

& t. O; o1 f- T7 X9 d5 z! ^5 RMethod 08. W! y/ C% j& l, r* _' l  c
=========$ X) y( \$ d$ R  v+ S) p( K! H

$ i/ x! P3 t+ `' i- P/ l& T6 sIt is not a method of detection of SoftICE but a possibility to crash the
- K8 O3 N; h+ [  E  _( Jsystem by intercepting int 01h and int 03h and redirecting them to another9 N9 \# x6 [* g
routine.# S; g5 |, W0 K0 f% M4 r
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; a) e' O$ T5 H1 E
to the new routine to execute (hangs computer...)
* G" X/ ?4 F; z+ l5 L9 o; Q; I0 D5 P! t5 p$ |3 O
    mov     ah, 25h$ P; e) C& x. |* C, [
    mov     al, Int_Number (01h or 03h)
3 N8 `- y! B* C6 P0 y" Y3 c    mov     dx, offset New_Int_Routine8 y2 {4 K) l9 l! y
    int     21h+ P3 g1 e: E' j  l7 J2 `, Z) O

$ P+ S% Q; p5 m: R/ R2 h9 O& u6 N__________________________________________________________________________
* O8 o' y- V2 Q5 ?. y& z7 W
# a! _" y$ B5 f( f* MMethod 09
& C7 M' O; F) i7 y=========
( k; P( T, }# h. }5 n, F1 C0 {! c; e! ^# l
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" r2 h7 l) J- x8 J/ Mperformed in ring0 (VxD or a ring3 app using the VxdCall).  h; N( x- }+ ]9 b- R5 A( U8 ~
The Get_DDB service is used to determine whether or not a VxD is installed* {: p! M. h+ r: @
for the specified device and returns a Device Description Block (in ecx) for
- f" ^! B: {$ F( A. D7 |+ qthat device if it is installed.
- F& j6 G6 O7 X$ l" e) p1 H# F, c1 \5 b% x
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" o3 U; t, X, B   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 |; L( H7 k+ }; K4 {
   VMMCall Get_DDB
' n0 N1 y# _; W   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& K  s+ h7 j5 r+ V3 v, }
" x' m# x5 J6 S: [/ k/ pNote as well that you can easily detect this method with SoftICE:
: _* P6 Y$ ^7 I: N& I1 l- O   bpx Get_DDB if ax==0202 || ax==7a5fh
9 f4 p1 [! G6 w6 R# U8 S: V! f+ p) y6 ]+ a& K
__________________________________________________________________________3 K- b( Q" y9 X! ?3 y( G8 [6 j& a: ?1 a

3 l5 l* h. |: E/ X1 G  _Method 10
" Q" z4 f( U& |& \' e& z6 Y2 }=========; ]; m3 h! r& O' o/ s9 L  L
& Q3 k( }2 V% T' Z  z
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
  p% t* O  j/ }$ R  SoftICE while the option is enable!!
; i$ y- T3 y2 m1 F" C2 A
( [( A( c8 \/ |1 ]% x+ tThis trick is very efficient:8 n$ m8 D! n! s
by checking the Debug Registers, you can detect if SoftICE is loaded
$ g3 x3 d2 V/ {6 h6 s( N(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ R  }! R1 W) D' @  ~/ W, Qthere are some memory breakpoints set (dr0 to dr3) simply by reading their
( r+ v4 m& H) [' G/ Lvalue (in ring0 only). Values can be manipulated and or changed as well8 @# O% M8 B+ Y) C( z! i3 k
(clearing BPMs for instance)0 S  `" I  d* p  I5 y" d

, r$ S* D( V' S__________________________________________________________________________2 Y7 }+ \$ y' u5 ~0 f
/ m8 D6 [: P2 ~0 F( ^* j4 p
Method 117 r2 G: n) K% L2 @* a1 c8 S
=========6 S" x8 p: \! @0 P1 e: V& h* [

8 Z: k# c6 j* v& l' p2 L* i. QThis method is most known as 'MeltICE' because it has been freely distributed" j# X  e! T. I" U5 W. Z
via www.winfiles.com. However it was first used by NuMega people to allow+ B& R! L: [. L: L
Symbol Loader to check if SoftICE was active or not (the code is located
7 Y' T7 ~- I* y: o1 L' sinside nmtrans.dll).2 I: k* Q& k1 M5 l6 f/ n
/ O  |/ H0 R- ]" n% A
The way it works is very simple:" w) Y: `$ y0 x- I' o2 y0 _: R, {9 r; d
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* m* {$ C4 g) \7 rWinNT) with the CreateFileA API.' X6 |6 a3 O& I* B$ V# ^5 r, @
4 |# k& K+ C( e2 b; U: L" S& F
Here is a sample (checking for 'SICE'):7 d: f$ b% c! L$ R* h

/ l0 q+ E/ O$ e( B7 sBOOL IsSoftIce95Loaded()
$ k; L+ I' z. y: I2 t) f9 J6 C{
3 z6 B4 ^9 t' X+ ~8 a! F5 z8 L$ y   HANDLE hFile;  
% s* Q. {3 f4 m* ]) v   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 ~1 c) H5 h% f9 a( K( U  m                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 Y) i; U9 O& r/ L                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( i0 Z2 G- ~! E) d1 j& q   if( hFile != INVALID_HANDLE_VALUE )
& ^' Q4 a2 N2 U# S# S   {
7 E. @3 E! c9 I" U6 J( r/ j      CloseHandle(hFile);" D7 S& y- h  \
      return TRUE;' w2 Y4 s6 i) |! N; \8 I
   }3 l3 ?( _6 @5 f; W0 G4 w7 X4 o. r4 y
   return FALSE;' _+ x# A: `1 K2 t) D! {- V
}. ]; [9 P0 _, m: O* I
  R; e/ N- o1 y0 C4 F
Although this trick calls the CreateFileA function, don't even expect to be$ m0 S& D1 ~' D
able to intercept it by installing a IFS hook: it will not work, no way!
9 a4 n: f$ C0 Y6 C2 c  I' p8 ?2 q6 `In fact, after the call to CreateFileA it will get through VWIN32 0x001F( l. {: w; |8 S/ ~& g0 J. x
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) k1 U) w5 f( i7 g
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
. Q% F; ]: v2 V5 \" A9 H6 |field.3 d# q3 @2 I$ M$ q
In fact, its purpose is not to load/unload VxDs but only to send a
3 F6 ]/ l' |, Z7 t: Y3 h7 {W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 J# S# M6 P) c5 e& T* v" j% @
to the VxD Control_Dispatch proc (how the hell a shareware soft could try! D6 k$ q* ?3 L: ^& D; v
to load/unload a non-dynamically loadable driver such as SoftICE ;-).( S- w- v" B/ i! G
If the VxD is loaded, it will always clear eax and the Carry flag to allow
% R. ^2 L5 U+ |5 iits handle to be opened and then, will be detected.' ]: p( ^: H, E: k- N
You can check that simply by hooking Winice.exe control proc entry point
/ L7 r# \) c3 z  c, q% F& J* Twhile running MeltICE.  l# Z) I2 M- [7 k
, D" X2 q4 s6 Q- o2 @

  ~9 v- `5 ?4 o0 c1 w3 u' u! \  00401067:  push      00402025    ; \\.\SICE+ @- u0 E8 H4 l: x
  0040106C:  call      CreateFileA$ o& o+ y+ c! x) V
  00401071:  cmp       eax,-001
5 {( u8 j! H+ A( q4 Y  00401074:  je        00401091
$ l4 x$ I+ {4 w* ~3 L- l
/ D/ x& K% O$ |" c  j/ ?& C9 J
- \; g! i0 c- EThere could be hundreds of BPX you could use to detect this trick.6 t7 v$ `+ q  O2 [
-The most classical one is:* t% K: Y% U: Z  _
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 I5 o" D7 P- b* S    *(esp-&gt;4+4)=='NTIC'( i, n  e5 ~5 `8 p" A- s: ]
; E# J# \3 A8 f: E- i- w. C
-The most exotic ones (could be very slooooow :-(8 p/ K* F5 d$ H# Q
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / I# C9 A) e9 O
     ;will break 3 times :-(
1 x+ s6 g* s. w- W5 k4 B, P- g+ @/ A& a! R0 [! M2 K
-or (a bit) faster: , a  O1 O, Q8 U$ F6 b9 c- _
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')5 z& u$ Z- O$ T1 r; y' Z
" Y" ?* \) m# t) y; e2 J: ]1 b1 U
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 C: K! |% O$ K7 H. T( ^9 J5 n8 Z     ;will break 3 times :-(+ i6 P; z2 A. J( A: ?
" m* o$ B. r3 N4 d0 K
-Much faster:
- I' v- s7 {/ X  r9 g+ Q$ K1 `   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 A3 b/ ]) f- L
; r& x9 b. n/ I0 U/ CNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
7 U: ]4 Q! q3 O4 g( l9 o+ j7 Sfunction to do the same job:9 d4 o5 {" N1 s4 J' `; X$ U1 J

0 V5 b  ?, v( m# c2 N) F, R& C6 S   push    00                        ; OF_READ# o8 ?% ~9 K$ |5 N  o; ?
   mov     eax,[00656634]            ; '\\.\SICE',0
- J: r+ Y4 h. R% f$ ~   push    eax: S1 P8 U7 M" E9 T- Q, z* i% J
   call    KERNEL32!_lopen
; w5 E6 ^7 X7 z% d; G% p   inc     eax
9 n5 y* O/ F  w7 C- r4 o   jnz     00650589                  ; detected0 }- I+ O0 L; n& J
   push    00                        ; OF_READ
; k- U( u2 {! e   mov     eax,[00656638]            ; '\\.\SICE'! D& ]4 z8 p2 t6 j* S: X- S
   push    eax3 s# y7 k6 z! i1 t6 u* M
   call    KERNEL32!_lopen
( P6 i( Z9 ?+ C- E6 X- S7 M   inc     eax
) g9 A$ Z; X$ u   jz      006505ae                  ; not detected6 v' i6 i$ |- E6 r

# Y7 h  k* I7 y0 h. x1 f! |% X  K
( |2 z. Z# t+ @* l0 o2 |__________________________________________________________________________
: ^: C0 o0 h/ P% Q  S, ?# V. j/ B& ]
, T1 e3 S# y5 g  CMethod 125 L% j2 p0 O- L4 P, u  p# @9 Q' Q
=========
+ ?! u& N( h1 s- a% @3 H! d! Y4 H+ u
/ n! s1 d7 m) L( X- X. K2 k& cThis trick is similar to int41h/4fh Debugger installation check (code 05
' u" t' e- L9 p* }" G  Z&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, r/ v; f0 n+ ?# ^; w' l3 p! T' Y1 Z* vas it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ Y) ^! E! K/ ^- V. a$ z

3 H9 d$ j0 b+ D7 J  T0 t   push  0000004fh         ; function 4fh
' L! r# \; l4 W( c3 l  g   push  002a002ah         ; high word specifies which VxD (VWIN32)
& R: K1 d3 T% U                           ; low word specifies which service
0 K8 I  r" d$ \, K/ S  M                             (VWIN32_Int41Dispatch)
4 P' i- o! `1 j$ B: K   call  Kernel32!ORD_001  ; VxdCall
* \  F/ v0 T% v( X5 z) O   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 Z+ L# S' S4 [. {: \  V   jz    SoftICE_detected$ H* Y/ ]# x" x" G

3 N( p3 p& u; {Here again, several ways to detect it:( g1 C" Q3 r7 d8 }
& v- w3 b1 G' F& F) w& J
    BPINT 41 if ax==4f2 R( Y  K- f- f0 l4 b

- R- g5 T1 [3 o" x    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 s" s. E' D. M4 A9 i: |, X& b- Q5 d" f" t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
" L" Q9 u! ^; S7 D. E) s* o( W$ O' T
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- l  W& v$ T+ }1 D' w& p7 Y1 w7 l5 ~' [  t. W
__________________________________________________________________________
4 S& z% o0 H2 i1 n: I" L0 d4 U, ~2 O; U+ v- [" g+ Q
Method 13* x2 B; J% O2 b- f4 U6 i2 A, g6 A
=========8 U# P4 N/ y& s
3 u) O. @1 b" p% I- y& O
Not a real method of detection, but a good way to know if SoftICE is, P$ g) ~  m/ n4 V5 H& q7 X
installed on a computer and to locate its installation directory.
0 n$ |2 D5 q5 m% N- qIt is used by few softs which access the following registry keys (usually #2) :' @! H% \* w, E

$ f7 L4 k5 d! [-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 g) ?7 S4 H4 g8 d
\Uninstall\SoftICE
0 w8 a* ~3 ?2 A-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
. l4 P* M% E( r% Y-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( g! z- D- u4 r# p9 v! r- e
\App Paths\Loader32.Exe! n5 u/ e# P$ Y
1 ?8 C# f8 {1 p$ I5 K

3 s& t: h# s4 h; TNote that some nasty apps could then erase all files from SoftICE directory
, I* a  r* f: N" X(I faced that once :-(
9 _' ~# l4 O+ N5 Z* u7 r: [; I) I. @: C3 ^( P
Useful breakpoint to detect it:/ a, J5 c& {* \- Z" A

4 }- l7 H0 A6 O0 k# a- @     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- f% k8 p7 J: d* ~, [% [! j# t

* Z. m$ \5 _8 q1 x0 c8 p! K__________________________________________________________________________
* }4 z: {3 w0 a- y3 z$ c/ W3 ]1 I, B; o+ b  k
& s, Q9 A% B4 M% ^4 }! D2 J
Method 14 & L8 V; x$ Y7 z( a+ Y
=========
  R; o: c" a3 f) `$ {* N" Q2 `# p7 G9 S  H, O
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: N0 I+ T  n# V0 ?2 E( xis to determines whether a debugger is running on your system (ring0 only)./ S% x% S9 l; v; M8 h! l

0 B) J9 F. b! N3 j3 ?9 v   VMMCall Test_Debug_Installed
: F' d; H$ ~# x0 h   je      not_installed- g4 v  E' M$ y3 P4 `

$ M& j' J. N* WThis service just checks a flag.
0 H, F# {: K4 D% v  H* t</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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