About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' k- O7 @  P. `" |2 A# A3 d5 c+ d<TBODY>8 ~2 j% p. g0 G( X
<TR>
! v# _, j& V2 v<TD><PRE>Method 01
+ ?+ I5 V$ s3 v+ I# ], K+ E- [4 B=========2 z6 M2 e2 v' @" G7 i
) s, ?) O6 z$ q- z4 i  P; i$ Q
This method of detection of SoftICE (as well as the following one) is4 h' F4 D5 y8 b5 C  G- m; o+ ?, r
used by the majority of packers/encryptors found on Internet.
6 |, \2 W3 j' F% K4 F. RIt seeks the signature of BoundsChecker in SoftICE
" k: E3 B+ C) M7 P6 L- R9 A' \
* ?1 |- s- ?9 i7 Z  \* ^# Y    mov     ebp, 04243484Bh        ; 'BCHK'
, t& g+ G0 O3 s9 B' }2 o7 m  }8 @' m    mov     ax, 04h
: y. p! V9 E- f    int     3       ; F  }. r% r1 F& L" ^
    cmp     al,4
. L/ M' U' I# x+ c) L% ^    jnz     SoftICE_Detected
; o! q# G6 c* c$ `+ G5 r0 H4 m# s! R, P3 Q& \
___________________________________________________________________________. W& M- l* `4 L8 n% _3 E2 j! b

/ X$ r0 Y/ X; F* m$ \, UMethod 02
2 a5 A* H( r* H4 e=========
6 h7 ?' h0 G" d8 ^9 F! F" d6 g9 [
7 v/ Q" O6 r+ p( J) `Still a method very much used (perhaps the most frequent one).  It is used
$ L4 I3 H6 Q0 n/ |6 _6 P/ H8 G( ~to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ k+ e0 n( ?9 L  Dor execute SoftICE commands...
: r" J! Y- F2 L. OIt is also used to crash SoftICE and to force it to execute any commands/ q& B3 S# s- B" u8 N
(HBOOT...) :-((  
. w( k1 i9 A3 A6 H1 k& Y$ r" K: a  A/ {1 E
Here is a quick description:1 Q8 J# r& f0 g; J7 X& n
-AX = 0910h   (Display string in SIce windows)$ j. v0 D/ f0 W6 R2 t% o
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)# b  n3 f* q# u8 h7 g2 H8 K+ z6 m9 x
-AX = 0912h   (Get breakpoint infos)7 h, ]* F6 b4 N: [* G
-AX = 0913h   (Set Sice breakpoints)/ `- z5 X0 N+ D7 ^* a
-AX = 0914h   (Remove SIce breakoints)
9 [8 v9 f- C! ^
9 C8 j2 c# h! d: a0 ^& Z" X) ^Each time you'll meet this trick, you'll see:
* n% W2 F9 j# L-SI = 4647h! L' f) V; ^' d1 E# `6 A8 J. f
-DI = 4A4Dh
0 M$ e5 v' s$ W. X0 yWhich are the 'magic values' used by SoftIce.
# C! W5 A4 K  i4 Z* a5 q4 sFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% _* A2 f5 ?" e, }. F  S# E, G8 V" w

4 i' G# B( x+ `( N' n$ }Here is one example from the file "Haspinst.exe" which is the dongle HASP: o- q  R( i' H
Envelope utility use to protect DOS applications:
* I/ }; J5 f! ?$ w( g
( r) D+ O) I; E6 Q! j0 w
7 o' o  D# q; Q7 }/ F2 {4C19:0095   MOV    AX,0911  ; execute command., W! U/ R& E( H$ E+ K- X
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- o6 e) }) S; B1 \4 z8 `
4C19:009A   MOV    SI,4647  ; 1st magic value.9 D2 e8 T" i8 L% E* A# s' J) f  B
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.6 ^) j2 b+ V# E" i
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
* ]% u$ R& V3 p2 j4 M# {% J% R4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 X) K) z( C( S" p* ?5 I( V4C19:00A4   INC    CX: P4 p( ]7 G; r" e! C0 f& G9 J
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute  h5 C( p$ G9 Q: k+ r6 O1 I# K
4C19:00A8   JB     0095     ; 6 different commands.9 x8 I* G: U. g) d+ z
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
+ ^! Y* U9 V& w; q, J* n0 W4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
! _+ Q) M8 X; m4 m5 F' ^" M
0 G5 a: \9 o/ a: C7 v: E( h, }; uThe program will execute 6 different SIce commands located at ds:dx, which
" T6 C3 T. T! ?; ~are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
/ q3 H0 X" c6 J% [* i, |1 I7 `% ]7 R8 G% K1 ?) Q# F& F. F
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.6 i$ G) @' ?9 m: Q
___________________________________________________________________________0 p. {4 _( E- J: Z
; M# `7 |( d3 Y6 F

" w- s2 }6 ], n/ S. {, U9 m. [8 C& oMethod 03- o# x: i8 V4 F6 b# P
=========
# I) ]8 W3 J$ D8 R' @) L% w1 y5 ^+ Y8 l
9 ?1 S# I( ^& ]1 m+ _1 N% `* U: g5 ULess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 k3 j% Q; I4 ~. }3 ~; V8 g(API Get entry point)  J7 e2 `$ f& L) v2 E7 u2 E0 |& z
        
' P' T' i+ n# Q. G% f
( }1 L! C6 C$ I; m2 q    xor     di,di3 R+ ^. J$ ]9 b# r; `; U
    mov     es,di
) n7 C( \  Q4 c! z    mov     ax, 1684h       " V# K2 g) b8 h2 Q; H
    mov     bx, 0202h       ; VxD ID of winice
9 u' G+ i, z& x1 V    int     2Fh* \7 t) F/ e4 O6 Y4 g& D5 q! V
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; H' ^% W. U+ o3 D1 E5 `
    add     ax, di
) ^' ]1 y4 U& s) k: S    test    ax,ax
1 E2 t* `7 Z" D& w3 f  Y+ D, W    jnz     SoftICE_Detected
6 i. p  U& I" _1 V# R2 t
% }8 C& o4 F. Z9 _+ S7 y- F; S___________________________________________________________________________, a5 }; ?! O  z! z

/ [6 }+ c& S. b- ]; p& DMethod 04
6 M/ z7 |) H4 T7 V2 ^2 n) H, \=========
. ~' I% s0 U$ }3 M
0 c$ U/ `& f% S- U# D7 B. Z  J' CMethod identical to the preceding one except that it seeks the ID of SoftICE
) ^( r9 M/ ~9 E: N0 @4 BGFX VxD.8 L9 P3 B2 p! W* I4 E6 z
$ }3 R. U( p# k& G* h- Q3 d
    xor     di,di
5 d, Z$ E4 R9 M1 b: S( S    mov     es,di
' P! E- K/ N' m. A7 M1 s    mov     ax, 1684h      
, s% O" X2 x" l9 }! @    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, y. w: F1 b( I4 p* V" h    int     2fh
- E( M6 C- G. W    mov     ax, es          ; ES:DI -&gt; VxD API entry point* m) O3 U8 S3 g6 W+ A7 e  P) }  n
    add     ax, di
