找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 R8 Z8 z( m) B1 V# m7 Z& U' [; Q) M<TBODY>  ?/ u, Q; i" [
<TR>
, k2 Y1 p: |0 z& e8 ?<TD><PRE>Method 01 . Z5 E* w' A7 s$ _! x' A4 p
=========* h8 I" m9 K* A3 E# i- Y8 X
  W7 d2 c6 e" V( N1 S. B" s
This method of detection of SoftICE (as well as the following one) is
. O4 x- d( k, r/ M/ M# iused by the majority of packers/encryptors found on Internet.
$ c  f. W7 W0 G% j  \5 SIt seeks the signature of BoundsChecker in SoftICE; n+ F( M" d( ^& q
7 d$ N# z0 j( v1 e
    mov     ebp, 04243484Bh        ; 'BCHK'9 l( s) P$ l2 l" _/ w5 [
    mov     ax, 04h
5 b6 H5 g: j6 P' T- G    int     3       , ~6 Z% s8 b* K
    cmp     al,4, F" A6 h$ z" t( }2 D) |
    jnz     SoftICE_Detected: _3 t# Y. `8 T6 v9 H4 h

$ H0 r/ m3 _' T! \9 e# P___________________________________________________________________________0 `6 B$ |" w* r  x( y0 ?* i5 t
& V0 Q% w8 i- {0 u3 `3 L1 D
Method 02
* x9 }* h4 e4 S9 I=========
$ V0 f! i" [  q% C- f3 I
' F' }% u9 z8 S* d2 tStill a method very much used (perhaps the most frequent one).  It is used5 u! I& d6 q5 g# y3 K& I( `0 y" {
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 l$ N2 K! N% l/ R+ O, z& L
or execute SoftICE commands...
  z3 f; I; h  c: `: {* uIt is also used to crash SoftICE and to force it to execute any commands# p5 c8 f2 w6 h5 l3 k- I0 S: @
(HBOOT...) :-((  
  Z& u, C( t" d
7 P8 h: |$ A: s" rHere is a quick description:; j/ \  T. b: s4 B& e6 ]9 u, S; W- n
-AX = 0910h   (Display string in SIce windows)
# H3 Q5 p) T- q% ?$ y7 X& |-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 z) l/ N/ Q" O+ y/ j" V5 G  b-AX = 0912h   (Get breakpoint infos)& T' X. M# \+ m% V' ]0 I) o' \1 I
-AX = 0913h   (Set Sice breakpoints)
' x% _+ ?" J  [' e-AX = 0914h   (Remove SIce breakoints)' J/ d' L0 L& W& G7 ^

6 l6 n% W) a$ i2 gEach time you'll meet this trick, you'll see:; n% P( D1 G- f9 E" B2 Y
-SI = 4647h2 {" g0 ^: U0 u7 m9 E
-DI = 4A4Dh  S$ L6 D9 f; a* T
Which are the 'magic values' used by SoftIce.  X# E  [  Q& R. q9 [2 ^
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.# X3 T8 K1 ~) D" s8 \: Q
: I  Q% v0 X) d9 {( Y  l
Here is one example from the file "Haspinst.exe" which is the dongle HASP' r2 a) I* {! W( R- t4 m
Envelope utility use to protect DOS applications:# J. _. S  I; Q/ ^3 c2 c8 o( K! x
6 T' D( z1 v$ a- H: h) x

  R# I8 V* e, V+ ^4 O& O4C19:0095   MOV    AX,0911  ; execute command.3 t9 j1 T2 y) j2 D
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ x; S1 S) I/ ]4 j
4C19:009A   MOV    SI,4647  ; 1st magic value.1 b. G2 C6 ]3 B
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
9 Z* S0 i/ u, W+ ~4 H( Q5 ]; h4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
# F6 O9 |8 _8 H1 Y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! N) X3 [8 q% o. n& L+ Z- o9 h$ T5 x
4C19:00A4   INC    CX8 C/ X6 f' j$ {
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute9 y5 C- H2 a* L1 K
4C19:00A8   JB     0095     ; 6 different commands.1 @2 K+ j; f' K" o. `  F4 _7 s/ s  {/ P
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' Q: v# T# N/ G3 |
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ ?' N. a. n/ S- }: t2 D9 ~- Q+ W
The program will execute 6 different SIce commands located at ds:dx, which
% V& x, Z5 X  Q5 s1 f, D$ I# v$ q" `are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.8 y5 w6 \; r1 j4 |. v
, j% u1 I7 ~' [
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ S4 S/ _/ |& ]4 T9 d___________________________________________________________________________# ^/ F, R& H9 k

  ]1 X& w" }7 J# \3 h0 ~
0 ?% z7 g6 q; w. ~. q. O  @Method 030 r/ i6 w; x0 l% p
=========" M1 ^2 L  g" t8 v0 k

; P) h# C6 N# J4 aLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 g" a: F7 z; ~(API Get entry point)( P& n( q: m% \& j! \% C
        
