About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 a1 ]# G: Q! C: ~7 |( h
<TBODY>
1 H) F! v! ^, ]1 X9 O& w% j" i<TR>
! ?8 H3 @6 y- K, Y<TD><PRE>Method 01
- [- F7 G5 w  S$ i: V& ~; j6 D$ L=========
/ C4 H2 Y8 c) y6 G& G# D
% A" H" `& L1 ?" @! k+ }. qThis method of detection of SoftICE (as well as the following one) is
% {4 q. ~+ A8 Gused by the majority of packers/encryptors found on Internet.
2 Z( z8 T% i8 W: \! d: AIt seeks the signature of BoundsChecker in SoftICE( S4 d8 }: K# `6 {' ~
" I  C& ^; u7 H8 |
    mov     ebp, 04243484Bh        ; 'BCHK'
: T. c" O2 @/ r    mov     ax, 04h
0 l1 V3 l, D( o% D2 [    int     3       & z" J5 }; Z7 a' h' A" a
    cmp     al,4
! x, \8 c4 ^9 R    jnz     SoftICE_Detected* ~( O5 Q6 u. ?( k" v+ i! x

6 A4 l! Z3 c( M- {# M3 U; ]___________________________________________________________________________
8 s+ ]6 Z4 ^2 t2 z7 _
$ h, o( r* `1 T( A6 AMethod 02  M7 Z% s' z$ S0 g- B) l
=========
/ t2 m, |9 d" w% z5 x# C! f! L: D& @4 P: p5 X" D
Still a method very much used (perhaps the most frequent one).  It is used
4 C+ [: W. R9 G4 ito get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 \+ Z8 N. S1 \8 Z7 r/ o
or execute SoftICE commands...
5 E% r: r  A5 a% @1 f2 j' {It is also used to crash SoftICE and to force it to execute any commands2 O* y5 w' i6 ?0 U. ]- l
(HBOOT...) :-((  
/ p, z3 w) H  {' J' q. H0 e0 L4 y
6 c* Z0 C0 D  G/ I( ?3 UHere is a quick description:
) p2 \( U1 D2 ^2 s2 u4 n-AX = 0910h   (Display string in SIce windows)
' B+ `1 o7 a. ]8 b9 E8 {-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx), u- t" l9 T3 R9 S+ u
-AX = 0912h   (Get breakpoint infos)) L2 k! W) K  [" F
-AX = 0913h   (Set Sice breakpoints): J+ c: ?, v8 ]8 B1 N( ]
-AX = 0914h   (Remove SIce breakoints)& ]) {/ t' ]/ N, e2 P; F

5 j* X/ ]3 m7 g) x* P" sEach time you'll meet this trick, you'll see:
3 D( t4 I" ~' ]  {# p, k- Z# h; u-SI = 4647h
5 W/ J7 T0 `+ ?. ?9 c5 C9 q  k' Z: q-DI = 4A4Dh
% s) x+ y( e. z( l9 A% UWhich are the 'magic values' used by SoftIce./ ?$ C5 E6 ^4 [5 G
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
( w( m# C. O8 N. f8 K& x% ^( l5 [0 f8 c! `
Here is one example from the file "Haspinst.exe" which is the dongle HASP$ ^/ p3 {: ^7 M% h
Envelope utility use to protect DOS applications:1 }0 L' i  ?* k$ R- \) s
% {2 g  c7 [" g6 W1 j. h

3 H. e. w1 ?7 l! m5 G/ Q, g4C19:0095   MOV    AX,0911  ; execute command.. }6 [$ V8 a9 f- m- b
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
3 v: c* W/ M) q. B8 C4 S- ]4C19:009A   MOV    SI,4647  ; 1st magic value.
2 x, ^; u# v) K, W: P1 E- B% T  z4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 J2 b4 K# E' K/ Z4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 a, `: _6 u, z# v: ~& [" [
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) u. w3 o7 q5 ~6 I! \, M& ~% c7 P
4C19:00A4   INC    CX
2 `( _/ C) r- b% t( |4 @4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 b/ Y( ]; z4 Y$ e9 q4C19:00A8   JB     0095     ; 6 different commands.6 U; E4 u  J( ^, n
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% w2 g* g6 t" ]) ^
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 b" o& M% B: F
6 A( N7 L# q2 {. a; x8 P! f! A; ?1 O) aThe program will execute 6 different SIce commands located at ds:dx, which0 X, x4 y2 C9 u5 y  w. I
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 f4 g* w8 z2 H8 R3 U
% L+ H$ Y4 m8 Z. ~2 {0 B7 A
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.+ Y% Y+ w+ C3 v) A- m3 L0 b$ |0 t5 B
___________________________________________________________________________7 y' F( y( r6 v( {
8 w  `; y8 p$ N/ h% n" h
# f! M3 K' A8 m0 g1 Y3 U/ [8 g4 C# Q
Method 03
1 c; h3 G+ w: M' q, h! ?3 E8 r=========9 \8 i2 v" t* ^
6 R8 R7 E+ P7 J3 U4 s/ q" f3 x3 x
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' Q& n* X- d  X(API Get entry point)
% p- ^3 X! h, h& N# `- \/ h6 l2 ^        
6 W* u$ c( Y- c% q. }6 Z) x; F$ v
: p- r% Q3 }% L4 ~; k    xor     di,di& }& E4 a( C4 s5 P2 B
    mov     es,di
6 {9 S* h: b- G5 t# j; a/ K    mov     ax, 1684h       6 M% u3 ]8 T1 |" t6 @9 |# i1 @
    mov     bx, 0202h       ; VxD ID of winice
+ P/ }- m  _$ W$ q9 j! @' M) h    int     2Fh
  a, ^8 w2 B- I& j# |5 j, Y    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 F$ N% {& x( c3 \( y
    add     ax, di
5 s7 V7 X0 K( {3 b" y/ `6 [    test    ax,ax  U  q. Q$ o0 M) H, d6 y8 }
    jnz     SoftICE_Detected* ?- q( I. k6 I/ E1 ^

/ ?9 W& S3 t# N& z___________________________________________________________________________6 k! l: d5 ?. O+ L% P0 U- d) z" d
% h" t1 ]. h7 J
Method 04# m/ Q# W+ Q' t/ ^6 J7 g. d
=========
# }( y) F1 i! U; P, }5 T/ `% [& T0 z" n' D  s3 _
Method identical to the preceding one except that it seeks the ID of SoftICE& n( ]: ~# `0 }3 p
GFX VxD.
  `7 e  e8 @$ {8 E5 i
  ], D8 d- b1 l2 i( b% b( {) h    xor     di,di
) T9 k: f" _2 l. b; S+ |& U    mov     es,di
: v& I( H& u2 `+ d# s7 ^. J+ d    mov     ax, 1684h       1 U3 ]( G& ?/ j  f. t( t
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 K+ L, ~6 S# k/ ~  G2 V    int     2fh9 ]" b" b- L( E: \* A& x" H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 W/ J! f9 Q) k6 I& Z! G    add     ax, di" E1 [8 {# }  l  Z; G& n3 t. D% U
    test    ax,ax1 |. W$ U9 S& B. b" }
    jnz     SoftICE_Detected  \. i6 }; Q2 o5 b% X( ?4 U1 G
. j; ~( V( {/ l1 y3 p
__________________________________________________________________________9 b4 u& ]5 r6 b  }- K: e
0 E' ?7 k' ^/ J" _/ @) Z) `  ^

% a/ C3 X, M2 J5 e% x7 A& z- NMethod 05
# u5 z& ]/ F# O) B0 y( ]=========2 [* Q+ U# Z4 i/ g7 S  x6 [
( q+ C3 m  B  g+ a. d$ d1 x
Method seeking the 'magic number' 0F386h returned (in ax) by all system4 A" `* ~9 i& J& D$ @: ~; ]
debugger. It calls the int 41h, function 4Fh.
$ S: m; q$ [5 N7 c0 R3 vThere are several alternatives.  
* `/ ?3 S2 u: h3 q5 G( n/ q8 p: I- O2 k. }/ p* `
The following one is the simplest:
+ k, _% z& m9 i# I
3 J% H; Q" ?( l5 f1 y    mov     ax,4fh
3 r  f3 j  A( Q, ?4 |: A1 H    int     41h
# A* X: n' ]; R# H2 j9 F9 `    cmp     ax, 0F386
9 r% }( A2 {: O/ r0 c    jz      SoftICE_detected8 r3 s* q7 @, ]& A/ a0 L& p5 Z
6 \& d, r& M9 P$ s, {" U

* @! X4 Y, ?$ d7 l5 C8 lNext method as well as the following one are 2 examples from Stone's
, ]8 `& n; Z9 N4 R' x1 l9 G"stn-wid.zip" (www.cracking.net):
. _0 ^2 y* m4 C5 @, ]" I* _0 o
% p6 Y% d6 M8 D6 T    mov     bx, cs0 E( }8 W# F; ]% X7 H  u
    lea     dx, int41handler2
0 V' W! u/ M# j1 p    xchg    dx, es:[41h*4]
% I5 v/ n' m, V$ x    xchg    bx, es:[41h*4+2]0 D8 J% y( ~9 J0 e$ b( x) Z
    mov     ax,4fh/ Z0 w# I+ ~# y! V! z: [
    int     41h$ @2 S* B# c# W+ l: z9 G# T3 S
    xchg    dx, es:[41h*4]3 w! U$ m/ y' O: y
    xchg    bx, es:[41h*4+2]
9 T) o6 i3 p1 Q5 B/ L) e, g    cmp     ax, 0f386h/ c3 |( s4 U+ {$ a+ X* m
    jz      SoftICE_detected
3 w2 @& F7 k  q4 l8 G5 p3 t* u0 S2 ^) C% ?0 q
int41handler2 PROC
5 w6 {$ j* s1 n    iret9 F( {5 o8 }+ l7 ~4 [- R6 [
int41handler2 ENDP. c% }. `1 u$ N5 `0 z. X
7 P5 E( M6 |; o; t- g

4 F7 L1 G. Z" M+ Y_________________________________________________________________________
4 [( Q4 S4 o, R* k  X6 X. i
. C+ D1 z. D- t7 E3 N5 n0 M( U/ w8 u$ k! J2 x. E) q. |
Method 06
/ y# s9 o9 o2 w: ?=========: r2 I0 R4 _( M: z

5 N8 F4 o' A) E! Y: p0 C6 N* F" Z+ y* \5 V+ m2 q& t, E
2nd method similar to the preceding one but more difficult to detect:: M: h& f* q3 _) }0 k1 I

* V% ^: B9 Q6 B5 D* M
) P/ A8 [5 w8 L7 o/ L& t5 {int41handler PROC
* ?* y- c7 W  d3 H" {  A    mov     cl,al/ K. J7 _6 D3 L6 b# l8 z$ ~7 \
    iret. {5 n/ Q( w4 K0 A7 i
int41handler ENDP
! N  [3 w2 E5 F& H, Q1 Y# C& o7 T/ p- y! [

9 P  x# C/ a" K; n% q    xor     ax,ax
7 |! H4 j3 R( x) S. r7 C    mov     es,ax
9 w5 r& ~# y  A$ Q8 Z$ n    mov     bx, cs
" p5 g' E4 ]+ F    lea     dx, int41handler. Z9 ]4 V; a  m, ?5 x; B) \
    xchg    dx, es:[41h*4]
# Q8 T4 z2 M0 y! j: T+ ?1 @. X    xchg    bx, es:[41h*4+2]
5 F/ x  R* S: [7 m0 S9 \! o9 _    in      al, 40h
5 ?* `; e/ ~# |( s! A! N& ]! L5 v    xor     cx,cx
! i  c  D6 S2 l9 G( a" ?    int     41h
* w1 x: O+ q& b; }    xchg    dx, es:[41h*4]
. R: \- Y0 L6 r    xchg    bx, es:[41h*4+2]2 P$ Y6 _4 o# [, v9 S
    cmp     cl,al
9 i7 f2 S6 G: b; Y( K, k    jnz     SoftICE_detected
+ j: _9 G9 P! ~' d6 s7 b8 x
" e& d0 i0 n0 S' O1 G_________________________________________________________________________: s) S9 w, u6 B# m, a/ x: H. m1 F

# u; s: G1 h, q0 g, [; RMethod 071 y. ^) n8 {! h2 q+ j$ x* t8 V: u
=========
8 `  f2 A5 C' Z3 X. T4 t4 Z9 b8 |5 i3 |5 m' @$ o6 p- |
Method of detection of the WinICE handler in the int68h (V86)& l1 Q" F1 U; h2 f7 w
+ Q9 E/ C' Q" k7 F6 g" Y
    mov     ah,43h
5 b" b, Y1 i. \. i4 D! ^- l    int     68h6 V' v3 g2 E( g5 N5 T1 Y7 `3 X
    cmp     ax,0F386h
; K- g! e' y* ^0 S( t- [    jz      SoftICE_Detected
7 a1 X6 X% y9 o" z( h/ t' m1 f) l( P8 ~6 Q% m0 h

3 p" D- n& l* W7 f3 }=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. C( `9 \6 d: i! y6 D$ v  c   app like this:
& c  A3 t- T( ?1 C8 s; Q! z
3 p) N0 [2 E6 f6 R+ @# I2 F3 t0 B   BPX exec_int if ax==68) ^* {1 T/ e9 K+ O
   (function called is located at byte ptr [ebp+1Dh] and client eip is8 e/ u- K: j( R
   located at [ebp+48h] for 32Bit apps)
) `: P' W* c' [7 K* ]$ V& Y2 }__________________________________________________________________________
+ r0 J" E: r9 U9 X) _' K; E/ T2 b; c  b0 t0 }, k' x- d
9 C9 ~% |% X1 v) w. A
Method 083 ~+ ?) J1 H7 G! P
=========5 Q3 Z' J" A- g1 E
( M: _! }$ ?4 K6 e
It is not a method of detection of SoftICE but a possibility to crash the
" F, c3 Q: Y$ q! y6 f3 |2 l5 W7 Jsystem by intercepting int 01h and int 03h and redirecting them to another, E9 u) W5 ~4 [- O
routine.
; ^3 \7 }3 N+ A/ J7 o# TIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 O  }& n% h+ e$ x: Nto the new routine to execute (hangs computer...)" U) O$ F( r, E/ O
( g4 f6 w9 o; D% J( B: ]# `
    mov     ah, 25h
# K9 F5 D) v7 q. r5 J+ @    mov     al, Int_Number (01h or 03h)
! R; Q1 a0 c4 T; R( D2 Q/ m+ g1 ~! ]- {    mov     dx, offset New_Int_Routine
+ u1 z- \& y9 u2 Q- r& N& E    int     21h# x8 Z  M& E3 Z4 _* n
  s' {4 Z' L" Q4 {/ c1 T2 c
__________________________________________________________________________
- ]) \& p: F; d! J4 @0 t6 {$ s4 D$ s2 {' _4 v  {
Method 090 j5 E8 i9 N$ c) m6 }+ {: \
=========( Z0 |5 U: |0 f1 i* z% b0 s

2 I8 H& o) t9 W* H7 I5 t# WThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: `6 K8 g2 J8 O$ J
performed in ring0 (VxD or a ring3 app using the VxdCall).
; \: R6 F; c& r( i3 ~8 ^The Get_DDB service is used to determine whether or not a VxD is installed
% |2 M$ t/ Q6 o7 Yfor the specified device and returns a Device Description Block (in ecx) for; O5 K/ M; `6 c: U/ I# J4 L6 Z
that device if it is installed.
# a. ?9 d: g6 Z5 N: x. }# M# I' L' W+ Q- H" F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
& L  a6 _% l( b' o, ~  G1 q7 m0 M   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
/ v1 Y% k" e  J+ D   VMMCall Get_DDB
  m; [) m* p6 ^0 K0 \  O1 i   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ ?4 a) q3 q5 D
7 B+ c* h0 O3 z9 ?Note as well that you can easily detect this method with SoftICE:7 {0 E$ p: }5 p7 [
   bpx Get_DDB if ax==0202 || ax==7a5fh) ~/ k: n4 c8 Z, A+ I8 D: o# a
: C- t8 z1 j* J: t2 c! L4 ?1 I
__________________________________________________________________________7 ]6 K; m2 \0 K: N" p
% c& l; n& A8 M- x
Method 10
3 W0 }8 }# C# d% Y- o=========( V& {3 E$ z2 ]/ ?6 N; i
  m7 _% f: {1 F8 E# }0 H1 d$ b
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
% ?$ P4 q5 V; A2 L  SoftICE while the option is enable!!
% V9 x! h0 i* H3 Y1 b; b& p9 _8 {, d/ q- `9 m9 ~
This trick is very efficient:  A5 o& {5 v$ J. v( W
by checking the Debug Registers, you can detect if SoftICE is loaded1 x- ], G3 b  b
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
0 r& ?+ w9 a- Qthere are some memory breakpoints set (dr0 to dr3) simply by reading their- B( Y7 t- }# c; M$ U
value (in ring0 only). Values can be manipulated and or changed as well
( e. N8 E- U+ Q4 L(clearing BPMs for instance). D9 D- ~* ~- |* X' X1 b
1 _4 ~, R3 j: t) X- u( _7 W
__________________________________________________________________________- |9 m5 c" q  ]& f: n1 C
# _( P4 m0 U- x1 `
Method 118 N- }( K4 |. J& |
=========- o' f: }* X" n& g+ ?
- l. y1 G3 q" j( h/ ]# [
This method is most known as 'MeltICE' because it has been freely distributed4 d8 T8 y( `9 y& ?: Q" U+ V9 `
via www.winfiles.com. However it was first used by NuMega people to allow" f+ E  x% I8 t; C' d& r
Symbol Loader to check if SoftICE was active or not (the code is located
: @' e8 q$ M7 H% L+ p" ?! Xinside nmtrans.dll).5 y9 m# ]8 }  E0 C6 A4 ^
7 ~, _5 Z; ^# u8 d  E! J/ s. D0 L- b
The way it works is very simple:1 ~$ L+ u9 n. }7 T0 x
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- S7 J" H& I% o, l4 QWinNT) with the CreateFileA API.
" p( Z& ]( k, _$ r5 `5 x  r. \) C
$ `" V( ~  `4 k# {Here is a sample (checking for 'SICE'):# J3 Q* b: o3 C
, }  x9 A, D: n+ M2 E& N
BOOL IsSoftIce95Loaded()
( S4 p6 W- |; {! m{7 P! |% C1 \6 |) Z  }8 d
   HANDLE hFile;  
3 b9 q7 U+ [) M   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 t  E8 z, S1 V& Y* ?                      FILE_SHARE_READ | FILE_SHARE_WRITE,- z7 n% L$ I7 I6 I, ?( G7 r
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  Q4 z4 _  ]! N- }
   if( hFile != INVALID_HANDLE_VALUE )8 {( |. X9 o* D$ O9 S
   {6 J. M; z: F1 S! i8 C
      CloseHandle(hFile);
5 e6 B) z1 ^( Q  T6 @& t+ c      return TRUE;2 J- v: c0 l" I$ [* E
   }! o  h$ L+ i) t6 {! d  K8 }
   return FALSE;7 i! O7 ?8 h4 S! i
}$ b; y, v! F( t$ F

6 f+ r8 L% ^" K1 D" j, V1 t, jAlthough this trick calls the CreateFileA function, don't even expect to be+ j8 B( m/ D- F/ [( X
able to intercept it by installing a IFS hook: it will not work, no way!
% G5 `# E( ^) ^In fact, after the call to CreateFileA it will get through VWIN32 0x001F) c1 {) y; X; y. y* O4 w
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)6 K4 M9 N$ o+ e- A- g6 z2 F
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
' O9 f' p. G" A, B0 [9 n+ x) x  ffield.  p/ i9 o' X& j% [: e
In fact, its purpose is not to load/unload VxDs but only to send a
( @) O" ?# v: B5 BW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 s4 }% y3 M3 _% G" U/ p+ v, h$ h' s+ Jto the VxD Control_Dispatch proc (how the hell a shareware soft could try
% a" i8 [- m" u3 D/ Ito load/unload a non-dynamically loadable driver such as SoftICE ;-).8 Z2 J2 }# ?! J; o  d9 i/ x
If the VxD is loaded, it will always clear eax and the Carry flag to allow+ z* T% I( M% [* w( B
its handle to be opened and then, will be detected.
* f, u; {6 p' g4 zYou can check that simply by hooking Winice.exe control proc entry point
! l6 m6 X& \% y3 ~while running MeltICE.7 o/ c2 j1 _8 }/ ~) T+ M
: s& s! E! s% x2 C1 K, C
" O2 ^1 H8 D4 `  F7 ]
  00401067:  push      00402025    ; \\.\SICE
& Q( n/ {2 c  E2 _$ _2 S, B. E  0040106C:  call      CreateFileA
! K6 f! Y# n0 I. m" d  00401071:  cmp       eax,-001
; I5 X, E/ v; B* B) E0 G6 t' t) k' b  00401074:  je        00401091) j) W+ c; o3 O( v" ~

0 X- s4 z2 s' R: R/ Y+ F4 K! _! g1 x8 o
There could be hundreds of BPX you could use to detect this trick.
7 B6 ]1 J( J  o- v! o8 X-The most classical one is:( ?( t7 U1 {' n# n" t2 }
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
5 b: t, W' D* z6 N5 J    *(esp-&gt;4+4)=='NTIC'
1 L% U! a% J3 _/ F+ j. S- u) Y1 F" Y  W
-The most exotic ones (could be very slooooow :-(& f: U, u6 w7 m. v
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; B& P+ S+ \1 Y# {
     ;will break 3 times :-(2 N  O* ?5 P% t

' I8 V( Z7 w* ^4 y1 Y-or (a bit) faster: 5 t# q. K( F/ z% p( E. x
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 K2 J) u$ h, c6 |; \& l2 U
, G+ L; T7 S& @3 `! g   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% D) y# e( L8 {; B; J. z     ;will break 3 times :-(, R5 e9 X8 `. V8 j

+ D9 c% n- I1 q0 l-Much faster:! y0 I$ E1 I7 ~) E3 a7 W# j. P- l& P
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 x) l6 s* U2 f8 F
2 j, z  j! @6 X  [
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen& D: `1 ?7 O: @0 |( {, X& C" R3 c! v5 q
function to do the same job:' y9 K* p$ N5 K) U; l

' t* a2 o( \3 k) ?+ b7 m   push    00                        ; OF_READ
  `, V$ V% G* T6 [# ~) G   mov     eax,[00656634]            ; '\\.\SICE',0, c1 F+ h' D$ ?; W
   push    eax
  c9 X, E% {, y; I" |2 q7 ^   call    KERNEL32!_lopen  P( p. E" l9 t. \
   inc     eax5 B  }. N! J! b4 \
   jnz     00650589                  ; detected
% C3 A2 e* G# F+ U   push    00                        ; OF_READ' a+ q  z$ L3 t2 K! ~* [
   mov     eax,[00656638]            ; '\\.\SICE'" _: m. t, n+ n) F4 m/ w+ A+ w* R+ |
   push    eax/ r8 \3 V. _" i8 R
   call    KERNEL32!_lopen! {& P+ o1 X4 `( _, }: |* c9 \8 v
   inc     eax6 X& r6 x2 e. l: O
   jz      006505ae                  ; not detected" K3 m4 D8 ^! s& J4 J0 H/ r; Z( S

3 l4 ^$ ?. G6 m; D( u2 s  R0 o; e. j+ F6 v) N! \2 c
__________________________________________________________________________
* p0 G1 Q  q' F  A/ I, E' l3 }) [. r1 n) s5 T
Method 12
8 U2 P: X# R& `# S9 q8 B=========2 |- m; x) P* ]
' P7 I; g. m  R1 x, e/ W
This trick is similar to int41h/4fh Debugger installation check (code 05* i$ t9 O6 o% c& x
&amp; 06) but very limited because it's only available for Win95/98 (not NT)% G8 F9 u1 A9 {8 y( o2 I
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.* h. r+ Z6 V5 j. T. j9 T

" w1 V" J; V& u5 Y! m; l- X   push  0000004fh         ; function 4fh
. A' i: g# a' V. \/ v   push  002a002ah         ; high word specifies which VxD (VWIN32)( G$ _$ \2 |# j1 X9 ~2 D
                           ; low word specifies which service5 L+ o6 \, j, ~5 V# o7 S! `/ L
                             (VWIN32_Int41Dispatch)0 j. {: s2 C6 _( L- g2 q
   call  Kernel32!ORD_001  ; VxdCall. a% M& D4 v( S- y  W
   cmp   ax, 0f386h        ; magic number returned by system debuggers
; U. S7 y, i* f' f% K) }   jz    SoftICE_detected
. C- X8 F/ ~: t4 c
' u5 {% l+ Y. v* UHere again, several ways to detect it:
! I9 o& C% O3 M$ l4 ~9 _- g$ ]; w1 @, f1 @
    BPINT 41 if ax==4f  g+ g0 f. E. `! p" R+ a" R" i
& i/ t* g! ^3 S) ]; f  A8 ]
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 m# H7 ?  n# d' J& G# J
8 _# g# k% E6 t2 l6 J
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
4 S+ c, T6 `8 r) \  M, N+ L& e" U* z+ o, y, J
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( ^8 S# [5 m  a9 g& t( _
4 \' b7 t9 U2 U3 c. E4 G1 q( ]__________________________________________________________________________
+ `: N8 x* N' N/ M5 v( d  A* ?3 g4 @* }- ?2 w% o, b
Method 13% X3 [# U+ ?& v6 f- F6 T
=========$ N) V! W6 ^0 N0 d- z7 m

  E" G, N2 N) ~5 X3 \Not a real method of detection, but a good way to know if SoftICE is
6 D: R5 [$ M( Z5 \) b6 {% Iinstalled on a computer and to locate its installation directory.
: M' ^: X* k9 d* i; v" D! ^2 j$ ]% ?! _It is used by few softs which access the following registry keys (usually #2) :; L' r0 k3 w* E; e0 w
0 `: {1 l8 W3 E1 {
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ Y/ O0 r$ d" s" _! z0 L\Uninstall\SoftICE
  c% q7 J* O. S! C1 J-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 M  G* H$ `" G( |* J8 n* i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) n# t; Z4 P+ d5 h/ ]$ _# r' G
\App Paths\Loader32.Exe
1 s" V# G3 P6 I4 i# p
+ ?6 ^" T: f  c2 M+ z, k0 I8 G1 M) q% E+ Q" _2 B  y
Note that some nasty apps could then erase all files from SoftICE directory* y! Z1 o& e. Q7 Z5 K
(I faced that once :-(* |) s: \( e: }6 C+ L, u2 O/ h
9 d' E" P% o- ?* c% `
Useful breakpoint to detect it:
/ A5 ~* A+ X# R/ G: i7 X* B1 L0 [) e7 Y. i  \  v7 f# L
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 o/ m4 C& m( m# L& _9 V6 b
5 |; {- R/ Y2 }3 |) P__________________________________________________________________________
" z/ d3 D& l* g5 F+ F* @6 M: ?4 a# K0 P4 a1 T, d; p, c( P; c. y

3 R+ Q9 _6 Q% M+ nMethod 14
5 [/ H$ [4 V1 Q  `0 X: @. i=========6 @% C! u) k; o4 P' L2 q1 X

3 t% u2 U9 g0 X& o! [( tA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 @# [7 V4 g# N8 _% g
is to determines whether a debugger is running on your system (ring0 only).- k! D' ]" V  t5 w1 I: Y. \
4 D" K& d: H% H6 Y6 e8 {& B( L
   VMMCall Test_Debug_Installed
# Z* K, X3 v, h* n8 a% w( L$ E   je      not_installed, n  e1 M& q) ]7 k/ N
& P& n& J) q- J, K0 i0 x6 S8 p
This service just checks a flag.& c% v) b2 z- w
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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