About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
1 l4 R2 |  {) K$ i6 E3 Q<TBODY>
/ m7 R$ w% ~2 |$ t<TR>* D5 r! X5 r# l
<TD><PRE>Method 01 7 x$ Z5 v% F% {  ~5 J
=========' g: G  Q: x" U( X7 D6 A( E
" Y0 y0 {5 v( X3 \3 G
This method of detection of SoftICE (as well as the following one) is; ]5 |. M7 G* v( C- C
used by the majority of packers/encryptors found on Internet.6 o, y( q- f/ h" b2 P  _
It seeks the signature of BoundsChecker in SoftICE
$ Q& n+ S, q3 P$ Q
* X3 P: d% z' `( r" Q    mov     ebp, 04243484Bh        ; 'BCHK'# f1 q6 J/ d* h/ j0 S9 a3 K
    mov     ax, 04h8 ~% h2 }0 \. b+ w7 s
    int     3       3 ~% p7 ~- J- L/ `
    cmp     al,4
4 s8 Y, D9 V# q9 N1 I    jnz     SoftICE_Detected
8 z6 ^# |- D( t+ H! p( r1 d  c! E% _. y. r3 U; `5 j
___________________________________________________________________________
' Y- L. X# `0 C* R" K! C$ X; {* t; S4 M& S
Method 02
/ q. n' M: X2 C2 s=========' M0 P5 w  G: Z* G& g5 v

4 T/ A1 ]7 C' `, j4 d+ }Still a method very much used (perhaps the most frequent one).  It is used+ g. |  b) `( W0 C2 [0 P
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 g* M5 b# T8 @2 k( U
or execute SoftICE commands...
9 T4 s" ~/ B5 O6 q! rIt is also used to crash SoftICE and to force it to execute any commands" }0 b, U; c2 X. @
(HBOOT...) :-((  
# U* Y3 F$ m3 d' i$ r" g' B; E& A
Here is a quick description:
. F8 j5 Z- Z- a' l" N-AX = 0910h   (Display string in SIce windows)
6 g7 n# m2 w; R+ `. ]; i-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# R- d* p0 k& C7 O- i1 f-AX = 0912h   (Get breakpoint infos)* K7 f, ~4 L7 w
-AX = 0913h   (Set Sice breakpoints)
6 h+ Q6 L( B% u- r. x-AX = 0914h   (Remove SIce breakoints)
* V; E# m0 ~/ a* B- R( G
# ^! }+ ]' J! T& K7 S* s+ REach time you'll meet this trick, you'll see:
" [! L0 `. p; E5 r$ z$ t, w* K-SI = 4647h, ?% v7 t" }0 }1 [1 q' E3 e
-DI = 4A4Dh, n& Y7 b3 v& z$ q. N# ^
Which are the 'magic values' used by SoftIce.  J, B" a1 T' A( i& {3 w
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.# {- X; |4 [* N3 v# d7 s  X' B
! J: t, G1 _8 T6 Z+ H" v( u
Here is one example from the file "Haspinst.exe" which is the dongle HASP' O: ~/ k' A) Z4 }4 t8 B3 s- _6 W
Envelope utility use to protect DOS applications:
$ X" [4 z: ^& m* m/ a5 P0 x% p0 O6 F) ~: f" T% h
  S3 O! J3 i' s2 [% \! h
4C19:0095   MOV    AX,0911  ; execute command., I% \2 k$ M% W, B/ H) w) S  e" H
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- {2 b* q# @1 Q* r( g4C19:009A   MOV    SI,4647  ; 1st magic value.
) s% @$ g# I7 S2 E6 c- v4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 V3 p9 U3 V' ?% Q& e( H; p- ?4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ i% T; q' W6 k3 q1 W
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  |+ M+ t. |, E& J) [4C19:00A4   INC    CX
( K" m$ k, P; I% X4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' G. g5 f' c9 c) y3 d: B
4C19:00A8   JB     0095     ; 6 different commands.# I3 c. [+ c5 I
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 t. Y; o" L9 V; F- r5 L
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :). X, n1 _) w4 y) @

