About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 o$ F0 Y5 G0 v0 h
<TBODY>
8 J& V7 k. I; [3 G% B4 N<TR>! C" j8 ?% r& ?% k- k/ ]
<TD><PRE>Method 01
" |4 ~* u3 o$ A& x3 t& N5 Z=========% ~2 F8 C8 i$ X6 x# N' y- X$ d9 J

0 \0 T/ t1 J$ JThis method of detection of SoftICE (as well as the following one) is5 P% L1 t3 |) w+ A) Q
used by the majority of packers/encryptors found on Internet.7 ^' p: t. q: u, @# i9 q4 _3 F6 F2 ], X
It seeks the signature of BoundsChecker in SoftICE6 Z8 P. T+ N& S1 P

9 l* |0 [% J) D/ B    mov     ebp, 04243484Bh        ; 'BCHK'" B# d1 a4 k% T* J- F
    mov     ax, 04h  t7 t6 T6 g, N. g4 X7 y
    int     3       % s0 r4 _* a( `8 c$ E# B" y( I4 d9 e
    cmp     al,40 F% P; N6 S7 k1 `' b4 R
    jnz     SoftICE_Detected
: a, w5 D6 |9 a& \8 d5 z( [5 J% I, e& T3 M& N# E
___________________________________________________________________________
$ ]* c  |' P$ O/ f3 I# K5 j  Q6 H0 |& X7 G
Method 02: \* B% I9 d) n# M, Q3 d) I
=========5 O. e6 P' T: x, N0 E" {

! M& o" a  i5 a& }2 Z3 zStill a method very much used (perhaps the most frequent one).  It is used0 P! r* o# K, M# X/ s4 B8 t
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,# N4 T- P: z; I( P/ m2 Q
or execute SoftICE commands...5 K$ S+ b8 e. u/ A4 Q/ A( Y
It is also used to crash SoftICE and to force it to execute any commands
, Y  Y; W( o  x1 z9 Q: A(HBOOT...) :-((  
# W/ x, H+ U# I9 q
% }9 Q- b5 H8 k8 x. q0 EHere is a quick description:
+ ^/ @  ^2 {& p+ C-AX = 0910h   (Display string in SIce windows)3 U% m+ L$ ]7 Q7 p' u6 T
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! ]& Z+ J; h6 L-AX = 0912h   (Get breakpoint infos)( {0 b: v; F+ M2 h
-AX = 0913h   (Set Sice breakpoints)
6 C8 c" Z# m# O+ I( ^5 [& t-AX = 0914h   (Remove SIce breakoints)
2 O, q5 Z( w: k( g
7 s$ p! o5 ~- z5 g9 y& a7 f0 v6 zEach time you'll meet this trick, you'll see:& H  H2 Z, `/ O" ?$ _- D; P& F
-SI = 4647h+ I) d/ I# R4 |, t4 J% {
-DI = 4A4Dh2 x% n- L+ u/ h% ~9 Y& j& J
Which are the 'magic values' used by SoftIce.
' B( }2 v8 X" ~* J+ s3 }$ SFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 y6 p; S0 ]4 p( Z9 w2 i/ G
8 m4 ^4 e# Y+ ~) C' o
Here is one example from the file "Haspinst.exe" which is the dongle HASP8 U4 ~8 {! p) M. Z  i3 H5 t( i
Envelope utility use to protect DOS applications:
, H0 \$ P/ D# Z0 H4 z; U& F2 i5 Z0 C" b

$ E/ j& }$ c% d) v: Q1 l* N4C19:0095   MOV    AX,0911  ; execute command.- Q% ^3 B( I9 a8 H' D
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
8 @1 j; O$ A; `! q5 E4C19:009A   MOV    SI,4647  ; 1st magic value.
7 }) J4 J' \' ~- Q5 y# k, D4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
* m9 p3 `$ q* p& G0 X' R# [# h0 C4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: q8 a  a" D% D& L& N4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
( F2 Y. T1 l1 J; a/ G, a6 o4C19:00A4   INC    CX
6 S: ?0 e+ ?/ f* X7 l, X5 d) r4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
: O7 E  L9 S) @* J" m3 _4C19:00A8   JB     0095     ; 6 different commands.
5 |; t* ~  T( H0 W4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 o/ Y$ b: ^4 W1 `
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% h  L/ N+ I$ G% X2 O, J. n  a! U" A2 D* M9 v/ k3 a
The program will execute 6 different SIce commands located at ds:dx, which! e* `! a# Z, u6 c
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 Y8 {3 |* {! A
+ v$ {8 m7 `/ F2 H. T
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  K4 Q0 y( l4 N4 r
___________________________________________________________________________) |' R( ]% I5 q

! v: H5 a& w# [; y: Z4 v* T$ S: I" `7 W+ V1 X3 o$ n
Method 03
6 A/ }  L. Y- n4 F6 y& U=========
4 K5 j& c3 D/ z# J7 \3 J$ m
8 i* o* t( E# D% WLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
! o$ `3 L2 b  ^+ J; X0 ^(API Get entry point)
( ]- e1 Q( K" t4 W& q/ `$ V        $ Y$ X3 B0 K5 {$ |$ n

8 q# K1 f& a+ b  i/ X    xor     di,di; x5 {- ]0 O6 W( g+ o2 W/ Y- b
    mov     es,di
1 x0 M! q$ U1 a8 H    mov     ax, 1684h       ) ?# P; C5 N0 C9 f2 t
    mov     bx, 0202h       ; VxD ID of winice0 N3 N, r6 a! x' M1 _" i
    int     2Fh/ d$ A+ ~% W3 i) [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 Y9 I6 B  z/ s' p2 |$ d& I: Z    add     ax, di
0 A# N* ^5 k4 K9 ]$ W2 N/ a, M    test    ax,ax7 C# K$ g" Z4 G6 v# N: A4 U
    jnz     SoftICE_Detected/ n2 _! l. v- I; I3 P  L1 i- |
: e* Z' M% m; ?) u  U
___________________________________________________________________________
7 K9 m" ~+ X# a$ h- I* y5 w
" x6 M9 [! }3 F3 n3 ^8 `* N/ H/ LMethod 04
1 z3 [( B' {/ n, j7 G8 S- j2 P=========
9 r6 D7 |7 E9 L0 H3 {( o% i4 B& i) V+ w, X9 T; ]
Method identical to the preceding one except that it seeks the ID of SoftICE* _* Y& R0 p& u/ @+ T0 `% X
GFX VxD.
( Q" l/ ^( g- X) {6 S9 F" ]
+ A1 x, d$ [. ~5 ?; t7 O) A    xor     di,di
: c# p# k# o0 \; |' ?2 H+ q( R0 @    mov     es,di$ h5 Y: [+ p1 ~, k. O9 c. a3 d: e7 b
    mov     ax, 1684h       6 N/ j; O. N5 C* _8 [7 @
    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ C7 D1 I0 P- m+ E- w
    int     2fh
* k( i+ @7 j: d0 H" }    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" S3 l9 ~" b" i0 {7 ?& {    add     ax, di9 V) ?" c. B2 }5 \/ F* a
    test    ax,ax
+ C) M9 _+ h: ^- D9 w    jnz     SoftICE_Detected
% n; Y; ]& L) z+ T" {- A  M$ l1 `) q6 M0 J. y! o
__________________________________________________________________________3 n5 p& W  n; x  W. M1 U+ i1 L) l0 ]
' i. e2 U) A6 ^* ~% X. j% ]. P
0 d2 p' K/ }/ j* S
Method 05
( G& S9 Y* e# v  W% R=========9 E" M/ a. T+ k  R0 r, Y" a- w: U
8 P' _/ S$ A4 F. ^6 k/ A; j6 _
Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 [1 ?7 |# b) E' Z& Idebugger. It calls the int 41h, function 4Fh.
. P$ M5 a# N+ [2 K& KThere are several alternatives.  
; @' G  A$ E" L( h0 v2 V4 |% Q
3 ~6 W8 A+ B6 Y* x; a0 g1 s5 pThe following one is the simplest:
" F' Y2 V' D; `6 P3 q  K$ Q" ?& Z. B1 f  ?  Z( N  A
    mov     ax,4fh
' ], t. ?4 ?$ B5 x    int     41h. E) p6 r$ r0 U6 O9 j$ s
    cmp     ax, 0F386
, a" _# b& I( T" M    jz      SoftICE_detected
' G% i3 y, ?% R7 j8 h0 g3 X9 n& c  k% |

. I: H* ?* ^" J, ^$ u3 K6 a/ nNext method as well as the following one are 2 examples from Stone's 6 w: V, _2 ?& ^8 P4 M) c# x
"stn-wid.zip" (www.cracking.net):
: S) A( @7 J2 r3 S6 ?6 ?; N5 a1 ?; o1 a1 |0 U! K9 Y, a( R" f
    mov     bx, cs
! J. d9 t! H1 a4 x( W1 l  `6 D    lea     dx, int41handler2/ S$ I' T+ m& G1 O$ ]# r3 f
    xchg    dx, es:[41h*4]) V) @8 C2 y" G0 {- n3 H/ L9 k" G
    xchg    bx, es:[41h*4+2]$ g) q1 \* O4 F' f
    mov     ax,4fh
: U, l+ F8 p5 A9 c    int     41h
6 I9 W; h$ {, g2 T    xchg    dx, es:[41h*4]
3 g/ Q$ M2 I7 {, {+ B7 t: h    xchg    bx, es:[41h*4+2]8 k7 h% Y( V; R! ?( b/ y8 H) b
    cmp     ax, 0f386h
) ~) D" [4 R& {+ W* E% c' @2 ^    jz      SoftICE_detected
3 y! l" Z/ }7 G+ }# S" P* Y- a& m
' f) _4 d! j& H& Jint41handler2 PROC
( Y0 R0 o/ B- Y& \+ ?. B! m- ^    iret
8 z1 P' h2 O) U0 c" {int41handler2 ENDP% C9 p2 t+ o: S9 o5 j

+ k0 t) \. [* o6 C% J; Y3 z8 L7 o/ ^8 {4 J
_________________________________________________________________________
9 A) E; G& s5 i3 ?# ~+ `; }4 Z! U7 j7 k4 r" _' d% U
- v/ u5 T9 y3 v; J+ C, }
Method 063 _0 E4 [+ T4 }# g! p2 {% Z5 Y
=========
5 ~7 o5 v& r* E+ J4 l( a" X7 V4 N* z$ L

# M. |( V! e& _* [# ^( L2nd method similar to the preceding one but more difficult to detect:9 g5 k# l0 }) Q( b+ `
: ~& S% u4 ?8 k4 [+ b) ~4 T
% a* ]4 n7 M; N1 u- b/ R9 [1 k
int41handler PROC. J: X% o" S( U& G
    mov     cl,al
- v4 S4 r8 b/ x0 n# _) a( y    iret- [' z- V6 c7 l. V$ z8 T- v9 M
int41handler ENDP
! S' o: w. O# d: |' d5 S8 h- m
0 m8 d! Y3 w# ]) O$ \. S: g- h& N' g
    xor     ax,ax) |- c0 f2 k% d7 p1 S/ q8 k/ ]
    mov     es,ax
& }3 L9 t8 W9 j- `4 g; K" h    mov     bx, cs
7 G: P" ]0 {' E5 }8 l. `6 j    lea     dx, int41handler; ]. Z4 y8 w0 r0 z  S% S3 e& X
    xchg    dx, es:[41h*4]
1 g4 F0 T8 u/ F( n5 R9 ~    xchg    bx, es:[41h*4+2]! K  e6 G- K9 g& j8 L9 P
    in      al, 40h
4 S3 }$ M" b# N    xor     cx,cx; f+ C# W. s  |0 k. _; E
    int     41h" }8 s/ w/ r; m6 d0 S" c; q
    xchg    dx, es:[41h*4]
, f5 c. v0 v6 P; i( Y    xchg    bx, es:[41h*4+2]$ ]- S3 \, ?, Y" y5 D) b0 I) t' [
    cmp     cl,al
7 G5 f6 G1 h1 V    jnz     SoftICE_detected1 Z; X; I( E. ?% d! G7 V- Y5 r
( G* L) \( E9 S' b' w( O7 w! i1 L
_________________________________________________________________________
; H0 ]3 O9 p( ]% a# [" A' c( v" X/ l# {6 R. l8 [" S0 N. l
Method 070 _( a" U: A! k$ a% s
=========9 ]- \) L9 {4 v

  c3 z: |3 Z2 o* a/ @' PMethod of detection of the WinICE handler in the int68h (V86)2 k2 m1 p" P4 ]2 d

- q: P$ w3 w) H3 P; V0 q# P    mov     ah,43h5 @5 n+ e9 E7 G( h8 f6 F5 O; s
    int     68h
/ \: |3 e( O! v  I    cmp     ax,0F386h( n+ T- d( Z% I& q6 Y4 V8 {9 a8 \5 P
    jz      SoftICE_Detected
$ |8 ?% Y; V, |8 D& ~) q( D3 N3 H
2 Y$ m# M4 j: m. x- c! ?& U' S+ S& K$ |% _/ C# A6 Z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 ]7 N( ?) s& W7 Q; G9 |
   app like this:9 [$ i" U9 p. B

8 B8 w" |6 N0 L: `+ ]   BPX exec_int if ax==68
$ j5 o" Y7 @4 L6 W- W8 U" a   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 k% \! ~* p5 W& i( M   located at [ebp+48h] for 32Bit apps)7 @) D; B2 E" u7 X  M: L& T4 D1 D5 L) w
__________________________________________________________________________
4 n4 l4 `; S% B2 b
, A4 O  l# @& V) V2 C  x1 T0 v) L" A+ ^; U6 Z" d' ?7 c' y
Method 08
* Z3 M( a& h3 v) d=========: r% {( a  H% A" @/ G+ \

; g1 `6 m) y0 ~: |It is not a method of detection of SoftICE but a possibility to crash the
/ O! e0 X& @  O5 c1 v9 O+ ]system by intercepting int 01h and int 03h and redirecting them to another
, J) D9 o( e. U) Rroutine./ ?2 _" o3 d% R0 R
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
( s" g8 m8 Q( M9 @1 I4 x* @* sto the new routine to execute (hangs computer...)2 Y$ A' g' u) b! @3 X

" P: S! d+ `  E4 j. ^% I" w    mov     ah, 25h* s% k9 x( }* a! V
    mov     al, Int_Number (01h or 03h)6 K. I3 @' D# g% q
    mov     dx, offset New_Int_Routine) x+ R' J8 b6 j4 r
    int     21h
# j4 Q( v- k( c5 {- c
+ [6 G7 E+ D; ?- k( f__________________________________________________________________________$ L1 g7 T) J/ B* B1 p
/ Z# C1 o7 ^2 \
Method 09! S0 h1 [/ T! D9 p$ A* _6 Q; ]5 s; P/ X
=========# b2 i$ T, f& h; \$ [
- u6 N+ l0 K: \" B0 a; K
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) ?. Q6 k1 H" t; R; b# E
performed in ring0 (VxD or a ring3 app using the VxdCall).
% h! C9 B5 v0 U7 H/ }1 v1 }The Get_DDB service is used to determine whether or not a VxD is installed
( c$ n3 |! E- ]5 M5 M% q$ Kfor the specified device and returns a Device Description Block (in ecx) for* O9 b7 Y/ [  D1 O8 b: o  o
that device if it is installed.
# m  _0 g; C+ e( A& `* l# R; w
2 W0 }$ A) ]9 F. u  s( \- W   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; A  F0 R' h9 a- g; \( j   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
. s' I& y' N9 m. \! a/ p1 E   VMMCall Get_DDB
  }2 L7 Z( g; D0 x" r+ s   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! T2 H3 u2 C6 a2 v& I% R1 u

2 a3 C6 R: q6 [& aNote as well that you can easily detect this method with SoftICE:
3 o9 G9 n5 n; E0 h5 ^   bpx Get_DDB if ax==0202 || ax==7a5fh
% @0 D+ w+ ?, u5 r$ i7 x% P* B. N
; M  }, [0 X1 D__________________________________________________________________________7 G: a6 b! R# M9 Q7 q6 l* g
' `, v8 v) m( h. D4 I9 E) P7 P5 F
Method 10
' y9 Y+ Z4 Y: H" C; I* L3 _=========
5 a1 B+ m7 ]5 C4 m- A  j/ E& E* O5 _/ z; m  q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 W" @: h& p' c/ u7 [* A7 [  SoftICE while the option is enable!!
+ h6 i  X/ R: C6 n  f& ~! k
" m. A, p7 }/ M& gThis trick is very efficient:* s$ r5 D  F9 k9 a! b; k
by checking the Debug Registers, you can detect if SoftICE is loaded1 T$ P4 J$ U; a+ r: D4 R1 c% ]
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ P, R8 F! e& P  F' }! u8 G
there are some memory breakpoints set (dr0 to dr3) simply by reading their$ }, r+ ]- m1 m$ Z( ]2 ~
value (in ring0 only). Values can be manipulated and or changed as well+ P* |0 ^! }! C5 s* J% X, F% m
(clearing BPMs for instance)6 y! N+ e, L& L+ z- x; V
$ c- t2 b% a/ V( _2 _
__________________________________________________________________________7 i6 B$ u0 R* o+ r0 ^
  c, D6 G* X3 x- s+ g
Method 11  d, b/ D  {7 S6 H
=========
1 U7 @& u- Q- [/ h- v+ Q5 m2 ^. R# I7 {3 W9 N4 i
This method is most known as 'MeltICE' because it has been freely distributed0 t; q+ B  k0 T2 N- \0 @
via www.winfiles.com. However it was first used by NuMega people to allow- u* }. |0 S/ X0 a' t  ^- p# a2 a
Symbol Loader to check if SoftICE was active or not (the code is located
) ?7 X% h! u  T- a! C  t- Yinside nmtrans.dll).
" j' g6 {7 D+ R  o5 q1 ^
& j/ l  B* o) d4 B# @7 r/ |The way it works is very simple:
1 E3 m2 {' @- y1 {It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; ~3 m# V) `2 f7 y3 b- V" E3 @0 tWinNT) with the CreateFileA API.1 u1 B' n# C1 _* i* ?
1 h) G: g1 m* r5 Z, R9 j
Here is a sample (checking for 'SICE'):
! `8 O) T# ~  H! J- n6 M0 E" k+ e0 k* {: A  O
BOOL IsSoftIce95Loaded()
2 w* ~3 a; T/ d* a{1 c  E) @, Y2 ?2 y
   HANDLE hFile;  ' o6 A6 d4 H( G  v
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ j' j( a5 x/ {8 ]6 W
                      FILE_SHARE_READ | FILE_SHARE_WRITE,4 ~* R4 _. c- u
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( i$ l9 R4 O; u: Q- ^: c
   if( hFile != INVALID_HANDLE_VALUE )
& L; q* l- X( _7 e% Y# p# `, T2 e   {
  Q* L# ]& Y; g- f9 `9 ]      CloseHandle(hFile);3 v, M# h: b* @+ P, J0 C. l! b$ e
      return TRUE;0 @. n+ a2 l2 Z" Q7 `1 D$ `
   }
