About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: g4 V2 o3 T6 I! C( Q
<TBODY>( K9 a; Q0 C7 g1 j4 z3 g! g3 K
<TR>
& J1 l# ]: Y' v<TD><PRE>Method 01 * H5 [( @$ n8 z7 R* J- W, o5 z
=========
% p% o7 L( |  n
% h9 R6 ]' @: XThis method of detection of SoftICE (as well as the following one) is' N+ v( L: m+ i9 o
used by the majority of packers/encryptors found on Internet.1 z" m; \% a# _8 q0 P
It seeks the signature of BoundsChecker in SoftICE
) W$ _; B. N6 C/ F1 Z# m9 _+ [+ N+ ~6 D) u2 K
    mov     ebp, 04243484Bh        ; 'BCHK'
' a- _, s6 Z) P    mov     ax, 04h
) G3 c% i& b! ~  m' Z0 Z    int     3      
4 \- p/ |) k4 v9 @    cmp     al,4) u" C, T8 e/ d
    jnz     SoftICE_Detected: E( S: P! x1 ~4 F1 p0 s( V
8 V. R; Z; S9 ~: k+ r# O- Y
___________________________________________________________________________4 Z2 P( P) f* |
0 J) l8 \8 X$ ~) k3 V
Method 02
$ ]" \$ Z8 i0 E2 \4 f+ }) C=========6 m1 O5 U$ _$ R

