About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ b# [5 I0 o5 X  L2 [1 F4 [2 b% j<TBODY>) y& d2 q1 E* |. m
<TR>9 I5 Y0 @# {! [, @9 @$ w' S  H
<TD><PRE>Method 01 7 O9 p( p) _. X7 E3 J* P
=========
( d+ Y$ m( e" T( `) g* B$ L$ z2 W' p
This method of detection of SoftICE (as well as the following one) is
5 ^+ C/ y* c8 i, n) f- X9 Nused by the majority of packers/encryptors found on Internet.  ~" i/ q! n4 ~; V2 |2 ?" O
It seeks the signature of BoundsChecker in SoftICE5 N; E: V, |) w6 ~

; R! x! N2 J3 }& M7 u    mov     ebp, 04243484Bh        ; 'BCHK'
: a- I3 t/ i6 k8 _) ^2 C    mov     ax, 04h7 {" M( `7 B: x3 N) T0 ]+ u7 \4 R
    int     3      
$ ^& ]7 {1 N7 }    cmp     al,4, _* c1 n6 U6 `
    jnz     SoftICE_Detected2 G* a, `+ t6 q6 V" X8 w9 k4 A

1 ?# b1 z7 a& E6 B- W___________________________________________________________________________3 l8 F0 T1 a$ R; _& S. z

