About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; b( \! ]6 c: O<TBODY>
' m) I$ ], X9 \' f<TR>
' T; q; }) P  y, f. x<TD><PRE>Method 01
9 \* W- b. P1 ^=========
' @0 b* h7 C, z2 t* i
; i! S- O: V$ c0 Y/ ?# VThis method of detection of SoftICE (as well as the following one) is
( T; \# p9 q, h8 Yused by the majority of packers/encryptors found on Internet.
4 c: Z: e9 }4 ?" F8 W" JIt seeks the signature of BoundsChecker in SoftICE
, P  R$ @7 M, d( ^3 ]+ x& [/ ^( f! x- q# w
    mov     ebp, 04243484Bh        ; 'BCHK'
1 g) s  |/ {7 s* B, l* W+ [# K+ p    mov     ax, 04h6 i7 f0 P8 q# u% n: u
    int     3       ) n9 \3 T. _( k2 v& H
    cmp     al,4
7 y! Z7 S0 x7 q' t! K    jnz     SoftICE_Detected* o. \/ _& q/ B5 v1 p8 X, l* X$ ^; ]
- J2 f0 `5 C( x5 t8 N
___________________________________________________________________________8 x  a- d4 b+ N5 v% a; W

8 H6 u( }3 I" c5 [& d; k* B. k# m& ]Method 024 ?9 B; n4 v4 V# C3 T
=========* r% y: X' a/ X
7 }7 |1 T  [- a* Z, u0 ~
Still a method very much used (perhaps the most frequent one).  It is used
$ n4 v1 R, T( M6 \# f0 ito get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# @! c/ U$ J- t% x/ B: N# ?or execute SoftICE commands...3 ^: K( F( h# |+ N2 T# v1 K7 ~
It is also used to crash SoftICE and to force it to execute any commands7 ?- |' ]" Y& |; s6 p  |2 \
(HBOOT...) :-((  0 E4 |; f& Y9 `" J9 {8 g' g
; Y0 T* z) R0 O, M
Here is a quick description:
: N5 D+ q2 A3 T' z/ O-AX = 0910h   (Display string in SIce windows)4 R' L; B' L* `% q2 Y. T
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx). n) P5 |1 g  B, ^+ r5 Z0 S! M
-AX = 0912h   (Get breakpoint infos)9 y3 U. g1 H, d
-AX = 0913h   (Set Sice breakpoints)& N8 W) L8 v* S# ~, g" [9 e. E
-AX = 0914h   (Remove SIce breakoints)+ V% J' y0 U9 f2 v4 k8 I8 f. a! }
( J. S: S& p: h
Each time you'll meet this trick, you'll see:
0 I- ^( i: S6 v, G$ U4 r0 t# w-SI = 4647h
; Z9 w3 [1 s, Z9 S! Y0 _2 x! z9 s* p-DI = 4A4Dh6 @/ A: p  h3 S* a
Which are the 'magic values' used by SoftIce.
9 u; n- X% ^) T! W! ]For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 X$ ~$ R' R# x$ N9 z" Q8 Q0 a9 i4 d
Here is one example from the file "Haspinst.exe" which is the dongle HASP
" w; n0 B) M# `6 r3 [3 m3 }Envelope utility use to protect DOS applications:
( H3 {8 s7 j2 m- t3 E1 {; |  R: A  y" P
. O  n& _# d* d  o
4C19:0095   MOV    AX,0911  ; execute command." T: a# ^  I+ \, l$ K
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
' N! |# ]. p' Y) Z2 V8 d5 k4C19:009A   MOV    SI,4647  ; 1st magic value., p% ~+ p# X# f* |+ U
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! Y2 K, L4 y5 n
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 {8 e4 U3 s) E; q% |% @4 z1 E5 j
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute8 v! \% q. i; S) O
4C19:00A4   INC    CX
* y; E* U( @* |7 K! q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute6 R+ Y) ]$ ^7 e! \' w
4C19:00A8   JB     0095     ; 6 different commands.
  S' z/ W( d' u) J# {4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ L) f# R, Z' M/ N/ A  \  W) A5 r4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ s& x, F6 v* Z8 x  I; ?' T5 ]) V; u) |
