About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% G) i. @! `$ S; X& {9 y
<TBODY>! {1 A. F* ^: Z* F
<TR>
. |, o0 u$ J% C( ?1 x<TD><PRE>Method 01
' Z1 c- r% K; k# L' @=========
6 _9 X4 e$ h) r6 a" E
) X8 A6 m' z5 WThis method of detection of SoftICE (as well as the following one) is4 d( Y1 l! D5 m  O# u/ T- y- F! e* |# ~
used by the majority of packers/encryptors found on Internet.
: l9 G8 M* ^# H! A, m" iIt seeks the signature of BoundsChecker in SoftICE, f9 L1 w6 n, R/ m& g
+ P- F7 a9 d" }
    mov     ebp, 04243484Bh        ; 'BCHK'# s- c6 L7 J$ B0 n7 Z. c
    mov     ax, 04h
+ [$ a3 |8 M/ p7 h: T  m, c    int     3       8 `' H* ~" d  S
    cmp     al,4
- k# T+ w% `0 a& i    jnz     SoftICE_Detected
1 I2 D# \4 n/ n) ~: x3 `$ j9 |( F2 t& c) W# h* P. I6 |
___________________________________________________________________________
4 G4 G* c* l/ A! I; t8 _; e$ P  u  \3 o* ~% X
Method 02% Q1 K1 g& D4 n2 v7 J/ V+ z
=========0 b" k) I! j" c' d" a4 Y; E
4 N+ ?/ N4 V# Y. z
Still a method very much used (perhaps the most frequent one).  It is used- f: r: I3 S: y" C9 S8 D" J
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
( ^1 t, f" m% m) P% V: ^or execute SoftICE commands...
8 u4 B5 g6 s9 e6 t% b/ SIt is also used to crash SoftICE and to force it to execute any commands
3 e% ~/ b5 X, j) ?4 D2 E(HBOOT...) :-((  
2 w3 @8 e" i% g  `  k
  \, f: D6 c, A3 X7 BHere is a quick description:: u! H0 O2 J& U1 V& Y) v% _+ F7 O* b
-AX = 0910h   (Display string in SIce windows)
# r/ t, M# g9 ?2 {% X0 b! Z0 @-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 H, t; {: s% ^1 Q! X; l9 |. S0 [-AX = 0912h   (Get breakpoint infos)- f7 z" [' N3 ~3 L
-AX = 0913h   (Set Sice breakpoints)$ t( ]: I, d# Q- e; S
-AX = 0914h   (Remove SIce breakoints)& c2 C4 R* l$ R0 i1 j
  M, D; a8 l- Y* d& q- y2 I  A
Each time you'll meet this trick, you'll see:. m' D# m. @: q9 t
-SI = 4647h/ f6 ?# F' U& D- J
-DI = 4A4Dh; t& p) O: \/ S1 ?: X# G% n8 F6 f3 P
Which are the 'magic values' used by SoftIce.
2 J4 ~3 Z0 h, u5 c% _For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& L3 z% |7 w; n0 U1 g

