About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>/ B% c6 o& p7 ?0 ~
<TBODY>
# B" Q3 \7 A& z<TR>3 I5 w2 {7 t' k6 U# x
<TD><PRE>Method 01 4 E; l3 @  e& _- N
=========4 r7 `- @5 Q# B  p" k, c
9 I, F2 w, B6 s: {8 L: x8 ~" U# q
This method of detection of SoftICE (as well as the following one) is
, W  ~2 B- ?6 v5 N9 Aused by the majority of packers/encryptors found on Internet.
! w" ]  v( @% V& o, O: KIt seeks the signature of BoundsChecker in SoftICE
/ z# h: S4 {+ Q9 C: K# @$ W6 i* H5 Y: V& V2 L! [  W$ s: c5 S
    mov     ebp, 04243484Bh        ; 'BCHK'. h) ?+ C: h% e
    mov     ax, 04h
4 k% y+ v2 v7 G- o, t    int     3      
! N, a& A4 J2 N6 j& ^    cmp     al,4. @. v% [0 o( ^) b- A& k1 U
    jnz     SoftICE_Detected
) Z  _* e9 B0 C; r) [
! h+ k) K. @! N5 @: c; u  u6 A' r___________________________________________________________________________
8 Q1 P( Z0 V) L' s$ G
3 ~' A- [( H+ `Method 02
+ ~9 b9 H0 T9 j% ^" N7 m% e& K' N5 a=========
$ E5 y8 F3 z' `1 z
0 ^6 v2 W; Q" PStill a method very much used (perhaps the most frequent one).  It is used/ }9 [' U! D8 n9 U0 J# M( {, R
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,; r+ l/ Q7 o& r4 U! L8 \2 \& n
or execute SoftICE commands...
) y7 l6 G; v6 f: JIt is also used to crash SoftICE and to force it to execute any commands
' @9 c3 G& Y% B" ~- E(HBOOT...) :-((  
; J( t) \( Y& ?& i1 z' P% N$ J/ e- i: T+ \# c) ]
Here is a quick description:
6 K0 H& ?2 Q! a1 F  W-AX = 0910h   (Display string in SIce windows)
. g! W3 B4 B3 t3 S$ H! _- @-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
; }: k7 ^$ G/ f-AX = 0912h   (Get breakpoint infos)
5 {/ a9 q6 R; d9 Z$ s" A-AX = 0913h   (Set Sice breakpoints)
/ Z5 j' G3 d, m-AX = 0914h   (Remove SIce breakoints)1 Y3 i5 c! }4 B" _
8 }$ }5 c. f, {% J- b
Each time you'll meet this trick, you'll see:' j$ O8 b2 H+ k( W( v& T
-SI = 4647h  C" e$ x$ O, P% M- W( G  A2 n3 g# Z
-DI = 4A4Dh% a  @0 P$ k& g( H
Which are the 'magic values' used by SoftIce.& Q* C( y9 j' G. F0 U
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.% b, w: y: m- _6 p+ y& x: _9 [

; P/ V; ]9 i9 x* a; M- c7 dHere is one example from the file "Haspinst.exe" which is the dongle HASP
+ n2 ^; l3 s4 u, \: `  e) HEnvelope utility use to protect DOS applications:$ ?3 {) K' T9 |* H; Y
$ \# q+ h* @4 X, P

3 O. [2 ~8 o$ }: S4C19:0095   MOV    AX,0911  ; execute command.: J- ]3 D% Y; u* D# Y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  \: Z, h( b3 W6 K
4C19:009A   MOV    SI,4647  ; 1st magic value.
  x: S3 O# R, P4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
9 F' x: M3 p; ^8 H% F3 u4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 y1 I, L# K5 y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* k2 ?$ S. m% ^! z  q6 O, H/ _4C19:00A4   INC    CX) \6 I% c8 V9 t0 J  M, P2 W
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; K  N: x! z+ a( _" v
4C19:00A8   JB     0095     ; 6 different commands.
* w/ y3 l# y- A9 _/ o" z* r4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 I" s! ]0 L$ S
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 |3 ~) o; c% o0 {5 x

% r, H" E7 S, z9 u% f& D3 EThe program will execute 6 different SIce commands located at ds:dx, which
  o/ P" |2 _. p- J3 X2 A! k% zare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 [# Q# w; [1 w" U. K

( K0 l7 E6 _6 B' e* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
0 v( f* A- _/ w4 H3 w___________________________________________________________________________
4 q/ K" w* L0 v0 E0 A6 D0 [$ ^1 U0 B" H, K& z& |* ]7 r
/ Q6 q6 S8 J  N' D: A9 [5 }) f
Method 033 r8 r0 p  {2 H" f3 R2 N+ S
=========
1 f/ z5 O6 E1 _- _5 r$ X  G' V0 A/ V$ |
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 X. z0 c$ {0 g( s- z
(API Get entry point)
& [" i! Q3 }$ ?. B6 T: @- b        / t( ]2 p: Z( R' _! ]; L" S
$ z; L- ]5 ^! p8 \6 ]8 Z  P: F" g( d
    xor     di,di
; i+ y3 ^, ?, s- X" M    mov     es,di
3 N7 H' [8 s9 f# p& c    mov     ax, 1684h      
. H( l- \1 l) ~" \6 l& k9 b    mov     bx, 0202h       ; VxD ID of winice
, S& h$ _& C9 }( e0 k' s    int     2Fh
; w: u) }3 r* c    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: D! D# Y# V$ _: {6 R5 Y0 ?    add     ax, di! s0 ]6 P7 T6 `! c3 o; l* F
    test    ax,ax0 Q) l# l7 d2 g- B3 `! f0 g
    jnz     SoftICE_Detected0 q5 O; L. ~% r& F8 z  f
: b1 f' w* I5 h. r
___________________________________________________________________________, x& B( ?' r/ E+ @/ D
  q5 ?/ @2 x. o# J' o
Method 04
& G4 a' e: S5 a8 _=========
0 m5 R( b9 v0 v6 X- Y) j. R
& M6 |5 O& J. `Method identical to the preceding one except that it seeks the ID of SoftICE8 U/ M& w) ]8 @; _5 ^6 A; X
GFX VxD., ^' N0 `9 y9 s2 |0 [

1 m: v, T- s6 S( z    xor     di,di
) e0 A( V$ I- x3 K    mov     es,di
6 T  j/ z. Q  G2 h    mov     ax, 1684h      
; j; g& ~, I5 u+ @    mov     bx, 7a5Fh       ; VxD ID of SIWVID% v9 {1 {4 x) F) g5 P7 q5 e
    int     2fh' A9 h; m9 {/ C& U! J) }6 ?
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 y' t5 E8 g3 ?& g! N    add     ax, di4 E4 c0 F* B" X; _  s
    test    ax,ax
' s; M6 S% |3 C0 j    jnz     SoftICE_Detected  Q. h8 y9 p0 L6 G: F) \5 B
4 @; e2 r# Z& ^3 U2 t% W
__________________________________________________________________________
* o$ B/ P- o: B: G" Q* o& m: L( U3 A
) Y% z  i, _1 R+ x3 W' C. V( L
Method 05
, `% a: ~; p5 o1 o( x" S3 O! T=========
7 J' E$ m6 i! N% o9 X- Q' @$ @% D! {* U8 e' D
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- M$ s0 p! d. Y% J* m# Vdebugger. It calls the int 41h, function 4Fh.
9 W- A8 z' N3 k* e6 j$ `0 _) W& x/ MThere are several alternatives.  
8 ~& `' C' l- d2 K4 C1 W9 p  {
+ P/ }* F& U) U9 k: yThe following one is the simplest:
0 w: n4 X+ A$ r+ U* Q- C0 ^7 G8 V1 z0 V, n; ^
    mov     ax,4fh0 O: o9 ?) X# M5 H) @
    int     41h" v* V. V/ H2 B7 n
    cmp     ax, 0F386
; R0 E: O6 u9 z9 s. D    jz      SoftICE_detected$ p: e) U' K8 m
7 W- a# m7 b6 G  G: ?
: ~' e; d" Z1 T7 B7 G
Next method as well as the following one are 2 examples from Stone's
# X- g/ S& A  X+ h2 x; _"stn-wid.zip" (www.cracking.net):  n9 ~7 l- q5 y4 \/ b; f( t( Z
: a  @$ V, X0 b& s: M2 y. o
    mov     bx, cs3 R% B8 n. _2 w) a7 n, Y& M( X
    lea     dx, int41handler2
% z, w6 S. [( i* f+ u( @    xchg    dx, es:[41h*4]
# Q" K3 X+ d2 }: j5 I" M3 `    xchg    bx, es:[41h*4+2]
% V$ N5 E; Q! q. ^3 R4 y2 A    mov     ax,4fh
  C1 r6 ^: I) ]8 Z9 }; R    int     41h, B9 \) X, {. j7 C  P
    xchg    dx, es:[41h*4]
; H, x+ R4 J% ]8 z' W7 h    xchg    bx, es:[41h*4+2]. r/ @' b+ U! R% Y# r/ I- j$ I
    cmp     ax, 0f386h
