About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>1 K8 Y* p* R! X8 V. v* ^
<TBODY>0 @. a- t) |6 M, G3 M' T! T$ H4 u
<TR>
/ H1 ?* f: g1 |# S3 Z<TD><PRE>Method 01
! T" G  M( g5 H) E4 e=========
: Z8 ^, ~) e! \9 @: M/ K% U- O
6 `/ z4 _* d) ^  l7 H3 H5 eThis method of detection of SoftICE (as well as the following one) is; x9 U# ?5 R/ A3 s) N
used by the majority of packers/encryptors found on Internet.- U" q4 R, Y; t2 G! w; D+ b6 M) g
It seeks the signature of BoundsChecker in SoftICE! k/ F' E3 D' n; t" r2 ?7 n
1 x" V6 F' Z# Y9 x' b# L
    mov     ebp, 04243484Bh        ; 'BCHK'( L' s: |+ z1 k" D
    mov     ax, 04h. R" W) |8 L+ U6 a+ t5 _
    int     3      
  j% G  z. `! N# }! ?    cmp     al,4! T5 w. |" e7 f2 J! s& b
    jnz     SoftICE_Detected, ~! n( f# j- Z5 |6 M/ M
8 B/ l0 y& }* U
___________________________________________________________________________
: m7 z2 W0 E( C! B0 Y, b# V
2 h# Z! F' w. D* v; X) FMethod 028 w1 K3 t  Y! j5 K3 Y
=========
, x+ g! E" @: B/ u( m8 b, r# M8 F0 k# b* B- W5 K
Still a method very much used (perhaps the most frequent one).  It is used
2 y! `) ?1 w$ z$ nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 t4 s5 o0 d, k0 O# [5 N# p) a& q: }) ?or execute SoftICE commands...
0 B. Z# i. l1 L7 u0 v. pIt is also used to crash SoftICE and to force it to execute any commands
" ^3 I( i1 U: Y' w1 I(HBOOT...) :-((  - }* I! {, ^8 Z; w

8 s% j  B% C% ], j8 Q- fHere is a quick description:! @; B9 ^6 L% o
-AX = 0910h   (Display string in SIce windows)
1 z' n9 V. D3 w-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- u/ `2 X7 N: x-AX = 0912h   (Get breakpoint infos)
+ H; L3 e1 O9 r6 ~- P-AX = 0913h   (Set Sice breakpoints): O( i" H) j5 z  c) B* x
-AX = 0914h   (Remove SIce breakoints)
% x; l" Y' O8 G/ S8 O8 X; o: \6 ^: R- u- x6 A' j5 y
Each time you'll meet this trick, you'll see:
% D$ E+ \: q4 n! y& A9 E, q-SI = 4647h; l+ h9 q" E9 P: K7 Q% K
-DI = 4A4Dh/ l5 Q% N4 `% q# L% R
Which are the 'magic values' used by SoftIce.
( r7 _' K: D- W( h6 {; c8 BFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.- L) V3 c) V9 v3 w  d
: N* T* b% h7 @/ L
Here is one example from the file "Haspinst.exe" which is the dongle HASP& k. K& d9 u$ Z9 Z: l# ]5 s
Envelope utility use to protect DOS applications:) _4 y' F4 o. d5 `: a3 ]

5 \  q% m" W) z7 E* ~) E  Q! K1 p) l
4C19:0095   MOV    AX,0911  ; execute command.
% D# w  a* |5 D1 {! {1 W; A, D: `% ?# N4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- v0 v" \" A* p/ b( U9 L
4C19:009A   MOV    SI,4647  ; 1st magic value.# G4 d. [* T- ~
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ j) _, k! Q& |2 I) z4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
/ o. g4 X9 Q# i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
) s, V0 ]8 v! m) M+ R4 C4C19:00A4   INC    CX
% ?% l6 H5 B5 C* u' |4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute1 Z: _8 b. `& j0 O' Z- B+ B
4C19:00A8   JB     0095     ; 6 different commands.3 }9 f! h; G- e( K7 c. d
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
& G$ H" K, h9 B4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)( x3 U7 H" W% M$ G
. V. ]+ a9 d* ~! Q
The program will execute 6 different SIce commands located at ds:dx, which# H! I% s' N/ Y1 l0 P, r$ c# p4 _
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 }: D5 b" i+ k% O( ?
% }0 P( a" g0 ~/ F& {4 z
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 }- `0 q5 g2 I6 s) a5 }
___________________________________________________________________________* }& M* C; c, b
6 Z  [! W# P9 [" x/ R
# V; K, }; B5 K
Method 035 E6 n5 l* C2 C6 M$ z2 i
=========
# y$ Z6 @, R  k+ W3 r3 U8 S  ], M/ E1 a/ s/ P
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ L, i. i$ h/ H1 |. j6 J
(API Get entry point), b1 N, E; g5 J' H% U
        
8 i; T5 e) l' y; c6 S3 y3 D! r. N+ w9 W8 d- }% a2 M* _
    xor     di,di
* w& F3 F2 F' H    mov     es,di
' U; b% _' k9 ~2 r, q' n    mov     ax, 1684h       : A. S2 F+ r. ]2 v, w, h
    mov     bx, 0202h       ; VxD ID of winice
* p, T  [; U, k( Q' {/ K    int     2Fh$ L5 S7 d3 {, w1 n& r. z! v
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  d  q9 R: N  ^2 d
    add     ax, di8 ^- E( D/ u# ~' Q6 K9 b
    test    ax,ax
% E9 ?1 s$ P: w8 R8 ^    jnz     SoftICE_Detected4 }* d" C$ k+ L- I& s! u9 B0 |+ ~; R

( S$ a, C( e8 U  w% i. o___________________________________________________________________________
# ^  d$ D- ?, d; U" ?5 c0 o# i- F
Method 04
. @+ C! @$ ?: T0 u4 n=========
' D: M+ o. O3 |" I, L  ], e
. a1 r+ W, ?& n; a* K( \Method identical to the preceding one except that it seeks the ID of SoftICE
- S: K0 h3 u5 U8 W) e$ k) n* H: @GFX VxD.- Y8 w9 n9 }  _* V

! Q$ M) }, M6 F8 C    xor     di,di
" B( C2 [0 s1 o    mov     es,di
8 W* h0 y8 `/ n9 i- U    mov     ax, 1684h      
# C9 g. I! d+ d& K( l9 ~    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( |2 {8 j; x' ?, p# S    int     2fh, J3 V: ~3 k! [3 q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 i' h+ B# r5 b' P% |3 R2 R    add     ax, di7 i1 u3 [7 N) m
    test    ax,ax1 I7 D7 ]0 |( A
    jnz     SoftICE_Detected
4 \. d! Y  v0 g/ K7 v
, [; c" y1 ^9 k* l& R# U$ v; @__________________________________________________________________________
7 v* {5 V0 n0 q. a& L2 D9 D& Z  R1 N& s$ X. U

  i% p4 |0 a: h  v# aMethod 05
6 w# {* l* t& }+ v( z5 J6 X1 E  l=========+ `8 q# w/ U. N$ o( Y+ z# i) e

2 q1 a- h# r, K( \  ?. D4 A$ u9 |Method seeking the 'magic number' 0F386h returned (in ax) by all system6 H1 H. M: \% H- @
debugger. It calls the int 41h, function 4Fh./ W" q0 s5 g3 D3 o6 k
There are several alternatives.  
3 X  d6 n# M7 G3 b  I* @) ?$ u
9 ^3 |; N, E2 R1 P  r: ?The following one is the simplest:, Z  [1 o) n( C; p+ H

& U9 I  L) s$ p    mov     ax,4fh
/ X6 i/ e0 C1 L+ S    int     41h
' ^( Q9 ^' A/ L  S    cmp     ax, 0F386: s; N1 ]  Y$ r& P- X
    jz      SoftICE_detected
  y% R. B& V' z" L- S5 p* `
. A/ }1 r$ i1 \" K) q1 _/ o" v6 u/ D) f
Next method as well as the following one are 2 examples from Stone's
0 s4 h3 j, n! o# R5 w' B2 a6 p) r"stn-wid.zip" (www.cracking.net):  C+ w2 R! l) n# J- H- {