# e+ ], z: e: z- F( x* k/ }The program will execute 6 different SIce commands located at ds:dx, which
2 A6 u" z0 T( j  bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.0 ~1 \+ E) N$ V
! S# d% K/ X) D. A6 _/ X6 d% S
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 e& E: ]+ o% R0 Q* b# N___________________________________________________________________________- c+ {% o1 a3 ^1 T4 e+ @4 ?4 p
% L. U! u- ?" o& t# U1 E0 `9 F, |

( [7 F: T' v: k' k0 G5 ^Method 03
& B- D! t( t0 j8 ], K  P=========; {2 q2 i' X1 q8 D" A
" y2 g" q% U1 p7 S
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ o- c* Z0 X4 E(API Get entry point)
; r: r& D! n- @* N        5 ]' q" @/ a# |: R, N# I+ b( G
: l6 Q) B. e/ w1 M3 Q( R
    xor     di,di# d, k- T$ u& l4 s; U: p" `, @6 V
    mov     es,di
: ?8 F, S  q, L* M' n0 |4 G    mov     ax, 1684h      
  M- o- C3 y1 Z    mov     bx, 0202h       ; VxD ID of winice
' W5 {4 L1 ~1 X' O! C( S- A' c    int     2Fh( `- ~% C/ h- P& L$ v
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! D6 B; [+ Z/ S5 X  i/ ~    add     ax, di
# @4 [' U, R2 H* U  d    test    ax,ax" I1 p/ J9 {# }/ t
    jnz     SoftICE_Detected4 x' v' J4 b1 v; ^9 i3 V8 T4 w4 z
5 X+ d* b  L9 q" W
___________________________________________________________________________! L% S, P  F. m6 I; w
+ e4 m& F1 \! m2 ^4 E& l! F
Method 04
  Q  D+ n# _( b& _( [7 P& K=========
" H9 u7 H3 z) _  N  F; j4 I& Q$ Y8 r: b2 A; M2 V& T
Method identical to the preceding one except that it seeks the ID of SoftICE
) q) ]2 f" N9 z& T' z2 l, OGFX VxD.0 o1 O0 B  `) s2 _, ?" Z# A. H
! |2 I. C' T7 }! W; d' ?
    xor     di,di* v1 U2 M' Y' r! J4 ?% ~3 @; U
    mov     es,di) t- h9 h6 {8 C# q2 e' A* \; Z& j
    mov     ax, 1684h       ) K" X' w! l) k# a' D& u
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. {! ~. s+ \8 ^6 u* }9 D6 [; m    int     2fh
) Q) c1 U3 J0 h' L    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" h& A6 X2 r2 P1 ]    add     ax, di
5 M# q" Q1 Z; s    test    ax,ax% Y. y9 R( C$ b7 m, [
    jnz     SoftICE_Detected