2 l: b. \" u; A' R6 A    jz      SoftICE_detected/ U7 U' Q2 w" U! y# y

7 u3 J7 q# y6 ^. Y5 n0 J( h/ ~. Yint41handler2 PROC5 r* n' {3 H/ K6 U. }6 ~
    iret
% y! k# b8 Q( S3 x8 cint41handler2 ENDP% _0 j1 ?" D9 W( I' ]% a, c

' h3 y+ I* t! a5 @9 v4 H0 U- u! [) |# m
_________________________________________________________________________8 R: e, \% \; R

% f5 X4 t; ?4 ]( D9 [  {: E
/ e/ o4 ^' l8 O5 R$ eMethod 06$ Q) W- |6 A$ O/ L% z2 {% k7 Z
=========4 d) e/ l) z) P  p

; I. y# X- I/ @' j5 R
* Z0 Y. b1 |; U8 d  R2nd method similar to the preceding one but more difficult to detect:
. E$ ^0 K2 U$ _: Q; t
. o) F. \/ v' e# l) @1 I
" \( R& `+ L7 ^( Y0 C' ?' r/ H( Mint41handler PROC
' x  ?) H+ v& `, N: E    mov     cl,al6 I+ _* G. D( v( @; E
    iret
3 m8 }0 X' g9 ?, M4 oint41handler ENDP+ E" q; G# \" J4 O