. G  H1 ?# t3 U, eHere is one example from the file "Haspinst.exe" which is the dongle HASP: U- O" V$ T2 O7 Y
Envelope utility use to protect DOS applications:% W3 A$ T$ u/ |. [$ W; R
: B( u7 R* v# T* N, S9 h- ]6 t
! ?! c6 K6 A& `% S, e
4C19:0095   MOV    AX,0911  ; execute command.8 e# Z' V3 R; a* ~& B# Z. R
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 f# A$ y% z7 a$ \" D# J9 E
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 N7 j2 }% F9 ~6 O" ~. q4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 V5 Z6 N9 q, y3 \$ l& ?4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' F  U( F3 H% y" S, v9 N
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" e) k1 o0 ]- ^' g! H. t
4C19:00A4   INC    CX/ v' h) I) \' D3 B1 P0 B4 z( J
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( ~% R1 E: z3 `& {1 y
4C19:00A8   JB     0095     ; 6 different commands.. }1 ~; {/ L: G- ?! Z, v8 N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ H" p- {9 \# D4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 m1 l) Y6 i* P
+ e/ V+ D- H" Y( I" O
The program will execute 6 different SIce commands located at ds:dx, which& b  m# t* Q8 J( U5 y/ Z: B
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.  A- A" p0 `" y- F

6 S' w& ~  @; u/ ~3 `& g- g/ M: z* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& M# n" f5 a9 _" M$ x/ D___________________________________________________________________________
% q: \0 P/ N& b  W) Z5 }8 f6 Z
3 j# _0 u  m3 `% f0 C5 t
$ v* x) _2 L2 v9 e$ F2 LMethod 03
( X+ E# V3 O$ M, q: P8 F, `=========
5 e6 Y5 p# k! M0 I; @1 C( |2 v
+ [7 Y- s4 G# K% HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 U( t- G5 _- ^3 A5 U, c% |
(API Get entry point). P1 W4 `5 c/ y" ?2 r
        
% j0 [; [9 h- Y; @5 I! L/ ]  i0 t4 v3 r7 w) [
    xor     di,di
* O6 S( ?7 h% I    mov     es,di# f* ~0 e0 D# j7 E/ H% F
    mov     ax, 1684h      
' v7 q* S; ?' E" H2 G. x    mov     bx, 0202h       ; VxD ID of winice6 Z/ H: v1 X8 i2 Q2 M6 e
    int     2Fh' h$ V! E- _5 D8 w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" ^5 J4 [0 L+ t# f; _& U    add     ax, di( ^% T8 ^; n) E' P, n
    test    ax,ax: q5 k. _. f/ ~' @7 E
    jnz     SoftICE_Detected
% l% B, K# e! V; G8 P- @# e7 m5 X2 b; U5 ~, t) j8 n! o
___________________________________________________________________________$ [1 ^' d* y- v
) V3 V" y! X& Z& }: ]! v
Method 04+ N, R% l- _" l/ B, F. W9 W$ Y
=========
2 c& I: j! u3 X7 W. B
, Q  d4 E& X3 uMethod identical to the preceding one except that it seeks the ID of SoftICE
! N% K+ J# h; B6 T2 C% S, }2 }GFX VxD.
# G' B) S3 k2 V8 C& j8 R0 _
: Y: t3 c4 c, P7 A4 c# Z$ b1 p    xor     di,di5 ^. c# T; P( ]: U$ e: J1 l& Z$ x5 i5 c
    mov     es,di' J. d5 }- Y2 j2 X. B# L
    mov     ax, 1684h      
) o3 o" v4 G  N$ D    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 {$ L- R' D* L, [9 T0 R. W. [    int     2fh) j7 r' e" g, p  p0 l+ h
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, C/ ~7 @# t7 h; M( A$ R+ ?    add     ax, di$ a* _* X7 R" x! F' P: _0 I8 l4 P0 \
    test    ax,ax
: b; `, e# n8 n' q/ v: B: L) D* v    jnz     SoftICE_Detected
. l' ]: x4 r  c. i. h& g" V+ N6 t0 u: X! O4 S8 _7 i. K# f
__________________________________________________________________________
7 V: M6 g0 |- }0 N3 E
. {. U+ g* a  x" A( G& Q
  h& o+ [" Y, [% D) X+ G' W( xMethod 057 E' l, G: h, B
=========/ K* _& W6 D, s& g+ M

1 L8 S# M. ]5 X' w' ZMethod seeking the 'magic number' 0F386h returned (in ax) by all system- @" y5 C6 K- }0 d4 u$ C: `
debugger. It calls the int 41h, function 4Fh.
& {* T1 p7 t  q; F. c! z1 cThere are several alternatives.  
! ^, Y: S: u9 \, l9 e4 ?
, o8 O! p2 l2 M+ {* |' R1 d+ h' |The following one is the simplest:
! b3 D+ O% \5 W2 [0 D( u' |$ A  x* ~# `" \5 Y5 ^
    mov     ax,4fh: ]+ C! u4 _0 }& j8 s
    int     41h
8 S) f: t+ L" w& W. ?$ N    cmp     ax, 0F386
+ R5 W# O. m. G4 S" _    jz      SoftICE_detected
0 h3 @  @& B% s
( ?- c6 b# l5 ^3 k7 P7 d& G0 a* e, [6 Z
Next method as well as the following one are 2 examples from Stone's 6 k3 P. B2 |; n' b' Q+ k7 f% b
"stn-wid.zip" (www.cracking.net):
) U; ^) B" i' E; ^$ ^' l. `  `' J" ?. l% f1 O
    mov     bx, cs
. h4 f9 p- v# w9 J9 A# e) {    lea     dx, int41handler2
' W- x0 ^/ n) [: x    xchg    dx, es:[41h*4]
. Q0 R8 w2 o- p6 B0 w4 F, A    xchg    bx, es:[41h*4+2]
# o! F' C" P# A, T" z8 d% A    mov     ax,4fh
1 {' k; B& b; P" o# B8 q    int     41h5 b+ l* d! E1 I" ^
    xchg    dx, es:[41h*4]- [8 s: `4 `( ~. P8 v! ^" \7 _
    xchg    bx, es:[41h*4+2]9 |7 |) Y. _) @' |2 P$ ~
    cmp     ax, 0f386h
* F4 A6 p9 N" @- u2 `    jz      SoftICE_detected
/ G" C4 B) T7 T" D4 k$ ]
9 c" D  Z. _7 f" mint41handler2 PROC$ v3 d8 }: A2 i3 X+ h7 _) ?
    iret
2 Q6 W8 N/ d1 e  K8 R( e1 O/ U9 w: }int41handler2 ENDP
. {1 s4 ?2 I1 g2 z6 m4 @( P! Q  t

4 h* w  D6 Q  i8 A) i% k_________________________________________________________________________
" f# y) o1 k7 o; |; {/ }
- K7 n7 P# h8 p; l" v5 O5 ?8 S8 N: C- f$ {& Z2 M
Method 06* c3 v7 [1 b9 k; D' Y; M
=========: U8 B' ^9 R" N. S% |
: D7 s! u' i0 c' x. I
2 Y9 R3 h) v* S' R  ]
2nd method similar to the preceding one but more difficult to detect:
! }# {" }: i8 e2 l7 s$ l6 b
' f! a( G9 ^1 t1 _! ]3 r9 J- G4 I' q, N
int41handler PROC
1 a$ Q( I, Q4 m8 a( o% n; q& f    mov     cl,al0 n! m2 Y( W$ |" B0 C7 F& I6 j
    iret# p) R" U+ X6 Z4 d6 H
int41handler ENDP
. C5 c* O8 H+ Q2 q- f% n  C' z: ~" {# q+ k0 ^. b2 s
. h: O; f: Y! w0 u2 @
    xor     ax,ax
5 M: _( b! i7 ]    mov     es,ax' ^" R2 a8 N+ A  Z  y
    mov     bx, cs
) G, T/ h8 s8 v$ N$ K" |: a8 ^) ^1 a    lea     dx, int41handler
, d  s" ^$ B  v5 f# ?# d2 x    xchg    dx, es:[41h*4]+ T9 L3 K3 f/ o, [
    xchg    bx, es:[41h*4+2]+ ~" N; _% G, c- J
    in      al, 40h
2 h4 k* }' j8 h' I6 f    xor     cx,cx$ P4 o/ h) I" E
    int     41h1 |9 o7 _" h: t4 \2 y9 Q) [: T
    xchg    dx, es:[41h*4]
+ [1 d9 S+ F: g( ?    xchg    bx, es:[41h*4+2]
, P5 N3 Y1 \3 N4 P& s  U    cmp     cl,al
2 e$ L; w; }4 G/ L/ i* `    jnz     SoftICE_detected) \9 h+ Q1 F+ t7 {
6 ?$ Z, n' R6 Q" q+ m( N
_________________________________________________________________________* w9 p4 W/ z5 b+ G: H
& T4 R) L4 c9 v7 F" O8 B' _
Method 07. b  ~: q$ s: S% @8 L* r" v: a
=========  x3 F$ G4 ~3 l8 Q( L

# J% B. E* r- u, QMethod of detection of the WinICE handler in the int68h (V86)
  b  u9 T. |5 y( W4 p% a) q' j* l0 R) W! [
    mov     ah,43h
; Y) e# Y: g! D/ \, U    int     68h; ], @/ P" s. ]' J/ v/ D+ m4 |  e- p' G
    cmp     ax,0F386h
1 l- [" i% d  R' _! @9 U; y    jz      SoftICE_Detected
/ O7 P  @5 D, X, p& m& H3 o/ D# @% l& m' D; e. Z$ h
6 C( i& k1 h$ g' A* \$ ]
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 Y1 Q; v5 @6 @; E6 n8 X3 ]   app like this:
. ?" J) j! c5 n, m" |2 \
6 u: R6 ^2 i9 e& w0 I4 I) `   BPX exec_int if ax==68: [1 v5 Y) @( I' F9 ~
   (function called is located at byte ptr [ebp+1Dh] and client eip is& F# c1 x/ F& Z5 L. c- b, s9 }
   located at [ebp+48h] for 32Bit apps)5 N" T! L% [6 [' _
__________________________________________________________________________# d- {/ Y/ X, U: \0 t  p

$ K# ?5 w0 n+ k
& j# m; x0 X/ [: n1 B' cMethod 08
9 C) z: i8 N+ r6 D2 L  k=========9 L" h6 W7 E9 y$ N

* ~, |! q# t4 j5 o( E# u4 uIt is not a method of detection of SoftICE but a possibility to crash the; p8 J! }# ~$ M: r, l
system by intercepting int 01h and int 03h and redirecting them to another6 I9 ]6 z8 w4 e8 \% u
routine.$ |& S& D" N9 ]# e. R% c8 g# [
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ a, n0 y& z6 P% ^
to the new routine to execute (hangs computer...). u& n) M' g0 {- ~. c
$ I2 I. J/ N  L
    mov     ah, 25h