' V) L9 {, ?3 L) Z% lMethod 02
4 c6 a3 `0 L; f' _5 q0 ^=========* ?; D. v) b9 i. }, W4 R8 h
' F/ J; R5 Z" O1 ]/ ^
Still a method very much used (perhaps the most frequent one).  It is used
0 Z+ k4 |+ {  Z; \+ [to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
; [( z3 }* |, e2 I! D$ [; d7 F( Yor execute SoftICE commands...( X- U" K; E' H
It is also used to crash SoftICE and to force it to execute any commands
" J8 t( F: C& C5 z5 h$ n* s(HBOOT...) :-((  ( f/ L/ ~9 [% s6 }% E% w& ?0 E
& y9 X- o1 I" X1 z) m
Here is a quick description:
0 P4 j/ V: n* E' k& _, a0 T6 d-AX = 0910h   (Display string in SIce windows)9 I; p$ d/ ~/ y+ ~' B
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% n$ X8 ?+ P$ F6 J2 ^/ |9 k+ G
-AX = 0912h   (Get breakpoint infos)
# n& x0 t% a( _$ O- q-AX = 0913h   (Set Sice breakpoints)9 u% k) K- D2 X6 Q# K+ p
-AX = 0914h   (Remove SIce breakoints)' Q0 q- D% O  Y$ F# O
2 G6 ], U/ M. z; z& l7 s8 M- Y
Each time you'll meet this trick, you'll see:
+ a+ D. C1 E0 v# V-SI = 4647h
2 x+ f1 n, o3 Y2 |# S4 H-DI = 4A4Dh
* C3 S: U/ U* Q4 T! D1 }/ I) pWhich are the 'magic values' used by SoftIce.
! Z  ], J% I- E3 D: N5 z' bFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.- M2 @; n# |8 J# x

: a, }- m6 @4 M: i; e+ j# N# _Here is one example from the file "Haspinst.exe" which is the dongle HASP" N! R; h7 f% k5 J
Envelope utility use to protect DOS applications:- ?8 S2 E: C" O9 c) A1 q
; S: j0 e# [5 Q: Q8 Y; V

9 a5 t9 d; F  o! t% d4C19:0095   MOV    AX,0911  ; execute command.
9 a+ i7 L8 t0 r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 P* d) |8 L! W5 A9 \2 @4C19:009A   MOV    SI,4647  ; 1st magic value.
3 |3 M9 y8 g, v, ]4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; e8 x* l2 \8 K+ B, A4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 z* B8 }6 s: R- S$ r2 j! ]4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& h9 D1 b; b) ^4C19:00A4   INC    CX
, t: |8 ~5 N7 t& H' I4 K4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
5 \* P; N( L9 _% a4C19:00A8   JB     0095     ; 6 different commands.1 ?" x; g  |1 a$ a' v5 {2 E
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# @3 T% u$ z: w7 y) n$ e' ]
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ I" t+ K# `2 m5 k5 q- H; `5 s3 r( Q, D% d  e
The program will execute 6 different SIce commands located at ds:dx, which
1 U& |6 e' C8 S- [are: LDT, IDT, GDT, TSS, RS, and ...HBOOT., R- k0 @4 Y5 Q! o
/ ~/ o4 _+ x$ G; ~* z: R$ W2 a) D
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
1 ?# Q8 V  Y  A$ ~, Y___________________________________________________________________________1 g2 ]6 {& y) o0 Y# g

, T1 a1 X4 E7 }+ \# s$ i7 \5 E
# n, D9 g8 ]7 z6 R; U- UMethod 03' L* [+ B8 ?7 m& ^* V
=========$ w) {$ n8 ~- H' [, s# k

0 j' N+ \6 @8 Y* k* Z* R& Q0 d. O; V' yLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* N% M: O% U9 g
(API Get entry point)4 @% X" f' N. J1 W8 {
        
. B+ w& D/ `$ j4 r  v& r/ {, h0 J* @
; o) S% t3 k: d( P, z( ?8 F    xor     di,di0 \1 Y2 r4 c. V  }+ c6 X& V
    mov     es,di  B# i4 C6 G1 o! u+ ^, A
    mov     ax, 1684h         ^( R; n4 m7 Z* \! c' C
    mov     bx, 0202h       ; VxD ID of winice
. b9 ]- n; A; ~    int     2Fh, j2 k( F# j' ^5 P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 i5 P, D) I5 |4 _+ ^: H
    add     ax, di
2 z' G  Q3 y# W; K; X% Q    test    ax,ax
% l/ }4 a! Y& d- R. P& I! K; ~    jnz     SoftICE_Detected4 S5 R3 n# M' J9 z7 b

/ b, h& r* W; G# @! M; [___________________________________________________________________________' p: o0 T# X3 j5 H8 j5 ~* J
2 o( H! ]" j/ j! l: F" [% a( d
Method 044 V% H1 g' n+ L0 H5 Y
=========+ U% c8 f5 T/ ]+ \
6 C, W, e, e7 M: o/ ~: T. F7 Y& }
Method identical to the preceding one except that it seeks the ID of SoftICE! G8 Q& P8 F: |. F8 H) h
GFX VxD.
' s; g: x+ B  t  R0 W* g: F0 ?; g7 |6 T9 K9 q, p
    xor     di,di7 G' ^6 f$ f) |( y
    mov     es,di; L% E+ Y0 t! C+ ^
    mov     ax, 1684h       3 L8 j5 {; x  ^4 t6 C" w4 U- `
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% @3 J) p6 @6 C& N; l    int     2fh
) a2 H& M  B" a0 F' d* S. v    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( f5 [8 R! L+ Q( I* ^6 a  X  Q    add     ax, di
- z( \2 ~' e* q" G. D    test    ax,ax( {9 h8 v, A) M4 C2 Z
    jnz     SoftICE_Detected
6 {# `. `; f% e  j
  U0 p4 K. _- E) M& r__________________________________________________________________________
2 A% A" j( j2 K" b. ?7 \1 N; ?3 A4 L7 u' |
  P. \: D2 `: v- J. t
Method 05
2 K1 v, I$ Z8 V( z+ z=========3 J; {4 N1 c' R  C/ X

% r; d5 ^/ T" o) B+ pMethod seeking the 'magic number' 0F386h returned (in ax) by all system# q$ d; g4 ~0 L- Q
debugger. It calls the int 41h, function 4Fh.* g7 |7 |4 W7 n. ]2 F
There are several alternatives.  ) a! ~# H. {# L9 H

' Y; ~9 p$ ]4 ^8 nThe following one is the simplest:
* d% S# H$ v' H9 o& B+ c5 c5 r  e2 j: h
    mov     ax,4fh  m5 ~# J% m6 a' G- F
    int     41h
% ~4 t! p, U& r, A4 t; n7 ?% _0 V    cmp     ax, 0F386
- ]* p0 ^& @6 j    jz      SoftICE_detected
5 S* Q/ ~- g# @. n0 J
  ]4 x0 k/ ?$ c; F+ t' h  c) |
0 k9 \% F5 H7 U# E, H4 p! |Next method as well as the following one are 2 examples from Stone's
' A& o% \: t  V$ F( T"stn-wid.zip" (www.cracking.net):9 H- w# X) m# A8 Z# Y* `" O- D/ b

$ I6 Q( K: f! O8 D9 s/ B* w    mov     bx, cs
7 k. Y# G4 z2 p/ K7 b3 q  w" X& m8 ^    lea     dx, int41handler2' c/ Z: t7 k7 T; ]
    xchg    dx, es:[41h*4]
0 Z4 b3 B7 ?( e; C    xchg    bx, es:[41h*4+2], F+ @% d, R5 T! g! x5 l
    mov     ax,4fh* p* \! M9 Z2 l) B  [6 a- U
    int     41h
. H& p$ h" `6 X0 O! d    xchg    dx, es:[41h*4]( ?  e# _& _, U0 @8 j
    xchg    bx, es:[41h*4+2]6 M! C( h. p; B. V: o
    cmp     ax, 0f386h
  ~- `4 m" w* K, ~! x    jz      SoftICE_detected9 U" v/ e3 U# A+ z9 p5 \2 P

5 e, w" M. T; d4 W; V' K+ ?) G# nint41handler2 PROC
2 l) ^+ p$ b, ^$ I( L  C# q. Z    iret
- E0 j- Z" t! E8 m/ Bint41handler2 ENDP
* f  j5 c5 q% m& P- s
0 Z% d* ~) R* k# y8 M) |" B" J3 H# r; l6 V' ^. G8 ^6 c
_________________________________________________________________________
2 C4 S! J0 I/ {; Z8 T2 \. r6 {5 F; C
  r5 m' K; n# P0 R4 T
Method 06$ A: N, G4 b0 S$ {5 C0 S% @) |
=========9 z: f/ u6 u" S

% W7 a. g) M' f; m! y1 w4 s) W9 P1 K$ ~! J0 `4 A; L
2nd method similar to the preceding one but more difficult to detect:  G! X6 K5 c1 [8 \
) M2 G) U3 l' j% m

% [9 z9 E  j  s" h. R  Z' eint41handler PROC
6 {  Y) a6 b' z/ _7 T) ]    mov     cl,al
& D- Y5 [% J3 O- A7 R: H4 w    iret
, [7 z3 k, F2 k3 m2 I! `. ^int41handler ENDP
. z. Y& y9 `0 ]4 S' |5 A* `6 e
6 W6 e6 P  B) i: {7 V4 H  n# ^
) e3 Z4 u" }. J) P$ Y/ M/ E  [    xor     ax,ax" m/ N6 h# q  D
    mov     es,ax8 r2 P1 W. J6 g5 a; H3 v7 ?
    mov     bx, cs' w$ i( E# u; T- q3 `% l6 \: i; n4 h
    lea     dx, int41handler
% U# }9 ?  S+ ~5 F+ y    xchg    dx, es:[41h*4]
0 W, a$ B, U0 a* H% \    xchg    bx, es:[41h*4+2]
( a& P  ~8 X4 k5 o3 m! u/ L    in      al, 40h
  |+ d: U6 T, W: H4 v4 J    xor     cx,cx
- t. d  V  e5 O' N( A    int     41h
3 T, ?4 S: w; }- [# U7 B( `1 G    xchg    dx, es:[41h*4]* v5 I$ C/ p0 T0 h' S" m7 e
    xchg    bx, es:[41h*4+2]# N: _9 D: D* p$ f1 w- F; P
    cmp     cl,al  }) F/ ]6 O9 }; S
    jnz     SoftICE_detected8 [" |/ t' B+ T0 b; S; g: }% u
$ u" M) \" d0 w0 l5 _: |1 ]/ b. u9 P: v
_________________________________________________________________________1 _" K9 N( \) e( y' {; T: [

5 n, D2 o; H- f/ eMethod 07% r; z% ?) {; j, T5 |6 n
=========( O8 ?! t# _8 s" S- D0 {. @

1 E% L. I6 N5 A1 _8 U9 BMethod of detection of the WinICE handler in the int68h (V86)
0 {$ E# Z" ], i% W. b1 s+ J9 {8 e3 U) ~6 B0 o
    mov     ah,43h+ J) t' J4 K2 G/ r
    int     68h
' b: [6 A0 J6 J  h  u    cmp     ax,0F386h/ N) v0 n+ R' h8 ]/ q3 Y
    jz      SoftICE_Detected
; f* v8 i0 C5 {) q; ?+ a0 H5 x/ ~( h& V6 V& X( R( y

$ E. u+ F& x) x" o6 _; Y=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 M, b; W  T, F: ]  q1 w( G3 O
   app like this:+ ^. u6 u  `; [
+ K8 F& |6 _% u" x2 l
   BPX exec_int if ax==68
& V2 i& Q. G  [2 k! S7 `   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 {* P* p7 _# Q   located at [ebp+48h] for 32Bit apps)
0 t/ u7 Z7 ?1 \* H% f' O3 p__________________________________________________________________________# L3 a0 f  t, C$ \3 \! i  P7 j

$ ]1 L: t1 o" O' e3 z  k
9 e& q+ X: j( Z) ]# Y# n( }Method 08
% S7 }: o2 o& C5 h( {/ t( {=========
) @$ i; @! z0 n: s) l
, z0 v# F% j4 xIt is not a method of detection of SoftICE but a possibility to crash the
/ k4 ^5 u/ j" M9 N6 O- [; ?7 `: T, osystem by intercepting int 01h and int 03h and redirecting them to another
; n: C. i: Z# J* s9 T/ broutine.
" j) b' l: f( W) A5 ?. qIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ b) G# M4 U& ~
to the new routine to execute (hangs computer...): u( G4 ~; q" b' d. {, i7 ^9 ?
9 t' V  P  R1 Y8 n! d3 L
    mov     ah, 25h; E6 t: x6 ^. o) c6 D+ D
    mov     al, Int_Number (01h or 03h)
; m0 |5 l1 x6 @$ `    mov     dx, offset New_Int_Routine  b  Y7 G: J! r* d+ ]
    int     21h) I8 B) z. N5 u/ T3 M
) G: w. w- Q6 H& w7 ?6 Z$ @
__________________________________________________________________________, p$ \) C" P. w8 x+ C( c" \

1 N1 Q+ s0 p* m. w0 M6 D4 @. QMethod 09
/ k. S1 G5 r0 v' R8 Y% A) W0 K=========+ b/ o# w/ m2 z5 ?0 w) Y

( K- d( `  Y4 Z% |9 ]  P5 `This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only4 {) {9 @1 C  B0 z4 g
performed in ring0 (VxD or a ring3 app using the VxdCall).
$ M- c- o. }$ C, E2 K: TThe Get_DDB service is used to determine whether or not a VxD is installed
' I5 f+ U1 E4 M& hfor the specified device and returns a Device Description Block (in ecx) for& w4 u% b+ a: ]* X* K# J& O
that device if it is installed.
' k4 O& |9 w; e$ Z. ?& J7 ~/ C; O" t2 A- r
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
6 x) g/ U$ r) e. O/ f& q# J   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
3 }/ Z! _" \6 K5 Y   VMMCall Get_DDB" \6 l3 x' g8 s" F4 Q' p: W0 n
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 ^4 U& S" x4 N5 y3 d/ c0 b" s2 Z. l+ A2 G6 X7 b0 l9 L
Note as well that you can easily detect this method with SoftICE:
8 L. k$ _5 t- c) Q. r! ]& q) Z" V   bpx Get_DDB if ax==0202 || ax==7a5fh
0 A. @4 `/ Y- [5 d4 J, y6 a
4 ]% p! `% Q2 V: w% K__________________________________________________________________________2 j1 V% w) s( O: s( Y1 p/ F. z
6 l/ ?0 q* V' k. x' n
Method 10" P" ^3 O" V) g! w4 `' m7 m  N
=========4 a& N2 @7 H5 }! R1 W2 ]
) t) `  j2 j8 s
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 r( h/ i; ?7 Z
  SoftICE while the option is enable!!
! A- l$ S! s- r- F( L) a1 X1 }/ h# z$ S
This trick is very efficient:
' S3 F$ I( q& p1 I  Xby checking the Debug Registers, you can detect if SoftICE is loaded
+ ?" j5 M. R/ i(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 [* G  X+ l0 Q  s+ [
there are some memory breakpoints set (dr0 to dr3) simply by reading their1 i& E* D8 z+ {% X  d" N
value (in ring0 only). Values can be manipulated and or changed as well- L$ \; [- }/ f4 r
(clearing BPMs for instance)" d1 x# V$ M5 k, c6 T7 P3 p1 m7 @

' L8 R: i, f; [$ D3 k1 _9 c+ c__________________________________________________________________________
- r, Q* Z4 S9 A6 j! d1 g( o# x. ], B- `# m  w: o
Method 11
: D! z" s, h) g+ D4 M8 t=========
: U+ Z9 L% [3 O& d4 y% z0 R
* F0 p% u5 q2 z/ Q) j0 L. OThis method is most known as 'MeltICE' because it has been freely distributed
! ^- _8 n6 U+ ^# z! X) ~via www.winfiles.com. However it was first used by NuMega people to allow3 j" G# l& J9 {) ]1 h
Symbol Loader to check if SoftICE was active or not (the code is located5 c% m6 p) m, h, T. ]
inside nmtrans.dll).& u+ m# t6 r" T0 P1 T7 n6 m* q