The program will execute 6 different SIce commands located at ds:dx, which
: S) `0 l0 x1 {0 ?: r& `( Ware: LDT, IDT, GDT, TSS, RS, and ...HBOOT.* y3 w( D; W2 x9 ?1 k  d

6 |+ U) P! n0 Q/ K; r* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
8 Z, A" A& ^; j/ D- K___________________________________________________________________________
& L$ Y, J" ~; J' R$ r) o0 u$ e2 p! }2 U. X3 o% h* ?% W$ h1 s
0 c$ d# j+ ~$ L) v& L" Q3 e: F8 ^5 g
Method 033 @  e  K: _) L  X9 c
=========
$ G4 ^# l* i( n, b! d8 l2 u8 K" Y+ V* l$ D0 d
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h1 m! q) y" x, }5 Z
(API Get entry point)& [2 z( E% S$ T, ]
        6 n6 ^& J4 v% `( m4 y) \8 ^

* |( y) e. h7 y3 L, R% e, z% n: U. j    xor     di,di7 S' ^& r. L9 l0 H# j  u5 w
    mov     es,di+ ^+ Z% M0 v# R, S
    mov     ax, 1684h      
6 F+ u7 Q( R; J" @- B& z    mov     bx, 0202h       ; VxD ID of winice$ ?5 h2 a6 _, u% O8 t4 ?$ O
    int     2Fh
1 g9 \* u9 E# u1 a  n5 C' M+ i    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 O$ `0 |, u* b; C, |- s
    add     ax, di. m& _) H( C+ q1 P! x1 `* J
    test    ax,ax% i/ F) J2 {+ C8 u* D" w
    jnz     SoftICE_Detected6 d6 x2 D$ o7 v% ]7 ^3 f: c

4 r/ p. |4 s5 m  V/ g' P5 N___________________________________________________________________________
( r) W0 ~5 p; n' p% C9 Z; f7 V+ b8 H% J* _
Method 04
) `- @9 t6 w& b: P9 u4 w" J=========
6 M; }9 W5 A* s" c$ \# g8 R' ?/ U' D; N6 r7 v. I( d
Method identical to the preceding one except that it seeks the ID of SoftICE
, ]/ {. b* B1 D0 YGFX VxD.
/ I' c- E0 ], ]! }- z- L; j
; n5 p0 G$ B) b. [' S5 O    xor     di,di! J* s6 w: Y- g8 z8 y; I3 p& w& ]
    mov     es,di4 C2 U& G8 X' `5 r% p
    mov     ax, 1684h      
! s! @: w4 W) ?6 @    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 d+ x/ |0 L- {
    int     2fh) W4 `2 e: @; L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, i/ d% |, |6 W8 j% C0 N    add     ax, di
2 \( F2 n0 H$ @# ?& X, n5 J3 U2 t    test    ax,ax
2 r/ h0 A9 s7 J3 P$ T" o2 j2 P    jnz     SoftICE_Detected
! N7 J& y) ^* b; o- ^7 o7 |1 x- H
__________________________________________________________________________4 L0 E. L1 a8 V; E. }; ]. Y& \

0 H, R$ j) V0 X/ _
2 T& N" J7 \1 zMethod 05" W$ q7 ~; g2 u2 A: ?
=========2 e4 L. I9 T4 S7 [8 `9 H6 U- u
5 P1 N. a. f4 q3 z
Method seeking the 'magic number' 0F386h returned (in ax) by all system
/ Q' L  w* q" S9 i, Rdebugger. It calls the int 41h, function 4Fh.
7 @( F4 U8 ~) V7 b1 {There are several alternatives.  4 E! ?0 g; h9 S. o9 c: |1 ]
5 R6 V; F  v" Z! G/ r6 D
The following one is the simplest:
- H0 i# U9 W( W6 E- v0 B
+ _& J" E0 a! ?$ b% w% [* {6 J7 |    mov     ax,4fh6 I/ T' D( Y) N5 c5 B5 B
    int     41h. y1 X' F1 h5 Y1 ^- {2 d1 q
    cmp     ax, 0F386
