About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( L! {3 x' f0 i4 q8 l<TBODY>5 S4 G1 W6 H1 W1 y+ i- q/ _
<TR>) Z  ?3 Z5 H0 i3 J' a
<TD><PRE>Method 01 - h: P& U+ T- K4 I- C  E, [
=========5 E& Z. Z/ Z) O* S8 w+ W

( a5 V7 V2 \) J* \# dThis method of detection of SoftICE (as well as the following one) is9 ~3 ?6 m6 Z! W
used by the majority of packers/encryptors found on Internet.
& i, G: E4 g, q4 OIt seeks the signature of BoundsChecker in SoftICE) x: ~: v; O5 `  m& U$ V) B

7 Z# [6 q0 L$ A0 i    mov     ebp, 04243484Bh        ; 'BCHK'* s6 w4 {9 U& g2 [6 g9 n+ Q* d
    mov     ax, 04h
0 l5 o+ X; |9 M4 G& s, k3 f$ m    int     3      
, g" w. `, @0 x! z5 E  M/ o    cmp     al,4
3 D8 K8 R3 i8 D* j! O6 F    jnz     SoftICE_Detected$ ?" o: ^3 U: m3 m
: ^. N3 x  f/ i$ X7 F
___________________________________________________________________________
: Y5 w6 g- [; P9 V0 ^& v5 _! P
  X8 r; \0 c" z5 wMethod 02% l& m7 w  N$ k; o
=========( f1 Z3 s! S8 j% U- n; x( ]$ |
! y. ]2 O' O& K6 {0 u* I
Still a method very much used (perhaps the most frequent one).  It is used6 T# e# D6 K# }2 t$ Q9 X
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: b# [  s3 N+ u; t# h* o. mor execute SoftICE commands.../ w8 ^. S) ?7 p' y
It is also used to crash SoftICE and to force it to execute any commands
( R9 b5 v3 `$ Z  A& m6 V3 g5 r(HBOOT...) :-((  ) S  [3 S, p* x- S

0 o% A9 w3 G# j- X5 K/ BHere is a quick description:( x  z; t/ r5 ?. g$ O9 L
-AX = 0910h   (Display string in SIce windows)
; ^: X& t) ]9 m-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); B* R8 i. H9 N2 u; m: L+ D3 h
-AX = 0912h   (Get breakpoint infos)
' J$ X# u" T  i# B- ~-AX = 0913h   (Set Sice breakpoints)
& z$ I- X) j3 j- C% B-AX = 0914h   (Remove SIce breakoints); x& }5 Y  K$ |! _& E
( A( P" n% P6 h+ h: |4 p
Each time you'll meet this trick, you'll see:
8 ]* J  ]" l3 W9 u7 Z3 C5 O7 M-SI = 4647h4 Y# y! U# [2 N9 V$ W1 S  F
-DI = 4A4Dh
. O8 h, k: w+ F( ~/ lWhich are the 'magic values' used by SoftIce.: M: r/ w6 y# P- X
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* V& v# C9 A9 q4 Z" v! U( W
: r- }# ~8 G" q5 d1 D* F( B* s6 t$ }
Here is one example from the file "Haspinst.exe" which is the dongle HASP" z. E' [: X0 _
Envelope utility use to protect DOS applications:
) R, k) m" t, L. K, N% t: s4 e
1 |  K- Q2 {( h/ u' p
1 v. T! F6 r) l$ m; D4C19:0095   MOV    AX,0911  ; execute command.% \/ |4 i/ W$ G) C# }
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
( q- ]7 T4 a! S/ t4C19:009A   MOV    SI,4647  ; 1st magic value.
! m* Q# h+ \5 n2 n1 o9 S4C19:009D   MOV    DI,4A4D  ; 2nd magic value.$ C2 P3 o8 J) U# B# g
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" k% `- d  c9 l
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute2 H; W+ q; ?) j) `# Q4 S% T% b; g5 ^
4C19:00A4   INC    CX$ Z1 q! `, Q- c- M' x% e
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
) Z! z( q) n% B2 b" i, [8 \4 `, i4C19:00A8   JB     0095     ; 6 different commands.7 c- e8 Y" j: z6 F/ }. v- r
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.+ o/ p: Z. T0 B: I" \1 l4 {
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 ?  z2 n; x! g" H$ ]3 j9 ?1 r, f( I4 L3 Y$ `1 n2 `
The program will execute 6 different SIce commands located at ds:dx, which
8 r8 P+ E8 S( j3 G' y" ?are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 o% u& h% L* ]9 @4 T* f5 R
  ]* V# R8 h4 M- o5 t, _
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' M4 l4 R: r8 s! C___________________________________________________________________________
7 X1 [' c% E! o! M/ m# ^5 f# d* C2 S: y: F: X- p6 S1 {
- T+ m8 c' M3 d' r) ^
Method 03
$ @3 u+ x( K3 O=========
# p; w) f: }/ z5 G, n8 M. i
+ b. x3 f% b% W) w: ]' J- a4 k3 `' OLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: Z  D9 r# |: a* }; ?
(API Get entry point)
7 l3 {8 b5 L. H8 W7 q        
) e* @! I( t$ v
: g" r8 ^5 Q' F2 X: B% x    xor     di,di
- D  g5 n1 i: n! I  G* ~9 k! t9 \    mov     es,di
! C" Y* B: h, @3 j    mov     ax, 1684h       " s* H: Z0 }7 f7 M3 b! p
    mov     bx, 0202h       ; VxD ID of winice6 G( V4 l' A7 ~2 i' R- U7 a/ q& \
    int     2Fh$ {% }' j  B$ B" s& C7 s: v
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) {4 d7 j+ ~: q( B2 L# _2 ^4 F    add     ax, di( J8 W+ E/ ~$ N
    test    ax,ax
2 N3 g7 ^" e' S& A. M/ E" O7 C    jnz     SoftICE_Detected
; e3 p  D/ k. v8 K
( P) s6 P: E2 e/ w___________________________________________________________________________8 B2 j$ `0 o5 R3 M% F: r4 a0 P/ h
4 m/ n9 e# G4 f6 `
Method 04& i& p- {/ d, ^6 W) j. T3 n
=========, _3 \5 i* A( J: k5 _" b/ _

0 C  m9 j; c$ z$ W0 gMethod identical to the preceding one except that it seeks the ID of SoftICE
) b$ }) e( ~0 ^( S( g  G8 l( QGFX VxD.; A% M4 y; f$ S# x' @
# n" d" g1 @' l$ ~0 I, O% o6 Z
    xor     di,di
# T2 A! ~( Z4 C0 W6 |    mov     es,di5 ?  E& p1 |) B3 [; M! x
    mov     ax, 1684h       9 A! C. w/ B/ W+ B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 H  i, ]* O6 a! j
    int     2fh
( V5 M3 F' }" u- _. j* {    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* p( v0 u( h! F2 q* Y    add     ax, di- b5 s% M$ X- P
    test    ax,ax
6 r) j. m1 x4 `$ x  D& d% s! T    jnz     SoftICE_Detected
8 k  F9 }1 C- Q, v; B/ d9 W0 |& Z( K5 F1 I" |. Z( C" w/ H
__________________________________________________________________________
1 s& U. t! y% R! G2 Y$ c/ I/ v. O
! r3 S5 e" M% i, d$ o/ N7 J2 z; s
Method 05) d& C, v7 E0 q8 H
=========
8 f7 T3 l4 |8 D6 T( z/ m
2 b, g& U# W& u$ n- W% HMethod seeking the 'magic number' 0F386h returned (in ax) by all system
0 e9 N. p. h5 }" }debugger. It calls the int 41h, function 4Fh.5 M) d- P7 f0 B: n! T
There are several alternatives.  8 }% v# p* u' G5 m! a2 t( R

0 B8 a) g1 h+ l( hThe following one is the simplest:3 q3 u" V8 s0 s- a
! W6 C" V  N6 F; r5 R. O7 w
    mov     ax,4fh
5 u& O8 ?8 A* f; F6 v8 j    int     41h
, Y3 ?; D" m3 }5 a    cmp     ax, 0F386& c- E3 W/ L- y- S) G3 Q# _
    jz      SoftICE_detected/ l9 k* Z8 f  `- B  y5 {

" J" f7 e, f+ |1 N
- z" h( ]% l, D* E5 U9 o0 p3 U; Q' XNext method as well as the following one are 2 examples from Stone's + W2 F% Q& z% b) u0 v  K
"stn-wid.zip" (www.cracking.net):
; X' i* R7 [. f7 ~1 X4 k
0 E' R2 W/ u9 F0 M* d6 k4 _    mov     bx, cs& C5 F( [. w) D( H
    lea     dx, int41handler2/ E! B9 k- U' ?6 n9 F  M
    xchg    dx, es:[41h*4]9 ^% Y* K! {$ o" v3 e" z3 Y6 H
    xchg    bx, es:[41h*4+2]
2 o9 P8 k0 c# |: ?9 ?& p" B5 e    mov     ax,4fh* }( h) {) Q4 v  m: y3 G
    int     41h
- @" |# F8 N2 u% \" G    xchg    dx, es:[41h*4]
' i8 {  {8 G& W- L    xchg    bx, es:[41h*4+2]
! d% N8 b1 q9 \2 |$ d    cmp     ax, 0f386h& ^8 f/ \5 P! ]) X& V4 X( ]6 ^
    jz      SoftICE_detected* x/ w% l1 D8 ^" l5 Y* a; N
0 {4 M. f! z* |
int41handler2 PROC, F$ ^, O' W. g
    iret
& @! O' r! F( G6 k+ rint41handler2 ENDP  D" P' k! \& ]9 p- Z& d# P
0 a) [- ~( d2 ~* w5 N) e

" D, M" L: D8 D7 u" q_________________________________________________________________________
' L+ t) b( R9 N- t0 Z7 V% x- P6 i5 p) ^
; Q" _4 |1 o6 w2 R
Method 066 n, S) R2 _$ _/ R, {7 r* m( W
=========+ Q; S, k* N) z7 ~4 F  l+ s  l- X

# B, L5 L5 j+ B/ V: ^7 G+ v; I0 K: E' Z
2nd method similar to the preceding one but more difficult to detect:
, |% `) ~, q3 s. M/ J! N# L4 l- o9 _) A9 A

% D8 {; k* n8 N- e) a* R4 }0 R/ r9 Jint41handler PROC
3 j: O' M7 \1 i    mov     cl,al1 S+ N! u6 V+ H; d  J( [
    iret
* G+ e% b" y* w4 @5 eint41handler ENDP
6 P3 X. \: [9 L
/ ^) `0 T$ O/ H5 k; s
/ I) ~& m4 P: H( j& ]    xor     ax,ax
8 f8 e) [% V8 k% i9 C0 ~    mov     es,ax
7 {3 h1 D$ `, P, d% u    mov     bx, cs
( q$ k( }8 \  g: N' Y0 T' b) f    lea     dx, int41handler
4 c3 r# }& p# `) J    xchg    dx, es:[41h*4]
8 w2 Y" l' c+ F& J    xchg    bx, es:[41h*4+2]: B, U0 e/ S/ C. E4 k2 I
    in      al, 40h
1 e' _9 C+ R4 R# ?& ~6 ?    xor     cx,cx9 B" ^( H- s1 q0 ?. G  y1 e4 V
    int     41h
. f! G1 j  F% X7 q) b    xchg    dx, es:[41h*4]
( s+ B) n) j0 ?+ Q9 N    xchg    bx, es:[41h*4+2]
  Q9 K. n  G% G: G: q3 \! V    cmp     cl,al: R5 @- t2 ]9 |3 ^  n- c
    jnz     SoftICE_detected
