About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; u; X# B* P9 T<TBODY>5 Q$ p- A& U2 b% q4 C
<TR>
3 m2 m4 _7 {( ~6 g5 L* O<TD><PRE>Method 01
- |! e: c# b! B=========
$ q  O5 \0 {$ |* `
7 N; [. {7 z0 ^2 I5 ]% mThis method of detection of SoftICE (as well as the following one) is
4 K. x9 }( F+ b3 Q+ l* [used by the majority of packers/encryptors found on Internet.) D" Z; Q) N# R% z; f. C" [& ~
It seeks the signature of BoundsChecker in SoftICE
' H7 I( _( g: `0 y9 }) X% d) e
  U7 L) `8 x  ?+ }& r- ^    mov     ebp, 04243484Bh        ; 'BCHK'3 j0 B' C- Q3 {
    mov     ax, 04h
9 K- J- T5 [* p; K    int     3       & x; r7 V( q0 t; y6 {' Q
    cmp     al,4
8 k) o, v/ p/ t# a; F    jnz     SoftICE_Detected
1 H! a' H! K8 J0 A
. G7 p; |$ S3 p2 J  ?: E) N9 j& Q___________________________________________________________________________& z8 l; b3 p9 ^: _9 S
0 I4 V, C  C8 |8 r; I
Method 02
3 f8 |$ A5 B3 p4 b! w+ G- {=========  u3 f; _. _0 P( I+ t& q

! n, k1 Z* ]4 U$ l5 V) t8 b% |Still a method very much used (perhaps the most frequent one).  It is used7 V! F1 I& P$ L$ e: `8 \
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: p9 B+ c2 Y1 l$ }or execute SoftICE commands...
3 D' c  E* _. m" wIt is also used to crash SoftICE and to force it to execute any commands
) W% o: T, Q. p3 P(HBOOT...) :-((  
& Y2 h9 w  i5 a% z7 W  N, K6 F0 q! B
% P( k9 h! {* T& sHere is a quick description:
& X" i  `% F% O/ _3 x+ Q-AX = 0910h   (Display string in SIce windows)7 G0 G" x/ g$ A  e# }6 i3 E. m
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 E0 W2 {& w8 U0 \' q. J1 s2 B/ d
-AX = 0912h   (Get breakpoint infos)
) x; h6 c9 d# Q) r  {8 p-AX = 0913h   (Set Sice breakpoints)
* B4 ^# b% L; w$ ^1 s+ l-AX = 0914h   (Remove SIce breakoints)
; O( z9 |' W0 x# L$ P  _' `* Y7 k  [
Each time you'll meet this trick, you'll see:4 j0 M; v4 r- U+ g6 e
-SI = 4647h" C' d% a; T' R% n5 A6 J# r- L
-DI = 4A4Dh$ q2 H( O* q. g  X; ~3 L: F8 F/ G
Which are the 'magic values' used by SoftIce.
, Y/ B* @( D8 y, YFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
# C6 O) Q; f5 @5 n, E( M8 l
9 j( A4 Z3 z" X! r" D% g! p  EHere is one example from the file "Haspinst.exe" which is the dongle HASP
6 @, K* b6 F% r3 b' I. B! DEnvelope utility use to protect DOS applications:! o# [% M6 ]) [, }+ X) G# P

; n- q2 _# \2 X, y! p9 K
% d/ s5 f$ ]% Q6 o3 b3 j4C19:0095   MOV    AX,0911  ; execute command.1 t+ W2 B6 m5 M! q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 X2 ]* `, m: d: u& k, R
4C19:009A   MOV    SI,4647  ; 1st magic value.
0 O$ x% N2 v# K  U% c  G& X- A) m4C19:009D   MOV    DI,4A4D  ; 2nd magic value.) ~" k7 ^+ p& y7 h3 a0 A
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 T, }- `- Z: }3 m
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# j4 ~2 {- H7 c; y4 P7 L
4C19:00A4   INC    CX
6 \. R+ p; T6 ~/ ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
; E7 ]; y0 e" v& g9 G2 O' U4C19:00A8   JB     0095     ; 6 different commands.. K6 A" ^% r9 s4 u& y) d
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
& J2 S0 U, _9 [8 @) J4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 ]- W5 p1 c2 ?8 E7 D+ j' s( |. d8 v$ p1 _( J5 a, B$ e
The program will execute 6 different SIce commands located at ds:dx, which
8 Q$ t' A7 O# _3 f# j% Bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ z7 Y$ G$ D$ m$ j7 ~
( D( G& B) h' y  N" j$ G9 k$ A
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
8 Q1 D! a( `# [& u" n8 E$ G1 x: G___________________________________________________________________________
. H% v0 {9 @- q. W; o& m7 S2 ^
& I9 c) I2 Q* H2 X5 A8 ]# d
) e2 e% B0 A5 r& R, NMethod 035 g5 E7 y, P6 t$ n3 J, ^+ D4 o
=========: ]% E" e9 F& k

0 g# A6 T% ]( Z" KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 n# Q. r$ X# V(API Get entry point)
9 }- H* b! E  t, l% H        
$ i$ b9 x1 u  {1 j
, ~* Q) l6 P0 ]# b' O3 v8 M* G# L  C    xor     di,di3 C9 x; X' T. u' w0 T2 b
    mov     es,di: e9 q# N# `9 \1 T
    mov     ax, 1684h       3 d+ b6 U6 r1 \% O* o; L. G
    mov     bx, 0202h       ; VxD ID of winice
