About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>! w6 _3 q1 L& s/ [: |; x1 @
<TBODY>& |; N7 Q6 X3 E
<TR>
/ K; g/ `* L# Z$ X( {) \  i6 a<TD><PRE>Method 01
! S7 g# C) E& P3 t% @) a6 w$ O8 p=========3 U" b1 \5 i4 \; ~

6 P$ d& V9 t+ [, h5 Z2 M& E  {This method of detection of SoftICE (as well as the following one) is; Z* r+ S8 F, c) |3 i6 l6 U; [7 T
used by the majority of packers/encryptors found on Internet.
: P# h9 w* W- P6 @It seeks the signature of BoundsChecker in SoftICE* Q* `; }4 i' U* |+ Y$ c

# s0 C6 S; p& F2 |) z. M    mov     ebp, 04243484Bh        ; 'BCHK'
* A& S# d4 F; H& o3 `0 A6 u4 w    mov     ax, 04h
& w; d* C7 F) g    int     3       8 P& H& W8 y9 K. A* d% t
    cmp     al,4; a* ]2 k& I; w$ \( U( b
    jnz     SoftICE_Detected
0 @: t5 Q$ p* ~5 r& N7 l9 Q$ a3 S$ A+ w4 G2 p9 Y% g
___________________________________________________________________________/ v. B3 k: B, v; \( ^
; e( Y3 g8 z. {7 Q: K, h* |
Method 027 J9 M: M* P6 t! g$ ]8 V
=========4 d' L) y7 W' A) k
" b- y8 v  g! w+ q7 ^5 y7 R! c$ h
Still a method very much used (perhaps the most frequent one).  It is used
" U  S' n; y" V- V* Qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,# R; p2 u5 A8 W& r, K2 b
or execute SoftICE commands...- m. |. z& P' s* f
It is also used to crash SoftICE and to force it to execute any commands
" J  k4 e+ C1 j+ l" B! a(HBOOT...) :-((  , \4 l: T  a6 L; r: ?. ^
  j2 d9 ?( ~9 [5 X
Here is a quick description:4 @0 r% a5 g" k( Y+ m
-AX = 0910h   (Display string in SIce windows)
/ d+ @; f( p! |# Y-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx), ^0 F8 n2 |/ l
-AX = 0912h   (Get breakpoint infos)+ U; g1 U1 \7 x/ a! L5 ?
-AX = 0913h   (Set Sice breakpoints)# x1 j* o- S; Z  T" o
-AX = 0914h   (Remove SIce breakoints)
- N; y3 A8 I  a) |/ n1 q/ ^* v" I( K2 q/ U$ f! J! p2 Q
Each time you'll meet this trick, you'll see:6 w9 _# q2 q. g! u* n! y
-SI = 4647h
9 ?8 w& a+ i, p8 ^-DI = 4A4Dh* n' `" H. b& W+ f; I" @
Which are the 'magic values' used by SoftIce.( T. |. W' m$ o9 p, j, S
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.' N, q9 j4 K# F# o

2 l$ p6 ^% {# m' aHere is one example from the file "Haspinst.exe" which is the dongle HASP
3 u4 y/ F& Z  u' qEnvelope utility use to protect DOS applications:
: I2 a5 d8 `" l2 r' B5 J
9 ^8 q7 D3 k7 E/ Y- ]5 t; X/ a% f; V% P) B$ M
4C19:0095   MOV    AX,0911  ; execute command.
! k0 h! p7 r! S5 k" Q2 L" F1 P3 p4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)., T+ `  f' i' J$ }, F  }
4C19:009A   MOV    SI,4647  ; 1st magic value.
+ v( Z7 b8 \3 L. \% g# x  k  y) S6 N4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
2 o+ u8 U& {3 w# G4 ]4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*); u" j, ]7 R6 m: o0 l: _; b
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! N5 y5 O2 P) R0 y2 ^4C19:00A4   INC    CX: e! ]1 ~/ g! k' q, Y! n. ?, m
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" }0 k5 B0 v1 Y, h+ O% J2 u
4C19:00A8   JB     0095     ; 6 different commands.- G6 `' A4 S" m, q2 U
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
" u0 l, p) b7 v0 d, E9 J2 h4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" k( u* ?; W; G0 w3 a( S% w1 \2 K8 @
% t0 a+ x6 O) v2 m$ S
The program will execute 6 different SIce commands located at ds:dx, which  q2 d* r6 D% R+ C, V1 m7 D* d
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) L* Z5 p% t8 [2 \$ }( V( `$ p# H
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! y* B3 L- Q! }; y( v& b
___________________________________________________________________________
. t& w2 E) Y- b9 M1 o+ R
2 B. p0 K+ G: E4 J) |9 {% M8 d/ m! B; J! b- ~, z$ t
Method 03
+ f; n6 d( T3 ]" ^$ @=========
: d/ Y9 K9 s. u8 l1 a) k
9 h$ @, l/ x8 l' u* O- M$ \% `Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ t  t+ ~, R: u. f" J. C(API Get entry point)% H" q" `$ }: S/ f# ^; @
        6 D% j, ^) u" x, X$ q) [
# X5 U- k9 Z- W) |8 _6 o1 T( g
    xor     di,di
  U. }2 r$ U: y    mov     es,di
7 n/ I* {7 T4 t3 v) h6 e4 [$ r3 U    mov     ax, 1684h       ( v, P2 D$ O; W! L0 b
    mov     bx, 0202h       ; VxD ID of winice1 y) z1 K) M3 P4 _- i! |7 O) ^
    int     2Fh( M- n& o* ^7 }0 E) ^7 M
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- F# L+ J" Q5 V    add     ax, di
0 ?% w/ ^: `/ }. _, s1 L    test    ax,ax) }; _. q7 d, N0 z  y# W: \
    jnz     SoftICE_Detected1 g2 q9 G9 R+ u) g0 B. e- X
7 G/ U* y# F+ |* u% r% z
___________________________________________________________________________* I! x: P) K: w8 b  ]
) H9 w1 p5 E+ n: C2 Y' T5 E& x
Method 04- _( l& p5 k6 l' Y! B2 S! [
=========  b! U/ ^- r$ O" |" [
6 F5 j8 U$ A5 O6 A$ X2 V
Method identical to the preceding one except that it seeks the ID of SoftICE( I: L& S/ T  X9 p. G5 L! [
GFX VxD.4 R' e9 G7 l5 U# M2 F7 O- e( d# M

' e. N" u: w; t9 X1 o) W; c" J$ y    xor     di,di# t; m* B  C" H- a7 R% }
    mov     es,di
( }+ Y% O, r& e" D3 k2 d    mov     ax, 1684h      
# u: Q4 B4 j/ r0 N9 O! i    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. ^/ T4 K! O; ?    int     2fh4 }: L) g) m% f# _: a  t& |
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ C" C" u& w" p( ?' _! `' K0 C; l- Y
    add     ax, di
9 f5 V$ N! O7 ^# A0 t    test    ax,ax9 y$ o0 y( M8 ^4 L! |! Z5 }
    jnz     SoftICE_Detected
- n8 n) G& h, t1 p1 o7 l0 s; H9 f/ E/ n* f8 c* P" A
__________________________________________________________________________
# a9 h3 x/ Z5 W) w4 o6 `& F: U
: }: V9 A1 u7 ^- P
. Q' M, D; O% DMethod 05% X4 k4 `7 Q. ^& a: U2 `
=========3 b/ K5 D7 j$ K0 w$ ^" d: _

