About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
. u- t+ m- G6 c. k( c<TBODY>
* [, A1 L& q: e<TR>
* D0 F7 i2 c; U0 c' y/ ?3 |<TD><PRE>Method 01
; P. e9 o1 ^* V' x# L# m=========- ~1 E" M+ ~8 I
: M( N( ^: U; M+ Q
This method of detection of SoftICE (as well as the following one) is9 j) v# q# h9 ^" A' I0 K1 V+ T# e0 ]
used by the majority of packers/encryptors found on Internet.: I( r9 J0 M7 o) c, m) R% j& P
It seeks the signature of BoundsChecker in SoftICE% @- T! g5 Y1 f4 f* n1 T

; [4 A/ M: L$ v    mov     ebp, 04243484Bh        ; 'BCHK'5 q* N% g7 `: V) r7 `! E
    mov     ax, 04h( O; d* Y! v6 G) t4 B
    int     3       ' Y* o6 N1 ^; w8 e, y  s
    cmp     al,4
' z. p& L: X0 u# l    jnz     SoftICE_Detected
+ i; ]& b& x2 W. u& v6 e- @
1 N8 r/ K) X7 a& K) g% K+ C9 P; P___________________________________________________________________________
! q" E' V/ |0 e/ D6 `% p/ x: U1 O4 p5 \( G. G' b2 Y
Method 021 C# ~4 t% j7 l7 H0 A" p0 m% t- B! }
=========
% J6 Z5 l# Q  g/ a) H' [3 K. T0 J, b# x+ Q+ x
Still a method very much used (perhaps the most frequent one).  It is used
) k% I+ T# ?3 K% L2 {) Nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 S2 d' Y8 d1 x7 P2 n4 V+ z5 m9 h
or execute SoftICE commands...
# F6 |* h4 e  ]' ]4 T* S! V/ Q8 C0 O$ wIt is also used to crash SoftICE and to force it to execute any commands* V! R- q; h) B
(HBOOT...) :-((  % |, M1 ~) l% k" k  f( e
2 }0 j3 L! w6 E% U
Here is a quick description:2 T4 S  A$ O$ H8 {
-AX = 0910h   (Display string in SIce windows)
& b) e$ P6 E9 c; R- {-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)' W+ ^9 S% t7 J5 [( g: X  w
-AX = 0912h   (Get breakpoint infos)& i1 G  p2 F. s! \& _: K5 K
-AX = 0913h   (Set Sice breakpoints): D" p4 [4 A+ s1 B8 ^$ w) v
-AX = 0914h   (Remove SIce breakoints)
: I1 f* z7 n; b, T. {( r$ y% f
$ ]5 O1 i% e9 F. g# `Each time you'll meet this trick, you'll see:( m& v' S2 {) G
-SI = 4647h8 [7 [' Z: z% M
-DI = 4A4Dh
2 \4 Z/ W6 a6 tWhich are the 'magic values' used by SoftIce.+ C6 Q, J$ _" h$ E! [
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" s6 ?9 {3 I( X2 i
3 S# i- L* @: d" |9 s6 G1 OHere is one example from the file "Haspinst.exe" which is the dongle HASP4 J8 z  {5 T2 g, N* ?6 V
Envelope utility use to protect DOS applications:
6 F7 ?* m6 ]2 K6 G
) C6 Y1 `$ ?, U/ }6 _3 {- F# S0 u- t& p; o% g  Z' a0 e
4C19:0095   MOV    AX,0911  ; execute command.2 _5 f! v* o; Y( F- a
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
4 I" h0 D  \) R# `' U4 z2 B4C19:009A   MOV    SI,4647  ; 1st magic value.$ Z: s9 }: l, P7 S- k; g
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! Y5 Z* d( W$ j" C, k4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
# J! O8 F, P  ~2 [4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ b& E3 A9 y: E$ Z' u* F) S
4C19:00A4   INC    CX, Y% H. J* B! D1 n8 T
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ z% d1 U3 P, |# b
4C19:00A8   JB     0095     ; 6 different commands.
- i& G* f0 ^' b, j! ~7 [4C19:00AA   JMP    0002     ; Bad_Guy jmp back., s( j/ T" q4 `4 T' `9 X! ~! P
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 s3 O7 A: q8 m! u$ {" R
: Y/ h4 h+ J% b& Z, d8 }4 P! kThe program will execute 6 different SIce commands located at ds:dx, which! p& F5 L$ v& Z7 O
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 o% V: t2 F6 F" x& {  G% f) W# a

% \/ k- F) K: w+ _4 q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% R  f/ q7 ?/ U; M' ^
___________________________________________________________________________
! K! z$ A6 S- i
' q. Q+ L9 |. z) C8 C/ C- T. S! w
0 Z9 P7 G; p' s1 I8 V$ o8 p' l8 Z. nMethod 03/ l' [$ ~. U6 ?( q$ ^' ]
=========
$ e5 K: G6 j9 j9 ]3 y  n7 J# o6 Q6 H2 @: _& ~% ~
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h7 a6 u/ ~/ f, \
(API Get entry point)
$ o. u( M2 m! i# c* S        
5 f/ B1 N* D% `5 ?0 O1 U5 h) q$ q  ~9 s- o2 A% D4 ]1 w; Z
    xor     di,di