% Z' @2 w, s) S- q5 @: u" K% c7 `    mov     bx, cs
6 a* o+ s% Q( s* u    lea     dx, int41handler2
* d% k0 L  s$ Q* b8 j: |" p& r/ U5 i3 I    xchg    dx, es:[41h*4]
# {4 ?# W$ M; \$ y0 S. ?. c" p% V/ J    xchg    bx, es:[41h*4+2]3 \- i2 i. Z: ~& d$ W: Q6 }
    mov     ax,4fh
$ G3 i9 T$ x& @8 J    int     41h
+ I" L: o) S; i  o% ?, F+ b    xchg    dx, es:[41h*4]5 F5 C1 V. Q0 q! J1 N1 Q' G: M! u
    xchg    bx, es:[41h*4+2]
9 p& ]  B+ z. ]# J! X& N    cmp     ax, 0f386h
8 B3 c) |  h1 |+ @9 d% Q    jz      SoftICE_detected
0 w, t* x* q+ G! R# ^2 j; P! w. l, {' R& ~
int41handler2 PROC
' S( |; B( I- T) ]9 h    iret
* |3 _  Q+ T7 y! t9 j$ j+ g  ~int41handler2 ENDP
8 t, y$ [/ m4 M6 u* i; ?3 y( t
& d9 S: z4 ~; y3 c
: W6 D  u; q9 t! C_________________________________________________________________________
2 F! _  T$ ^, Q3 B( D
0 x' t/ ^" g* I7 q3 F9 L8 s! H9 \- l/ _0 N$ f
Method 063 R/ u! W) S; U! V0 V! t4 v/ O( v
=========: o) L1 w7 g6 m% |6 \

" u" C3 F6 C* ^+ S% ?/ e0 F
, s* j8 f$ C  X& ~8 k6 M8 N  I2 d2nd method similar to the preceding one but more difficult to detect:
" M* ^  v  R( _# [: }# p
1 H8 S4 c9 F8 ]; k& D
6 a' `9 ^% b. t4 q' Wint41handler PROC
( ^! ~1 G6 u4 q    mov     cl,al/ e$ m( r: A# ^! \7 R! [% }9 B
    iret/ e* I) l% T% s# R4 ^+ Q
int41handler ENDP
) `4 U6 H7 k6 N% O9 N
7 i2 Z  D0 o2 Q( e; }- l7 ^5 z' O3 G  x% e( ^+ d/ a
    xor     ax,ax
' E: @7 f+ a7 }4 T4 M' h    mov     es,ax1 J& \4 Y( s. e0 |3 }& y! S
    mov     bx, cs" h3 f$ N- J& m* C9 ]
    lea     dx, int41handler# u% i! ~5 |/ W& v  I
    xchg    dx, es:[41h*4]/ s: h% ^1 R) S  b- V+ J
    xchg    bx, es:[41h*4+2]
! \( F0 v9 Y5 J/ D    in      al, 40h. t" ]1 T% G9 z+ y- n1 \% w
    xor     cx,cx+ ^( F( y9 g# P2 l+ ^/ y  n
    int     41h
* C; E. H5 e+ j0 g+ Q* @    xchg    dx, es:[41h*4]" B5 r8 r' r0 n. H. m7 O
    xchg    bx, es:[41h*4+2]
; V. p+ U4 d( }    cmp     cl,al& B" C! m: h$ ~! U/ \; G5 n
    jnz     SoftICE_detected) |4 ^# n! m' ], t
$ O9 o2 S3 b* S
_________________________________________________________________________
; ^( K0 T& y; A5 M* E: f
8 C0 _( K7 Y) J* U' K! O$ p  j+ j5 nMethod 07
& |* G9 _8 _1 X& |$ L  I) a4 l" v) J=========
! a5 i3 \4 U7 b
6 T. m& B. \# b" {Method of detection of the WinICE handler in the int68h (V86)) R" w+ y+ D) y. N2 h
5 G( C* V5 X; K9 d
    mov     ah,43h  X9 `0 Z$ \& V$ ]8 f3 f- W4 F$ y# R
    int     68h