+ M6 x5 J# j2 N; v  K    mov     al, Int_Number (01h or 03h)) F9 }& ?3 H  i( ^5 G
    mov     dx, offset New_Int_Routine8 D( w) |0 q, a# v
    int     21h
+ ]9 D; m9 w' v7 V5 b
* f$ V7 e0 \. O8 T+ ?__________________________________________________________________________5 U% @8 _: b/ b# y- z
0 j2 D  r6 \8 L4 H* ]) X' ^
Method 099 W5 o- S! j$ L; |. @. o
=========8 j% P! N9 d9 G7 Y4 i& \
5 b. E/ j, ]2 O; B: x8 w& w3 b" a
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; d$ E2 `% s$ Q9 H& {* E  E7 K- `performed in ring0 (VxD or a ring3 app using the VxdCall).
% G6 E  `" j% F* h) U8 a: s& dThe Get_DDB service is used to determine whether or not a VxD is installed" m6 X& A- F5 l
for the specified device and returns a Device Description Block (in ecx) for
' b' t9 R2 F  h6 Y, dthat device if it is installed.
0 e" P; d9 h# R0 {* m! S& C, Q; o4 x
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID$ t1 p6 @9 c) h' F8 b& ~
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), G! q% f# C9 C8 p1 r% B
   VMMCall Get_DDB! }, Q6 Q3 ~) R- W4 R
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed+ w1 `: P% F# p1 ]4 B