7 U/ w8 e( O3 m8 y6 l3 H3 E+ Q$ a1 V' a
__________________________________________________________________________4 \( ?' O. U: x+ W" z2 t$ c

$ z+ Y, y. k. G* f- i- ^% K6 d9 G1 x) B: R
Method 05. p" i0 H* e+ `& D4 }8 V2 _
=========( Q' y. d! \( u7 h4 C/ D8 x

# Q7 @' n, @0 E( [& oMethod seeking the 'magic number' 0F386h returned (in ax) by all system! r, }: E6 B3 m( u* s* `
debugger. It calls the int 41h, function 4Fh.
1 d2 J: K+ M  y# t; @There are several alternatives.  1 t# g; o0 w8 Q- a1 ]: C1 y6 ]" \
( q$ u6 m) x2 L( V# }' M2 P
The following one is the simplest:$ B0 X% c* j) z  u) ~- Q" ^% x; w
2 g7 \8 w- V+ I; L
    mov     ax,4fh
7 h, G& n& M5 d9 E- H    int     41h9 l8 }% z0 Z' I( E5 J- A
    cmp     ax, 0F3866 f1 A, `6 l$ X$ R& D
    jz      SoftICE_detected
/ E) }$ M# i! @9 F" @; Q" P2 O  |$ Q8 ]* u$ T

5 o' s# I, z4 INext method as well as the following one are 2 examples from Stone's
8 ~- b/ B( q4 d- z8 l"stn-wid.zip" (www.cracking.net):$ n/ N  c+ u+ H! I& l' v
; a) |, C, T; z" C' a
    mov     bx, cs7 E; _1 o' g  B8 B9 _; }
    lea     dx, int41handler2; r) r) B; n& {) A6 O6 j5 }5 Q
    xchg    dx, es:[41h*4]
/ f! f2 r$ l  t$ m9 e+ m; m/ l$ Y( u    xchg    bx, es:[41h*4+2]
5 \( N2 ^9 @$ x0 a" z" b    mov     ax,4fh
! t$ f1 R6 @) E- [/ _    int     41h5 F& ~7 n6 F; u( ]5 D$ y
    xchg    dx, es:[41h*4]
8 q, U2 N* `7 b! Y    xchg    bx, es:[41h*4+2]6 o# f9 c& m. S  ^6 v- c  d
    cmp     ax, 0f386h8 d& h" X" F9 |% D+ @
    jz      SoftICE_detected7 h4 M* h" |; b- S7 Q

- {3 T: p- \7 o5 S, Iint41handler2 PROC6 x; g6 O. b, G: [$ E6 f& b
    iret
# z* S/ o! ]2 M3 Jint41handler2 ENDP4 Y3 S7 S& O/ E: W
0 X* ]' D0 w& T7 A9 M
% X4 t) W& b$ U" s" \% E
_________________________________________________________________________$ b, L! G' p. h  v
# O9 c: g& Y! b. J