/ g) B& ~4 L* P/ W! X. w/ \* w( V5 m/ t3 J) @: H- z8 o# d; ]
_________________________________________________________________________
( f7 U+ b, Q' v$ G# [$ M$ H# d0 L" o- G. V, p- V
Method 07/ [; u6 ^% d: e  f* T$ p+ o
=========9 g3 Y. P1 ^0 u. R6 d! |& s% U
* q# H; W8 P/ u7 V. \( a
Method of detection of the WinICE handler in the int68h (V86)
) d  \0 F9 o3 V# r8 r0 U, K( x
9 f) A$ u6 T5 K9 j7 G    mov     ah,43h
% U1 _& H1 O# B: @0 o4 J    int     68h
$ \4 h. d+ ]" e# m0 l5 G: t) T1 D    cmp     ax,0F386h6 \. X1 v& ~  h; S) x* x( z
    jz      SoftICE_Detected# C, B# d$ V$ J# K3 A& \1 t/ r) k
7 V% T0 ~1 E+ O, `9 V
# L% ?! U. q. q0 o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# b& H* t% o# w- m2 ]' ?% E9 N
   app like this:% r  z/ z* k/ j6 D! T+ V1 i! j
4 I3 V7 O% V' I3 z) p2 d8 D, E7 [3 y
   BPX exec_int if ax==68
1 m. J  x- b* v) o   (function called is located at byte ptr [ebp+1Dh] and client eip is9 v  |/ `& A3 o2 c3 y7 t
   located at [ebp+48h] for 32Bit apps)
