About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
1 k- j  P% M9 O5 @+ ~<TBODY>: k/ q) c' b# {' r
<TR>
! F( Y) O" f/ N# {<TD><PRE>Method 01 + @/ u" x5 Q) n
=========
9 w; h  }2 S7 W% U$ _8 O) G# _3 j2 }/ Q0 n3 G) c" x
This method of detection of SoftICE (as well as the following one) is
- F9 g1 z0 c% h; a. G) lused by the majority of packers/encryptors found on Internet./ N4 p" w( Q0 m4 k3 |( U5 M# N
It seeks the signature of BoundsChecker in SoftICE
1 i  U0 \  j$ q; A* y6 |6 `& J* ^* U2 B' O) Y
    mov     ebp, 04243484Bh        ; 'BCHK'4 n% j, ^2 `$ y
    mov     ax, 04h  |0 R& n3 v5 U0 \
    int     3       ( `6 }1 B+ S5 d! K' h( f
    cmp     al,4  d3 G/ j; ^  c! _+ U
    jnz     SoftICE_Detected
+ M1 B# E# `1 u* W
: o: o% \4 V/ c- I1 V- n* K& x___________________________________________________________________________6 n- o1 |2 b$ q4 a( z$ K
* T3 w7 |/ J5 V8 ?# C8 i
Method 02
$ X2 t% P7 t# l. F=========; A3 q/ _# X; N+ f0 P

9 x$ |/ c( u, F5 Y1 N7 u+ [8 GStill a method very much used (perhaps the most frequent one).  It is used
1 x% u+ `8 F% x" Ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 u& j$ x7 {2 por execute SoftICE commands...
. _  G. G8 p' {* r& ~' _% FIt is also used to crash SoftICE and to force it to execute any commands% \" a1 z+ s, N8 |; {) x6 q) X5 V, x  ^3 Z
(HBOOT...) :-((  " h7 _" J. l/ u: t  y- f
1 c( F7 \9 n6 G$ K2 f6 l2 d
Here is a quick description:, ]! r* y, g* R0 }. f
-AX = 0910h   (Display string in SIce windows)
) ~! @5 y/ Z8 ~9 M6 {4 Y. N: a-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. x! o" b7 Q2 t( ^2 I-AX = 0912h   (Get breakpoint infos)1 `# l6 O& R+ V. t6 s$ N
-AX = 0913h   (Set Sice breakpoints)
. y- ]2 e( _6 l2 |-AX = 0914h   (Remove SIce breakoints)
, [( x" l: e; m& c! d; t; C- \0 R) @3 q5 e
Each time you'll meet this trick, you'll see:' @0 c, {% A, ?  u4 f2 U" X* Y7 ~
-SI = 4647h
$ Y( c/ S' b( o-DI = 4A4Dh3 ~7 X, V) R! E# W9 k$ _& ?* e4 s
Which are the 'magic values' used by SoftIce.3 a9 h8 }' J; L2 |0 x
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! r4 D- O# K4 N) v0 p2 q! H' K# `+ O4 ], h" y9 F
Here is one example from the file "Haspinst.exe" which is the dongle HASP' Q8 f1 R+ F4 {) }: o0 V; h
Envelope utility use to protect DOS applications:
: y+ m, C+ M% X- k5 ]
( K+ g8 ?( k  P' _, J4 a; m8 I3 }( x: R3 h) w) T
4C19:0095   MOV    AX,0911  ; execute command.5 v: b: P- b9 u9 z4 b" c8 u
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. _7 R& s6 K! G+ G- C5 s! o% o* y
4C19:009A   MOV    SI,4647  ; 1st magic value.
  d8 S4 g9 y9 M' D4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 k% I' J$ ^  H9 D
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% k) O- U; s! d6 |
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! C7 A" U2 j( I% L2 @, b
4C19:00A4   INC    CX- B" [8 ?9 w3 ]4 E. A/ |7 M
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
+ @' d0 r* v9 ?& w& |' r' ^4C19:00A8   JB     0095     ; 6 different commands.
) r$ a$ V0 n5 h$ {  D4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% S9 ?6 z* G  u  R$ O) k# O4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)# L2 o$ q2 P: `2 c

- E1 Z$ ^& x: |The program will execute 6 different SIce commands located at ds:dx, which
0 ~% c3 d% P$ o# z, D; i. tare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ W2 q  j4 [& h9 ]
) J# t7 l5 K, v# \# j* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.* T: b" E9 D4 b$ P
___________________________________________________________________________
7 h6 _2 G- r3 @" ^1 T
7 i7 I$ D, Z+ e  [( z
! F0 w* T2 ^. z% S  _. F* s4 qMethod 031 }; C% K( J1 x( E- v" d* Z+ O0 t  E. B
=========- I  \% L9 D  y- C8 w

  o2 _; x% g( O* o8 p4 J) QLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( R( p  \. s0 O6 a' b& s
(API Get entry point)
9 t, H( M5 z, S1 j9 \        7 d; \) `* l# A/ B- A$ @3 _

8 G! X) d  c  U4 }, U; O    xor     di,di
6 P+ o& D9 p  s% C# l' h    mov     es,di
2 b( c) D: \: {$ ]/ T    mov     ax, 1684h       * e  v5 G5 o+ Q! L- y
    mov     bx, 0202h       ; VxD ID of winice: n  p" R, P* C% t
    int     2Fh
: d/ i; B/ d8 h, K9 ]% o/ {% V    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. V8 t1 }$ O% l' h    add     ax, di9 u. ~, e8 l& z# V
    test    ax,ax2 }' }, {0 w0 R8 E3 q; p
    jnz     SoftICE_Detected
# b+ r& }5 d/ s  S1 k: Q8 t, U) f( q1 q( C% Y
___________________________________________________________________________% N3 f  D: t4 `$ H- q
6 c& Q$ k! ]: P( v1 A+ Q% q
Method 04
; D: u7 j3 D% }* g4 q( R  @  U=========/ a! A; n8 P. W8 P" P, W8 z2 F

) u' U. ^# _- K  w, XMethod identical to the preceding one except that it seeks the ID of SoftICE( @# K' a8 U' [, v# E  M9 t' _
GFX VxD.
8 B) Z! c4 @+ w5 h1 k1 Y0 L, n& t- ^7 |
# m" X6 P8 O2 |7 @; j; }, \    xor     di,di
' y% u8 [% @4 J$ l5 V    mov     es,di; s. y% D. W. E' W1 o
    mov     ax, 1684h      
: j# X$ A8 i: ?4 I    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 F; ?2 U' b% X% F    int     2fh
/ C, N4 C& r% r    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 N1 k, J1 I3 x/ F2 w/ I2 c    add     ax, di2 k1 G  }" L; y/ y& e+ u
    test    ax,ax
- r  s! z* j( d( `* q" t    jnz     SoftICE_Detected
! S9 V6 i. h- p. b  t
6 I) N) _( {7 s$ D* ?& L, w__________________________________________________________________________5 {1 X: A/ x9 V) }& Z

7 C# Z, o( v/ t- Y6 m' t* @) i  }  l% M7 c
Method 05* |( s6 I( p) H! x' A: R1 v
=========
  H9 G4 d) e1 o
9 R( k9 W5 W3 t$ g# K8 N: ~/ EMethod seeking the 'magic number' 0F386h returned (in ax) by all system/ T  U; s* |/ @" n( V& V
debugger. It calls the int 41h, function 4Fh.; ?" `3 g& x0 |4 o! l5 _
There are several alternatives.  ; w6 u7 K! f- v, V; y- L

4 }7 n# T; z! HThe following one is the simplest:
$ R8 c) t5 t7 e$ N0 i3 I& o- s" E, d
    mov     ax,4fh
1 ~6 r: j3 ]. A! T3 ^7 ^" |* d    int     41h: v; v5 w' o3 ~' f6 R- l2 T
    cmp     ax, 0F386
2 r  T3 E; S0 N! G    jz      SoftICE_detected! w1 s2 }5 C  a: b% }* t: |/ C
) U  |- V# T8 G! m6 }/ g4 k" X) k' i

/ L/ f0 _! N/ `' \3 k# DNext method as well as the following one are 2 examples from Stone's
% J: N0 z# X# r2 ~2 e"stn-wid.zip" (www.cracking.net):# o/ A( j; C2 G( _4 \7 D  M7 Q

* X3 |& ^% A$ h9 E    mov     bx, cs
% S2 ~1 K* B$ ~$ Z; S" n4 u& `    lea     dx, int41handler29 [" ], v7 D  |& y
    xchg    dx, es:[41h*4]
  b4 X6 h" y9 {1 Y4 T( o. n( Z  G3 Z    xchg    bx, es:[41h*4+2]
$ y+ @9 L: v: P$ G    mov     ax,4fh
: E4 I5 C2 B+ u2 Z( r    int     41h
. D& G6 B/ [4 u5 j. Q3 f3 X    xchg    dx, es:[41h*4]
0 q+ X- j" b  u6 h% N! R1 p' l    xchg    bx, es:[41h*4+2]2 ?/ [" h% m& C& o, l
    cmp     ax, 0f386h3 E$ M' C% M. w/ `* t, U
    jz      SoftICE_detected" c8 B) G8 X# h% r, q

/ t2 d/ R: V" W* gint41handler2 PROC# [+ F$ C7 h( c5 A' U. @
    iret& o' t" s9 b# I4 F2 f- M6 D) [
int41handler2 ENDP
) {' @% s3 _, M; @
) R& N' m8 Z# l  s# m% X9 A4 Z* }4 ^1 z- s
_________________________________________________________________________
" {- d# J5 b" L8 v# v# _2 b: A3 J. n! P" Y

& {2 R0 l/ J; o" Y% zMethod 069 V$ u9 m% h+ u, V
=========! R6 t, j' j' ~7 B; m9 B
6 A" d0 {$ S" n& N$ H1 l  b( |

' Q! C0 _( y8 [, `' M, Y2nd method similar to the preceding one but more difficult to detect:2 ^8 y. B% c6 |( ^% M
8 `5 ?  Z' j% H9 o2 ^4 a
, S, A5 c1 `1 O7 a) H
int41handler PROC% A0 S( x& o, m% O" U
    mov     cl,al
! v/ U9 [9 A; n: [2 A6 E. k# z9 M    iret+ S/ g5 O# }" |0 D5 p
int41handler ENDP' y1 `! U% Y* y# |- t

" Z. A8 ^2 ?2 u9 T6 r& X& ]- o9 [. J/ ^* p
    xor     ax,ax
+ @3 I; g4 @9 v. E0 T# v    mov     es,ax
4 }' S* g9 |1 m; q9 Q7 }    mov     bx, cs  c: b- q( f! F5 P6 H4 d- q
    lea     dx, int41handler2 \$ \! ^3 q& g% r" O) {
    xchg    dx, es:[41h*4]
2 F+ H' d( L' P" K1 ^( B$ M2 K    xchg    bx, es:[41h*4+2]
0 m$ R+ ^: q" k) H, j% q" r) z( l7 X; j6 x    in      al, 40h# I1 [) N& t' b8 P. l0 z! s+ g
    xor     cx,cx
* k, E! S, E/ {6 k4 w    int     41h3 ^& D: @- n. S4 G
    xchg    dx, es:[41h*4]$ `. }% p" |+ _+ H* S
    xchg    bx, es:[41h*4+2]
$ O2 F/ y! K0 P, x5 n    cmp     cl,al
) j( f0 o& j* f5 H6 ?+ n    jnz     SoftICE_detected0 a$ @) Q) e( v* p1 g

) j% N% Y) d* O& X5 J_________________________________________________________________________8 P- K( d- Z1 F; n: }# r
3 U) l9 W+ a# n# v% m$ a3 Y
Method 07
1 a8 Q# O: U+ _5 X. J( A  i=========2 ?7 S# T, n  z
& j2 U5 S% l+ U9 C4 E1 G& X
Method of detection of the WinICE handler in the int68h (V86)' ^, ], u1 l4 k4 ]+ ~1 {  r5 Z

$ ]: ?; X2 B0 M" B    mov     ah,43h
0 a8 b. F% k7 L    int     68h
$ S. Z! q& @4 t4 J    cmp     ax,0F386h( p3 l3 ]& h# f# f
    jz      SoftICE_Detected5 H* G7 s3 n% c/ c

) o8 d2 O& O% v
* l/ ?8 {; m% l" n5 x+ \. u2 G: b=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
! g. A& f3 ~. S$ H" a, M! m# y   app like this:
% m' l, ~3 ~$ N# f3 |
. p, o. t8 w" |3 j   BPX exec_int if ax==68
5 A- W/ s( q$ K2 i. ~. _   (function called is located at byte ptr [ebp+1Dh] and client eip is
  g) V0 M) H* k9 \5 f# T   located at [ebp+48h] for 32Bit apps)- d9 P' U! u7 F7 B4 @
__________________________________________________________________________, ^6 r, a0 _9 @8 y5 Z- X
9 S: l2 L9 z1 h$ O; c0 p
4 s6 Z+ ]# m; p. ]6 w/ ?/ k
Method 08( D: c( c0 T- j3 l' Y
=========/ _0 M0 g3 X  B. u
# p, `6 Y3 L% U  e
It is not a method of detection of SoftICE but a possibility to crash the
- ~$ l+ h& u. _- n1 {3 K' Csystem by intercepting int 01h and int 03h and redirecting them to another7 o7 q7 W, a' s# O1 w  z3 _
routine.& N1 Z" R) F* W7 F1 }% O; `0 ^4 \
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points6 K. X! p& ~, U
to the new routine to execute (hangs computer...)7 J) t5 W* A) S( Z

3 g/ \; _# T/ J% y6 `: N9 E    mov     ah, 25h
# r0 E5 p0 B9 W* e+ X+ Q3 [    mov     al, Int_Number (01h or 03h)
1 \) K# q- A+ d% X0 |6 q  n; `    mov     dx, offset New_Int_Routine
' E! T7 s  X  b2 J. p8 O    int     21h
$ v3 u; O+ j9 T; l7 \
3 f9 ?6 n* V& O( t/ d9 V__________________________________________________________________________5 J1 s: v* g5 m6 u( W
! k- I. m0 c7 m2 C$ D1 p9 ~
Method 09& v1 y7 p3 r. X* w4 k. q
=========
, y, a( W1 i1 ?2 y
6 t7 c+ N  z7 t1 Z0 xThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! W( `" L* p8 I
performed in ring0 (VxD or a ring3 app using the VxdCall).2 a& A9 o% x3 p6 C3 j
The Get_DDB service is used to determine whether or not a VxD is installed
0 Q" S. w) y+ X' n, s" zfor the specified device and returns a Device Description Block (in ecx) for
3 G0 t) Q0 f1 o+ g0 e% h/ Qthat device if it is installed.* k7 g2 k- M; z( O) S4 Y% p" m1 ^
  @# i1 R2 t9 U& v/ m; ]& X, e
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID% G: U, J2 ]5 |$ _- p
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 X8 f( d6 x2 q1 H   VMMCall Get_DDB
; _: K  }7 X: N3 N+ }   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
4 t2 u8 }, s, C
, M. l6 S" S7 J9 f; \! @Note as well that you can easily detect this method with SoftICE:
! ^! n, M) f  O5 j. g5 U   bpx Get_DDB if ax==0202 || ax==7a5fh- r9 B3 Q# j$ b" L
# q( p4 d+ _) U& A7 s- `
__________________________________________________________________________- E: i) D- J0 {
$ e7 o- G' K* i) F( V5 t
Method 105 x4 B' p5 w' G6 \# m
=========4 i' L; q6 E- T1 t% j' a4 }
8 z( W9 }8 b; R$ B
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 U2 \% l+ B2 d% D; d  SoftICE while the option is enable!!
  ?" _( ~2 N! x' o2 J/ T. A) {  F1 V' ?
This trick is very efficient:
9 m* Y' Z7 ~0 v% V0 Fby checking the Debug Registers, you can detect if SoftICE is loaded1 L1 ]& L, ^* D% R8 K% r; R
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 U2 U7 x- g2 n* a8 Athere are some memory breakpoints set (dr0 to dr3) simply by reading their. H+ N/ u" r* L8 S7 z( T4 r. }8 {
value (in ring0 only). Values can be manipulated and or changed as well
6 E" W% V! d5 }8 w% v(clearing BPMs for instance)
) C- T( p: s* ^0 P
* G0 g: t5 {, @9 O__________________________________________________________________________3 s- w3 b' I. c; I# \& |7 `: [
4 D3 z6 U% O) \0 o
Method 11# r' Q8 Y  D! N* u  T
=========
* l: M  P8 @: \  U/ L; d4 `. }1 `! d: ^* h' F  a% u6 O
This method is most known as 'MeltICE' because it has been freely distributed. }- P# o0 A5 C6 i
via www.winfiles.com. However it was first used by NuMega people to allow
2 v. [( Q, U& d) K) u$ R: KSymbol Loader to check if SoftICE was active or not (the code is located
* y& n2 |% w: C% Z& uinside nmtrans.dll).
6 Z; M8 x4 E3 ~! s0 z' `8 S2 W, Y6 u
The way it works is very simple:) f$ v2 K2 k7 w' I3 L1 c2 _$ u( \
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 e2 L& o. J* U0 i/ {4 Q" G
WinNT) with the CreateFileA API.7 b& F8 I6 j) P: _8 O6 l
) C9 L' l4 _/ T- C* x
Here is a sample (checking for 'SICE'):# g! T3 X' d& |; z# Y
2 z) M4 K# [+ J$ Y
BOOL IsSoftIce95Loaded()) `+ s7 k3 P# b
{
5 d6 C0 o( K! O) c   HANDLE hFile;  + i7 A& I+ j9 [8 k9 w& a
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% H- o& l3 A; _6 k( O" ~
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% c' M& \" |( K" J0 r2 ~# d                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 }, Y$ s# Z2 `* j
   if( hFile != INVALID_HANDLE_VALUE )4 _: i3 L# z! M/ W: n9 s
   {
, u# A/ [: i: P; X) H: I9 Q0 n      CloseHandle(hFile);
+ U; J* P& h: ^4 L( N7 Q      return TRUE;
* O' V# F: M* w" t! D4 u6 e   }- y' `! N) T* ^2 B9 M$ {! R* D
   return FALSE;, z4 t0 h) N! L* U
}7 A% _1 H( p  P0 N
+ `% L  p  K2 A. B, }4 m
Although this trick calls the CreateFileA function, don't even expect to be7 L2 G5 J0 R& R4 Y4 M1 ]
able to intercept it by installing a IFS hook: it will not work, no way!5 ^' g. k3 U: h' a. {6 w* q  ]0 y6 J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
" ]5 W, Q1 I* A- d/ h: Vservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
/ p" p2 z9 {( O, e9 M9 ~and then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 L+ g3 g, ^; e6 f. Tfield.) @: A. w; U; F& M, e( B
In fact, its purpose is not to load/unload VxDs but only to send a 3 W1 D* t9 q  u& u- j
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* Y/ a" f! f/ ^+ H# s' Z2 z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 R9 [9 i% i- m: {to load/unload a non-dynamically loadable driver such as SoftICE ;-)./ T9 I, C- |: I$ f- J+ Z
If the VxD is loaded, it will always clear eax and the Carry flag to allow) p0 {. {# L$ i1 p9 K  a
its handle to be opened and then, will be detected.
% h5 B8 q) f) J+ X1 MYou can check that simply by hooking Winice.exe control proc entry point
4 A6 q' y+ c# e6 q: U  Iwhile running MeltICE.5 w5 R0 a% M  @" B
' j' n; u2 H9 ]4 X% q3 X: ^5 A

5 V# d' x$ l# }# G4 K  00401067:  push      00402025    ; \\.\SICE" q% x' A1 i* O8 J& M6 W; a
  0040106C:  call      CreateFileA
2 [6 A% X7 f1 N# j  00401071:  cmp       eax,-001
: F1 s8 |. S3 w1 ?6 p  00401074:  je        00401091
/ d0 |9 }- s/ }# t. k3 O' _
6 B4 D6 r4 b. l5 r
# v1 }. ^) T+ N: JThere could be hundreds of BPX you could use to detect this trick.
7 l. c* b, r4 K$ y. @: F4 {' o-The most classical one is:
- i! M+ G& h" P7 U; w$ }7 Y1 j  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||4 n/ E. N4 O) o0 f/ B- O
    *(esp-&gt;4+4)=='NTIC'
% ?5 A; ?, b; l5 o7 m
2 f- I8 H7 L! ~1 d-The most exotic ones (could be very slooooow :-(. l$ ~, b2 r% }/ a2 B: z0 D' T
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  f7 r' j; O2 i( `( B$ J     ;will break 3 times :-(
' L  G! C7 H# i3 ^
( }; U8 c8 K; H. g8 r; q-or (a bit) faster: 2 U+ V) L. Z2 h8 G% b7 H( V* t3 F
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) J1 n8 T) U8 W7 S, x

& D- F* A3 g+ W( ~- H! u4 A  p3 f   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- {$ N$ B8 Q. L' }1 U; K     ;will break 3 times :-(
7 y% ^- m! t6 b) o, T' [  Q
0 Z, d4 i* g5 W-Much faster:
* i; I; v& Q8 G0 [1 Y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; A! C; Z# ~- a0 T; ]
( V: L# ]- b2 E0 f: i- r; ?Note also that some programs (like AZPR3.00) use de old 16-bit _lopen5 T5 M/ Y  `  u5 \5 F) H; x
function to do the same job:) u, L1 i3 h: u3 t( w

; q$ w0 z  `; q' W. d   push    00                        ; OF_READ
4 y+ T+ a0 \3 {3 `% \1 t   mov     eax,[00656634]            ; '\\.\SICE',0
6 L) @5 A0 B  `' n   push    eax- m+ t3 s7 E3 j
   call    KERNEL32!_lopen( i- z, m" s7 }( C" k6 b" Q& q
   inc     eax
" L# a! \4 x8 P$ U, r3 I   jnz     00650589                  ; detected
3 G! J' O' B9 r, U5 J   push    00                        ; OF_READ
9 V! T3 e2 D; N9 G* z" |7 T( a   mov     eax,[00656638]            ; '\\.\SICE': W  z" P9 [; s( _' L
   push    eax( \9 i+ S: |1 H
   call    KERNEL32!_lopen; o6 p5 A7 f3 J  K* {
   inc     eax
5 }# J" Q: I" ?4 Z# }   jz      006505ae                  ; not detected# J/ r, c$ \; m3 Y5 k0 _' L  V

7 s& \& L1 {! q. }
4 S: W& W. e# C0 z1 \# U" H# }2 R9 h__________________________________________________________________________
4 T5 |) z, M" f9 O4 P+ l& z8 a
$ @* C$ o0 B* M/ VMethod 12! S9 s1 R8 X% Y
=========
1 t7 ~- H9 Y' h" D/ c! H0 k( {3 _" e* W2 d
This trick is similar to int41h/4fh Debugger installation check (code 055 |  ^& ]) _7 g) w6 G
&amp; 06) but very limited because it's only available for Win95/98 (not NT)' b4 o% ~& x1 i* Q$ I* ]4 R/ ?! g6 P1 |
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ ~( t1 c) M  M$ {2 \6 a8 E$ V4 X* x1 D+ i( ^, A
   push  0000004fh         ; function 4fh7 j% ?/ v# L' V' J# V
   push  002a002ah         ; high word specifies which VxD (VWIN32)6 I3 [) S& Q- e/ @: J- Q2 I
                           ; low word specifies which service
8 Y7 _, s" g8 ]1 A1 n3 c" [                             (VWIN32_Int41Dispatch)9 S* R( W! Q8 O! @
   call  Kernel32!ORD_001  ; VxdCall
3 {& q% k3 i& T% y  B2 V   cmp   ax, 0f386h        ; magic number returned by system debuggers, o- n% x" J% U8 K1 g0 N7 F/ p
   jz    SoftICE_detected
6 b+ Z5 t$ b3 A, ]) I& ?5 W& C3 H7 f( s' t
Here again, several ways to detect it:  \' c4 N4 ?; I# a0 r) X8 x
) R; T) z! x3 Y/ j4 ?" ^
    BPINT 41 if ax==4f
7 o/ V0 J& |3 j1 t% L0 e: s" O
4 n2 Q0 Q9 F( o; m    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one( q' T5 l0 f' Y  ~

: O0 g) D9 z6 F/ C/ J( x7 T* R    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. x5 I  d- {9 W  `9 Z
( Y8 O; }  G6 \) k8 P, P
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* c! Q, o+ g9 J) q6 o- j1 Z
! y$ U* H5 [1 A  k0 U3 L% U__________________________________________________________________________6 Y" ~! h+ W2 u# m( U

! K. A' t+ F+ p3 S3 f+ h/ sMethod 139 e& Z' j  v7 K2 B# F# B2 r% F0 a
=========9 b6 S6 W, n: S3 N7 g
, A, W) M1 m/ x. b
Not a real method of detection, but a good way to know if SoftICE is
4 v  O  E$ s! |0 I. a6 Ainstalled on a computer and to locate its installation directory.( ]7 G+ d8 h+ c& \- z) X
It is used by few softs which access the following registry keys (usually #2) :
7 E8 Y0 t$ Y$ h( N2 U% U+ s' m9 @  y* q2 n- r/ {) `9 b* T
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 g$ F0 p; M( ^* C\Uninstall\SoftICE6 r: X' ^! p  N
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 }* J' E" N$ ~* W6 K8 X
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! a/ j3 J8 X; T+ u  P0 c/ I\App Paths\Loader32.Exe
' a0 V3 \) Q. F) n8 [' N- e& ?) K) c6 m4 w5 J
$ A$ E8 F- Q2 @0 u0 H  R
Note that some nasty apps could then erase all files from SoftICE directory
9 N, X- s2 X( x5 D0 [' j3 A(I faced that once :-(
, i' k' k' s- D0 @8 p. D! W$ x  `; B3 e
Useful breakpoint to detect it:
. s" t! M( f( C( g7 L, U4 j. L; Q% _6 K' R  b' y* R6 i
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) z7 \8 N6 U% G- S: ~9 R, p; D* T: j
% H( T, V* I1 y* L5 _- x! o__________________________________________________________________________2 L& B" z, u- l/ r+ p) r

4 |! v3 @/ A- N9 y
0 ?! k) t7 O  x# eMethod 14 8 l( E+ f% L* M3 O1 F$ U
=========: T; J" a9 n; j/ G  p* L

# y% h5 H* ?  w: E$ e; d) xA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose) [) @5 c7 X6 e. ?' P/ r
is to determines whether a debugger is running on your system (ring0 only).
( v6 ?1 F+ q3 q0 O/ r* k
+ {: _* t" G, l9 c( C   VMMCall Test_Debug_Installed- X/ h6 \, G  i9 U$ J( S
   je      not_installed
  Y2 u( [; `& T3 F# q" P2 o2 f7 ^9 K: ]) m6 q2 E! m* q& [
This service just checks a flag.' w: @0 A  b% \+ E2 L7 t
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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