8 F* \. W  F' h8 O' JNote as well that you can easily detect this method with SoftICE:
6 Y. z6 D2 l1 m/ d/ @   bpx Get_DDB if ax==0202 || ax==7a5fh# P; V; @' j% p3 P. }
7 [, x% s  c: a4 i/ B" h" r
__________________________________________________________________________
; F1 j: z/ i  h. v
9 d5 p" c3 I, |& V/ V0 \& bMethod 10
0 L" }: m4 M$ D! W=========6 e9 K; {& }2 }

7 o0 u7 C# \  Q=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) G/ u' a4 W+ ~  SoftICE while the option is enable!!7 Z8 [8 E' `0 {8 H& d2 K
4 t2 U, H5 M5 s6 M7 T
This trick is very efficient:
. K% B, Q% @- A/ Z1 P9 p" |3 I1 Qby checking the Debug Registers, you can detect if SoftICE is loaded
% K! Y" X3 P7 A9 r2 H(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  `. p0 Q, u7 z9 W( qthere are some memory breakpoints set (dr0 to dr3) simply by reading their
9 {% N5 r6 V+ N* M  Q3 fvalue (in ring0 only). Values can be manipulated and or changed as well
8 p% x! U' h+ k9 I* h# R, G(clearing BPMs for instance)
" d' @2 H$ n& A( |/ {: l. J
2 G+ J4 q( X" p+ D" w, \& P__________________________________________________________________________) w+ s2 S+ S; q( X

; Q; x& H" t7 q1 ?' kMethod 11+ O8 k5 E8 w( k" M" ?" _
=========5 K1 B3 j4 f) @9 O

$ N4 h. l* J- p" n9 @This method is most known as 'MeltICE' because it has been freely distributed
5 M, ?1 p% I. w, }8 h7 r* g1 k9 ovia www.winfiles.com. However it was first used by NuMega people to allow
3 w, P" W* U6 G- mSymbol Loader to check if SoftICE was active or not (the code is located8 Y% S2 ?# H/ F% U0 S, A2 m
inside nmtrans.dll).0 k+ ]# _9 C) @0 J- @
7 h0 L# s/ m+ D: Z) C# Y$ `
The way it works is very simple:( ]& X5 e; I4 Q0 e# I
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) A, Q7 Q" z9 I, kWinNT) with the CreateFileA API.3 C5 m3 \6 t' D
8 ]$ L7 f- \3 |5 |1 I" _' u
Here is a sample (checking for 'SICE'):
9 W# K1 s# Z9 r) c0 G! ~! n: C) W9 b$ p8 H7 m6 i4 t8 c8 g5 g
BOOL IsSoftIce95Loaded()
) H  f) @9 q% m3 Z1 F3 z{
$ U2 y% p" \. }' R' ]   HANDLE hFile;  
+ O4 [# F4 E' i) r. [! \   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 \4 G1 }' r& n$ \5 A& \" N( d                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 f3 K* s- I  [$ H& H                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);0 R; o3 c8 S' t& @$ c
   if( hFile != INVALID_HANDLE_VALUE )
$ G1 B' h7 A$ b: n: i   {
' `/ l. P& x- y8 G4 g3 }( r      CloseHandle(hFile);
/ o9 D; [5 K2 a3 q& x7 b. d      return TRUE;
& a6 h6 O" \. [4 o! p   }! O# l( v6 f* J" X8 J4 O
   return FALSE;
; D( {4 }8 t: n3 L5 ~& r2 k}* E* b; W! y% v- i2 S

  z$ m! R9 l$ p3 }/ z. o8 MAlthough this trick calls the CreateFileA function, don't even expect to be
+ m2 x9 v0 N/ l8 Pable to intercept it by installing a IFS hook: it will not work, no way!$ X5 j. P/ I$ D- x1 ~* N
In fact, after the call to CreateFileA it will get through VWIN32 0x001F+ x1 U; P! g* ^, b1 p3 e7 n3 ~
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 L+ O8 e3 ^0 s: Rand then browse the DDB list until it find the VxD and its DDB_Control_Proc
& N. [# R& t4 d- q+ ifield.
' k% x9 [" p$ a- D& z" b* [In fact, its purpose is not to load/unload VxDs but only to send a
. f( W( [" T; P( TW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! _$ A& W" o+ O+ ?0 [" Z, Rto the VxD Control_Dispatch proc (how the hell a shareware soft could try
; A" W; h6 L) ]& k! D1 n8 @0 Cto load/unload a non-dynamically loadable driver such as SoftICE ;-).0 |5 k# A8 y& ~* ]$ |- M
If the VxD is loaded, it will always clear eax and the Carry flag to allow5 Y+ m: w# T6 W  o% J- n
its handle to be opened and then, will be detected.
: d$ z* `* G! L/ U! }, jYou can check that simply by hooking Winice.exe control proc entry point9 ~3 N/ \1 z& p8 L' \
while running MeltICE.
; G6 I2 q# @% o) q3 R- t+ c
, f2 p; u. \) l- h* J1 }; C% ^
# `. c% ?2 t2 N5 I% m6 i  00401067:  push      00402025    ; \\.\SICE0 y+ s* z# N0 O' F
  0040106C:  call      CreateFileA6 o# o& k0 i' x4 ^( G, d
  00401071:  cmp       eax,-001
2 J8 b7 f) z$ C, |# W  00401074:  je        00401091
8 M7 H( ]& O3 n: \$ }% @' p6 {7 G6 x7 _' b0 v1 u
' P9 j8 z* w! K/ p$ Y
There could be hundreds of BPX you could use to detect this trick.
: |. L3 S% `) \# j: e2 |-The most classical one is:
5 E$ o8 h! q- p* u0 S  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) m) _! E4 q3 U3 w
    *(esp-&gt;4+4)=='NTIC'
2 }0 x1 b- Q- s5 l; [3 ]! f
# ~: r! b/ C# E7 D3 u-The most exotic ones (could be very slooooow :-(
" t. c% q: g+ f3 O" V# R   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  - T, e3 b, a7 u
     ;will break 3 times :-(
3 v1 z- b# q; J& T! j5 L7 Z: y* s9 y. f
-or (a bit) faster:
( Q# ?: F- l& i% _/ k   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 U6 ^$ M' [6 b3 [; ^( X: ^! K$ y: H) `$ a$ H
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* O3 B8 Z6 R' z+ c. O* A     ;will break 3 times :-(' P6 k5 f: _) Q* k: V
7 ?( p, p' m$ p! r/ z7 T
-Much faster:& A* B( ?  S& x) g0 u* P) {' q2 h+ f
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. G1 J& O+ R9 [5 G/ s' w+ z6 W, G/ }* a
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
" M5 ?7 d; B8 ffunction to do the same job:
' a* |- x% w9 t6 _" L4 ]: b# J9 ]1 I( v; U& Z
   push    00                        ; OF_READ
7 F( [5 i0 Q7 R1 V   mov     eax,[00656634]            ; '\\.\SICE',0
" e" W# z( n! T! F0 S3 F   push    eax
  D, f2 ^  H% P( A* h   call    KERNEL32!_lopen
3 `1 A8 V. T' u9 Z7 K   inc     eax
0 M& T2 i  `9 n$ A; O5 Y0 U   jnz     00650589                  ; detected6 K% D( z; M$ X% s) s. x$ b
   push    00                        ; OF_READ0 @9 I' s( X4 c" K1 S
   mov     eax,[00656638]            ; '\\.\SICE'
  O" f- h7 j& ?+ Y) J6 L! E& y% q+ Q   push    eax
& o, ~; u  ^/ @1 X0 `, L   call    KERNEL32!_lopen& Z8 W3 ]3 R) D  o: }8 w
   inc     eax
$ ]# i! K% Y" z' G& }! j7 j   jz      006505ae                  ; not detected
2 J: g9 v2 ~* Y; H; K- e& P! M! J( M$ |6 V3 Y
, q: y' a- X  J( Y
__________________________________________________________________________
  t1 @8 o3 O2 @0 h$ D/ Z# u& A9 p( i/ v
Method 12& ]' X) ?( U0 z
=========' H0 f% y0 s& A0 I# F
# t* N% A# f$ M+ g  H
This trick is similar to int41h/4fh Debugger installation check (code 05% ^  ?+ L  _9 k4 {: R# u
&amp; 06) but very limited because it's only available for Win95/98 (not NT)* A8 U' W8 e4 T+ r6 y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
+ P% l. V; ]  ]* ~: ], q
$ M; F: m1 z1 l   push  0000004fh         ; function 4fh. u) I# L+ d3 V/ A0 I0 m6 B: J
   push  002a002ah         ; high word specifies which VxD (VWIN32)
3 g% m  W: W* M. ?0 a+ |: n; W. r                           ; low word specifies which service& i1 U- A6 @  y" y0 m/ ^  x" e
                             (VWIN32_Int41Dispatch). r) `( N" @% o) B8 c4 f9 p
   call  Kernel32!ORD_001  ; VxdCall6 I1 F7 {* l. ^  O9 q: x$ Q7 T2 @. f
   cmp   ax, 0f386h        ; magic number returned by system debuggers% @2 F- u1 W* X! L  r  `4 d8 l
   jz    SoftICE_detected; N* b$ e/ Y: R3 c' o/ b* }$ f* t

$ l" |" I8 u& \2 ]# w% f$ t8 _5 P$ BHere again, several ways to detect it:
5 p+ [" \  I5 h* B* z: f
$ p5 B# n* M+ q6 N3 _2 w" N# i    BPINT 41 if ax==4f; Z- c5 m! B2 a

3 k9 ^' m. v& ~    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& K% q3 E8 }% Z, D( Z

& D5 z& G2 D5 ]) j    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 H1 A" v+ a5 a( R# ^2 `9 {
! a7 t& @, u* [0 T. C# u
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 e' W; }' X0 V; z9 D7 ]
7 w: T* i3 P0 `6 N9 H; q__________________________________________________________________________4 i# d5 k  t$ m/ ~' {' t- A

( Y) ^) k9 Y1 l1 qMethod 13- C  O6 R' ]; G1 |0 b+ a  B
=========
8 Z+ J* d$ F! u& V
1 x; I% j3 ^# x$ iNot a real method of detection, but a good way to know if SoftICE is
, E4 x/ `) ?( h# }, finstalled on a computer and to locate its installation directory.9 Y. e! A5 G! n) Y3 c0 t
It is used by few softs which access the following registry keys (usually #2) :/ F$ [. l3 n" g! [2 d4 c

0 ^  {; y. f# I-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) a+ W% B  [  L* p
\Uninstall\SoftICE
) o7 c  [! F7 [-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
4 s' j3 S3 W# L" R- k5 p-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 G& D: I. ]0 b+ M% `5 H+ b
\App Paths\Loader32.Exe* O) X* V' Y6 ^* F9 E  c0 n+ {; M
# m8 c2 w. t5 G
5 Y7 k, W. ~$ W* G$ l
Note that some nasty apps could then erase all files from SoftICE directory
% H" P: b4 ^, d! Q& Z. |. j$ U% a(I faced that once :-(
( [1 E( D, R6 k& J/ `1 ^4 g- L$ n- R/ E$ F+ u* j
Useful breakpoint to detect it:
! f& K" Q2 Z/ H
' ^; X2 m' ]# \0 c     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; L' F) T% I- h4 y3 {6 }$ t
& V$ k+ l+ f, ]+ U/ E__________________________________________________________________________
, t* C& l. d# p" S) h* y$ t- s
; S; m. F- d& r
8 d; v( C' [/ A- M3 YMethod 14 3 J# `" d& ^0 W# a" ]$ O
=========
6 i7 J7 _; Y* G1 l8 @: K& P
, H9 }% A% X8 x( }A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 v. k0 c7 G: |9 |5 h: R8 Eis to determines whether a debugger is running on your system (ring0 only).! F3 [6 B+ M3 l9 ^9 ]$ F" k- M) ?6 }& R
- t3 p" ~1 |  U8 d% _5 V9 i, M& |8 r
   VMMCall Test_Debug_Installed3 q5 L. q$ n# h4 a, W7 |
   je      not_installed
+ o# U: T3 Y$ N2 j' X: m+ X' Y0 i" Z
This service just checks a flag.9 e8 o1 D$ V8 n: O! M* {
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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