1 Z. l0 f# R+ _, k8 H  n8 y3 y# AThe way it works is very simple:" g2 _/ \9 m% y2 b; Z
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for( ~4 m! {1 S2 Q( @: f- Y) u8 G' N
WinNT) with the CreateFileA API.
- w, C( w/ N; G& E% H3 _/ T/ y
; n0 B) `5 T( m/ e4 vHere is a sample (checking for 'SICE'):
2 e! l+ V( e1 |9 ~' z( ^( q) k4 l2 i* z, G, T4 ^1 g3 m2 `( x& X
BOOL IsSoftIce95Loaded()6 v. j/ l, E3 ~* _% ]) t, W
{
" S" Y% ~. u+ ^0 ]   HANDLE hFile;    {6 j! G) Y& G" K
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,! Z7 }* w! [. Z  I
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) M6 Y# }3 j) \6 U4 a4 w
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);+ L8 z% I: c, a' P3 M9 ~: w0 M
   if( hFile != INVALID_HANDLE_VALUE )/ {6 G$ X; X4 w+ s) t
   {
- Z, g+ `" E: ?      CloseHandle(hFile);
; U: k2 ]3 Q; w7 I. r) J      return TRUE;- R$ w% E- i! N2 z6 ~2 \
   }
4 x7 r- s7 S3 ?# C5 n   return FALSE;) X# r  Q" H/ v# O/ j. [6 o7 q# w4 r
}' I' L! q' U; Y1 [* r
, a! S$ z! G% I( r/ f1 }, M
Although this trick calls the CreateFileA function, don't even expect to be
) F" q3 V' E* x" p2 F- q8 l( f; U3 eable to intercept it by installing a IFS hook: it will not work, no way!
2 H( \. ~7 }6 Y" B0 eIn fact, after the call to CreateFileA it will get through VWIN32 0x001F  ~% `' w9 v) r& Z8 j4 f
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
  t/ a) y, |+ \- q2 ~* k  W& Iand then browse the DDB list until it find the VxD and its DDB_Control_Proc$ q' ^1 e, I9 t6 S