7 z- s$ s5 {, ^! R- YMethod 06
, j6 _# f7 k$ u0 z=========; S; B: D1 |3 V- Y  R# }& w
; r; |& f  `! ]6 w' W8 c, S3 S* t! K
. a1 C$ x1 g; A; u1 L0 r: Y5 r0 v2 \$ a
2nd method similar to the preceding one but more difficult to detect:6 i/ n: M+ H6 ?; a9 s

8 J- h+ t- ?6 l. `7 h( p% s! C% H/ [6 U
int41handler PROC: u; z3 N' Q! k( K
    mov     cl,al& V, K- [% J3 F  s0 p3 ?* d
    iret
7 C( j* [7 P3 Aint41handler ENDP" C: E$ i6 c, K+ u. d) r
  |; T1 V7 ^8 N2 \% N# d8 A! c

0 @1 x0 v( {3 D  x    xor     ax,ax
% n. t; F* _/ ^) }3 P" u    mov     es,ax
' w* ?% j- ?$ ~+ O1 C% F    mov     bx, cs: Y0 K' }8 C# C5 Z9 u
    lea     dx, int41handler6 k" T3 z: @% Q, \" [
    xchg    dx, es:[41h*4]
: i2 P0 }& U7 T$ p    xchg    bx, es:[41h*4+2]
7 ^" O/ B( D/ ^    in      al, 40h
; x5 L- s$ b2 O; B( z0 q2 N    xor     cx,cx
6 k7 `3 L- m8 |5 ^% A" T    int     41h2 n8 r3 J% ~8 b9 y* X
    xchg    dx, es:[41h*4]) ?4 M; v+ I8 A3 ~  o: S5 {
    xchg    bx, es:[41h*4+2]" X7 q9 W2 W. \3 \0 R
    cmp     cl,al
1 X6 E/ z- D6 T! p3 {1 e9 b7 \    jnz     SoftICE_detected
9 A" }5 m# m/ Y% T  ?+ E" x: [+ [2 @* H
_________________________________________________________________________
! ~* o( C  L! u# x8 S  A4 q7 q6 k( ~7 ?* S$ e# M5 o* e
Method 07
- o3 }, a8 o8 a9 @+ H' q2 P! S0 o5 K=========; v+ r. b1 ^/ p7 e  d

. k% A4 ]& ~3 i* \Method of detection of the WinICE handler in the int68h (V86)
2 _3 Z: y& \4 Y3 g8 \4 I- X1 Q; n; }# i+ P3 z0 v7 r' G% r! r2 }
    mov     ah,43h; a% x7 w7 {- d" A6 H$ T
    int     68h' t2 m( [# Z* [/ a/ _8 ^
    cmp     ax,0F386h
& c' u. a- j+ M  s, @4 F    jz      SoftICE_Detected
, @4 F3 s1 k  ]5 d8 I( _2 H! P" o# I* A/ k# Q' o7 N! r

' [" B9 o% d' K  I4 i; I5 ^=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
* g1 V6 N, a; q( l   app like this:
1 B; r; A* s4 O8 K" `# h- Y
0 w1 E1 P8 D6 _  G   BPX exec_int if ax==681 D; m: ^9 c4 L1 u. m. g2 X! P
   (function called is located at byte ptr [ebp+1Dh] and client eip is
$ @- N+ H" s  Q. s; T. a3 p   located at [ebp+48h] for 32Bit apps)
1 R& Y* r: x/ j9 R. S__________________________________________________________________________8 ~( b; i; C4 ?4 ]% |

% O1 y2 f6 l) Y; v6 `% \$ X/ D3 ]3 U: E
Method 08
0 d+ H! \* B. }; k9 \. |, V=========( v% A$ G& g, m  Q) w! W6 u
8 u0 ]4 D  `# q
It is not a method of detection of SoftICE but a possibility to crash the
+ C# @1 c/ A; F! p+ rsystem by intercepting int 01h and int 03h and redirecting them to another, c# ?7 r8 H: W3 W1 j3 U6 N& Q" `
routine.: |  n: p/ t  c' ]
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ S* G6 D3 k$ p  M: L; Y* h% Ato the new routine to execute (hangs computer...)5 I" f  }/ N6 z0 C7 m% T
! O! e$ B3 [  o  R9 F
    mov     ah, 25h
3 i& R, F: r6 a; g# K9 R4 p$ G    mov     al, Int_Number (01h or 03h)1 B4 q# H1 p/ P9 @4 P
    mov     dx, offset New_Int_Routine; @. Y* m: A: L2 }; d
    int     21h
! P6 S% Y2 i, R9 A& _0 ]6 m3 v4 [: z9 S, \
__________________________________________________________________________
6 q+ a) t& K9 H! E2 o- y& q+ ~/ q; a- Q' a2 U4 W
Method 09& _- a; I- H4 L" U) e& y3 `
=========
8 O+ j( `5 {" `0 y8 B4 E0 ^' K( A) @$ l( v" G  r
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; J- U: k( v% w' Aperformed in ring0 (VxD or a ring3 app using the VxdCall).
" p$ q8 A3 l1 y/ R& M$ d# @The Get_DDB service is used to determine whether or not a VxD is installed
" J& K2 k: q# o$ V+ e6 w  Pfor the specified device and returns a Device Description Block (in ecx) for
/ y5 }# C4 V# Q4 B! a2 gthat device if it is installed.
4 e$ l6 T8 G) ?- ]* P; r$ {9 h. ^2 }
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 A; k. I, R9 U+ L8 I! h$ P% Z   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)5 x, X9 F4 ?& K% \' K
   VMMCall Get_DDB2 ^- S! Z% @, p3 }
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 d1 m$ R  O% L
. \+ x/ F* a9 u# Z  W1 o1 w& }Note as well that you can easily detect this method with SoftICE:3 }, f9 R5 |1 h& l1 b1 C
   bpx Get_DDB if ax==0202 || ax==7a5fh4 n+ ~* s# q: _* h) h7 E

* A( |: i% r, b% r__________________________________________________________________________) g) ]8 O- \8 o; ~; j( ~/ W+ u! E) E