' `( X. R6 L& q% T& Q* r    cmp     ax,0F386h
1 o6 D! l. z; i% ^% l    jz      SoftICE_Detected% g  ^7 m! W6 W; t( V
3 O  q) g" k) G$ R! u' D
/ M5 E( V% K, R( M
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( W7 m7 l5 x: C& ~1 Y  n( M5 i   app like this:5 g7 K4 u! I- A# t' X, c  F! Y8 V" ^
1 ?: g5 ]3 n8 s2 Y5 r  N& i
   BPX exec_int if ax==68
( _& l+ Z/ T0 Z   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 k. ]( W1 C$ y   located at [ebp+48h] for 32Bit apps)0 g1 p8 b/ @- a4 U# E0 `; O
__________________________________________________________________________
2 t. ^+ d4 l2 a) m# a3 {4 z  S3 E1 |6 M: K: [
7 J$ i& Z+ B! k) o6 j1 F& v7 r
Method 08* J, H4 b2 |! {1 C  u' w9 o( W
=========7 N/ u9 N  {/ o4 c6 W4 r3 k

5 f6 J# g* S9 KIt is not a method of detection of SoftICE but a possibility to crash the
8 j& [& d) C8 g% s8 Zsystem by intercepting int 01h and int 03h and redirecting them to another
" I' Y7 M' @+ ~9 }! Droutine.: ]5 `: @) b; |4 d4 N
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' P' V3 ?2 ~8 k3 C
to the new routine to execute (hangs computer...)
1 B% R( _  p% M  Y9 j- O3 @0 m
4 S& ?: @+ ^- D    mov     ah, 25h! W2 ~2 E5 T! L- w
    mov     al, Int_Number (01h or 03h)) v  {  P# f) M# c
    mov     dx, offset New_Int_Routine
, B  D$ C% N3 ?3 ]  F    int     21h
1 J! }+ n# z* a& x
' u  q' V! r- ^/ P5 U# O5 c__________________________________________________________________________, Y. w: {  v) z6 M3 W

9 t4 x7 b9 J1 Q4 d; H# X4 AMethod 09& t9 N% C( d' K/ o
=========
, U9 \! w* o- Q% R% T) [
& K' ]& M9 J  WThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
5 z, d) I6 Y7 h% {# O$ s: d- zperformed in ring0 (VxD or a ring3 app using the VxdCall).2 v# k4 ^; S( I+ n( g7 x1 ?
The Get_DDB service is used to determine whether or not a VxD is installed% A# |5 [8 p  W2 M
for the specified device and returns a Device Description Block (in ecx) for
( k5 A) o, `- T2 Y6 o. K( `- Qthat device if it is installed.
# ^1 Z! K' P* a5 Z) l" E2 m) P" b0 t: Y- M
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 `2 p/ a# L, S6 F8 j1 T  v9 i( N* p1 d   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), Y3 u2 \+ c+ `8 H0 [. @' ~! N3 R3 w6 E
   VMMCall Get_DDB8 z# T! o& W2 {3 E
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% c% I; _( y' Q1 K4 W0 T: R" B

- M4 F" n  S9 m2 [7 c: Q" K1 k( CNote as well that you can easily detect this method with SoftICE:
( Y5 h% U+ s$ w; U   bpx Get_DDB if ax==0202 || ax==7a5fh* `) h+ n' _/ W4 s/ W

; Q( y. i8 z' o9 G$ r__________________________________________________________________________& i% M# B# ?: T

, d4 Q1 Z9 C) _8 p1 L- dMethod 10  G. g& ?$ l5 n* P, _# g* d
=========7 M" S# T, G  T+ J) P

3 `& ^  N) o( Y- b8 K" V5 M=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. t2 E3 k5 d! n6 t1 s  SoftICE while the option is enable!!
: ^5 j) h# q" a# g+ d0 Y- N5 Q
3 H" S. y9 M4 M2 o6 }This trick is very efficient:- e$ v( o$ o0 ?; v6 v" {7 _
by checking the Debug Registers, you can detect if SoftICE is loaded7 Z# U2 ]! w9 M; l
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: Q6 A) ~; f1 B! b* J; mthere are some memory breakpoints set (dr0 to dr3) simply by reading their. D0 j( V0 O/ ^) A  K9 a
value (in ring0 only). Values can be manipulated and or changed as well, R1 h6 }" ^+ }  X
(clearing BPMs for instance)1 R1 ]" U3 W! G; J/ F) Y# c* n
8 f2 [* ~* r, e7 ^3 k$ |9 s
__________________________________________________________________________8 o9 d. o  {+ [; f* q
- F2 ], a: |) E6 `! o+ M- I% i( j
Method 11
8 E! T; Z9 @' ]3 o7 V* `7 _2 |: i=========9 B( G, n7 z5 _' U1 M
+ `2 w2 k; u4 c9 Q& `. P
This method is most known as 'MeltICE' because it has been freely distributed% l6 ^$ P3 J5 J4 `
via www.winfiles.com. However it was first used by NuMega people to allow  F. r5 a  _/ m1 R: G( u% O, b8 g1 \+ d
Symbol Loader to check if SoftICE was active or not (the code is located" z  [" k9 h$ O9 H; M2 x
inside nmtrans.dll).% Z; c  v' J4 Q* ]
2 {- f+ q0 W2 G$ V& \
The way it works is very simple:, w+ L$ a7 z9 H6 H/ N
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for, C& b0 k; c" O( u8 h! k
WinNT) with the CreateFileA API.' }( b# m# a( I; \$ U, F! f& z
, b4 S! `$ |- h. B- B1 t$ K; v* L
Here is a sample (checking for 'SICE'):; Y9 H) y0 H3 U8 w! o0 j
* a" N. K3 e8 E+ g0 t. P; q
BOOL IsSoftIce95Loaded()1 s) ^1 S( a& h' Q" `
{! k7 i% p; k3 D) O: T( e
   HANDLE hFile;  
4 ?# A0 |' W" b  T* z   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ E' M1 A1 Q* L8 {8 T( w4 E                      FILE_SHARE_READ | FILE_SHARE_WRITE,: a4 H2 A8 A. X  x' Y" z; I, K% [
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: [3 ^  U3 X. f; s   if( hFile != INVALID_HANDLE_VALUE )
% V6 Q' k# s. m' t- O9 Z) A   {1 m0 ]/ z! V4 h9 Z% |( h% j: z7 i
      CloseHandle(hFile);! S3 k; X) R1 D- h
      return TRUE;- n, o* s$ ^5 p& I/ B+ F
   }
6 M3 ?3 r  y( u& j  d5 y   return FALSE;
5 [, `. z, y* ^8 ]}
$ B6 b! L6 J: g. k; P$ D5 q+ a7 c5 Q! `- _, h( l) j
Although this trick calls the CreateFileA function, don't even expect to be
9 L, j+ p0 A' c+ x5 |  Kable to intercept it by installing a IFS hook: it will not work, no way!# w, i) Z' l0 I; X3 Q& B. e
In fact, after the call to CreateFileA it will get through VWIN32 0x001F- u  G7 C- N/ l6 b' c5 S
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 f* \! i3 \, b6 h  p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 @& I7 c% Q) F" Q5 X
field.
* [* X8 G: V) A$ MIn fact, its purpose is not to load/unload VxDs but only to send a ! o, S/ s8 Y) V3 h
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) ~2 U! D; n4 R+ @3 N. \/ u9 Oto the VxD Control_Dispatch proc (how the hell a shareware soft could try& }& ^" J. P( y- W* }2 c, ?9 H  Q( @
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
' C$ u0 ?& D$ S5 I! `- KIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 e( p3 t/ b7 X' mits handle to be opened and then, will be detected.: ]+ w  _5 y- Z# x1 v" i
You can check that simply by hooking Winice.exe control proc entry point
3 |, ^. G- l+ V2 ^$ L0 I5 a) I  D) }while running MeltICE.
1 a+ h! T9 I% k+ f
7 Y) K% v0 G7 O/ \% {
# S8 T  \  ?, e$ ?) X  00401067:  push      00402025    ; \\.\SICE
1 l+ W( t/ w8 L- ]  0040106C:  call      CreateFileA0 l0 n8 m6 ^  M
  00401071:  cmp       eax,-001+ S7 r1 s( T7 \0 n2 I" b
  00401074:  je        00401091
* G2 i  h8 P9 R, z1 o( a! j" Q
( q6 O+ I6 m; y  u5 j4 F: \/ i0 M8 |5 Y" f% R
There could be hundreds of BPX you could use to detect this trick.9 f7 [' O  t  w7 W# m
-The most classical one is:3 \5 E" T1 Y5 S  a% g7 p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ w7 X& w: i& S2 E- T    *(esp-&gt;4+4)=='NTIC', n8 U8 H  r2 I3 J2 ]; q

+ l$ ?' Q: ~) o-The most exotic ones (could be very slooooow :-(8 O) B' u9 S' y5 `2 K- W
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* u5 |9 V8 b0 ~" D0 }( o* d2 `* a     ;will break 3 times :-(
( Y4 ?9 e* m9 A- ?" n! x, Y6 y- O* P* R7 p5 e) |( Q2 S* m$ y- S
-or (a bit) faster:
& f5 }% B% k, [8 m# H9 O   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 M2 o+ s, Y4 F7 I* i( V
2 M. ?  O& z1 s& W6 X" @: E/ ~4 E   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  2 v: u+ x* p% P8 u
     ;will break 3 times :-(
% O5 K( P4 B! G$ c: L8 L( Q' V3 _% n: W! o! U! a" l) t" i
-Much faster:4 I& e0 d2 C: t. Y3 W( _. o! Y
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
3 V1 X% E/ a  ^! E  _7 [% K) q( }6 W
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen; P7 B% E" v# F) ~# H8 y+ e' ?
function to do the same job:
6 S/ ~$ w# q6 O  D* X& Y3 ]% l  y5 T& c5 |& M# x
   push    00                        ; OF_READ# ^8 d+ _* N" @+ ^* m/ O# y
   mov     eax,[00656634]            ; '\\.\SICE',0
5 r% D  y2 C0 q/ _   push    eax1 b( ?" {) j# W, m% j( C
   call    KERNEL32!_lopen
6 R4 D9 ~2 b, Q' ?& l: t4 R9 @   inc     eax
5 p. L! u$ P- ~, D; Y0 J# b   jnz     00650589                  ; detected
- g% D4 M$ s8 S# M6 Q5 Q% H   push    00                        ; OF_READ
7 ^% D. e1 i& f1 x) ^1 D$ }3 a# |6 c   mov     eax,[00656638]            ; '\\.\SICE'
6 n9 G3 w, }, Z! @7 U; e   push    eax1 v7 T* E: |$ p8 q7 }
   call    KERNEL32!_lopen5 |' m8 T( z% a) U4 f2 \( \; C
   inc     eax& J8 N+ F+ x* n. h) ~: l2 j, b$ K, O
   jz      006505ae                  ; not detected) }& G5 t- J+ j% Y7 k0 D
' _. d0 ]: w( E; K3 n! u4 t
3 ~0 D' Q! }: K* e
__________________________________________________________________________, s6 G# s4 x' N3 _1 c
# f6 \: a1 T6 m/ R4 K( q
Method 12) P1 ]) o" G* f1 ^, e5 @: V$ e# p
=========
, N' h/ o) N' @' C4 L8 t- {  B9 i( h# t+ A+ x7 t- k7 o
This trick is similar to int41h/4fh Debugger installation check (code 05( l+ L9 X' B* S) V* e
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ s4 T( q6 h4 R5 Fas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 d( A/ a. o0 H+ N6 x' N1 c! q( l
   push  0000004fh         ; function 4fh
8 T/ I6 I( F  S: i4 O  h+ w0 F$ c   push  002a002ah         ; high word specifies which VxD (VWIN32)- c2 l" G& E" i! t" T) r
                           ; low word specifies which service
5 i% ?8 u3 ^' d4 Q                             (VWIN32_Int41Dispatch)
4 P, N0 |- p0 ]+ n2 F, P" K- }   call  Kernel32!ORD_001  ; VxdCall
0 E% z* n3 Q  a   cmp   ax, 0f386h        ; magic number returned by system debuggers1 m0 G! u+ E4 m7 y' k# Q; \
   jz    SoftICE_detected
: h/ n0 m" U: C# @
; y5 `# H$ d2 M# \, q  ]Here again, several ways to detect it:
8 o6 ?% K' r# V) }# R1 j) x7 [+ @6 ^) N- h
    BPINT 41 if ax==4f8 B7 s* j$ I9 v4 H+ C, f

( g8 l% z; k2 U5 H7 _    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- b8 N8 o  i" K$ u# ~1 ], p

$ ^  l  j% o' @8 H. z/ q    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ H. p1 h$ e" Y3 e4 |( Y! h+ h' R8 ~2 ~  Y' Y
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- z7 e; f' \0 F; w" R! t0 n

# h$ v! X+ ?+ Q3 D( a; j__________________________________________________________________________  s& F/ Y1 g3 _1 W5 i
  A8 m' u& P6 \4 a, K& l, z2 c
Method 13# G- u" q8 J) ]- t0 x
=========0 Y4 m6 j: F1 ?
* o# I+ k5 |% [- ~' Y/ G
Not a real method of detection, but a good way to know if SoftICE is. g' y5 }6 A: a% s
installed on a computer and to locate its installation directory.6 u4 X4 @0 W1 C
It is used by few softs which access the following registry keys (usually #2) :+ o: t2 t; W5 v8 Y# i# M! Y% |9 F
- M5 A- `, \5 _6 j5 A4 }
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 h* ?# [# R' O- a) l5 j" m/ S: O\Uninstall\SoftICE
+ s7 ~. o7 H7 b6 D/ K' x" x-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 m' d. k& {9 u6 Q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 g7 q/ U! [4 ~\App Paths\Loader32.Exe+ {) I9 X$ h' m) T7 |. \0 U: u& U/ D) {

9 f+ K! G  ^0 p! s. E( B
5 W2 ?) L, W! o  v2 y; `2 I3 GNote that some nasty apps could then erase all files from SoftICE directory
  d6 B( N+ O- ?# T- Q(I faced that once :-(
. X" j0 c5 i% \
' t! o! @) L+ L) j+ `5 t9 yUseful breakpoint to detect it:0 S9 r. ^- P! M( O2 l# g  G. W

7 r3 f8 |0 [; \6 W  o* i     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! E9 b! B2 T/ V( O  ]" ~$ R  l& N
# ]' e0 L5 a7 M5 v; h% N: ]+ y1 o
__________________________________________________________________________
. M  Z# D* w! {- Q
1 l  e% l# I3 f* }+ T3 h
4 ^, L1 m7 _& V, q* Q& g0 FMethod 14 - |7 \! t% w. K  ]5 H
=========
, G) P0 Z7 e6 ~0 v* _$ H3 D7 S! t% G" B$ k+ k7 [) S8 \7 Z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose# S( u% Z) \6 B4 e
is to determines whether a debugger is running on your system (ring0 only).
6 m  W& V; \% [% [+ v6 s% y% \; q7 e  y4 D" j
   VMMCall Test_Debug_Installed5 O' f: C) u+ i: [
   je      not_installed4 U% F$ J0 D; q  u& f4 T
( _4 C$ c  X( S' C2 C
This service just checks a flag.5 b: u; R% [, {2 W  S; s9 e
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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