field.
5 r8 k, c: Y. i4 Y! _) t* }. h3 v1 LIn fact, its purpose is not to load/unload VxDs but only to send a
* o4 n0 P, t8 s& eW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). P# p* l. h; T3 ]# [0 T
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
$ b+ l) s- F  V, Z4 Uto load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ E' J! L* P1 v3 I) G% n0 B% I2 oIf the VxD is loaded, it will always clear eax and the Carry flag to allow& w% P: s9 c3 _& E2 S" i
its handle to be opened and then, will be detected.
3 Z0 ^, ~! |" v1 i+ W6 ]- hYou can check that simply by hooking Winice.exe control proc entry point4 z. u$ N0 Y" f9 H
while running MeltICE.1 t: F% D! u# C8 {: j7 m1 g+ h

1 p- H( V! O5 l$ \4 u0 l" `3 q3 i9 d# X) T# w) ^
  00401067:  push      00402025    ; \\.\SICE# b* t4 r3 w3 B5 j4 T1 e9 F0 V
  0040106C:  call      CreateFileA2 m0 Y& y6 r! h. _5 h
  00401071:  cmp       eax,-001
0 t) H* ]# D5 p+ B8 i9 X! Y  00401074:  je        004010910 G! L; ~% U4 x4 \' Y
% c! N* X1 m* ?* w, G
3 j1 ?1 v; W) Y/ t, ^
There could be hundreds of BPX you could use to detect this trick.3 B2 @& a7 W* G, O* X/ l7 f
-The most classical one is:1 S- k# B% H  V, |! P
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 g( h" l% z( {/ m: D
    *(esp-&gt;4+4)=='NTIC'4 g5 [$ t5 i1 q) E6 m
/ b8 I1 C3 R, [' y+ k: g
-The most exotic ones (could be very slooooow :-(
! S' f; t0 ?1 w1 f( W   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 @, a, O; ~8 K  k7 z: j4 X
     ;will break 3 times :-(
: @5 M  E+ v# ], e9 W; S( \/ E/ k' R# k; i! _& x7 g, N
-or (a bit) faster:
1 h! A4 I* W4 N   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) _  [: f8 s1 j5 `) o3 E  d0 w

, {4 |& A* n+ P0 m- }   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : M& Y: v7 f" g2 g
     ;will break 3 times :-(
7 c) ~! D% U: g" |' L; R8 q- \, Z7 c* @. _5 r$ e
-Much faster:
3 g( M9 J! _; I   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 \5 A" E, v( p* x" _, ]8 R

+ \/ `8 R" D8 i* V1 A6 G7 H: Z; ZNote also that some programs (like AZPR3.00) use de old 16-bit _lopen6 p( p* a0 R. w) @
function to do the same job:
& w( V$ A# n6 f( m4 Y4 k0 G3 L; ?8 ?
   push    00                        ; OF_READ5 D3 t& g* {: X# x9 u
   mov     eax,[00656634]            ; '\\.\SICE',0+ ]" B) i! V/ T* \( L3 e
   push    eax
  h, ~* s( F4 q) P+ _/ }) ?9 l   call    KERNEL32!_lopen: t: h' m. b$ {! f3 f( o' {$ X
   inc     eax
& {( f7 N9 m0 g+ r! b, i5 H! B   jnz     00650589                  ; detected4 ?7 ]7 _; e- I9 T$ I. B
   push    00                        ; OF_READ, C+ @) u( e. t" [, g
   mov     eax,[00656638]            ; '\\.\SICE'
' [) L& R1 {  l* p8 `7 i   push    eax2 J/ L+ w, }) ?: C& O0 e6 o. _
   call    KERNEL32!_lopen8 T0 k2 z/ E8 T5 ?* v
   inc     eax8 |$ D' {8 Z3 D
   jz      006505ae                  ; not detected
$ v0 }$ v; M' H% P8 t# k6 J% u( }0 b9 }; V5 b! e9 k  ]

, B! x; B) Z' a) ]__________________________________________________________________________) H, p; n' y1 T. I0 l0 Q

$ ^) p2 c3 X4 DMethod 12. i7 T5 @* W  Z
=========
7 }$ C; ]9 a4 X- q/ b) q
$ G6 Z" N% v5 K7 Z; OThis trick is similar to int41h/4fh Debugger installation check (code 05, _1 F" s: ^: B7 a& f
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. |& K6 t* M* has it uses the VxDCall backdoor. This detection was found in Bleem Demo.
4 d" ^' A1 u/ A# [
  w& m6 |# r' W% Y& Q* L   push  0000004fh         ; function 4fh  T1 e- }* Z7 w0 m+ v
   push  002a002ah         ; high word specifies which VxD (VWIN32)' D$ n) H& W) q7 L( p: W. G8 F$ q( C
                           ; low word specifies which service