1 v& R8 n. B; U- PMethod 10' z* a; F( Q# X# E) h  e3 a, h
=========1 m/ n2 h& |$ p; ?6 n: c
* M6 ^( j/ A: A- o% b$ a2 W8 r
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ W+ z1 p$ ?9 ~% T% ^6 @+ v3 y8 `  SoftICE while the option is enable!!
( B- }, S8 A' c* z/ p0 Z; y" c2 R) V; f8 ?, w
This trick is very efficient:6 L5 j+ k7 v) r1 n, q. s' V
by checking the Debug Registers, you can detect if SoftICE is loaded: e- a. i- G  x2 P, ~2 M
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( ^2 b2 B0 c6 l+ n  i
there are some memory breakpoints set (dr0 to dr3) simply by reading their
2 T, H0 M% b8 ?( g9 K1 `value (in ring0 only). Values can be manipulated and or changed as well
7 s' @) s4 k* u6 X6 _" X1 k" G9 r(clearing BPMs for instance)0 i) M+ k/ K9 Y
+ h. P1 D7 r, W% |+ `3 d# ?" A
__________________________________________________________________________
8 P5 q8 p0 ]9 Y* P; p4 W6 Q' ]% N
) g7 p  r+ m2 VMethod 11# `$ s- w" g; G# @. w2 Z5 f. b
=========
( a; c" W1 f/ Z# N# C  C
9 D4 }/ S1 V$ T5 K2 n1 f! EThis method is most known as 'MeltICE' because it has been freely distributed
% o  e3 \* l" zvia www.winfiles.com. However it was first used by NuMega people to allow) W6 N# G* [' K" ]1 v5 V# i
Symbol Loader to check if SoftICE was active or not (the code is located
3 d, p  H, A) x: I. `inside nmtrans.dll).
; N  K! d  n' m+ h
$ f: \+ D' c6 M1 m, o/ XThe way it works is very simple:
: ~8 K0 H& o, v% s$ AIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" `' b3 B) R8 \- ?/ |1 L3 w4 C$ G
WinNT) with the CreateFileA API.
2 b$ w! L3 I- v
- @5 y2 t3 g# Q+ z2 KHere is a sample (checking for 'SICE'):% [" G3 E7 \& `, y# I1 ]

