About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 j  m! s/ b( \
<TBODY>
/ C9 }3 I1 |# C1 G1 W' s! f' P. u: t<TR>
' ^7 @  M# R/ }! F- ^' j, b<TD><PRE>Method 01 * o, k" o# R5 y- H; x2 r
=========
. A. D* `' H  t9 N& ^$ z1 D
5 L# w5 g0 Y4 V9 vThis method of detection of SoftICE (as well as the following one) is; R' ?2 E) N9 w; g' I2 ~: @" E1 s
used by the majority of packers/encryptors found on Internet.3 O& ^/ Q) v: c# P7 x% ]  w
It seeks the signature of BoundsChecker in SoftICE) K& s* y+ z; J5 S
  V# l' y* b! X6 r
    mov     ebp, 04243484Bh        ; 'BCHK'
( N/ I* a5 D! c  v5 F    mov     ax, 04h
3 ]: _  `, \4 S/ K0 G8 h7 ]    int     3       0 r3 ]4 b* ~* h7 o; T7 T
    cmp     al,45 N! M5 K1 [) Q: L5 b9 {2 y6 w
    jnz     SoftICE_Detected' {# E3 Y5 c# o

5 X% o# r/ }/ Z/ J0 l. h* I$ }___________________________________________________________________________
5 `5 l' Y' L! E- A0 C, }
* g4 I/ G5 T, g+ W0 ^' o3 x8 ^Method 02
/ M7 H4 {3 i8 ^, w=========" \! k/ b7 E1 j. `; G8 ]9 O4 z
* P- H5 h- [  S' |
Still a method very much used (perhaps the most frequent one).  It is used
  K3 T  b4 p( G: F5 dto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
" F5 e, t6 k0 f, K% X: oor execute SoftICE commands...
' A- E. R$ b& r7 z: J. E6 c3 ~2 [It is also used to crash SoftICE and to force it to execute any commands
( k0 I0 i; l1 w; C6 O(HBOOT...) :-((  
' W& f5 C# U8 `9 u. H
1 e( P7 V5 n, `' OHere is a quick description:
/ M, Y4 i* `& H7 n-AX = 0910h   (Display string in SIce windows)% `1 Z. k, N7 Y. Z; \" b% I5 p: _
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. W: F7 @; b3 X-AX = 0912h   (Get breakpoint infos)
3 h/ L, x5 p- u: C$ y-AX = 0913h   (Set Sice breakpoints)& Y0 E# f: ~3 m. s8 ^
-AX = 0914h   (Remove SIce breakoints)$ l6 @6 b1 v' K. L6 B- h! V+ {* m1 x7 v

* X5 N! ]1 @! L5 |( ZEach time you'll meet this trick, you'll see:
- ~, @+ m" f: u- H: {% N% N-SI = 4647h
0 }: B: W$ ?# l+ I, C-DI = 4A4Dh$ K5 J) v) _) n4 _! B% x* ]
Which are the 'magic values' used by SoftIce.
# k" ?9 `) G0 VFor more informations, see "Ralf Brown Interrupt list" chapter int 03h./ L( o9 Z  W- C8 i

1 T' R' W; [  P6 b$ |Here is one example from the file "Haspinst.exe" which is the dongle HASP
% Q5 R9 G. O9 [& y4 ?Envelope utility use to protect DOS applications:
9 M. X, _- x# q+ n7 R3 {( s+ @
7 e  h7 q9 S$ ~
2 b3 [: i% q3 F3 ]7 ~1 i* M4C19:0095   MOV    AX,0911  ; execute command.
; m% e0 e0 K% I) x, g' r% I+ z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 F9 ]' y. G, W5 N/ g
4C19:009A   MOV    SI,4647  ; 1st magic value.7 Q, a4 Y% [( T# f$ [% R, I
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 W; q' g7 M$ |
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
  ~9 b0 X8 b' D" i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( C, t" e/ y1 A2 e( B
4C19:00A4   INC    CX
2 {/ T  _+ {( n& @5 b: H4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% k' X+ ]% }) N' {
4C19:00A8   JB     0095     ; 6 different commands.0 |1 E+ y, W4 p
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 Z5 j0 G, v/ ]! m
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! m8 X  r0 O) F. y+ H1 i+ n

  j; J4 Q: O3 F: P; lThe program will execute 6 different SIce commands located at ds:dx, which
* a4 S# `2 u0 i: r; _3 F$ [0 Fare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# P& _. k  b  n* G4 z' k
9 c1 Q" B$ q2 Q- `* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' W! h5 i4 Y: z$ O
___________________________________________________________________________' n- ?5 l6 A- q4 S* J4 m! J2 b
8 q: ~9 o. r+ r4 B& e
! [) W: B0 |5 W& x  D+ K2 z
Method 03  t2 Z: H$ n5 I# t
=========
2 `! j$ V  {: f4 L5 t- v% p1 ^1 k1 g
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
" x1 p$ l, E+ A: j9 [& Z/ x(API Get entry point)2 Q/ A) A7 {: p- B# k0 F  x' l
        ' }. W7 ~; Z1 I* d+ f2 n/ c1 ^
4 T) i5 U" t  N, _
    xor     di,di4 T5 l) v& l( Y& L% ^* {4 p
    mov     es,di
+ r. M7 w4 Q6 {1 J% j5 F) y    mov     ax, 1684h       8 e9 G& E" f- q
    mov     bx, 0202h       ; VxD ID of winice
, `5 E" L  b  I+ O& h! ?    int     2Fh. t" ]# ^4 q7 }& ^4 {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% X( h1 v& O) B5 Q4 n! M+ {+ }
    add     ax, di! t# z' l) s4 n
    test    ax,ax. _' h4 S; B  A, W
    jnz     SoftICE_Detected
4 r5 ?  ?9 @, K  W( L  j+ Y. [# P2 h  j
6 r& d2 B9 R. O___________________________________________________________________________
. T; E8 U( b6 Q1 g6 ^' B
. ^% w% S8 ^! f* [% |Method 04
# G! q7 A% K5 l=========
! l1 j# p5 B% b' [4 Z6 o5 U
; g4 g0 ]9 d) {/ _Method identical to the preceding one except that it seeks the ID of SoftICE6 C+ Z! o3 q) c3 \
GFX VxD.
9 Q1 j' f6 T1 U3 j" x" }# d& z6 `8 W8 c6 q  c  P9 v/ M1 S8 [
    xor     di,di
8 I( L9 D1 o1 W0 z    mov     es,di' s* S. ?( f5 \
    mov     ax, 1684h      
& ]! \* |6 q$ p! f# O2 N    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 Y( t2 v/ C3 |* X% [+ U    int     2fh
, @, D# S& N. c7 c1 a9 N    mov     ax, es          ; ES:DI -&gt; VxD API entry point* x: W3 F" ?7 K. @, c. n& I  Y
    add     ax, di2 e. q/ I8 e: _8 H9 q! A
    test    ax,ax- }$ u  r/ A1 f# l: B9 H/ G3 A
    jnz     SoftICE_Detected1 f. f( y+ ^) c$ u3 C
/ K) V8 z! r# ^% W
__________________________________________________________________________
1 h/ R# D, Q. p1 n
) n9 D8 l3 A5 j! j' G5 i0 e) d2 ?" B3 u1 p& R- N+ [
Method 05
( J) o' T( Q2 g: _$ u1 e) u7 y=========9 G5 ^# j: r2 Y4 u( b. [' }
# \' E9 ~" J; s6 Z8 w3 n2 I
Method seeking the 'magic number' 0F386h returned (in ax) by all system+ n0 n7 f( V6 b: X! b1 _
debugger. It calls the int 41h, function 4Fh.
! d: x) o( w, q) y9 T; C! s; XThere are several alternatives.  % \5 z- l# v  `2 n8 U$ R
" V' ^) A. `5 G7 F; @
The following one is the simplest:
: N5 e' E8 N! M4 _
% m) J4 @% I% Z6 S/ [    mov     ax,4fh
! s' q  f4 p" b7 X    int     41h7 a  G) [0 D% `+ g; p( D
    cmp     ax, 0F386: Y) L; {4 g9 g, ^% d
    jz      SoftICE_detected
0 z3 {. {& {9 X& Y3 @) S
& t; H1 a( P  P4 Z' F$ J+ M- |& O2 x( Z+ r3 {
Next method as well as the following one are 2 examples from Stone's * J9 o% v% X4 h9 s* I
"stn-wid.zip" (www.cracking.net):6 S7 v$ P( |* C7 b0 |; P+ S8 I

. C  r' f0 R4 |4 [0 X    mov     bx, cs
. D. g# n6 A  P( V0 A4 ]2 l- _    lea     dx, int41handler2. ~7 {( w; O3 a% d! _. v! b2 d
    xchg    dx, es:[41h*4]
& v5 X. a) D8 L7 ?2 g: F! ?    xchg    bx, es:[41h*4+2]  |1 n0 s# u6 ]. a; o
    mov     ax,4fh
2 N( x* J; x+ C  X& V4 N    int     41h
2 y1 W5 Q) V) Z! i# ?7 A- Q. ]    xchg    dx, es:[41h*4]% U2 T4 j# t: D
    xchg    bx, es:[41h*4+2]
9 |! A# [9 t/ S    cmp     ax, 0f386h
. O7 {+ l  P$ n. Q0 O% g    jz      SoftICE_detected
7 C! j2 L  {' E# L. e3 \' ^
8 J9 |+ [7 {7 oint41handler2 PROC3 x. _  z3 d4 T; e
    iret
& u$ R4 R& g2 gint41handler2 ENDP
* W, V: I, P) K* }5 X
* P# E1 o2 E5 C) T6 [% ?' E
( i* l& n' @9 o" Z_________________________________________________________________________2 T* l7 E+ c% B, V$ {3 r

5 A) ?; b, f, ?$ q2 |9 P1 m+ J, R% G' t: C
Method 06
0 u; g  X, K0 I% m2 c" K4 B0 v2 x& r=========' F: ~/ |/ d# m6 T) E* u9 p* X
% R5 W+ n, t# w% y
( ?5 z0 _) U; M, F  ~# d
2nd method similar to the preceding one but more difficult to detect:
- N3 _6 H% }9 w4 D( V! S; d3 [6 O/ D8 R! u- T9 K3 H; k8 l) a2 I
3 k' z+ h( O' X6 _8 Q( G
int41handler PROC
  \( O: ~0 a! s0 L7 Z/ P    mov     cl,al
/ i: y$ l  V9 J8 l+ s    iret2 U3 i3 q* x1 M5 }/ c6 h% D
int41handler ENDP  o; i/ o, F$ q' ~
, B+ f% B. l' w0 f4 w5 x, d' W5 [( U

$ |# e" z5 V6 V' T# b2 n    xor     ax,ax/ A5 E0 E7 c, E  v. |9 h# T
    mov     es,ax
) t4 ^) o0 u$ l  R8 L0 ?3 c    mov     bx, cs; m- Y" g% i3 @( t
    lea     dx, int41handler+ w4 ]# `. q3 b+ A9 m+ w
    xchg    dx, es:[41h*4]5 Y7 ]. {( V! f6 s2 K
    xchg    bx, es:[41h*4+2]' }* |% F; o7 h0 o% I4 j, m2 x
    in      al, 40h) u; N, t! j2 i; e5 F
    xor     cx,cx
, ]  A+ V" z# L6 M0 a3 V; G$ b    int     41h/ N2 X1 V% h5 {, @( Q1 M! W8 F
    xchg    dx, es:[41h*4]
, d+ d; [7 ~5 b" x9 w2 B' @- I    xchg    bx, es:[41h*4+2]/ B* A3 A( f) f2 b
    cmp     cl,al
9 A: n( T9 e, y; D. N    jnz     SoftICE_detected
5 g# a6 f# q3 D4 S) w) {+ }! R% T( F* y- D. S5 p
_________________________________________________________________________& H7 C2 m) l5 ~* i
- L5 M4 s' O+ N" R$ ~+ O. `8 c# R( I
Method 07  h% M6 d/ Z6 h+ ^! h) P1 c
=========
2 j5 D5 p7 c* ^  r, ^8 ]+ k' S2 r! a7 w- k6 f9 Y$ L: _" D
Method of detection of the WinICE handler in the int68h (V86)
2 ^! N$ x. v! \: h& |
+ W# p5 j: h3 F3 d- [    mov     ah,43h8 z* e# L' s+ A6 c5 Q1 l. C
    int     68h
: {$ g; H$ W6 U+ C$ T! k    cmp     ax,0F386h& @7 w: p: w+ O9 m/ d
    jz      SoftICE_Detected
6 H0 T+ [# W- r) S2 S# R
( n; f! Y' Z* n" s, K" q: a+ R+ i
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" @( a% C! ~. w1 r) o( e+ l6 C4 f
   app like this:  v3 ~+ U/ c. A4 r" A

1 b% Y% }9 a/ P8 ~- o   BPX exec_int if ax==68
( H/ ~  m" N) V- S( ^   (function called is located at byte ptr [ebp+1Dh] and client eip is9 y8 y7 F+ u6 w# S
   located at [ebp+48h] for 32Bit apps)
" L" w' w4 w1 w% Q__________________________________________________________________________
5 p3 H, `9 z- C8 r! ]" u. u+ o- o
$ V. [1 Y& Q; _0 T- R' h/ f2 L* Z+ _- X
Method 08+ V( U  r: _- w* w% W4 C1 O: J
=========
  p" c! Y9 K# N9 z: w( I) u5 s6 P6 J# N  B( s3 \
It is not a method of detection of SoftICE but a possibility to crash the
3 \: ?9 W9 I. isystem by intercepting int 01h and int 03h and redirecting them to another
  d& d' n& i! Q) w- {# uroutine./ H# z6 t7 ?8 I6 |& F8 q. |
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points* ]2 w4 Z5 X, w4 ?1 n: `
to the new routine to execute (hangs computer...); i; H# J$ d) o0 b$ m" p. S
; V! p! y; g( `- Z% M3 S% Q
    mov     ah, 25h
, L1 T8 N2 C( \    mov     al, Int_Number (01h or 03h)0 ?4 o& [  ^0 g* T
    mov     dx, offset New_Int_Routine
  K0 J2 B/ Y" V/ L    int     21h/ l# R2 v6 Y& X/ W" ]) Q8 B

- z9 `- p! N* Z6 }  {__________________________________________________________________________$ @8 C. V3 M& L' y- X' v, w
% T/ ?. F: A& E
Method 09* |: o3 p$ b8 r. b) k
=========" ~- P, Z! N* a# ?- U, W
: ~9 R, c9 p' R2 R
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" T3 o+ J$ G; ]/ n3 Z, I# t$ g2 J
performed in ring0 (VxD or a ring3 app using the VxdCall).
* y" y+ N: l. Z+ g+ L' h0 _The Get_DDB service is used to determine whether or not a VxD is installed
. S. Y# a+ W( ^9 @& Kfor the specified device and returns a Device Description Block (in ecx) for
, B, K* ?6 P, k; H/ Kthat device if it is installed.
# b0 u0 a+ l$ n" O$ T6 u
0 S4 Z0 _' L+ j5 v8 k1 E   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 K  g% ?) w* ]+ P' ^& v, z2 \  u   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 ^+ G! {: |8 R7 S' i
   VMMCall Get_DDB
. H7 E. w1 M/ N, z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed0 f4 F# Z. r- o/ y/ c3 |

2 ~8 F- Q' b  U- YNote as well that you can easily detect this method with SoftICE:
; ?" z$ S5 \3 S6 s, {5 G+ ?   bpx Get_DDB if ax==0202 || ax==7a5fh) a- L8 B( O& t" t' j0 ]- G' y3 J. M0 c
/ c6 S3 N0 f: a: N. i- C3 U5 @* }
__________________________________________________________________________
' N8 Y- [8 X/ n, b: }8 h* O: v: d6 x
Method 101 M( B0 E& |# ]* [  e- j
=========
8 z/ A  r8 `% u6 V% m7 ?7 c! y* i8 a& f8 F
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with5 r* B2 h" G( _+ u
  SoftICE while the option is enable!!
( j7 b0 l/ [$ X8 f
. O0 S0 O& D1 I+ N+ v0 WThis trick is very efficient:
4 G- |: v0 Z- @# }. tby checking the Debug Registers, you can detect if SoftICE is loaded
8 ^! F8 ~* g& v! _* H6 l(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& _( r! z9 v* n9 S
there are some memory breakpoints set (dr0 to dr3) simply by reading their4 G$ \9 c+ S/ P* [" i0 o" O* u' b
value (in ring0 only). Values can be manipulated and or changed as well" d6 C/ L! F) p0 m- P
(clearing BPMs for instance)# i; l0 c- E. G( L5 K

' |+ i0 S- P+ P9 t" h3 C7 a4 B__________________________________________________________________________
6 ^- j$ _9 P: m: `% s; O
# L1 e/ r/ F4 g* H! p  C! ~Method 11
5 u3 s  \( [6 ?. @: R# K) ?=========
$ o0 h5 k2 t4 ^7 i& ]! C
7 ]" ?3 Y. W( K# ]This method is most known as 'MeltICE' because it has been freely distributed
6 `6 p+ p, a  F1 i5 \4 Q0 u  Pvia www.winfiles.com. However it was first used by NuMega people to allow; n0 X: X* {: F8 [7 ]3 k
Symbol Loader to check if SoftICE was active or not (the code is located* ~- y( ]+ U$ A% H4 w/ w% o
inside nmtrans.dll).
- @* [, t9 t3 [
3 |4 D* [  \5 w- T- a. h" d' sThe way it works is very simple:$ t/ V; o, ?9 ~' @8 \0 u
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; t9 a. |& b  T! ]' w' y9 S, M" P
WinNT) with the CreateFileA API.
- w" [3 z; [4 l( M7 e7 M% W3 l7 N9 _/ f7 t
Here is a sample (checking for 'SICE'):
* @6 |# j& ~( q1 d' e* @' C8 w
9 @* t' G% d. Q) r9 XBOOL IsSoftIce95Loaded()6 u4 H7 D! ?8 U' M1 A8 Z
{1 l: C! V9 e  t+ ?/ r1 o1 w5 j
   HANDLE hFile;  
( W- v6 Q2 w2 @1 |& ~9 {   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,/ ?3 b+ H9 P7 d- e
                      FILE_SHARE_READ | FILE_SHARE_WRITE,. r0 V2 V7 v' f0 g' Z3 {8 u8 C
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
0 w$ C1 ^# }& ?5 t: e4 e   if( hFile != INVALID_HANDLE_VALUE )! {7 a8 y0 j6 I0 T  g
   {0 W( ]6 O2 \0 P5 L. K1 Q
      CloseHandle(hFile);
) J5 M1 d9 i+ @      return TRUE;
2 ?# u' b, y" K8 n8 F; }% D   }
+ W2 D& O& J% k, y4 k9 |   return FALSE;0 t5 X$ F1 W) a6 i" Z8 E9 Z. N4 n) N5 v
}
5 a: [" L2 U) Z( u8 ~% |
& s- P3 ~: ]1 Q2 IAlthough this trick calls the CreateFileA function, don't even expect to be
8 J% h% e1 A6 R! b/ e6 H+ kable to intercept it by installing a IFS hook: it will not work, no way!
8 }  J4 i5 _4 e# i3 T9 E2 H# dIn fact, after the call to CreateFileA it will get through VWIN32 0x001F8 V, `% B* M5 @$ J" N
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
# t0 \8 R# x  \. }and then browse the DDB list until it find the VxD and its DDB_Control_Proc
# _  F; o  [1 _field.
2 O' H$ T7 n: T) m% q2 V% n' a$ ]$ VIn fact, its purpose is not to load/unload VxDs but only to send a 4 t( c7 P, P3 ?
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)5 I7 F5 H( i; z" }9 o8 q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try* `, Y+ w  j& e$ v
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
, R: Q2 D% u1 H3 M; X  D& E" VIf the VxD is loaded, it will always clear eax and the Carry flag to allow
+ n$ w$ E1 z$ N5 l" x0 kits handle to be opened and then, will be detected.
! W; j4 S( D4 o8 |* ^# PYou can check that simply by hooking Winice.exe control proc entry point
' j, z9 E' t4 mwhile running MeltICE.. D% i( {4 x5 r5 f- U. M

0 z7 I$ e. Q# B( {. a6 a, Z- n, X6 a* q$ X6 p) r9 f$ H* i
  00401067:  push      00402025    ; \\.\SICE
5 n, M3 t1 n2 a8 E! ~; o  0040106C:  call      CreateFileA
+ P2 K  f- a9 E, K- O  00401071:  cmp       eax,-001# S, i% D% ~# l
  00401074:  je        00401091
3 a3 M7 j/ ?0 q5 J. J, b6 c2 L! W* m4 E& S( E

; `, L* b! w& Z# D4 G7 D5 B9 yThere could be hundreds of BPX you could use to detect this trick.
, b2 W# s' b" P, j-The most classical one is:+ X" {7 o$ E0 I: k1 d! P! I7 `! Q( f
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 s0 o# |% ]9 Z: P* p    *(esp-&gt;4+4)=='NTIC'
" M0 C5 l, K# f4 M* h  a( B6 G$ n$ q6 I) z
-The most exotic ones (could be very slooooow :-(
) O6 U% L. T8 c# R   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  7 T" }8 t7 i# O: c0 k6 s
     ;will break 3 times :-(" @8 K7 Q' `9 a

5 a9 [6 Q$ a5 A- t" g; z# _-or (a bit) faster:
; w/ F, |+ i* O   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): E9 L- l  z& {" _2 g

/ c$ W3 D% y2 t4 Q+ I9 ]   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
( Y) M. B7 a/ Q$ h) @9 C     ;will break 3 times :-(/ l) T9 r, W6 N! h
6 ]5 L- f0 N% u$ h- L
-Much faster:
0 Z1 T8 E+ e+ L) g4 U5 J   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
3 E8 e( Q& k9 z' H( R, t2 n
) C( R2 C! [7 s0 G4 nNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
6 v' u! w' B# H1 w8 {function to do the same job:
: Z& ]8 S- L  e$ U+ q
9 \( Y/ D2 L. u5 R4 \$ e' F) G# q   push    00                        ; OF_READ* b$ @6 E5 b+ _, X
   mov     eax,[00656634]            ; '\\.\SICE',0
: ?) S& `6 \8 d% z9 x, `   push    eax. a# \/ X9 k/ N! Z& @
   call    KERNEL32!_lopen) t- l) }! a6 _
   inc     eax
# a* a' q, E4 d5 G5 g   jnz     00650589                  ; detected
% b. \/ C' |- R$ c* y- p% N' b   push    00                        ; OF_READ
" `7 O" L4 J! E8 T* U: T" T" N   mov     eax,[00656638]            ; '\\.\SICE'
: \8 d! g. h/ z8 u& M5 \) v  M$ m7 |   push    eax( j& |! x: X* q3 K) T+ f; q
   call    KERNEL32!_lopen
4 o0 K) J- X  n( B' F" C- n! g   inc     eax% S$ P* \$ K& G+ @# Q
   jz      006505ae                  ; not detected, ], f( k# @! j) U! i9 o$ R# X$ k7 o2 E
; ]' n+ ?. X) ~$ c& h$ O4 {

/ B/ ]/ O6 _, Z, [) X- y__________________________________________________________________________7 {6 f: K, ^: }  A& P; c' [; h
1 {/ y% s( Z' \9 V6 m8 ~
Method 12& a" N& J) ?) d* \9 B# V+ b
=========
9 W1 E: Y4 f. \% ]9 L6 H0 c+ p% d2 z+ p; t* K7 [
This trick is similar to int41h/4fh Debugger installation check (code 05
$ I9 Q% s0 n* Z2 j&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- F5 w1 f5 k' vas it uses the VxDCall backdoor. This detection was found in Bleem Demo.% F- u" }3 I" `# l  Z5 Q3 |

1 ]4 D) a) V1 n2 W: [6 K   push  0000004fh         ; function 4fh
2 W( O% i6 R# k& |1 m   push  002a002ah         ; high word specifies which VxD (VWIN32)
6 M" D/ J; |+ O3 k                           ; low word specifies which service
2 F' r8 y) P; \# ?* ]4 l1 I9 h. Y4 z                             (VWIN32_Int41Dispatch)
; A0 G5 A# L8 l: R   call  Kernel32!ORD_001  ; VxdCall
2 q8 s7 R8 k# E   cmp   ax, 0f386h        ; magic number returned by system debuggers7 f* P2 K5 c& J" `4 R
   jz    SoftICE_detected
/ X4 y7 V  P0 m3 F9 c$ @: _& l( W4 J/ n5 B% @: G0 M
Here again, several ways to detect it:+ h7 V$ f% T" C/ X. C

  K: m0 i3 G/ t8 A. d- [    BPINT 41 if ax==4f
! m* k6 v+ N7 ?; B8 Q+ M/ \* j" B" e! j: _: R+ I* A* a9 M
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& f! C' R. d. G3 q# [4 t8 L8 {- _2 L5 j$ {+ c
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ I' b9 v- i4 d8 D- H8 ?
. G4 c4 M# U, L( C1 ^
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
% J( y$ [+ \- }' ?2 y7 m/ {# a# H5 x
__________________________________________________________________________- _3 Q% W* H) s2 o3 v% M
4 B/ H3 Y' o) f7 o+ L4 g# H# ^
Method 13' U; Y) r6 I: A4 k$ ]! ]
=========
( ?0 L" F" x" t( m& _* o  C$ W. y2 K7 M' T# W  W
Not a real method of detection, but a good way to know if SoftICE is
6 ?8 b1 r& u1 v/ Pinstalled on a computer and to locate its installation directory.! Y0 S; S' s0 J7 R8 k+ S
It is used by few softs which access the following registry keys (usually #2) :8 [* Q- [) ]' O$ }% P4 V
/ l  a8 ^$ U% ?+ h1 I+ \
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( W8 O! i4 d% g5 J& [4 s
\Uninstall\SoftICE4 n  L1 W3 G- v! {6 d
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* ?' F3 Y1 m: L2 G0 q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, d5 {2 V; n8 _* Y% I\App Paths\Loader32.Exe0 }3 _0 D! g+ }- [

6 S8 V8 \$ ~$ x* `6 z) z3 e' v' ?
5 g. V7 c5 v& j$ c: [: qNote that some nasty apps could then erase all files from SoftICE directory" l7 K2 f: Q9 Y, [3 ~- `
(I faced that once :-(5 a5 e& W3 V9 ?0 J$ ]

8 e3 `2 ~# S9 j4 CUseful breakpoint to detect it:5 o6 B+ \* s+ c( ]

6 f  i) t0 H, z/ b     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& E+ j: f- m/ O/ \2 x' i
% O: \; b  c2 T- N6 r__________________________________________________________________________0 W, s+ j7 ?* {4 |8 ^0 h" M9 d/ P
: u" r$ |" P, d+ n

% p. o: c. k7 n# Y/ UMethod 14
' c* h5 H0 S* B& Y=========
3 ^& D$ O$ V  Q: {4 u
8 F8 [+ w4 u8 E: jA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 D- [1 V& Z: s! Pis to determines whether a debugger is running on your system (ring0 only).
1 L1 m1 d4 L( X& j: J+ L+ ^0 I) M0 f4 P) O( z
   VMMCall Test_Debug_Installed" \' v0 {& q7 e9 W& m* r
   je      not_installed/ r, S& H: }4 A; x8 H8 O: ^8 B; l

- Y% p5 K" r* g2 U- oThis service just checks a flag.# \9 h& i5 W& ~( E2 r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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