1 w# a  V5 ]  d' N& V    mov     es,di
9 D5 \# A' c/ H0 x; N5 r4 ~8 B    mov     ax, 1684h       " n% N3 f# @) F8 s
    mov     bx, 0202h       ; VxD ID of winice, f! {" t3 r6 w  T% _& a% K
    int     2Fh! n6 b, _* s5 j) ~( f9 ]# d& y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 r; c6 T5 X5 T    add     ax, di! B$ [# g  {7 ~
    test    ax,ax
, I( m' s5 b$ T8 }* X; [( `    jnz     SoftICE_Detected, ?) T' `3 S" O! c7 Q. e
) n$ Z. J; ?6 F- p$ h; h  e
___________________________________________________________________________1 T4 t" S% V) f$ f

. x6 H  G$ ^% D( r) ~  NMethod 04
+ I; f! ?$ d+ g' C' r=========) e8 S& B2 [/ D* F. U! u/ M; Z
7 A+ u0 A' S, }4 c( W
Method identical to the preceding one except that it seeks the ID of SoftICE$ {& |' P: ]3 l- D9 f
GFX VxD.( X* x; X4 y  z" Z2 X2 D6 n6 l

/ g1 ^! ~- r4 J9 g" D    xor     di,di
" _% O  r+ o; Y    mov     es,di
! i. ?  z! w; I2 c/ z- K' u& T/ r    mov     ax, 1684h      
# @! X4 b" m* _& L& S    mov     bx, 7a5Fh       ; VxD ID of SIWVID& g6 |2 d  l$ q) q( a3 ^) S
    int     2fh6 w) m" M+ z+ t$ {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ G+ {0 z* C2 h7 f' L3 F0 L5 J
    add     ax, di! `" e3 U7 \, Z' p4 ^) W+ O8 U
    test    ax,ax
% {% j" o% W* Q1 u0 E' B    jnz     SoftICE_Detected
$ I6 ]3 O/ C8 }# X
, c+ J/ n8 j. H; `# }; I__________________________________________________________________________# X( r3 i4 B- K5 ~
* E9 i4 W4 J2 Y9 Y
9 [! `5 V, T, f8 x/ a' ~1 \9 l2 q+ L
Method 05
- r! h1 d% t) b=========5 q0 R9 G6 J+ `2 R

% q& w2 ?% Q! b$ h8 XMethod seeking the 'magic number' 0F386h returned (in ax) by all system% m1 k7 L. Q, ]( R  r& }
debugger. It calls the int 41h, function 4Fh.
# C& {! {/ h" Q  O8 z! wThere are several alternatives.  
- q. R" v) A/ k2 C3 H! b
" \9 p; Q" r& M6 ]+ o) [/ TThe following one is the simplest:
! b6 G. m# E" I3 a
5 u5 y) B" m" F( b8 b    mov     ax,4fh
1 ~. c- v3 O" i* v    int     41h
3 r9 `& J: I4 s- P  k    cmp     ax, 0F386
7 p/ o0 I5 ]6 d: o    jz      SoftICE_detected5 [% N1 w; d' Z1 P# t

% n2 U5 p5 Y* R( T: n# P8 q0 N2 E  F5 r0 }
Next method as well as the following one are 2 examples from Stone's
( P, k; R0 v" L5 N* {9 t; e% B( M" f"stn-wid.zip" (www.cracking.net):0 i% h$ r1 I' e  _5 l8 T8 \8 k
) t& ]9 |% x3 G' }5 f8 `
    mov     bx, cs7 H% Y5 b% J" w9 o! Z
    lea     dx, int41handler2/ _  m, M& e# ~" ~; _
    xchg    dx, es:[41h*4]
/ U, V; m/ A8 B2 h+ p# c    xchg    bx, es:[41h*4+2]
& Q4 e" O9 v& |    mov     ax,4fh0 ]- R9 a3 w$ C
    int     41h7 Z6 b7 g- y1 l, [4 D4 a" Q/ u. K
    xchg    dx, es:[41h*4]
6 F/ E. h3 Y. p2 e) q- o6 T    xchg    bx, es:[41h*4+2]
8 O5 b% P- Q# I( s    cmp     ax, 0f386h/ J& R$ G5 T. f1 i6 G% W
    jz      SoftICE_detected9 k* E! ^" x' Q" U  |
! m& u: R$ p; n3 f$ W8 B
int41handler2 PROC4 A9 c- i" C$ k" X0 u
    iret8 Q8 p  h6 x9 Q- k& F
int41handler2 ENDP' |$ d& h! m; ~6 Q$ [0 C8 V
- G2 p% a) q5 z- y/ I8 x* c
& u0 P: H3 I& z
_________________________________________________________________________
0 x& u$ f/ g% |3 u7 T* P7 ]- o. z: d. O2 S+ Q( e7 w

' Q' f  F" y* d  G2 z1 dMethod 06
/ ^$ i# w" n# u' T1 c( a( f" \=========
) }! r/ L- _+ r+ z% t( L% u( T! d# i$ {5 [8 i, R8 V/ u6 R' w

( _+ [' Q! z" _0 a2nd method similar to the preceding one but more difficult to detect:
, D2 B+ s$ r" o  {! \, p' ?! k4 l+ p8 Y, H

& y! |) g4 F+ c) f6 N- P( U0 mint41handler PROC, @& p5 `( R' f7 Q2 j# ~
    mov     cl,al2 Q7 P/ _+ l5 W' L
    iret
) g& I! Q6 ]) Xint41handler ENDP
5 w0 v4 I  }& _8 O# k# f4 t. l) z8 m3 u. V) L
2 ?: Q+ _8 Z3 m) C( F& u
    xor     ax,ax6 E- a+ c+ U+ O6 c  Q3 Y
    mov     es,ax) Q- \8 _; H" X& m! I
    mov     bx, cs8 C6 H3 ~( v: h% g4 f4 q
    lea     dx, int41handler8 @/ L0 ]5 A) Y2 ~
    xchg    dx, es:[41h*4]
" w, |9 u0 t( f+ C) N0 S    xchg    bx, es:[41h*4+2]* Y  c8 L( e$ m4 h3 t) j
    in      al, 40h
- g, @: O3 E6 p, Z. {6 Q4 u    xor     cx,cx1 w0 O7 J& V  V3 ?' a  S/ }- \
    int     41h( o+ q5 H+ D) P* ^* u# g: V$ P
    xchg    dx, es:[41h*4]
) E$ P+ `5 f% }7 J% k    xchg    bx, es:[41h*4+2]9 F$ f1 j8 J5 v
    cmp     cl,al
4 J% \. s( f- x; s/ [    jnz     SoftICE_detected3 u9 B6 ?, y2 U0 v( F
/ Q' `# G9 i' Q: {* ^6 I
_________________________________________________________________________
) z" v/ C% t! }9 G) x1 q* _
2 h$ Y+ O' O# P( F! z2 ~- O2 ~Method 07
2 S7 r" P" H, _=========7 ]' @# _( o, i5 r$ S: [4 Z

- p+ t, v5 O' \) n2 V" ]Method of detection of the WinICE handler in the int68h (V86)
( o$ h4 e  E& p* x
) I+ _) X$ U2 f    mov     ah,43h, X  R5 |0 Q, b8 T1 D
    int     68h
6 b( W8 d+ r7 `5 u4 }4 H8 z    cmp     ax,0F386h% B! e. p1 n. O
    jz      SoftICE_Detected
  Y/ r% S' [4 S2 b5 F- v7 P: i& i# _, C
! j& c7 m# T9 _1 T: t
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
' [3 b  ?9 d  b% U   app like this:2 T" y( D# `# o3 t
3 q7 e6 u# K/ k* K* k( c: @
   BPX exec_int if ax==68. q8 `3 {; C* j
   (function called is located at byte ptr [ebp+1Dh] and client eip is
# I& L+ S/ D3 ^+ @$ n& `& d. c   located at [ebp+48h] for 32Bit apps)5 u! ]& n. E& u4 `, ^; Q
__________________________________________________________________________$ Z/ w3 S# v: x: h- i% d

1 l$ G- b* n( f' O+ T! \6 f  f8 B8 j2 h/ C
Method 08
) R  S5 o' e0 J=========
3 B( u# e# G: H6 d' y7 |9 ^/ [& e& C! _2 I: @/ K4 K
It is not a method of detection of SoftICE but a possibility to crash the* W6 F, D* Q" O
system by intercepting int 01h and int 03h and redirecting them to another" P/ Y2 N) y2 T& Z$ |
routine.
& h+ h' A9 W. F  G1 H5 n: YIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
* Q6 h& o3 X% P/ _to the new routine to execute (hangs computer...)
5 N+ l5 W$ `8 g6 \, ~. p/ N, c
0 T9 u' O1 V  h3 G    mov     ah, 25h9 G" O2 N7 Q( Q& ~
    mov     al, Int_Number (01h or 03h)7 ^0 w" H/ `. u6 U; {2 Y+ k- V9 j
    mov     dx, offset New_Int_Routine/ j$ c0 e1 E0 k# Z7 ~3 d
    int     21h8 Z8 g4 U" p6 s, I( U

/ M& k- h; c: R! K% c__________________________________________________________________________
! |0 F( v, r9 a6 u. f8 j& Q
* C5 I4 A' G1 I9 R5 F! ~( XMethod 09/ S- W7 X  l* J3 K% Z
=========! h" i  V* t+ \( J/ A' u
6 M4 j8 o7 P3 C2 j
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
. v; C; ]) M7 }6 y# S# n" fperformed in ring0 (VxD or a ring3 app using the VxdCall).* _( p$ C% M+ W) x( P3 o
The Get_DDB service is used to determine whether or not a VxD is installed
3 S& D: t8 i2 O6 Tfor the specified device and returns a Device Description Block (in ecx) for
/ R& J. {+ o, h8 o  Qthat device if it is installed.
" @3 ~' Y! O8 l% g% B+ _
  Z/ H/ o3 c( X. a7 B   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- S6 J1 ]6 E4 `. P; A: w   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)2 V1 }5 f3 _" C, y3 F
   VMMCall Get_DDB
7 C! ^8 ?# }3 d. N2 p   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed- i  }  M& G/ S! W% h
) A/ i( [& P0 F
Note as well that you can easily detect this method with SoftICE:
7 {  S, b2 C1 {/ o* @+ C3 K   bpx Get_DDB if ax==0202 || ax==7a5fh! R  S. M! k' W& u' n/ a# X
2 ~( B4 m; N7 P- h% T+ [+ N$ O
__________________________________________________________________________
2 m- A1 f  V: e8 D/ E% W+ I3 X, i
0 r, l; z, Y# F5 ^Method 100 L3 K" }  X5 b3 U' k5 a
=========5 i; V% X5 v4 ~& `* b+ ]" I