$ h5 V/ m5 J9 m, u* S( k* N% x
6 L5 V) V( K# C" S    xor     di,di
+ |; G7 C  ]! G, t    mov     es,di
. q! M" p2 @6 u1 v    mov     ax, 1684h         }7 c4 A1 W. d! x, z
    mov     bx, 0202h       ; VxD ID of winice
" d4 D; R2 S6 v. \; V6 Z4 @    int     2Fh
; v  G! \1 ^- f$ s8 C" P8 h    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 o3 e) `: ?6 j$ [    add     ax, di
- k) ~7 P- j; R, G  q1 _: a; X/ d    test    ax,ax; t; O) m+ n( x- E. m# A/ _
    jnz     SoftICE_Detected
0 Z4 C/ P! F2 O; R8 V- J/ z1 Q) a/ P9 w, \& p+ v# Q* a
___________________________________________________________________________% o/ w9 u, ^2 i+ k
) G& r; H1 ^5 `! n2 i4 q' b
Method 04
, V/ l# A' [3 d( @=========8 ^/ W; Q# h6 _( h+ C( b  j
# p( ^8 G8 `5 E4 p4 M$ j2 O3 O
Method identical to the preceding one except that it seeks the ID of SoftICE1 r, [9 a' C1 @5 c7 a2 k
GFX VxD.6 q1 O: D6 C# @

3 H9 n. ^' h) ~! d# g    xor     di,di
) a6 z& U: `; R1 L% O0 X* R    mov     es,di( v9 E* p; [5 w/ f
    mov     ax, 1684h      
8 L& q; Q6 d7 V, I0 y- P    mov     bx, 7a5Fh       ; VxD ID of SIWVID
9 Z7 `0 x$ t! g) k    int     2fh
8 ]8 h7 C( y, Z2 X4 \    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 b) v4 o5 |3 a( a3 C; f8 J# Q
    add     ax, di% f/ W5 h* k0 d8 w
    test    ax,ax# p( [; k: t) K0 B& F
    jnz     SoftICE_Detected- f- G+ E6 B' h

4 w/ P5 ^# x- f& E__________________________________________________________________________- V' X7 }* T# U+ C  h% `9 `
$ M" |8 _$ g% p0 a6 a3 u

( ]9 A1 t& h9 G# k% U8 \Method 05
2 d- F5 z& U7 Q/ o% T( B=========
! e" @  y/ n& h) [) o
  F' r9 F$ h9 j. f, @& uMethod seeking the 'magic number' 0F386h returned (in ax) by all system" Q% o$ c" H+ ^
debugger. It calls the int 41h, function 4Fh.( m% S8 m  m$ b* ?) C
There are several alternatives.  
- d* X! \# e4 r1 ~8 f. p
" e3 o3 {0 G) I7 ^7 N* TThe following one is the simplest:
' j4 K& `6 v+ x0 }9 M
3 ^6 r. o0 F5 x7 Y; ^9 u' R1 l    mov     ax,4fh1 V/ E  G) O2 a  q
    int     41h; i0 P- V$ a0 n+ K7 D
    cmp     ax, 0F386
" s# P5 O# }/ b8 _    jz      SoftICE_detected
# L6 Q0 a9 P1 |/ ^, j+ p$ w7 s  `- f% S- w# \

8 y+ V* B7 a. CNext method as well as the following one are 2 examples from Stone's ! F9 C' Y; y) n: M1 I8 U: K- Z
"stn-wid.zip" (www.cracking.net):
& m& h6 G( x# K' q/ R! p% W6 }  x0 C
    mov     bx, cs
+ R3 [0 D" V- d  t    lea     dx, int41handler29 k: R9 i* Y: D
    xchg    dx, es:[41h*4]
/ O  i0 h- }1 c$ o. A    xchg    bx, es:[41h*4+2]3 W* S# w2 J: g, T
    mov     ax,4fh6 g5 u! W- Y% ?1 e# `1 S& x- W1 O
    int     41h" p4 Q- y( S  S
    xchg    dx, es:[41h*4]- i4 h( e6 L9 v7 q" l' Y% G* K
    xchg    bx, es:[41h*4+2]
8 a0 y9 |( w8 p% u    cmp     ax, 0f386h
& B4 I5 k" q# ^' j- B    jz      SoftICE_detected: t. j8 i3 o# M$ m1 c2 H. y
0 x4 b8 |4 k: c- B1 b) C
int41handler2 PROC
& ]" h  A- U& {, ?" |2 V' P- S, X$ q- n! e6 G    iret
# f; x2 _8 ]" l2 P* }" Tint41handler2 ENDP# n( g3 q! p9 R) x! l0 M
4 Y( k% O9 ?! l' x: H6 d  }
% U+ o7 a7 A9 |, c8 Z2 ^2 z
_________________________________________________________________________: [- ?" k6 r2 J/ H. y! V
4 x. X; t3 ~$ |6 h  H4 v( }: V
9 i( ~$ s3 P1 R8 k" b/ ^' }
Method 06. ?0 n, h5 K' Z& M1 z6 s# a- M
=========
0 J4 Y  }; }5 o+ r" c; g/ [/ t, h+ t9 a
" P$ n- p$ Q- p
2nd method similar to the preceding one but more difficult to detect:
2 W& k- g. h; [
, I/ j3 g( K) S$ u6 @. ]
& d+ G, N$ I: ~8 s$ U8 Kint41handler PROC
! S3 Z# v' O! V3 m) o9 `% G1 x6 ]    mov     cl,al
! `. b1 Q* I+ C0 R# }! v9 F    iret
: i. u+ }3 p% c  k3 bint41handler ENDP1 M% J' s0 P, t

3 A/ _  T9 S- g; i& C
# c) _! f: q: H9 v  e7 p    xor     ax,ax
* ~* Z8 G4 k  K    mov     es,ax
, B. f3 B) s/ J) y3 J    mov     bx, cs" K# m& X' m) `( _8 X0 a
    lea     dx, int41handler
& V% j% ~1 f: a! J    xchg    dx, es:[41h*4]: e3 @- [+ V" D8 h. o* q# ]' n
    xchg    bx, es:[41h*4+2]
+ T7 Q% _' z6 X* N" Y    in      al, 40h
/ _5 }; v" u: X& |* D    xor     cx,cx
- ?: b4 B# q$ j5 I' h( z    int     41h
' D: S5 \; B* J5 b) ]& D/ Z    xchg    dx, es:[41h*4]
/ a" u6 l8 o4 c. P, i+ E6 f% W    xchg    bx, es:[41h*4+2]' K5 Y  c4 d- Y3 J  m: `
    cmp     cl,al* P9 s- v4 Z4 H; o- r' G
    jnz     SoftICE_detected
; t2 @, @6 q. i! m1 @$ r4 V* I1 S! }' T+ S! A2 m# s: T. \
_________________________________________________________________________" b/ U) I/ \* @$ W& V4 W
; r% X: Y, Q! |4 \6 U3 J$ y* Q
Method 074 @) r8 q& G0 O5 J
=========6 ^$ o% x$ O3 b! L
9 V5 r6 X5 K# t# ~
Method of detection of the WinICE handler in the int68h (V86)
+ v! d7 c9 ]) U; F+ O" v8 E* v2 h7 p* h4 o
    mov     ah,43h