! F1 O# ]" U' l! D/ [) K$ RMethod seeking the 'magic number' 0F386h returned (in ax) by all system" F2 |" p, i" I  @. d# {
debugger. It calls the int 41h, function 4Fh.
' N" o: d5 H2 B4 ]' sThere are several alternatives.    J" s8 M' ~, ?9 N+ T( Q/ C
' j2 M0 Z/ ]; A! J, b
The following one is the simplest:
) V$ h% Z, g! z: s6 q# ]* J+ }  o/ E
    mov     ax,4fh% b( D8 x0 N# q' j. q
    int     41h- r  i( H& u* L
    cmp     ax, 0F386
; p$ d3 G8 z( _    jz      SoftICE_detected
/ ^) ^! W% M% |) e# g" R4 t
# R/ U: j( e  J& }8 K1 Q- x( }0 d* d) D* W; u
Next method as well as the following one are 2 examples from Stone's ( u( p" a. k2 A; T& w
"stn-wid.zip" (www.cracking.net):+ D4 O2 }% S' @

! w5 X- y2 z0 n, h: O& Y/ L    mov     bx, cs% t5 y, A  C9 z% s( z
    lea     dx, int41handler2
- M' g' h/ _# b; ^8 Z% ?& U    xchg    dx, es:[41h*4]) P1 d- m* S; @1 i
    xchg    bx, es:[41h*4+2]
, R! P4 g8 }5 \# Z' A    mov     ax,4fh
/ d, ?1 b- u" O5 `4 p6 J$ `, D    int     41h: }$ |8 _  c2 }$ v6 z
    xchg    dx, es:[41h*4]