3 f- i5 ~+ m; z. T! a$ K3 ~    jz      SoftICE_detected% U5 ~' O# X; b# m! |6 [

! y- L/ Q9 `% t8 ?1 q
+ s& c' V4 U8 e( n% qNext method as well as the following one are 2 examples from Stone's
+ }% c! z! Q( e5 l/ }6 O. o"stn-wid.zip" (www.cracking.net):9 H5 `$ u4 ~8 \9 I
7 m$ ]5 P7 _' v: r, p) U
    mov     bx, cs
0 Q4 \) ^8 x" W) T+ \    lea     dx, int41handler22 ?. e- d1 a6 |7 t# l' ]5 u( d- t" t
    xchg    dx, es:[41h*4]1 v7 s0 z. Q7 n! D8 K8 G" {4 R
    xchg    bx, es:[41h*4+2]0 _5 z5 C6 W7 v- L6 }& d! r% p
    mov     ax,4fh
' S  ?4 |& A( q9 S$ q7 i: z$ `    int     41h' H5 n1 B* x3 w# K+ h
    xchg    dx, es:[41h*4]- R- U! V7 k* s5 F9 }& A+ K6 ?2 q2 O  ]
    xchg    bx, es:[41h*4+2]
/ Y  Q. P, I6 r    cmp     ax, 0f386h; W4 q$ Q! J5 Q- G  i3 ?4 G
    jz      SoftICE_detected
; m1 a/ B. I  M
, R3 [5 ?8 v- x0 d& o- Mint41handler2 PROC
: ]" P% k; f7 M5 B6 [  A8 [" {0 \    iret
! A" L% z" f( lint41handler2 ENDP2 c; u1 \% B) K
: w) ~8 g! K2 f0 X) o/ J

9 F1 ~' ~  m/ o4 x* z: t5 f& d  b_________________________________________________________________________
8 s7 V( v$ h& {! t3 {
$ z. h8 l! V9 ^# W. ^) F2 k( g" ?4 Q/ x9 |
Method 06
) c, h5 ]; ?- Z; }# \& X=========
. t' W( A- r3 [7 R& Q. h6 a; R4 Z% b- W& g# f
2 ^; O1 ?# A+ z& Z* M( g& a1 Q
2nd method similar to the preceding one but more difficult to detect:
6 }+ q7 D2 i( X
- |1 ?4 `+ F. s5 f8 H; `" J: m, b7 C$ u+ i  U, Z/ m
int41handler PROC
; g8 g  a4 }" H    mov     cl,al7 ^: v, G$ K1 c. Y* _! }  b' i: ]9 N
    iret
