About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 v  m1 P" S7 r8 U2 s1 c  P/ X<TBODY># M# a9 ^* }; j2 j) I# S9 X
<TR>
0 E- ]4 G8 ~1 X6 F3 P/ N  N( F5 B<TD><PRE>Method 01 9 P  h8 S+ k$ `
=========: F. X3 C  |7 ~" M9 H& r6 B

. Z/ Y( U1 A! }This method of detection of SoftICE (as well as the following one) is, \; |2 ^9 H% |6 M2 S$ k2 [/ @: r
used by the majority of packers/encryptors found on Internet." y0 N, s6 Y0 P& i% h" j
It seeks the signature of BoundsChecker in SoftICE
1 S' _4 S% b. ^6 z. K7 |. N3 w3 V% w% [! m
    mov     ebp, 04243484Bh        ; 'BCHK'
9 m& S8 P; t$ f6 B! a/ x    mov     ax, 04h
$ K) l! k9 G0 ~! v' I    int     3      
8 y. g: p1 B/ t' i    cmp     al,4: [( ]: t+ E; C- G5 M3 z3 M( ^
    jnz     SoftICE_Detected
* I* Q4 q, W7 y+ V
3 W- D% z1 ]8 k1 V# h2 t___________________________________________________________________________% N, C4 p& p+ ~# O" d; N6 V
) K' l6 [: \# A" `' q7 Q2 ~
Method 02$ {: v1 M0 |6 }
=========5 r( x$ O5 w3 V& w2 L
, J# Z: g8 T; p  N
Still a method very much used (perhaps the most frequent one).  It is used+ |' t+ h0 t6 u+ c
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 m1 B' _- W) V' R3 @5 Yor execute SoftICE commands...
$ o1 _& k: T' q1 ?9 P  SIt is also used to crash SoftICE and to force it to execute any commands
2 p/ _2 b( X9 X* A. r(HBOOT...) :-((  
) d5 f3 O9 S4 n8 k7 u4 A( K5 J1 N! k+ S# \( ?5 n  m" h
Here is a quick description:
$ b( }2 R9 G* D! b- F7 K-AX = 0910h   (Display string in SIce windows)
; X; N1 Q$ a1 h  I! x7 A9 o-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
; L3 \* e2 @& B. S4 n6 e/ }-AX = 0912h   (Get breakpoint infos)! l/ I  S) u2 V2 ?
-AX = 0913h   (Set Sice breakpoints)0 d! K# f- L" i5 K1 g
-AX = 0914h   (Remove SIce breakoints)
% ~! ^* I3 u/ z/ k5 }! b$ B, T9 y+ \! }1 X
Each time you'll meet this trick, you'll see:
/ f( d& u3 S# x4 q2 E) ]  Q-SI = 4647h% ?& k$ v8 e& O
-DI = 4A4Dh
0 ~* G7 D" c. ?Which are the 'magic values' used by SoftIce.5 h( M' F: k: G
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.' X0 {$ }6 @1 I9 Q

( e+ E1 S/ k$ h9 O( p1 r* RHere is one example from the file "Haspinst.exe" which is the dongle HASP
7 n* d. ^7 S  m( K/ [8 }% z5 GEnvelope utility use to protect DOS applications:
1 M+ Q# ?; `+ E3 c3 O
) l) k8 e& N, y% B
& l7 }+ J% t( m* Y. D# p: O4C19:0095   MOV    AX,0911  ; execute command.
/ r( l1 k2 r' y4 F: }9 B4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).+ J; F, O+ |1 l
4C19:009A   MOV    SI,4647  ; 1st magic value.
! _4 v3 Z  k" B) |/ [4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
* h. t+ J$ m9 A# ]% ~+ D8 O/ t4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
4 ~4 `, t! k$ ?  J5 r) B$ B7 n4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute0 f) w: V- K2 n* `4 C" Q8 f- k
4C19:00A4   INC    CX
. k1 V+ Y/ Z- J$ x, e9 G5 f4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute6 a5 O; i. Z/ f( t0 x- d
4C19:00A8   JB     0095     ; 6 different commands.
% W, j. l6 k0 v* `5 ]' {4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ A% @+ m) Q/ o: b1 Y. ]0 O) f
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 s1 T0 N4 y% V7 ^7 T
$ ~+ P, J2 ~7 B$ w9 m8 {' nThe program will execute 6 different SIce commands located at ds:dx, which/ A+ x4 m: W3 A. g
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 k* x/ |5 P. k( Z- R1 m! z9 L7 l5 u! ^

0 x* y/ o. K4 c2 e8 W& [6 H, U* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., A/ t: p# Z6 p9 v; X% W  K  {
___________________________________________________________________________" i3 a* j+ B4 }9 L3 I0 ~- C& x3 W4 e
( `0 e% E5 t8 y6 B6 I- g0 N: T
( j# Y' q6 g/ X" m
Method 03* q/ G  @! o$ f2 v
=========
: Z6 H$ v5 }7 U  w. |. \$ V" d, I" e( g9 C( |$ v2 h
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  o0 ^( m2 J* y! ^( `' K
(API Get entry point)
5 j' t) d; ?4 t) v8 |: @        
8 w# T0 [& h; x! F, H; m
* x* j( w" L  `5 L( P' @4 j    xor     di,di
( N2 i3 V. s) z  K- U    mov     es,di
7 S: `7 g+ i# w1 X' e    mov     ax, 1684h       6 d' u7 j- b( K9 U( r3 |1 K5 M
    mov     bx, 0202h       ; VxD ID of winice( l. c+ m0 B' `" V' x! O
    int     2Fh, _5 L8 n7 e6 g* `0 Q/ ]
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. ?8 _' W) x# D' v
    add     ax, di+ y* x' x( `6 I; M4 I$ Y' ^
    test    ax,ax9 D9 J6 U6 j" \
    jnz     SoftICE_Detected
) V* W7 ]% `0 ^/ q0 c* O* E
# F! h8 K, g8 |4 U2 b4 z) q/ r: h0 O___________________________________________________________________________
% S: l8 _% ^) I8 a% o- d0 K( K" ~/ h& U) Z
Method 04- e5 i' @0 m# ?% E$ B7 q1 s0 n, D* H
=========3 S% D6 Q0 Z, y- R7 r4 Y# K# n
+ {( o9 v4 c" @# G0 F
Method identical to the preceding one except that it seeks the ID of SoftICE
2 g2 h# S  V8 a( V! {* IGFX VxD.# B2 @  v$ U  t* S
& u2 F' z+ n2 A- y# q; X7 g
    xor     di,di4 j! V% J7 I& W! O
    mov     es,di9 R. ^% a& P( x% M6 v1 g0 \
    mov     ax, 1684h      
  z6 `' Z; S$ u* i7 y* g    mov     bx, 7a5Fh       ; VxD ID of SIWVID
2 ]+ w4 S# j6 `% g    int     2fh6 r  G$ |4 h. d8 J* v1 w, [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* l" N  r: v+ ~: i2 {
    add     ax, di4 t5 l# s, D7 O
    test    ax,ax' U; S7 n3 x) q* S3 X
    jnz     SoftICE_Detected$ u( j: i! {/ Q4 R# P- X7 A$ ]; _

3 ~: \. T. S: S__________________________________________________________________________
! _2 v2 W% S. X2 ^1 M
& ~9 L8 P( J$ Q' V: _9 c+ k* i3 N# C; \& ]2 w9 O% T  g0 X$ ^
Method 05! v% m( q. M, c) H
=========
. E# v" O$ _7 A: g2 O0 A! d2 Q
  f3 s! p' |3 j! uMethod seeking the 'magic number' 0F386h returned (in ax) by all system
1 ]3 ~( j0 w- B: Y. G" K9 xdebugger. It calls the int 41h, function 4Fh.
- [( K6 @* d- g$ n& b+ y6 C  iThere are several alternatives.  
0 p& [8 ^4 G9 w; }- x0 p2 b" K! k# z2 Y1 P$ U; z* H5 b- t  R0 z
The following one is the simplest:
1 G6 n9 i- `( q& e1 c6 a3 W
/ l2 m: k: y% }' j0 m    mov     ax,4fh  I0 A0 T$ N* p/ x8 e7 P8 A% f4 z- v
    int     41h- V& n2 w5 {* s$ _5 o' T
    cmp     ax, 0F386
/ U, ?' f5 U+ y+ B: S* G4 d$ }    jz      SoftICE_detected& v5 \+ M* o4 w' `2 l7 u

- I) {! h% \0 L# `. F9 d5 u/ l
6 S7 B" [* r. F! l  A4 VNext method as well as the following one are 2 examples from Stone's 7 d3 E% P( \1 y' Z# D
"stn-wid.zip" (www.cracking.net):
# O! R+ H; |1 K; H+ ~
; [' i) u' y/ u. ^& a6 V    mov     bx, cs8 n- v8 \+ k% }1 M
    lea     dx, int41handler2
3 O" P# \# z; n/ a3 K    xchg    dx, es:[41h*4]
5 Z  _5 ?4 r4 D* k  i    xchg    bx, es:[41h*4+2]2 k. N4 J# d; D, s) {1 a
    mov     ax,4fh# Q7 L4 k$ A" }9 I- k( c/ ]
    int     41h, D- z+ o; V3 c
    xchg    dx, es:[41h*4]
1 e$ A  v* Z. G/ }6 l9 H$ P3 |  c8 M    xchg    bx, es:[41h*4+2]
  m3 }4 Z9 }1 k$ M: G# L+ M/ o    cmp     ax, 0f386h1 ^, Z7 A3 k  r( m% {# p* j# Y/ G
    jz      SoftICE_detected! W: o  O* ~; M; B. A
. U$ M- S  J/ s; R
int41handler2 PROC
' A0 B- Q6 I) R  H7 n7 t    iret
' {; g5 ]$ E% i& P5 rint41handler2 ENDP" u5 }. }9 z5 h; m' c- n% U
8 B0 b( Z' {/ {& u. }

7 X) V) j. X& T" H_________________________________________________________________________
: g( Z3 C7 [' y# u! o& ^
9 B  d( K$ M) v& k/ D2 ~2 I! Y) F- P3 a/ O. s7 j5 A, E
Method 06
+ s" a* L! [0 ?0 w7 o# J0 p=========# j* a3 i; ^) N' X* t: s+ C

; y2 z2 ]8 m7 S% U% B2 |4 ]
9 B: f5 T7 X6 O# e8 u2nd method similar to the preceding one but more difficult to detect:6 Y4 B" G' X7 D% V* y& m

% ?# E! E# q) L- O$ k1 W" B( |  Y# g3 p
int41handler PROC. A* p: C3 Q$ H1 J% [+ a7 `
    mov     cl,al$ j9 k; ]2 V3 ?3 H+ p  g
    iret
" u( h' X* x& {int41handler ENDP
' ^- m2 z: G4 C3 j6 d( \, k1 t/ Z$ `; B2 e; {3 |6 ^9 M  S
( E8 X& b* n, ^0 V$ a  P& C5 O
    xor     ax,ax
' @# p, D, t3 r. q1 x, `    mov     es,ax$ a9 ?3 ]! e0 n  q$ V* F8 v
    mov     bx, cs
& z  r5 j- Q: L" F% d  X2 m, o7 l4 m    lea     dx, int41handler
2 Z  m/ _& L% W4 [    xchg    dx, es:[41h*4]
  y- _- m9 `7 d) Z; z+ }9 x5 v    xchg    bx, es:[41h*4+2]" n. @0 `1 N; f5 l' [- S
    in      al, 40h
* g1 j4 s$ @$ S' x/ l    xor     cx,cx5 Q, _! B, M/ G9 T
    int     41h4 E. H7 |; i' r3 W5 ]1 L
    xchg    dx, es:[41h*4]
& ?: ~# |+ J) m* L    xchg    bx, es:[41h*4+2]
1 w$ t, a! J  S: o0 \    cmp     cl,al  C9 ^. }' i; b3 g/ G' \5 @; d- N
    jnz     SoftICE_detected
- ]% @3 l( \* m& }$ i; H5 x
9 T0 S8 W1 z  C_________________________________________________________________________9 z7 M& C; \8 g/ X' \) a

$ m: U* n. T* a/ I5 X: X0 HMethod 074 P0 p% Z4 l$ O
=========5 y: [3 e5 N6 F, D& O

. r: x3 W4 ^5 \! wMethod of detection of the WinICE handler in the int68h (V86)
5 r& U4 N; T' `0 K  |: J5 [/ P* O5 B( [' k2 W9 `
    mov     ah,43h8 `- T  i' K% q& y/ l5 w- e
    int     68h- i6 n) u' Y+ E9 K* M, p- Y
    cmp     ax,0F386h
" E9 ^& O- y2 ^/ g2 J0 H    jz      SoftICE_Detected
; u( \* o5 R0 b% i! B* Q% a# |/ z$ O; G
$ V3 [% v  X5 j  @
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
' w3 v) S8 s  K5 F& }   app like this:# e5 A' T1 E" x( \8 Z% ^
, S( G. Y* @# d& u+ x7 j; A  R& r
   BPX exec_int if ax==68
+ E$ g; x2 H4 \$ X   (function called is located at byte ptr [ebp+1Dh] and client eip is- O# o$ q* @. i. k: M
   located at [ebp+48h] for 32Bit apps)6 K# [' A" ^7 w9 e
__________________________________________________________________________) P3 n- D  U: d, x8 u
9 K4 x2 Q5 F' E5 b; A) M, K
5 t4 u* h3 B1 _) _" ^
Method 08
& C9 B  A3 I0 a) l* W' _=========
+ N/ }2 t7 c& ?# V
4 T' M2 d) ~" U8 v2 s+ |It is not a method of detection of SoftICE but a possibility to crash the: \0 q. a; m: u5 d5 `
system by intercepting int 01h and int 03h and redirecting them to another/ ~" y6 O8 M. _8 z. G  Q. [
routine.
" \! \* y* d& N! NIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points: q8 }" A8 L7 w( V6 m
to the new routine to execute (hangs computer...)* j6 ~( q6 J' m% U7 l/ F: Z: I5 `
8 S+ [: P) i4 r/ A% }& B
    mov     ah, 25h+ k& [7 F& W% g; a7 r1 U) `
    mov     al, Int_Number (01h or 03h)
" p9 s0 q, B7 d( \  g6 m    mov     dx, offset New_Int_Routine
: W0 Q+ C" o, q    int     21h
# S* x4 _" O' y* C$ D* q9 y: [! a5 Y5 [2 a: F! c4 B/ o
__________________________________________________________________________
( n/ `3 k" r) J( g, o/ p/ w, T' y9 ~' |
Method 09+ G( ]6 a1 T* b0 N+ ~/ j
=========- U: Z* S) W  q$ v
' a! R- ]& i8 g1 k3 C( g* B2 M
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 l7 l- Z5 x! P7 [) |
performed in ring0 (VxD or a ring3 app using the VxdCall).+ ^5 a* j& ?0 l! C" e
The Get_DDB service is used to determine whether or not a VxD is installed
! E( o1 w4 N3 |: y% d! M, sfor the specified device and returns a Device Description Block (in ecx) for
8 [2 ^/ F* C" R5 I' rthat device if it is installed." Z4 w9 {+ Q) E7 X3 L% X. e

6 H) O* a, y+ y% l1 B3 Q   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID$ X9 t; o/ k# B" d* q- }
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
+ v0 t, T( j! Q9 K$ Q# u; f; h& C   VMMCall Get_DDB5 p& a( y  r. P, a
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed) Z  y# O0 K* p/ d1 B) t

% a6 N2 K+ G9 \$ k# gNote as well that you can easily detect this method with SoftICE:# _" s% Z: ]1 e& e6 U1 g
   bpx Get_DDB if ax==0202 || ax==7a5fh
, E' e% w5 g+ C5 I& \1 I# |8 |. J9 I7 Z8 _- Q* F5 C1 N
__________________________________________________________________________
& ]' ^+ N" I0 Z$ \/ C5 c1 T1 j2 x- D' q; A! \8 F
Method 10
1 Y  A" h+ b) a=========
; ]  k% H, W5 q3 J8 o0 R. v: q3 ?0 k6 W( k! n
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 s; y% \) o; G& J2 ^  SoftICE while the option is enable!!
0 E! G: h% \1 K2 v' g
/ b' f" w& \- L4 ^7 c8 kThis trick is very efficient:
! B: n0 t! @* L' n9 Pby checking the Debug Registers, you can detect if SoftICE is loaded
7 B0 D0 O- J' a0 X" b5 p4 l& l2 U(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) s- D' f& {4 D6 D& R% J
there are some memory breakpoints set (dr0 to dr3) simply by reading their
( j# S0 ?; b' r0 J9 Q, Yvalue (in ring0 only). Values can be manipulated and or changed as well
& ^  N- u' e4 a( x(clearing BPMs for instance)
$ J- F4 y$ ~! W6 {4 C+ }- K$ Y) U
__________________________________________________________________________
0 K7 K! W" H: v2 j$ h1 n7 c% M9 ]- l. q+ ~, ~$ s1 P, `
Method 11$ h+ R' j/ m8 O  k- I2 o
=========
+ l* d0 Y0 S7 |
& [+ ~+ K/ b0 H+ zThis method is most known as 'MeltICE' because it has been freely distributed
. W: U; E' X( G, `. Uvia www.winfiles.com. However it was first used by NuMega people to allow
/ w/ T. n! ]) i& E/ J' |' KSymbol Loader to check if SoftICE was active or not (the code is located
( Z* H" t  ]0 X1 o8 p+ Vinside nmtrans.dll).) q2 B8 }9 n6 X- ~
% Y6 }- U* u2 R: W# s
The way it works is very simple:. b5 b6 s% s; H4 L' r! R: Z) p' |0 D
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' ?( R, E* E0 n
WinNT) with the CreateFileA API.
3 Q  W- q; M+ K
) b( G/ h* c0 N; v8 b5 |- QHere is a sample (checking for 'SICE'):
, n9 u% @9 q1 u5 t! {+ W  d
2 n' m& z' x; T" H: zBOOL IsSoftIce95Loaded()
' V" f; Z, N+ z4 p/ g  m{
5 r! V# T: J& G6 p4 B& b* d7 y! F1 k   HANDLE hFile;  
" ]9 V5 `& f( l2 q4 a6 r   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
; f0 n7 E4 i  V: y% h1 V9 Y                      FILE_SHARE_READ | FILE_SHARE_WRITE,
; q1 r7 b2 N& M7 C3 |, N* x( Y                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);; E) \2 |5 f: |; B; D9 r; F5 f7 D
   if( hFile != INVALID_HANDLE_VALUE )- q+ N, t3 o+ O" R& z% |6 D( z9 d
   {* `1 K6 u! p1 J: K& ]
      CloseHandle(hFile);
& b1 k, |9 w" Z6 p; u+ l      return TRUE;* q3 N; @- n: H& t1 w1 q1 q
   }4 n. ~% {/ H9 C- o7 v+ i
   return FALSE;
: v% f0 l: E* H( f4 S0 P1 M1 R3 a}
" u5 V% j8 e5 }9 U; U2 [/ O
# t9 o0 @) C( a& {+ p: `Although this trick calls the CreateFileA function, don't even expect to be; M7 A0 p! k7 P$ o
able to intercept it by installing a IFS hook: it will not work, no way!
  c) O8 ]4 u0 u4 ?* Z2 |, NIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 o8 X: P9 P0 }% \" Rservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ ?. |6 K! o1 T+ R5 Iand then browse the DDB list until it find the VxD and its DDB_Control_Proc
9 |# h, F+ [2 v  u" e3 e! y& nfield.
6 F* z8 _$ g( \! N- o5 Z: i* _In fact, its purpose is not to load/unload VxDs but only to send a ( w( a4 a% N2 B3 `  ?4 d  F# ]8 j7 X
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! n/ b4 A* o& x6 F8 W1 [  B! _to the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 Z! f6 w) u: [7 ^+ S9 Z" ito load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 T6 T' G2 U7 z3 g+ u8 tIf the VxD is loaded, it will always clear eax and the Carry flag to allow  i: V6 `  m; p: _
its handle to be opened and then, will be detected.
+ r4 ^/ e7 h9 o; K. }% g2 L5 zYou can check that simply by hooking Winice.exe control proc entry point
( D- R& b+ B8 v* _( x4 Mwhile running MeltICE.
) S6 e: ]% F: ]; \: @- e
9 D5 X4 m( B8 f- c- }# u. ]; l6 h
& Q1 q) g% I  l/ X5 {" a) d  00401067:  push      00402025    ; \\.\SICE; `" P+ w9 w% j& y. @' u' B. f5 F3 ]
  0040106C:  call      CreateFileA+ ?5 f# C8 r5 ?0 \
  00401071:  cmp       eax,-0018 K/ c. z1 R9 F% w1 g8 D6 k' G
  00401074:  je        004010918 c' H8 |  W2 u: [1 [8 r

. O/ P) A6 I8 T: H8 d& l  e! S" k
1 v* r$ \; L7 \, c) ]7 P' l2 WThere could be hundreds of BPX you could use to detect this trick.
5 s& `+ m- G. ?% e* {6 e-The most classical one is:
) _) h! P: b8 \  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
& Z; c. {; a( s) r7 D8 t    *(esp-&gt;4+4)=='NTIC'
$ i: H- ~  k+ f
, g8 r' J4 Q0 _3 X-The most exotic ones (could be very slooooow :-(% A! W  ^& l' {  U: ~5 F& R  u
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
# R, d& R( A4 U9 D" x     ;will break 3 times :-(, H6 Y1 ^" H! p) o

. |! P1 {; K  k2 m: [-or (a bit) faster: % P* J4 v8 T$ Z+ e+ k/ ^) U0 A
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- C, g/ i1 S4 n6 F
/ y, e5 `% R  b. u3 a5 Q( T   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
) O' O2 U8 E5 S' N% [% j     ;will break 3 times :-(
& H# q, r# j4 \$ y* _. q$ H( a6 h1 L2 c4 v! s2 z8 A9 t. Y2 m8 ^5 g
-Much faster:
* F; g8 z% V8 }8 k/ U" D* o3 F0 B! l   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
: j( _8 u; D, S& Z6 s: e( E' w( a7 l! L5 l% O, `% h
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
, C/ y8 T: J9 h' xfunction to do the same job:
8 _; g6 S" a) Y8 `8 H/ w/ k3 L: K5 h. @5 ^9 R
   push    00                        ; OF_READ
' O# @" g/ P  r, E" w) m   mov     eax,[00656634]            ; '\\.\SICE',0
( {" _* ^$ m. E6 _5 q# |  i( D   push    eax
! h8 k" T: V0 P7 B3 Y6 f$ g% Q* A   call    KERNEL32!_lopen% n$ W5 L# E0 u1 w, k7 K1 S. f0 N
   inc     eax# N" X; b- y+ b  b* q
   jnz     00650589                  ; detected
2 U3 u# f- M2 B! q: G* @+ L7 ]   push    00                        ; OF_READ5 w) r- ?+ ?# \# s& }
   mov     eax,[00656638]            ; '\\.\SICE'
7 l: R1 A* [" F) A% H   push    eax
& d8 [) `* L( H   call    KERNEL32!_lopen! W4 |+ t5 Z4 O9 z( I
   inc     eax
5 ^+ x: }9 Q; b0 {   jz      006505ae                  ; not detected
# h" S5 k" j/ [; ^
8 H6 N% {1 G4 x0 a5 j
" _+ @7 C( u; `5 L# F0 y# h$ c/ y__________________________________________________________________________0 \$ Z0 r2 t+ e- _8 d

6 K+ Y6 K1 u6 E# Y  o( f  e5 G6 {8 {, V3 CMethod 12
4 H" q- a3 }# a, h0 I=========  h& W0 H7 {  `& G5 _( X

' N2 T: f) n/ ]1 g; n0 zThis trick is similar to int41h/4fh Debugger installation check (code 052 k% D. u- w: Q7 Z; I
&amp; 06) but very limited because it's only available for Win95/98 (not NT)) c" X! ~7 F* O# }6 V2 N
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.% B4 Y) T; ?" H/ v$ @) W. m- K) ~
1 x8 k1 g( ^5 p4 t3 `* K! a
   push  0000004fh         ; function 4fh
& W/ `6 P* |# C* u) K   push  002a002ah         ; high word specifies which VxD (VWIN32)5 l% B& p' {8 r) D7 t. A" m
                           ; low word specifies which service# {. n  g. M# ^* v
                             (VWIN32_Int41Dispatch)9 G' \" H+ e6 I' C+ p! ~! `+ e5 E
   call  Kernel32!ORD_001  ; VxdCall/ B$ d8 g+ z* z- C, I, g, G' h* t) o
   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 A1 Q+ J9 d" K  l/ m/ I   jz    SoftICE_detected+ D& ~* \3 A) w) f( [- L
: \5 l8 `9 B* X. r7 a7 f3 Y$ d5 }
Here again, several ways to detect it:9 A' q' w2 V. p. F& [8 R$ m

8 |8 g' O) S* a) }5 J    BPINT 41 if ax==4f7 c+ h8 ]. y+ J0 M
" |! [3 v, m1 k1 h5 t
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& u  e1 o1 b! H, P; A" s. |4 G! p; c1 v
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A% k3 e$ d) E: I# T/ q

: O  i9 L4 R6 n1 \* ^    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
% p+ Y! N5 w! s4 m7 Z8 l; y$ g  U# X+ r! Q* \" Y
__________________________________________________________________________
5 V* ?5 h5 A! h( |9 {7 x% h
8 @' P0 v2 E' L6 A0 g$ I7 YMethod 13, m( L0 Q2 U' L2 G9 \) A
=========
! h0 j0 @0 ^, f# Y* T7 u' B" T9 W! y* R5 H$ P. n5 ^
Not a real method of detection, but a good way to know if SoftICE is
9 ?& V4 P5 I) B/ L$ P1 minstalled on a computer and to locate its installation directory.
+ A4 c* ]4 \. i2 h) Q2 j5 aIt is used by few softs which access the following registry keys (usually #2) :1 q7 Q  P7 I% J1 |7 c. y/ x  {

/ g5 G% C0 e: i: k. B2 N& V-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 [6 \# p$ ~. g) Q) o& |3 Y\Uninstall\SoftICE) b" N/ }& l' d, _$ `
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% O& L9 \% e9 H) t( u
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; D8 i/ C- G) j9 i4 ]5 R) x6 X8 p\App Paths\Loader32.Exe
" X* L. ^+ _( g5 s8 V- W6 ?; ~0 l5 ]: K! l- G3 c

% D* ^# R& s# S; m7 W. UNote that some nasty apps could then erase all files from SoftICE directory
* Z& C6 W5 V- m/ |+ H* Q3 A(I faced that once :-(% \0 s9 _; d1 X/ y

/ {+ f4 E* |$ a# N/ AUseful breakpoint to detect it:4 L/ i4 r) O% V: N* e- W& q0 t+ ?
# s% F2 H4 @3 k$ R* w' F9 e
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'7 x; X! \1 p; S7 I

' i! o0 d5 \+ H+ v# }. Y- }__________________________________________________________________________/ Q5 b# S/ B8 I# e0 h
% f. M5 J4 j" B2 }# w' v4 O0 @
( M$ Z9 s8 q$ f" {
Method 14 # A  }" X; z/ D- l7 ]4 K0 o
=========
3 `2 w3 w: i: D# d
& A3 }' \$ j0 F# b- d6 h4 xA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) G8 _- D; ?% |, z. H/ H; vis to determines whether a debugger is running on your system (ring0 only).
3 b  H; i2 R% c# e1 K1 b7 V
$ n9 P, D5 t- Q4 _   VMMCall Test_Debug_Installed
( @3 \: R3 s/ ^5 k+ h  f5 }2 j8 `1 l! W   je      not_installed3 ^# S% _- ~$ ]5 [" U  `

3 r  p7 v# W' ^This service just checks a flag.9 s0 u$ ]- j' J
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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