# e1 a8 z* v9 r2 k                             (VWIN32_Int41Dispatch)3 [: y  M  X' F4 E% B
   call  Kernel32!ORD_001  ; VxdCall
7 S" F. ?4 {9 N- G$ o   cmp   ax, 0f386h        ; magic number returned by system debuggers, Y4 ?. y/ M4 Y; T# _7 ]. z7 K
   jz    SoftICE_detected
$ E' K' U" F4 r$ i& L/ K# O$ B. z8 |0 H! Z2 B
Here again, several ways to detect it:
! P% v) S4 j4 L. [" ~' |5 v0 O2 _; c2 d$ a" W
    BPINT 41 if ax==4f
) ~8 J& L& j4 g6 ?( ~5 R, F9 L3 X; B) N6 J# K2 X7 \
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" V8 V) z% t8 x8 h7 x7 X
2 k: f2 |) S& o8 ^    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A1 n+ o1 L& h* y- ]0 R& _6 w1 B% m5 u

* k" B+ K1 s/ a2 {6 Y' i% V. z" W    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. h2 x' r0 `! i1 Z- R' N- T* l  w  P( \! V
__________________________________________________________________________/ J- n! Y" E4 L2 [7 L
1 W- e6 z9 T# V. W8 C; Q: I
Method 13
' E' e9 ?7 @! G4 S  p, J+ r' i" ~=========% i$ j1 V/ C. U9 W
) P0 R. k* U" ]" `
Not a real method of detection, but a good way to know if SoftICE is
3 b% s" B& p% P9 Binstalled on a computer and to locate its installation directory.) x- p7 o# ~0 R& D) w+ u  o
It is used by few softs which access the following registry keys (usually #2) :' Q* Y$ R1 n) Q+ u, a4 k, Y

1 E+ b1 x5 M7 g2 `-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, I5 m4 X" R" N: a; O; ]1 O\Uninstall\SoftICE
9 K$ v, I  l! U9 [% t* H- e-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) E/ Y7 a3 f9 j  K7 i2 y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ i3 d% s$ F. f$ {
\App Paths\Loader32.Exe
# ?) X1 @! b4 n- i2 g5 k; B! I. t; k4 q" ]/ J' }! F
$ ]3 m1 W# b8 F1 y# _2 b. o- x% M
Note that some nasty apps could then erase all files from SoftICE directory
4 x) s# U5 S$ \3 }1 {- e(I faced that once :-(0 g7 q/ O' m& q1 h4 T( [4 ^+ @
* Q  x+ r$ d# C
Useful breakpoint to detect it:* V2 e8 L+ F. k4 Y) l, A" h: D

/ r) o& k" _8 \  w  Z9 m     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
  b$ Y) S2 w( L/ m5 ?1 e# ?* i6 b9 h! {5 C
__________________________________________________________________________
& V% W; m; x& Q% s  n3 {  O# i
7 F6 ]1 D, L6 a, T/ \- \  z8 I' j' j# E
Method 14
* d3 D; Q- j" A+ b/ j5 b, J=========; G0 }1 W9 u7 P7 m! T/ \

% Z) }' r& m: z/ v1 cA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) W2 m# y$ E2 t5 L$ K' kis to determines whether a debugger is running on your system (ring0 only).& @. O8 n* @  ^3 N; H2 s* Q

% V( i0 @5 o1 |7 C  H5 s; W   VMMCall Test_Debug_Installed
) U, z- P9 O: g2 U( u, X, z$ O   je      not_installed
1 \! m9 g- D6 f' A& X5 N; G+ y5 Z  J  u; }8 V% J2 N: E" h7 X
This service just checks a flag.
# @3 P' A: P+ C! g5 X</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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