' U/ x# F' @, l( Iint41handler ENDP
" }2 p1 J# R! J: I$ p- x  t' @2 s8 g$ X% l& {& c
) i" P) a5 w" }4 b% h9 X
    xor     ax,ax/ J/ L. M4 a/ g4 [; U! p# F/ Y
    mov     es,ax# B- e: {5 w8 D& k
    mov     bx, cs0 z- z: M# c, q0 a* k  b
    lea     dx, int41handler; e; f0 `, ~- P1 n7 m1 w/ J
    xchg    dx, es:[41h*4]
$ h# ~- D3 ~, ?: _7 `9 f2 d4 n  D+ b    xchg    bx, es:[41h*4+2]4 m5 ?9 W( D9 G$ i6 H) {0 r
    in      al, 40h
. a/ b; L. H. ~0 U1 J& f    xor     cx,cx9 b6 U6 N" N9 G3 W/ l/ O
    int     41h
% Z2 t: M$ f2 G    xchg    dx, es:[41h*4]
/ p- U1 T1 _9 S' e# q    xchg    bx, es:[41h*4+2]
8 R/ l/ g4 Q/ D& Q9 u* ~7 {    cmp     cl,al% p5 T! a9 V: r5 D% e
    jnz     SoftICE_detected6 X% e2 R0 \. F5 p: c$ L

% h8 ]! b& n, @6 i* H_________________________________________________________________________) z( n! u( Y- G& D" W+ i. E
: ?7 }- L% m; y& N
Method 074 g; x0 G6 v: f9 v
=========
3 y  w0 Z0 [# I. g& Y% o" B- ?: P# C% p7 d
Method of detection of the WinICE handler in the int68h (V86)0 S! [7 q, O  s/ G# h+ [& o8 B. `
2 I8 U: D. j. I, s7 i
    mov     ah,43h
4 ~; h- d8 d  n0 h$ S    int     68h; m% m6 ^! O5 ^& E: n! x# l$ P/ M
    cmp     ax,0F386h
0 S% n* ~+ A0 D& V/ [4 w    jz      SoftICE_Detected8 }7 P% ?4 b$ M2 @* t
5 n5 ^. t9 D/ x+ L1 q
) A7 u6 d; n9 u* F' {* T
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" N1 Q" ^; L% J2 }   app like this:
6 C; z9 T  u$ v  e- {. f: u6 D2 ?$ H+ y( @
   BPX exec_int if ax==68  f/ M+ }  }: g% Y3 ^) L
   (function called is located at byte ptr [ebp+1Dh] and client eip is
" C8 O( f1 d. V) f1 B   located at [ebp+48h] for 32Bit apps), v, N2 A9 c2 V+ D, S
__________________________________________________________________________5 u, h- Y( b, S" M& V! e5 o$ r

$ g, }) ^, ]) X: C1 A* G
& l* F2 W0 ?+ K8 j' C% o. PMethod 08
9 _* y# q% Y  o& g  y=========
, U# V+ ^; v* s3 l' q+ u5 O, u0 w, L5 m
It is not a method of detection of SoftICE but a possibility to crash the  q% Q8 F* p8 }' ^9 @
system by intercepting int 01h and int 03h and redirecting them to another; [* p, b  W- |- d1 j
routine.- D, j/ R3 U+ }/ K5 |% [! `
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  C5 j6 |5 N& Z6 j# sto the new routine to execute (hangs computer...)6 y$ e& ?  K" W1 b# x, Z( \* f$ z
) A; L! b+ a' }4 H5 w
    mov     ah, 25h: C5 h: x# k% C
    mov     al, Int_Number (01h or 03h)2 o" y1 g6 q; d% G3 [, F$ s
    mov     dx, offset New_Int_Routine/ e- I5 D1 t- a9 k7 S6 {3 \: j
    int     21h. Y9 x5 G5 r: x, v
$ F: ?, ^2 E) U" j- Y; I
__________________________________________________________________________. o5 m' c6 ?* @  L# \

) n( j- M! G1 {- u' i4 T, rMethod 093 L8 ^- h  Y  X& R2 D9 h. _3 f
=========: e1 m  u- X6 a8 c" y; ~
& t' b$ o! R  v' @
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
- @: B& D1 A3 v' G( [6 o5 Q/ Fperformed in ring0 (VxD or a ring3 app using the VxdCall).* k/ T  D% Z& ?5 |
The Get_DDB service is used to determine whether or not a VxD is installed
- }3 U' H% J+ D5 u, \9 L) |for the specified device and returns a Device Description Block (in ecx) for
1 d4 G5 v; u4 z2 vthat device if it is installed.
' l) w2 d4 J& Q$ j  Y3 `
3 N% e! d. y+ ?* c, W3 N( k   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 j! {1 [" A6 r( ^$ E
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
. ~. i# k5 _/ V+ b' C0 K+ J( a   VMMCall Get_DDB
! Z, A5 V' \* r  `   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: ?* K2 i- w9 g1 w6 _$ |* L2 T* o6 e' M0 v
Note as well that you can easily detect this method with SoftICE:5 a9 v3 P1 K" L  l
   bpx Get_DDB if ax==0202 || ax==7a5fh
" o3 q) s" y! f9 e" }; ]/ e  {
8 h7 U% s) A6 ?$ F__________________________________________________________________________
& p( K" u) J' [. r: d4 U
) G4 m5 n. i8 ?4 D. l# q; lMethod 10
  D  u3 o- I; K" R7 Z9 Q=========8 s4 z8 O$ M5 g
- i2 P& U+ P/ ~6 ]
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
; r; P! L4 ]; E1 m6 @3 D5 w  SoftICE while the option is enable!!/ W; I8 y2 t3 V5 u$ @* O
. a* v4 ?+ h1 M; @2 j+ X7 M
This trick is very efficient:8 |. _: N! _) c( ^! f2 D
by checking the Debug Registers, you can detect if SoftICE is loaded2 [. }' k) e( _# t+ w! e8 E4 \' t
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if% r# N. a- a* W( ^% N& s% t
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" ^5 L: X; E) h' ]value (in ring0 only). Values can be manipulated and or changed as well. w, [: j4 n- j( V6 b
(clearing BPMs for instance)$ e5 }3 h2 R. ]1 A# Z% ^" ?: I
$ o) Q9 l7 L7 W, M8 T3 M& c
__________________________________________________________________________
1 l+ f+ B" P2 \( |, H0 C. r5 }( w+ x6 n. h/ k0 t# V, s3 y
Method 11; L( ?2 C0 O1 H1 _
=========  t; k+ v$ M& `+ k* L
# V9 j) A+ ?# h' I' i  M- E* Z
This method is most known as 'MeltICE' because it has been freely distributed
% f4 O% |& o7 z! d  g  Jvia www.winfiles.com. However it was first used by NuMega people to allow+ t$ s7 O  [1 `$ S: z
Symbol Loader to check if SoftICE was active or not (the code is located
# ^5 ^) c0 l6 E& K& ginside nmtrans.dll).
" R* x8 n1 K  z0 c9 v- q# y- C
6 K, q- R/ H+ F) Q* IThe way it works is very simple:
0 f* k0 l' S1 O1 B* y# }9 ]& ]It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# R) ^- S. c# A. {$ N( n/ jWinNT) with the CreateFileA API.
- T% u. L( c# ]# x6 e0 E$ k9 N2 ], L1 d# [3 C4 Y$ A& \
Here is a sample (checking for 'SICE'):
8 G1 f' U' g  ?. n7 O7 Z; O0 m& q* i$ s6 \0 i2 p4 I' \# P6 ~4 {. Q
BOOL IsSoftIce95Loaded()
; J: `! B# q! ~{
" w4 R6 x" Y& F5 a   HANDLE hFile;  
3 |' ~$ |. ^. ]   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ F8 e' x- Y- t! n) H: }- n# u1 F                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 r2 H- ]9 O) i- }) ]                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);" y6 S7 W- ~) L0 s" C4 t- z7 Z
   if( hFile != INVALID_HANDLE_VALUE )( m; m" p3 J" @" a; A% O  A, v
   {2 }8 V  ?! q1 ?/ _$ n
      CloseHandle(hFile);
# S* d6 d* ~7 D: ]5 {* u% E8 F      return TRUE;
: t4 {* s( a, |: `, ^" X" v   }
: U# L& G- `0 k0 Y: {% v& H   return FALSE;! r/ l8 L; m  s
}7 ~: x5 C* s+ L+ y$ U5 e+ M4 ?
) L7 `' d+ U/ x' l
Although this trick calls the CreateFileA function, don't even expect to be1 Z. o( A9 X- `" y2 z7 l$ X
able to intercept it by installing a IFS hook: it will not work, no way!/ a  X! H9 k4 h) r/ a6 P6 }9 H5 X& B
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, K% F7 w( Y" D- x5 y4 x7 a
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
, ?9 O: R# X8 z1 H, X: v4 T" H4 |and then browse the DDB list until it find the VxD and its DDB_Control_Proc' k( C4 R1 @1 Z3 B2 m
field.! H8 W: O% n( B; g4 r1 i
In fact, its purpose is not to load/unload VxDs but only to send a
2 y* j- P& H; c# [+ A! Z2 iW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 H8 y) ?- c( U' M- Q- ^
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
  Z1 ~. |7 Q* q0 A+ o, K  yto load/unload a non-dynamically loadable driver such as SoftICE ;-).1 @8 w9 w2 r! R% M) ^