& T) p+ g" c* H- \) S& a=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with; h! E5 X0 }1 k3 v+ H
  SoftICE while the option is enable!!5 |) O/ }+ M# o/ k

% i' l0 T% P: l2 H% n- y+ TThis trick is very efficient:$ \5 G( N0 a! `5 a
by checking the Debug Registers, you can detect if SoftICE is loaded
7 f0 |* G( }2 H2 j8 }- Z0 {; W(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' u6 ?' k8 v# z8 C6 X0 ~
there are some memory breakpoints set (dr0 to dr3) simply by reading their
' T- `1 n$ H1 x7 U; w* ]4 Evalue (in ring0 only). Values can be manipulated and or changed as well
, N6 U0 w9 P. O- f8 |(clearing BPMs for instance)" W0 \% d; X9 `' V* w8 t5 Z
! s0 u, g9 H1 V2 }
__________________________________________________________________________. t8 w" X' j& w* F0 Y

; @  R  Y; Z3 K$ {Method 119 l/ T6 m4 y( k: B
=========
5 t" {. I% p4 s
7 f" [) o# ?; W$ i" @! }0 c$ ~This method is most known as 'MeltICE' because it has been freely distributed+ q$ f6 u7 W3 R, C% e+ m0 Q" }
via www.winfiles.com. However it was first used by NuMega people to allow
- b; A5 m8 W* f) D/ X7 X: p8 hSymbol Loader to check if SoftICE was active or not (the code is located
, C% C, {; X* yinside nmtrans.dll).; G/ I! y1 ~* P7 U' ~6 S

7 ~# X1 P2 z3 k" YThe way it works is very simple:, n( A1 \6 L& W2 R' J
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: x. g! @2 }3 q- K/ I- F
WinNT) with the CreateFileA API.- F( x! v+ x! _# z/ |4 I- \
/ m" _# [6 u) m. Q
Here is a sample (checking for 'SICE'):8 H3 c% E0 r$ q
6 ^: P4 i# p# `4 O9 B7 Q3 G
BOOL IsSoftIce95Loaded()$ R/ N+ l+ W; p& K) M! u
{
/ M/ ^$ h* R1 S" D8 p+ {   HANDLE hFile;  
' i2 K+ o4 o" O0 r- D1 k/ U( S2 j   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% j' s" b0 n1 Q& s+ Z, e
                      FILE_SHARE_READ | FILE_SHARE_WRITE," D) ], ]1 `5 |4 i; D7 g8 D
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) m7 u" Y7 v; G   if( hFile != INVALID_HANDLE_VALUE )
, P8 x! ~1 E" E6 _1 ?1 P% b$ F9 U   {, H; j( z# }' b' X! V# l5 L' H. w
      CloseHandle(hFile);