: }, c. g* ^1 z$ D8 Z    test    ax,ax
; |8 v4 M, }9 P    jnz     SoftICE_Detected7 c/ s* u" G9 g2 E& J9 {/ p
# q% X5 t- O0 K6 n6 X9 m* X
__________________________________________________________________________: v! O+ i9 N' y
; u  I$ c. {) k3 h5 C) [/ w

+ ?* ~9 V1 B8 e; _  J6 T' m: FMethod 053 \4 P9 m6 P% w4 i
=========  u2 k0 g& i/ X+ v

( {+ H* E/ j# C3 jMethod seeking the 'magic number' 0F386h returned (in ax) by all system
/ ?3 S8 ^; k% [3 \3 z( Tdebugger. It calls the int 41h, function 4Fh.$ _: i* k6 |6 S4 R6 }3 R3 E) ?
There are several alternatives.  # ~" n& H8 E% J" w, Z
9 w$ O+ }8 C! f$ O* N2 d
The following one is the simplest:
8 Y! v2 C/ e2 D- k/ V3 ^; I' p1 [- H7 y" k, `0 s
    mov     ax,4fh+ Q: C6 ?' t6 R. d0 [# [) Z1 G; E% y
    int     41h2 g2 G2 p/ _. y
    cmp     ax, 0F386
. X, K3 a& @! w1 w/ V/ L# G    jz      SoftICE_detected, s+ r1 g" l8 @+ p' G
0 C: T1 k2 _, r. |4 ?1 h: C
4 @* p1 U) Y# Y! X
Next method as well as the following one are 2 examples from Stone's ; x& c1 w. N( a
"stn-wid.zip" (www.cracking.net):; ^1 D' C" P" j6 g+ Z# L1 _
9 C: s5 s$ x1 b2 w9 p2 S0 \
    mov     bx, cs
. L+ j; L% R: p    lea     dx, int41handler2
  T+ z/ H1 {9 z$ l    xchg    dx, es:[41h*4]4 Y5 ^. h8 E8 p5 M  I* T+ l3 y
    xchg    bx, es:[41h*4+2]( c* v! C6 d, {
    mov     ax,4fh
8 F/ t) m, ]9 e* W' c5 V8 C    int     41h
% `5 T8 {) t7 u    xchg    dx, es:[41h*4]
& {, K$ |) C8 j- X- L8 Y) {% p, S    xchg    bx, es:[41h*4+2]4 m. N7 d# R4 S- q9 a
    cmp     ax, 0f386h' y: G4 U7 ?. a
    jz      SoftICE_detected& A8 q7 r5 I3 c4 o+ y
1 }! D+ y) S6 s+ D; J4 ^
int41handler2 PROC- t$ |9 j8 Q) o; `8 K! M2 \
    iret
7 p. Z  F, C2 D8 d9 Lint41handler2 ENDP# f) F2 [& ]. `/ a. C
0 D* z( S$ a8 a3 c% a# e
* v, m! D! ~, N
_________________________________________________________________________
+ t3 B! Z- P) r* {7 |3 T  ?. N5 [1 [2 c2 f, b

- o1 c* S( |( }/ _; e5 ]Method 06
3 K) c) |% }2 f=========
7 m7 H+ @' ]# r$ A& M" ?( s
# ~: f3 E, ?4 j: O( q
: K# v- z: U( b" M0 y+ y' o2nd method similar to the preceding one but more difficult to detect:) n% c9 F$ g; K( q5 X. ]' Y' u3 L4 I
' x7 x$ S' g0 s4 h; ^' C

* m6 [2 `1 u6 f% n  |$ |7 iint41handler PROC
: `5 M3 R, F# p+ ~4 }+ x' S$ d: \    mov     cl,al
9 j* H% n! X$ H  {/ F    iret  s9 ~  R6 d3 t9 k+ J! d& {
int41handler ENDP
; K2 Q' d& `8 h- W; T* q, t/ J) I& |2 o2 u% O2 R

- y9 C4 f9 Q0 [# e9 G    xor     ax,ax& a3 f- l% d- a& z
    mov     es,ax
5 c0 X, X# v4 t" L3 z: n* h    mov     bx, cs
! D7 A0 f- ?4 ^4 l2 w    lea     dx, int41handler0 X* q2 p7 l" u2 h! T: v& H
    xchg    dx, es:[41h*4]9 m* H2 [2 \6 k+ a" S4 k" o9 U
    xchg    bx, es:[41h*4+2]- i+ w& u7 s, q1 N; b1 U
    in      al, 40h( X) o8 o) t/ M# g. Z; J
    xor     cx,cx) Y# K/ _' t" Y8 O- u* C
    int     41h6 f2 B* I. X# c
    xchg    dx, es:[41h*4]0 h" u! Y2 [0 u+ k) J
    xchg    bx, es:[41h*4+2]% O) [' m* x: I7 `4 H1 \
    cmp     cl,al1 Z6 H* d3 p, m: b7 W! {! m
    jnz     SoftICE_detected+ t/ m" }( ?# ^  g
4 s- s$ V7 y; _- C: `/ O; Z1 w
_________________________________________________________________________
" }2 W: g  N7 ~5 a1 w& C& z) p- C# H4 t/ q
Method 07( L% M& A  w4 f
=========' J+ K1 F* @: ~( U3 X: e

# B' p: J- d# O7 ^6 M+ X+ ]Method of detection of the WinICE handler in the int68h (V86)
+ F" |- s: r( Y5 M' {) h5 s
. r  B8 z* x! I    mov     ah,43h
0 x3 b0 h1 g, W, ^" U    int     68h2 ?  {% a% K6 ^+ ?, o" ]8 `
    cmp     ax,0F386h
$ F8 |. ?7 D7 Z" D7 s' J9 D% e    jz      SoftICE_Detected
6 ~  b8 q' [1 w  s  ~8 Z4 v
2 X& ~: z) a: k# l9 P
1 D  K; Y3 b4 ?3 k8 ?! P) k" N( A=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit. D9 C5 l) P! x0 w( _
   app like this:
# D3 ^8 Y% p) `. @2 {1 q0 g4 d5 x% ^+ ^5 j6 l7 l/ }) T8 l* H) v: T3 G
   BPX exec_int if ax==68
9 ~$ P2 e6 E8 |  S- ^   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 q- W" N  H$ B+ e1 Q# s9 W4 O- L   located at [ebp+48h] for 32Bit apps)5 \9 c  n' Y% e
__________________________________________________________________________
  \1 p0 W! d* m# U$ X4 W4 n( e+ C' s; O: a
9 J. A  k8 n9 y1 K( W) a( R+ O% N7 H7 R
Method 08
8 S$ @, U* ]$ }& e$ I5 F: [3 d=========
& r/ {. [, i9 F" z9 |. L  ?$ c2 b6 O/ @: Q# |$ a% j
It is not a method of detection of SoftICE but a possibility to crash the% G; I! I0 s8 f$ v) H* I
system by intercepting int 01h and int 03h and redirecting them to another9 L/ f# n9 o4 @- M8 B: b0 s
routine.) ]7 R3 E' @6 V( n9 l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
8 \4 m; R7 q# T; J" S9 k2 rto the new routine to execute (hangs computer...)* ?5 d% N, ?6 ~
/ J5 M& d) ^$ a# h7 }
    mov     ah, 25h5 Y8 f/ n1 w* ?; }" n
    mov     al, Int_Number (01h or 03h)
