About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>$ b+ u- @% e0 B6 |6 c7 k
<TBODY>5 G) `3 u+ W5 f( n& B
<TR># U- V' i. ~9 r& B$ v7 n3 t
<TD><PRE>Method 01
+ L% ^5 H; d: f* Q& ]=========
0 a) w' C7 C& ?7 `+ f
7 r' f8 t# {% D  G, r4 ~This method of detection of SoftICE (as well as the following one) is
% X! Q1 U( _- A$ b: `$ d3 W' B% kused by the majority of packers/encryptors found on Internet.
9 E) ~+ ]5 p% R2 E1 p& {0 o! fIt seeks the signature of BoundsChecker in SoftICE
  m! ~8 Q8 B9 P% X9 h5 f4 m: I) I" M' w
    mov     ebp, 04243484Bh        ; 'BCHK'
! g/ _% \' s7 ?    mov     ax, 04h6 y6 G5 b* u5 g) y, _
    int     3       5 l5 x$ N" H! C$ u2 M- x
    cmp     al,4" W4 [8 k$ y" S: O3 U' Z. C) A. l3 u
    jnz     SoftICE_Detected6 D& J. [# p& g; k# K7 ^
: q. k* X  \1 P, y0 K. |
___________________________________________________________________________
6 u  f  l( ?3 Q+ x1 N9 Z. F& w9 U* f8 O! s
Method 02% u2 f7 E0 O& a* I* I
=========. t1 ?1 T1 ?) R+ n0 J; N9 D
( \* @" x1 K: R' N- K" }
Still a method very much used (perhaps the most frequent one).  It is used
. }+ X+ Y$ ~( `3 A2 y/ B  \to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: z; k; |3 L7 A- `0 j  T, g- \) e$ E) For execute SoftICE commands...
% |" S6 C' H! y4 Z( kIt is also used to crash SoftICE and to force it to execute any commands
7 F1 m, j4 m) e(HBOOT...) :-((  & Y6 x9 \& x1 y+ s

% f+ n- ^' ?( _* ZHere is a quick description:
# e$ |/ D5 g+ |) }0 d-AX = 0910h   (Display string in SIce windows)
8 J8 J! a0 z) y1 e: v6 v-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 i  h& S+ r6 e-AX = 0912h   (Get breakpoint infos)
2 L7 q: ]* }" Y% Q7 f4 I5 Y-AX = 0913h   (Set Sice breakpoints)6 c4 Q; M! u2 s! J/ \+ T
-AX = 0914h   (Remove SIce breakoints)
  j4 ]7 ?/ F! g; P9 C# l. x
$ d: B* z6 X. e) REach time you'll meet this trick, you'll see:+ W8 q& P% W; s, e2 F' r
-SI = 4647h
0 _. l9 a4 ]5 X8 b6 t-DI = 4A4Dh
1 W2 i6 @! C; v. x, Y: z; x- \" B8 j8 [Which are the 'magic values' used by SoftIce.8 Q5 g; a8 N" t% Z0 A7 Z2 L4 Z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ y8 y, M9 r8 M- P  X% A
! a/ C, ^7 ?0 O- |( a+ LHere is one example from the file "Haspinst.exe" which is the dongle HASP1 K0 A  Q$ f9 [
Envelope utility use to protect DOS applications:# m% r  t  t- x! k

2 b; D5 b6 o% e$ ?. t, ]0 W6 p+ e
( l, ^* a* }; i9 O  a0 w  i+ D, u4C19:0095   MOV    AX,0911  ; execute command.
! `4 s; G, J) Z! P4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- L5 F$ }6 g6 U$ `4C19:009A   MOV    SI,4647  ; 1st magic value.
, L& B' N3 I5 O  }4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
, \+ O" M/ z2 }3 ?4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 l+ E. f$ }& i3 j$ s( A# Y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 ?  V) O! D! g0 Q4C19:00A4   INC    CX% \& F5 h) p9 {9 G2 k' [
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! A, }& b0 @+ n1 ^
4C19:00A8   JB     0095     ; 6 different commands.
9 P+ g% {- h# ^4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
( X% z5 L  U% ?+ `! J4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& e6 Y( h0 W: d5 l7 s( w- p) j) s4 f9 ]- E
The program will execute 6 different SIce commands located at ds:dx, which( u, X/ O* [" r0 s5 D9 V
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% V, p/ D% F6 X) V( l
8 F( u( S- J2 X5 e. h# @
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 O7 K9 o: ]) R5 ?6 p# U/ i
___________________________________________________________________________
" M' Y( Z0 i5 m7 i$ @/ Q& `# V  q. g& w
) }; g$ J: I4 q) e4 j
Method 03
' y& G- B+ e1 M- H; y6 o=========
1 W6 w. t. g( B
9 p" H0 p; P, y/ F* YLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 ]  Y6 }: \. u+ N( X* ^) M(API Get entry point)4 V3 K& N- p6 h. o  i  P( V6 F2 G
        
: \2 o4 [$ ^6 W- U. M
- F+ g. W1 X5 a- ]; q, O/ T    xor     di,di
) Y# @  Q2 Q; \, z1 F4 N    mov     es,di$ r  d( Q- e$ @/ W! ^& {
    mov     ax, 1684h      
