About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 `# ~, D3 {' z
<TBODY>
5 M5 D" ~8 }8 }3 s$ e<TR>
+ [8 n1 H: e6 z' \3 p$ i( n<TD><PRE>Method 01
0 o1 u; k. g/ Y; B=========
1 J1 p% Q, c" ?! l5 K
9 r. X. |2 y$ XThis method of detection of SoftICE (as well as the following one) is5 w4 K$ U) a! z4 `2 w3 o8 I& S: L
used by the majority of packers/encryptors found on Internet.
" W# M5 M1 ^3 \, F6 b/ BIt seeks the signature of BoundsChecker in SoftICE
9 o& Y, r; `! G8 t, a$ v
0 c8 K% g4 V' K  D* g2 u# Q    mov     ebp, 04243484Bh        ; 'BCHK'
: q) c6 @3 q! N* U8 u4 _    mov     ax, 04h
4 [$ M* R* H6 V9 |! |# K    int     3       4 d; a, K2 H6 W9 ~# O2 F2 K
    cmp     al,4
8 q" x% k' i/ X5 P% b7 N/ z* c    jnz     SoftICE_Detected
) w) N) h6 l  O0 k3 B  n; V3 R  X  o3 Q7 _* m0 O
___________________________________________________________________________
/ A- u% Z  C5 Z2 d% M  I1 u( l0 W
( ~& X7 X4 W2 w' i" r% |Method 028 R1 P/ j2 }# j0 I$ u" R) I3 ?2 o
=========5 G& q/ H% ~, g6 m" F
' V. Z7 O( N& i( z% B
Still a method very much used (perhaps the most frequent one).  It is used
: U) k3 x  o3 d7 ^to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ ?  }4 G0 ?5 u* }/ D0 A, F  o# \or execute SoftICE commands...
, f4 w+ E# _5 g# CIt is also used to crash SoftICE and to force it to execute any commands
: ]5 a. s! o  v  d3 r# |; J2 [+ g) Y(HBOOT...) :-((  ; q# h: D3 x9 ]: z) y1 L

4 S$ e) A8 {$ \* T* S+ y# h9 ^Here is a quick description:! z# q' O2 [/ z% M9 ~% j
-AX = 0910h   (Display string in SIce windows)
7 y6 G) r0 f! T' b, h3 }* l3 C-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
' J5 p7 H; O5 I1 b-AX = 0912h   (Get breakpoint infos)' H0 G$ D% r5 [1 c8 v" a' I
-AX = 0913h   (Set Sice breakpoints)
$ L0 C4 T6 t) o-AX = 0914h   (Remove SIce breakoints)7 S7 f  N9 y# `+ i7 D, g/ }% M

" V& r) w4 E: K# [2 i: KEach time you'll meet this trick, you'll see:# `9 \. [: r2 m
-SI = 4647h
6 s3 W4 Z, O5 U-DI = 4A4Dh0 K8 H4 B- c0 M8 o: J: d% X
Which are the 'magic values' used by SoftIce.) f# z9 ^7 S: ~5 O- i. l
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
: G. `4 N" w8 p6 h. I$ {
, o3 [8 I2 I4 M- @" `3 pHere is one example from the file "Haspinst.exe" which is the dongle HASP2 {" c- N) ?9 M/ F/ z
Envelope utility use to protect DOS applications:
# M3 p0 \& J$ j0 J9 b$ r/ L
% o& C, F5 c# f: G5 H1 f4 }! z( Z
+ C1 g! N+ M- w* A- r4C19:0095   MOV    AX,0911  ; execute command.
  Q  a" B( D* n; V* Q4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)." }& z& }/ G- N" t, ]: P. V