" [, R' p5 L6 f8 v7 f" c# t2 {    xchg    bx, es:[41h*4+2]
+ `7 r" d. Z# W( z- T5 a! v    cmp     ax, 0f386h* d8 U0 t% c+ j! A/ ~
    jz      SoftICE_detected
3 j3 X% L' @+ A- h5 x& \! A: u# d, j  r1 R9 l, |) c
int41handler2 PROC6 g2 K! _3 k$ n
    iret8 t/ V& l; |% `
int41handler2 ENDP6 i3 \6 z0 D0 c) j% `* q
- c5 h4 G) z! J6 N. w

9 E9 k6 G* b6 __________________________________________________________________________
: z) @6 G) G1 {: B4 w* I
" S' N, f* |$ R2 Z9 z& h! ^; y
+ b9 _: }" b/ p/ A2 u( SMethod 06
! W, }* V$ `$ G& q/ _! {/ Z0 Q: c/ G=========
7 ?8 ~. K. t5 x- f+ l9 A8 k7 `2 v$ p) N, c! l
5 ^; l$ @( x! E3 z3 Y
2nd method similar to the preceding one but more difficult to detect:! V9 L1 ]9 t6 g2 z; M. R2 l( L6 ?
2 L: \% N: }+ z$ R$ ^

+ S& B" Q6 B. |+ ^1 h7 Sint41handler PROC
2 F. A2 t* X# {0 i# z    mov     cl,al
0 K; K% Y% m$ t* W; d+ h2 }    iret( ~9 ]4 c  G& N6 Y3 k  _3 Y+ ^
int41handler ENDP
9 u- l; P  y5 A1 t% M3 c/ ?. e9 D/ G) A/ w0 m; L  z# @

2 C6 u" U: U! H* V9 ]    xor     ax,ax" W: Y0 H. ?+ c1 @$ F( B
    mov     es,ax1 X# L3 h- f! {+ H# ~
    mov     bx, cs
% A# `6 M& Y3 |9 N) @    lea     dx, int41handler
0 c6 D$ N) N$ a1 y+ j6 X    xchg    dx, es:[41h*4]
# ]$ t: B5 v" }: }    xchg    bx, es:[41h*4+2]
* u1 E+ M; Q% k5 \  u$ \, {    in      al, 40h
6 E7 X) E  T" i# d  }' n7 C    xor     cx,cx
+ K$ H8 ]1 t0 e' T7 u& J" }    int     41h5 E( y/ h5 z( ^; M1 A1 `
    xchg    dx, es:[41h*4]
# n9 ?9 J2 N* d2 y/ C2 V7 F0 L    xchg    bx, es:[41h*4+2]  e* H# j' v6 A  h4 \1 [1 k
    cmp     cl,al