. ^7 E  U- v# C7 V5 f9 z' i& {    int     2Fh
& f. A+ Q- z, X! N    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) m1 ^- v0 G9 d' x& z    add     ax, di  U4 v- \0 a7 l, f9 N
    test    ax,ax
2 t( A: Q* B; j- L$ x8 p' Q    jnz     SoftICE_Detected/ P4 m* Z; @7 M& x5 a
. e' E6 @  s/ j# L- h
___________________________________________________________________________
* L* i, p& K! ~9 a( C. h" @
- B0 M! V7 y. N4 @; NMethod 04# R$ K) M+ s; p- V" \
=========/ ^2 I8 l/ w4 z' E$ r
4 m; r' ]6 D8 _" n0 B
Method identical to the preceding one except that it seeks the ID of SoftICE
" i7 I; v+ V/ l" ~3 nGFX VxD.
4 w/ Y* e- t9 O  R' I- m
' R" ^) {: F. E, P& @    xor     di,di% U7 Z" V! n* T1 h  }
    mov     es,di
* e9 E" z/ k1 X    mov     ax, 1684h       8 X& Y, d+ C. m8 f3 E( a
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) Y+ l1 J* w. ~2 m6 \    int     2fh5 t" O( r' U% v
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ h; {/ A, M) Y+ c- Y5 O  H    add     ax, di
( Q) c1 r1 z  [% _. \  C    test    ax,ax
1 t% k9 f* e7 F) T    jnz     SoftICE_Detected
, J( E! o0 K! Y2 X' I% q7 y" k2 V' a, w/ X5 n
__________________________________________________________________________5 F& ?: x  c& y4 E

. K! j$ x" D$ j+ x6 P- P) r. _% {- [! _8 R/ q7 U1 q6 y
Method 059 [7 O0 G9 T% ^
=========( `5 q4 z+ C+ @/ i3 ~, [3 d
7 o: ?* v* V9 R) P: G( u; c3 J( C9 C
Method seeking the 'magic number' 0F386h returned (in ax) by all system
2 c+ m% W9 ?: [# ^- Cdebugger. It calls the int 41h, function 4Fh.
" {! @6 L, G8 a; @/ aThere are several alternatives.  ( ]( [7 R: I) ^3 w0 X

9 ^9 y* x, y5 Z1 i1 `. v& j2 EThe following one is the simplest:/ N  r  ~, J; H8 M

0 V! N" i4 T8 u! V% I" Z    mov     ax,4fh5 s$ O, p, b1 m3 H# Q& T
    int     41h
% {- N- [3 Y; I# n/ [  p    cmp     ax, 0F386, P" s3 @/ o; D- y8 T' R) j
    jz      SoftICE_detected# \* ~* m1 Y( y' ^

$ j' P! V6 y4 {, k0 K' a( Z+ h+ G# q# U; Z
Next method as well as the following one are 2 examples from Stone's
! V5 p2 ~, @  S0 L! B8 |1 r"stn-wid.zip" (www.cracking.net):
+ W1 w+ P6 ^# `
0 o9 S5 U" O% _+ h5 G, q    mov     bx, cs: R  J$ ]' B2 G1 M( h. v
    lea     dx, int41handler28 J5 v/ {: r3 Q; W( S8 H1 G; B
    xchg    dx, es:[41h*4]2 r( V/ a6 d4 D* v
    xchg    bx, es:[41h*4+2]
+ z0 `7 F2 l' p    mov     ax,4fh
, }$ s9 S/ e! ~' z! }    int     41h. q0 M3 k$ ?9 N, N, S& h
    xchg    dx, es:[41h*4]
7 h0 ]/ C$ ~6 c, [. k( R1 j+ P    xchg    bx, es:[41h*4+2]) g( R+ ~4 Z; G% C
    cmp     ax, 0f386h5 l7 p+ O0 [# }5 ^5 v. h$ I9 d
    jz      SoftICE_detected
  h5 U8 ?/ I: s
- U; R- K' ~, \8 a  G0 Fint41handler2 PROC7 \, N, h5 u% x" a/ V. c  ]
    iret! m: l  d; W1 U& B
int41handler2 ENDP
9 N$ D( S. ?) J& m% M
+ y+ Z- V: Z- b& ]
8 C  r9 S3 z+ \. v( S" }1 C  j_________________________________________________________________________
- q" r0 `! I5 r, S# A! \2 i" I% O  y! I
: v5 a: g% a% l- |: p0 v- ]
Method 06
* ]8 v  U* c' a1 ]2 S; E4 M=========
7 p/ p4 T! c7 b* V
4 B0 l* r/ W8 V3 w6 S/ Q& M
% L/ c. g  O# l/ L2nd method similar to the preceding one but more difficult to detect:
0 i3 q2 G/ S2 ?" t1 h  @1 S& K  x7 J6 x
" L- M: g& p4 D8 @4 \5 I" Q8 C- f
int41handler PROC2 a8 O3 s+ r+ O! T; ^1 n- b- a
    mov     cl,al
5 E$ w# _' n8 a$ A& M  a* e    iret. W, B- x, k8 u- W2 ]' t
int41handler ENDP. {# S: _, Q# B* M
6 E8 \# U+ n( n3 C

. A2 v, P7 K6 G& x* ?' R. {    xor     ax,ax
0 F6 j' h0 T2 F! n    mov     es,ax
& T) _& b( s0 {8 I9 ]# v) j8 k: _8 a    mov     bx, cs3 F5 |+ X8 l3 s. F
    lea     dx, int41handler
1 b& i( r: U8 G. }. E' R    xchg    dx, es:[41h*4]
2 A& A" A# F" K9 E' N  V* B3 N. o    xchg    bx, es:[41h*4+2]; m3 E4 t6 _, P0 D: _* T
    in      al, 40h8 L4 f* B% N  s" r; G
    xor     cx,cx
6 b6 \% E$ L7 r+ T7 O    int     41h  p2 H6 }8 f6 i3 M% q- f
    xchg    dx, es:[41h*4]
5 j, ]+ ~3 Q% f6 s/ ^) v9 S/ _% q3 \1 b    xchg    bx, es:[41h*4+2]
8 M4 a4 R% }5 g    cmp     cl,al5 F* [( i8 e7 O+ f
    jnz     SoftICE_detected  g, S) c; v' t$ C# o8 g8 {+ Z
: O  f) s3 Y( H5 [& g
_________________________________________________________________________9 J* L9 i- i! O; [/ w8 I
8 N+ C, g" E" t2 r- n
Method 070 x/ u% c; ]4 _3 |1 t3 |
=========- `( k" i, y7 h0 T1 f2 R
/ c( u3 |( ~1 n% @3 v7 t
Method of detection of the WinICE handler in the int68h (V86)
; [7 o6 b! s- V/ C- ]( p2 x$ D: S& }7 `' S  ^: c' ?; \
    mov     ah,43h
. {& y% Q8 G% j) \: L* i0 Y    int     68h' [% @. E: R; G$ c" E6 F
    cmp     ax,0F386h
6 O. h4 S7 J; d$ Z: [( |    jz      SoftICE_Detected
* R7 m1 Z7 n3 D0 V, N7 `( r3 a( H6 W6 t

& d: }% g# P  G/ a7 I8 ?=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# E0 ?4 _) c' S5 S6 l' [" n
   app like this:
0 G4 G" e# K9 d5 ?! ]* l' v2 A& \. f; P2 E4 E8 f3 `
   BPX exec_int if ax==68
" v: U* U# x) S% o& W1 v   (function called is located at byte ptr [ebp+1Dh] and client eip is
1 g! f0 Y5 z( {' f! [" ], j   located at [ebp+48h] for 32Bit apps)
/ ~* y. I# M. c__________________________________________________________________________0 W! f( b$ H/ ?7 M* f
+ S/ D. T7 u3 w. x, e6 \9 U, G

, I" C3 K9 L' c, b3 SMethod 08" u6 z4 |$ M9 |+ C! c0 M
=========* V$ c4 m" r8 M( o. Y0 r1 G. U

+ V2 l; y+ V4 L" U) K  y, H4 EIt is not a method of detection of SoftICE but a possibility to crash the5 |4 S) Z8 i2 Z6 @& `# B
system by intercepting int 01h and int 03h and redirecting them to another
7 B! i' a9 \+ N. Q: q* J7 aroutine.
* \% }( [8 Z0 L% WIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ j( h  u- x; H  T+ f) M4 W/ D
to the new routine to execute (hangs computer...); K( _' v4 ?) \

& }4 p: N2 u/ J( N    mov     ah, 25h
2 S  \9 c9 s: I6 K( h    mov     al, Int_Number (01h or 03h)+ Q4 B3 N* a" Y. \/ n7 D$ D1 R! i
    mov     dx, offset New_Int_Routine0 R$ n2 N$ V* i( U; o
    int     21h9 W( I# E( U+ Z% `4 `5 j

; Z; ]( H3 A& u2 D/ _9 ~  o& T. I__________________________________________________________________________6 t3 Z& T: [0 [# a) g, j' C# q6 _. g

- {* Z9 z6 M7 o# h4 F$ l1 {Method 09$ I5 @$ _9 `0 |; p5 ?
=========) d2 A  y& y! o- \7 p

% z7 a8 L4 _/ M$ gThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& A: w4 A1 N# [/ kperformed in ring0 (VxD or a ring3 app using the VxdCall)., T4 j, d# [$ w" h+ u; m
The Get_DDB service is used to determine whether or not a VxD is installed, D$ H; S; V4 X8 m$ f
for the specified device and returns a Device Description Block (in ecx) for" [6 ~! x! |1 M4 E* |# H, X
that device if it is installed.
" S2 J$ x+ s; o0 B, l
1 P! I' b! r3 z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( R+ H, r* H* l8 Z9 t3 p
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ @1 x) \7 D" }6 S
   VMMCall Get_DDB$ B1 I8 Z- u$ j- L
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 {/ O* }9 O( w2 Y5 m; T7 J& L) X6 k7 E; |
Note as well that you can easily detect this method with SoftICE:! S  `- K& e8 A( N
   bpx Get_DDB if ax==0202 || ax==7a5fh
: Y* B) S: s' w, e5 z5 \
9 D' N8 T. i- _; v* v__________________________________________________________________________4 M5 F. ?& C  x( ]! r5 ~

3 P2 q  }( O5 k/ q: zMethod 103 r) L% q5 g6 i6 c" \) ?/ k4 y
=========2 d& }' y8 L5 T+ A  L5 [
, t7 y' q1 D( R9 t- ?" h& I
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 |9 N  H$ A7 O+ R& R  SoftICE while the option is enable!!
1 Y8 e* S0 r8 z
* _$ s2 t: E! n! }5 y0 x( P& D, IThis trick is very efficient:  M9 I3 f8 v* {1 i6 `! H$ b: O9 L  W
by checking the Debug Registers, you can detect if SoftICE is loaded+ c0 u3 I1 v! y4 s6 k1 |
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; V5 L! r) c8 n3 F) f( g" B
there are some memory breakpoints set (dr0 to dr3) simply by reading their
. l! }+ x' ]/ g: d1 P! l  fvalue (in ring0 only). Values can be manipulated and or changed as well# W  w; C7 v2 w& ]/ u
(clearing BPMs for instance)3 k& D& m  ~; F8 ]9 s

  w( m# |8 y. b* e, g$ F0 j__________________________________________________________________________
, R( I0 D5 D+ p9 s1 c# W/ r1 W: `% q, S: E' a+ R/ G. B
Method 114 q0 Q' h! S( Y. ^/ `
=========
* {9 j" w# L% {+ {, s
: r' M) P, T- P! `* GThis method is most known as 'MeltICE' because it has been freely distributed! d& ?+ Y* K  I; E/ P8 I: ?
via www.winfiles.com. However it was first used by NuMega people to allow
+ S. k/ `4 @8 j; o# |7 ISymbol Loader to check if SoftICE was active or not (the code is located
( M2 j) ?; e* b: A% P: Ainside nmtrans.dll).7 K# |1 S7 j( F" b- ]7 r; p
8 P3 G5 T( v) q' ?! u! q' J5 F
The way it works is very simple:
7 I: b! B8 n8 @7 D- z: q0 wIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
! n! V7 `+ u; y; _3 YWinNT) with the CreateFileA API.& _( l  C  @+ C. g: A
1 ~- L9 G: a: m8 j2 p9 ~2 H
Here is a sample (checking for 'SICE'):
2 g- q' }6 Y4 E+ V$ Q/ j4 e4 ?- P, Y& L1 W8 i. ?
BOOL IsSoftIce95Loaded()
* P+ e7 T  @' U7 W{) z9 l- [& Q. u1 w1 }+ c
   HANDLE hFile;  ; E' g& @! Y1 o, `7 r$ m3 B% p
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: \, d8 G* p1 ^6 P$ p& [+ q) @                      FILE_SHARE_READ | FILE_SHARE_WRITE,
3 C. d2 @! I' B  O5 s                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' I  w, g  E! c   if( hFile != INVALID_HANDLE_VALUE )
& ?* A) N3 ^! |, p2 @   {5 N6 D) @- S& a# O$ \- C
      CloseHandle(hFile);
* @+ p9 h3 z( f: K1 T9 X8 ~, ^0 J      return TRUE;$ B$ ]: J7 |1 ]% [" W6 i
   }
8 m$ o  T% Z8 }6 L: a   return FALSE;
  ~- k& `/ _8 x1 [: ?}
1 v: I( P1 j0 {3 L5 G0 n! ~6 ?% ?, j! m' ~. f! a! P0 H
Although this trick calls the CreateFileA function, don't even expect to be
, }* a4 R; y5 Q% k8 |5 a) cable to intercept it by installing a IFS hook: it will not work, no way!
) A5 z, C" H+ g) t$ JIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 [- ^, j* v) G1 L3 |service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
# ]+ r$ D. O8 v  N6 U; \( tand then browse the DDB list until it find the VxD and its DDB_Control_Proc( F* C  W2 L6 p  t7 d' W5 Z
field.
0 @* r% n0 i' [4 \! PIn fact, its purpose is not to load/unload VxDs but only to send a 9 |1 O9 A/ b1 r$ x' Q( C: J
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* t" s1 k4 X9 G( p* m, [
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
. p8 ^9 g. e  v9 e4 o4 uto load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 I' R: O. V' y+ d( k* g( _If the VxD is loaded, it will always clear eax and the Carry flag to allow! K& l. D) w$ ^. ^& l) D
its handle to be opened and then, will be detected.
  X0 m8 e3 k5 i5 q! TYou can check that simply by hooking Winice.exe control proc entry point0 z- @9 U+ p; }8 z% i) B6 h( v
while running MeltICE.
+ \  z; _; ~0 f4 R$ V
$ \, y( M. W) r1 A5 N' \
" F2 P% p- [: Y5 w% ^+ o* J, v# `  00401067:  push      00402025    ; \\.\SICE/ V' O: |7 T' @' ~0 w/ \5 g
  0040106C:  call      CreateFileA; p; K. {; s( e
  00401071:  cmp       eax,-0018 S5 c0 l, A0 g# m* z* h
  00401074:  je        004010917 U0 I8 f) I4 ~! ^) N1 i+ ^% |& O

( N+ v4 t4 m5 E/ V& k: m  Q# Y: m$ n  s) Z4 ^" ]( y: q
There could be hundreds of BPX you could use to detect this trick.
/ I9 f7 l8 E, z' k! i8 w; M-The most classical one is:
/ L! Q4 \* K- W' X8 d  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 s% v  k& r+ `& \3 q    *(esp-&gt;4+4)=='NTIC'4 S3 h8 D4 s! @1 U& j
8 D; |- E6 x1 V) U
-The most exotic ones (could be very slooooow :-($ P* q& I" Q  e$ Y, v/ u
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& [/ m( y4 a  g+ a4 U5 k' \     ;will break 3 times :-(
! k! W2 R0 F9 i
8 f4 ]7 }6 n' p$ N6 M) O3 ?-or (a bit) faster: : K6 P5 B; B5 H* U. [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ ?8 _2 s# S# O4 x. Z

$ R3 J& Q( D" _7 |5 N! f7 Z   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 `7 u0 u. L* X2 S
     ;will break 3 times :-(
0 Y) w! r5 a  \/ C$ n
8 X3 c' T* W' S3 b-Much faster:) Q: X8 a: l: |4 y4 u* r) Z, ]) B
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'; f# o& d+ [. i8 H' o$ ]

+ O& {! z+ q$ yNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
) @" O) E! }  Zfunction to do the same job:1 c6 ?& y9 ]3 F% l
' C: T' b6 ?7 S, F, t' _4 @; e
   push    00                        ; OF_READ, D6 n0 V& I' M4 e* P) n
   mov     eax,[00656634]            ; '\\.\SICE',0
/ {- `1 H6 @) B1 h% ?: N   push    eax
% Y+ g( G1 }1 u1 r8 j   call    KERNEL32!_lopen( Y8 p8 n* z" ], `* r, t
   inc     eax
1 W# a" ?6 L3 {% T& P1 b; p! T9 M   jnz     00650589                  ; detected8 ~4 r' C* z$ \/ n
   push    00                        ; OF_READ1 [+ u7 `9 ~& S/ z5 c
   mov     eax,[00656638]            ; '\\.\SICE'% V! C) q, \" {% p, G( P
   push    eax8 _( P, P. _  E% c6 a! r
   call    KERNEL32!_lopen1 |( P4 e" m; F2 @
   inc     eax- e  N& ^! \, _" ?
   jz      006505ae                  ; not detected4 @9 H( _% u) M( Y. B8 ]

" V) G+ p/ E/ [
4 s0 N7 F8 P# I2 T/ N0 W+ x2 n__________________________________________________________________________
7 P" x( `: a# _5 T" g# D& n
# C3 H) T- u# T3 C; IMethod 12: P6 A. g, y1 B7 ?" A* m, ~3 m
=========
- [9 M! c1 L1 S# t0 N
$ m$ w0 k" }2 q8 Q+ j2 O1 FThis trick is similar to int41h/4fh Debugger installation check (code 05
% R: u/ n" d( F) a. R&amp; 06) but very limited because it's only available for Win95/98 (not NT)
& A; H/ x2 D* {3 \" ^5 y' q( e% |5 aas it uses the VxDCall backdoor. This detection was found in Bleem Demo., i6 U. w3 O( _3 t
/ b5 `2 S1 w3 s3 W$ c6 {3 U$ ]
   push  0000004fh         ; function 4fh  X2 w& D' N$ R1 l; Y  q+ o- R
   push  002a002ah         ; high word specifies which VxD (VWIN32)! R! I2 b( z# @+ t' Y% V
                           ; low word specifies which service
/ n; b) q' g4 ^) `3 O                             (VWIN32_Int41Dispatch)
7 u, F% ?! t* Z/ x  M9 E   call  Kernel32!ORD_001  ; VxdCall2 M. ~* b& Z4 N, i0 O7 K# {
   cmp   ax, 0f386h        ; magic number returned by system debuggers0 \0 V  e) r. u9 c) c( F2 G
   jz    SoftICE_detected# _4 z' b- I# R5 ?# y. @0 `
. h* M3 a) d# Z1 N+ [: _
Here again, several ways to detect it:+ C( q7 B1 b4 s4 f! p# }

' L5 V6 z: c% E% ~8 @' U    BPINT 41 if ax==4f& _  A' q  y3 w3 c
3 g  c' F- D, M9 ?/ u* d! `
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! g2 ^% F/ ~# C, v. s- F$ x( i. T6 y
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
) _! T( E" d/ g
6 N' C# j+ e0 a+ W- X+ S, ]    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( U4 G( Z# R4 w# m4 o
' }2 m9 T4 B. P5 @, G2 _, s__________________________________________________________________________
* L, @6 s2 ~' J' w* B
, g& ?5 M8 t+ V% K8 ^0 MMethod 13
) f  Z( d6 e1 e=========
+ Z$ F# q5 B' Z& R! Y( a) ]( Y; L4 z$ a4 S
Not a real method of detection, but a good way to know if SoftICE is
: J7 {) K$ A) ~3 Jinstalled on a computer and to locate its installation directory.0 i/ g' W( R3 m
It is used by few softs which access the following registry keys (usually #2) :
1 Z( ]" o! R: d1 w8 `3 @" g$ d; _0 ~8 W. B% z( i
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' y9 W+ z" x4 K\Uninstall\SoftICE1 K2 e7 G+ Y2 P0 I: K; J
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; Z6 W7 w; W  N$ g
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 P8 p$ ^# U( |. }
\App Paths\Loader32.Exe
" p; W4 \. @- c+ G1 n7 W
4 G4 z$ q* H* C& R1 B: H6 |) ~0 a, o2 g. a) Q" |! y: S
Note that some nasty apps could then erase all files from SoftICE directory8 _' h7 M& e; S7 B
(I faced that once :-(5 R% Q5 v7 b3 \1 Y4 c0 V2 Q' \

. P0 W( }) Z; TUseful breakpoint to detect it:9 e* x  N- r$ I3 M; g4 z; g; h3 y
2 C; Z' ?+ H, |3 a
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) J# H: J, z2 c( r, N, O! j
* f4 b& {% b' ?2 l! M- o7 B4 k__________________________________________________________________________+ p3 Z4 G2 ?) Q4 _0 {! ]

2 M" m/ O$ M! Y! W! Q9 c0 a
+ C5 b/ ^: [- d4 Y3 \% \3 X& Z( h/ ~Method 14
! A2 [, @8 |- e=========
  X3 q: e# O+ n) {' e. i
3 R4 r* I" F* ]0 }  M3 R: nA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose1 ^- `- f2 ]8 }( y3 |3 C
is to determines whether a debugger is running on your system (ring0 only).
1 a3 ^% t  g# g
6 ~/ A; Z4 w2 |4 E   VMMCall Test_Debug_Installed
  b# W' L8 N4 a+ w) T% x% h" d   je      not_installed
  y+ Z# y8 n: S
* ?  {: C' h9 G% {/ v$ K1 J  ?This service just checks a flag.% q) I% |7 m4 ^
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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