. x+ U, S) R4 x: e__________________________________________________________________________
) L8 Q2 w4 S9 I+ g% l
3 w6 h& M2 S0 U, H: A7 h; D5 V
9 L# w% s+ u8 K- `2 Y! _1 wMethod 08
& I, p4 ^5 Z: j. t1 a: ]+ |=========+ t  X9 E/ o# K- x! m: d' ~+ s
/ C5 M) d1 W: l6 y3 q. F
It is not a method of detection of SoftICE but a possibility to crash the( q1 V' _5 X' m
system by intercepting int 01h and int 03h and redirecting them to another
# n6 i" c" n6 @routine.
, ]5 t" ?: b! f; {% dIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points% c+ l; v2 ^0 r% H( W( s4 A) K6 @9 o! i
to the new routine to execute (hangs computer...)
/ l+ J1 v# j' L* O
4 y0 u  b/ K7 U! U" B    mov     ah, 25h
& T) W3 u$ @6 K8 }* x5 ~    mov     al, Int_Number (01h or 03h)4 y" G" _( v0 J' ~# h, w9 g5 O. d, J
    mov     dx, offset New_Int_Routine2 \0 B8 R$ w& |, r5 [, G- |, W
    int     21h
4 k# v& V/ m3 ^& R/ Z3 M
" X7 s! w  M: }4 X+ O! M+ {/ E7 [8 B__________________________________________________________________________- A. v- @4 N; c3 n( t- V
7 e: A' L/ }+ {/ q& X$ Z: c
Method 09# g. J( _1 D8 f
=========
# m: j3 h4 R  H5 ?- D! u. w) f5 p( ?9 M3 s2 \0 U) U8 e
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* |+ w2 z. d! \& @7 e% {
performed in ring0 (VxD or a ring3 app using the VxdCall).
) a  _) P/ L3 {0 AThe Get_DDB service is used to determine whether or not a VxD is installed) f8 F0 ]8 w  `/ @; v
for the specified device and returns a Device Description Block (in ecx) for
) O, s  B+ ~5 n6 k! `0 o1 cthat device if it is installed.
/ V' \: }8 g! t9 W* s2 @/ _  p7 Y8 N/ N# k- ]* P' f
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 D- B: X) |. C  e
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
1 F9 w! g# C* N6 [3 m  v" |   VMMCall Get_DDB
- T, D; V+ L' Q6 t( ^& ^- I   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed' n5 g6 B6 l1 _; o
* g7 v3 R9 \( C5 e
Note as well that you can easily detect this method with SoftICE:
1 V3 R. A7 t/ s; H8 |$ D$ R4 Z: l   bpx Get_DDB if ax==0202 || ax==7a5fh; {0 h% f3 a/ Z7 R/ v" F, }
" `; z7 w+ L; D% M8 R5 _
__________________________________________________________________________: a8 ~, J/ D! V& O3 b

$ ?5 l$ F8 A) V4 L( e! ZMethod 10; r: D6 Z9 g- ]/ S
=========
8 D3 \4 L! }3 \$ d1 H$ m' n# G8 J2 K0 u) A0 n
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 |2 Z1 ~- b  m6 p1 z- m  SoftICE while the option is enable!!6 A( y7 `8 l% }! p- W. X( \
8 ^: B: R/ _# n* A/ p- Q; G9 K" F
This trick is very efficient:( ?4 ^7 @2 F- o# s$ g7 _# p0 s4 B8 `
by checking the Debug Registers, you can detect if SoftICE is loaded
) h, e) Y9 o* m' E* O# r4 C' C, C9 |(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if7 B& u3 F  \/ _$ P
there are some memory breakpoints set (dr0 to dr3) simply by reading their
* z$ o" A" S! x6 h  Zvalue (in ring0 only). Values can be manipulated and or changed as well
( b" B7 x6 }$ D+ J$ r(clearing BPMs for instance)5 ]1 F  y: D2 ?
5 t+ _8 y) `# i* j
__________________________________________________________________________8 k5 {; C1 u0 c

# y6 ]  V9 {; NMethod 11# D* X& z5 q8 O' N- B
=========% \/ ?0 D4 `3 Z5 w' c

8 n5 Z& L; Y! ], }This method is most known as 'MeltICE' because it has been freely distributed& a' X5 v6 H2 c& L/ k7 r8 E
via www.winfiles.com. However it was first used by NuMega people to allow
* _9 \& Q- V' T9 C4 ~2 @Symbol Loader to check if SoftICE was active or not (the code is located. W9 L! {( b" A2 Q9 x
inside nmtrans.dll).: C5 s' I* w  Q7 E& W" G. {3 M4 B+ ]
$ X5 L7 e$ l8 E' y
The way it works is very simple:
- C: v& X# `# D# }5 f" H4 T6 NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ o5 ^8 _7 T' z& ]9 u' N
WinNT) with the CreateFileA API.0 o- `* G; v% W
9 |8 a$ v# `+ b2 L9 f
Here is a sample (checking for 'SICE'):
2 K$ p4 D: h) \4 z" {* n% `
8 T8 M( R1 m" C! [9 N/ M) uBOOL IsSoftIce95Loaded()
; U! b/ E9 l6 C6 i; G5 t* z{
& D3 ]& N1 `: M; g+ V6 A   HANDLE hFile;  
( e1 C* p, |9 B4 o. o   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 P9 Y# ^( d: s
                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ K; R: M& C4 ]; U4 ~
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  V( l' N# v" U1 z6 U   if( hFile != INVALID_HANDLE_VALUE )
8 p. [4 ~) M5 C) d! M; {7 L   {
7 z+ d( @) d% O$ p2 d. J" b  V  L      CloseHandle(hFile);7 C* {& J3 O0 S3 x% b5 G2 y1 W
      return TRUE;
/ ~3 f# `( X8 Y- S; v   }
/ i+ |: F0 [/ Q3 S6 d. D2 Y. F/ @   return FALSE;
" I8 Y9 ^; c7 i! x/ r}
1 d7 m) C4 a- U# ^0 W% T
  X/ C* }* K1 K$ k8 C1 W- jAlthough this trick calls the CreateFileA function, don't even expect to be
) }* \- G; k) `$ T. O, [, G2 [/ oable to intercept it by installing a IFS hook: it will not work, no way!( T$ _8 ]8 P! Z8 \: ?0 k- B
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 X$ D: F7 ~6 D- Yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 |2 t0 {0 p3 l  t- b+ a# S$ nand then browse the DDB list until it find the VxD and its DDB_Control_Proc( p5 o0 u# |$ L& ]8 {5 b. }0 W: S
field.# d. T1 Q; g4 t
In fact, its purpose is not to load/unload VxDs but only to send a
/ L) J# i4 y' C) S  }9 {W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 T& J) b2 B* W+ ]" u, B: Q5 [to the VxD Control_Dispatch proc (how the hell a shareware soft could try
; c2 `; b% U; r: d7 T: V0 uto load/unload a non-dynamically loadable driver such as SoftICE ;-).
* m. p  R5 ^  t- ~; Q  v4 @( T+ \If the VxD is loaded, it will always clear eax and the Carry flag to allow
% j- U6 p. H  B) r% [its handle to be opened and then, will be detected.9 S. B: X5 T, D- ?" I3 F8 Y6 b1 ~
You can check that simply by hooking Winice.exe control proc entry point7 Y2 T& o  N0 @. p& y0 F
while running MeltICE.
, k' c$ z: G. ]* a1 k1 I
% `4 O! x, h8 f
2 D5 a2 ~$ H4 O  ?7 A* Y$ t  00401067:  push      00402025    ; \\.\SICE
6 x, _; @! f* Z, N( a  0040106C:  call      CreateFileA9 D# @  D5 e+ W
  00401071:  cmp       eax,-0015 e( [. B; d: }0 y  K5 I  s
  00401074:  je        00401091( {2 V" b4 S; t8 B" Z9 x
3 ]2 J5 c' L, Z: @

* x+ ?5 M# d5 Q) w1 I) KThere could be hundreds of BPX you could use to detect this trick.: @/ g4 l+ ~; o3 Q" S
-The most classical one is:3 N0 m# x% t, a6 R* H
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
5 ?1 U- X+ f9 ~, U8 T! ^2 q% M    *(esp-&gt;4+4)=='NTIC'0 |; V9 Z& M# ?+ [. N* b

) \, a* q( W1 m" Q$ g5 q/ \7 K-The most exotic ones (could be very slooooow :-(4 R% l+ H: a7 ~' l1 q
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! W2 u/ A. A" g9 r5 [) [) P: m0 F
     ;will break 3 times :-(
% |" x2 _2 d( k! r8 C
* \$ B& \0 t& g-or (a bit) faster:
2 n4 m( ?2 C* l8 \+ `   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" y5 D) c  C+ u  V8 B
8 b0 B/ f! b& G
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ c0 e" t* Q2 d1 _0 T     ;will break 3 times :-(5 y) v2 ^/ W7 ^9 W' i; r$ g
( c# |7 v! T9 \% V$ P( |& ?: q9 i5 z
-Much faster:8 p6 J; E4 s6 [$ B0 I# K- a9 `
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 P0 Y1 S3 K0 O0 G' x' \. |: U( \5 U

1 A1 `& f, P! K  @" zNote also that some programs (like AZPR3.00) use de old 16-bit _lopen! P1 J$ b, \( U- H
function to do the same job:
- h$ P! Y, t4 u) M+ {
# y2 L+ }/ m! Y# e   push    00                        ; OF_READ
* I$ A8 X+ A! E( X2 s   mov     eax,[00656634]            ; '\\.\SICE',0! N6 b& F5 t' s  a6 ~7 s
   push    eax
9 |! k1 O& s4 h, T1 S( @   call    KERNEL32!_lopen
! d0 S: L: h6 m  ?- p9 \; g8 \   inc     eax7 [* ^8 T* l3 H4 [: A. q, e" ]* @6 r$ I
   jnz     00650589                  ; detected& Q4 U+ U& W8 D- N) v7 q; b0 l
   push    00                        ; OF_READ
( [* P' v! X  s" S5 i* B0 @   mov     eax,[00656638]            ; '\\.\SICE'  x: [% |7 n, M; @, e
   push    eax* u' ~, ~! e2 ]3 c
   call    KERNEL32!_lopen: N7 M# c3 C- |( |( J+ M( X4 u. W
   inc     eax
' d7 x2 H) q# z' [   jz      006505ae                  ; not detected
: Y; V' y9 R1 h. y$ ^; _
, l4 u0 W2 W0 C- K4 \* G7 v# l( ~2 I- _2 V; F, m
__________________________________________________________________________! Y/ J* q3 ?' R  i- f
8 s+ ?# {- R! y: m
Method 12
6 v8 i7 Q0 k' p0 \  F$ s=========
/ |8 I% f" U0 B3 j* c6 r$ P. W
This trick is similar to int41h/4fh Debugger installation check (code 05
* ^# ]# W& Y, \. P' B* D&amp; 06) but very limited because it's only available for Win95/98 (not NT)) s* E! i/ f" O& o/ p" p  g+ G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 E; H3 U. B% k# P# G( v( u% b
: R+ V3 c  c5 x. k) b  X
   push  0000004fh         ; function 4fh6 {2 `  y7 y! }
   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 L. T! F) R5 j# O; E                           ; low word specifies which service
' W5 I9 x+ R  |! u4 p9 M                             (VWIN32_Int41Dispatch)& w2 d$ E8 D/ U' W& I" R) e+ Z
   call  Kernel32!ORD_001  ; VxdCall
- l% g# R) N5 Y- Q4 g5 y   cmp   ax, 0f386h        ; magic number returned by system debuggers, u7 L3 M$ p7 e% ~9 ]7 j
   jz    SoftICE_detected$ \+ Y+ H+ T" M2 m/ B

) i% |; `: i6 Z- R6 C2 s5 f" mHere again, several ways to detect it:$ Z! E+ u9 I# W1 ?( a$ m- n
: @& A! L" K# k8 k0 {
    BPINT 41 if ax==4f$ A& h7 J- _- o  n) V- p

+ {' O1 j% [/ D4 t# w) X    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" W! J$ I! r) h0 v# l

( V) L5 O! f9 c& F    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ I; G, d6 t  I& j( ]3 T$ Z! Y( L4 Y0 u! \, f) i& N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 ]; x( M- l/ e3 w! ]! i; e

2 |. Q$ l+ f! M2 |8 n2 p: a__________________________________________________________________________
! ]+ j; k  }7 L$ g9 f9 o3 s2 S( [6 ~* e( V" ^4 x
Method 139 j0 n' }7 s" V
=========
' n3 S% d, R! S/ j: F  ~/ z) h+ c. |3 }7 k' E
Not a real method of detection, but a good way to know if SoftICE is
  A) Z; c7 Z# |+ A3 J" Binstalled on a computer and to locate its installation directory.
1 \' v( D4 p. u4 e6 gIt is used by few softs which access the following registry keys (usually #2) :2 _) f8 N: n) d2 l
0 S; {' p4 z0 {5 q3 I& B- u  B" W* ]- b8 G
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* U, e# {+ n3 m' c3 h\Uninstall\SoftICE- |9 @6 v' J  d  Z; x4 L
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; j) z6 O& e) e1 L) ~; _- D2 t
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ m( J0 f2 I  b9 q- r6 r. J) b\App Paths\Loader32.Exe& j  C; l# W, _0 D3 \, V5 W
$ Y7 @7 ^2 e9 |! w

) Q$ v8 Q3 Z" J$ Y3 x% CNote that some nasty apps could then erase all files from SoftICE directory
0 b# M: ~4 n7 I1 A3 j  o  T(I faced that once :-(1 P# o6 a9 l! ]6 L2 x" @' |  P

# x- o, D& T% d7 a) PUseful breakpoint to detect it:
$ Z) K; r% _5 R* y# J* {1 n* \- \5 i! {2 l
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. U% Y. T/ x; u5 t3 D  a6 y

, r& m8 m7 D5 H, w) P: M__________________________________________________________________________
2 p5 J& d/ F( [2 I8 m7 ^0 Q
3 Z8 i' ^9 w3 q. H5 S, X9 N4 z8 ?4 ]
6 p0 d0 C* W9 F) W5 |9 bMethod 14
4 s3 Y; y, `7 x! A! h=========7 B( V9 @) u% `" i% x6 Y! N! O

0 m0 S) O5 ^6 z) ^( b, j# ]" n& VA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ h2 J) \, O; v7 a4 h
is to determines whether a debugger is running on your system (ring0 only).: z' v6 M7 |# D  W" b) B$ Y* Z
9 y6 ]: h$ x1 |4 o5 Z" X
   VMMCall Test_Debug_Installed
& G# `- x! s+ g3 h2 f( {   je      not_installed
9 v9 \- v- ?/ @% L, x! ^0 r  n, ~' [8 O6 G9 I
This service just checks a flag.5 P/ }& S! n, \0 {- N  K
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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