: f! L/ o3 x5 x* Z8 U1 ?3 @    jnz     SoftICE_detected; A" i$ v, b% r! D
3 Q6 L0 U  f2 P/ Q% \" l6 D
_________________________________________________________________________
4 R3 ]1 b* h* b' }1 t
" r4 i. F4 T" pMethod 078 H7 r2 k: k7 [4 W
=========  }9 E  M$ k0 t, B
9 K4 Q$ {7 y; E: f
Method of detection of the WinICE handler in the int68h (V86)
# K2 L; s# o9 j' z. i0 }
1 A# ~+ S+ o2 t* R" J    mov     ah,43h
$ J" A& m/ E/ ~6 U5 }7 v    int     68h2 [2 s. N4 w% _* `8 x
    cmp     ax,0F386h& a) \7 l* g# u; t
    jz      SoftICE_Detected) l# f/ A" _, f. c

1 w9 q$ C2 ?/ w* L! G& x( b2 U
6 D% K  D) g. G' B4 k=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# B: P7 M7 M% e  g$ N8 |* c5 d
   app like this:
) `  |5 B5 q, K/ Q9 I* @9 L! F8 w- M1 Z$ v& t$ ?9 d( C
   BPX exec_int if ax==68' [0 E, m( s7 X7 s; E- V5 s9 C
   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 C/ y7 g! L2 h( L* t; x. r   located at [ebp+48h] for 32Bit apps)& e# F9 E% ^4 [0 H2 T
__________________________________________________________________________
8 \& i1 U' ]! r. g4 ?
* M4 o( {; y& q( b& W- q( o: ~! R
Method 08. K% U8 k( ^  W* f4 `3 A0 Y, f2 h
=========
% K6 w5 M3 g+ e$ W0 Z9 Q1 t
& u4 s* P* g9 ~, {It is not a method of detection of SoftICE but a possibility to crash the
! C) G5 Q3 O9 O4 b5 d1 Usystem by intercepting int 01h and int 03h and redirecting them to another5 I$ ]" _+ j$ _% h
routine.
9 P( I5 u* Z3 t( S0 w5 nIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- i& m- }; w* w& a# ato the new routine to execute (hangs computer...)
. x/ X& k4 Q9 |: T% \; i& Z
3 i$ d5 {4 c5 e8 r5 K2 a    mov     ah, 25h9 r  A* t6 {# y" K
    mov     al, Int_Number (01h or 03h)* R" a4 s4 Y% U/ V1 }
    mov     dx, offset New_Int_Routine
. R6 Q& O! p3 ~: v7 B7 o0 A: D    int     21h( l7 B9 s$ l+ [0 T/ B" @
6 {) J5 h% F/ S6 e( ?, o+ h& i
__________________________________________________________________________3 d2 o7 R8 {1 v3 A" [$ [# B
8 T6 {- ?4 G" r' |8 w
Method 09& l2 k& h  _! d! b$ n( w
=========  w9 o4 u2 T; G/ H, y7 j

% N6 i2 J$ r& `% {  nThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
) q2 O4 t' _  D' P6 A! Operformed in ring0 (VxD or a ring3 app using the VxdCall).# \) Y5 h9 }6 Y3 M. {/ {+ M
The Get_DDB service is used to determine whether or not a VxD is installed
5 J/ I4 T/ @, J$ Y9 p+ gfor the specified device and returns a Device Description Block (in ecx) for' `2 g0 J* Z' x7 }" I: ]3 H
that device if it is installed.
& n, k, V+ y" B- }! ^- X' C8 N1 A
& p+ T4 u( e& G" J- u. e* z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
9 J. y! F: T4 z- j. r# r   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 X" h$ y6 s9 _8 A
   VMMCall Get_DDB7 [8 v- X2 ~& N9 U; e/ [
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  L6 K% a* R. x. b1 c8 H! Y6 W4 j  B# i- \  c: v# j( v
Note as well that you can easily detect this method with SoftICE:! F# j; C" L! Y
   bpx Get_DDB if ax==0202 || ax==7a5fh
  g, K" W3 b0 `# J" q: D
4 H+ @+ f( D6 p/ U- j3 x; X6 L3 k__________________________________________________________________________
3 `% A! X0 D2 o2 ~* m4 i$ f8 p- B
! L; \& l2 e) y4 h3 `Method 10
$ W; n# P- s3 w) Q0 W: {6 l" ^=========  _! \+ O; t) q

) L& y% D; d8 Q5 i=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with& S' ^7 A. h1 U9 U) x
  SoftICE while the option is enable!!5 U) M( z6 F3 c' c- U
& w1 _' U/ n& h% v
This trick is very efficient:. i  i; ]! H9 W& a
by checking the Debug Registers, you can detect if SoftICE is loaded
% B/ E" R: ]& b" Y2 N4 o% l(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, v, H$ g; Z  j! A# B( n  r
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 D- M! \) R6 y9 i. Xvalue (in ring0 only). Values can be manipulated and or changed as well- B) E2 p3 C: u$ g$ `0 _
(clearing BPMs for instance)
! @5 I, k, _+ G) m
& f& H* r6 R& ?7 @__________________________________________________________________________- g% z1 h1 i' d$ p3 q
! B( o  s6 o1 N$ J
Method 11" [, ^5 A' b3 E+ W1 q) z5 R
=========8 N0 U" r+ c& M" Q4 u
# b5 v( W/ c; |, ]
This method is most known as 'MeltICE' because it has been freely distributed( [" i$ q; u8 s8 }; h! ?' ^! F' K
via www.winfiles.com. However it was first used by NuMega people to allow
/ Q, M0 x3 }' Z8 o: k4 Y& ZSymbol Loader to check if SoftICE was active or not (the code is located* n# ^) e. f1 n. U5 k# C
inside nmtrans.dll).) T" L5 [" v1 ^

- I( R5 o  |2 V  ?The way it works is very simple:
0 X- g; Q: _2 p. d; \" \* eIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) X9 }1 U! V9 I, X
WinNT) with the CreateFileA API.
. P  H1 G  s4 L9 ^) s: K% D
% e4 L6 I3 m) UHere is a sample (checking for 'SICE'):
% U9 w3 m9 h+ G. A. d
7 }- C; k9 c& S! E1 NBOOL IsSoftIce95Loaded()& \, z' o3 f1 c4 h
{9 Q( a# R2 f; P3 L" }
   HANDLE hFile;  
+ }8 A* G  s* _. J+ b   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 z- \6 a$ h  t$ n3 M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 A- |$ h1 U6 s" I1 ^% j
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! p6 B8 R+ b3 U- x/ j7 r+ s   if( hFile != INVALID_HANDLE_VALUE ): Q8 t6 a) h- N& l
   {' @* ]. W# g" A& s; w" e7 h# Z3 ~
      CloseHandle(hFile);$ |3 d+ ?; Y1 F+ ?" c3 q
      return TRUE;
5 {  `7 F4 @! f' N2 w. b/ [. t$ w   }" ^3 {7 G4 S1 C$ R
   return FALSE;/ r% e8 B  M- v2 z( Z$ V
}5 L( J# N/ `- o+ c* I
8 Z% A4 t/ j$ U# y! h/ {
Although this trick calls the CreateFileA function, don't even expect to be
* a! m, h+ {3 k8 uable to intercept it by installing a IFS hook: it will not work, no way!
3 C' X- K" k) c6 NIn fact, after the call to CreateFileA it will get through VWIN32 0x001F* X7 x0 I3 e" {" M
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( F- w  w: m3 d& i/ b6 e' [
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 k' G( E3 m; w4 zfield.
5 H" Z; o1 G% F& {5 N% rIn fact, its purpose is not to load/unload VxDs but only to send a 8 l3 O  Y5 y( y5 c6 I! {) h
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ b# @7 O- l! i( B% |3 Q" k" h
to the VxD Control_Dispatch proc (how the hell a shareware soft could try& C* b! A1 D/ S; \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
! q. q$ L( Z0 b( wIf the VxD is loaded, it will always clear eax and the Carry flag to allow
" Q0 j6 f! w7 W4 H/ ?, j% hits handle to be opened and then, will be detected.. ^# z8 `6 X7 n$ F
You can check that simply by hooking Winice.exe control proc entry point
& y- H7 ^0 k" l" H- T+ Twhile running MeltICE.8 z9 M5 a; L' I

# V$ b0 D* T4 Q2 ?
+ c% j+ v6 y: V9 [0 ^  00401067:  push      00402025    ; \\.\SICE
3 p3 X) H% @) O; A- T( ^; E  0040106C:  call      CreateFileA- f) a% w# v* W: N* U- T
  00401071:  cmp       eax,-001$ ?5 t1 d+ \1 q% k) Z
  00401074:  je        00401091/ `$ ^8 N- x7 B2 h6 Z( l% I/ a! ]

8 i. D% j+ i: k/ s, {+ W
/ ^" T& D/ g) E* _There could be hundreds of BPX you could use to detect this trick." M3 w* Z. V  l( v1 u
-The most classical one is:; x( T& x; i0 Z1 w4 y0 m; I. f
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 n# C- D& g( j! u    *(esp-&gt;4+4)=='NTIC'
( |6 p- z7 Q* L( |1 Z7 d/ C; d) r8 M! J% o* I7 R0 ?
-The most exotic ones (could be very slooooow :-(
6 G2 C( n) D% E3 X/ `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( _* l) h( O1 U! k8 }5 s: L
     ;will break 3 times :-(
5 Z, c) R, i% e5 ~9 {% N" t* R0 c9 @4 _$ O+ g: f+ L
-or (a bit) faster:
8 U$ `6 R7 A6 [   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 x! u' N1 [, I) ]( w( B
* J+ h+ ?0 I. e& g$ ]" \
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 W0 d( C$ \3 S     ;will break 3 times :-(2 _* X- k  [5 e0 N8 |) x

! p( e. ?- n) M0 C' F-Much faster:& {$ e; u( I# d* p& e
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 W4 J$ X. Y+ u& e2 ~- ~6 \, a3 R
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
7 w: q! V' s7 `3 z! S( wfunction to do the same job:) {' {0 w) L% M

1 x/ f, {5 ^9 ~. `   push    00                        ; OF_READ
/ H4 v8 p7 U. R   mov     eax,[00656634]            ; '\\.\SICE',07 b+ S0 L0 p+ h6 c$ j2 C) a
   push    eax
1 C0 H  B  G1 H2 h# o/ c& _   call    KERNEL32!_lopen
) W: a( M: D( f: u9 R7 T2 _, L   inc     eax
1 a4 e( ?9 x$ [# a   jnz     00650589                  ; detected; S1 q6 J: p! Y0 y
   push    00                        ; OF_READ
1 H/ w2 D9 h; R. I9 O( w8 ^   mov     eax,[00656638]            ; '\\.\SICE'
# B' D2 v; C( _- `" E   push    eax* a" ?! r1 _3 G0 J
   call    KERNEL32!_lopen- v, h& _/ l/ P& S/ u- ?$ ~
   inc     eax) |& r2 n% Q+ A- ^7 L
   jz      006505ae                  ; not detected, Y  X* e) i5 r- \1 E/ X

  u8 A! d( M) S
; j" W- O4 V" `" p: F& N( i2 N; ?__________________________________________________________________________
9 `! U* [, L+ I" }# P6 D! d( q0 z1 ^* r' N7 W: _. F$ @, `
Method 12
1 y5 J/ Q* ?; d- _5 v& L# R  j=========* E/ h4 A6 @1 d/ O  c  }0 s5 _! l
$ h( V( G3 ]1 K$ r% ~3 j( q! H
This trick is similar to int41h/4fh Debugger installation check (code 05
4 i  _2 M3 P( q; e: g& u&amp; 06) but very limited because it's only available for Win95/98 (not NT)6 O* g; E" `0 E( S0 Y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo., a9 {  ~6 U# p$ X

6 W4 [( A) x) }, ~. d4 b7 U   push  0000004fh         ; function 4fh
, a  K% y; i( c! u+ i6 f% e& J   push  002a002ah         ; high word specifies which VxD (VWIN32)0 H9 k" V' x  |+ u& R9 V
                           ; low word specifies which service; l4 b0 {3 \# }8 ?
                             (VWIN32_Int41Dispatch)8 {* X) B2 t! A1 {7 W) ~
   call  Kernel32!ORD_001  ; VxdCall
: \3 ^. J4 U, g   cmp   ax, 0f386h        ; magic number returned by system debuggers
7 h/ D, j* l6 f+ c   jz    SoftICE_detected" Y( o' Z5 M( G) M+ X
. W( l7 H2 K: M( R! C. e
Here again, several ways to detect it:
4 F3 S) R8 ?" @/ X* l9 I/ s2 N; B8 Y; V1 [9 P! A
    BPINT 41 if ax==4f$ m# K- E8 l. T4 x) v+ ^+ H

/ l  \, r1 C/ d5 [$ _$ L, I; o    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
* M: I/ W6 _  O% r# w
8 k# j) ]" l# ^2 J! J: W7 R" m7 X    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* H! j" A: q( y4 c7 H0 g
& f+ n% n4 G/ J2 n; J+ g
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 I: {& o  `2 g3 ~

* [7 k" S( I5 P3 w- |( z1 O__________________________________________________________________________. G  H" V/ B( K4 Q$ _- c; G
, e4 I: O) `5 W6 O
Method 13
# r8 F; k( P( ?7 P2 z9 \=========
& F) m" W5 j/ p, b  K4 |/ @- q, Z' c  @- M
Not a real method of detection, but a good way to know if SoftICE is
* h! x* s' b1 ]+ Yinstalled on a computer and to locate its installation directory./ _' Z- l: |4 @& v
It is used by few softs which access the following registry keys (usually #2) :- _# q- h' S( T+ t
. j' A+ P# {7 F3 e; S* F) \
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) l) j: T: A6 n6 c: V
\Uninstall\SoftICE# B* L/ j; W. R7 G8 g* ^- W$ X, I! e
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ a$ l$ `2 f! N  f: {& W-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  S' B, M; F* l: _4 U# [) M\App Paths\Loader32.Exe
) h, V: T* _& ]. |6 L. i9 o7 T" d8 p: q. t. i2 l
: A( M) b+ ]& Y( e' R3 S
Note that some nasty apps could then erase all files from SoftICE directory! N! \  G: c9 K3 n1 P4 U0 i
(I faced that once :-(; O& C7 m3 A& ^$ O4 R

" z8 Q9 D. `: C0 V) HUseful breakpoint to detect it:
. K8 ?9 I( M% q7 h3 g" @
' u+ j+ F8 }% ^/ V     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
9 R3 j( O, Y$ R1 R/ X: d+ v5 B! p/ A% T  _" S
__________________________________________________________________________
. P, u% _$ Z2 h  }0 T  E, E9 n1 R
2 B; C* e, E0 j
# V& ^+ [; m$ n4 k5 z. W1 L0 j% \Method 14 : }4 V& I9 {+ g% G; k2 l% C
=========3 j% X" w8 C# H  z
- h% \/ |: q1 E. N( X6 Z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose" B9 U7 q: T: \/ S9 Y; C
is to determines whether a debugger is running on your system (ring0 only).& i4 o0 ^+ d( M  k% s
1 e9 U2 h2 l( U7 r. P% I( j7 A
   VMMCall Test_Debug_Installed
( w  @8 ]! g& X" l* B   je      not_installed
/ ~7 d. |1 a6 T6 I6 K8 T  \% f3 c( [$ R0 O. `# _1 G. r
This service just checks a flag.
) ]8 P+ |' t8 Z% C7 u" L& @</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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