About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 n" z( ?! I6 d4 J& j<TBODY>, O* ]$ H8 k" H  ~: N; X
<TR>
! B) n% ]& n3 s) E( B2 M/ V1 z<TD><PRE>Method 01 " ~4 f  k: u: |& L1 u. K" A. f
=========  O2 Y+ V' Y/ K5 p+ k- O0 o9 I

, F! X8 D5 ?& T1 \. c, RThis method of detection of SoftICE (as well as the following one) is4 Q4 _- r) }1 d" E
used by the majority of packers/encryptors found on Internet.$ f9 S9 D) {$ {% o( d& i
It seeks the signature of BoundsChecker in SoftICE
( g0 c5 S0 A) M" |0 s) Z* R0 N! W9 `
    mov     ebp, 04243484Bh        ; 'BCHK'
  M7 _5 a8 m( ~$ \8 M    mov     ax, 04h7 N; ]3 V. _* o
    int     3      
4 K' N' k% G; b  H' z, \    cmp     al,4
0 j, A5 V' `+ l    jnz     SoftICE_Detected
8 O! X6 t0 m3 P3 M' s- t' `8 t1 f
___________________________________________________________________________
9 V) Y" l. t/ C/ r) B
' |) n4 Z. `$ }+ uMethod 021 L9 n# N- `* H1 O  s) O' _% u
=========
7 o& |8 w4 W  {* K0 r6 a/ v/ k& u9 Y* J2 @
Still a method very much used (perhaps the most frequent one).  It is used
, P; b; I4 r% {2 D* L2 ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 P3 S9 e8 ]: W# r+ v7 _. |
or execute SoftICE commands...
. b) h2 C% E( L; C0 V% pIt is also used to crash SoftICE and to force it to execute any commands- m" k( \9 ?& l% ^
(HBOOT...) :-((  
2 x. |7 C( f7 }, h% Z
4 h3 r( p* p$ h* y* qHere is a quick description:( r; J) K$ I" T  y; v
-AX = 0910h   (Display string in SIce windows)3 |1 h/ `* Y: @' m
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! ~0 X! ?; \! s0 d-AX = 0912h   (Get breakpoint infos)
$ T$ ]- U9 p, {9 u6 i9 ~7 C# Z-AX = 0913h   (Set Sice breakpoints)
0 b4 q2 g6 {! T9 N-AX = 0914h   (Remove SIce breakoints)
3 O2 ]& L8 e! L
& D. }7 C$ T: N0 w( l; t# gEach time you'll meet this trick, you'll see:
! W, T( U& H& `( G. y& h-SI = 4647h
& W/ V$ ~, N7 a9 p0 I: W$ ~-DI = 4A4Dh& O; h& t, T! \  Y  ?5 U! }
Which are the 'magic values' used by SoftIce.
1 r" u  N+ t$ ~) _+ t0 F: u" l2 IFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
( [+ j+ k3 ^# Y+ _+ H' ]
1 d7 s; S! F: J! u6 g1 N; o' y: AHere is one example from the file "Haspinst.exe" which is the dongle HASP
; f: }0 P  @/ N( vEnvelope utility use to protect DOS applications:
" E8 x" T; b0 R* k' s7 s- v  V) S& `2 S3 p# @0 Q4 \
& L+ C; D& P* }! T7 m5 O0 n3 V& E+ k
4C19:0095   MOV    AX,0911  ; execute command.
9 V/ a5 m- ~9 F4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 A# l( ^! [  W
4C19:009A   MOV    SI,4647  ; 1st magic value.
6 c2 ~9 w4 X- k: ~4C19:009D   MOV    DI,4A4D  ; 2nd magic value.# J  [  u( l7 a6 b
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& k' f- E6 s9 [* j, w' i! \& x$ b4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ h: D" P% A% C& c( v/ J2 Y# @8 H
4C19:00A4   INC    CX
* |) ]$ F' u  V0 R* l) M: j4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 e7 }% I3 l7 G4C19:00A8   JB     0095     ; 6 different commands.
8 j- S! ]- i& w7 X0 y% M4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& V( M+ v* U/ `" w' |4 N8 W! t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 R+ S: o1 T9 X! N

8 P) ?" V6 p, X3 i, F$ r5 ?The program will execute 6 different SIce commands located at ds:dx, which. N; f) R8 Y" l5 W
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 M7 D% p5 b% \" f) Q" H) R  ]

+ |8 T& G8 a4 |  |8 K" ]* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.. ]3 s4 L" B8 R3 F5 p- F5 U
___________________________________________________________________________- s8 D4 a& n; d/ A/ @, J
( U" V" b! M1 a
2 ?: v0 A! O: w* w. E
Method 03
6 o7 i, v$ r, C: F* w- o+ a! n7 n; T=========
' q0 d; ?' T* Z" J+ I1 e
& u  H6 ^4 I, F6 l' ULess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  v- U2 P6 E( A7 N# n# Z, T6 U(API Get entry point)& |5 O: S% {% x- j* Y2 G4 j( O
        . C% ]* L) t& Q# m& ^

3 }! j5 ^/ N) \6 O2 d0 h  T6 |    xor     di,di* E3 g. c7 H0 v
    mov     es,di
1 K' e4 w9 @3 J  h    mov     ax, 1684h      
& S. {+ L8 U* b$ c5 q! V    mov     bx, 0202h       ; VxD ID of winice9 \* R" P6 e4 a' o
    int     2Fh- N# i% o7 P! f7 Q- q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# E. N; S4 p. h5 D! Z" `9 ?    add     ax, di. h9 a$ |. [' Z4 |2 @" m( r
    test    ax,ax
6 |& A/ y; Y& \! u    jnz     SoftICE_Detected
0 O. Y( Z: Y! }5 w
- V4 R) H# ^' e% I' ^+ k  y% W___________________________________________________________________________
$ l" t& W$ h) Y' I* {/ x
% K+ i6 O8 d. ]: zMethod 04) G: \( B  {' t5 U* U% _
=========
! @6 w1 T1 K) B% k* p4 G& Q9 s, d4 Z, T! M+ J7 ?& w/ [* n$ L3 h6 c
Method identical to the preceding one except that it seeks the ID of SoftICE+ O2 X! [  {( F7 T7 B- X: \
GFX VxD.5 ^6 G. {( i8 [9 z7 `2 N' m( _1 z
- @9 Q" g, r& S
    xor     di,di
& K, y' ~  Y5 e# O& X. [3 K# p; X( l    mov     es,di
. o" [4 Z6 J) o5 r) L1 O" ]2 M    mov     ax, 1684h      
$ _1 j0 n5 R" n7 R: \1 |    mov     bx, 7a5Fh       ; VxD ID of SIWVID
' |% r  h! n5 ]0 m1 X7 \9 N4 p    int     2fh
1 G# }: i0 l, E* J6 \    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 R6 N3 j  F7 l' p: ]0 v( D    add     ax, di; R: q# A- N4 M8 q" r
    test    ax,ax  R5 e5 [7 _6 z, A: p2 V
    jnz     SoftICE_Detected
' B3 k9 e) _0 D
" V. h+ k7 o5 w/ q/ O" ?__________________________________________________________________________
, ]$ R% |3 O8 c% ^: J" m' z
: K  w2 [2 L! W* o. B. S5 Z# e
0 l5 |1 h) y& P4 L# N. kMethod 05
3 ~# T8 g8 H0 L- z: v+ e) l8 _=========( V! V. F8 B  @. x, N2 C
$ e* f( F% B( z6 o  E
Method seeking the 'magic number' 0F386h returned (in ax) by all system% Z1 @+ c9 g5 F1 h9 S7 n
debugger. It calls the int 41h, function 4Fh.
, O8 A  _: @) D* r% bThere are several alternatives.  
+ N, g* _. S# F* {$ F5 i/ F/ L8 j* [8 Y  o1 W" ^% X. R4 R
The following one is the simplest:1 n) a1 p7 v6 P5 T2 B  `1 \+ B. u

- n+ }+ A( P. p, @4 s) W8 j    mov     ax,4fh
2 C' ?- G, [5 w3 y- k" ?  e4 C    int     41h
# e1 Y. F8 u5 S- q; y( I% H( n2 P    cmp     ax, 0F386* V- s% s& A, {; G8 J! T
    jz      SoftICE_detected
4 e/ e, m5 g+ W. G# u( E+ O
) E5 G+ X( X! f  i. T* m" q0 D# M4 y
Next method as well as the following one are 2 examples from Stone's - X# K! W7 i( p0 g2 i$ e3 F6 j% t
"stn-wid.zip" (www.cracking.net):+ r# h* ~) l6 ]9 `, a4 ?

* k# u  [% ?; p4 C" F4 N, K    mov     bx, cs
- I+ {- g% D# c! K& x    lea     dx, int41handler2
( ]2 Z: \. \, N5 F' u    xchg    dx, es:[41h*4]: |' L0 U& i8 e2 `2 k. z' f! T
    xchg    bx, es:[41h*4+2]
# C5 U% Y- O% u; `    mov     ax,4fh+ U- C" X) \: X+ j, m' V
    int     41h3 x' R4 O5 X' ~" }* s' T4 j6 c* ~
    xchg    dx, es:[41h*4]
$ C7 ~# \' N" X$ h8 B    xchg    bx, es:[41h*4+2]
' h( w; ^/ P; X( `: E+ d, x1 q    cmp     ax, 0f386h
8 |! F0 ?/ A8 a+ a    jz      SoftICE_detected
% t6 c  t' U# e# s3 V  x( N
! L0 K6 f# Z  w1 v% Z2 Dint41handler2 PROC# q! |' s- c' L# C! p9 z' r" c
    iret' Q+ u1 O5 s& ?$ C4 b1 n5 M- C
int41handler2 ENDP# ]+ `( j8 d8 o- ~+ l) l' p3 n9 B

# v( N% F1 d4 A0 I5 O% `' T
2 |2 `8 ~- t* N9 p7 E$ A: E_________________________________________________________________________+ ~# r( N' Q' d6 s

  K; d* L6 ?; R- I- B4 \& B5 B# [  j
Method 06
- l* B) n% u# Q4 `=========8 U' `- ]  i- j& R
% d" n! c- \5 p4 z
$ t  M5 k- U: n3 A) b/ _
2nd method similar to the preceding one but more difficult to detect:6 S& }* f3 e$ F7 |1 v" q7 O7 e
  H1 ^6 g! a5 k% H) V

7 ?8 v$ k' J! P" Q- v9 aint41handler PROC  N9 s' a: [5 N* u
    mov     cl,al
; L  W, [# q7 ^  J5 i2 l2 [- B    iret: P0 S1 H/ s# O& b
int41handler ENDP
+ k6 P; q! \" ^5 V+ e& V9 j) A5 i  N6 _

4 r% k5 E/ H# u    xor     ax,ax  }) Y6 F. [# ?, _; n
    mov     es,ax
( [. x1 y1 j% q$ g6 B    mov     bx, cs0 l/ n. N, x) _: k! i  H0 E
    lea     dx, int41handler
" s; {5 t" M* P! i5 T8 A    xchg    dx, es:[41h*4]1 R: {: p9 T' O
    xchg    bx, es:[41h*4+2]; V7 Y1 U! }1 n) S0 ~$ ?
    in      al, 40h
$ i! C: X  T( d7 k- [    xor     cx,cx
- b7 ^3 Q8 y# ?9 K7 Y/ b    int     41h$ q+ r$ U% k+ \9 C# L( @3 j( m
    xchg    dx, es:[41h*4]
! V$ {6 `2 B/ @. u    xchg    bx, es:[41h*4+2]
* P, [/ ?% U! }7 L( W% \- [2 L    cmp     cl,al
/ C5 X9 M5 M6 e1 K" ^    jnz     SoftICE_detected
3 S0 `( R; V# Y
: q! K4 N! S. B_________________________________________________________________________$ O/ f* L1 Y/ P. |: F

6 q  q) D; j  I6 w0 v+ a5 h5 mMethod 077 ]# z& l- o6 S$ k6 \9 X7 ~% U
=========
& A3 m. N9 c& R; @! L/ A3 ~5 L7 Y& {0 U( U- }$ Y+ I: V& l- k  `9 B
Method of detection of the WinICE handler in the int68h (V86)
1 j' G$ Q8 L3 n# y) Q
/ Q: U. j* d$ d4 h% t! [3 b    mov     ah,43h
% }% c  {4 ~- V4 `4 S    int     68h6 _( m( a7 C# j# ^6 ^2 n
    cmp     ax,0F386h2 N& |  j4 r6 Y; k
    jz      SoftICE_Detected
0 m0 F5 a  p6 y3 U# Q
' y6 D2 V! k7 B, S+ V( p, F; ]) q, o4 Q" S5 C
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 c) h& X7 s( L$ e0 @0 a! J' l
   app like this:% A) C; c# B, |9 ~! ^" v' O& f

( w2 w$ [' }3 b4 b# V   BPX exec_int if ax==68
& m6 r& W# Z$ s% C: E   (function called is located at byte ptr [ebp+1Dh] and client eip is* N" j9 b1 |) Q; P' a4 c4 X& k
   located at [ebp+48h] for 32Bit apps)
6 Z# T0 j, `2 w! f__________________________________________________________________________
5 p, ]# f" O+ Q9 x/ _$ {
, W" k$ Z1 h4 Z8 m+ ]8 v! w2 t2 W1 b, l7 ^2 ~+ E$ R- S
Method 08
7 w4 }+ i2 g9 Q; C7 l& G, @/ c/ @- ?=========
4 S6 ?. u" \5 l  ]* {  A
2 J2 U4 h3 m* W- {; OIt is not a method of detection of SoftICE but a possibility to crash the& c- V, J6 `& I: u6 A
system by intercepting int 01h and int 03h and redirecting them to another( u6 ?' g/ L, T2 H
routine.
/ J7 \( \: d4 iIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- q4 }# W% F3 m, r* Q% bto the new routine to execute (hangs computer...)
# H* F/ t: Q+ e8 ~' O- j3 Z3 T* M5 w
    mov     ah, 25h/ _4 Z5 C7 \) J  q+ g( A; U
    mov     al, Int_Number (01h or 03h)
3 W! C  e# D" w    mov     dx, offset New_Int_Routine* f7 s5 p0 G9 a: P
    int     21h/ l: M9 \/ E4 {" m4 S8 E
" d* d. \8 {0 ?- R; S
__________________________________________________________________________
# }2 ?. c0 k9 G) ?8 u" T: d* A' q$ X9 O2 t' T4 Y  K
Method 09
8 a8 s* J2 \; i: n=========3 f' o* ^- r/ P
8 r3 r# {$ T  R. e. p/ C
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only; K) m4 ]0 e9 Q3 `2 s, g
performed in ring0 (VxD or a ring3 app using the VxdCall).6 w! l8 O4 ]! N- M) V4 ^1 F
The Get_DDB service is used to determine whether or not a VxD is installed
& r# |# }1 z+ P) Mfor the specified device and returns a Device Description Block (in ecx) for8 h4 h6 w- e6 }$ L, h' z" D3 w
that device if it is installed.
: y( p) h: f: P+ f3 V
0 K# M" f4 U3 @9 ^   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 u& |# H- k  Q+ T' l9 {
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): a) M1 W& Y) V/ Z
   VMMCall Get_DDB# M9 F0 a9 {2 t1 A4 {7 k% J) q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 j  b9 u7 W; S

& ^" L' d2 {! [" [4 ?Note as well that you can easily detect this method with SoftICE:
! q- y2 |! H( Z4 j2 P   bpx Get_DDB if ax==0202 || ax==7a5fh. B! C# u' d6 u! {

% d$ I. ^1 O, e! m5 D8 e% ?6 y__________________________________________________________________________
) B/ ]2 X: Z9 s4 F1 W; Q% V1 p/ b( g5 p4 K) T( z; |- P  ~9 n
Method 10# V* U; Z% A6 m$ k4 O+ Z( v
=========
- d) L3 R+ o; z9 C% e. {
0 i1 H' d' a+ V7 V8 h7 c# R=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
; {; ^& L! x# b. t; U9 o4 p  SoftICE while the option is enable!!
! b* P8 w  o4 x
9 F2 _  Q2 \8 b2 rThis trick is very efficient:6 x% C5 f4 \6 P1 R/ i
by checking the Debug Registers, you can detect if SoftICE is loaded" C( Q8 W+ b4 g0 t8 l
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( B' T- \) B$ k, s8 K% p
there are some memory breakpoints set (dr0 to dr3) simply by reading their9 S8 W. w& Z4 i# U9 o8 n+ B
value (in ring0 only). Values can be manipulated and or changed as well
/ e6 m8 ^6 x, V& y) e9 [+ e(clearing BPMs for instance)
5 ?8 ~9 y* c9 H. @) a5 x! W
5 u$ Q$ o1 A( k. Z8 |& `9 l7 N) j__________________________________________________________________________
! y8 v% B: \1 x7 A2 H8 F0 @: l% d0 T6 G4 ~) ~* Z
Method 11
/ q& g% n# Q% w# U4 G=========5 d' V0 m1 t; u. A  S9 k

. r! a' ~, z' n9 Q( bThis method is most known as 'MeltICE' because it has been freely distributed
% R, v4 ]) @9 b4 Xvia www.winfiles.com. However it was first used by NuMega people to allow7 F; f5 B1 R/ h  X' y
Symbol Loader to check if SoftICE was active or not (the code is located1 v& u3 {5 S: _  F$ ?
inside nmtrans.dll).: Z8 X% Q3 Q5 w, H+ E
; D; K* W( E0 j0 m4 F
The way it works is very simple:6 @# O% j4 _3 x/ J. [( o
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; Q/ B% O8 v1 X; yWinNT) with the CreateFileA API.
, I5 a# F6 A- V2 H. h* W( c4 w  H/ N. F- G' s$ q# f0 L% o
Here is a sample (checking for 'SICE'):& ?5 g$ L5 n$ b! \
* V* X. q5 q* @; V2 o/ p* S
BOOL IsSoftIce95Loaded()
* X: ?9 ]& h) N{
" C6 ^0 j- s8 q+ y: j2 t; z( V, @/ @) q   HANDLE hFile;  
* X9 E5 ~5 h& z8 w( O" g" [   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,9 ^( T1 H* c. ~! A0 O
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 |6 ?& U) k# U; f# N9 I                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' R' x7 \; W& v5 A
   if( hFile != INVALID_HANDLE_VALUE )  B8 J1 @' T6 J+ s
   {7 h' }7 E9 w; Q/ h
      CloseHandle(hFile);  ^% X+ }/ ^0 d- Y$ _1 v
      return TRUE;, Z8 y: G' X6 _1 d/ ~0 |$ U
   }- A4 F  X& e9 x# a8 y
   return FALSE;
+ L1 `- ?: f6 e8 r) x- D}4 ?- s. Q3 o8 ?/ H' _+ E* f
/ e+ G% u! M& N" I" X  C
Although this trick calls the CreateFileA function, don't even expect to be
- r# P9 U6 A$ z% u# p6 E$ uable to intercept it by installing a IFS hook: it will not work, no way!9 U8 D- a$ V6 g; E  Y+ s8 w
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
! u0 Y$ [: J, Q0 Xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
1 a# Y% E. _! d/ S1 \and then browse the DDB list until it find the VxD and its DDB_Control_Proc6 b  Q5 W7 w  L# N5 A" H
field.# H1 }3 D% k/ Y7 ~" c- g
In fact, its purpose is not to load/unload VxDs but only to send a
% O% G5 ?8 F2 C! V" _9 OW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
* f* H! k. I1 N+ O! Rto the VxD Control_Dispatch proc (how the hell a shareware soft could try
  V7 Q0 \, {8 j  I  ^; r1 Rto load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ u9 i3 P- z( O0 ^. ~If the VxD is loaded, it will always clear eax and the Carry flag to allow  z; N9 B1 Z2 h
its handle to be opened and then, will be detected.
- }2 @8 Y& n* m: |' ~You can check that simply by hooking Winice.exe control proc entry point6 F1 _2 p9 `8 m1 d4 j
while running MeltICE.
2 p7 d5 Z' v4 N  m8 B/ _2 r: b! o7 C; p+ @, Q$ A* r6 e% U. [/ |
& L; T8 `' e8 }3 w2 a" w& G
  00401067:  push      00402025    ; \\.\SICE
  z8 {5 P0 h7 r2 C/ U+ S; v  0040106C:  call      CreateFileA: M/ }! N/ F2 V; Z. M3 e4 n
  00401071:  cmp       eax,-001
, X) k4 H( H" }  00401074:  je        004010910 w0 h& D, i, J3 l$ O( Q

7 H$ ^) ~' M/ ]. m, h! E* `1 @, O% H0 o/ H$ [9 h5 h  E" F: \
There could be hundreds of BPX you could use to detect this trick.
# \1 q+ j8 L; F$ ?-The most classical one is:' s  D( _- f% R( x8 Z# T' y7 |9 K
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
' D5 h# g% P: r7 O% V    *(esp-&gt;4+4)=='NTIC'
4 A5 j( U, v& e8 [* }- @5 h
) m7 M! }: L! E+ F-The most exotic ones (could be very slooooow :-() E$ R" y" M5 J
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' Z$ ?0 d/ Y- N
     ;will break 3 times :-(
6 v& I9 |3 Y9 x, [# E2 L1 e
$ j3 J8 H  x  X, r( V3 Y-or (a bit) faster: / x3 @3 s8 T! V2 G3 D# x
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 M: ~4 W, X" y. i: ?2 a+ E1 D% r' d
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 J  i) B$ H. p) K- ?& h# w     ;will break 3 times :-(- ?; H- T2 C! j# i3 \

/ b0 u  m. L* N* v# _; j-Much faster:
* S. U6 p) Y& x0 d7 e- a   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
) b% w' ~+ q, {9 I! @; _
8 o8 R+ j& R5 V, q$ B6 VNote also that some programs (like AZPR3.00) use de old 16-bit _lopen) w. ~9 R6 b. B) `: i, m
function to do the same job:
) G% M5 g, i" K& W: a. s3 w, V) k( I/ f1 P* Y! v3 d
   push    00                        ; OF_READ
+ Z. K- ]3 ]) W   mov     eax,[00656634]            ; '\\.\SICE',0, s1 H7 k) z9 j
   push    eax
) b/ @+ t. ~5 F6 ]) _   call    KERNEL32!_lopen
8 c% R/ t0 m8 z( }# N   inc     eax1 c. s& z1 L9 Q+ @
   jnz     00650589                  ; detected) a- A/ O4 s6 C: D/ b
   push    00                        ; OF_READ
+ T' d; z6 z: p; i0 m3 b   mov     eax,[00656638]            ; '\\.\SICE'8 T) C( z4 `+ V- E
   push    eax1 V7 u9 D3 g: o$ a5 x* f7 A! \
   call    KERNEL32!_lopen1 U7 [) \1 G1 b
   inc     eax
: ^' P: A+ ]4 C+ ^   jz      006505ae                  ; not detected
1 G- I+ Q6 \% s9 N( F$ G
+ A) V& e1 e. v) j# i! ]% y, [% S  ]4 k8 e) U8 |
__________________________________________________________________________
8 r, u1 C4 G1 q! T( I3 i" ?. [8 W* y( E6 R+ ^
Method 12
; y5 I& q. c% B# H6 j1 v=========
; L/ R9 Q9 K" B
7 Y$ o& w6 W7 J* Y' X% R+ S! l8 L) RThis trick is similar to int41h/4fh Debugger installation check (code 053 V0 x$ e/ p: P3 k
&amp; 06) but very limited because it's only available for Win95/98 (not NT)0 Z* W( i5 X% X9 l+ e/ ?
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 g- S9 s# O" ]& m! x, ?& u3 ]& }' Q) r
   push  0000004fh         ; function 4fh1 n' C9 p# i  E/ ^9 B  }3 @( E3 ]
   push  002a002ah         ; high word specifies which VxD (VWIN32)
9 {# b* B  N0 x2 h. J' f                           ; low word specifies which service& J: V4 M- t! z, i. i- M
                             (VWIN32_Int41Dispatch)8 C6 D2 E% V9 p
   call  Kernel32!ORD_001  ; VxdCall3 f3 D+ Q8 ?, A! n
   cmp   ax, 0f386h        ; magic number returned by system debuggers
/ E( Q- X1 \! n# `" A   jz    SoftICE_detected
, o( b5 k% |5 `* [: A  s# X6 `) Z( Z* D  a& X* v/ r  L: e# C4 {! ^# o
Here again, several ways to detect it:+ _2 I8 v# {9 v1 n$ S/ J

, V% }. Z5 `+ p# h) F    BPINT 41 if ax==4f
  k$ ^; H6 y% j1 o/ Q
1 ^' Q7 y+ H. N! D8 P1 ]    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
$ J9 Z$ O" _" @4 U  O3 e
3 {* A& i, a# H7 ^    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 v' I, m5 X% v2 ^/ m( t, |6 e0 G
7 [: o2 E# W! L: v% r! E( s
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 d. J- G, k7 A% `
  L) j8 c' F( g$ v
__________________________________________________________________________
, S6 R1 O/ [0 a* q+ w* `, u; j2 ^% e4 b" u9 _) A4 p4 p( W4 \: _) E2 f
Method 13
9 }! c" K  I$ [* X7 t- O' A=========* N8 H' z: ^% R9 Q
: C9 Z0 v# w- j* N# L  [
Not a real method of detection, but a good way to know if SoftICE is" o- w6 L- ~$ ~: s
installed on a computer and to locate its installation directory.3 W6 ~/ E: Z( S- v/ W# X
It is used by few softs which access the following registry keys (usually #2) :5 x9 M8 T; ^, e. d3 i. Q

8 b8 U6 ^& {$ t. X3 \-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 \8 G4 [/ H; r/ q8 K\Uninstall\SoftICE! h5 ~# P3 |. W9 X; f" D
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
8 T8 E. `5 g$ s0 A- ]& P; v-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 [' ?+ U0 c+ C/ o) c! P2 e
\App Paths\Loader32.Exe9 b% P/ o8 p# e$ p
# J( Z7 w+ q" G& c: w& m" j

& b. L+ U2 M8 S7 w! J5 _8 m& J9 UNote that some nasty apps could then erase all files from SoftICE directory
0 |! A3 T' k; r(I faced that once :-(
, \6 U, X7 o7 ^3 I2 H: \) ]7 ]7 L. Q6 \- v* P( Y6 S& e
Useful breakpoint to detect it:
7 ]% J& D6 b: i* R2 s8 a, [0 Y$ G6 A( V3 {
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. ^4 X% y* ]: T" j) j, @
8 Y( `* s7 B4 f% Y$ ]6 s7 u
__________________________________________________________________________" S; e% M8 W. U2 @8 D! M

( S. `, U9 Y: `7 X0 K* V8 x* e% K7 U
Method 14 ' y7 u5 J7 h4 l/ ]6 Q! M9 S( [* l. ]
=========; i! h5 T& D3 @

2 i+ B5 _* K2 g( kA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, h  x7 J  C! F) f3 t$ Y5 u6 [6 d
is to determines whether a debugger is running on your system (ring0 only).
6 Q$ {- D4 S2 w: V! G8 f" \/ x& j& r0 C7 r8 \9 A
   VMMCall Test_Debug_Installed
: n+ @- X6 d, R" r   je      not_installed- y9 t! u$ c7 F4 Z$ K; {

4 {( C  h+ J9 o' j0 Q, tThis service just checks a flag.6 D7 \4 e  Q: }. j
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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