About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
1 R) n2 `4 u$ P, W8 n7 Z<TBODY>( S( e# D1 [. p
<TR>
- b$ d# d. J( h& k<TD><PRE>Method 01 : E* Y. Y8 t6 q' b" h/ W/ V
=========
  Q+ P9 B3 \8 V3 e# A1 z4 G/ I, o1 ?# x! s5 _
This method of detection of SoftICE (as well as the following one) is
- J  C8 v$ H+ V. F* S( [used by the majority of packers/encryptors found on Internet.* D8 H8 p  T" S" f6 d, ^
It seeks the signature of BoundsChecker in SoftICE# n" o4 F" U8 L1 H/ M0 I% I- c

- L' P6 @: E* r$ Q) Q    mov     ebp, 04243484Bh        ; 'BCHK'
" b$ |3 @8 M6 n: X& l3 a    mov     ax, 04h) {+ p# j' p. e# a+ R" B7 w' o9 w; x
    int     3      
2 b3 _8 ~" a& l9 C    cmp     al,4
4 [3 D& r/ B4 M1 A& t. j. G. g0 S    jnz     SoftICE_Detected
: \8 ]' v/ q5 H- y9 D+ h4 e3 F9 B# j
& }& A% v6 E5 e, e7 \. K___________________________________________________________________________
8 H: Z3 ^6 g; i5 B% t
- C) e% U+ b5 ]. t) _4 JMethod 02
  I2 S2 w/ C* L4 `3 d3 z( m- t=========4 k* c$ }( ?; E  k1 J# d

+ v9 M; y# v4 {, _3 vStill a method very much used (perhaps the most frequent one).  It is used% m* E, r9 ^; C0 U* y4 w- V, Z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 g1 C' y0 n9 F2 c6 r
or execute SoftICE commands..." Z7 j& E2 e, \7 M1 {2 h
It is also used to crash SoftICE and to force it to execute any commands
: Y' F* D( K- A( B6 u/ G: W  }0 `(HBOOT...) :-((  
8 V1 b/ W1 l; a) p) A6 K8 p; r9 H7 P/ e% r, ~" @
Here is a quick description:
2 M% P8 L# V' r1 }: M-AX = 0910h   (Display string in SIce windows)
8 E  I; J' A- C0 [: h* c-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) a3 i* `6 ~3 P' t* m- X7 d
-AX = 0912h   (Get breakpoint infos)
6 n' b6 k/ r7 s( ~; j-AX = 0913h   (Set Sice breakpoints)
9 Z- [+ T$ L& r) z+ F6 h4 Z-AX = 0914h   (Remove SIce breakoints)
1 v5 D! V+ q% ]& q0 U6 N( q; [1 F' C
Each time you'll meet this trick, you'll see:5 w7 I! P) k; n: D
-SI = 4647h, ~, b: R% {9 V1 m
-DI = 4A4Dh" s& x" k" G3 |" G, o: F
Which are the 'magic values' used by SoftIce.
& P8 A. `' o; x: J/ ]4 n/ iFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! Y& m; D& h: m. s; S7 r
3 C; e, i+ I0 C( a" d; nHere is one example from the file "Haspinst.exe" which is the dongle HASP; P; A& t0 f! D2 S, y! o
Envelope utility use to protect DOS applications:
8 R# H- @" I. M5 i6 \+ D/ h' k" }- T; Z, O: z9 ~7 f+ g
3 `$ c$ c0 N" h7 t
4C19:0095   MOV    AX,0911  ; execute command.8 _9 _. H  @1 o. L2 ^* D/ |
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 C; L1 R( Q8 b8 C) J
4C19:009A   MOV    SI,4647  ; 1st magic value.1 x, ]3 z5 ~# h' x1 j# i1 r
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! q  P% `/ Z5 Z. Q
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' _3 g8 [6 {) L' w4 h0 d
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: ~8 ^& D7 X" F6 }. n* _7 u
4C19:00A4   INC    CX
6 E1 s8 G# p. i$ w+ a4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 r) G* O6 @  {/ ?. n9 ~0 K) k
4C19:00A8   JB     0095     ; 6 different commands.& g! A) D2 U2 Y  V! n; b
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 L: a  Y) z5 |
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% `$ ^% H3 {) m3 h* C5 n0 P9 x; C
/ h  h( Z9 w7 U$ z5 {The program will execute 6 different SIce commands located at ds:dx, which
4 T5 b: l, M, W9 @are: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ {! T, C% q, h3 e  d$ a
) n+ @2 D' O5 K3 g
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 g- D' T% X) t5 V7 j) n
___________________________________________________________________________
: f- }) \8 G! r. V  ~3 ], a8 A
0 G8 i+ G4 Q9 W4 F, {% m
' {5 f0 m- T3 N9 EMethod 03! N* t! K) Z/ \, Y
=========
8 v" `! @+ x# R, x# ~" f' G* v
' h& j& u4 j: eLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ a. |0 I7 O8 Y4 s
(API Get entry point)8 }+ k0 L, k! B- b* e5 I. i
        2 A: B, Q6 L. ]$ J. T/ E