! l; z0 x- Y# ^
; s# Q) B% R4 A7 M    xor     ax,ax
/ J- q( P) }/ T' P0 A% T' n" a6 O    mov     es,ax
7 ~: z) r: g1 g8 f/ H    mov     bx, cs
9 ^) E) n: B1 t1 q' }! h    lea     dx, int41handler! X8 ~) c4 v, i) t5 a5 G
    xchg    dx, es:[41h*4]
1 n# u5 N- `( ^; K    xchg    bx, es:[41h*4+2]% X( e0 t! S- A/ o. G! p2 n. m
    in      al, 40h
$ B' z3 p9 u4 N, ?    xor     cx,cx
  O" m! h8 {  ~& i3 r    int     41h
5 }: A. P( A* D6 Y, j    xchg    dx, es:[41h*4]8 [& T% r) P: \' _$ [
    xchg    bx, es:[41h*4+2]9 D' \! w" S2 j* e
    cmp     cl,al% q/ ?6 j3 ]# X  B; U
    jnz     SoftICE_detected
8 R' G4 a( r9 ^, {1 B6 X9 l  q1 \3 i! b+ D( }- ~
_________________________________________________________________________
2 _7 p7 C2 M* N( d4 a0 V/ Q4 @. I. c" L8 |
Method 07/ u. m! V3 H5 m# h4 ?
=========
& p9 ~$ h1 p5 X
; ]9 V9 _" @: K( {: BMethod of detection of the WinICE handler in the int68h (V86)
8 }& B: Z: n) y2 g+ `: w$ Z
" B- v( ?/ r# [8 Y8 T    mov     ah,43h" ~/ O- E- U7 y7 A& S$ Y
    int     68h4 G$ v: [% s0 @% B5 ~& ~
    cmp     ax,0F386h
  J4 h4 {# i' i- y$ J/ n. K2 _    jz      SoftICE_Detected& q% o7 |! M$ m3 V; o  J' \
/ Y, w' a+ \. E0 o+ s8 b  m! X

+ V7 I1 F1 f6 W- ?=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) {4 |0 v( i" Z5 Q# x3 M   app like this:9 p4 e8 N3 y5 v/ _- L+ [* ^" i

$ q3 w% |) O7 z3 @   BPX exec_int if ax==68
! e. e/ Z3 P! }( S$ X- G   (function called is located at byte ptr [ebp+1Dh] and client eip is
7 W# |8 S5 Q9 h6 w7 }   located at [ebp+48h] for 32Bit apps)
, X5 x3 ^$ a2 O# }. y1 l__________________________________________________________________________& ]& `/ |0 _3 h5 Z

