About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 G; ~! e# T) ?/ x1 _( \<TBODY>
2 j+ N2 y/ }" K- u<TR>% o& G2 A% y; O5 C8 [* _2 y
<TD><PRE>Method 01 7 l4 W$ B/ ^5 k
=========
# h2 a) J( l$ k& n7 ~  s  c$ ~% i  g+ O1 |  ^; b$ T
This method of detection of SoftICE (as well as the following one) is
5 Y' B8 C6 ]" P: F2 \. k. Zused by the majority of packers/encryptors found on Internet.* n0 S0 F( z0 R$ N; R+ R( x  @
It seeks the signature of BoundsChecker in SoftICE3 w$ Z3 w" F$ s$ q( Z1 E) O

3 S9 G) Y$ g# O1 }1 }* r9 ~    mov     ebp, 04243484Bh        ; 'BCHK'+ e+ p: u. s: \5 }( s5 {
    mov     ax, 04h
5 {1 Q5 p! w) C  E- {& j    int     3      
' L) t$ i/ H6 O) U. m    cmp     al,4
7 z  A. U& P" L+ Q7 L$ W0 m' j    jnz     SoftICE_Detected
$ s1 K5 q1 y5 c  A/ i+ ~0 e0 N  i* f! O5 e: b7 X/ v+ Z
___________________________________________________________________________
/ a7 b8 V1 y1 S# P+ R/ \, r9 m2 y3 P% u: D0 k1 I& n% m- o
Method 02
) Y/ k5 q# G9 Q2 G: J9 p9 s=========, w5 |  ?$ k6 T- I( z: A