* ^  S! N# h6 P1 N0 w% u1 HBOOL IsSoftIce95Loaded()( d5 `  Q3 {5 y% C( G+ a+ [! q
{
( {7 K5 b8 Q- ]& x* Q8 B$ ?   HANDLE hFile;  $ T( u9 C1 {$ {( Q- x% ?
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
/ ]# \5 J* F2 X( ~                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 `6 }# A' |8 D1 a. L) N9 V
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);8 l- Z0 C1 W. c# D4 }
   if( hFile != INVALID_HANDLE_VALUE )
( H" A- R: t2 R5 i   {
+ G7 C+ x4 p3 J7 U) B$ K. V- v      CloseHandle(hFile);' g' Y; Z$ S, n' `0 D) t- ^
      return TRUE;
' S  O' G4 M% }6 @' U   }& M- l7 g& e) p3 s0 O8 f' O
   return FALSE;, u4 u3 N6 R/ S$ x
}
) H. d0 h' V- X
, ]& a% `) Z9 V1 |4 OAlthough this trick calls the CreateFileA function, don't even expect to be7 l! E* p% R7 B: a( j. k" F% d" A
able to intercept it by installing a IFS hook: it will not work, no way!$ U# _1 l% U8 q$ E8 c
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
% _+ K2 m1 P3 uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); [* I& s; \* a4 w5 w
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
" N$ ~6 b% ?' ~; Bfield.4 |0 S/ I+ ]6 Z. a9 s
In fact, its purpose is not to load/unload VxDs but only to send a
5 r& ^% F3 A0 X1 W0 x: nW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 J. I! b# i& ?to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" }8 ?+ d  G9 d: P3 ?6 n% wto load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ z' L% \% j  Q+ G: D, OIf the VxD is loaded, it will always clear eax and the Carry flag to allow
/ B  f/ ?% x2 N* }; oits handle to be opened and then, will be detected.2 C# ?! c' h6 j  [
You can check that simply by hooking Winice.exe control proc entry point
' x. H! I) Q! v* Q, [9 ~while running MeltICE.! C) G* r  b' n
9 O! m4 Z) m' q  M3 K* }2 z& [

! w; d# d9 q2 p  00401067:  push      00402025    ; \\.\SICE2 U* x* i* N& Q$ s. G
  0040106C:  call      CreateFileA! Q2 |! X* |5 s/ g, \2 V
  00401071:  cmp       eax,-001
* L+ ], b" C* g5 F' E  00401074:  je        00401091
5 h: ?( j$ {$ x7 Q' _' K. h' \) f, Z# ?  x4 P: [" g2 L

9 n2 Q0 _3 {& ^6 c1 {/ A: iThere could be hundreds of BPX you could use to detect this trick.! ^( i/ W+ c9 ?8 \
-The most classical one is:8 F9 ^( M0 q* l
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; F  L2 f7 v" K    *(esp-&gt;4+4)=='NTIC'
. b: A2 P; w- q6 K! x6 ~2 t9 P/ Y% q% U+ F7 k. Z
-The most exotic ones (could be very slooooow :-(
# G/ s/ K4 Z4 J) Q7 z: N# O   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
; |" A9 [- ]0 Q8 ?% \: {) ^1 R     ;will break 3 times :-(
5 y; J9 g6 p# }! F8 `5 P4 ^3 t& g7 l3 X4 o
-or (a bit) faster: . s2 w6 r0 X) m
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')/ f5 G( f) t* e, L1 B3 j
% V) f. I+ O3 E$ P$ E# J" W) O
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 l: O0 i2 r5 M) R
     ;will break 3 times :-(
3 Z4 @1 A6 B/ q" N$ o1 C
1 A/ x: R4 G& R3 J5 }-Much faster:3 z) E2 U: A) Z6 Q
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 `+ C1 C) i/ }9 h( y5 [6 d0 T# x' C# x; i3 Z3 o. J
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# T; g- ^% Q( J8 `9 g1 l  V8 r3 m6 ?
function to do the same job:) @  ]  Z" B8 _. ]

6 }2 I7 H8 j/ E& i( J, g   push    00                        ; OF_READ/ p! N) J* {% W4 [( b
   mov     eax,[00656634]            ; '\\.\SICE',09 u6 k' a! G0 k" x& ^" y
   push    eax, I* h2 q/ T' d# {% e
   call    KERNEL32!_lopen
- M8 I. @/ J: g  X* g4 x. u. p8 ]! S   inc     eax8 B9 \8 z* G7 ]4 q+ D& k0 k
   jnz     00650589                  ; detected
; ]4 x# q5 k6 s   push    00                        ; OF_READ
0 H& ^' N: b9 U1 @8 E   mov     eax,[00656638]            ; '\\.\SICE'
% S, T- u8 s/ S4 a% d   push    eax" q7 o! P% F8 n  I4 l( H
   call    KERNEL32!_lopen
1 k: q4 c4 ]9 f. m; h' U   inc     eax4 K8 F  A# g9 q3 b( T) m
   jz      006505ae                  ; not detected, o; p, o$ b% u2 l1 Z2 l
# o4 K/ m3 K' q. I% k9 {