4C19:009A   MOV    SI,4647  ; 1st magic value.* f5 w7 k  Q! q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! E0 Q2 x; S& [* \
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)! W! h- x8 U& \6 c7 x
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute5 F! g" n1 Y$ i( C9 ]) S7 g4 O2 t
4C19:00A4   INC    CX
; l2 D% E6 n& [3 W4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute8 s' J: ?& q4 C5 E) I$ Z  R  r; G
4C19:00A8   JB     0095     ; 6 different commands.; h2 H1 c9 Z% v! n( q0 |0 H
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
& A- c/ o/ J" c: [4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)0 n2 N8 y& b8 O: q

: o* q; z4 H: a8 P* UThe program will execute 6 different SIce commands located at ds:dx, which# N6 j2 U4 x' c& R/ A( v
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT., }4 l# p6 _5 m1 o4 k
% J. e# ?) C4 B+ ~6 ?
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
. j# U" H7 H* f2 l( {7 `$ h$ F) N/ C___________________________________________________________________________
6 b. V5 ]3 l* R  p5 m" S6 A- J3 w( z: u% J" E
. J6 ~8 q$ i% J- Y+ `, X- Z# U4 p
Method 03/ N; V( ~, r) r1 N1 t
=========* X( u, H$ X( D) o( P/ ^: e

9 m# _) f1 H4 G4 J5 f' r/ dLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# `! ~, A: x6 I2 G(API Get entry point)
' f9 b' Q3 f$ r) Q) h2 ?        
. X5 W  a* O1 P4 L
, g+ S7 ], Z0 m9 A, \    xor     di,di
" ~- ~' x2 @5 O  y" Y  I4 @    mov     es,di
; I+ t. U8 c1 n* ^: s' X! I7 z+ O    mov     ax, 1684h       * {6 Q' k& k2 w. n' l
    mov     bx, 0202h       ; VxD ID of winice8 e- r; n- m8 g& E/ W+ k9 ?! z8 J
    int     2Fh