3 A3 Y0 s& |0 }7 ], F9 M$ k    xor     di,di
* a. x7 q, G7 @+ X8 X1 H+ h    mov     es,di
: r$ ~5 `$ G, j. z. f9 V$ ]) B    mov     ax, 1684h       ' B) ]  \4 b& ?6 a$ O3 Y
    mov     bx, 0202h       ; VxD ID of winice
& d( q6 m$ i9 r4 Y9 @, f2 s    int     2Fh
0 v5 x" q! e4 E    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 i1 Z( l6 k* F" |7 O
    add     ax, di
0 h3 a: @; ]% v    test    ax,ax" T0 L, T, A; [5 Y
    jnz     SoftICE_Detected7 ]* r& ~* L+ l0 r* Y# u% f5 l

1 \  p  j: I3 T4 I) Y___________________________________________________________________________$ j) h1 q$ {& [& V; _5 C  X8 d
  q1 t0 j- N( }, m
Method 043 l/ Q8 W6 \3 @: Y
=========
  k3 m7 g) z2 R% H0 S; E$ ]& |3 F9 h4 c* F
Method identical to the preceding one except that it seeks the ID of SoftICE
- m5 u$ Q* [5 `3 O" G% ?- f2 s4 xGFX VxD.& G' w3 I( U. K7 e+ v- p; T5 n
& P, G/ }: D; C9 o. O. g
    xor     di,di
