找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>0 {$ d  q; G8 `1 t2 y
<TBODY>9 \$ `5 s, G% V' x) m0 `
<TR>
( ?9 @* d4 t) |* n* D: ~9 X( R<TD><PRE>Method 01
7 n) T; f" D9 Y0 z=========
* R3 u4 ^+ ?3 t) Q# H& Z+ A. V- @5 N$ C2 B1 Z  I
This method of detection of SoftICE (as well as the following one) is
2 t# R( O1 V! S$ k; ^, V8 K1 xused by the majority of packers/encryptors found on Internet.$ B: ^$ R5 e- n9 B+ z- e
It seeks the signature of BoundsChecker in SoftICE* |) F6 T- f* v+ E4 d) N+ u8 D

' g" ?5 Z* U0 r4 M# G* T# s7 J    mov     ebp, 04243484Bh        ; 'BCHK'/ X- i2 K6 R  C
    mov     ax, 04h
! P3 X  S$ U; E( c" R. i    int     3       & C6 x! D; E; W, ~2 W4 |
    cmp     al,45 ]% r# Y- o/ k2 J$ t: H/ ]) q8 O
    jnz     SoftICE_Detected
7 S% r- f$ B$ [  p8 x) N- J& ?& j) w! i
___________________________________________________________________________; v" V  a  S; h! I, _- X6 m, @, Z+ i9 g( Y
* b: B3 r0 R. p- C1 m1 B
Method 02
# a& _/ y+ W8 D4 p& [1 M8 U) j/ u1 y=========6 n- Z+ X1 I  T6 N% g8 b$ B( q
% v. T3 i4 L  }0 |0 ~2 r
Still a method very much used (perhaps the most frequent one).  It is used
" I4 a7 U6 y9 Z. o0 P0 Y! rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 E& ~& J! r& }! J+ @; |% u# X
or execute SoftICE commands...% v6 K- e' V: c9 V; f' N
It is also used to crash SoftICE and to force it to execute any commands
2 I8 ]" V) E6 C& D(HBOOT...) :-((  7 j% A+ j) h- s  C

( c/ _8 G: q) r1 M1 XHere is a quick description:4 i9 E  b1 K: e( h5 g+ q* d5 q
-AX = 0910h   (Display string in SIce windows)/ Q% u  |/ L- G
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)- z8 z5 M- v0 F5 i/ X( k
-AX = 0912h   (Get breakpoint infos)
/ J3 x: j1 i: E-AX = 0913h   (Set Sice breakpoints)+ l1 ~* [- X% V% T$ {8 ^
-AX = 0914h   (Remove SIce breakoints)+ V) n% q/ h9 }/ Y1 C/ ^$ V
% O& ?( V& K6 R9 l
Each time you'll meet this trick, you'll see:
$ A+ m" f9 y- M+ G$ Z" ~-SI = 4647h
% z( n) o% n4 V/ T- Q9 p  U-DI = 4A4Dh
3 p0 {+ c7 U& e7 v; _Which are the 'magic values' used by SoftIce." B8 N4 Y0 D1 c/ M/ P
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ f7 b" R3 x% L# t. I8 r

; M: o. k6 y) Z# v% QHere is one example from the file "Haspinst.exe" which is the dongle HASP
/ C' X* f3 V4 ^3 E1 jEnvelope utility use to protect DOS applications:( o2 F( j  z; B
) C. p  x: K: `( o- T* e$ Q
' d! |* z4 @* v) Y5 q
4C19:0095   MOV    AX,0911  ; execute command.4 l1 g) v! ~) i$ J1 p& G
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 ]+ ?- N9 H0 n1 h( l9 w! \, T, D4C19:009A   MOV    SI,4647  ; 1st magic value.: L. F, \* c( D5 u- A
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
2 J, \0 z# a7 T! q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
  x! W7 Y& @. \% X4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 f* ]" m* {8 \/ @- C9 V
4C19:00A4   INC    CX& t, B& F8 b7 }
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: M3 H) ~( R  G! I2 d: |/ ~
4C19:00A8   JB     0095     ; 6 different commands.
9 a, [: b( y7 ^, T4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
) Y2 j9 B  D6 N% B+ Z9 O/ }( E8 ^4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
  p8 E4 E2 o3 C7 N' {2 P- v) o$ @4 H& ]+ X' _4 x
The program will execute 6 different SIce commands located at ds:dx, which* s( N' g1 ^$ U' Y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& p, |* m$ o+ E, F2 o' P! ~. y8 I2 l
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' X: c* |# L8 m! y) \' n4 d
___________________________________________________________________________. g6 g- T* E$ \% `$ @) G8 u; p
3 b! o9 E  M  o6 H

