About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 E" `5 [9 |( P<TBODY>
6 J  J: k) X4 c6 e3 q<TR>
1 {7 a( K, s( n- [1 n- E<TD><PRE>Method 01 3 [! N; R1 X9 ^$ `1 _2 U. v. |3 j; I
=========' L( u' |: A5 T4 K. S
- q0 [5 b2 j+ X) b4 j
This method of detection of SoftICE (as well as the following one) is/ p5 M" v1 n4 p& o' C
used by the majority of packers/encryptors found on Internet.
  w% \# C) w$ B+ R( ?9 q* u! o* AIt seeks the signature of BoundsChecker in SoftICE! ~" T3 P1 i) a- h4 L
- \: x" x- F2 m. ]/ U7 K2 ~8 Y
    mov     ebp, 04243484Bh        ; 'BCHK'3 I7 r( q& M! B: B/ [
    mov     ax, 04h' T% f( w3 p4 R8 g
    int     3       5 H( y% g, ]% I3 a2 s
    cmp     al,4) {) i6 Y" ^6 _/ K  a
    jnz     SoftICE_Detected
" D% t  M4 g( ^* @0 C6 T- ]
/ i+ w; y* Q6 T/ Y* y___________________________________________________________________________! |% l( E7 e( v' |7 b
4 ~1 B0 F" D  N
Method 02
' y. ]- {7 }% U# m=========5 Q: K! a# X9 [- }0 \  P2 x5 `2 k

: @) X; I1 B* o  Y, l" N6 AStill a method very much used (perhaps the most frequent one).  It is used7 a8 _% R' Y8 T/ Y9 n
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# B1 f- R% h2 H+ G& P! v0 [or execute SoftICE commands...5 Q8 r( }% a% Q- Z5 |0 Q. ~, m6 t+ F
It is also used to crash SoftICE and to force it to execute any commands7 k2 \. N# l) a  f3 l+ v" G( k
(HBOOT...) :-((  
# \, k1 K* Q+ ~# Y" I& J0 N, K! T' V( j% o. l4 `, A
Here is a quick description:
9 e# k! k0 h) Z-AX = 0910h   (Display string in SIce windows)
/ s2 z6 K; y- `1 o* u4 s-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 M, I1 O/ x" B# w-AX = 0912h   (Get breakpoint infos)3 {+ h. v% s  |
-AX = 0913h   (Set Sice breakpoints)
5 C! J, u. P% w2 w-AX = 0914h   (Remove SIce breakoints)
% F+ z3 f! @4 u1 _. J0 F
5 m$ a- \; C- ^Each time you'll meet this trick, you'll see:* i, w  p" C9 J& d( t
-SI = 4647h
7 ~7 ?) j3 U( s$ p-DI = 4A4Dh" I# e1 h3 `  B2 [& o# A$ R
Which are the 'magic values' used by SoftIce.# r% L$ T6 T: H! H; K) Z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.( O' Z( V& j8 L  k# j
: F" U& z) @, a1 }0 A* u$ k
Here is one example from the file "Haspinst.exe" which is the dongle HASP
) h$ }8 z2 ?- S) _Envelope utility use to protect DOS applications:  U0 R6 \5 c# V4 k! d" B
! v% {5 m6 H) `- B6 u% F
/ u) q& v3 l5 D7 Y
4C19:0095   MOV    AX,0911  ; execute command.
* j2 e$ L8 p* a: F4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 J5 {* p% G8 y. D. Z
4C19:009A   MOV    SI,4647  ; 1st magic value., g4 @, C5 R7 i& j* S  N
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! n5 a/ F3 ~/ W- n0 U" u, J/ Z4 R
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
$ ]/ [* P* q4 S+ e: e4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& J" Z# u2 V6 n4 S2 Z4 @+ p4C19:00A4   INC    CX, n8 W- j7 d/ {# R8 d
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; Y8 O1 V+ D: [( r- M4 ~7 m
4C19:00A8   JB     0095     ; 6 different commands.# I4 J0 Y# g. E7 c2 D. V1 d0 c2 V
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
" P9 B% Q' i8 t" ~. F# }) f( Y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)$ o* _9 s; F3 G
2 ^: w! F* Q1 Q0 M. g8 D; R
The program will execute 6 different SIce commands located at ds:dx, which5 ?. @6 f# a+ W1 X1 F
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.) c' m4 P" Q+ D4 ]5 _

, l% T# ^8 _# F+ R% z7 ~" ~: z, g* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& Z, ?% G* \' g; ~: {7 k0 ^___________________________________________________________________________
3 g/ u3 \% T* ~8 [( J$ C
1 r, m/ u; \7 ]. i! q- }' x; p8 D# R2 `, `; Y: A; d% w6 C
Method 030 o- K: D4 \/ R: E1 ~7 q" P* g0 |
=========$ {2 p9 y3 A5 R. z! _

+ s5 X, }8 n3 ^& o( ]Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' e3 ]& _8 O8 w  v" \(API Get entry point)' `" K  o- y2 G
        
2 S- R" c8 G1 e, O! x
* A& U# Y( F2 q8 @1 e    xor     di,di' f9 \( q3 C( D6 w$ Z
    mov     es,di
& S7 s9 w+ m5 s* W4 N& B    mov     ax, 1684h       $ V  W  Z1 ~0 ?% \% ~# d6 i6 @& N$ Q
    mov     bx, 0202h       ; VxD ID of winice
  i" W' i6 P7 L$ f- ~+ l' N" }; l6 [    int     2Fh/ L; q' Q9 F7 k/ X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" M: f: }% m/ L
    add     ax, di$ Q- F) E' ~: r7 l1 ~
    test    ax,ax# z% W" ~7 G! {! d* [* z
    jnz     SoftICE_Detected# @7 U# D8 m$ O/ U

5 w+ ]* d6 B, X5 s6 Q___________________________________________________________________________8 P/ X* }. C( f5 U7 l2 W
2 C1 C8 R' O& O0 {+ o( o9 s
Method 04
( M$ W" D0 E2 b: H=========
3 b+ z% \/ [& b  s7 e+ n4 i1 M# E, C
Method identical to the preceding one except that it seeks the ID of SoftICE) x3 M3 B; F& J8 y: X1 r  R/ s
GFX VxD.
0 W0 [- [! y7 N+ V
8 Z6 Z" g' V9 a! U0 `    xor     di,di! R% H$ j0 e- N# F/ r$ k3 _
    mov     es,di$ i; P8 t) C7 f) J; u$ }- C0 y# {% J
    mov     ax, 1684h      
; z% I0 G( T  M" g9 j    mov     bx, 7a5Fh       ; VxD ID of SIWVID  {! R$ q7 b4 Y  ^  U: Z
    int     2fh  j3 r2 F9 S0 G! u0 f+ D
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 T8 M: k/ [# r; X2 X2 [
    add     ax, di, Q% o) H5 K2 c+ p/ w' H
    test    ax,ax4 ?+ ~* j9 }5 ~$ r! d" D+ P; |: a
    jnz     SoftICE_Detected4 T5 l: x" Z# m. a% ~
2 g1 w0 v# a6 d9 w7 e( l
__________________________________________________________________________  A- a6 }  f7 X
- x8 h. A0 h  l4 Z1 `: V

& q! T; d5 U: U9 D* ^* W* fMethod 056 _- t% l+ G$ Q7 f6 x
=========9 q1 F, \! q1 o/ Q' ?/ d
# L1 [4 P/ G! d2 i+ D$ s
Method seeking the 'magic number' 0F386h returned (in ax) by all system( n6 j# J5 N+ d0 |/ r5 }5 C' o
debugger. It calls the int 41h, function 4Fh.1 s5 s; c6 u6 o
There are several alternatives.  
! V1 m, M6 d- r: _2 u% J# g$ O" V$ ^! h1 S
The following one is the simplest:# H# O; x# e5 W& R7 f

- f0 ~+ a- m" r9 {  F    mov     ax,4fh& @+ j  i9 D# F. m& e( N
    int     41h
; u; g* x3 H. U" i7 V    cmp     ax, 0F386
* P8 b7 }2 n" ~# v# M    jz      SoftICE_detected3 B( w: H# P* K- [' k1 B
2 C" r8 \$ c8 s5 |/ _) I* f
3 P9 C' T; b( Q# C
Next method as well as the following one are 2 examples from Stone's 7 [; `% o+ O: N, m2 n1 [2 `$ G5 e8 K
"stn-wid.zip" (www.cracking.net):* z1 L" x! Z( i3 h/ w) I* O2 a

- G: e6 ^* i3 H( p) i" I9 F, L    mov     bx, cs/ c8 V5 @) ?0 k
    lea     dx, int41handler2
9 ~, k6 X  [2 t* J    xchg    dx, es:[41h*4]
/ h) G6 s. `$ @, m/ [9 ?  J* |& r& j    xchg    bx, es:[41h*4+2]% k. B+ i( H5 [- Y
    mov     ax,4fh
8 U+ g2 Q3 V" G4 u" t    int     41h
# k2 F7 q! F; h- v    xchg    dx, es:[41h*4]" M1 g( g7 }5 H, w
    xchg    bx, es:[41h*4+2]3 @3 _6 A0 t6 E$ t+ D2 A- r1 ]
    cmp     ax, 0f386h
# @% |/ @& V. y5 ~6 ?3 i" |& P    jz      SoftICE_detected: H7 g6 T9 [: O- a( W
8 I: C( {! N6 b- j
int41handler2 PROC
/ g' r- O( J6 o6 @2 k+ J    iret. ?4 R  O+ m! e( D1 e6 T
int41handler2 ENDP
2 h" ]5 a+ V8 O# T" Y0 X' c
8 I$ _& a" O0 \2 L; ]* t" n) |5 |/ ?+ D/ ^! O4 u% ?
_________________________________________________________________________
2 \( d4 C* W; w5 e- c3 t. u) n0 c4 y+ [& a6 ]  G
2 F1 |6 a6 w, P
Method 06# S9 S( a, n$ `; Y! @5 I" o6 m0 @
=========
" J: O/ ?" \" I9 A9 C1 Z% Q# `; N/ d+ R# S( i
7 ]! \- L# ]& M( K
2nd method similar to the preceding one but more difficult to detect:5 e3 O; k! j0 _2 K: F% }' X

2 A( R  U, i- a: W6 {4 S5 G
1 ~. O0 B% k; i4 m  F. L( yint41handler PROC
4 V) Q' l: c/ b. O6 L    mov     cl,al! g; B" Q5 K" d$ S0 o$ v/ [
    iret" \! u$ a3 ]8 e" d3 t+ d
int41handler ENDP7 z5 m) W+ z1 F6 E$ Z8 g
. g/ }1 N; T0 h, ?
& A' j; d: r0 j, Y
    xor     ax,ax
/ w7 m9 e! [# z8 q' }0 R6 W    mov     es,ax
3 n2 F7 [# z& }% J    mov     bx, cs, _7 M& v  Q$ O7 F$ H0 X5 o
    lea     dx, int41handler9 Y& ^* z! j3 ?; E
    xchg    dx, es:[41h*4]& M9 Z7 G( C6 K' C8 k. `6 B
    xchg    bx, es:[41h*4+2]
( x( o% k( q- T3 a/ j# c& y    in      al, 40h
+ E6 O- F, o8 {( _7 p8 |9 X    xor     cx,cx
$ h( n6 C4 G( S4 s    int     41h6 ?4 Z# v! \3 D6 c  G6 L- X
    xchg    dx, es:[41h*4]/ L: o2 h* k5 \
    xchg    bx, es:[41h*4+2]
8 o* E% P7 l8 d5 n    cmp     cl,al
+ K' u; \& v! l5 U7 V    jnz     SoftICE_detected6 g# b6 @; x, ]$ Q/ k% X
9 _$ }' _! f& x8 I# ]
_________________________________________________________________________$ p3 p- P0 o! B8 M
# n# `' V' f6 R5 e4 w6 p
Method 07/ ^' T5 ^  o: H9 [; E2 A
=========* w. q5 c( ~6 }1 k3 E% a
0 p& j" o( r' c: F* k
Method of detection of the WinICE handler in the int68h (V86)/ d* f" m3 U. b6 U
" Y/ _8 F0 W/ u% [
    mov     ah,43h6 L. S# N' F4 X, n, A
    int     68h
, h0 O5 c, y) s0 Q  s    cmp     ax,0F386h5 `* H3 G/ `# E3 h
    jz      SoftICE_Detected
5 [1 X* f7 j3 C' L  m( }1 X* q4 p0 F1 o  ]7 a( I' s- h2 [# B

7 Y6 C9 A$ o  D$ H=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ z* \; A# K$ l1 H
   app like this:% ~) d* d- Z: }0 N2 r9 e

( S0 _: |% r% Q) ^, r7 |   BPX exec_int if ax==68  q' n3 V, u& \9 u1 g6 V8 b7 t
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ q5 B# O9 e6 w7 V6 o- h) V' r   located at [ebp+48h] for 32Bit apps)9 M$ I. {% ^4 ~* ?* U
__________________________________________________________________________/ c% G1 m* o1 j
. ?" i; n! Q# z4 e7 ^3 t# ^- C& d
8 q, d; E6 d" O7 S1 ]; \
Method 08
! U7 L/ [( `. a: Q=========  S5 Q8 B6 U4 N2 ~4 Z5 y* d( ~4 u" V

) ]- T# R" v9 v. U% e5 fIt is not a method of detection of SoftICE but a possibility to crash the
2 }/ `4 x$ ?5 {! Z) isystem by intercepting int 01h and int 03h and redirecting them to another  I5 i( [% Z% I& s. |) v
routine.+ k& f- r0 P& V
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
& r0 o; a1 O5 [; mto the new routine to execute (hangs computer...), y& R# ~! x# a( M( L; z. j
0 T/ i3 q2 O, r1 u$ R% c. @
    mov     ah, 25h* L- w4 ]3 b; B; u
    mov     al, Int_Number (01h or 03h)/ f; F) W# M8 b" y9 K# n
    mov     dx, offset New_Int_Routine/ Q2 i7 w) N" y) V0 ]
    int     21h
1 [5 Z3 Y( T) b9 E' z% x- L( \6 C6 R* x2 w7 F1 c
__________________________________________________________________________  E- |0 Q. q: M) ?5 C
) d$ @5 r: \' w/ B* P
Method 09
* q  e# H& Q1 ^' }5 [=========/ a& p! T! g; K$ \

2 Z3 C; b" A7 K1 k) l1 ]0 `! c' H8 nThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only& I2 P- o+ Z8 e- s- f% r7 v( P
performed in ring0 (VxD or a ring3 app using the VxdCall)./ j/ W" ?7 p, j" F
The Get_DDB service is used to determine whether or not a VxD is installed+ d* `5 U1 T) e9 H
for the specified device and returns a Device Description Block (in ecx) for8 m: r4 a2 V2 a: S
that device if it is installed.4 F$ J! C$ a: E! }! M% m3 B
1 {- L; h. c# p; W! e/ m# x- h
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
8 R% B( {9 L# f   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 l9 \' J  k" ^. i3 Y- N, \, K4 a
   VMMCall Get_DDB
) h  B8 K% e7 N! D! p   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed+ r" ~9 j: U5 |: i# G
  Z5 r5 j( g: U( @- W
Note as well that you can easily detect this method with SoftICE:
3 M  d  I; J) n0 P" L! J   bpx Get_DDB if ax==0202 || ax==7a5fh
' C; R% a6 N% I2 [4 Q* _! i/ F' T
__________________________________________________________________________% r! v# S8 U! m& X$ L

' B+ _, `$ q3 S, ]$ Y1 j6 TMethod 109 h$ _" g. K+ N, i
=========: J: F% n/ \* g% P! T# a8 p% ]
5 O6 P* t* Y4 A  [
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with7 \& `7 B/ @3 _" ^
  SoftICE while the option is enable!!2 D7 V2 d3 o4 w$ m* B0 B, m# Y5 k

) ~: B9 N+ P5 Z* \" Y6 n3 n6 CThis trick is very efficient:
, Z- H- A! ~' G  Y2 L0 |by checking the Debug Registers, you can detect if SoftICE is loaded
/ ?: \8 _4 m. j& j7 I& M, W(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 `. F' L7 _. dthere are some memory breakpoints set (dr0 to dr3) simply by reading their1 }$ {/ R' F2 o, s8 |" J
value (in ring0 only). Values can be manipulated and or changed as well
0 `, l. T6 A! V4 |(clearing BPMs for instance)) a+ S- w1 O7 s) Y  Z) p5 b
4 I) J) O$ Y4 B0 o) S$ V5 U6 G
__________________________________________________________________________$ J- v+ P' i4 ]* P/ q

8 y8 P/ T' s1 i" h2 ~+ b( WMethod 115 {7 U1 m/ ?- L% @
=========) e) ?( o9 _( A9 v$ R

. k7 q( k2 ?% _This method is most known as 'MeltICE' because it has been freely distributed, t( D& a, X8 ~% S8 c1 R5 Y
via www.winfiles.com. However it was first used by NuMega people to allow
# @) x) V2 Z% u3 U1 }; XSymbol Loader to check if SoftICE was active or not (the code is located1 N8 m% q, B/ p9 m" R$ V# o
inside nmtrans.dll).
2 T: Y4 s: w& \8 ^, U7 h) w) g- M8 ], P6 }
The way it works is very simple:
7 F: I" s' Q) |" V' @It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; N7 s+ r6 T4 ?" C5 |/ {) A/ DWinNT) with the CreateFileA API./ P/ z2 J7 n1 P: }

$ G$ M/ n8 J( o2 l0 PHere is a sample (checking for 'SICE'):3 ]$ ]5 k7 ~& Q9 ]9 {

) w: y3 n2 u4 H! o) F/ vBOOL IsSoftIce95Loaded()
' N! N' K! C6 i- L& Q# m- k5 S- u0 ]{- G8 p8 Y$ \" h- h( u
   HANDLE hFile;  
* N+ a4 d; B: g1 M9 E. g   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
3 v# s/ C/ \/ R  ~% E% M                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 ?" Y0 ?" |# |. X                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) l. K- }3 f2 P5 H# P% a1 o" o/ F
   if( hFile != INVALID_HANDLE_VALUE )
+ ~* r8 O0 D; I6 T3 B4 J" x0 ?   {- Z7 y0 {. p5 Z9 J1 y2 L; [
      CloseHandle(hFile);
' `; N* h- S, P3 r. R0 ~) T% @      return TRUE;; i1 X' V1 p! |% z
   }
2 g1 |. K/ K$ ~7 P' C   return FALSE;
, v& t/ k3 H2 z! T8 J}
: u9 R6 a' l# i6 N1 R! o" @
+ m5 D8 X4 C$ q. D# yAlthough this trick calls the CreateFileA function, don't even expect to be
/ V; q3 F2 c, e7 Bable to intercept it by installing a IFS hook: it will not work, no way!
: T9 F+ A) q6 \! I/ rIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
3 z. P/ X  _( P6 ~( O0 Mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- Y" l+ m0 T* ?. y/ x
and then browse the DDB list until it find the VxD and its DDB_Control_Proc. t- n+ W9 E8 w. T$ F4 x5 [
field.5 h1 j+ ]+ K; P0 E! o. }7 F; Q
In fact, its purpose is not to load/unload VxDs but only to send a
% |7 u7 b5 [: uW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 G5 }8 A) J  [to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 d8 E* E5 M/ a5 u
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ B6 p# i3 O6 `( `If the VxD is loaded, it will always clear eax and the Carry flag to allow" A* n; e" m3 V4 _
its handle to be opened and then, will be detected.9 O# E( s/ x+ d
You can check that simply by hooking Winice.exe control proc entry point
" j- G! i$ q% ^" jwhile running MeltICE.
4 z- ]+ ?- L) C9 Z5 h3 a5 K
+ s3 w8 Z3 \- w$ o# [5 }! r9 ?& j) w2 j5 H- k
  00401067:  push      00402025    ; \\.\SICE+ J& I! z! N8 U: o; y
  0040106C:  call      CreateFileA5 w; m7 Y3 Y7 i) l# D4 w$ D* t+ b# g
  00401071:  cmp       eax,-0017 A! ?  e6 J' J& ?
  00401074:  je        00401091
  S; R# B0 y# y5 d+ x* o
2 a; Q+ m" x1 H/ W9 m+ X% j: X4 \4 G% Q% s8 v- T; d* a5 A
There could be hundreds of BPX you could use to detect this trick.
7 \/ R; n; [( G( D-The most classical one is:
' J  k! p; C. O4 k  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ h) L$ u6 h* X- D% C    *(esp-&gt;4+4)=='NTIC'1 G/ C: B" q! d$ L) @- j& _6 ]) ~

' _+ [6 B( i# y; k" _-The most exotic ones (could be very slooooow :-(
% A1 m5 l7 G2 H8 R   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / N: w6 S  e0 L  j
     ;will break 3 times :-(
; z" E& C4 Y9 I8 ~1 _9 ^0 {/ Y' _7 n6 w5 b9 V+ B# d% @! k
-or (a bit) faster: % G. {2 [: k/ j9 q, t2 x9 R
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')* y: @( w7 [% Q: H
# J' C4 l% Y# T+ S
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  4 m0 e! ~$ X( F  G8 n+ M# d  M" `
     ;will break 3 times :-(, V/ x  ~4 ~* K# z$ C: ?& _

/ z  d, e: e, M, j$ r) w-Much faster:+ s9 v4 ?6 ^/ @: F4 k- w5 G: h" O8 l
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; M/ [2 C4 R/ \9 H1 i$ R' O# F2 m
0 N5 Y5 A  K  ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. r) H* ?; H& S# C) o. afunction to do the same job:
: M# p0 v$ c3 E3 |0 a! X0 A9 }. q+ Z0 X! u# v, s
   push    00                        ; OF_READ+ g! v. h" ]$ z
   mov     eax,[00656634]            ; '\\.\SICE',0
# i! ~5 x' Z3 H: R3 q5 [9 m   push    eax
, J" x( S+ J. o7 u1 U' K* e3 V   call    KERNEL32!_lopen
$ `! X* U9 g  O' S0 M. K- }   inc     eax, B4 m6 t8 u* z9 a  B: N4 f
   jnz     00650589                  ; detected# f" K/ n( Y) x! p- S. _
   push    00                        ; OF_READ* |7 ?  w% @# N" Y" U0 F
   mov     eax,[00656638]            ; '\\.\SICE'  \- [$ }5 L* l) x9 N6 M) x
   push    eax  l2 F* M+ a6 m2 T% g# {( L. y9 c
   call    KERNEL32!_lopen
' [+ S* r: _5 k   inc     eax
6 d/ A; D# K- z8 R& `   jz      006505ae                  ; not detected
" C- o' X3 }) w" b' n  ?4 Z! G% f1 k: M- d( T: V) p( Y
: ^3 J4 g1 F) O  W5 _
__________________________________________________________________________
: P8 R8 m2 V+ i" v9 [- x! S  s, s- g6 u, h" e; p
Method 12' C/ w+ y# B0 @; Z4 m
=========5 |. ~% n  `1 g/ q+ p7 ?

6 E# T+ o/ K& V  _7 y5 R, p  P& aThis trick is similar to int41h/4fh Debugger installation check (code 05
( _* ~. l3 ]# |  m/ p) |&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, `6 S) h( \0 n) qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 G$ L. d, E; p$ G! E7 Z
6 m" Q8 v7 g* Z" {
   push  0000004fh         ; function 4fh. ~3 o! t9 K. [; G/ q
   push  002a002ah         ; high word specifies which VxD (VWIN32)/ ~+ g- c% X. S$ i- F! J
                           ; low word specifies which service8 d6 y5 u/ e  e* z/ a' C0 x
                             (VWIN32_Int41Dispatch)5 U- ]3 b- M& H; ]# |" }; C0 f
   call  Kernel32!ORD_001  ; VxdCall$ q4 {) a5 S0 s( t/ w
   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 ]( c6 h" S3 K1 q2 q   jz    SoftICE_detected
% E% }/ e3 i2 g& t6 d( D  ]- z0 \+ M: p- M
Here again, several ways to detect it:# ?: u) \% R; b+ _. l0 P- _

% c# ~6 }7 y: b* I    BPINT 41 if ax==4f
& X' e  w# m) E' e2 @1 I0 K  N
+ e. r+ u5 u% i8 u: D6 I    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 k6 T9 W. }/ R5 S8 z1 W

6 W; P, u$ i  c    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& O) _. q1 c1 ]/ R* u* g5 o( F
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% Y, n6 N( z: |2 W* X+ ~) n
1 S# s/ ~7 S2 |$ U8 E) H
__________________________________________________________________________" V* P, c. J) E
7 n# w6 `: j/ \* J
Method 13
1 L4 z& B% u/ O! D- |% a=========
( m2 y: L& x$ M) o3 F  V, x6 d5 v
3 l& [# N; |! H1 `Not a real method of detection, but a good way to know if SoftICE is
$ |- ^# f8 g! K. l5 b% ninstalled on a computer and to locate its installation directory.& a7 R/ ^% m: q* U7 r0 K. B) z6 I1 u
It is used by few softs which access the following registry keys (usually #2) :6 G" O7 j. y8 e- h: r1 u3 r& U

  B* t8 [1 L. Q: B( Q5 N-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( |9 F$ I  `) m. K; j% [
\Uninstall\SoftICE
5 s" O/ U0 c$ d  R; m" I- O; S; [* ^-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- Y+ A& ]% O( `-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' }1 D$ |( [5 W; K. S; i1 \3 A& D; ~\App Paths\Loader32.Exe
' @+ ^. M# r, k( R2 u* Q% j, w0 r) }) W' l

+ o% A" X  [3 B6 y! iNote that some nasty apps could then erase all files from SoftICE directory% Q( \2 S. ]! E9 v
(I faced that once :-(
6 S  k8 l- D  {7 Q, k; i' w+ s/ B5 `
Useful breakpoint to detect it:1 L0 \$ I/ u$ b$ R% K
! }% W& V! e* [
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'2 S6 {% G4 [0 h- f" M' l

- G4 `' ~9 ~- p- B3 K8 S: j__________________________________________________________________________, z0 z8 q* E- u3 d& f) j4 P

8 m3 t4 D) `$ H1 E6 h! H8 k0 V0 x+ W' ^$ `& W
Method 14
' t$ Y9 T. K& v* Z7 x) W. `=========" N3 I: M3 }1 z

: m. Z* P1 _' W1 u1 |A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* p, P! _: J/ ]4 D, qis to determines whether a debugger is running on your system (ring0 only).3 g  U; z5 G5 p9 ^
% D, R7 r" e+ N( N/ }! y
   VMMCall Test_Debug_Installed- k; \  @% K0 B# w
   je      not_installed+ h4 @  ?8 R% D
1 w  p# n% s6 Y- e5 C* Z
This service just checks a flag.
2 a6 G* `9 g) k* Q$ g/ a9 d7 R</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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