* b$ l- p. y- B5 ?3 j: U7 r
. \$ u) U$ H7 J+ E0 S/ xMethod 08
1 J/ u9 ?$ y* b: Q* E# F* U=========* i- f" F# l5 s- x. L
; j: K) w. _0 v7 x! d3 u8 M, y
It is not a method of detection of SoftICE but a possibility to crash the0 H$ w, w' b! ^* S: m
system by intercepting int 01h and int 03h and redirecting them to another; ]. N$ [( o' ]! ~! P4 X' d; [% o$ v
routine.
; p2 o  D( l' s& m* z* |. i) ?It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ V" A) h1 q' y) o  S! m0 Jto the new routine to execute (hangs computer...)( }6 O# H+ \3 c- z; p

7 q5 r& y' K" \8 p& g" K    mov     ah, 25h
- R2 j- W4 E' a/ j    mov     al, Int_Number (01h or 03h)
! w& q0 s' T# t/ a8 K, o" v    mov     dx, offset New_Int_Routine
0 ^5 O9 ^5 G. }, _& K+ S    int     21h
" E- D* r. _, O$ V6 v* @
, I. V: }" Q1 c__________________________________________________________________________, u( _6 a8 p# c
8 C1 y/ I% n1 l7 a! t+ ~' n6 _
Method 09  k( Z' ?* s: v9 p; ^# g1 z
=========
3 J! J. C( ~/ D5 \0 |& V
9 ~2 e6 E$ C* B! fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only; E( p4 C- h) C8 M
performed in ring0 (VxD or a ring3 app using the VxdCall).& l: J) y% w1 X  m9 k
The Get_DDB service is used to determine whether or not a VxD is installed
3 }3 c/ T7 k. y5 ~2 ]$ @for the specified device and returns a Device Description Block (in ecx) for
0 }  d( X: K% t& \that device if it is installed.
2 b  c- Q9 p: J" b$ l+ L
3 p6 o! q+ {  _) E+ T* T   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 [, O- x% Q9 P2 K( y7 d! m   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
) U) a3 L3 @) j   VMMCall Get_DDB
+ D1 F, ^+ N: X3 S- C! W4 e   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  |; y0 r# M. B% N5 X# H& Z  r; o
% g9 M* v5 I7 ?% uNote as well that you can easily detect this method with SoftICE:
% J: ~0 b, ?6 {8 |, O5 [   bpx Get_DDB if ax==0202 || ax==7a5fh
9 B2 J) L$ y; j8 t, p8 A5 o  t- K; b" Z( n4 C, P0 H$ n: ~
__________________________________________________________________________1 I2 R/ I4 S% F3 D. N# C) Z

2 u' D/ \# U, K1 a  T) V2 v1 kMethod 101 D' ]) \! z0 a' X" M/ x5 y( f: p
=========
; h4 b9 T" @" g& ?5 B* }: M1 A* N; O+ F$ f+ F# e
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with7 g- ~) M* u8 }& s' v6 E
  SoftICE while the option is enable!!