9 m) t4 W- j  L0 G8 ]  w+ [  FMethod 03
2 h' E$ Z; c, e" w=========
, A: f$ L( {: j) o" \
* i9 ^: A; }. F6 x( Z$ O# m: w% sLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h7 y7 B4 D1 K4 O( m) O) R
(API Get entry point): d- X. Z) ?( [- W; k8 J% J, x3 {
        
- a) O. g1 \# Y: |2 w! Q' R1 B) Q; W( b; O4 B$ S: W# `( A
    xor     di,di
3 E6 }2 E3 N" J6 P    mov     es,di6 u2 n. ^0 q! C8 z0 _9 |
    mov     ax, 1684h       . N" d% {; q0 }$ f$ e. l# c
    mov     bx, 0202h       ; VxD ID of winice' ^% `& y; b5 G2 x& `- A
    int     2Fh
( y3 G; X( P' {% k* [2 n2 B    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 h8 I% Y7 J# k! h& ~. [, d( c
    add     ax, di
6 O3 M8 L3 y/ A    test    ax,ax- C& W: p% k7 S5 Q
    jnz     SoftICE_Detected
9 j. b& `: ~  e: `  G4 R% l, ~. t6 v7 W
___________________________________________________________________________
" j. x, Y: _; T: k0 ]4 J# |  f7 }* f3 _3 [; P2 s% p. x
Method 04- H" M7 t6 d8 p- F8 |. W
=========- V1 c6 a* l/ F$ }% }: [1 l
+ h/ E* c7 S! D6 z# Y: ^% y( M- X
Method identical to the preceding one except that it seeks the ID of SoftICE
6 i% k$ J* T& c& XGFX VxD.8 ?0 y6 h3 Q/ N% ^# ?% N
, W  ^' Z' h/ N9 c: o3 c- v: o2 S
    xor     di,di
3 |2 ?7 P6 g& N% v( o1 c* l    mov     es,di
) L  E7 \2 L! `: c5 h    mov     ax, 1684h      
; ~+ N7 n; m! t. ?" t" C0 f4 u' w    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. G2 \: W( }" t5 q8 o    int     2fh
3 ^! k; `& ]! O& j    mov     ax, es          ; ES:DI -&gt; VxD API entry point' y% w) ]) E5 _0 }. t3 k  L# \9 [4 H
    add     ax, di" {$ D  y5 @5 y7 W% s. m
    test    ax,ax0 }, Z- _8 }. m5 U. Y: V& q6 B
    jnz     SoftICE_Detected