. P, w$ l5 o* K; |  ], _    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 K) _  l0 C3 B    add     ax, di0 n7 Q( I( @8 f/ p4 z% Z' b
    test    ax,ax
) U0 T% Y5 Z0 \9 E' \    jnz     SoftICE_Detected
! t# N7 a+ w' ~. J( a9 S6 f; T6 i% k* I) ]* E: k
___________________________________________________________________________
: K, A+ X! }8 _/ r  A
. |5 b; T% _5 pMethod 04. h6 ?/ a. L; |
=========4 A5 `; H( ^" Z/ x3 t

  f: Z1 L' {. y2 q) nMethod identical to the preceding one except that it seeks the ID of SoftICE
4 w+ c" R. q+ t0 l) ^5 ^GFX VxD.' G; s, }1 `  \5 W# y) I/ w0 G
% J9 c3 L' ~/ s' i/ I
    xor     di,di* i1 H% W; v1 _( s: `
    mov     es,di
: Q4 q' i# A3 a6 M    mov     ax, 1684h      
5 _: w) y) _% m, Y9 k    mov     bx, 7a5Fh       ; VxD ID of SIWVID
6 ]* h: x! B! B  h% [    int     2fh/ L) q( X  J- R, Q$ l1 R- c
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ N' q" L; d) e% ?4 V2 r, `    add     ax, di
2 i6 |; f- t2 U' m6 V) v9 P" o$ L& A$ c    test    ax,ax
. M- L; k0 F4 T    jnz     SoftICE_Detected
9 T: G: s  _* H- x; i
" I  q, o# M3 E- F9 C__________________________________________________________________________
$ ]9 k/ B7 Z# o4 _5 r
* f( K: _# J5 x- E
8 C5 j% n4 v: \6 i0 o' X6 t/ rMethod 05
5 w* I  v( i0 r. ?=========( p  }1 t8 j, w0 @% U
# v* U2 p# y- V5 B' |: u$ Y  C
Method seeking the 'magic number' 0F386h returned (in ax) by all system. j! N9 n' H2 [5 r6 Z
debugger. It calls the int 41h, function 4Fh., E1 S  l' E1 B  k* R' N8 E
There are several alternatives.  " J# S) b. L# {
( f0 P% d; t$ u- ]& k
The following one is the simplest:
/ V9 C9 k! w% y+ P& J
; n) e7 n* r  d$ |$ P# e    mov     ax,4fh, U# d1 j, @' w& }
    int     41h
- j+ D4 V  t8 a, M( \- [    cmp     ax, 0F386
5 T& r5 r7 n/ v; y+ }$ [3 v    jz      SoftICE_detected7 B" q7 g7 _  _3 g

6 m$ ?- Z8 G8 u( W- X$ `0 W: K# l  n3 B1 E" L( }
Next method as well as the following one are 2 examples from Stone's
4 e& q. u6 c" u" x7 e# u"stn-wid.zip" (www.cracking.net):% m* y* N. O% G

9 ~: [' D! c4 q7 i3 H    mov     bx, cs
2 d" e! j  E  {0 \0 f. r    lea     dx, int41handler2+ x  t( _* k2 c( y
    xchg    dx, es:[41h*4]$ O0 N6 o/ W2 [2 |% g9 m
    xchg    bx, es:[41h*4+2]
* A1 ~$ H7 h5 @7 K' Y8 I3 `    mov     ax,4fh
0 Z0 D+ K  |5 G( F( k    int     41h! y: D1 ?/ z. U2 d/ }
    xchg    dx, es:[41h*4]
6 ~: ~4 O9 ^! k5 e% v+ {. B    xchg    bx, es:[41h*4+2]: x& d9 y( c9 J$ A& y, n  K
    cmp     ax, 0f386h
, c$ I' h+ |: ]: F    jz      SoftICE_detected
* l6 x" n7 L3 |" i- `) _6 K: c7 p: ]) ], _8 W6 L' ]
int41handler2 PROC
1 ?6 H- l% C$ x' S( j0 y( j    iret9 ~1 Q3 `( @2 s: U6 U
int41handler2 ENDP. Z& d+ a9 @% h& N
1 R3 d# C: l3 f3 u/ E

0 J1 S4 v( [* z, b: O# B_________________________________________________________________________
' w/ Z  ^$ m' a& M
; c3 L. p$ z' O" ^& D
/ D" C* }: @/ p/ `# M% eMethod 06
4 d1 e  E( b% n=========: J5 `! i- _& N/ r$ \6 h
$ R4 O0 Z/ f1 @
8 d" \" P5 |: Y
2nd method similar to the preceding one but more difficult to detect:
* f# `) L6 O# a: _$ Z+ {( U6 @" B/ K/ z2 |; F7 C$ J2 t# g

+ E1 u, U6 \7 W5 Qint41handler PROC
& g% q! H; x* e) o+ {: B% o    mov     cl,al# i  Z. B# r. [+ B  G
    iret9 h$ D" h* J8 I& {' T4 N9 {
int41handler ENDP
! T4 J0 Z% V: R# d2 }6 w0 D- Z
" ~' T9 m- y& y5 l$ K! x; a$ _) h1 m" u+ ^, f2 N
    xor     ax,ax
" T$ ~( S4 Y$ w5 G5 V2 q    mov     es,ax
6 E; t* b! s1 G1 x$ \    mov     bx, cs4 x1 ?) Y$ ]( p$ |+ p# V4 k
    lea     dx, int41handler4 }# R' k) Z: J+ N2 {$ Q( c! l" Q* b
    xchg    dx, es:[41h*4]" S1 k/ G6 p; _5 P6 `- J
    xchg    bx, es:[41h*4+2]2 {! i/ L1 v0 Q6 `) ~7 j+ n; M6 i3 B
    in      al, 40h. u* _3 h& B# c* J6 L* e
    xor     cx,cx& z- Y. X: o: G, l( J" c
    int     41h
% y. W" S' R( p8 u% i7 T    xchg    dx, es:[41h*4]5 O1 k4 K" e. t
    xchg    bx, es:[41h*4+2]
- U" e% L) @+ W% H! f( {* ~0 i+ B    cmp     cl,al
' ?2 f' f$ o5 @3 t! w% m% G    jnz     SoftICE_detected, W' p: d4 q0 k$ G1 ]+ q3 ~( f
9 `7 L, K* ~3 l- O) v6 L
_________________________________________________________________________  c- T9 A1 l2 }+ h# c" L
/ b" P* A  z; I, I* H" E. U
Method 07
' U$ i. L  t; P  e9 o# _=========6 W0 W9 S8 {, k2 A4 n

( G/ j: A% s1 ]7 O0 J+ hMethod of detection of the WinICE handler in the int68h (V86)# V5 r9 S6 D5 G: G3 Z
* c1 V& n9 [6 C
    mov     ah,43h
! L. y4 y3 b4 R    int     68h* z  Z8 U/ t; b5 d- r  ]# X
    cmp     ax,0F386h% F' ]5 N) {1 w$ }7 h* z/ ]1 i* B
    jz      SoftICE_Detected+ F1 V% p; e$ s

+ A& [3 [( A3 f$ M2 M; U, n) j* a' G- a: N4 Y0 z0 s: @
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% l7 E5 I- E" l( g
   app like this:
% e7 g7 y; m# `1 a0 P4 j, o# }1 U1 G' Y7 O+ ~) J% o2 N: y( A
   BPX exec_int if ax==68( K0 d1 y6 m6 c" W1 q
   (function called is located at byte ptr [ebp+1Dh] and client eip is- n8 [) n7 e5 M: w& g1 }7 M
   located at [ebp+48h] for 32Bit apps)( F, ~6 D. Q8 o) @) o
__________________________________________________________________________
; ]9 J9 m- c: v+ q/ Y- C% I* W% R5 N2 W" ^- K2 A4 U: M6 F% G

) @, r& O, d' J8 c, h) L3 j3 {! aMethod 08
, n, {4 ~  _) ~' `=========1 x7 _9 }8 h) Q7 }# w$ N1 T. J

8 E9 E( b! r/ i9 v2 UIt is not a method of detection of SoftICE but a possibility to crash the
6 [2 s1 a8 l; s& }3 _- g8 j6 F) xsystem by intercepting int 01h and int 03h and redirecting them to another
/ @& S0 v" I; t2 [6 k$ n: ?routine.
8 n# n3 ^' O7 y# TIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 \3 q; d! T8 k0 n# p" K$ X+ n
to the new routine to execute (hangs computer...)
4 d( j" j2 G  [' l
' d- `, v0 z, x6 f! L8 s! D3 X, j    mov     ah, 25h
* v( f0 N, h" Z1 e0 X' `1 ^    mov     al, Int_Number (01h or 03h)/ O- L6 d; M8 V+ g8 f$ h, Q9 D
    mov     dx, offset New_Int_Routine7 @+ |0 \' V+ o3 h0 @
    int     21h& L: Y( [& z2 [, m5 v
: M' W2 c$ E' l1 I* A
__________________________________________________________________________
% b. Q2 U% n( ?8 K" O3 ^2 a7 ]/ Y
0 Y1 y4 s  ]& f1 z: g" QMethod 09
: m& C* g2 O) i$ h+ F& G=========
1 y6 i1 L0 z9 J. J1 T% A6 [2 T
# n4 Q1 W  w6 D; lThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 g( [0 m! H3 e9 Tperformed in ring0 (VxD or a ring3 app using the VxdCall).& G) v# t8 p% A0 h8 C% `
The Get_DDB service is used to determine whether or not a VxD is installed
8 D, `5 m* D; X4 H% B3 }4 w( qfor the specified device and returns a Device Description Block (in ecx) for# p" z3 a6 R( u
that device if it is installed.0 i: N8 j9 a$ _! \  v

" c8 j1 u+ v5 F  f: `5 t+ R# X   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 ?6 [5 y- z0 K; ?0 Y' D
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ m, K& k9 ^5 @% {+ D; @: E$ `& B
   VMMCall Get_DDB
1 W( v* Y3 j2 ^6 J3 \   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: x# f$ f# |( b! ?; K8 @/ @+ x# q
9 y7 [" U5 t; M3 H7 v' P/ W7 J% X
Note as well that you can easily detect this method with SoftICE:
0 \4 L+ o8 |2 v" o# _. q3 j   bpx Get_DDB if ax==0202 || ax==7a5fh' Z' G: s, G1 d+ {5 R2 g
5 L) C& s& d5 g5 f6 ?
__________________________________________________________________________
" }. h, p$ m5 Z4 ]; u9 I/ e) R9 p
8 A! }9 w  v# P. YMethod 10, l2 w7 ?6 I2 g0 ]+ \
=========
( n+ N" O) F& U+ e4 k/ J
. c- F3 `% f& E. ?6 ^. g=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! ]. G* V: Y, Z) w' O* K& w
  SoftICE while the option is enable!!
9 `' T5 n1 k' a7 R' I+ F& |" V
- n$ I5 e9 e) W! A8 g$ lThis trick is very efficient:6 N' j0 h% x7 g% B/ _9 |
by checking the Debug Registers, you can detect if SoftICE is loaded
+ r1 d' `8 {, |6 e* \(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
) i5 f7 z% D  N- C, Ythere are some memory breakpoints set (dr0 to dr3) simply by reading their
/ W2 b" L6 v6 C8 Mvalue (in ring0 only). Values can be manipulated and or changed as well* @( x* h5 u! X( R
(clearing BPMs for instance)
* X; {$ \( ?1 ~8 h: N+ v6 m* t& x, o; i$ X2 o0 I. b
__________________________________________________________________________
% y3 F9 `# g3 ?: J+ A* G5 m8 T8 c! t! E
Method 116 X3 U( Q+ p5 M; f; M' J
=========/ A* D8 s" a9 W

6 \8 |9 T& k/ _) ~4 V  [! WThis method is most known as 'MeltICE' because it has been freely distributed' }; z& i, W/ ?" q$ G- G+ U
via www.winfiles.com. However it was first used by NuMega people to allow" B9 A& _8 |# P) @
Symbol Loader to check if SoftICE was active or not (the code is located( X' ^+ E% ^1 W7 u$ F& \
inside nmtrans.dll).3 ~5 Y6 F0 c, Z! u$ c' F3 P, g

% g; L! x8 F2 I/ U% ?7 O; [4 eThe way it works is very simple:. b% j2 }6 z4 R1 g' Y4 O$ U
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
  ?' J5 \7 q1 r. e# h% Q$ G" X( yWinNT) with the CreateFileA API.7 L6 r- q" j4 T

' K- z" a9 g6 D$ ?+ n0 t' v' x- dHere is a sample (checking for 'SICE'):
& s- d4 f* V- F) w" c' c6 h  B% J: Q3 j  E
BOOL IsSoftIce95Loaded()+ Y! i; l9 s9 r! P$ W. r3 J8 Q; Z& |
{
2 ?# n# H* a# Q$ s2 m% ?1 A7 R  @   HANDLE hFile;  
- j2 _2 J0 m  f  X# Y  Z, I   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' n; p/ G' R8 E* d6 k0 H# x
                      FILE_SHARE_READ | FILE_SHARE_WRITE,: }: l. ^5 e" x. B, o, ~
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
% E  \0 w! X, i" p, g& X   if( hFile != INVALID_HANDLE_VALUE )) P7 z% F' C2 N7 v- r% s, l* |
   {: b6 u& @  A& \% V& U6 J
      CloseHandle(hFile);9 R0 H+ S7 n- d' V5 {
      return TRUE;1 b5 A. W# {( D, A
   }
  b5 Y% }$ O+ V6 H* R% X* c   return FALSE;
: c. b, X: g: \5 [) u; |}
0 v% g7 I6 l0 v7 }0 F
. s- I# p% i4 k- y! L( o/ _Although this trick calls the CreateFileA function, don't even expect to be
# m( V8 x) b+ B  o! Iable to intercept it by installing a IFS hook: it will not work, no way!
* U! [5 z5 u# U% F7 W, \5 HIn fact, after the call to CreateFileA it will get through VWIN32 0x001F; D- y0 E- {$ [) M5 }- V4 Z, B
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)& J3 w" U% u% p, j
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
% P. {$ L5 }% F7 |% s  B5 r5 vfield.
* L7 F) L, c2 _$ n3 ^+ x9 f% HIn fact, its purpose is not to load/unload VxDs but only to send a
7 k' D8 q3 g; ?( ]7 Y+ \2 I8 S+ gW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 b% h! L. O$ A) S5 d' nto the VxD Control_Dispatch proc (how the hell a shareware soft could try
% S1 w, [3 e/ f+ z0 Gto load/unload a non-dynamically loadable driver such as SoftICE ;-).: G) ?, P9 C4 h1 d
If the VxD is loaded, it will always clear eax and the Carry flag to allow
3 A6 E0 ]9 ]0 `7 p$ c8 ?its handle to be opened and then, will be detected.
- |8 a% j$ \* a0 X0 i( g8 m; \" h7 iYou can check that simply by hooking Winice.exe control proc entry point
+ J: c9 R+ K& T& x% c6 Twhile running MeltICE.; e3 L) B6 h/ |8 d  w! h  N* H( d
, ^7 }+ E/ b( |" `8 Q( k% X

4 _& s6 q* }# [. x  ]  00401067:  push      00402025    ; \\.\SICE0 ^0 R, Q) Y( K$ _5 Z  s% v
  0040106C:  call      CreateFileA
. y7 f+ D8 {) d3 a2 Q. ^' @  00401071:  cmp       eax,-0013 K  v  A! m" ~( U0 H9 l/ x
  00401074:  je        00401091, X! A0 r- X! B/ n# a, K$ Z

$ l) G# H, Y4 ^
" a3 V- \0 d0 ~5 B2 h" [3 vThere could be hundreds of BPX you could use to detect this trick.
$ ~, w, d  ]( o& h( N7 i$ m-The most classical one is:
# i2 X" _9 k, V3 h; e( C% [+ t6 @  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 U/ t2 X5 e5 l    *(esp-&gt;4+4)=='NTIC'
7 m* B! n+ y0 ]' y( d3 w& t# I
/ X) u. _, ]1 R2 v-The most exotic ones (could be very slooooow :-(
4 U* l, _) d4 L: g0 K9 ?   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! f: ~; \8 U5 S# ~$ e9 j     ;will break 3 times :-(
8 y" ~5 G( @# o: s3 i
: [+ b8 a: M0 o. b/ M: E  p-or (a bit) faster: % e" e! p  L% d0 Y. \
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 A' u4 b, |# ]0 f! Z

: L: W* Y" p, Y- M6 H   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  - }4 p  ]% P2 s5 K' a
     ;will break 3 times :-(
: y) u6 [. v. S: U" y1 ]3 d8 C! M/ X4 y6 L. _
-Much faster:+ d: M2 u% W: J
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. h+ Y4 `# _) f7 r7 g2 o0 M* M3 p+ V1 F4 q, n& \; b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
% H) Z; H  g/ L4 \function to do the same job:
' G: X6 Z: w# R" |- N; \0 @* ^; k( g- i1 F4 B% i4 x) y; c5 B! B
   push    00                        ; OF_READ: S  u4 W) T: {0 q: D# W
   mov     eax,[00656634]            ; '\\.\SICE',04 [( }# _& y6 c; H
   push    eax5 o4 B; K& P9 ?0 l+ _
   call    KERNEL32!_lopen8 v7 ]5 r. W0 Q
   inc     eax8 Y+ ]: ^4 A2 [$ [9 F
   jnz     00650589                  ; detected. r7 a0 T: X8 N7 V. ]3 P) }
   push    00                        ; OF_READ8 S8 s& j5 o$ b8 [% s0 q
   mov     eax,[00656638]            ; '\\.\SICE'
- d; }+ C  m7 p& z# q4 j1 p' L. i   push    eax- z0 \$ w$ r3 n3 E. Y/ ]
   call    KERNEL32!_lopen& }% @1 U4 Q' _3 h7 Y4 d5 S
   inc     eax
: C( K' ~; R: F: Z+ L, n( N) E   jz      006505ae                  ; not detected& G( @0 a* P( ], F

0 |7 u" |. H" B. D7 M3 T2 e/ \7 V& k5 Q- X
__________________________________________________________________________
7 g4 Q- l/ B3 e# g3 b) u+ ]+ |
Method 12% u, K( l' }- J: s
=========
" @2 c3 i8 [1 f! {! ?9 m" m5 z0 O/ G2 Q1 @' J
This trick is similar to int41h/4fh Debugger installation check (code 05
+ I: z! H# H$ l4 o( I&amp; 06) but very limited because it's only available for Win95/98 (not NT)5 x6 P5 i/ S8 F  R+ W
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ }1 |3 |- I4 I  }* [0 X( `( h

  a9 H8 i' g0 H   push  0000004fh         ; function 4fh
6 o2 q5 E) h+ P# i2 a* l   push  002a002ah         ; high word specifies which VxD (VWIN32)
% C# _3 Z: i) n. B                           ; low word specifies which service
% q9 l8 G3 `5 |! l% V8 Z$ Z                             (VWIN32_Int41Dispatch). B* _3 N  b) c/ }
   call  Kernel32!ORD_001  ; VxdCall  q/ R0 n9 E4 l8 F9 u
   cmp   ax, 0f386h        ; magic number returned by system debuggers
: @3 o& ?" B8 n; ]: @   jz    SoftICE_detected
3 e% H- I3 n+ |( y" T
+ \# h8 \2 P+ E: ?Here again, several ways to detect it:
. P& o' q! w% t8 T7 K6 e' d3 X* b6 L8 @3 ~
    BPINT 41 if ax==4f. ?, v: g$ E/ a

# Q. Z7 g/ R: h    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, r2 [) V& H3 a
' m3 F9 S, M: L) X2 s
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
4 ^& p2 Q) Z* ]  c/ @" B. y5 l/ U% t$ [. U
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ s2 f/ Z7 m, m8 {. Q; f2 k5 P" G1 K0 ^
" N) t! g( ^$ M9 l  D__________________________________________________________________________
6 `- \, G5 f0 L$ Z1 B( ~) z# ^- b0 [8 b9 M  o, j# h
Method 13
! C: \( P7 g4 Q3 y  A# T7 X$ K=========
. j- V# l6 _' `  I& J& S: i! i+ M) K2 u1 i: g/ V
Not a real method of detection, but a good way to know if SoftICE is8 W( p/ C$ E1 I! K9 g4 A
installed on a computer and to locate its installation directory.
8 q' i+ g7 u( ]1 X0 @It is used by few softs which access the following registry keys (usually #2) :
/ N, J2 `1 \' X7 h% r' @3 v/ _
/ b. S7 T) ~; \7 r6 N6 i0 F-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- |$ B6 P  N; q: P- s/ t
\Uninstall\SoftICE
0 `/ I% j# J: e' E9 G& O( g7 o-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE5 u6 P* k2 t9 u3 u; K* i4 [" S0 g, ]
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% R. ?9 J6 l6 V- G8 T
\App Paths\Loader32.Exe. A4 V+ h8 V- X! [
$ ^( A7 _, [4 n$ _- w; T8 t& Z* H$ _

1 \3 d+ o: H1 x. X4 `' cNote that some nasty apps could then erase all files from SoftICE directory
* A, X# x8 K7 A( h( i3 w(I faced that once :-(
3 T, y3 \# C3 p8 C, C. a4 L
* A5 s& [4 q5 b6 T% {# \Useful breakpoint to detect it:5 C6 ^" Y( m7 V/ A

/ ?6 J/ t- R5 r2 z* m; o; |! x     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ _/ a( y8 F# B8 {; o4 J8 `9 L8 W# T; ^  U" K. N
__________________________________________________________________________# a2 f8 F  b9 B% \8 ^
2 t8 m  [* p2 f3 b

& R- [0 H% ?) R$ ]; K- I) j0 F1 yMethod 14
( b9 {" J# r4 h  {5 f=========
/ N8 n$ \  D! F6 u' d0 {; e' F$ o1 }- x$ i$ `
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: O" r# d9 Y* U8 O: u( Ris to determines whether a debugger is running on your system (ring0 only).
1 Z# ~/ g" \6 ?+ `3 ]
$ _" Y* K; [- c: D7 K   VMMCall Test_Debug_Installed- V  T" ^  L7 C1 S2 E5 q
   je      not_installed9 {7 I' O3 }6 S. m  P! {1 U8 J) o

: o% K. f. _: Q  t3 J1 |This service just checks a flag.5 O' m# u+ I+ [" ^2 L* T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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