If the VxD is loaded, it will always clear eax and the Carry flag to allow
1 B9 B6 D4 H, i) e  g8 R. Wits handle to be opened and then, will be detected.% C& U) e$ g  R# G* ?
You can check that simply by hooking Winice.exe control proc entry point! _2 v  F# e7 R& a* C* R" D
while running MeltICE.
3 {/ T$ t) Z/ k6 i0 i$ I- l+ a0 K( a1 u# g" P

) @/ h& \9 {  w) d, o' U  00401067:  push      00402025    ; \\.\SICE1 l& m& X; `" Y
  0040106C:  call      CreateFileA1 h- g7 O) e) h
  00401071:  cmp       eax,-001& P8 n; d; @0 i
  00401074:  je        00401091
* s1 O4 {1 `) a9 l4 W" E9 ]" e% B. g6 Y" J; ?9 {% q/ t

/ |6 J# |$ v# o2 m; Q4 WThere could be hundreds of BPX you could use to detect this trick./ P3 l& z3 q' b' s( [# @! `, a5 `
-The most classical one is:; `7 H! \4 }% ~; P: L4 Q$ a0 ~5 k7 h
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
6 O$ n( ^; Z; c5 F    *(esp-&gt;4+4)=='NTIC'" k; D" Y- r4 Q7 M. H8 W3 Q

4 s# f; X3 t1 P- k. ^-The most exotic ones (could be very slooooow :-(1 A3 q3 Z. T3 m& ?. m
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ l$ S# O8 ?% X( h+ P2 D9 ?# f$ H$ R     ;will break 3 times :-(
& A. y/ W* D) Z$ _! m  W
) V$ y+ u4 q; V0 n. Z& v+ j2 m7 C3 K+ A-or (a bit) faster:
$ z+ S; X2 l$ I* p- c4 U& }   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 V* J$ Q6 F9 y
( k/ n: u: M3 W. h   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : O8 X9 [+ B) p6 Z: h) n
     ;will break 3 times :-(
* s2 M3 [3 z/ u! L3 X
6 R) Q: B5 w& v. T/ `" C1 ?-Much faster:: G/ ]7 Z2 P9 o) ]* |! Y, F
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' g0 B; E* l$ e# I7 b! L

. Y/ v+ \& I+ G4 {. L( aNote also that some programs (like AZPR3.00) use de old 16-bit _lopen0 h7 m& t" V: a% d+ h
function to do the same job:7 i# a' e; C5 B1 ]. r6 L$ k

8 H3 ~! x0 X- [   push    00                        ; OF_READ
+ n6 A$ l- w$ Z  n' M% O4 f" w   mov     eax,[00656634]            ; '\\.\SICE',0
* n2 h# n; D1 r3 N, j$ J   push    eax
* Q3 B/ c+ h& P& v2 J1 A   call    KERNEL32!_lopen! c% s/ E+ `5 a% L
   inc     eax
( i6 U% ]$ z8 P- _% [   jnz     00650589                  ; detected" @$ A; y1 B$ y) d5 I) p
   push    00                        ; OF_READ% H1 b. F5 Z& e4 E" T
   mov     eax,[00656638]            ; '\\.\SICE'
5 O  L. f+ ]" B9 G   push    eax
+ K$ o3 E9 d- a   call    KERNEL32!_lopen1 }. B/ Y6 |* ^" G- `
   inc     eax: k  M8 H# H' I8 J
   jz      006505ae                  ; not detected  B% Y, o8 [0 v5 O

$ S# F, O" y2 D- L+ e8 [1 h( V7 `, ?* w8 P2 W" R% ]& \6 H
__________________________________________________________________________
! w2 K: Q/ m1 F/ a6 J% T
2 u* X* \0 o! u9 x0 bMethod 128 M' `/ A3 O0 i; i7 f
=========
3 o5 ]# v2 h. m: u2 M8 j
/ _5 P0 g% _* p+ TThis trick is similar to int41h/4fh Debugger installation check (code 05
5 L5 n5 T+ ?5 A, m4 y1 [, z&amp; 06) but very limited because it's only available for Win95/98 (not NT)
6 W+ G: E7 H5 B1 X- _8 X+ e* Cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.0 |. F! @7 V1 e: c

" o- O$ o# k  w3 Y- E9 r1 u   push  0000004fh         ; function 4fh
6 G! d" A8 ^; A% F# P% M   push  002a002ah         ; high word specifies which VxD (VWIN32)
$ A8 F! X2 h" V1 B( ]                           ; low word specifies which service1 A0 M) z. d" P4 E8 G
                             (VWIN32_Int41Dispatch)% H1 h" [7 U0 m/ J% u8 t6 \- ?5 B
   call  Kernel32!ORD_001  ; VxdCall
3 S4 `* A: x9 j- y( L8 n* H   cmp   ax, 0f386h        ; magic number returned by system debuggers
( }. G1 _6 K# _% F   jz    SoftICE_detected' C5 |9 j! h2 ^; h8 _3 o

# Z: E9 P4 w- i! I* [  _Here again, several ways to detect it:* \: ^3 B5 m+ S0 }& [

# Q8 S/ n0 n- F' X- N* R/ F3 x# `+ y* W    BPINT 41 if ax==4f
) ]$ L6 f: F) V: n2 S, Q
0 |* Z( @/ j! Z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 o4 v( W2 c8 P- l* E4 M6 Q. D! Q# u, i% u, b
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 G8 M4 n/ f- t5 `
5 j) `9 v5 d0 r/ C2 c    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 M+ d6 z9 y8 }! d! `, s# K* _% Y' U, J' j
__________________________________________________________________________2 k  b, c; ]# J" x4 h: J# I

/ X" T' D, Z$ Z- d- wMethod 13- t- W  a2 _& `: T3 y
=========0 R2 S+ s0 `8 k# U$ J) f

, _9 W5 h8 C% m7 Z; |: hNot a real method of detection, but a good way to know if SoftICE is
8 o+ f" E. Y- S" B) minstalled on a computer and to locate its installation directory.
6 r6 h1 S( f: |It is used by few softs which access the following registry keys (usually #2) :: V* B. a& T9 o  e( P' y; C" `
1 \) m8 W8 a+ b+ m2 [
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 F5 T7 ~$ ]' v3 }: l
\Uninstall\SoftICE
+ E- R+ g) I1 G, e) j-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; I; o1 f4 n* P7 l
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 Q, J7 m8 F0 ?# p. |; A4 u
\App Paths\Loader32.Exe
, B4 G# O2 c3 B. B3 V( o
" v( k8 H8 _) B5 b6 H# F& j+ V" ^) P2 g  k' u" L) Y$ x
Note that some nasty apps could then erase all files from SoftICE directory' z6 F7 d  L. n% h
(I faced that once :-($ j. T  d6 a, b

* C8 W  ]: ?$ {Useful breakpoint to detect it:
6 _3 s: q$ k, ^- p  y+ e' a. D0 T- u$ e1 |/ n# G  H5 S+ t# C
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! r/ Z' n9 z5 r  C; E

' I4 P1 l1 w( _! i0 H1 I7 @__________________________________________________________________________
. b% D- h' T* a; n
" F; w7 v+ Z' w. R- @( d5 e" B5 B2 N2 [+ x/ K" B: Q: r
Method 14 . k3 M, L3 b% A, \. w2 o
=========4 k4 B* I, F; @
0 ~  r% d- S. N1 F
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
7 ]9 Y4 A# X9 t* Ais to determines whether a debugger is running on your system (ring0 only).: c- Z4 f; p5 Z- e5 E/ w

: w; H7 v4 w' |8 |7 R: c* y   VMMCall Test_Debug_Installed: \4 [1 q' D  _$ L0 p0 M. m
   je      not_installed9 d1 e6 C3 C( s3 i; u

2 X. F' {/ [9 R, rThis service just checks a flag.9 T  Y4 z3 I1 m9 j) Z( `+ B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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