# x3 z$ H, V( }+ Z) [/ [5 i    mov     bx, 0202h       ; VxD ID of winice
2 w& G# P, n. n' b    int     2Fh
7 K  b8 k( I  \5 h0 t3 D' s" [    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 L- u$ }$ ?% u, ^3 B    add     ax, di. M% _( Z: [' ~+ z+ d
    test    ax,ax! Q( G$ g! e+ U- ^' K0 c
    jnz     SoftICE_Detected
7 u( {- n5 U' [2 t
# Q. N6 `+ ]! W, G* R- w, I" S; h___________________________________________________________________________
, M( H: s2 |. B" a
: \) ^2 Y& S8 w6 S5 oMethod 04+ s9 X% N. c. t( ^5 v& @1 ~
=========
. @, E5 A6 `- X" s' M, Z! `; F; t" B. ^5 I4 I; L( o
Method identical to the preceding one except that it seeks the ID of SoftICE6 B. X& ]0 c8 C1 X6 C6 g# Y
GFX VxD.- F" d* R6 b4 ]* A
4 E! C2 m+ g1 h( @4 g7 y
    xor     di,di
: j) s0 O& h1 A. o) [" f    mov     es,di
0 F# o5 }! Z- R% f% Y( Z    mov     ax, 1684h       2 v  ]$ g# f  r% y- G/ e0 ~! K
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  @) e0 U$ T, Z* r2 B0 D    int     2fh
: N% x% f$ w3 C( q4 s    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 b+ q6 b" ~' N  D    add     ax, di4 B% S$ s2 Z; q, _- ~
    test    ax,ax7 u7 W6 i  N; {5 \
    jnz     SoftICE_Detected; R0 h# J( Z  V% U

+ d6 D# T. B; C" D  g# x' r! o__________________________________________________________________________& `- l, g' R0 q

# G# N+ d" F4 a2 a6 X: \
; I0 [- k4 ]3 i# hMethod 05+ B5 J* G. `4 Z: ~8 B' B
=========5 w! _' [5 \4 k$ x

( {$ i% N/ [' P7 L* {Method seeking the 'magic number' 0F386h returned (in ax) by all system, u* |* [9 e! m" L. J: _
debugger. It calls the int 41h, function 4Fh.! Z# U) P9 M  c% u6 q$ l
There are several alternatives.  
0 X5 s7 w, z& L2 |( |# R% e9 H8 `- e+ {& \: P6 D) ]- ?# P
The following one is the simplest:
# K. l# b, x; X  Y  Y9 p$ R$ C
5 i2 B" I) _- e7 \& y7 G: f    mov     ax,4fh/ {2 U* M& A) l: ?1 A0 ^3 G* o
    int     41h2 \+ s! E! P4 V, H% w9 R- u
    cmp     ax, 0F386
. Q  _# Z- O& E6 ]4 u. ^" s    jz      SoftICE_detected4 ?7 T$ M6 O+ c$ ?1 r# k) I5 t
4 K' x. N! B2 Z
% P( v+ ^6 i2 m2 K: F
Next method as well as the following one are 2 examples from Stone's
% B; T) b! a  W"stn-wid.zip" (www.cracking.net):
/ a; @3 k% Q+ v7 m5 v+ s8 a* M0 F( Z- E
    mov     bx, cs
: ~% n' J# g6 L6 ]% J$ c) v! N* k    lea     dx, int41handler2
) m; w  r/ y4 \7 S0 {4 O    xchg    dx, es:[41h*4], t( |: [; ~+ T- h: b$ O5 T
    xchg    bx, es:[41h*4+2]9 v7 _9 U: a; X- ?( D: d% d5 x# Q
    mov     ax,4fh8 B% n5 J5 H7 A6 @' B: r
    int     41h/ p& b5 ~6 n  G& `; y: A. y
    xchg    dx, es:[41h*4]0 g9 C! x6 w$ K8 k& E/ r! d% O0 `
    xchg    bx, es:[41h*4+2]. u9 Q2 R5 m5 L3 f4 j4 l
    cmp     ax, 0f386h' W# L$ q0 g3 G4 A7 e
    jz      SoftICE_detected# ~+ W) ?9 [( ~
; l" Z+ L& e8 J6 V5 i% y
int41handler2 PROC: f* P' D5 J. x% m3 i$ N
    iret
& n: C6 u+ ~4 |2 D+ L/ Kint41handler2 ENDP+ a+ e; B# \" T" ~

6 j, J# V& B3 k8 K& }& z# A3 [! A. F. w% \4 S" ]' T8 U
_________________________________________________________________________
; G% O  h+ t* ?% V. z3 h  f1 ?% F6 h
" b- s5 d0 `! ~4 Q7 N! a3 O
Method 06
; _& [. b/ B" j3 @7 [" [. |  C=========
3 [2 L3 j0 I7 J9 q9 [( b& H6 C  M
  N/ `; v: W. t/ W1 p7 r- f* ~9 z: y1 I! F' F& U8 Q
2nd method similar to the preceding one but more difficult to detect:' m6 @( I$ C. ?0 S

3 g  s% Z8 Q( _' `" u# o7 j
- i. R3 r1 y0 ?int41handler PROC- D: u. M8 R  \2 `
    mov     cl,al9 Q0 L' Y$ T: E+ C$ E/ Z1 G
    iret9 Q5 g! b- r: o- j4 h, ]
int41handler ENDP
8 {$ l, V, R7 A$ x
6 X1 ~; e, o2 c6 b
& ^9 c1 L0 o& i    xor     ax,ax
2 P% q/ Z, v1 A3 J2 k    mov     es,ax
0 k1 ~+ N( E' t3 n  D+ e% |    mov     bx, cs  }( R: J4 H& ^3 _3 I$ Q1 Z0 D
    lea     dx, int41handler
. |* o' l7 d/ A1 ^1 M5 ^5 d4 ?    xchg    dx, es:[41h*4]6 a: R- n! D7 n. ]$ B$ n, B# w
    xchg    bx, es:[41h*4+2]
( V; V/ z& o/ _) m4 S    in      al, 40h
3 h7 ]! E: a' k8 t" z9 U    xor     cx,cx( _( d: M% n* a1 a" z3 i
    int     41h6 x5 M/ }; n9 Z, k% s( s
    xchg    dx, es:[41h*4]
+ |# a# @) e# v, L, e9 V    xchg    bx, es:[41h*4+2]
0 z# X" E9 u% u+ ^    cmp     cl,al: ]; }5 I# P) `  h" x
    jnz     SoftICE_detected
* E6 H2 m$ S% Q& M& m- T
  n  q: j, L( H3 x9 [$ N_________________________________________________________________________
3 Y% _( j; [2 L& N0 K! z4 O
1 T# w9 q0 }% ]+ c7 n. U9 YMethod 07
& v4 D! R$ _4 h9 d& P3 a=========
* Z# ~: Q6 }, B1 h. J" _$ n
3 J9 i0 a2 M- [; E4 P6 I$ A# aMethod of detection of the WinICE handler in the int68h (V86)
6 d. @; T8 S& |$ K7 M
9 D3 {7 k( Y; \5 U: n  }' x% `- g- k5 g& Y    mov     ah,43h6 m6 V* h  R& ~; V; Y; ], m: B
    int     68h
. L! s- |! \3 f2 V" f+ J- F    cmp     ax,0F386h
' L$ e& q" Z8 d: G% K# N  P# _* f    jz      SoftICE_Detected
' P% N- u7 J6 j/ s! \& {3 q) O- o+ I
4 X  Y7 W5 i9 O
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit. Y8 f1 N! U' a, H& }
   app like this:6 T! v4 h1 }- K6 k$ y' k

/ U0 w4 f& W8 B2 B) O/ s   BPX exec_int if ax==68
2 E" C" _+ |/ A  t# P# ~2 S   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 K9 \) c9 |. \) F( U7 d   located at [ebp+48h] for 32Bit apps)8 G- m; K7 u/ s1 S( \1 O3 d& R
__________________________________________________________________________
" O) G7 V. M  U3 d
/ k2 c# I( ?6 U; S7 g5 f4 b/ G, ^4 h* p
Method 08  d9 w2 T7 |, p  x4 c5 A# X
=========5 F9 h% }- X" ~
- h+ C% Y; a. k, v3 {
It is not a method of detection of SoftICE but a possibility to crash the
5 V" R. Q2 k' h/ ^; z8 Hsystem by intercepting int 01h and int 03h and redirecting them to another1 l/ z  o% l$ s6 }" U% S. K
routine.% i1 A" n, h& w! ^
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ N$ j, k/ p( _! x% ]; @0 P
to the new routine to execute (hangs computer...)
2 z0 M" L' h* B( j, K* L* i
6 I5 _4 u% W5 V    mov     ah, 25h) {' _  n8 U6 ~* W
    mov     al, Int_Number (01h or 03h)
) _7 @" ?" o5 y2 i4 |9 E1 F0 Y    mov     dx, offset New_Int_Routine5 e; P  O6 F1 S2 Z
    int     21h
/ D0 m6 r; F# Q' B  L
! t( g+ M3 Q3 C/ C) z$ Y0 X- x__________________________________________________________________________
1 f% P9 M9 ?; ~$ e2 _* r$ [' C7 f3 H; ?$ A4 {! E5 g8 R( Z8 D
Method 090 q4 x4 E. j2 e  U) d
=========
/ J2 o. L+ `3 M) U; a" {
, P& e( s: R  eThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only# s- u- H5 d4 j8 j, S
performed in ring0 (VxD or a ring3 app using the VxdCall).
* i- ^, ^* g2 |% x* Y# b' w; t2 H$ ZThe Get_DDB service is used to determine whether or not a VxD is installed+ f' x. J, h. F$ t" \8 t" w. o
for the specified device and returns a Device Description Block (in ecx) for
# M/ m0 f* Z& n$ s: Gthat device if it is installed.
, g8 i5 }0 X. N7 C3 o9 s6 M# I" z2 x4 h) N
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID* X2 T2 K/ h% w  `, o
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ I/ D0 B& M9 p6 N  u; s
   VMMCall Get_DDB. M/ i7 c2 V  V5 ]) |7 d' }
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
8 G1 X9 z# m' J( B7 \9 g. ]& |  B. P# A/ Z+ H# l7 Z9 a6 E
Note as well that you can easily detect this method with SoftICE:7 `1 K7 b: S$ y2 _
   bpx Get_DDB if ax==0202 || ax==7a5fh" s$ ~, Q+ K1 h% T: i' b# c
! e  O2 z3 N  L4 V9 x
__________________________________________________________________________2 `/ s, _* e8 Q0 _5 B$ A0 f

+ e7 X6 |6 v5 W+ KMethod 10" o* t( X! H! x& H
=========0 d& R" x4 N5 R- c$ v) z
, i$ ~/ e: c8 f$ J& p
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
  `) H2 x) r% N/ y# Y# _  SoftICE while the option is enable!!
( f/ x6 F' e6 ~# b/ A2 W* N% o( y8 G" D, ^+ B& x; i
This trick is very efficient:+ f: B2 S( t5 _" y& n
by checking the Debug Registers, you can detect if SoftICE is loaded1 e4 y; o0 b; }! s! b
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
+ M" @3 B" V; F9 ]1 a$ K0 M' ithere are some memory breakpoints set (dr0 to dr3) simply by reading their. R0 Z2 w2 @4 S5 @: J) e  e' F
value (in ring0 only). Values can be manipulated and or changed as well" T5 |$ `( e1 Z
(clearing BPMs for instance)
. u( \; V8 S& H0 \# ]' N) F9 V* Z  b3 H0 n
__________________________________________________________________________
$ n/ D# v( s, s9 I: o  y  C8 O
* U9 ^& x. o# @. p1 YMethod 11
+ t1 {4 F$ ], o5 k0 X& G=========+ M* {. R) u" z! \' k/ P

9 d6 [8 P6 U7 g# P! oThis method is most known as 'MeltICE' because it has been freely distributed
) v# t1 G3 m6 Hvia www.winfiles.com. However it was first used by NuMega people to allow; P' I8 j: b. y5 V
Symbol Loader to check if SoftICE was active or not (the code is located
  Z( W# ]+ l6 ]2 J, D1 [inside nmtrans.dll).
: [% x) s2 e& H. v, [7 I, c. i! M5 R/ s/ l0 _3 Q
The way it works is very simple:6 r- j, m; h0 m* O5 }5 R( q/ M; ]
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 G' k1 R9 \# s5 P) _  l: hWinNT) with the CreateFileA API.3 @  K7 i. z: ^0 @

* x% L% R; h1 O- J  m- A6 E5 lHere is a sample (checking for 'SICE'):
/ o4 S: A( e5 d' y4 J" F
. f! ]  N8 n7 s0 e) I$ A( iBOOL IsSoftIce95Loaded()% Z$ j; ?: h( Y; @1 b
{+ U! V4 V$ v+ J0 r1 S
   HANDLE hFile;  
" e4 \$ {- M! N: l; a# `   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,2 o& b4 e  n! L6 \
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
5 L* G* o0 I; m) s+ Q& _- E                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 E( J- o3 |! C/ U5 `- K   if( hFile != INVALID_HANDLE_VALUE )
1 n2 N" x" _6 S% I. v) j' E: f# k   {6 ?! C( j& C5 H. U  V4 R$ m/ f
      CloseHandle(hFile);
% }1 I5 J; w# W8 F      return TRUE;
# ]6 M( ^9 L) a( f7 y+ I; v   }
% ~1 p/ X' _( y9 ]3 `$ R5 W4 f   return FALSE;
- x( J8 q( i5 s5 M: \}
. i  r- p$ o% G' G& o& Q5 \
$ E8 j+ c$ o- E" w6 j) m- H; }, pAlthough this trick calls the CreateFileA function, don't even expect to be1 d* N; I. T& |
able to intercept it by installing a IFS hook: it will not work, no way!
) P3 B/ M6 I9 K" V  _In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 ]6 v; K. @9 n0 w0 `
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
* L4 o6 d0 \1 {& }0 fand then browse the DDB list until it find the VxD and its DDB_Control_Proc; V) B0 S8 T1 r
field.9 C& V$ M5 r2 Z. ]* V
In fact, its purpose is not to load/unload VxDs but only to send a 4 q6 O9 p0 A8 O- j7 v& n8 ~
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 n  z7 b4 Q8 `3 n( N" Lto the VxD Control_Dispatch proc (how the hell a shareware soft could try! S! s% `/ H) s: J
to load/unload a non-dynamically loadable driver such as SoftICE ;-)./ ]5 o& j. F6 q+ k
If the VxD is loaded, it will always clear eax and the Carry flag to allow
; B; w! }! I- T" aits handle to be opened and then, will be detected.
. W9 |6 p* p* y! w) V' cYou can check that simply by hooking Winice.exe control proc entry point& k, Y3 d% l- l4 E. V
while running MeltICE.
; M' f; j1 @+ f. m0 x: R* w, A0 ]' @8 C. a$ A

3 B9 z/ s3 {/ T3 i% A6 h/ t  00401067:  push      00402025    ; \\.\SICE& J: f& d, o+ W( F; B
  0040106C:  call      CreateFileA* e5 R' x. b9 v* e4 j
  00401071:  cmp       eax,-001
: ?: a" a  A) Z% ^% G  00401074:  je        00401091
+ f5 n- Z: G( o8 S* [, L9 s
# t; i& _; Q- k$ ]- l3 B: U. u* a; ~+ a7 S9 u" F7 q
There could be hundreds of BPX you could use to detect this trick.
! A. H1 Z9 o0 I* k4 D' j-The most classical one is:) `# q3 X  e9 v) m* P
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||4 H* K. m# R, F4 O3 \
    *(esp-&gt;4+4)=='NTIC'$ ~0 {$ d& k6 {4 d, c. M

$ k+ |- e6 o8 i3 j-The most exotic ones (could be very slooooow :-(8 s( V: H) y9 J1 y( `
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ p) E$ i& e5 K: }4 A2 }9 F2 l     ;will break 3 times :-(
7 q5 k# w$ h- s- I7 C" a, C0 U9 C8 e
-or (a bit) faster:
  ~! I! f+ U5 N2 |! Z0 W  A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 P& J% L; L( b2 x1 c9 B; m
6 e1 f% x; ~7 S$ ^
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 `8 j* D2 P" Q4 [* K& v7 x( U     ;will break 3 times :-(& ~& m; r! x8 v

. C' z( }' F* G/ L" [-Much faster:
$ W2 a. y5 ]7 ~1 c" C4 l6 k. T   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', E( U, b) U% B
- q9 ]+ n/ R5 N/ W4 g# K
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
8 h" N8 t( `5 k9 e+ ]- Dfunction to do the same job:
8 n2 l0 e0 _# K+ k# _& p  `9 W6 e) e+ |+ E
   push    00                        ; OF_READ
& X, i7 |4 g/ f2 D4 _   mov     eax,[00656634]            ; '\\.\SICE',0- ~6 ^. t- u) M$ R  k* Q6 T, Z
   push    eax, r1 {% n# d% \3 W" B/ X' _# x: X
   call    KERNEL32!_lopen
1 @- a& a/ [& o5 Y1 y* Y8 @   inc     eax( W  Y7 T1 g- d
   jnz     00650589                  ; detected( Z/ [, v4 A8 B4 B; q  x
   push    00                        ; OF_READ: K9 T$ O9 Y  T1 Q% f
   mov     eax,[00656638]            ; '\\.\SICE'2 [: X7 i6 v6 @
   push    eax
) W6 t% h# ^7 z9 b   call    KERNEL32!_lopen
3 Z: _( v1 O- Z) Z# }   inc     eax
3 e7 K" r  D9 K# f   jz      006505ae                  ; not detected
# {7 c" [( ]" C% @1 r6 h5 D- o) H" h: l
' Y. `# W% l+ B8 z# J
__________________________________________________________________________, X- m+ k6 M) k7 o, [

$ R6 c1 |# @% n9 |. S$ gMethod 12
' x0 M/ S, w# p* _6 G8 g=========
. @) E/ h+ \  H3 V7 ]& u: T7 j- _' p# N9 c' z8 e
This trick is similar to int41h/4fh Debugger installation check (code 05  `/ C6 t9 r1 Q; O
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
" |* s  s8 \9 G! Z' mas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; C; V! }9 q* o5 o
- a! B5 y2 O$ z! \, r+ ?3 D   push  0000004fh         ; function 4fh, D  D* A8 u2 D' d3 |+ B
   push  002a002ah         ; high word specifies which VxD (VWIN32)- Q% q3 _4 J0 ?) Z+ I  m( Q  Z& |' Z
                           ; low word specifies which service2 [. J6 p: H& ], z6 b% v/ M8 c
                             (VWIN32_Int41Dispatch)
- A% I& y* j7 f6 A# `   call  Kernel32!ORD_001  ; VxdCall) b6 e( j; R9 T8 z9 I6 {
   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 S1 h( D7 T6 {7 e# z  t+ t4 C   jz    SoftICE_detected
# G$ @6 |! B! i4 n  h6 z3 W- ^7 J: p! w1 t+ o( d
Here again, several ways to detect it:
, T% }! R" r. V
0 h$ u  e! O# B( t    BPINT 41 if ax==4f$ U; Q8 w# {) W0 K- g
1 h5 i: O0 B6 d  b
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one6 [; g. s" [( j$ w1 j  D
0 j# _7 M. E) w# \& f& B
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
0 h& ]  Z1 q* V3 Q# N4 |0 S/ z4 F+ B, ]7 ~
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; C3 \3 _2 u) o, \% J+ O( u# ^+ i) C9 G( }
__________________________________________________________________________. Y, n3 N$ M% ~' w

! C" B( D6 d$ N- t) u4 z1 @5 HMethod 13/ @, C9 g. v" H2 X4 ]; \
=========; H# J' B. K3 o  B6 e& s

3 W4 s5 l% b: @# ?# o+ t; O" R  tNot a real method of detection, but a good way to know if SoftICE is
1 q. o7 F4 X( H% Z6 ~0 ^installed on a computer and to locate its installation directory.
2 ^: H1 |$ R  [It is used by few softs which access the following registry keys (usually #2) :
: D: ~% R0 f9 {
  f7 e' J8 f$ l% V& _$ ~9 V. m-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' C+ R2 f+ C4 {8 }' o! Z
\Uninstall\SoftICE. f( @. I! j8 \- B2 p7 _1 B
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
: @; c+ r" \. Y! {) J! O-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# I( a, |6 Z9 y1 j( b\App Paths\Loader32.Exe
  I% h$ \4 U- b5 V- w3 `8 Q
7 }6 {% Q  |% Z$ [- ~1 J+ p, W3 P, x4 v
Note that some nasty apps could then erase all files from SoftICE directory
& u% Y- p- Z  H! h  D* p(I faced that once :-(6 E1 g3 o2 k7 \" N0 f# V; J

' q4 V7 e# ]1 }, mUseful breakpoint to detect it:+ z% E' G# O* c
' A0 X$ s' a, X, j7 \' a
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. `# ^* Y  ]. m! u3 Q. ?4 r

5 R# _, Y+ L: P- x) b# R% r__________________________________________________________________________$ W6 d1 Y+ ^5 Y5 C
4 z# ~& t4 k+ v# [0 X

- ~2 \; @5 p2 {6 i; U; N! P7 HMethod 14
# G$ h9 r6 ]+ ^+ z! |=========
: ?" e5 ~$ X- b& |: G9 Z% K" }- v- c0 t3 l
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( E1 s) u. t  r/ h6 ~; A& Y2 Wis to determines whether a debugger is running on your system (ring0 only).# T# m; `! L3 Z& ?$ [$ P
; [) o; O' v" t6 _2 J8 P+ d0 q# G0 D
   VMMCall Test_Debug_Installed' v7 k: b5 x/ p
   je      not_installed' Z! [* W" ^- ?6 R" Q5 x+ L
; |7 Z: i; Z. I+ d& ~* F
This service just checks a flag.8 ^- {/ _* h% |7 @! d
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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