* P% l' Y! e- ?# e
5 E, t8 B6 d5 S, Y__________________________________________________________________________1 V5 N2 [9 S- f( s  ?& y2 K' w

4 s, A1 G$ A  I2 z7 z9 h0 B$ J
' y6 T2 C9 s$ f' b# \4 W; K! l6 yMethod 05
; ~+ v# P2 k# N=========
) k$ ~8 [; j3 S7 X8 E
+ }& a; F) t3 ?7 R. u* \7 ^0 G4 TMethod seeking the 'magic number' 0F386h returned (in ax) by all system
0 F& N- e+ C8 s, n; u$ r: ddebugger. It calls the int 41h, function 4Fh.8 y5 x# N: F5 {3 Y: T1 W
There are several alternatives.  
' z  y8 r) b- ~8 c
: Z5 r3 ~+ U+ H/ a: b6 Q  gThe following one is the simplest:
6 d( n: s3 Z; H$ F' J! ~
* w6 @3 K$ ]$ Z9 k) Z5 W3 ]  ?    mov     ax,4fh
" `6 Z( `, Y; V6 e4 T0 X8 L    int     41h
5 b/ v( ^$ D: `( ]0 @, g8 Q( p0 a    cmp     ax, 0F386. z* v3 T- h) m5 _! M# n2 E5 H* r
    jz      SoftICE_detected) |% |* G2 \1 B1 ~( [9 R5 n1 K

( P, W/ r0 U9 w: _, U
$ O! H& `! o. G4 c& E9 S0 |Next method as well as the following one are 2 examples from Stone's $ y' F9 T/ [/ e7 D% N6 }! H8 x
"stn-wid.zip" (www.cracking.net):
2 c: S" i. D  X1 j
3 @: ]( e& U- ~% Q' ]" n% N7 e0 r    mov     bx, cs' {: K8 A# V7 H/ _# H
    lea     dx, int41handler28 d* X6 x9 }" |# J9 t( A% K
    xchg    dx, es:[41h*4]
1 L! G7 h& ?5 _3 |$ C" K, E    xchg    bx, es:[41h*4+2]
/ O- X" }3 }2 _/ f1 M    mov     ax,4fh
; a' l9 }% V8 o! s: @# p    int     41h
4 S/ @, L2 w- K- I% b/ O    xchg    dx, es:[41h*4]
. L, B! w' _; N+ i    xchg    bx, es:[41h*4+2]2 a. n  m* T! A1 V6 X, {& ^
    cmp     ax, 0f386h
+ e! g* v) D, m0 T    jz      SoftICE_detected
' k/ l  m( S) I2 c: [( [2 y
( c# m3 h# y0 k2 ~2 {3 D) tint41handler2 PROC
. E! M$ Y4 z" j% n4 u9 ]( t    iret
% \- n! L- {5 \int41handler2 ENDP
4 Y' F4 @" s5 p4 F& T# u5 |. O
+ g8 C1 Z; [4 Q7 l9 c) o* p0 a) Q$ A3 x* a1 f  V6 d1 C
_________________________________________________________________________8 d7 g# c6 G' J; f9 d. Y

1 b) a5 M& E: m! l" E/ ~8 T) Q0 X  j+ s  Y" X7 N, U9 G
Method 06
, L' J8 M* C) G' }6 |# ?=========: G7 x' k9 A  o5 A. e( M0 T
+ Y- e; d* S& ]3 ]' G
3 @3 w* I& N4 x1 d
2nd method similar to the preceding one but more difficult to detect:7 z9 ^( i  p. m# U
; X( r$ J  _( F1 e
. D0 D: p3 R2 V# L  m; G" D7 i
int41handler PROC
  ]# C4 U* z4 t) K    mov     cl,al
# a! X  b, T# c' g# q) w    iret
# s4 `2 j; L# Z" F, yint41handler ENDP% R" @& W. C6 ?. E( [) t
) i9 M: Y, M* o: W5 q, l' h

' M  W) `, @5 b7 Y1 q  u    xor     ax,ax
. n' y( p, a5 N    mov     es,ax
; @# ~2 H1 Y% |" F    mov     bx, cs
5 N6 K( G8 _2 i6 A+ y% x! z+ Z8 s    lea     dx, int41handler
# M# Y2 X# X" x& Z3 K    xchg    dx, es:[41h*4]
. D* I1 j5 g! M8 K' I6 V    xchg    bx, es:[41h*4+2]7 o, c  w, ?% m- s. H7 f
    in      al, 40h
& ]; i+ {5 w: D; W* c. |1 E    xor     cx,cx
% @0 G, h0 }3 s9 U/ G+ ]. V& U' q    int     41h
5 m7 z/ D3 p- G7 C3 j) j" K    xchg    dx, es:[41h*4]% R+ h; e% G) v) }& S" }
    xchg    bx, es:[41h*4+2]