9 y% z! _9 A5 e) x% ^__________________________________________________________________________
9 V; h4 j: E$ m8 C5 e3 b+ y' A7 K2 |; y7 `1 j& z3 d: [6 @
Method 12
, |7 Y1 R5 e) \+ n3 Z, B! m7 }=========- U5 _# r  K- l) g! B" C* b
" m. Z7 f+ T5 y) g# [
This trick is similar to int41h/4fh Debugger installation check (code 05+ n4 ^6 l6 q. c2 X  t
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ b1 b8 d, s7 j" J1 |as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
* O# h0 J2 W# G+ g6 T* j
4 ?8 i* y( c% o: ^$ b+ Z   push  0000004fh         ; function 4fh) w) Z$ r% d1 W; t# W1 k/ X- ?
   push  002a002ah         ; high word specifies which VxD (VWIN32)) ~' ~5 O  E% |
                           ; low word specifies which service( `) ]7 ]; p; k+ ?& x1 P- c6 m: z
                             (VWIN32_Int41Dispatch)0 S* E2 n) Z* f
   call  Kernel32!ORD_001  ; VxdCall  }+ |, i6 @. z3 k
   cmp   ax, 0f386h        ; magic number returned by system debuggers
) ]9 a& y$ u( Y( L8 I4 ^& J   jz    SoftICE_detected/ D8 [0 u1 V$ N$ t% ?: u
2 z8 O2 x/ K2 ~# \  B- R# f1 g
Here again, several ways to detect it:5 O- {& P) x1 D4 p
8 P6 U( V6 m0 o5 J/ ]
    BPINT 41 if ax==4f
; h% v& m' b: d4 W# y3 r4 Z0 T
2 ~+ X+ w( q9 }& ?5 Q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: e6 x8 v+ i8 ]5 V5 V- p+ V: q0 k
5 x# L' V1 l! S% V9 S: `    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 T6 M9 U  b+ ?/ f' G9 W
1 h, ~+ Y1 x/ m
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, W1 b) C. A# p) k
8 |6 }* I; c  y: q3 \+ \
__________________________________________________________________________$ y6 ~) i' P0 i. `9 H/ [% R
# B) v$ B, K5 n4 V! u* T3 o3 V- {
Method 13  ?( z/ N% s6 u# A. S
=========
: t) e$ h) N* X$ y  ?. m; s& n0 _8 x( \: v; S
Not a real method of detection, but a good way to know if SoftICE is% P! v' W& x) @% B: @; X
installed on a computer and to locate its installation directory.
5 m! @' z- I. kIt is used by few softs which access the following registry keys (usually #2) :: c0 A4 U# l: A( L4 Z) J: G- U

  x$ e; m3 ]5 p-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 o; ]$ K& \: \
\Uninstall\SoftICE
, i0 S/ A& }- _* o2 R  l5 |-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
" X; [+ L. F( x-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 h, j- w% T+ f, U% t/ T\App Paths\Loader32.Exe" ?5 n1 q1 x! p+ y- p, _" b* }

7 d( X! q; y8 l6 l' }; v6 [5 k! i: h2 }- r: w4 B' U
Note that some nasty apps could then erase all files from SoftICE directory( w0 a; D- L" l( w  d  V
(I faced that once :-(+ C' c; ~! B" ^" R. }, S

* [# w* q( k: v* `6 Y! c& {: n8 |Useful breakpoint to detect it:: \& f- o" t$ T" t

8 w4 J, Y6 L/ Q8 M( w: w' f$ f& C" s0 b, G     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 i  _. v" g* x6 Y$ O( {! \) \* l
# Q% {+ y9 x! I__________________________________________________________________________
- Y1 G% W1 C) Y2 R& @: a7 a4 c# P1 X  v, f( v! O) f
6 Y* p9 I' T- @- \# X' J5 ~
Method 14
6 S$ p" ]5 H1 {# v8 k5 o  v=========- u  T, x& R# l" @9 j

! R( V7 F# K3 B; s( y8 o1 ZA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! x2 t4 ^" o. p0 x  @# F. Vis to determines whether a debugger is running on your system (ring0 only).: y6 q& U/ c' x. g2 U

% _: J; _" ~2 T3 j% y2 |   VMMCall Test_Debug_Installed! E& v  u. X! b3 {
   je      not_installed, X* G. {2 r" u8 m0 N
, D3 b& N% I! E2 T8 w1 @
This service just checks a flag.
! z7 s$ K; L9 z1 Y" a</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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