$ S, g8 X5 _$ L0 ~( Z4 c  iStill a method very much used (perhaps the most frequent one).  It is used
7 K6 r4 y1 L' ^% t+ C# N8 g8 a+ Pto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 \5 c3 O) y  ?7 g9 Oor execute SoftICE commands...% Q+ j0 A& l9 ~! B3 F( |# ~
It is also used to crash SoftICE and to force it to execute any commands
, a4 x! D2 q, B(HBOOT...) :-((  
) u/ \, C( Z  B. X; y/ }' O, z2 U! M7 G; k( I+ ~
Here is a quick description:6 z, E% S: Q+ T' V+ [
-AX = 0910h   (Display string in SIce windows)# P8 n) L9 [. X) i  s- l
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ {9 E+ g- A' u" m-AX = 0912h   (Get breakpoint infos): ^" u1 P/ ^2 Y  _( m6 D
-AX = 0913h   (Set Sice breakpoints)2 ^, c' ^/ P6 ~$ B
-AX = 0914h   (Remove SIce breakoints)0 u' y3 V' k: _; K* }3 Y/ N$ G+ D
0 D: @0 L; c' T% L. \) q3 d
Each time you'll meet this trick, you'll see:
2 W1 d& j1 h7 o% R1 u7 a-SI = 4647h: c8 a& t, m. ]4 T
-DI = 4A4Dh
2 ~' D5 ?4 m1 D+ {3 `Which are the 'magic values' used by SoftIce.' X! ?' g4 N/ h; A
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.  u* L* F$ S5 C, |) L# d
+ l$ V  b! b' j. l- c2 G0 U
Here is one example from the file "Haspinst.exe" which is the dongle HASP$ X/ v9 V# P% z' }
Envelope utility use to protect DOS applications:
# q8 I2 D2 ~) j* Z
/ K* f/ a" f  s! v1 t, ~6 m  h7 Z9 O/ B( Z5 f/ P4 q- L
4C19:0095   MOV    AX,0911  ; execute command.
0 M. \7 T$ U9 I6 O2 x4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! J$ I( w3 |: D! O2 V/ s- L4C19:009A   MOV    SI,4647  ; 1st magic value.
% F; ~" H& w' O  [: i; ^4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; O" u. `% |( s: r) u
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 f: Y- r; c! d* i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  P: P- [" F0 H4 F- S
4C19:00A4   INC    CX
6 X! W) R6 }2 H3 F8 I6 [1 x) ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) A0 y5 ~8 ], B4 x+ y4C19:00A8   JB     0095     ; 6 different commands.
8 x) J, V- B9 Y: L* ]4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 p4 `4 i% n$ {
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
) v; b/ V8 c& Z/ m$ T- X, u  q' A( Q* g# E1 P, n- O7 x, q- Y
The program will execute 6 different SIce commands located at ds:dx, which
8 `; Z0 j. o; ]( G% Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 e+ I5 M0 {5 ]

: S: _, Y% N% @) A  F/ E/ A& A* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! [* @; T2 s. q2 I$ V$ R$ `
___________________________________________________________________________7 x5 E2 r4 R# b7 I8 L( f

2 L' t( r% e( E$ A9 M5 ~% G+ Z- c
! S7 Z$ H! r8 i; dMethod 03
# C0 \0 ]0 G* v. Y9 ^* U+ \=========
5 M1 W8 [6 c' [; {
" X; d# L$ M2 r7 {! v; PLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ k6 q8 R& Y& b3 Z& s8 V0 \: v* I(API Get entry point)
+ A  j% J# u+ x( @7 Z        " i& c6 W5 ]( `  Z4 r2 c
5 }$ _6 G/ Z9 R. q4 `3 N0 n& _
    xor     di,di, a/ k0 b3 O5 [
    mov     es,di
" B& K2 ]) i- }    mov     ax, 1684h      
7 K; y/ X3 T4 c" k/ u) v# v    mov     bx, 0202h       ; VxD ID of winice  ^8 s0 `# e8 |0 Y. ^6 a: x$ R. _+ Z
    int     2Fh
0 O8 v, U. D; i1 Q+ o    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 h6 R# {3 ?' J0 M8 o# g
    add     ax, di
' w+ P- O' Q: K* x% D) P    test    ax,ax$ J& b( d' ?# n, X; I; b# {
    jnz     SoftICE_Detected+ P* |/ L! Q! y! C: o: {9 X$ B8 U
& f9 K+ k1 @/ }  u" e" a/ |( C
___________________________________________________________________________* t. U" L" ~2 d8 J+ C% M
, T6 n* I9 b7 g& l/ _; Z
Method 04
7 w# T: _- B# r$ q9 l1 l# _=========
$ Z  ^! Z0 m& X3 U" N- O& R6 z. q# Y0 ?& n. X! h: V; {) u2 @; e! g6 `
Method identical to the preceding one except that it seeks the ID of SoftICE$ Z7 i5 {- q+ N' t# h
GFX VxD.
1 @$ Z' ~7 z/ w/ ~& r* T& L: `0 d7 Q5 M
8 M7 x& M' S5 z: x  y* q    xor     di,di/ E3 V+ P# D( b: \4 y
    mov     es,di
4 j1 |1 G$ s% u& i9 i    mov     ax, 1684h       0 b- b4 Q1 A% i: p# E
    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 P, h1 m4 {- @, g$ y5 N
    int     2fh3 p+ |5 m; T: Q/ [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 J; f# B' F( Y8 U6 e. ^    add     ax, di6 j' N$ `& A+ L# y$ H: [
    test    ax,ax
0 g' e4 v$ Q7 M% T    jnz     SoftICE_Detected
+ @# l; F; ]- b  J  L- c
/ y8 [8 {. V% h/ E4 \3 y) @2 A__________________________________________________________________________5 @; j1 B  N" a' p8 g8 C8 n
' o( I5 X( ]! ^4 [# k1 D

  t: |7 v1 p# L! D& h* |8 c) NMethod 05- m7 z! H( x9 Z1 Q
=========
. k& n+ \4 {' K: P9 m0 b4 D. V7 |$ S7 B6 ?0 A
Method seeking the 'magic number' 0F386h returned (in ax) by all system; |3 V5 }+ m2 j: l* X! u9 L/ S; T5 r
debugger. It calls the int 41h, function 4Fh.: B/ o, z1 N/ J% G& B! t
There are several alternatives.  3 U2 B& ^! K4 S' ^
, s" X: u4 G5 v; ^+ q
The following one is the simplest:
5 G7 ^1 s: j1 H
0 J0 e$ X0 a- [  f0 {    mov     ax,4fh
& ]2 c8 v4 O. h6 M+ v! I    int     41h2 P* h& X7 V2 n6 e* K; [
    cmp     ax, 0F386" t$ k/ h9 k! H
    jz      SoftICE_detected
. j5 x; Z. @6 l0 D0 h$ W; y1 L8 n. b
) A6 K) D. a$ r# e& ~1 d# g* F
Next method as well as the following one are 2 examples from Stone's
9 x2 o7 T+ k" x+ e9 }: q) B  H! a7 f"stn-wid.zip" (www.cracking.net):
- K9 I% W* Y0 \! @2 M( w' E4 i! w" _, Y* U* R- _
    mov     bx, cs
) y, E) K6 |/ ?4 V) w# p/ e* t    lea     dx, int41handler23 k& g3 ]. x9 r5 Z
    xchg    dx, es:[41h*4]
( Y, Z: f. E" y: O5 G    xchg    bx, es:[41h*4+2]  Z7 ]# {. y' c& x- N! R
    mov     ax,4fh+ B( k* E( O* y8 @1 ]4 e1 {
    int     41h
+ k/ t& d2 U; [# K7 A  ~7 c2 o    xchg    dx, es:[41h*4]
* L6 Q- T- b" B" M  q0 E* y    xchg    bx, es:[41h*4+2]
" Q5 l$ J1 e) n4 S  c    cmp     ax, 0f386h) [" v+ E9 [& u0 \" n5 z
    jz      SoftICE_detected' B$ j4 s' h5 u

( M, d$ y/ |- ~( `int41handler2 PROC0 j1 y6 n8 d6 x* k
    iret
) P- J6 R* A+ n/ t' jint41handler2 ENDP
6 `; o: w( ^& {9 V# z7 E+ A
3 ~( J: W9 p! M' f3 ?4 Y+ S3 Q9 x3 P* G; T* i! O& A0 G1 o
_________________________________________________________________________6 g5 ]2 e' m& v/ N( x+ ]  [' V- O2 I$ ]$ I

) X, a4 o5 {9 x: k. v
1 d9 s5 y4 B, ~; i, S( o+ nMethod 06! B7 n1 w+ g( J# f1 N
=========& L/ w  P( ~/ u, f' J

* M" P2 `2 _/ a4 [- n; _, N+ E! g- F4 @, l. M' h$ Q
2nd method similar to the preceding one but more difficult to detect:5 b5 F' i& S  j0 D+ O

* ]( O4 `1 Q7 \: X6 \( l0 p- z
; |) H9 o/ k; x9 b# @! m" tint41handler PROC# ^& Z; c9 I0 b7 T7 l4 D5 U3 Q
    mov     cl,al( Q: ]; L% u3 C. x
    iret  g4 v+ d% n& b, Y5 }  s
int41handler ENDP- k& m  B) x& r9 ^3 K# x$ ^
) ^3 x7 [+ |1 a% i+ U) W$ k$ r
; l. g' ]% }5 ~( e8 |
    xor     ax,ax* p( D( u2 F/ G. T2 r! _8 K
    mov     es,ax! `$ h& u- h. v9 P
    mov     bx, cs+ u; c0 q( _3 r! b  Y1 |
    lea     dx, int41handler
* g2 b# ?. R, D( Q! t6 w3 j+ |    xchg    dx, es:[41h*4]
$ |* d1 }' x3 H, Z! ~# |4 Z& E    xchg    bx, es:[41h*4+2]  P& ^* N2 V2 _; b; ?, G7 [# _
    in      al, 40h
* v: V9 C& b1 V2 j" G4 r7 B    xor     cx,cx2 l, _! `( G8 [: V$ ?0 D- a
    int     41h
2 K& v  {8 t8 Z% \$ f: X3 v  L    xchg    dx, es:[41h*4]2 W" Q4 i9 d7 z) L; H
    xchg    bx, es:[41h*4+2]
7 W8 E6 u! Q  ^2 J/ o    cmp     cl,al, j/ @% O: i8 D9 v# [5 h$ ~, h; X
    jnz     SoftICE_detected
6 Y7 |7 _7 n" H: a! i$ k# d1 H1 z" V6 f  _
_________________________________________________________________________, `+ u9 w/ t0 ?
+ p0 O. o3 X) l
Method 074 H# W1 B3 g: N" g. ]
=========! }% X( b8 W9 P- i. ~
+ S  n$ W0 W8 q/ }( s( _9 z
Method of detection of the WinICE handler in the int68h (V86)& n) p. U' P0 d( [. _7 Q4 M; D
/ ^, z6 ?& _% b+ m& g
    mov     ah,43h
! Z- n+ N6 w' ?) `9 ?7 m    int     68h: ^  K+ i( B' R3 q0 L+ _) M
    cmp     ax,0F386h
9 N* [! j" A& X" U, \( v. p8 c    jz      SoftICE_Detected8 p; S0 e% I$ O5 s: x( {) h& _; E
9 y  }. n( l; S2 }" P3 s

, A' b3 ^2 p1 i+ _=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
* X! N3 \4 H0 d2 D( R5 Y# y1 T   app like this:
. ^3 b3 O$ }! a" s7 R, o: b9 ]  N$ B; P( [2 O6 M8 L3 U) V
   BPX exec_int if ax==688 c2 `6 A5 E+ ~/ U
   (function called is located at byte ptr [ebp+1Dh] and client eip is; u& W3 U* X- C5 C% U! h/ V% T
   located at [ebp+48h] for 32Bit apps)
" y: [, w" q! `: t' x, w__________________________________________________________________________
1 f  R% u* g- v; ~$ o  J, S2 t( L# h1 d4 A
3 ^3 E& t9 ]5 O- c5 ]/ a
Method 085 l' e* A; P- _" _  Y
=========
) t! l* P. _+ ]: p: Y: N
, e; C! E! D' o  I) k, x; ~+ wIt is not a method of detection of SoftICE but a possibility to crash the8 p  G4 o- x- I, D& \, S
system by intercepting int 01h and int 03h and redirecting them to another
3 h" o( {: a/ ?' D$ j6 ^- troutine.1 E2 G* H' \( @' @- `7 P1 ]  d
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
# I- H& O& S7 Y4 {) B& Mto the new routine to execute (hangs computer...)
/ W# k# H) \0 s+ m  t% i, M; f2 F3 S. v, `2 C8 v3 q! n
    mov     ah, 25h
: w: n2 D. J, G    mov     al, Int_Number (01h or 03h)
$ ]' c$ C$ O* y  R* k    mov     dx, offset New_Int_Routine' _* Q3 u( K, i( c! C
    int     21h
- Q3 H7 Y% k* j' [  }9 X4 w6 }; l; p% X; ^3 e$ {5 i* @9 v
__________________________________________________________________________2 U1 e6 X* i* l
6 [4 m- ]) `" }5 a, c
Method 09# ~& j6 X, j2 X) j: z) Y
=========3 r1 ~7 o1 n1 R  |* G6 y0 P; O: v
6 t% h7 l. z* A5 u  p9 q4 _( M
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  m# j; G. P8 i. }+ b$ e
performed in ring0 (VxD or a ring3 app using the VxdCall).) c- |$ x. `5 o& ]0 }+ j4 p
The Get_DDB service is used to determine whether or not a VxD is installed! i! }; O& ^# w$ E  n& t
for the specified device and returns a Device Description Block (in ecx) for7 Y9 e' g, m% d" v
that device if it is installed.' O7 C6 v/ @1 \8 ~/ t0 b

8 T+ A! m' Y4 V/ z3 d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" R: [& L3 @8 K% a$ w( S5 Q7 m   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% ^5 Y  A+ g2 }2 I2 L9 u   VMMCall Get_DDB
( s3 i7 Y/ s+ a   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed5 Q/ m. d2 b! L8 e& W

% d2 H) j8 D) [6 x$ f5 O2 v6 eNote as well that you can easily detect this method with SoftICE:$ b. f* Y# e6 v; R
   bpx Get_DDB if ax==0202 || ax==7a5fh
2 [8 j. u4 ~. Z' ?: e% a' s+ K4 z
__________________________________________________________________________1 F8 q0 S* z4 F3 X

$ A5 h# `6 ]" ^6 ]: o) v& pMethod 10
* N3 m7 ], y) M- ^1 s9 a=========
; I7 R0 V% c3 v( z  O1 K" l* j3 G7 ?. s/ a
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with5 E0 j3 v, c) P( U4 F
  SoftICE while the option is enable!!+ R: ]! Y0 T. L  x" U
0 ?6 A, a9 l7 D1 G* t
This trick is very efficient:
; w& u. R! ~3 [" H8 T) n# Vby checking the Debug Registers, you can detect if SoftICE is loaded0 c$ I6 t) Y# m% Y% x8 V# Y! H5 q
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! E+ I0 X/ F; v. N
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" b0 ?# H9 B8 M* h  ovalue (in ring0 only). Values can be manipulated and or changed as well6 f1 M: V- [% T* `* J6 S
(clearing BPMs for instance)$ E+ |6 z! d$ m* l* Y7 u+ \. d
- x/ Q; v$ k% }' T' s5 u& M; q
__________________________________________________________________________8 L9 {% ?1 H  r1 v2 v" w  A' Y9 D# ?
  J; b: L9 e. M4 W  c( D
Method 11+ l) ?; n, [" P* i" A5 R# t- W$ b
=========6 }. k  q: ]( [7 E% R  g& E

' D0 f5 A1 ]3 {8 f! U' m  D2 iThis method is most known as 'MeltICE' because it has been freely distributed+ Q" K( N4 {! Q: Z; U( Y2 L  q6 l
via www.winfiles.com. However it was first used by NuMega people to allow
3 L& X7 [. i" _, e, X  s2 {. r4 FSymbol Loader to check if SoftICE was active or not (the code is located
$ {6 m5 J4 d+ f+ @) }inside nmtrans.dll).3 h/ H% Z# S! U  z! a# {! l1 I# G. ]: K
/ m. s1 j$ F: O
The way it works is very simple:& d+ X: e: F7 k" \) u: w' p
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 C+ T# j7 s- eWinNT) with the CreateFileA API.6 W2 f7 E4 q% g2 N

6 ^+ h) e0 d1 b& J! r( y; wHere is a sample (checking for 'SICE'):; t8 {" m3 X0 F2 i* T  V" v  K3 `! I. I
) p( a3 B# \! y5 K; j& s9 Y  ]
BOOL IsSoftIce95Loaded()$ c/ X$ b" n2 Q9 a+ Z! K
{
1 e& X: D9 y) o  `/ g' B5 D   HANDLE hFile;  
6 w% \1 G8 O& M/ W9 P% r   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ [1 N3 {9 L8 j$ P3 o' V+ R                      FILE_SHARE_READ | FILE_SHARE_WRITE,: a0 z! `# |2 U- }; @
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 L% H/ s; }( n
   if( hFile != INVALID_HANDLE_VALUE )
, v& q, M' I; V4 {7 q   {  u# q2 |2 c% s+ z/ V- L* c
      CloseHandle(hFile);: N6 ?" X: m/ ~
      return TRUE;
: ]' m2 M: J; I   }
& p8 H7 P% F0 j   return FALSE;
; I! M& |( F! B+ W' m}
" K" u2 U4 ~/ Q/ }5 o
0 E/ t  T; }* ^Although this trick calls the CreateFileA function, don't even expect to be
+ H$ k3 ]% J" B' C: D( }" |0 [able to intercept it by installing a IFS hook: it will not work, no way!( H8 H' P: s4 d" W5 R: O: d
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 s% k/ Y/ C7 B' C" m8 b2 e
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
2 s4 e. A# X6 P9 p1 Mand then browse the DDB list until it find the VxD and its DDB_Control_Proc1 M0 e+ D8 Q) x7 G6 @: V( d. _
field.
' x  W# i+ h/ Q7 H- r/ R2 Y0 RIn fact, its purpose is not to load/unload VxDs but only to send a % ~, p6 E' D. h5 `3 o6 E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)2 x8 `5 _) _4 r2 k4 P) w
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- J* m" r: Q5 x$ j6 B7 y* Dto load/unload a non-dynamically loadable driver such as SoftICE ;-).- q; A  n/ O" P! b# n/ u7 b1 j3 Q
If the VxD is loaded, it will always clear eax and the Carry flag to allow* T8 u; P0 d3 L( w
its handle to be opened and then, will be detected.
" z. `! x* T: J: A0 w$ pYou can check that simply by hooking Winice.exe control proc entry point
3 _# _- S0 h+ C3 Owhile running MeltICE.2 Y2 p1 k9 f) _! C2 g! Z& Y
9 C$ a* @( q/ y

: W; o. F  t, T( i  00401067:  push      00402025    ; \\.\SICE
  H$ Q- Q: k6 @( ]) m  0040106C:  call      CreateFileA' c2 _3 u" P4 [1 Z* n
  00401071:  cmp       eax,-001' H/ O) N, h4 E/ Q3 ^
  00401074:  je        00401091) p' v% L$ [+ n0 x3 G

5 o! w3 x1 C$ l$ D1 B; z, l3 b- H  A7 A* E! M
There could be hundreds of BPX you could use to detect this trick.
" D. ~  W( p( }/ S3 A-The most classical one is:# ]1 o) P3 V6 ?" S) c5 p: g
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
! [2 a* V) D3 t    *(esp-&gt;4+4)=='NTIC'- B; g3 P1 L4 C4 q3 L( O
5 v$ W2 ~3 j$ D
-The most exotic ones (could be very slooooow :-(
! C! `8 @, b! r: {, V8 G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; w! e) f8 {; M* M' Z. r
     ;will break 3 times :-(3 f/ S8 `. j5 a# q

6 ]; o6 Y) ~+ \9 P) k$ h4 D! d-or (a bit) faster:
- ~* R3 n! ~. h  Y( y4 E8 I* A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
" w$ ?. g7 g8 J6 p
. Y+ O/ V. \' w0 f1 T   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # d6 m9 e: s% S* q7 B
     ;will break 3 times :-(" G5 ]8 u7 u0 ~' d5 ]4 x2 R
3 Q9 n$ Z8 j7 F
-Much faster:( M9 d, v9 v9 M7 y$ F' `1 @" ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ @6 n, v. v0 Q$ W5 f+ F& y" \
+ R6 {0 n- v: r1 G2 PNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
; a! [! W3 h  o, g) Lfunction to do the same job:
* f. s8 a) x3 ^4 P1 B- z
8 l1 x9 L! B( m5 u/ K   push    00                        ; OF_READ
8 N- T+ B$ U9 X0 [1 K9 |6 t/ o9 V   mov     eax,[00656634]            ; '\\.\SICE',0
* ]$ M7 @% k1 U' U/ g   push    eax
, f% \8 E$ o# b. h# a: V: V' r& Y   call    KERNEL32!_lopen
: c  y6 P$ D1 k( A0 G7 J! a# _& i. U' S   inc     eax
: I, V( M" \& v! m, @   jnz     00650589                  ; detected3 p% a  B- q- g) g. G4 ]
   push    00                        ; OF_READ& I  s2 N- e6 {" L' O
   mov     eax,[00656638]            ; '\\.\SICE'! u$ O4 A: e% c
   push    eax) t* f4 Y7 ?  E0 ~8 k1 s# _0 D
   call    KERNEL32!_lopen  O) _' r8 [5 E; D; N: g
   inc     eax
' B+ B/ [5 D3 B9 V0 |   jz      006505ae                  ; not detected  o, ]: c; Y4 L# I

: {2 T: O+ W; |. \$ a* s- i8 p* u; H0 z, f
__________________________________________________________________________8 T( b4 X1 E, {7 A

9 i- `( Z, g& S8 h- G! N; w3 LMethod 12* P" G# ^' d5 a9 g: J1 I( ]
=========5 s3 B; j) ^1 S7 r8 p

3 v# \% H4 n5 @This trick is similar to int41h/4fh Debugger installation check (code 05
! v% `- C0 E# k9 {&amp; 06) but very limited because it's only available for Win95/98 (not NT)
3 G/ j/ n" |7 k7 c$ {as it uses the VxDCall backdoor. This detection was found in Bleem Demo.( C: f+ X3 ^$ x/ }3 t

9 k+ C6 Y2 C6 W   push  0000004fh         ; function 4fh
) V3 @( t. c5 s: |0 U/ d+ G- f6 r# z  W   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 |+ m3 Z. A) i9 c                           ; low word specifies which service
( t3 ^: J+ j! `                             (VWIN32_Int41Dispatch)5 F: G  X+ p1 O
   call  Kernel32!ORD_001  ; VxdCall
: G0 r" D# \+ H6 F* O  H6 x2 G   cmp   ax, 0f386h        ; magic number returned by system debuggers( x2 H5 A8 x/ @8 f" f* z# q3 }  a
   jz    SoftICE_detected- H, u+ J- N' b4 d8 C

. y5 }* Q4 P9 {% ]8 PHere again, several ways to detect it:% ^" \/ T: l4 @/ F1 A( b5 g6 K- [" m

. p8 n$ H0 R7 u! p$ x3 r    BPINT 41 if ax==4f
* U4 ~. W+ p  h+ Q
( R9 }1 |! X7 Q- q& y    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" z4 I% r# t  _4 j: R2 D

3 c5 C0 k1 z7 j) P! |% I6 u# P' ?    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ L0 `/ I) R4 G
+ F7 i$ }, c1 r* p/ U    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!: L6 m: m2 G" c+ P; T( A

& q8 c; n4 ]8 J5 M( i__________________________________________________________________________8 e" i' ^& H; B8 N: E' y
) C/ R" C1 A/ k7 A& r4 S: w
Method 139 d% }5 m3 X/ o2 L* E3 r" G) {* @
=========
( Z4 c% i4 p* g/ W6 @6 u% x
& H6 Y9 z/ X7 H9 Z& l/ SNot a real method of detection, but a good way to know if SoftICE is5 y7 w/ J( |) a9 ?
installed on a computer and to locate its installation directory.
! ^2 ^9 H' I" ~7 s  JIt is used by few softs which access the following registry keys (usually #2) :
) C$ L) W- w+ x4 N7 c
+ a* }. z) D" ~& W6 C) h9 J-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 K& T. N; R1 O% e/ _. U
\Uninstall\SoftICE) \* ^; R" z  D. Y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
. D5 g# w' L/ V6 ^* K/ h-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ ]/ [: j. d. r5 W* H6 T\App Paths\Loader32.Exe
9 a2 `; Z, K3 L& g$ ?. e
' U, l7 s# w8 D5 Y
( r! o3 w" m5 g( H, jNote that some nasty apps could then erase all files from SoftICE directory" N$ j8 b. M9 p& |6 i
(I faced that once :-(2 ]# N) j1 O' S& v# U1 U, P
- N) H8 H4 H/ x9 @# L/ p: r# U) s
Useful breakpoint to detect it:
7 X2 P$ t% |: [, W% m
5 G. B2 G. f1 ^  R9 j     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ C8 o  k& `( e: G" Q
3 Q& n) f& J/ y__________________________________________________________________________
' ?3 `; {( S* H% K3 `6 S. l" M& Q; x; w  H; K& Q1 X- m( p7 Z
  U3 T9 N. |% V; O, O' ^
Method 14 : C2 `6 f% c1 w. C% N$ Z
=========9 A& R+ s% e8 D3 Y; q1 b
' r7 W3 l5 B2 }9 |
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 B+ z' b- j/ p. qis to determines whether a debugger is running on your system (ring0 only).
: `& O# H! o, Q9 h' P! c! _% K0 |* |# r- R: U
   VMMCall Test_Debug_Installed8 I2 P% y, Z4 C9 X* |8 E, h
   je      not_installed2 l6 c  o: G/ g

% P# Z, d! O0 g& ^* R' y! Q1 qThis service just checks a flag.( j# @2 v! P. _. w5 ], J
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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