3 R, v# f" f% l. M# c& C    cmp     cl,al
- r4 Z' E# y+ ~9 W    jnz     SoftICE_detected8 Z2 {( a; w7 B: X0 g

6 f4 W9 j' B9 O# B$ t# L_________________________________________________________________________
. A/ u% g' T+ d1 f$ d, y
3 F8 S) c2 k+ r) S0 ?" \6 X% VMethod 07) C# y  D) o7 E7 o) ^
=========5 J( _( K" e* }* `4 C) v& l
- `  F  x0 {1 [+ M
Method of detection of the WinICE handler in the int68h (V86). v+ e% m, X" R

. V  t' K6 B+ v: v- ?) f    mov     ah,43h, a  @6 {$ ^; s+ |, M# N  M
    int     68h3 b3 A3 [8 }' ~- o- k
    cmp     ax,0F386h
9 V, r9 ?* @/ p$ p! G/ ], {    jz      SoftICE_Detected
) z- E" ]* j9 p8 l+ c1 v
) C$ p+ V3 D$ r2 R" Y3 h6 b/ w/ U+ e9 u/ j4 ]4 X7 H
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& a: y5 |; D( |' V
   app like this:
4 q, |) p# q0 ~5 c0 `$ w( m8 [
+ F% C& I$ F, c3 [& d0 U   BPX exec_int if ax==68
5 v9 w* y( J# X# m5 N3 d6 l   (function called is located at byte ptr [ebp+1Dh] and client eip is2 T3 n/ y: y$ L& i
   located at [ebp+48h] for 32Bit apps)
  d$ j6 ~0 Q( M" i" g__________________________________________________________________________) X% O3 @1 \/ P# a' [/ `0 V
3 Z# C, x2 _& Y  z  v

/ P# r. G2 u9 JMethod 08
( m8 G; A  r' V* ?: G=========
$ f# G, y7 m, Y# L: J; ?' \( o* Z3 v+ o
It is not a method of detection of SoftICE but a possibility to crash the
0 I7 c1 g$ `+ C  i8 e! [4 e9 N& Bsystem by intercepting int 01h and int 03h and redirecting them to another7 |8 z  g1 T3 d- E& n
routine.1 M7 `: J1 v8 Z
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; e' F# x% x' o
to the new routine to execute (hangs computer...)
, p3 a4 U" F- Z' L0 P3 {1 D& j% O) n' O  C% B) f. D3 w- a4 j
    mov     ah, 25h& n  [8 C4 H5 [8 v
    mov     al, Int_Number (01h or 03h), G$ j: Y; B/ F; ~" }& v& p$ ?
    mov     dx, offset New_Int_Routine
% d8 @! Q- T" {0 W" ]# O    int     21h5 ?7 `6 ~7 ]8 C% w7 L4 f

2 X1 |1 E" e% U) e__________________________________________________________________________
" \* s8 ?. h( S
6 m8 K- h4 T5 ~; CMethod 09
4 j# l2 G+ e0 _; L, |# F2 U  l=========
* t- T& K; [0 J; C1 {! f2 s1 M8 [' A2 x0 f# P) J% e9 \8 Q8 m
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
' [0 I, M  ]0 R" \performed in ring0 (VxD or a ring3 app using the VxdCall).
* B% I( O' S" y& nThe Get_DDB service is used to determine whether or not a VxD is installed) @5 A0 ^; ]& j7 i
for the specified device and returns a Device Description Block (in ecx) for
1 z  G5 h  W; n1 \+ Ythat device if it is installed.9 S3 R& _! f1 N
) c- r1 Q; A# T7 m2 l8 D" [8 j6 ]
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 B! {& i3 t4 g! q   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! t% T, N6 B& X. @7 b   VMMCall Get_DDB
& u+ o5 T$ i* u0 P$ r% g3 h   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! X. k3 p4 `8 w" u9 R+ Z( s" Y) c8 V8 w  l. l9 f  M8 m, y
Note as well that you can easily detect this method with SoftICE:
* e- `( y2 I) }0 y" I+ J   bpx Get_DDB if ax==0202 || ax==7a5fh2 E: j* q1 \3 T2 A- Z4 c
# s0 x3 k6 e* Z: f1 s  Z
__________________________________________________________________________0 W* f5 t& j2 r3 l+ y- N5 f3 ?
( f# Z' C# z& K+ }) y
Method 10
3 Q) {# g/ @9 b=========. Y$ z! |" N* T& E
/ M2 |3 M$ U% v) D
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- W) U. ~& I' D$ @$ w  SoftICE while the option is enable!!" U0 N. O. x# A. n. x" \7 g
: T- y* z+ j1 w3 C0 q' {% C
This trick is very efficient:2 L: @+ ?8 D( X: I/ `' z6 q
by checking the Debug Registers, you can detect if SoftICE is loaded  m& Y# Y7 N; ^8 o
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if8 k& k& f# q0 r( g7 R5 b
there are some memory breakpoints set (dr0 to dr3) simply by reading their+ W& l- b3 {; @4 Z: Z7 @
value (in ring0 only). Values can be manipulated and or changed as well
7 Z/ Z$ Z6 S- T1 c& u7 a(clearing BPMs for instance)
% C% k  }& ?  C/ y8 [
+ N7 K3 a5 }' O" |0 F# }4 K# {__________________________________________________________________________0 q6 P: Q0 r. Q& v) }5 O+ i2 G/ r
* @+ T' y* C9 M: C: Y9 u9 @
Method 11
! c( T2 V$ `( ^! Y=========
" W" C7 ~, y: _2 ^5 J9 g7 c4 i& g+ h9 {: J' H* e% m
This method is most known as 'MeltICE' because it has been freely distributed
& Y  Y! G+ \+ Y8 Dvia www.winfiles.com. However it was first used by NuMega people to allow
2 F% S1 ~# y" LSymbol Loader to check if SoftICE was active or not (the code is located
" y2 x4 t. O% U% }0 H! dinside nmtrans.dll).. J* ^% w: F) T. M0 p" v

( p5 ?0 ]: s3 q- m2 u; Y$ A% pThe way it works is very simple:6 G* |  [' H0 A8 b
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
9 ]( i4 W& H: K4 V* R9 PWinNT) with the CreateFileA API.8 H& F& @, S5 n6 C& a+ x% z

5 c" z4 `& t* w  }5 Y- R- |* g/ PHere is a sample (checking for 'SICE'):( q( a% v7 s5 ]2 |4 ?

$ x, [9 W% r0 N& G( I1 [$ PBOOL IsSoftIce95Loaded()
0 x" m  O$ N4 K' f4 {  Y% V{
2 p) w+ ]3 t) n0 g, p9 Q, Q   HANDLE hFile;  $ f. }, v8 S. z
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: ^, N, ]" N7 N) _' Z. ~                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 N( g3 |; F% o" ?$ }
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ t9 w; W  ]7 g5 G# w4 n
   if( hFile != INVALID_HANDLE_VALUE )7 D$ B; B$ l- q8 G9 E
   {6 [/ f5 K6 ^8 c9 _0 H4 O. l/ E
      CloseHandle(hFile);$ s  I# M3 ^3 r/ x) N# H
      return TRUE;
+ h+ c; y$ n' K+ P5 L( y   }
4 d( x; |: F9 C4 @" D- I( {   return FALSE;# w5 Q! e' d6 d2 M4 W) l
}
" ~5 |/ L- E1 W) y6 J. V
+ X& I% g& ?5 ?Although this trick calls the CreateFileA function, don't even expect to be- J, z2 ?. N; M% U9 l
able to intercept it by installing a IFS hook: it will not work, no way!
0 k" w! M* Q! d9 a$ W9 F& |In fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 W: k! J. c% o$ B! ^0 I. Vservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" p0 d/ k. c/ cand then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 J- V/ T# P! \6 R  Vfield.  @# d* D4 N9 E2 H
In fact, its purpose is not to load/unload VxDs but only to send a
: e2 B2 k9 r3 i5 \) J2 s1 Z+ lW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 F  L# j7 g& }to the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ `! W. G6 p+ y2 _4 G8 Wto load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ P& m( }+ r- G# cIf the VxD is loaded, it will always clear eax and the Carry flag to allow, O: ^8 N' L% V. G6 q
its handle to be opened and then, will be detected.
6 n7 B' h0 H6 lYou can check that simply by hooking Winice.exe control proc entry point
3 N7 I' R" G) ]! S8 H5 Jwhile running MeltICE.
! F5 z" ]; Q# j
' c) F6 X0 U$ k) e6 R. G& O5 N8 m% i% z" v  E7 D4 F: E0 _
  00401067:  push      00402025    ; \\.\SICE; @# L  G# ?$ ~" {; z" B
  0040106C:  call      CreateFileA
& R* \2 `$ d: L  00401071:  cmp       eax,-001
  E, t0 a4 @2 l, j  00401074:  je        004010916 \: ?" K4 t$ f: ~

( c) |  }# V: M4 b
9 a0 u6 [+ D9 d7 S/ X+ ~3 ?( r0 AThere could be hundreds of BPX you could use to detect this trick.0 ^$ N+ Y( H3 d. x
-The most classical one is:/ _& n4 [( q  o8 S5 F; w5 y
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
0 U& @& q6 W, g4 v6 `% X    *(esp-&gt;4+4)=='NTIC': H; [- t! P( b: Y: ?* b# L

9 K/ W0 H. P1 a$ P- v9 t( X-The most exotic ones (could be very slooooow :-(8 u9 `! C3 W) o$ |$ g, L- Z/ l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- Z0 w2 ]! o2 a& V( l4 J     ;will break 3 times :-(
! C3 Q. u! E2 E' T% M: O# s9 p( j' A2 d" R' i& t( |4 E
-or (a bit) faster: 9 i& n- _" b. R% {# Y$ {7 ~, k
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) O* N* X: T! `  _7 e3 P8 P: z
* ?/ k  q( W) G, Q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
' v1 z% M9 Z( y! Y2 s  }     ;will break 3 times :-() }0 i) {4 l1 \
8 J/ r: ~. |1 x+ B
-Much faster:
/ u$ ~5 u8 Z3 `: {% q  @   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 M4 L- o3 p" G5 w9 J5 e* B6 @
( G# m8 J  B2 g; F
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. i) i1 T# D- j! Y1 i7 f, f5 Afunction to do the same job:5 a3 k( V/ d2 E+ F

7 C5 }! I% r2 X" M0 [   push    00                        ; OF_READ& q0 L; y9 W6 M8 _! B& n
   mov     eax,[00656634]            ; '\\.\SICE',0
0 o8 D) m& Z: m4 o   push    eax, C; F6 z! j- \0 m- T% u
   call    KERNEL32!_lopen2 ~, J! _9 s% ]7 {
   inc     eax+ q  T7 j& A- n- v3 D
   jnz     00650589                  ; detected
2 g$ y1 ~6 q  q1 f0 p   push    00                        ; OF_READ
; ]  a, A7 T! H9 e8 Q" s% {; {) p  \   mov     eax,[00656638]            ; '\\.\SICE'
; L( K. O5 V. J/ [0 k# A) T  @   push    eax
7 u( L- `' l0 d/ l! \. s   call    KERNEL32!_lopen
& {* n1 |$ n( H1 f, E' K5 E# |/ I   inc     eax% B8 w7 ]( _5 F
   jz      006505ae                  ; not detected
; p5 f0 o8 E6 Z$ w* f2 Y8 G; Z7 O9 u9 z; A3 s2 E

% R4 y8 S. N$ U) r0 C7 f, S# w0 V__________________________________________________________________________
7 i: ]9 c% K7 H! l4 G" H$ `; Q+ @8 T, T2 u
Method 12# _9 o& ]6 z8 U! s3 E* o4 N
=========3 j4 d2 u6 N% r( \8 _
$ R: W" U. @* w1 n  B% I
This trick is similar to int41h/4fh Debugger installation check (code 05
2 V/ I6 a- Q% @- o/ ~&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ ^* F# K) v9 E5 @, n1 Uas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
5 H* P% x0 e8 o- i/ f$ G1 s4 O9 `$ p$ I, J3 A, T, _
   push  0000004fh         ; function 4fh
) [, \& M5 U2 f( f) _) }/ r   push  002a002ah         ; high word specifies which VxD (VWIN32), H# I4 W; Q- d" M0 j  M
                           ; low word specifies which service) Z: [3 Q# ^$ L2 D* B! s  N. k, o! B; \
                             (VWIN32_Int41Dispatch)
5 n7 j8 Y$ V* }) [   call  Kernel32!ORD_001  ; VxdCall
# g( o: O5 b% [; D4 L# L   cmp   ax, 0f386h        ; magic number returned by system debuggers
! v! J* p( G1 y4 }$ C, z1 y   jz    SoftICE_detected
; u+ w- z1 Q6 d4 l, [  u( q" S% K  ^1 f9 F. w5 f3 X5 h1 \# C5 l
Here again, several ways to detect it:
- G$ S1 J1 C, Q3 _6 T1 M5 y1 [3 L9 ]- {# V4 x& |) o( ^. S
    BPINT 41 if ax==4f
/ v+ v& y( Z" U: [* J3 m; M/ l- \- n" J$ q% y& B/ ^
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" v) @$ V0 V0 Z0 m  ~
! [  E& C* Q8 z$ _4 ^    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 H6 c% n. d) v( X
0 K4 f5 b3 V" X( {, z. S1 h    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# p; P- W$ v' O
' U/ T0 J. A- I* _0 M) T- w
__________________________________________________________________________
% Y, K8 K& C4 I" k5 K3 R) J& P! R/ [; M0 U* B
Method 138 y4 c  |8 n& o  Z; i' D% L- G: ~
=========/ w9 v# h+ z6 r3 K! X
7 L7 ?* W% U6 d1 r
Not a real method of detection, but a good way to know if SoftICE is$ D, ~- o" V* r; Y0 N7 B& b
installed on a computer and to locate its installation directory.& f! j1 M% P8 [9 f' W
It is used by few softs which access the following registry keys (usually #2) :% L2 f' @( r+ H, `. e- C6 Q$ d& ^. y
" s$ b) y- E! ?( q! }8 \- k( ~' d* [* [
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: R7 @; X0 q! |1 m  @\Uninstall\SoftICE
/ g: j- G$ ^+ Z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE3 W1 A3 _  X5 ~% j
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 ?2 ^5 G' Q, H8 N0 g\App Paths\Loader32.Exe
; ~8 e" l; d& |* J7 s$ Q; [" v+ p; J) e) S. F/ Q  e' y# G, A

0 f9 r3 {  c5 cNote that some nasty apps could then erase all files from SoftICE directory$ h4 `, \* c: |( c/ j- E
(I faced that once :-(
5 N1 u  y9 C& l2 {& N
+ t  V( T2 c" l! T. G# C4 }Useful breakpoint to detect it:. l, q: a/ ?+ E# C: W
  A# v* t  d  h" s
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& i3 O$ @, R6 I& @( d0 z( K. c

! o1 N1 ^( p# P" G  Q" N9 O5 e__________________________________________________________________________9 \. b$ q) g/ i" t' W3 E, F9 [' Y

3 X& @; x3 B- g6 R$ t' X
8 B% h9 j: R& P3 K5 P  ZMethod 14
- J9 f9 n, Y7 t, H=========
; W& e7 p+ C6 v0 t! l% A! w6 `6 }6 y9 w0 O' W) R
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose5 v+ t, [4 @1 [" u0 P; f
is to determines whether a debugger is running on your system (ring0 only).# Z/ _  a+ i2 W8 q
0 H1 y  v/ N$ I* X
   VMMCall Test_Debug_Installed9 E5 W$ [4 J! }" d
   je      not_installed, X2 Z: |" ^, v0 I$ C; [2 z
! e# F9 }- Y" A
This service just checks a flag.
' N( m+ i9 g3 S2 G% f4 r: U</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-19 06:05

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表