0 ~% h1 H$ M# T# Q7 o' E* d3 w, Z    int     68h
" D7 l0 D  V) j, |9 G( M# u/ e    cmp     ax,0F386h8 u' V0 u8 y9 z- ~' m' L: a
    jz      SoftICE_Detected
/ y2 g1 K* k$ g; |( x4 N: B
* [! Z1 l$ G4 X1 [6 r' @0 u' Y, L/ v. E2 Y
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit  q* M9 V3 T  v% [
   app like this:
5 X, D! j, q6 U; i+ _& t
2 b) Q9 {/ f. j" v   BPX exec_int if ax==68& r' z+ ]9 i  L
   (function called is located at byte ptr [ebp+1Dh] and client eip is; q1 a( E; J- W4 U( F4 h: _7 N
   located at [ebp+48h] for 32Bit apps)' `0 B9 V; N) I! c8 h# [4 i
__________________________________________________________________________
$ l: h) S; u6 \3 \( \3 H6 D5 z& p% Z$ Y% j

# u) ^. D3 R( R0 _: ]5 _% TMethod 08
+ l6 X1 h9 A( t6 G6 h+ F=========1 s2 Z. f3 n3 g% `$ D
( V: C6 @& Z6 b$ W  e* T& d
It is not a method of detection of SoftICE but a possibility to crash the* l7 Z% `. J9 H3 y
system by intercepting int 01h and int 03h and redirecting them to another
+ c+ i) W7 X, S% D; H, y; ^& r2 O" nroutine.9 r: i3 o6 D' d0 A* Y1 \
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( A+ k/ j1 _$ G! J. g3 Y! `* f
to the new routine to execute (hangs computer...)
- |) v# [, D  N/ I& y* I. x& V6 C# u) H' s) r7 B/ k# ^5 M' |% x3 `' H
    mov     ah, 25h# \- {" M1 H: s( D" t) m  F
    mov     al, Int_Number (01h or 03h)  T1 p2 R+ x: O; [
    mov     dx, offset New_Int_Routine
: f; ]! Y* @( s/ N$ @, q+ o    int     21h
, y- ]/ _2 i* a. z0 u0 x1 h. ~" e) \* q- X8 t8 X( `; O
__________________________________________________________________________/ E8 h5 j! f# F

$ t) o4 n' j4 G. e1 JMethod 091 o$ R. o/ t% _. B) g4 b! v% w$ F4 o4 V
=========2 f. d0 D; c  O* R1 n/ Z6 B3 M& q0 u
) a2 b) v+ r$ H  G$ g
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 C6 v& z) O1 m1 h; Eperformed in ring0 (VxD or a ring3 app using the VxdCall).
2 l' E1 r) I, B* G  S& U6 w- sThe Get_DDB service is used to determine whether or not a VxD is installed
- M1 S+ s' ~: ~$ S  v6 xfor the specified device and returns a Device Description Block (in ecx) for
  A0 ~  _# K( i7 Ethat device if it is installed.
% ~5 V: M: X6 A; [2 O
+ J0 T: D- b% Y3 _4 @( Y   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ {/ `. x2 f2 M8 F6 |) X   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), ?- _1 N+ i; y" m
   VMMCall Get_DDB/ f2 N" ^  d. V7 o" o( B
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 s: B$ J% c' q  M+ m
4 s% {) K  `; X5 \: A! I+ _; |
Note as well that you can easily detect this method with SoftICE:
3 {( C: P0 {0 ^/ E. Y$ Z   bpx Get_DDB if ax==0202 || ax==7a5fh
4 s% _3 p0 k+ d1 B* w9 O2 ~) h1 Q9 n* R* P( c
__________________________________________________________________________6 f2 c1 k' B1 `( T; ^8 B
6 f4 d# n# E6 ~' Y9 Q! {2 y& s* k0 [
Method 10
& C- z" m' I) \* s( U4 o0 b=========
" S6 |- Y4 b9 z7 J* C% o
( d3 N, l2 @6 x$ L5 F2 ]=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 }% H/ ^# S  y4 H  SoftICE while the option is enable!!
3 ?8 l, `7 ^: u4 V& {% N4 G! s+ r" F1 h, |8 g5 H
This trick is very efficient:3 K: j. g1 p) i0 }/ n8 r
by checking the Debug Registers, you can detect if SoftICE is loaded+ |% b2 V" s* \
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
! J4 W$ i% V8 P# Hthere are some memory breakpoints set (dr0 to dr3) simply by reading their( q1 g( ~+ \4 Y0 \& z
value (in ring0 only). Values can be manipulated and or changed as well) q+ W) q! E9 ]; i9 Y+ r
(clearing BPMs for instance)
) Z/ O/ z4 g! [2 G& y* \0 r% e. o4 u" y
3 z0 Z6 E+ n7 M! ~* h) x- ?. r3 z__________________________________________________________________________
( Y% A  ?0 k9 J% Y& U$ m
0 j# [% X  ^: N4 H7 g3 s( qMethod 11# B2 A2 j# l1 U! w8 |( h
=========: I) `* ~4 f9 ]: u# r9 `" T

) @5 I" F/ O" h: b, d- f5 ?0 ]This method is most known as 'MeltICE' because it has been freely distributed! ]) i/ ^, i9 o6 i1 H8 m
via www.winfiles.com. However it was first used by NuMega people to allow
) \4 M! E/ {. U" H# i5 sSymbol Loader to check if SoftICE was active or not (the code is located7 _2 ?$ B4 g% X3 o8 y$ d$ |) g
inside nmtrans.dll).1 w6 d% r$ i6 V