5 p! w) L2 U% i5 ^+ R) s    mov     es,di
& w5 `; [( [1 [: |5 A/ P: |" d    mov     ax, 1684h      
/ g/ i9 L, J" X, i. f8 ]    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* {5 C2 M4 {3 U    int     2fh
: m+ V  p/ N1 l' i6 R' j' u    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 {) D. h  ]9 N% F1 s: X" a7 P    add     ax, di
) Y( `& F4 c$ F0 N+ k+ x( e) T2 |    test    ax,ax
7 g+ [/ I! o, I; ?7 e5 c! B9 m    jnz     SoftICE_Detected
) v$ u8 V+ h, j' Z" A
6 x1 T4 B5 |+ R__________________________________________________________________________
, t& w# v( }+ C" G( B! O
  n/ E& H2 s7 {" F) k* y
/ `; V2 S4 V2 `" J/ Q! G0 KMethod 05
5 }5 `' Y/ o9 U=========
0 ~0 V, i+ V0 ?
/ a6 @3 u' L# o3 [9 y8 o4 iMethod seeking the 'magic number' 0F386h returned (in ax) by all system  m5 _7 X6 ?2 o" U0 `6 B
debugger. It calls the int 41h, function 4Fh.
# v' u0 W- P' H1 I! AThere are several alternatives.  , s! j' [" N2 [( h+ K& w
. M5 [* G% a5 V! o8 B, G
The following one is the simplest:7 h  u6 Z( u' I# R2 v

7 U# J! v; p( `- C" @9 p" ^: J# ]9 a    mov     ax,4fh1 U. I, ]* V% C9 \
    int     41h
7 g) H  N5 {: H) x- \6 d! j    cmp     ax, 0F386" E3 ]" ~: I+ F! Q# F8 w8 F* ]9 j
    jz      SoftICE_detected
8 P2 d- {* y8 ^4 u
: }7 e8 o! C  N& D: V& C* u# t& \" u2 k: B/ }7 K. X  @
Next method as well as the following one are 2 examples from Stone's
6 Z- U7 Z5 X) d3 |$ t"stn-wid.zip" (www.cracking.net):
/ L6 r' D; A5 i, H5 Y. w+ Y8 `
; M4 ]8 `0 m5 k- ^2 e4 |$ A% D    mov     bx, cs: ^" D0 g/ U1 d* x3 O  h
    lea     dx, int41handler2
8 e! I5 ]* Y( U- P1 D  _" W    xchg    dx, es:[41h*4]
% i7 f, `9 v- V    xchg    bx, es:[41h*4+2]
" N9 M9 C+ p# p0 ?+ l    mov     ax,4fh
+ b6 B7 m- Z( a9 b% L6 S/ i6 x: [8 ^    int     41h( _# o& L5 {$ Y
    xchg    dx, es:[41h*4]' E5 N" |; p, V
    xchg    bx, es:[41h*4+2]& r# v/ ?- `' g# P+ J# `
    cmp     ax, 0f386h! J" S& c) v4 }: `5 ?
    jz      SoftICE_detected9 z( U7 `: K3 I% B/ @
( a5 r: n% x: x& n
int41handler2 PROC5 A$ w! J* V" T& U; b% r! Z5 N
    iret
5 K7 X* r! P8 z# ^( b$ hint41handler2 ENDP
6 L) n) D& Y3 \- q- n0 x
% G! z9 |+ H9 }( t2 ?
# }, R2 A, c$ R  j* x% c_________________________________________________________________________; Q9 T2 }6 K3 p
7 H) L9 z% ~; u  d8 p

* @8 Z* r( k6 cMethod 06, g. V; N' B9 i% \- a' }  V0 b* E
=========
3 l4 t  X; \3 Y! b9 \, J4 T5 [4 [) m8 _6 R$ M
6 _% t1 W1 C' r3 U# i
2nd method similar to the preceding one but more difficult to detect:
  `( O, y1 R- q& D6 F) ?
  e8 s& v% B8 v" q" F4 ~( n& L, U/ F; l5 H0 f, p& l5 H9 j  O, `
int41handler PROC
# r9 k/ j4 G8 g    mov     cl,al- [( u/ F3 x9 }9 ?$ R: t
    iret3 E1 F1 Y' p$ `, g: y. s
int41handler ENDP
" e7 H* @' B, r5 p! [5 o! l5 i
- [, p4 I4 R7 @& P! c, N& o' G$ K' |( V' q
    xor     ax,ax
7 U) c# B+ [  ^  T1 X$ l    mov     es,ax; E6 Q. Y- w# C, F  N8 _
    mov     bx, cs
) q( }3 ^  s! _3 I/ J    lea     dx, int41handler7 t" z7 z. x  K* }
    xchg    dx, es:[41h*4]) j( R4 o7 |! j5 H" L1 Q' w& O( |
    xchg    bx, es:[41h*4+2]% ?8 m6 Z# p0 p( y% D% e1 A! @
    in      al, 40h9 y3 x4 [3 O* }7 U# @
    xor     cx,cx6 \/ U: x+ I: K4 V; H# t4 [' y
    int     41h
! f$ a, ]2 ~& D' v    xchg    dx, es:[41h*4], x( ~6 q5 J' o' j* i4 T1 W
    xchg    bx, es:[41h*4+2]; X% r9 ?0 {/ t2 ?: K
    cmp     cl,al
% e, B+ U6 i/ r( l1 W8 J/ H    jnz     SoftICE_detected
6 O% ~+ |; u6 e$ ?# L1 k7 L7 o/ w' G" `
_________________________________________________________________________
2 L1 m. P6 [7 o% I! d1 n
3 p4 G- S. q. o+ e8 n+ JMethod 07' s! I+ x: M' ]: p: d* A! N
=========' W, x( D( I0 F! D( g- Z5 J
) `$ o! M4 n9 x5 V
Method of detection of the WinICE handler in the int68h (V86)
/ F: w# J0 G4 c- q/ v$ @* `3 r0 B2 B5 `
    mov     ah,43h6 s+ y9 i4 _& r0 m! D+ g# S9 p, A
    int     68h6 g9 N3 g# B8 q, z" s3 o
    cmp     ax,0F386h
! [- {: m# u4 ^; Y3 |" C    jz      SoftICE_Detected: c2 C# Y6 O( h/ m, V' A; z

' @0 F3 ]4 ?* s  K: a7 ^! M5 U5 w3 V8 U1 z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 l, R. i% j" s, v& Q   app like this:# d9 q% @" d% P' \+ I
: F: }: l! j: m. O& N) J# g: X
   BPX exec_int if ax==68
5 i1 R. O% z2 z+ O, Z   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ ^# l6 Q% e6 k1 x   located at [ebp+48h] for 32Bit apps)- h) D' V. W* `- F& s* r/ W
__________________________________________________________________________# x% {! X# n7 h2 m
' P  }  [& `$ F7 k

/ |& U4 ~6 j- W! v7 {) G5 `. |7 uMethod 08
) r! H6 u# z% B6 h& P! r% J" A=========
; ^' x7 J* D2 g! x: y" ^) ?% F. c2 B  q1 E8 S, \
It is not a method of detection of SoftICE but a possibility to crash the
6 K* n1 S! Z- e, {6 M4 m0 ssystem by intercepting int 01h and int 03h and redirecting them to another
% A' N5 w- n, F+ D3 H8 z! {( w2 jroutine.' ~: t; v/ |9 j
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; S! _. b% c" v) Sto the new routine to execute (hangs computer...)
; W/ ?3 H5 @& M6 v( l. R
  w0 t8 `0 t' [4 U    mov     ah, 25h% V9 q) y4 B: p9 \) }$ k9 R
    mov     al, Int_Number (01h or 03h)2 Y) ?! @6 v& o( g: M9 Z* z4 M
    mov     dx, offset New_Int_Routine
: d7 [# h& T& s: H& _  R5 k5 C0 R    int     21h4 x4 n' v1 n0 l# ]1 R* m* ?4 x

- g  f7 W) e7 j9 {$ ?" I& D# H__________________________________________________________________________* c: ~# J" Z% x. K2 E- a, o6 }' d/ }9 f# p

) p/ M% u% K! H" ~# b% o0 zMethod 09
2 O7 ^3 H4 M, s' {* r4 S" U=========9 c# `" x4 c( F7 a
) q% Q. s) j& r' L3 I5 A) w7 q
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( A, }2 H8 I- ^/ @
performed in ring0 (VxD or a ring3 app using the VxdCall).
+ S0 j* {5 K) I2 C: z+ F" L* KThe Get_DDB service is used to determine whether or not a VxD is installed- S. Z5 `* `! t* Z$ m# x: c. h, ]
for the specified device and returns a Device Description Block (in ecx) for% u4 H1 d0 g; M: X9 f2 Z! p8 p
that device if it is installed.
' }9 V( }/ J3 _  g% E
/ A6 A- R/ Q$ B   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- |( q& K, a( |" |+ u# V: G2 ~   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)( p. _6 T8 u* ^5 m; M  T0 V* x
   VMMCall Get_DDB1 t6 X+ Q: l1 A1 z7 f4 ~7 q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, Y0 H0 L! A9 J3 m
. e* t  _: e8 j/ {. ENote as well that you can easily detect this method with SoftICE:- g; }# f4 C5 k# n+ M% b! N
   bpx Get_DDB if ax==0202 || ax==7a5fh
$ ]3 U/ n* S0 F* O9 m2 m% E" V
: S* u- F2 P. z- h5 ?* S__________________________________________________________________________! z2 k; }3 ~; i1 }3 h

7 [3 v3 v& [2 K* I: a  L1 GMethod 10; c4 o  F6 [4 a0 D  B+ r& k0 A
=========0 I7 T% y5 ~$ c

# w8 Z6 R) r% ~9 K" ^=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with& W% C& T2 }* e$ C9 }1 s) }% K$ Q
  SoftICE while the option is enable!!3 g, o5 P+ [  @) A. B
, Y& V; A( l, ~1 Q/ E* f2 c. P& O, I
This trick is very efficient:
+ y5 t' x  z+ x& H# Dby checking the Debug Registers, you can detect if SoftICE is loaded
3 X- y- s/ U" e) C(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if7 H4 m# D+ ?# m3 h2 N& L2 U- z/ ?
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" ?! Y% E' Q& c' m5 ^- wvalue (in ring0 only). Values can be manipulated and or changed as well* F+ {. [; M+ W
(clearing BPMs for instance)
- S& {& Z( C& ^4 s9 p, N; j3 V$ |  k8 C1 x; u
__________________________________________________________________________0 w5 r8 ]) ]% M/ a9 |  t" |

* Y4 O! x( t( ]9 XMethod 119 b0 J( a3 O3 ^- M; j
=========8 w; `% b4 s5 t$ _, U

# l% a( V0 ^: f  F8 @, o" |* LThis method is most known as 'MeltICE' because it has been freely distributed
& R; z* o' H) ^' D) yvia www.winfiles.com. However it was first used by NuMega people to allow
& J0 I3 j+ F% F( D8 w" E* _- k/ GSymbol Loader to check if SoftICE was active or not (the code is located
4 ]" M3 v+ `. K+ _+ M0 q5 d6 jinside nmtrans.dll).4 q! n% _* ^7 |! w7 O

+ [, N% }' D( R( C2 OThe way it works is very simple:
" C' E0 {; x* K7 I  l+ gIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) Y. }) F5 s. z/ I' a* `
WinNT) with the CreateFileA API.+ i) S" B! \" t, h# c1 Q
. i, r9 i( s. }) x- J
Here is a sample (checking for 'SICE'):( Y- x$ E! g1 l4 x. C
' d- n6 M  l+ X& f, _
BOOL IsSoftIce95Loaded()9 U3 h$ {9 k% u4 e$ M6 f5 `
{* w: H0 q1 h+ ^* v
   HANDLE hFile;  # ~+ W0 m6 ]6 s. m0 K3 P7 A
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
3 ?' Z& r$ ~! n0 ?. O                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% [0 U' ^& ?- E# j' ]                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8 C4 {. s, Q) w0 p8 Q. H- }   if( hFile != INVALID_HANDLE_VALUE )8 ?8 U$ J% l. ~/ s9 N' C
   {" l9 q. ?3 z) Z" \4 J; A0 C
      CloseHandle(hFile);' ^/ I- r' S: g& w0 q
      return TRUE;
6 g- N% j9 G/ G* [% n: L7 W# b   }) T, l' a* h2 h6 E) l, z( j+ i
   return FALSE;
$ {: Q5 {# h1 C3 w}
* e, N- w, ]4 o( S/ M, a% R2 c% n) @+ ]
Although this trick calls the CreateFileA function, don't even expect to be
' t; W$ J: ~3 a9 M7 Fable to intercept it by installing a IFS hook: it will not work, no way!
9 |8 e( h4 i$ z2 B: ]/ {In fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 ^& g) X0 R) I' _4 H: |1 eservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 V% ?6 @0 q# g" e3 F# k
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 U2 k, o5 B& _& _3 k0 q! l7 vfield./ Q, d+ ~: o3 i; q' U4 x
In fact, its purpose is not to load/unload VxDs but only to send a
; d( H9 x+ h) qW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
$ C6 ]) c6 f1 xto the VxD Control_Dispatch proc (how the hell a shareware soft could try
$ r+ l, o/ D3 M2 Nto load/unload a non-dynamically loadable driver such as SoftICE ;-).* \5 q# a/ ~( b5 R/ n
If the VxD is loaded, it will always clear eax and the Carry flag to allow* a- S& V$ \. U2 |* g6 V5 h( U
its handle to be opened and then, will be detected.$ D9 z" k9 x: X' J
You can check that simply by hooking Winice.exe control proc entry point
! Q$ Z8 j' x" t6 [5 Uwhile running MeltICE.
6 n* ~. E' H: p8 C' d
; e+ B! k: F( {8 o2 {
- [, G" ]( `" v  00401067:  push      00402025    ; \\.\SICE% P0 V- s5 T# {
  0040106C:  call      CreateFileA
  I& G; `$ v- K% J  00401071:  cmp       eax,-0018 a" M7 p# m6 x! Q
  00401074:  je        00401091% f0 f% C1 e* }5 s1 |. F
, r2 A- o2 _8 O: s( P( u# M
- D% d% d7 |5 h! F( ?: _
There could be hundreds of BPX you could use to detect this trick.
0 j. L) H% H- f' v" I-The most classical one is:
9 z, E; M3 L/ f1 e" J  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||% Q: {+ W+ W. J) l4 w3 }& H# q
    *(esp-&gt;4+4)=='NTIC'+ z- Q6 p$ z6 i( H* X
5 y8 z; H) E7 K) t& Q
-The most exotic ones (could be very slooooow :-(# B  R. ?) ^% C5 S1 r8 f
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( ^' `8 ]; Q3 I! S" }) D% T8 J     ;will break 3 times :-(# o3 I% Y2 _; e9 n! I+ s

# i+ P& m+ o9 B! H3 m, n' f" F+ p-or (a bit) faster: * P' A0 O/ Q7 a& w9 I6 G7 p* F
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
% k! D0 B* S9 |! L! H
6 t; T9 n: ]6 n. e   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  " V) n2 b1 l' l& y$ C8 z6 \/ |4 z; N
     ;will break 3 times :-(7 q8 V& c( O1 S  a

7 l( k7 e; J7 v0 j2 U+ m1 M-Much faster:; `% f% b3 U, t5 M! W1 f  a) J2 d
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'8 m3 \( A  Y- N$ C8 h

4 u! a! _+ R4 a$ uNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
0 v* Z; i  i' }9 @3 W# Dfunction to do the same job:
. v+ E4 u+ ~( P- E8 l5 q! E5 u- D1 u, N4 F( p
   push    00                        ; OF_READ- o  U) D: n4 o$ U' L) i
   mov     eax,[00656634]            ; '\\.\SICE',0
) V" h  y0 c# u2 t: k   push    eax1 V) }$ V5 N: ?$ z3 M
   call    KERNEL32!_lopen
7 a* G4 I7 x9 g( k3 A' W   inc     eax7 f6 P" S: `: f% {6 |% S
   jnz     00650589                  ; detected: a5 H( o# E% i, ?0 M/ @
   push    00                        ; OF_READ
6 s. K; j2 q! V; Y! {* e   mov     eax,[00656638]            ; '\\.\SICE'$ z4 _# I6 `3 d4 W$ }  a" q
   push    eax+ d: j/ L1 e8 t. ?
   call    KERNEL32!_lopen
- z6 y: S# r6 b. Z$ u9 u1 z& \   inc     eax
# U' ~6 R8 G1 q+ [* i   jz      006505ae                  ; not detected% O2 D0 z" O  J4 V
) `5 H1 q5 \9 n4 f2 v- T/ ]
$ w) {; Y4 Q) v1 q, w& Z
__________________________________________________________________________
9 K0 ^% T$ x1 \- V, W
, t/ V5 C( Q+ ~8 C% iMethod 12
4 c# D7 J2 i7 L* A0 w=========
$ m% t6 H9 J; H, q4 g' q' Z4 \; h. q; m
This trick is similar to int41h/4fh Debugger installation check (code 058 w8 O6 O5 N8 ~/ z- F3 s! o
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( c7 u# \* j* A6 {( f# |% kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- L. ^0 B3 y( t7 U6 a
9 B6 ~9 o7 u- d   push  0000004fh         ; function 4fh
  `* ]0 R9 S! @( G   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 B2 K! i/ e4 _3 ]/ ^                           ; low word specifies which service
" r+ Z; K# G; i8 t; W                             (VWIN32_Int41Dispatch)
6 P* W! l* x! |1 s; T   call  Kernel32!ORD_001  ; VxdCall
& D/ z3 m$ r* w/ |, \   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 U7 @" x! o& C- X! [   jz    SoftICE_detected" o$ Q" e6 c/ p) y$ H: p: ?

8 i' t  V% T' q0 ~1 qHere again, several ways to detect it:* l: ^1 U- N' i8 ]. J. T+ _4 F

' G9 m0 w% S4 C    BPINT 41 if ax==4f
& D0 B- d/ G3 J1 M4 n9 e4 e. }2 \$ {- O/ p
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' f8 D; A1 p/ e# i6 f
# i( f: O: L* e. h
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ y( V4 V: \# Y( A. E: E+ J; M
; i3 d! I+ B8 Y; P: T' Q) q    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) K9 I/ U2 M- ~/ X% |) ]
. `* R% R1 j& H1 w$ w& A9 a
__________________________________________________________________________$ J3 _  |. ]1 ]8 N, n
3 q! g  i% i6 {6 N7 k
Method 13
" ~. ]3 l. }% [' ~=========
" f3 b, s0 a! u+ k. {- ]' f  A9 H- d( M. i5 Z$ r
Not a real method of detection, but a good way to know if SoftICE is" M  h  @  u, p. g% s: b
installed on a computer and to locate its installation directory.
' J; ]" L2 G) y, D0 O9 i6 LIt is used by few softs which access the following registry keys (usually #2) :
+ f. U7 a6 ?7 t- U3 P7 |: {$ a# G( X& l5 u5 n2 E% V! l, H- D/ T* n
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: z; s3 h! F' s$ @, ?2 b% r3 F$ ^
\Uninstall\SoftICE; b5 d1 f. @4 ?9 L) n# R# @+ G' B
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
) z/ ]# c3 j: W8 L8 @-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  m; q% `. L5 i7 e. _4 u8 Y
\App Paths\Loader32.Exe
( |: Q% O1 V# n/ y0 s2 p/ T) |) q: o: c
$ j, I  d0 ~& ]7 S( X
Note that some nasty apps could then erase all files from SoftICE directory% [/ Q6 W% L! v) P. k! N
(I faced that once :-(* l  ]* \/ J1 c2 @; X

/ ?6 o! S' v: K0 p  ?& g0 ^Useful breakpoint to detect it:
# h+ f! c% C! z, P, W7 `% a. }% ]  s/ d6 l# B0 y
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# ]; b5 n" a5 x% {% C- V, d, x- o, i. v, T3 S5 @9 z
__________________________________________________________________________
# L! T$ j: y; r& S) {. S2 ]8 `. ~' Z4 u2 X% C4 A7 o

3 R8 s6 J9 `; b% V7 q, q% jMethod 14
1 n8 v1 U4 c; P=========: a- u" q4 N' C4 W* a
7 x+ E& h3 J% Q5 U
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  A% E$ {6 X# b0 u* ~$ zis to determines whether a debugger is running on your system (ring0 only).
+ |) Q5 ]8 c1 N% Y0 b1 c( o$ G0 b. M2 H+ R/ D5 r
   VMMCall Test_Debug_Installed
& i+ M* M0 H9 ^' \: p   je      not_installed, K6 M; l! d. c6 I6 l% E/ o

. i7 R+ p. m$ V* U' f+ Z* j! W  HThis service just checks a flag.
. v, a/ H0 k5 g! C- I% ~1 J; o</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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