8 M8 q5 A- U$ Q% S& |7 f* V# }& P. o3 u4 |2 \- t/ v. ?" _
This trick is very efficient:, T( c( O' R! P. K
by checking the Debug Registers, you can detect if SoftICE is loaded
3 t4 h8 B- n' ~* M( \5 D( h(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: ?* f& K/ r/ C  R( Ethere are some memory breakpoints set (dr0 to dr3) simply by reading their
0 Z- H, g+ E$ j9 J  j- wvalue (in ring0 only). Values can be manipulated and or changed as well* O% k9 Y* j$ C
(clearing BPMs for instance)
! M' |" c" l/ I7 L% F3 E6 C& ]! b! E. Z. F* Y8 ?3 x8 v
__________________________________________________________________________; O! Z4 F( M9 p4 x  e
0 j9 W) l7 Y: u* I2 d$ ?: L# Q
Method 11) e+ J5 M5 F2 ?4 H
=========) m5 `8 w4 R5 s' y% i: C
+ l; Y& m5 n8 _
This method is most known as 'MeltICE' because it has been freely distributed
, v4 y: r3 e3 K1 Q$ yvia www.winfiles.com. However it was first used by NuMega people to allow, ]2 {" ]( Q; L* n9 y
Symbol Loader to check if SoftICE was active or not (the code is located# j6 m$ Y6 ^6 C; P
inside nmtrans.dll).
3 z- m3 ^* Z% N  O6 L! I- K
) T! W! E6 @5 K: p; w7 v! p( S* Y+ GThe way it works is very simple:' B  B  y& Q# @
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! [6 T! c+ n9 C* B
WinNT) with the CreateFileA API.
5 v& m' f/ M0 l
& d  R9 P: F" m# H; JHere is a sample (checking for 'SICE'):0 Y6 }! _1 K) w
& ]7 P7 p+ x7 t* V
BOOL IsSoftIce95Loaded()
3 z3 W# N7 {' R3 O. h- f/ t{
* d; m( Y! X& K3 \3 ~! N   HANDLE hFile;  
& a3 e) ~' c8 v   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,# \3 e; B' a3 B( |
                      FILE_SHARE_READ | FILE_SHARE_WRITE,% i- ]- R6 J. t- L. E: i; z
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ E& l0 l' e# L   if( hFile != INVALID_HANDLE_VALUE )
# \& V& ~7 N' q& N2 x2 {' c0 x   {
  ^1 C  ~$ ~3 o& T      CloseHandle(hFile);2 Y8 w4 a9 N+ m5 m& {
      return TRUE;4 D" C9 K  w; u
   }% _" d: }1 x/ D0 d8 w
   return FALSE;) r' n. z; N! ?
}9 |2 ^: u& u& n6 g0 f! Q
4 w+ D  D5 d" |$ {
Although this trick calls the CreateFileA function, don't even expect to be# L; j8 ]/ b3 I6 ]; F( ]. R
able to intercept it by installing a IFS hook: it will not work, no way!" A- I: I8 J' Q1 @0 p$ X! ?
In fact, after the call to CreateFileA it will get through VWIN32 0x001F. R0 Y# H4 I8 L4 E- X! t8 `
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( d2 @" r* x2 ?  p2 N' E
and then browse the DDB list until it find the VxD and its DDB_Control_Proc! D9 G/ p' r" P2 W0 k/ G
field.) f) {/ k' p/ G: d) [
In fact, its purpose is not to load/unload VxDs but only to send a
7 e8 W5 R% R9 a" f9 S6 l9 x/ a3 l0 FW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 I/ A! F/ H5 N  s2 Bto the VxD Control_Dispatch proc (how the hell a shareware soft could try- I# D; o5 g& L3 A( x  T5 S& j* I/ k
to load/unload a non-dynamically loadable driver such as SoftICE ;-).3 K6 U; ~* [/ R, U0 ^5 v
If the VxD is loaded, it will always clear eax and the Carry flag to allow" r& R) P: v+ n9 \" Y" R3 R
its handle to be opened and then, will be detected.! w3 Z5 @9 \0 x$ U. n' Y
You can check that simply by hooking Winice.exe control proc entry point
+ k  ]5 r" X) r( p) f) Hwhile running MeltICE.
/ X6 U8 F) l3 ^8 w# d- }% X5 s- y" E) d3 e. G# p