* ~1 u7 U7 T' h# [   return FALSE;
* H  i7 s. y4 e$ y! i, ?}# |0 x, s) g' t8 ?( U2 L, t
, ]+ j6 l6 X" j/ G, \
Although this trick calls the CreateFileA function, don't even expect to be$ y$ i8 [7 @# ^. t0 P) c* L
able to intercept it by installing a IFS hook: it will not work, no way!
, E; D8 {  t) h; L3 qIn fact, after the call to CreateFileA it will get through VWIN32 0x001F1 r7 |0 j( ]' o; j  H- l9 F
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)" H& Y$ d9 F5 ]! Y9 B0 [! r
and then browse the DDB list until it find the VxD and its DDB_Control_Proc, s: M; z" y6 }6 E" q
field.
: Z( G8 C% C' y4 O# M' {In fact, its purpose is not to load/unload VxDs but only to send a
( t! `; f( x" x2 i7 [W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% D( P6 G% U; D& k: |$ W4 l
to the VxD Control_Dispatch proc (how the hell a shareware soft could try* }# D% g+ x# i6 W4 |
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
. K" B: d' T8 W' @6 t/ _. r3 q. W6 mIf the VxD is loaded, it will always clear eax and the Carry flag to allow
. {3 c; j# P* c2 sits handle to be opened and then, will be detected.6 a4 `. u7 Y+ B1 F  k
You can check that simply by hooking Winice.exe control proc entry point
' i( f( K/ k4 lwhile running MeltICE.
  H7 G$ t: ~7 N- u9 a' ?+ T& d7 _0 K. @% ~+ X
  `/ U4 c% ^- A
  00401067:  push      00402025    ; \\.\SICE
6 ?, [5 l3 H( {% M+ v  0040106C:  call      CreateFileA& E* {% @7 b  `, ^; G% N4 t
  00401071:  cmp       eax,-001
, x; H; D* d: m# o  P$ _. y3 C  O  00401074:  je        00401091
* t$ J# V3 B5 h% \# _4 H: S1 R) Y; i7 x$ U6 U

. _0 O" F+ L2 p$ @& u) i) yThere could be hundreds of BPX you could use to detect this trick.2 J8 j: u. h% n% `
-The most classical one is:
, a0 N6 F: f/ a  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
( F4 Z, N1 c4 v; K; g8 J/ |  V    *(esp-&gt;4+4)=='NTIC'
; {1 _/ O# t- x5 f0 u$ \
& L- T2 X' l% W2 Q& b; \-The most exotic ones (could be very slooooow :-(
# \# P/ z4 k4 b7 z/ @" z   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, q: L3 \& O8 p- x     ;will break 3 times :-($ e! `7 n' c- v1 P* p; v; d4 H8 f0 f
* T9 C# s! f/ T1 l
-or (a bit) faster:
- o7 k( W; z( v4 T& x9 H   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
* l4 b3 G) D" V1 I; x7 }; P& ~2 J. a9 i
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& R% P; A8 L4 Z( Z* d' ^$ e! h" ], f     ;will break 3 times :-(
+ |) l5 [/ X* g8 l+ K  V
$ t8 F: ]; l! M9 R-Much faster:; Y# ~3 q% O% d3 }# d$ Y5 r3 R
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ G" C  \0 Z' c: S$ B, Q% P0 h$ g: o# q( c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen) j/ p) ~( h/ H: J8 t+ Q8 Q/ X
function to do the same job:& n% |! g# y9 x. Y. s* o/ U
# ]: y8 E7 G/ l2 _- b: Z. g- M
   push    00                        ; OF_READ
2 f5 @# e- i7 z/ i8 y1 T* }$ d   mov     eax,[00656634]            ; '\\.\SICE',0
& C$ A; d5 \; p# |   push    eax  q) C2 a3 q% V# i- ]
   call    KERNEL32!_lopen$ o6 k- D- j8 J& Y. T3 X$ M& n- @
   inc     eax* y8 E  o5 b& S( R$ f. b6 J
   jnz     00650589                  ; detected
0 `# W  M* H& i6 l   push    00                        ; OF_READ
6 u9 m) T/ C0 F8 @7 P! U9 Q   mov     eax,[00656638]            ; '\\.\SICE'
$ s" l* Z6 Q1 A9 N0 M) u' z9 ^4 j   push    eax9 t8 p  C. V+ k. A9 x3 G; v
   call    KERNEL32!_lopen% `1 C1 D- D& ^& U
   inc     eax
3 N0 S7 ]1 e7 `+ S8 i1 O+ b7 z   jz      006505ae                  ; not detected
, o! V. M. D" K, {# i6 \" ^4 U0 D" _6 ?* }- Q7 {# X
4 D! J& w& X7 K. k5 k
__________________________________________________________________________. _4 b& }% f' U9 ]2 N

' Y3 f9 o9 K; fMethod 12
  r, b# G/ P: l% _=========
. g3 P5 C5 r- Z: m
! }, z1 k/ E7 _3 bThis trick is similar to int41h/4fh Debugger installation check (code 05( x# ]5 r9 y4 m& M; u, z
&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 {3 T. t3 W4 f/ m) e2 t: o, m
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.! R; W! S/ ?) O' T2 \4 \( Q% o
6 J/ Y6 d8 g1 {: t( W5 I
   push  0000004fh         ; function 4fh7 w3 ^# }$ P5 i# d/ C
   push  002a002ah         ; high word specifies which VxD (VWIN32)
$ G) A: H- q1 o                           ; low word specifies which service
7 O: G3 [; i$ h/ d- R; n                             (VWIN32_Int41Dispatch)# Z0 `# G0 d1 L% @+ n# K
   call  Kernel32!ORD_001  ; VxdCall
; S) k5 T- N6 N$ ?9 G4 H# L" {   cmp   ax, 0f386h        ; magic number returned by system debuggers- g' N' L( z+ K* C8 x- u% {
   jz    SoftICE_detected& E: {- G) e/ k( w. C# _- O& m

% E; L# ~. @- l9 [; J- U& k) ~Here again, several ways to detect it:
$ B0 B9 |4 H- T' M7 P; P. _; X4 q
    BPINT 41 if ax==4f
# o- `7 h# @* C( {( H: h7 }
8 }+ ]! ?% P) m: Q7 Z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ U% R1 s+ g# ~: c9 F

+ i+ P3 V; A! N3 S8 J. n/ {    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
( ^  ^  U- E% c) P& t0 s4 F+ H" J; R5 s4 m. t$ g/ G. v4 }( B
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) H% @# C! _0 l  r* A) F' q: p
+ ^5 D4 N$ p" C' }# F% `* f__________________________________________________________________________/ }4 i9 t' R7 l9 ^% G1 d

  `4 \9 R; n6 y, N' TMethod 13
, ]3 c1 F% z. |) |0 o=========
9 @+ }  {( t" o0 k- ]
, D5 |9 [* i; ]/ z7 _4 ]Not a real method of detection, but a good way to know if SoftICE is* J3 p1 [: l# y( u, j# a; P* F. V
installed on a computer and to locate its installation directory.6 h; e5 b/ g1 m8 q- V4 [; [
It is used by few softs which access the following registry keys (usually #2) :
1 w0 r' A  G7 N
& ?/ d! I1 v# {) \: g- f3 K  J-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 ?6 h: t2 b8 X' c( ~  P5 ]
\Uninstall\SoftICE
( R8 J8 v2 l# R( b6 ?, w' K' c-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* r( |- }' Z& E2 p; f4 i' a- ~: t
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ e1 G: Q* @% N' b6 Q' {0 f; A1 q\App Paths\Loader32.Exe$ e7 c( E, N  t/ |" ]; t

6 ?0 B' v/ Y. ~/ |+ t! @
6 z/ J# ~9 G5 L1 B$ l7 Y" _- QNote that some nasty apps could then erase all files from SoftICE directory
* e( |! {. s# f0 U7 q(I faced that once :-(
0 g5 ^7 p' e" K  S% F  J; _; [- x9 |0 D1 H/ p
Useful breakpoint to detect it:+ u5 u2 f. u- j/ s( m- s4 z' P
0 I* y: M& ~: L! |, e& A
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 Z; n% v$ b; ~# K+ j: }3 a
6 e1 A: k4 h0 \1 K__________________________________________________________________________
! a" D2 {3 q4 [" p
4 o: H9 u. k. I5 R/ v7 e
6 _- S* T2 U6 h3 y$ Y" \Method 14
  _, D' H# x% o=========
% |/ C* D9 @& x2 q* Q, N  L2 z! {$ g! z! ~( [# M
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 ?* [; z( e% m: T7 m* C% Iis to determines whether a debugger is running on your system (ring0 only).4 V) b5 T3 \7 `+ ^( |8 A6 d

* I6 R" V0 a) r  z; M" B* |# G$ M  g   VMMCall Test_Debug_Installed& @+ ~7 A8 l& Y
   je      not_installed) M) p9 W: ?$ H

+ M7 k9 }1 n2 U0 d' _1 lThis service just checks a flag.
4 A6 j& ~4 G1 y: y2 u( [</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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