2 ?: U2 l4 U6 l* _* C  OThe way it works is very simple:
8 b4 ~! G& I, T" HIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: k4 w; x  R: g  J1 k4 v( d7 h8 d# oWinNT) with the CreateFileA API.
) Q; m. R( i* v$ j6 Y, Q% l& W0 v0 H7 X% M9 y
Here is a sample (checking for 'SICE'):( [2 b! y7 }7 x$ j) T  t
  B$ p, ]* c3 v
BOOL IsSoftIce95Loaded()
# h7 v6 O" N# v* g( _4 U{
  d  v" g% W; u( T/ n0 P   HANDLE hFile;  0 d9 w  x$ i1 Z8 Q" E# `7 J1 p
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ U+ Z% B6 ~  ]" |! Y& t                      FILE_SHARE_READ | FILE_SHARE_WRITE,
3 A2 v( ?+ ]& I" B, ?) L                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 e! w8 x( W, ]/ O' h
   if( hFile != INVALID_HANDLE_VALUE )
7 a, f+ R: R& w( }& w( @2 J# o   {8 ^6 F  e: q6 H7 h
      CloseHandle(hFile);
6 {  o; c5 d4 Z9 }1 Y/ g0 m      return TRUE;
8 g9 H- T# @7 Z   }
0 q3 N  @1 i1 \8 r0 h+ G1 `9 h   return FALSE;
0 _4 l% a- q* F}
% z  N) d9 Q1 [3 Z9 \( T, ^
. _( J* z# Z$ a# S5 X) I/ gAlthough this trick calls the CreateFileA function, don't even expect to be
0 A  P/ U9 i6 V! @. table to intercept it by installing a IFS hook: it will not work, no way!3 Q' y# {! }7 S  m3 k+ `% m
In fact, after the call to CreateFileA it will get through VWIN32 0x001F# [4 ?6 S6 b0 m# W- q# H
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ Q2 g* x" S. ?9 z/ a
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 ]1 `9 V, H/ A, s3 Rfield.8 b+ C; @8 l, |" G/ l
In fact, its purpose is not to load/unload VxDs but only to send a 9 i: y8 Z  r: |. B; t1 E) t/ U! j
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( i; o0 r* [" ]' |  U, s
to the VxD Control_Dispatch proc (how the hell a shareware soft could try; I7 J1 C3 ~7 h/ M, C0 s6 T# T8 w
to load/unload a non-dynamically loadable driver such as SoftICE ;-).( _) {! j1 b/ z: h# C
If the VxD is loaded, it will always clear eax and the Carry flag to allow2 f: X. q6 L# ~! h( w
its handle to be opened and then, will be detected.
: E8 a& R; L# B4 L- EYou can check that simply by hooking Winice.exe control proc entry point
3 `  q7 y& s. N8 {" l, I% S: n8 \while running MeltICE./ G' I3 z: j5 J$ {$ N9 V
- }, Y- H  p7 N" J8 T7 U- ]- x
' A+ e# ?  Y) n) x
  00401067:  push      00402025    ; \\.\SICE2 f& Q, g. J' F5 h' x( \
  0040106C:  call      CreateFileA
: D  G- S# g0 }1 Y  00401071:  cmp       eax,-001, {- M* U8 W6 W! t; T  O
  00401074:  je        00401091
5 x! {3 C7 E; o+ ~" v
% A2 o( _5 S' k! [7 f
7 T6 o/ w# s. B6 m7 A) Y2 S9 bThere could be hundreds of BPX you could use to detect this trick.
  g( Z, x1 @/ ~- @4 `-The most classical one is:
; `0 [# V" e, O+ X3 f% P+ s  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
! ]6 k- e' P7 S+ c" S    *(esp-&gt;4+4)=='NTIC'  D9 N5 [! S# F4 [3 i( ]% X

3 X. N5 u; r- F3 q' I) Z% B-The most exotic ones (could be very slooooow :-(8 [+ H' d% m  S7 ^2 a' d
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  : y9 Z' Y5 b$ N1 o2 P4 c( P
     ;will break 3 times :-(1 \4 f& W8 X! C
' e7 _( o! h# G5 b4 g
-or (a bit) faster:
- J  A9 Z- r# V- ?; ^5 P- y   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
, z0 U" c9 c7 w/ e$ {, r4 p8 ]3 D+ l- ]6 b0 Z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + U" J/ W& T, m/ U
     ;will break 3 times :-(
2 N7 x, F8 ^" ^
  a. ]7 d2 t/ P  `" c- x-Much faster:
' v) j; I; X/ [/ f   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ k& H+ s$ t! ^- i4 N
1 D' _3 @' g" WNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 b' C' G- q6 g' z- ~function to do the same job:2 c) Z0 |1 l0 V5 s: i
/ l# Q  G* n! F. u) a
   push    00                        ; OF_READ* n- F) |- G/ G% L" T
   mov     eax,[00656634]            ; '\\.\SICE',0+ b) e: E( H1 R3 j9 ]/ Y& a0 W: U
   push    eax
; f+ D- o% [) T1 Y   call    KERNEL32!_lopen  K: K& g2 R+ N! L9 d5 T3 O7 H
   inc     eax+ j+ J2 i! Z3 d+ ^! q
   jnz     00650589                  ; detected& O3 z7 ~8 p0 }: h
   push    00                        ; OF_READ
( I6 B0 H6 }; W   mov     eax,[00656638]            ; '\\.\SICE'
# J& V# ~5 E6 Y   push    eax
0 O# r9 t5 ~2 |8 n0 E   call    KERNEL32!_lopen
" j' ~. k3 G! p  S' D& W1 Y   inc     eax
9 P; L" |$ r& r. P5 Q; ?9 ]   jz      006505ae                  ; not detected
+ {- _: H9 T" l# Y  v. L1 K4 L% f/ m6 y6 w  E
. [+ {$ s! H/ \
__________________________________________________________________________0 e; b' i& f- I9 ?4 w2 k- c, C+ d
& h* t4 A3 i- C  p
Method 12
9 x. A; ]8 S6 m, y; |# ]- a=========
$ T' x1 o$ R# t8 @: B, ?  C  M& \1 x& ~! `6 M
This trick is similar to int41h/4fh Debugger installation check (code 059 s  V$ q1 U3 ?& L
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; L6 h) F# y; b' L7 X! f  q8 qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( n' t" O$ A# v( t. A6 Q8 t* D0 o! k, K$ ?- V8 |5 ^
   push  0000004fh         ; function 4fh
( _4 n( ?1 y+ }% ~1 A: l5 I   push  002a002ah         ; high word specifies which VxD (VWIN32)0 \1 P7 }4 K! s+ _
                           ; low word specifies which service
* `( Q/ Y5 d! d                             (VWIN32_Int41Dispatch)" t! @2 j! K* D( H
   call  Kernel32!ORD_001  ; VxdCall
) F+ s: ?+ {6 _9 P   cmp   ax, 0f386h        ; magic number returned by system debuggers
! ~2 o- ?( g$ R' ?! B' M   jz    SoftICE_detected* x$ E5 q9 j; N4 H: s$ W# `# C
9 N7 r& T/ q# u: e6 a6 q2 B
Here again, several ways to detect it:" n1 b( c9 L; _3 D# Y: s3 H8 X
( S* a: d* S% V; |
    BPINT 41 if ax==4f
* u5 l6 g/ l3 D! R' H, z8 h- y, U! h) r
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) ]" }6 P1 q, d9 A
. [+ y4 Y, w: e" l
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 T2 |3 ?8 W% q: y$ j$ N

2 t- M5 ~( B  J1 ?; ?( i0 r    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 Z0 w7 E3 [2 A, A* u1 U  ]
7 q* R6 B. M# p__________________________________________________________________________! s" Z+ A0 T0 K+ g! u" O, n8 J! ~
; V* f' h( c1 {- N+ @, y, c
Method 13) B' O- {8 F7 l  K) F
=========! O, M. d: I: l# H( |! k. l" E" _
6 X  W4 B+ r8 a* p$ {  e" C
Not a real method of detection, but a good way to know if SoftICE is
+ d, Z' O$ w' m0 k; I9 Jinstalled on a computer and to locate its installation directory." B( Z( q* ^  s4 E+ C& F
It is used by few softs which access the following registry keys (usually #2) :
& T" ?, Q/ w9 ?
) R+ c( V) H9 Q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( C. x$ d4 Z" i2 T. v$ Y- P1 ]\Uninstall\SoftICE9 `5 h2 V9 l3 f
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% P% a& r; ]- ]4 U& }, I-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 `5 I; a6 N7 p5 ^\App Paths\Loader32.Exe8 \8 ], p6 T# S! @* L* I. T! V0 O

: ?& N( Z0 r' Y; v/ @" {  a9 z( z1 b& b/ U
Note that some nasty apps could then erase all files from SoftICE directory" M7 W3 X* ]: s: _& |- a
(I faced that once :-(
1 Z8 @( U0 K+ K5 P
0 Y6 @0 U/ C. ]9 {* {Useful breakpoint to detect it:
9 V9 }4 N; K7 T+ m- e. V5 `4 f, m% S/ r5 J/ T: \( E& b# I+ Z; O- ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'6 X' ^6 \, a& i# Y/ Y
9 |% `. K6 a* d
__________________________________________________________________________
1 G8 U% N4 z! c8 r6 Z& j
' d( j; k: K* c: ^2 _
' r8 _7 y( ^1 a. r3 z! S$ HMethod 14
' [. B3 n- k# ]' q0 h=========
6 }$ u+ c4 q2 s7 f' B2 c# S
+ s4 P: Z" D/ X) g4 f" nA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  N+ C2 J8 c: G' @2 c  ^# e8 pis to determines whether a debugger is running on your system (ring0 only).
. P" [, f+ p% P7 N* O1 a+ e' Z/ {6 J
   VMMCall Test_Debug_Installed
# ^3 P2 L2 v: d" x  C9 Z# T2 x   je      not_installed
* W/ A1 b( k: _2 X& F1 e2 k# m1 Y# e5 ^5 Z" S
This service just checks a flag.
. h  X: j8 I2 G</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-20 12:50

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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