, s( q- r3 s3 [8 k    mov     dx, offset New_Int_Routine
6 ^0 Y3 l- E8 M    int     21h/ `2 r  D: {1 Y/ w( U7 S" T$ x6 w
8 Q4 f" z1 @; o: d( Z5 `: U
__________________________________________________________________________
% X: Z& q& K& o9 W6 {8 I$ `* K8 ]4 T
# E1 |2 I/ ]7 ], N+ cMethod 09( T% g8 m, [0 n8 b
=========
( B8 }5 H% c# b. {- f: [& c& z+ P- G. @+ L6 A
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# O6 ^$ f+ J2 a; J, ?3 e+ N) {performed in ring0 (VxD or a ring3 app using the VxdCall).
: ]2 T+ u6 T& p( X% ]/ O- p5 ^The Get_DDB service is used to determine whether or not a VxD is installed2 ?! Q" S, ]( k3 ?5 a
for the specified device and returns a Device Description Block (in ecx) for
9 Y' e8 G% M: e' s7 m0 S: O, t1 {that device if it is installed.
% R% K0 I" I% |
/ c' o" o5 r1 C6 ]) S   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 s1 n$ p5 a/ s5 b. Y3 Z   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; I9 R7 T3 h& S. W' a' H' A   VMMCall Get_DDB0 I7 T7 G& d5 o( H
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# ~% F+ N0 Q, k$ U2 I+ Z3 t

9 A* U8 ?1 p, O% @) F6 X1 h; CNote as well that you can easily detect this method with SoftICE:
- y( m5 R8 [  l3 n, |& C" }) V   bpx Get_DDB if ax==0202 || ax==7a5fh1 g" `5 m% E" Q0 t0 E) h/ v

/ f  r7 i; x# n! k3 i5 u__________________________________________________________________________
7 R$ Y4 q# R: J3 w8 _
5 T( V6 w0 P9 Y$ E, o% ?Method 10- K7 Q: |8 ?6 D% `# w
=========
! b7 P) _9 t0 \  X0 ?% D3 v' w1 L' H& U5 Z1 R$ S- [
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with# \" ^" W, \- w' s2 Q
  SoftICE while the option is enable!!# R! \) ]2 M7 z
2 b( ], w8 j2 D2 M
This trick is very efficient:
! y# v% t9 u& U3 x1 G3 d0 rby checking the Debug Registers, you can detect if SoftICE is loaded
& c6 ?5 A& `$ |/ ~* {$ @6 n(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" j0 o- W+ P, Mthere are some memory breakpoints set (dr0 to dr3) simply by reading their/ L2 s4 R; k1 [5 @
value (in ring0 only). Values can be manipulated and or changed as well
7 a3 v4 f! F6 a$ l(clearing BPMs for instance)
- F# j/ W0 B6 u8 ?% e( F2 ]/ ?0 R) \2 u+ o
__________________________________________________________________________
& p+ P" X9 E/ ~4 v5 D7 [9 G8 q
1 e; q0 t! M# Q4 @) ?; E  @Method 11/ g. M, f* E! F# K) Z4 X
=========
+ d7 t! @7 ^: c5 l3 f: F# T/ }4 R
+ L- G7 P+ t9 Y& |This method is most known as 'MeltICE' because it has been freely distributed5 U4 V& m1 R3 K9 e, `
via www.winfiles.com. However it was first used by NuMega people to allow. H) B6 `2 w. f" c( N
Symbol Loader to check if SoftICE was active or not (the code is located
0 O& m5 R# o8 }6 o# {inside nmtrans.dll).1 Z, d! }! h" a

$ B- l* K6 r, u7 pThe way it works is very simple:
& A/ |; W  N5 {9 J8 \It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' d6 o  E$ \. ~* j7 n7 }
WinNT) with the CreateFileA API.1 I% F, \6 D% n; y/ q
' t; d, B; F) j: a0 X2 T9 H9 F
Here is a sample (checking for 'SICE'):
1 T* I( Y; E6 K4 ~5 w8 I" Y8 v: ~- r, e/ L
BOOL IsSoftIce95Loaded()
$ ?: C) `4 {9 n9 e  }{
) P, L* y  C4 o5 w   HANDLE hFile;  2 X- J9 c1 @* H
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
" ?# j) E5 V( }; A3 o- R                      FILE_SHARE_READ | FILE_SHARE_WRITE,2 B' N* O" R6 i9 E
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 F# }2 d5 ~7 y
   if( hFile != INVALID_HANDLE_VALUE )
: K5 U% A) l* ]6 x- c& V( {/ I   {' G& h5 f; g; f% @  _
      CloseHandle(hFile);4 G- D# j  a, }. o2 p/ V+ j
      return TRUE;/ Y2 U) u, M1 \# K
   }( c, T/ C+ ~3 W
   return FALSE;: d3 U1 m3 N2 j" ~, F
}
# ]5 S* Y: a1 D; M' a
: g& o2 D3 T' e) d- G; T( G8 VAlthough this trick calls the CreateFileA function, don't even expect to be6 Q0 W3 I( w+ }0 q
able to intercept it by installing a IFS hook: it will not work, no way!  H5 \' L0 i% q7 k! e* v' X
In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 j* S9 \# q0 b' s& e& s3 n7 P# M
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function), ~) }8 u8 t+ [! E( q2 n
and then browse the DDB list until it find the VxD and its DDB_Control_Proc4 P; Y5 \3 u( P
field.+ o# v; [# c% T7 a' {6 W' c
In fact, its purpose is not to load/unload VxDs but only to send a 5 p0 \% n5 V7 A- |( k$ f# C
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. z# @) W3 C2 h# x3 Q7 `% hto the VxD Control_Dispatch proc (how the hell a shareware soft could try
% n3 `: w. [$ Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).1 h. s  Y/ y# s9 ^( C' j
If the VxD is loaded, it will always clear eax and the Carry flag to allow# J0 Z& a8 p  o8 e1 ~
its handle to be opened and then, will be detected.
. D4 \( R# u  {- MYou can check that simply by hooking Winice.exe control proc entry point! v; `* F7 {3 U7 k! N0 c) Z
while running MeltICE.2 x! q# t$ ~3 v6 l

; M/ g& o) m! L2 a6 E, m
) B$ R' z; S# b$ R( F: G  00401067:  push      00402025    ; \\.\SICE
1 a9 l1 R0 P( z3 e8 y- {; U  0040106C:  call      CreateFileA
+ E2 l( E# D5 ?5 P4 B* b  00401071:  cmp       eax,-0014 `3 n* Y6 p% F6 Q$ p2 X: i9 J: f
  00401074:  je        00401091
2 Y$ c1 o- V) I. {/ \2 ^1 i( i
0 X/ u0 d- t. k) d% x
- P7 u4 z6 |" Q! fThere could be hundreds of BPX you could use to detect this trick.
, a3 ^  Y, h9 e-The most classical one is:, I/ |% l4 v3 w  W6 n3 ^/ U1 w
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; ~2 B: P3 T) r2 R, q( c1 i6 V# f
    *(esp-&gt;4+4)=='NTIC'9 E6 x7 b: Z/ D$ i, |& R

, y7 t& X7 ?, A( k) B, j-The most exotic ones (could be very slooooow :-(* V0 V2 G0 ^- H/ e2 F0 l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 l5 S  x( q; i; y$ z
     ;will break 3 times :-(
1 C+ B, R3 J, Q2 l! I
3 [3 J0 e" ?) t' h& U  Y-or (a bit) faster: 8 B  y% w# u) e$ A) p
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 Z5 I" J/ U4 |4 J. p. ]; G5 E
3 @6 }7 M4 v; \1 R2 ]
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( i& }4 t2 q% }8 v! t2 Q+ R
     ;will break 3 times :-(
" K' c! ?* x: `: f  j9 c
* p# J/ Q% k) [: C; @9 i-Much faster:& g3 i* J& b6 `
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 r) r& B- d3 \( y5 ~

8 R2 ^2 c$ j4 o3 B$ s: S4 ?+ I) BNote also that some programs (like AZPR3.00) use de old 16-bit _lopen6 G7 c# j( O& L0 p
function to do the same job:
( C% U& H* k4 j" c: o9 d
) h. d2 n+ k1 M5 v! n# D" Z6 R) C; u   push    00                        ; OF_READ
/ j, x2 c- o5 X7 M, `6 a   mov     eax,[00656634]            ; '\\.\SICE',0! x' O! A; m8 W1 w
   push    eax) [* ~( Z9 Q' g5 w' L4 \3 Z% R- T: b
   call    KERNEL32!_lopen$ t$ `; l' J0 S) t; l, f% U. Q* v
   inc     eax
8 Q2 i9 Y9 [+ U. ~$ d/ A. ?7 A8 u   jnz     00650589                  ; detected
- E4 o) I5 a' F3 {- J- P" v   push    00                        ; OF_READ
- O8 s! x% `5 j   mov     eax,[00656638]            ; '\\.\SICE'  h2 f6 [2 D/ J% z. d5 ~+ s6 G
   push    eax
! M) G+ k/ e* C   call    KERNEL32!_lopen
. x9 O4 @3 a1 n+ m  x# V   inc     eax; _9 ]8 w6 `9 t3 `' P+ w+ M
   jz      006505ae                  ; not detected! L, @) h9 K9 g. E  W: F+ |: t

/ G& `: d2 l$ K3 E7 l
/ g% Y; h8 k3 g__________________________________________________________________________
3 c7 F2 Z( r; \8 `3 V
6 a) F8 N: h; @+ T: DMethod 126 e1 E5 @" Y( \  |! i8 J% F0 n
=========8 y% o9 r$ A8 W
) Q2 G( {, h- E9 x1 F
This trick is similar to int41h/4fh Debugger installation check (code 05) W9 E' F* m7 V
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ Z  c9 Z, W) _5 t* f+ has it uses the VxDCall backdoor. This detection was found in Bleem Demo.* n$ x! `, _* D& X# E
2 K( q: G: Q0 T. s% J( }0 f
   push  0000004fh         ; function 4fh
  S% p3 m# B4 _1 Q   push  002a002ah         ; high word specifies which VxD (VWIN32)
9 P& e" D1 N. N; A+ ]' x( |$ h# L                           ; low word specifies which service
7 ~3 E) C$ n/ T( v7 Y' a                             (VWIN32_Int41Dispatch)
. }* O2 p& l( v/ P+ A! a! _   call  Kernel32!ORD_001  ; VxdCall+ b/ W5 ~9 x" G6 ?1 d+ m
   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 y9 j8 O, X) e   jz    SoftICE_detected
! K" p0 g7 ]- W0 i5 n4 [1 d1 A& {1 r' }. A
Here again, several ways to detect it:2 Y) A% R/ L5 G) {

5 x- h2 M3 b$ F3 T' _4 R0 b  p& x6 L    BPINT 41 if ax==4f
& A, n* i9 A% ?/ X" G$ a' L
4 Q/ x+ P. f# {( k3 Y- W    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, o2 n7 K- P- m0 i6 x
2 C# i6 i/ c+ k0 ~4 Q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
+ M' W! b- M4 K9 j  a8 k
1 B  h' V5 [& f    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 g/ _' @$ y6 u$ K/ @5 c4 |/ r+ _7 H
__________________________________________________________________________
3 F2 f9 n1 X( y6 i. J% c" f
5 Y( I  b) K8 o1 PMethod 134 W6 {, m) n5 V
=========! \; K- R( U. e8 P' `7 F/ ^( v( R( L

, \4 l7 m0 {1 J/ g; Y8 Y; KNot a real method of detection, but a good way to know if SoftICE is, P( h; k* i& X3 w4 J& o* K/ C
installed on a computer and to locate its installation directory.
' t/ L) \# O5 i, F; d% f: W! a4 @It is used by few softs which access the following registry keys (usually #2) :
7 B/ G: @5 a; L7 B/ w2 o
+ e3 x, J9 S1 J* e' ?0 E0 B-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ D3 I3 D5 W9 `" i: D) M7 r5 X\Uninstall\SoftICE
, C% m! Z. j& y* K  l0 n-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
1 }$ C$ }) b$ G-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; s. H# W' {4 m" P" I\App Paths\Loader32.Exe- @8 M+ j( M& B2 m
+ [) f: i9 Z. A& A0 i

. Y6 E) q! J1 Z2 _3 ^Note that some nasty apps could then erase all files from SoftICE directory
& U) e, F) `" m! s(I faced that once :-(
! W9 w! Z$ f5 P0 E% J9 Q0 y7 h& t0 w5 G5 V7 o
Useful breakpoint to detect it:
9 A3 Z) y! D3 `. C/ u
& |: r. Q7 k1 Q/ y5 l5 G, W9 Y8 b6 a     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'/ w/ u% X+ q) Z% F7 s

" S" b) D0 _9 A! c__________________________________________________________________________
/ h4 a1 \' x- x+ G' }& ~! D- Q; `9 a- [9 J7 D
/ k4 \  u4 f: ^6 u4 q2 W, j" b
Method 14
4 _9 t% ?6 {) i1 Q9 `  R) I=========; b7 i8 }' J' C8 P% C- S- N
! U4 L+ I% {+ m: ~
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 }# y6 \1 @& j: `- e! J# T+ ~
is to determines whether a debugger is running on your system (ring0 only).
6 v) x+ F" n: ^
5 `) ?+ m0 U  p   VMMCall Test_Debug_Installed
- d5 D3 m5 y- X; P* B' a' X, v   je      not_installed
' q7 T$ l( F, V& }! o" v
0 s7 Z8 N  w2 Y  I, `8 _  v9 wThis service just checks a flag.
( s: n. L# l' Z+ \- B* Z</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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