4 ?7 U0 F7 N/ H  m& m% vStill a method very much used (perhaps the most frequent one).  It is used8 B2 Z8 p+ b8 h2 r- T4 [1 g
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,- G  ], G) a; \# r7 b8 C
or execute SoftICE commands...
: u) [% x7 D+ LIt is also used to crash SoftICE and to force it to execute any commands, G3 S! n4 {% y2 C* z9 ]
(HBOOT...) :-((  
" P+ a5 O3 n. b/ L3 x$ T: l8 j* b
Here is a quick description:) F1 g: M6 {" x/ a5 F$ C
-AX = 0910h   (Display string in SIce windows)8 O+ W  h( h) W% c
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" m0 H9 u. g$ o-AX = 0912h   (Get breakpoint infos)$ n8 a4 S( V9 y) m! N( V
-AX = 0913h   (Set Sice breakpoints)$ Y2 W4 |1 z8 _  |6 N, b0 A
-AX = 0914h   (Remove SIce breakoints), P- d& s3 r  N. G

$ [- A; J/ [3 D* W" k/ ?6 }Each time you'll meet this trick, you'll see:/ M( ?) M+ T* R" b. a
-SI = 4647h
8 S: w) v: j" z-DI = 4A4Dh
' t  J" V# P9 IWhich are the 'magic values' used by SoftIce.7 e7 v, v0 z" \4 _7 y- c2 m+ r
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.) P2 P' h- X) l% H. l& Z
. z9 U9 L& J" _5 Z4 I
Here is one example from the file "Haspinst.exe" which is the dongle HASP0 K2 P4 U( E1 h: _
Envelope utility use to protect DOS applications:
. Y2 ?$ C! s2 Y4 R9 R( Z- Y; i+ w" u, Z0 x

+ E) e, {" ~0 V6 t0 S4C19:0095   MOV    AX,0911  ; execute command.
8 @2 {- m/ R: i: L: \8 [4 t4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; }4 Z. M( p% q, M+ o
4C19:009A   MOV    SI,4647  ; 1st magic value.
- p0 Q; L1 Z( P5 q  J8 N4C19:009D   MOV    DI,4A4D  ; 2nd magic value.) D5 b- }- p! a! C: e
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 Y. t0 l5 z$ J8 a! t
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
8 C, }' s/ k& g- f& u& t( F8 j4C19:00A4   INC    CX, C' D2 ~6 ^& Y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 q( ?- [  S; O) }1 S4C19:00A8   JB     0095     ; 6 different commands.
4 R) a: m' _1 e2 I4 n% T- v4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
7 i* Q" C) T  v6 K9 O4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 B$ X% y1 p$ J& I  b
; p2 [3 D& J8 f! `$ D5 b$ q
The program will execute 6 different SIce commands located at ds:dx, which2 {! y5 y5 ]! f. T' I/ ~
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& l4 X! S- `5 t3 c# o
& X  H; s. x- ^5 B. l. F+ }
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
3 n# q0 j* X' E+ s& P* `___________________________________________________________________________8 ?; |* W. Z, w( `
* c7 `- \/ V6 j: W6 H- y
0 K. o8 g+ D( Q1 p7 l, N' m
Method 033 p2 h% ?6 k5 `! k* a$ w
=========* }6 Y8 U0 b( |+ n% Z8 Z

1 F- w& T3 h1 W  o9 KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) Q8 {) c8 n3 c
(API Get entry point)
, Q" S2 y8 b, w& ^5 k; ^! F8 v        
+ w) t; r6 Y3 M# R+ X# e+ F9 w0 e9 V. j1 l: {/ k5 t
    xor     di,di  m( K1 [$ o+ Y+ |' r& V) H+ o
    mov     es,di8 E. q7 X" }: _5 M8 U/ Z5 p9 N9 u
    mov     ax, 1684h      
4 P. k* i. o: x9 M- ~: {7 s    mov     bx, 0202h       ; VxD ID of winice
% t' L: ~: l/ K5 H    int     2Fh. F$ H6 F. U7 x/ r8 T3 I6 ]
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: Y. v. }" r7 e
    add     ax, di
( Y/ s+ r4 t. \2 Q& F1 S& u) `& j    test    ax,ax' ~/ t! N2 V% p) U* e( V7 b  i6 h
    jnz     SoftICE_Detected! O2 q8 P& }4 W' ~3 I4 a3 ^( I
4 t# X: c* V$ l# Y
___________________________________________________________________________
  T2 Z: M& J* O" P) ]0 W( x$ Q0 \6 ^9 ]; }" T
Method 044 A$ H1 l" S" n9 W
=========0 c9 t0 x& A# n- C" p) a# G  q
% a6 y" V3 \2 ^0 F
Method identical to the preceding one except that it seeks the ID of SoftICE
6 T  E; H/ h, B" J0 C  O: h0 c/ uGFX VxD.9 C( j" Q6 ^/ ^1 ]0 Q+ |* L

4 f* X  M! G# C6 d    xor     di,di5 Z% ]- J4 ~9 U5 A
    mov     es,di3 |4 Y) `6 I) P+ s0 Y6 o. p
    mov     ax, 1684h      
) B7 Z- z+ _/ D& P7 U5 ]    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 \6 ]/ d/ W0 g3 R& b# w( h: m
    int     2fh% x4 w4 `0 l7 \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 g: e. X$ a  p9 R/ @# w    add     ax, di
5 E3 A2 T+ E( e" H4 a; K+ ], f    test    ax,ax
, c3 E, {' C8 y, ]    jnz     SoftICE_Detected6 z1 g6 q3 d5 _1 M8 I; b* |, L
: l& D" s# V7 D2 H  ?, T* r
__________________________________________________________________________5 V' a+ _" X0 U; z+ @9 }
- r7 _" v2 H) `% E4 F% _; t0 D
; i/ Y7 A. |- v, I0 |! y
Method 05# a1 \; f0 G' Q4 r& @4 I
=========
, c  ]- S, E+ Y% V/ a: f. [" m7 c# Q- d8 G# T4 U
Method seeking the 'magic number' 0F386h returned (in ax) by all system. g! U  C! E& y6 h6 n5 ^
debugger. It calls the int 41h, function 4Fh.( i! a4 e* W$ ?$ {9 `
There are several alternatives.  
' T! G: N  X$ ]) r( [) [
* F- P, S! H3 Z! ZThe following one is the simplest:6 O8 g, T/ i3 Q' k* K' U' f

7 _; e9 }1 c7 f* b5 |    mov     ax,4fh/ `! P4 T% y) m0 |% ~4 @/ G% r
    int     41h* r# i2 Q2 H& I& v
    cmp     ax, 0F386
  h/ u# o7 O, g4 v4 E8 V* p    jz      SoftICE_detected" k! |/ I: \+ T7 C

* ^% k9 `# I3 l8 ]
1 Q. P6 i( q& o7 B, j( qNext method as well as the following one are 2 examples from Stone's
$ K" K+ k2 l% ]5 a) ]' U; I" s; g"stn-wid.zip" (www.cracking.net):
' A4 o4 {4 U; @3 A% s6 h/ S
9 U; W9 b( @1 b/ W; R6 y! c    mov     bx, cs- s2 y* w0 ]' H$ G
    lea     dx, int41handler29 U7 T3 t7 F- `
    xchg    dx, es:[41h*4]! [6 N; }) \( L9 ~3 f& v2 d
    xchg    bx, es:[41h*4+2]
1 i0 A; Y5 L" T! I$ i" u# y    mov     ax,4fh
+ I6 ]2 s! Q: H    int     41h
& \# F$ K$ R6 F+ V: `; U  t    xchg    dx, es:[41h*4]
7 Z; W- X( J" |    xchg    bx, es:[41h*4+2]
% L" s! Q* I8 |; Q8 A  E# x" \    cmp     ax, 0f386h1 u2 K9 ^3 C& R1 L
    jz      SoftICE_detected9 E5 D8 P( [0 e$ q

7 Q& v+ o4 p  Y/ J6 x1 H; Z6 ?' Rint41handler2 PROC' v+ i! ^5 h2 h" I. Q
    iret
" t: @! ?9 c2 [4 V/ j0 U1 K1 v. ]  ]int41handler2 ENDP5 |+ O4 f4 P0 W3 y" e

6 k2 v: Z4 J2 F* C4 N" Q
  T/ {  h  X6 e( B# u0 |_________________________________________________________________________, E8 `" h/ I3 r- [

8 S; }: z# o3 L0 z2 w5 M+ X. U1 y) I* X: X: o& Q% X
Method 06
6 g" h' ^; c. }+ N4 p( m=========- K& R- @( a3 p$ [& p$ F6 J! d; I
; M3 P3 Z) C) V6 M; R4 N

% W. S# m, _! _, t, F- H" m  W4 k2nd method similar to the preceding one but more difficult to detect:
* w3 Z( c# B* w& n# k
: i% S7 D' R2 G1 `8 X4 k
7 k# A9 w- B! \int41handler PROC; f2 v2 R+ P% K* \! m
    mov     cl,al
: s. P' g7 y9 r7 @$ u) S/ r    iret
9 b5 l! H" F5 u1 C5 @int41handler ENDP8 m" U4 H( G# @7 A# i: Q! R* y! @" F9 M

/ f0 {" `0 F3 N$ l" ~( Q3 J0 d2 \) s3 c2 S4 S$ `
    xor     ax,ax
- I) l4 |. S8 _: f( s    mov     es,ax
) n0 W* B: k7 y% l4 S( t    mov     bx, cs
9 ]; P& b. t  e, i  K    lea     dx, int41handler
# E" N0 p. p# n+ Z2 O( w# y2 i- Y; ^    xchg    dx, es:[41h*4]
# O: U5 t7 ?, ], N% Y    xchg    bx, es:[41h*4+2]  l; D( }& A+ B  S) f( @" \4 f
    in      al, 40h3 n  U$ A5 k# H" u7 A4 ?
    xor     cx,cx: o! f5 X) f0 b! f. H
    int     41h3 z6 S' X6 S/ y+ C- p
    xchg    dx, es:[41h*4]
3 w( b5 D; n4 y( ^- T    xchg    bx, es:[41h*4+2]
5 h: {) k7 P0 b9 A    cmp     cl,al
% Z( n0 C7 W( j2 C- t. g    jnz     SoftICE_detected. A0 S8 j4 z+ A3 l

; P7 G  }2 l8 x7 H$ L_________________________________________________________________________: q8 R0 T9 G! s3 S# {

- |/ k8 @& Y3 }/ P7 EMethod 073 l( ?/ H7 L' K; W- y
=========
" u6 w/ k- [- @. M+ ^
1 a2 u, F2 [* e9 ^4 hMethod of detection of the WinICE handler in the int68h (V86)
1 ^+ a  f3 q; _
/ ]. Z5 M; p) a4 |' q    mov     ah,43h6 w0 ~7 a7 ]6 B/ ~* U; n6 V
    int     68h
" `- H7 G. F5 ^; J# v' C- ~1 P    cmp     ax,0F386h% k- D- E: \. v) f% ?) z: Q
    jz      SoftICE_Detected
. }4 i) W6 M4 z0 b3 G! v+ B$ B
& E$ ?( @) W( Z; r7 ?. ^
6 r' J/ @, o9 {* ?=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' @6 N4 x  U; Z/ j  O
   app like this:
  J' W' a! H- _1 ~' u5 M$ [4 f
3 s6 Z6 S2 \, L1 m8 H; Y   BPX exec_int if ax==685 V0 f7 Y6 ?  Y" I6 X
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& x/ |, H- X+ F   located at [ebp+48h] for 32Bit apps)' N' i: `  [) q+ |9 i0 x
__________________________________________________________________________
+ X2 l* ?! ~! t$ `5 Z7 f  [' U4 t% R( |9 q# F

$ }5 w3 [4 E4 X5 xMethod 08
9 v4 e1 A6 h1 L8 O/ Q1 P0 I=========
0 L2 Z0 G+ |( V  c9 M; z: p
' ?0 g7 D! x5 D5 p7 l/ q) QIt is not a method of detection of SoftICE but a possibility to crash the
$ Z$ K! Z- ~% D+ l$ ]/ j( H' nsystem by intercepting int 01h and int 03h and redirecting them to another2 @+ A# e- ^( l2 F
routine.
4 p( [8 i$ Z& W3 T. c, l0 q0 s" JIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, ]- @5 B6 A- D, I7 M9 x& O  [: T
to the new routine to execute (hangs computer...); i; |. U/ q+ z
6 _3 ~7 q7 g  k& I7 Z
    mov     ah, 25h
+ c  @5 [  w1 ]' z* v" C    mov     al, Int_Number (01h or 03h)9 y5 P7 r, n& H) e4 M# ?
    mov     dx, offset New_Int_Routine+ Q1 H$ v1 E9 J$ y1 c
    int     21h
2 ]( l( e9 @; A- B5 j+ R, {; C
8 h2 |  T* T. k, R% ~4 d__________________________________________________________________________
( A' r4 `* {  ?9 l+ |/ Y: D
9 k- K' J# w2 @7 W) R1 SMethod 09
9 o+ ^) [# D1 k+ `- j' e0 c# w. t) x=========
: }! [* L4 R& V3 g
* w5 g) u! J' Y- u! k2 XThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: x0 q+ i+ W* l  P1 s  ?. Y& y
performed in ring0 (VxD or a ring3 app using the VxdCall).
& y3 o% O  W1 O; I& MThe Get_DDB service is used to determine whether or not a VxD is installed
4 a4 M$ y, e7 Z9 ^* s3 u* T* E& j( xfor the specified device and returns a Device Description Block (in ecx) for
5 ^9 L( G: C' T3 L+ q) n/ d# Z) Ithat device if it is installed.3 _8 ^0 n( X* {0 p9 {
) P8 W6 F. t8 ^' [$ B
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 T, J0 o% }2 Q8 p   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
: `. t1 q6 o2 ]% c: \; d5 t4 U   VMMCall Get_DDB: l9 m! {; W2 y; n! o3 H3 k0 s  Z2 d
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 m; n* J# R1 R! U# C

. x; c% E) g/ c( M% QNote as well that you can easily detect this method with SoftICE:
4 C. O* E: U8 x* ^! s' C8 [   bpx Get_DDB if ax==0202 || ax==7a5fh
& k# i) _) G5 H! g; B( R9 ?# E% l: C
__________________________________________________________________________- l* r: w8 P* y) C, \- \& G$ j  Q
' R/ R7 @* R7 i3 _9 D
Method 10
  B1 ^8 x0 p" ?" h% W/ a4 \7 m=========
* x% n: q+ ?: E  G& f) ]; E- z3 C( {$ p, B
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 g9 T$ J9 j5 [/ [2 s: h, l  SoftICE while the option is enable!!- M# l% K# S5 u! T7 ]% W6 S

/ _& V  y2 R$ @This trick is very efficient:, R) Y4 o6 n+ u2 S7 f" L
by checking the Debug Registers, you can detect if SoftICE is loaded4 `3 I9 Z! I- ]" o' }1 o
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if  ^4 t# P5 R# y0 S% a
there are some memory breakpoints set (dr0 to dr3) simply by reading their# J; p# R& v9 W$ H
value (in ring0 only). Values can be manipulated and or changed as well6 R4 F9 [6 o0 k. x, c/ c" s- j
(clearing BPMs for instance)
3 |( U5 z- N( B% l0 p5 U  G$ w
9 k0 l& `$ M1 O* R0 M) }  i+ }__________________________________________________________________________
& h3 Y0 A: |2 {4 V& O7 |8 Q/ [5 E$ S+ q. S1 U
Method 11
' C! y+ L" u% A' p=========7 p& Q+ L0 k( x+ [7 P0 l
5 U$ d  p" u, E4 P7 H" `8 S
This method is most known as 'MeltICE' because it has been freely distributed' u6 i* i$ X$ O( t9 B; _6 @& n' v
via www.winfiles.com. However it was first used by NuMega people to allow
' C( f- T+ e9 v/ ^4 [: C4 NSymbol Loader to check if SoftICE was active or not (the code is located
5 |  y) W4 `  w. ninside nmtrans.dll).
$ ~9 \+ W) g" Y5 o+ w) \
1 k! ^2 e0 \3 r5 f: `) a  PThe way it works is very simple:8 `% [% G& r; t, R7 y" i
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: Z9 A) @+ v% Z% H& T' eWinNT) with the CreateFileA API.
& Y' |/ y& [2 S& C) x
1 A7 O7 Y8 \/ x' d2 L8 q4 y2 SHere is a sample (checking for 'SICE'):
0 z" n/ a% |9 I+ W+ p) J( s" b# A  Z1 x8 ?6 m) m# T% H
BOOL IsSoftIce95Loaded()
/ ]4 G9 j! g& y% c{
+ z$ |6 h& f- {7 n& v& v* t" T   HANDLE hFile;  
& e" Z6 n. G  ^& E4 U% `$ ]   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 [1 g# a* a8 F
                      FILE_SHARE_READ | FILE_SHARE_WRITE," ^  [+ u. r' d) ~2 p0 [: h
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);% R8 a+ _- i! D* p
   if( hFile != INVALID_HANDLE_VALUE )
0 k; o. B9 j& C   {
7 {0 s* c# K) I+ d6 T      CloseHandle(hFile);! @% t$ Q7 \" x5 S( W% `
      return TRUE;
2 A% W# Q8 v" ?  O1 g   }
: {8 s: k$ p- X- `" `   return FALSE;- i  _# g5 M" V8 }3 A4 |8 @5 [
}3 }9 r2 o+ a7 |, u+ n8 |, l

) i' \# i. @( l0 g% H4 @- R4 K* ZAlthough this trick calls the CreateFileA function, don't even expect to be4 }4 L5 v# Q8 L  `/ x8 R
able to intercept it by installing a IFS hook: it will not work, no way!7 r( b( D0 _' j) [* B; V. C
In fact, after the call to CreateFileA it will get through VWIN32 0x001F- G$ w3 o$ n) m7 P  l
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! g( @" n- d% h0 w4 N+ Y( Wand then browse the DDB list until it find the VxD and its DDB_Control_Proc4 G0 \# e( U* O( n/ p+ Y* v3 T2 H
field.
7 t" P# w" K; f  G. I+ ZIn fact, its purpose is not to load/unload VxDs but only to send a
8 F3 W8 }% V. k1 t6 s. NW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)5 s0 n% |1 E& n+ y- A
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 g$ X/ R' [7 l& H8 E1 G; p+ Lto load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 [' i4 A) M+ M2 ~2 P6 nIf the VxD is loaded, it will always clear eax and the Carry flag to allow
. P6 p6 h  t' f- G' t2 g( f) |! Q/ {* X- Pits handle to be opened and then, will be detected.  ?) S+ u/ C! c, c) E/ T
You can check that simply by hooking Winice.exe control proc entry point
5 b! n4 B/ D" ?7 L& awhile running MeltICE.9 n: C  }: [) J6 J! ^8 W
' x1 S: c& v1 O8 s( a

6 e. h* i- c( p7 J: W0 T8 Z/ G% t  00401067:  push      00402025    ; \\.\SICE2 H1 `' L% s) H5 e8 i
  0040106C:  call      CreateFileA" W2 }( k1 O2 F' N2 i: w
  00401071:  cmp       eax,-0018 T3 c( A* d' F" r
  00401074:  je        00401091& `( y5 m  i! X1 X2 I, t
+ J# u, ?2 P" D# _* j
- K5 V1 d# G, J6 W( i/ F$ i
There could be hundreds of BPX you could use to detect this trick.; ^( f7 Y- Z$ n. h( F3 t& N
-The most classical one is:
* d1 {; x  W$ i3 U, K9 f8 s  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||! Z& \9 r* e8 \) ]* ]
    *(esp-&gt;4+4)=='NTIC'
) k9 u( u, X9 H* U* I. T2 W  H4 D( \& y0 K4 {* J
-The most exotic ones (could be very slooooow :-(9 e! ^  b# e6 U, n& ~
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 i- r$ W. s. P0 [( |% _' H2 @     ;will break 3 times :-(
# ?; N& H+ s8 D0 g) x- w
1 L9 n! f$ P4 A4 ]$ {6 }-or (a bit) faster: - Z  _/ y8 }- ]
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# U; Z2 U8 }, \- h4 h7 z! J
2 ^1 U9 ^3 ~' x7 c* F
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + N- d7 E0 n3 d- I
     ;will break 3 times :-(( B7 f* }7 O/ W& C! p

% h6 w% D( B" M2 J$ G. S( C. r-Much faster:* r$ @' p( t0 \# }5 i# C  K: `
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
5 \, E$ Q& b, ?4 k9 l  s( m% V' L
4 [6 \; Z/ V" B3 kNote also that some programs (like AZPR3.00) use de old 16-bit _lopen) a; x) v; h" x7 ]% y0 b
function to do the same job:- C3 H2 r$ y# V9 o/ b
* o% F3 N4 H$ r4 [; V4 {( A3 Q
   push    00                        ; OF_READ
* ~4 s. o! l4 c$ \   mov     eax,[00656634]            ; '\\.\SICE',0
5 y4 d, C* r1 b   push    eax' u+ }% T2 A  Q/ H7 L' f
   call    KERNEL32!_lopen, `5 p, S4 s, O/ S$ a
   inc     eax6 m9 `! T7 y6 s# g
   jnz     00650589                  ; detected
) v! l* ~( G. j, Y/ g' _! h   push    00                        ; OF_READ/ R) b  x4 ]# H
   mov     eax,[00656638]            ; '\\.\SICE', g0 v5 E) q5 l. ?5 J, Z
   push    eax* X6 i$ J0 n9 w. t4 p' S: V
   call    KERNEL32!_lopen# F5 J7 t) @, l9 u9 s' w6 ~
   inc     eax; W: P+ `& H) @) W- e9 ~
   jz      006505ae                  ; not detected
5 g2 C+ ~8 j$ J; q
9 b: O+ P, v$ a9 n6 P8 `! _6 n+ _: ~0 e  n
__________________________________________________________________________  d# ?* u9 m! w* x: w% K3 ?% L

3 `5 a- ^, C. M6 q: pMethod 12
! ]( w$ N3 |8 H/ C=========0 b0 K0 j) j. m5 U# x

( v2 E$ i1 l: D' cThis trick is similar to int41h/4fh Debugger installation check (code 05
# h: d6 v0 L% O8 g% d1 F&amp; 06) but very limited because it's only available for Win95/98 (not NT)# p7 N5 h: ]& e) j* j; Q% q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 k! D+ r- ?- w# B5 F

0 s, [! F& B1 D1 g* F# a+ d   push  0000004fh         ; function 4fh
+ l; E3 @6 C2 I* C* B   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 ^* X( X: Y) _+ ]! c0 e                           ; low word specifies which service% ?- m& {- V4 g! f
                             (VWIN32_Int41Dispatch)' _; @( f. \7 _5 I2 l3 F8 r
   call  Kernel32!ORD_001  ; VxdCall
& v' K" B3 q& x4 R' p0 h   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 p3 P; Z9 m/ m+ E& T, B5 J% x! M   jz    SoftICE_detected
5 s, C8 j1 I9 c1 V( F0 Z5 k6 l- e: q! D1 i/ q1 J% c" A: o) s
Here again, several ways to detect it:; |4 y6 l7 x$ ?. r' C8 t) |
3 ]8 D2 n0 @! T' d0 M2 Z+ s* _
    BPINT 41 if ax==4f5 \+ D  ~: s! x/ F* K& r9 B% x

! C) ?+ u9 r; r0 q# U    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
( p! @4 |4 e/ M) ?! F. k
2 Y- R0 y8 [9 |" j" g    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: ^0 J) n) N. u
: Q7 s; b/ x7 G  w9 G% |8 b
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' a; A: w* o$ B; ~

1 X3 A, N% R+ }, g5 ?8 r__________________________________________________________________________  V' _( u. b  `, L4 e

/ I+ N/ @% N' l& L0 }9 rMethod 138 ~% C8 e" Z6 o3 m3 e
=========
' L; P" a" A( A, S5 d' A2 X9 x. [) x9 U& Q- I
Not a real method of detection, but a good way to know if SoftICE is' @4 r! q3 |9 x, ~+ m5 G
installed on a computer and to locate its installation directory.' a9 \  Z  T0 M
It is used by few softs which access the following registry keys (usually #2) :
0 V5 B( z  [" _" D! Q) z; E
* X) N3 r5 g9 V/ E) i-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 k9 k& s8 y9 c+ i
\Uninstall\SoftICE
0 @0 z4 E8 o7 e% d+ ^-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 [1 X9 Q) a4 X: c7 ~- c' E
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 h8 G% }& a) I8 O5 \
\App Paths\Loader32.Exe$ W4 H4 x2 o  T3 g( F9 V5 T

3 F9 \7 d# e1 d6 n
- I) S$ P; R  J; R. f) LNote that some nasty apps could then erase all files from SoftICE directory: e* B3 v. A8 k
(I faced that once :-(
- u9 ?$ o" G: ^# z! G* G3 S. E& d  @! y( s* K: e" f' X
Useful breakpoint to detect it:, v0 h7 L; b8 {3 p( w

6 B2 z  h( v$ N7 P% P* J) i     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 q" z% f, d" H7 \$ N0 r( c! k: I/ x0 K
__________________________________________________________________________
* }4 g1 ^7 m8 r* z& Z& L8 w0 u5 o/ C+ t) `. x

( Y2 x7 d2 X0 @# _/ B5 o5 d0 C- Y8 wMethod 14 2 u9 {1 u/ a" ~5 L2 Z3 J  y
=========
: V( W. Z3 V. l4 L0 X
) Z& b! R* y' O$ N/ m5 e! P7 |: VA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
7 v. I; @0 W. T1 }1 Fis to determines whether a debugger is running on your system (ring0 only).
' R* Y; D; d0 S4 `/ g+ s& L: \- i+ R1 j$ s$ z2 j$ t
   VMMCall Test_Debug_Installed
5 _: ]$ a% |1 ?: y/ p- u) M   je      not_installed
6 J6 V2 h% D# {$ W$ n8 X: B
6 ~. z: e0 h3 cThis service just checks a flag.
! u$ }2 `( p4 K- P+ ~1 U</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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