- l7 K! ^, G# W( h9 Y. K" s  00401067:  push      00402025    ; \\.\SICE
2 m' w0 i5 Y5 R# V& g& Y  0040106C:  call      CreateFileA8 d/ q9 z# q9 t
  00401071:  cmp       eax,-001) ^& O! t# P$ `: V; t% a" r) l
  00401074:  je        00401091
) K* _, b9 c0 U4 H8 V( j) s% Z# g6 a! ]: i9 g4 y

9 r4 ?. W3 c3 _* i* R  J$ GThere could be hundreds of BPX you could use to detect this trick.% @; _( Y. l5 f! H
-The most classical one is:& P6 d) p! _7 m  l
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ Z: \2 b! ?9 m4 W9 E+ u
    *(esp-&gt;4+4)=='NTIC'
; T! n4 r0 A9 |6 u1 Q" d; ~: ]2 c$ D
-The most exotic ones (could be very slooooow :-(
0 Y: K6 ~! r+ E* e6 H   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / m2 U0 m+ _+ N/ E8 c7 K/ \- p
     ;will break 3 times :-(5 C; ^6 g. r( B& b/ t: f8 B
2 f1 x7 l5 }+ A$ r" d' v8 b+ a
-or (a bit) faster:
% ~8 f7 E# m* v: n* C   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- z1 O9 S: z8 q0 |" ~- y% C2 e% }
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  2 K- C4 [9 u+ B( r/ o
     ;will break 3 times :-(
* O+ a7 i/ t* S7 _/ V) ?
" R  W0 b' b7 O, s-Much faster:/ Q- f1 e( I8 y) V* t1 O  ?! [+ j
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. B0 g$ |3 g3 c+ \* [
6 n! m" Q  Q. F$ T; p$ [) w" CNote also that some programs (like AZPR3.00) use de old 16-bit _lopen3 l# q! x. J  f" O0 I4 y3 y
function to do the same job:! I- l5 P3 [& c$ p! s

8 u4 W7 |. M+ l; N5 v) o   push    00                        ; OF_READ
$ W7 e$ l' Y. f; B9 R8 g   mov     eax,[00656634]            ; '\\.\SICE',0
+ C2 z% {( G) }" [2 _   push    eax
8 W7 ~: w+ x$ f$ w( k4 q# t   call    KERNEL32!_lopen
# X# l0 F: _2 S, n3 A  Y   inc     eax$ l' }% W5 `8 }# h6 }/ i. V! J
   jnz     00650589                  ; detected
3 ]5 n( g& `6 {/ g" l   push    00                        ; OF_READ
) M0 |1 N: |% F8 s: o1 I% Q/ [7 v   mov     eax,[00656638]            ; '\\.\SICE'0 g" X& W$ c8 i' Z# {. U- Z1 J
   push    eax
8 J( b: H5 y" E6 \1 F) d   call    KERNEL32!_lopen# e! i' j6 U" W% r2 Y
   inc     eax; ]0 h. P* ?4 x$ ^
   jz      006505ae                  ; not detected
; N9 _& D" Q4 x1 G) i) b2 e: b1 ]1 G$ D
; Q/ C0 X+ J3 Q; |7 \
__________________________________________________________________________
# `. U0 Q. L0 w) c1 \6 |9 K0 D# v/ E5 J1 T
Method 12" F* \% ?# r% y" H" n: o
=========' d- v+ T  {  E0 N: h3 s
/ P' Q. E, F6 F( ]
This trick is similar to int41h/4fh Debugger installation check (code 05
  n6 R6 N2 j1 i; S5 z! n4 [1 V9 c&amp; 06) but very limited because it's only available for Win95/98 (not NT): ?' q: @0 r4 [9 r1 T% ]
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 }9 Q, n7 S3 D' D
) [  p' C1 N/ @$ v
   push  0000004fh         ; function 4fh- `( V# K( w( M/ H, ^  J3 g
   push  002a002ah         ; high word specifies which VxD (VWIN32)
" a7 B" I9 H0 P! _                           ; low word specifies which service
" G) ^  B4 B& v! Q  F                             (VWIN32_Int41Dispatch)
# F/ G6 k- k1 F- S6 S   call  Kernel32!ORD_001  ; VxdCall, M0 y' j. ~0 [9 G8 }  U. S: p
   cmp   ax, 0f386h        ; magic number returned by system debuggers5 k) S6 j. _; H, ?! J5 L! {4 i$ t3 d4 m
   jz    SoftICE_detected
0 j7 S7 s9 b" [" k# ]6 \* ^# y+ I
Here again, several ways to detect it:
& D" k1 [' m3 h; f' r3 v. F- t% a: o0 m" [
    BPINT 41 if ax==4f7 y2 Q/ s$ N% W  N9 Q. J1 t

, A8 c: A3 C5 Q- t+ }/ E9 ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one! t7 |7 P: ^2 }" p
' a; a7 q3 q( K5 m- U% J; |6 o
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; z+ v0 P8 I% h" q7 t$ L& x, X1 Z$ k* p4 _7 u. G
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
3 Y5 p* E+ s$ O) R2 z+ O! [4 N" y/ t9 r3 a
__________________________________________________________________________! ]& F, u' o7 x5 T

& w# Y2 J$ H4 b" ], uMethod 139 S1 y+ u  S+ x7 w" A* A. I+ }! R
=========0 o, F+ q" ~  d  \) A! d& i) B8 F

# |% |8 |' g1 M& k2 a! r* BNot a real method of detection, but a good way to know if SoftICE is& |! I$ v' P0 b5 ]6 ?
installed on a computer and to locate its installation directory.8 R5 ^3 W# H2 t& V9 u( y+ Y& e
It is used by few softs which access the following registry keys (usually #2) :" u9 A% \/ @  n, U' p) p
( I6 k2 Z2 i$ B
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 F1 [) b4 {  P\Uninstall\SoftICE
' K% X7 k: W* W0 Y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 b$ H% d5 o2 g5 L# r2 S8 f-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 `- N( `! g( d2 {' I9 v
\App Paths\Loader32.Exe
% J8 I4 Y8 k, s1 U4 k, P5 e/ v2 B- ?7 D( P) z' m, R. e* h

/ m6 R& G: ]% W( C4 j; |7 u- `" v1 NNote that some nasty apps could then erase all files from SoftICE directory2 o3 ^3 n/ ~9 ?  N
(I faced that once :-(! b! G2 `4 j9 ^9 `" n* J$ z- D( a
2 v6 I1 o5 B7 v  S! _* D& C
Useful breakpoint to detect it:
# |7 r7 }9 }7 x  U2 F7 s% S. e8 R% M
% {3 U3 T6 E3 @* f  j9 D     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 ]8 g5 u2 G7 c0 K' d6 M; ?; _# `: U
) k+ ?1 S2 i1 R. b; W( T__________________________________________________________________________8 `& d, b* y* S' W$ Q

, {: F+ b* E4 v) H- A
. e  F) w7 ^$ |( F: [* kMethod 14 : f5 p5 |  r# e7 p
=========* d4 Q! ^8 z' {5 s  J
, Z# z" W" s0 J! b" ]
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 B% \8 B0 B) }: }4 D/ Z  J
is to determines whether a debugger is running on your system (ring0 only).
8 D% \: q" a) t% k8 f
* h/ T8 x6 ]4 |- |3 c   VMMCall Test_Debug_Installed; h8 {$ O  j# p4 v+ F9 s6 o% y
   je      not_installed
, G4 R! L7 g; m1 D7 \$ W% a6 R  s, ]9 ?/ X# W! U; o0 \
This service just checks a flag.2 ]1 {$ E6 G  Q- i; n) f3 P
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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