! w3 k2 G; S; z$ U' m. b7 w      return TRUE;
7 ?- M7 B7 `) Z) n5 Z   }& V( B0 U  B: v
   return FALSE;$ I0 Q2 Y3 \$ w+ Y" R/ f: ^7 P
}
8 b: S" F# i' `0 p* s' t: o: C& M
( V- p% A% i5 RAlthough this trick calls the CreateFileA function, don't even expect to be6 X5 V2 l# p( u+ q% G
able to intercept it by installing a IFS hook: it will not work, no way!5 b$ H0 B. J( B' D4 W+ U! `
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ @* B3 ]- G" Z6 b' r4 Z& C  uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 @& v& s0 L" k+ U4 J7 H
and then browse the DDB list until it find the VxD and its DDB_Control_Proc# ?8 ~5 `+ |4 |, S9 E6 t
field.
& s9 x; `  ]3 G' j: c" ~+ N7 GIn fact, its purpose is not to load/unload VxDs but only to send a " T1 t1 b5 Q; @! x
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 k6 m2 t/ v$ J* n/ _2 ~to the VxD Control_Dispatch proc (how the hell a shareware soft could try
' Q  F, J" g' ^to load/unload a non-dynamically loadable driver such as SoftICE ;-).
( w3 c, y2 C( f) g6 Y6 ZIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 h+ C. o* R; w3 x; ?, G0 Xits handle to be opened and then, will be detected.
" E; I+ V' d, b, h* [5 S) m" fYou can check that simply by hooking Winice.exe control proc entry point
# W2 g, C1 e7 e  R- [while running MeltICE.
# N5 J8 V# r$ ~5 V5 x! \
7 G  N& ~. S: z: V. K' j1 d% k$ i& S/ j- D/ C
  00401067:  push      00402025    ; \\.\SICE
5 ]. A& h4 V' V9 G1 W5 T3 ~( F  0040106C:  call      CreateFileA
9 W. ~' Z% x+ s+ F0 L5 E/ U3 t4 F  00401071:  cmp       eax,-001
# R' {1 ]0 q: }/ d  U1 i- {) f  00401074:  je        00401091
) Z- w& I' f5 O! ~6 I+ B: C: z4 m( x) r/ d; T" U

8 g3 g, w/ V$ A. yThere could be hundreds of BPX you could use to detect this trick.
0 O% m( w7 z/ ~3 L3 W) r/ }9 p0 f-The most classical one is:0 l* Y, R7 C' X% N" A( m3 ~
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ |& p$ H/ k# Q4 u
    *(esp-&gt;4+4)=='NTIC'7 i3 ]% a  j3 ?3 q1 ~. r9 y

' x7 w1 E: i  U; E0 X' e2 u6 M-The most exotic ones (could be very slooooow :-(/ r, u, e/ x/ }# ]+ N7 m/ e* H
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  9 ~% N5 n& E/ |. k4 f  f
     ;will break 3 times :-() U1 x& {6 K0 q/ m) v, {" c: ^* l

& C  r7 N7 O; Q  e) h-or (a bit) faster: % D0 S0 x! d$ t* N5 I% P
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
, O/ |8 h! J: r' e( \8 M  X. |, R
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
$ m4 D* [# ?) \! s     ;will break 3 times :-(% e/ l6 ?6 F8 i, Z1 x

& Z; U) K' E: I+ i% z-Much faster:
3 P" y! f# ]# r) N0 H0 `   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' o  k$ w$ f* l- X+ E

5 s  }5 o. H  FNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
6 m5 h, R# L$ g1 y( t; nfunction to do the same job:
% l, U) D& z2 K. ^7 Y
6 J7 r% p, T; p' e, g8 Q5 `   push    00                        ; OF_READ8 M% b1 c( e# i
   mov     eax,[00656634]            ; '\\.\SICE',0( w8 f. s* {1 V8 A3 Z
   push    eax4 j) e* i: F+ x, x
   call    KERNEL32!_lopen- j/ C( @" v$ u2 {$ U0 W" E
   inc     eax
4 \- z- K2 c3 X( k; c   jnz     00650589                  ; detected. ?' Y6 z2 b4 p
   push    00                        ; OF_READ( M  j6 h% U% ?4 ~9 w1 B% T
   mov     eax,[00656638]            ; '\\.\SICE'' k3 A6 S3 a8 Y* k# S
   push    eax
* j/ v+ A7 P# Q& h5 @5 T   call    KERNEL32!_lopen
, C% k4 |  x$ R9 s" ?* c( r3 T   inc     eax. V4 F  s: @. \1 G6 |# Y7 O
   jz      006505ae                  ; not detected
5 f  i9 ~7 Y  }' E/ R, Y
/ x9 o9 o% Q( S  Z+ f) e' |8 o# \# T: z& ]; H
__________________________________________________________________________# ^$ B' I! H  z, L3 N( B7 u

" ?6 f5 h- E6 u0 P4 QMethod 12- ^5 b9 q: k" C' p
=========8 y- W3 V% ~" o/ J* B
2 f. Y" E7 r/ O1 X+ `
This trick is similar to int41h/4fh Debugger installation check (code 05) s3 |4 |, {6 ]& w
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ e% c. j7 Q' ^6 c+ e0 ~as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 G- i1 U  {$ q' p! n- B/ h# r7 l; [+ B2 |# R1 Z
   push  0000004fh         ; function 4fh5 z) v: e# B# W8 k  M0 Q
   push  002a002ah         ; high word specifies which VxD (VWIN32)
% h- L$ p# B* \# \. j0 ^                           ; low word specifies which service
$ ~9 K1 D6 ~' C6 `                             (VWIN32_Int41Dispatch)
: x* }! F2 n/ `  C1 i: d   call  Kernel32!ORD_001  ; VxdCall4 ]+ U' K) {$ X0 ?9 B: u6 `* S
   cmp   ax, 0f386h        ; magic number returned by system debuggers
" L4 ^2 J/ T$ z# a  Y! j   jz    SoftICE_detected: t6 `$ g3 V  ^6 j
( c% l, J! g6 |: g% F" I
Here again, several ways to detect it:
: N5 j" |* @8 B, e7 p, x+ ]
) J; s: ]; Q& S, G( `6 c% e9 J& G    BPINT 41 if ax==4f% `, `1 l, H) h: z' F1 g& o

/ I/ m+ T% ^% ~3 n% v) W- s    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) n7 U0 K! d+ `1 p$ _
8 R, ^$ i; C$ d: V  j    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- S3 y, i* H1 Q4 V& |0 c3 [) `/ r+ W+ f1 t# M
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  `3 N. ?7 g# Y! K8 B

) W: f3 k, d) c' V' W7 ]( `__________________________________________________________________________5 o: k1 p1 G: Q: n  x. m4 v) M. Z

# ~( w/ Z8 @& m$ \Method 13+ S. V9 d) q; K7 Y$ G
=========% v1 [1 T9 H. I# q8 Y
" R+ w7 v# I+ O+ ^/ M# Q  C
Not a real method of detection, but a good way to know if SoftICE is
% g2 q) x, M  Y- s; w: Iinstalled on a computer and to locate its installation directory.
, ~8 l3 t. c: E  S6 D# j* }It is used by few softs which access the following registry keys (usually #2) :9 l0 m  _; w6 I9 a, N

( q4 l# R# L0 p4 T, k-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  C/ F& l" k/ y/ e, S+ A) M( l% H; F
\Uninstall\SoftICE7 }' K1 ]5 ~5 V5 D
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE5 R4 H9 d& |. Y/ A' w& Q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) y# C# Y3 A; @$ z+ Z6 ?\App Paths\Loader32.Exe1 ~# \  U% n+ t3 |* w* l  @
, }* \- y9 Z3 f( h

& ]# w% \) y3 C' MNote that some nasty apps could then erase all files from SoftICE directory
+ O5 X' h/ q: r2 P& |* ](I faced that once :-(' q1 J4 I0 Z1 A" e

8 G# f: N. Z" h' PUseful breakpoint to detect it:4 t  d4 b/ q% w& I+ s& r

" C8 s- T) i' v0 I# }7 f     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'( h8 X+ J" H. `. W( l

6 {. V: h5 r' x; I  H__________________________________________________________________________
4 ^% q" |7 W$ v) ~/ ?  t4 N" H
0 z" h+ U5 V1 p) K% ?* @7 x+ S, _8 G' _; A
Method 14
& n" r6 [, I2 l+ b+ F$ r/ `=========( f# c2 b) f0 M, P8 y

, Z% B6 c9 T; r6 z/ \A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 D& b# g/ E0 K+ o+ r5 |/ X
is to determines whether a debugger is running on your system (ring0 only).
" M' Q0 `1 @- \; d7 m% ]2 e! K! G% g/ h$ a: H% J
   VMMCall Test_Debug_Installed
* N1 j0 B) a" {& Q2 I   je      not_installed, ?' J; E+ e7 t& i

, D* }+ B, S5 {& O- c2 pThis service just checks a flag.+ t/ }3 i6 M/ g% b% Z2 j
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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