找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" A' V% |; R' {. B+ a9 \
<TBODY>
: S: S6 D9 T: i) N<TR>
" @8 s8 ?+ A; ~  H<TD><PRE>Method 01 " q: c$ s; P! G$ i2 P
=========
8 E8 n9 G7 H" [. }2 U& }, o; R1 h, q' @
This method of detection of SoftICE (as well as the following one) is* X! [* J  M* H# s
used by the majority of packers/encryptors found on Internet.( c2 j; i; }8 N
It seeks the signature of BoundsChecker in SoftICE6 A1 z0 h" P' z8 T. ~0 Y
% t2 r" E* I2 ^2 c5 v! B, e+ x  ~3 U
    mov     ebp, 04243484Bh        ; 'BCHK'7 {) W6 |, X& F0 t
    mov     ax, 04h
. `1 ?; Q/ n! h- v- @0 p# O9 @    int     3       ( M2 e% C+ D4 l$ u: t
    cmp     al,4$ n* \0 g; M9 J( P, P& |
    jnz     SoftICE_Detected
/ ^+ {9 n; p" b0 B1 z6 k. @4 {; a. |0 _! K6 H. f' d  j( G
___________________________________________________________________________( W' C/ L1 L0 T; ]1 v; |
/ F1 Z0 b0 Y7 _$ o" L8 g) d
Method 02
+ i$ w: f" s9 Z0 B3 e' S) a. ~" k7 h=========
! N8 e! N* X/ W" b6 j& t6 y) _- e) U: K$ v+ Z
Still a method very much used (perhaps the most frequent one).  It is used, P  ]2 R& k2 d
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,2 B& n9 `- w& I! q1 s2 L
or execute SoftICE commands...
7 x$ g3 i% J" C- @1 l6 ZIt is also used to crash SoftICE and to force it to execute any commands
( x9 r) C1 k9 c1 \& ]% ~(HBOOT...) :-((  
, K* k+ m) ^7 Y, }
0 L% m$ F8 P& _Here is a quick description:9 q2 d- a* j6 ?9 Q9 c9 t
-AX = 0910h   (Display string in SIce windows)0 {9 ]5 ~3 ~9 q2 ?0 X6 M" R  ~
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 }  b8 n. D! f1 W% _-AX = 0912h   (Get breakpoint infos)
( Y" f' h7 r3 v* l8 w2 b-AX = 0913h   (Set Sice breakpoints)* m) ?2 v9 l7 i9 n% s
-AX = 0914h   (Remove SIce breakoints)4 i5 f  B& |6 |1 Z. J

9 x0 U) n3 l. S9 h# QEach time you'll meet this trick, you'll see:1 ?# }0 W- A" G
-SI = 4647h* Z  E9 l9 D. W
-DI = 4A4Dh2 y4 |* j# o2 I. ?
Which are the 'magic values' used by SoftIce.% R4 d. z' H( E% g% o. i. e, ^
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 @& t0 E$ n! o. @; |
7 l( c; t% r, q5 @Here is one example from the file "Haspinst.exe" which is the dongle HASP( B& ?" J; o+ W' l
Envelope utility use to protect DOS applications:2 T* I2 w+ X& B, |3 g
, S: q1 h( Z. J( ?/ ?7 M, e

' O2 T! [2 {/ r$ H. d4C19:0095   MOV    AX,0911  ; execute command.4 g" M: \) ~9 Z# |1 ~
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).0 _7 |. Z% B. B/ k. m
4C19:009A   MOV    SI,4647  ; 1st magic value., g0 Q" Z: n  t6 Y- w3 f, J% m  O
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 \2 P3 ?% ^  e- Z) m# M4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' O8 \' f% q  }/ {; H" z1 f
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) P/ C' }2 G  W6 q
4C19:00A4   INC    CX
$ C) f4 K7 E: a1 P4 [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
% ]/ D1 C0 E+ s/ k( X4C19:00A8   JB     0095     ; 6 different commands.
2 H6 i6 h: `$ k# O8 V4C19:00AA   JMP    0002     ; Bad_Guy jmp back., Q6 r1 N2 Y3 ?
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 c8 N5 E( j1 G: f9 Y

: w# a+ }& @  @" b' n1 }. W3 CThe program will execute 6 different SIce commands located at ds:dx, which3 l3 z% ~% k- `
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% e% i6 K5 \; {0 e! n+ l+ |; H1 Z) R$ Z. I: B7 L9 B6 R3 Q
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
7 i0 t; E5 i$ z) `+ g# A___________________________________________________________________________1 A/ `3 s" Q& h' @

8 ^. P9 J4 U& j' N% R& P6 S" g( M4 N4 i2 _/ H: z
Method 03
5 f& \3 h& l: t9 Q8 l& Q=========  \1 ~: X4 y' q, {7 Q
& u8 n0 W' q- p2 C+ c8 }% q
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 z. q: m* ~! i* k5 U- ]7 m+ O; @(API Get entry point)
- h0 a, U* R: D& d  P. [& ~        8 C( e+ c/ `1 C/ r
0 y, B0 P5 N, K& y
    xor     di,di& H6 r5 }/ f: k' v; m1 F! _# C4 z. Q/ t
    mov     es,di
: A0 O& S4 j/ s* V% ~6 e2 v" b    mov     ax, 1684h       , Y0 c, ^3 h$ e: c3 O4 e$ _
    mov     bx, 0202h       ; VxD ID of winice& K0 |. k# G1 @7 _/ r+ m
    int     2Fh
2 v) \+ ^# W0 E& \    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) y' R( i! E+ Y. R5 m" a! V    add     ax, di
4 b/ g6 C! u2 }0 ~4 L) o6 N# P* t    test    ax,ax
7 a3 `. i+ y( G    jnz     SoftICE_Detected
( ]: d' T) a* O6 [. m3 O5 u; n  x- _% p' i* @% v, |
___________________________________________________________________________
/ \  H+ g1 @# i4 {" m+ ]# l- C9 W  g/ h( A
Method 04
& F; Q  c5 k9 J! ?; H, a; A4 j2 Y# ?=========4 ?4 `& C& T0 _8 P6 Q
( V5 O1 e0 E9 z' N: B1 F
Method identical to the preceding one except that it seeks the ID of SoftICE3 P7 \$ ^$ q% R! [# ^
GFX VxD.6 Q; Q# @& S; T; C
( g0 G# e8 C2 K1 k* m4 }
    xor     di,di# m* h8 t! G5 H: {9 \# m
    mov     es,di5 m; _& f/ J2 K5 y9 j4 A( [
    mov     ax, 1684h       " |' }# k' W+ m' q9 ?/ a' ?
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
# @' M! _! s' m    int     2fh
9 x$ {/ m- P- ^6 k% ~5 t, D+ _    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- [- ^& T/ r! a6 P    add     ax, di! r, S! g( J  z6 y1 P1 y! F% {# j) T+ B
    test    ax,ax
  A+ ]6 N: ?' n0 L    jnz     SoftICE_Detected- Z$ u/ Z% `! D1 T3 R

# R) w+ J& x9 S( z" a2 D. i__________________________________________________________________________
$ x/ `( s" f+ h" b  p- B: f* p2 `. U5 E+ Y
; s5 f' \; \5 u; x) y  B
Method 05; o  |2 H& l5 _: c9 `* o: v
=========, ~( f2 A" S/ ?, l2 {, T

+ L: e3 t; X$ C8 a1 n. Y6 AMethod seeking the 'magic number' 0F386h returned (in ax) by all system5 S4 g3 O8 e# W! n9 r; r6 @6 f3 H
debugger. It calls the int 41h, function 4Fh.. r6 C5 l4 J( v3 u0 p$ Z, Y; F" e+ v$ T# |
There are several alternatives.  
2 v0 F6 Z' H* \0 b
7 f7 `7 S( i/ u" n7 r9 i2 }$ J0 C* RThe following one is the simplest:
% U2 W  P5 ]2 u4 y- i/ L! U3 k6 q1 M
5 x$ x$ ~* d3 w  p    mov     ax,4fh4 d2 F  W/ u, i3 _
    int     41h7 [0 V( D, |% N. U* t
    cmp     ax, 0F386
& D' N/ g8 `  q4 D: x    jz      SoftICE_detected
9 ]; D; Y" b3 U* z
. w1 D" a: |9 F+ I/ K/ Y7 m/ @5 @  e
Next method as well as the following one are 2 examples from Stone's 0 }! q$ q* x( u8 T0 _% v, G
"stn-wid.zip" (www.cracking.net):, H# ]0 c1 I' n6 g% j
/ }. P" v& \2 k' V  z/ }
    mov     bx, cs
) ]' J" O5 z( d# }    lea     dx, int41handler23 g9 E, Y6 U; F1 H4 c9 K
    xchg    dx, es:[41h*4]1 `" D8 f8 ^8 j/ e4 m0 \$ b1 ~; P; `
    xchg    bx, es:[41h*4+2]9 K) h4 f# A7 d: ^" C1 W
    mov     ax,4fh
3 s- E' ^3 A! q, S) b& B2 T# p" N    int     41h% L$ s. c0 ]1 H
    xchg    dx, es:[41h*4]
3 h. g% z( U7 x+ Q; K    xchg    bx, es:[41h*4+2]0 }4 K3 S. R! H8 M1 O
    cmp     ax, 0f386h
- _2 v9 D9 L; T9 g$ ~6 F' q    jz      SoftICE_detected" ]8 _, A0 Q  {! H/ x4 w0 H
5 U8 K0 h( [4 Q8 N7 {4 n! u6 `
int41handler2 PROC
. o4 D7 c) h& \( [    iret
7 K# }! H. w* v% s% ~& \int41handler2 ENDP: ~  L- Z* n# O) @4 l- E/ P

% j: q0 y/ W0 ]( h+ j& F# M* G( S* @2 b" Q0 y3 K% G/ r1 h
_________________________________________________________________________
7 a# M9 ^% q, _. L8 C; X8 K' Z0 M) ^* b9 p( `0 x7 U- [

( O9 V4 @; c( R% ^( {5 OMethod 06
( ^$ Y6 ]4 I! l0 ~=========
$ P% {; K' K- I7 ]6 K/ u% E
! \5 `) g+ K( E
: w6 t' L9 o) y$ M7 X2nd method similar to the preceding one but more difficult to detect:/ L' q; o; ~8 x! a7 Y/ M2 {2 K( M, d
. K/ X- V5 Y3 D1 N5 `8 s5 X

$ a6 M2 [- K' r3 r& r9 X" {int41handler PROC
" }# m3 b2 E" b/ ]( K    mov     cl,al
% r# e" i1 |: t, x8 X    iret
" _$ X4 C+ i& W7 F9 Pint41handler ENDP
- ]' C0 Z( A# R
' u# s4 W6 P% u7 C0 C& n  d0 C- i$ g: ^& R, y. {
    xor     ax,ax
/ e: D3 j$ a% M    mov     es,ax
. q5 q: {- W6 ?9 n6 j$ m    mov     bx, cs2 z- Y( j+ w: R$ Z
    lea     dx, int41handler2 |+ ^* P) _8 \* t
    xchg    dx, es:[41h*4]6 Q8 E: `& Z- r
    xchg    bx, es:[41h*4+2]3 B6 t9 B3 C' v
    in      al, 40h
; l: w# E0 w8 G    xor     cx,cx
# D6 r2 ?$ ]2 S    int     41h
& T9 c; b2 ~* i- O    xchg    dx, es:[41h*4]1 y: d- H- G" b! c" v  h" t
    xchg    bx, es:[41h*4+2]
1 S6 E, l: g# t3 v$ L7 ]" ]    cmp     cl,al
3 F8 V! x4 H% U6 q: d5 B    jnz     SoftICE_detected. S/ _! i1 D0 n" ^& b
1 y" Y2 Y9 F8 k) o0 z0 d* Y
_________________________________________________________________________5 _0 ^0 Q: [7 [* b( J  n0 `5 T" L
. R* p9 |- G  t6 M7 Q" o
Method 07
1 ~$ d" I2 Q( ^=========
' f2 J" g! x' E1 G
  {  p! V7 Z/ A: L, wMethod of detection of the WinICE handler in the int68h (V86)& M' k5 M5 q" f3 g; k+ h9 L
  X; b$ r& ~4 \; Z2 X# F0 p
    mov     ah,43h
- J! X$ N6 j$ e+ @* r* g/ e    int     68h
; t8 ?7 E. G1 }; q. Z' k5 G+ N    cmp     ax,0F386h5 R5 |4 p! F" C) @# i
    jz      SoftICE_Detected  A0 v5 q3 H1 J4 M2 k
6 T3 n) B3 Q2 w& ?# E: `. T
# g% s& N) T# B0 z# U$ P( R
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" F1 X& @2 m+ H( |; }; h% @9 `) y
   app like this:7 n4 ?$ g) `9 a3 ]6 P0 o
& `% F4 X# e2 e3 e+ J9 N/ X
   BPX exec_int if ax==68' O) B8 G& b7 s" r
   (function called is located at byte ptr [ebp+1Dh] and client eip is
8 ^& v8 @) L2 V6 e4 B  m   located at [ebp+48h] for 32Bit apps), P( N! d5 t4 C" |1 S" o: a% q
__________________________________________________________________________
& ~3 C2 D  ?5 y" X( n4 ~
/ i3 G, l$ U0 k+ _# N4 T0 L8 e' D0 O5 h3 u* O4 b
Method 08' n+ @5 e$ C; V; M
=========
/ L: @! J  j/ r/ r; h5 c6 }
3 [; ]8 ^$ m/ C, O, |It is not a method of detection of SoftICE but a possibility to crash the+ t4 `' o# w/ W' K  I# l8 T/ e
system by intercepting int 01h and int 03h and redirecting them to another
5 _+ o) Q) P; P. j6 h- groutine.4 o! G& W2 }' C) T+ n
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points! E  `+ g6 f7 g) Q# ^
to the new routine to execute (hangs computer...)
6 M# ]  i) b9 j6 P  V8 E+ }% f/ I
0 y' w8 E- N) {6 @5 r8 y    mov     ah, 25h5 Q* E  A' L; Y9 K8 m' s- J! Y( y
    mov     al, Int_Number (01h or 03h)
2 V/ S! a* ~% p( q0 O" I    mov     dx, offset New_Int_Routine% ?& K$ W$ B" K6 D* l
    int     21h
3 U9 Y7 g4 w, w0 y, @9 s6 z0 I- S7 L/ x0 F
__________________________________________________________________________
( z' b$ e& f9 N/ I0 |, Q& _% B) A3 v& A" p, m
Method 09
6 w7 W. n8 O; P/ w=========7 F0 o4 c  e7 v0 [8 O! M% g5 G7 c

( H* f$ }: Y$ o4 b. GThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
# \6 X' [8 }8 s& \4 s# m9 Hperformed in ring0 (VxD or a ring3 app using the VxdCall).
2 r2 g$ i! w% h) f9 fThe Get_DDB service is used to determine whether or not a VxD is installed9 \% Q" [- |. I. ^+ Y$ s
for the specified device and returns a Device Description Block (in ecx) for( N3 z, V( P: }
that device if it is installed.
& c1 M( }3 V2 |3 J8 G& d# r: o/ C& m! F" @" ?5 z. l2 ^' K3 P% N
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 {3 M) @* O9 \* }: y) k# x) N' ]   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 m3 I& f" t% G8 @4 g% a+ Z
   VMMCall Get_DDB
( U# F0 N4 L. x9 H) \6 k0 W   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% p: o2 a( s3 e5 Y, j

% [( O, Y5 t" d  {( [' j! PNote as well that you can easily detect this method with SoftICE:
6 m2 d4 y8 }3 _0 x( E: X, V" x- V3 j   bpx Get_DDB if ax==0202 || ax==7a5fh
2 m/ _! l. [2 v
4 z$ B, n; [' x  N' O" P% E: H__________________________________________________________________________
! U; }9 K% R1 \6 Y! W2 V) i) B7 a/ Q. {+ D" \6 \
Method 101 R& z+ A8 E, \" J+ d
=========; ~8 ^) j! d) F/ Y" N4 w: Y' I
9 w/ M3 Z) ]9 ]( u) j5 P+ G
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
! _3 Z2 U; R2 n- N1 O' |  SoftICE while the option is enable!!
3 T6 n, l2 c- d% c" {: V$ ~8 D
+ z. t, D+ ^9 P& \1 PThis trick is very efficient:
; O$ J( j3 Q# ]6 }by checking the Debug Registers, you can detect if SoftICE is loaded; q& a# T* F9 G9 A
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 b- Z+ ]1 Z' l% H6 i6 B' [2 gthere are some memory breakpoints set (dr0 to dr3) simply by reading their. n+ p' W2 f& s* d( u. C  D4 u; M
value (in ring0 only). Values can be manipulated and or changed as well
$ |0 U4 a  _$ T, A0 [(clearing BPMs for instance)
& }  F* C8 q% R1 y% R8 r/ k
- m- T7 L6 n/ V! @. q6 Q& f% @__________________________________________________________________________
2 x, i0 [) Z* d4 B0 O- U
! |$ e; R* S/ MMethod 118 w  g/ |5 X  I8 ]; `3 j& G
=========3 F* k5 H$ l3 H, R7 t  T5 q
" @2 B0 @. o. g" c
This method is most known as 'MeltICE' because it has been freely distributed: X6 o  y' h4 N  l( u
via www.winfiles.com. However it was first used by NuMega people to allow
, N! z3 [2 v  W% L4 y% B( vSymbol Loader to check if SoftICE was active or not (the code is located; \* e' M/ w( `  H9 b5 t& O; O, y
inside nmtrans.dll).3 u$ n6 H; \5 z' \, s
: e: X1 ]/ ^- x
The way it works is very simple:
. N: K; P1 J2 L- A* o, MIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
$ C5 F7 a1 B6 L/ TWinNT) with the CreateFileA API.- ]( @8 y* b8 C, B0 r3 ~1 ~: C) P
! K' e4 q2 i6 A7 R( w
Here is a sample (checking for 'SICE'):3 u+ n( [# |) P6 h
. f% a7 j( ], ~2 G) h/ z, n/ B7 _
BOOL IsSoftIce95Loaded()
, a; O1 Z; `' ?- ?. n9 {{; o  k# e+ l; l
   HANDLE hFile;    J$ Q  b% `% L
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 d( n/ i9 p# [  v" @5 A% M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 o0 S7 Z# x  g6 ]) q/ _( O. [3 R
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);+ _/ [" m5 _+ n% |
   if( hFile != INVALID_HANDLE_VALUE )
1 ]- v: D2 e7 Z6 b5 D: S- m   {6 W+ ?$ P2 |- F6 g) Q! n
      CloseHandle(hFile);
8 I  p$ }$ F- e1 {( v7 I3 z      return TRUE;8 l; Q% F* |8 W
   }: c8 u- r0 ^, x
   return FALSE;
2 e7 v  o* I. w3 E; [( f1 n5 M}
7 u  w% r7 ^( C5 [; U7 G$ _
, y4 K% r6 }" q! Y4 x  n) eAlthough this trick calls the CreateFileA function, don't even expect to be
5 G. @9 A8 ^% `/ e1 s# qable to intercept it by installing a IFS hook: it will not work, no way!! S) Y' l) R1 H* q; z6 X5 a: i
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
% b' C: B0 W& D3 |1 [& M- i5 Dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)$ I; L/ H* r# Q8 t% P, w9 w
and then browse the DDB list until it find the VxD and its DDB_Control_Proc/ U; i0 T: O* N5 w% x6 N$ M
field.8 g) i! Q$ K3 `  D( Z% D; z- w
In fact, its purpose is not to load/unload VxDs but only to send a
% E1 E- k8 w# xW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 F! f6 x( k& p# N/ d, W, L. K
to the VxD Control_Dispatch proc (how the hell a shareware soft could try! a. f; V1 Q. ]2 A. J6 \1 ]0 J
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
, L2 {8 P4 k: C/ v  T2 n3 w6 z$ QIf the VxD is loaded, it will always clear eax and the Carry flag to allow
5 f1 @) L% O$ R3 [! M' N3 E8 A6 F; Zits handle to be opened and then, will be detected.. P6 l& n! i+ b; l4 h6 d0 J, Y) f
You can check that simply by hooking Winice.exe control proc entry point
/ z2 N, \5 v; w; @. mwhile running MeltICE.$ ~, D$ b6 F& Z# x" L$ Q+ Y- Y1 P

0 M0 X6 j( B' B; j0 J. g. n1 }- Z9 w4 a& a' K
  00401067:  push      00402025    ; \\.\SICE
3 d/ P( G6 G5 ~5 x  l' f  0040106C:  call      CreateFileA
7 x% Z# o% P% \1 X7 }* U& T; m  00401071:  cmp       eax,-001
" Q$ X6 r9 i3 \" L& x  00401074:  je        00401091
! j3 E3 u2 e! i3 G$ `# v8 E7 n
' N' s( X& w+ A) y7 `  ^- A
# J2 _: p* v2 z6 i  z. A. S# GThere could be hundreds of BPX you could use to detect this trick.; n0 h1 \$ Q, l3 K5 e
-The most classical one is:
: P' F, }9 x: G  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
0 M+ @8 s* t6 b    *(esp-&gt;4+4)=='NTIC'+ w' ?  T; _! Y/ ~; T& r0 B) d. e( w
' m& g3 A* `0 d# B/ ~: }
-The most exotic ones (could be very slooooow :-(
* S% c8 Y% B8 s7 D   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " g8 y; l% G* X8 c9 }- x4 v+ d$ F
     ;will break 3 times :-(9 U8 t! e' }) S  [! A6 J( C4 B$ E

" I* h' r, Z: Q& h! ^" Z/ [-or (a bit) faster:
, ~' |5 K* o' m, ^0 [# @: I/ \   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! \3 d7 g" L8 L5 x' S$ {8 ^
% ~- C4 p5 x' P: D
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 v$ j6 f( r$ e0 a! [+ j8 T
     ;will break 3 times :-(' B& t2 w- N7 d, R7 ?
, X# A6 s7 z0 h4 t$ k
-Much faster:
$ a" n' r, c: o, l2 M: c   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
( p1 E! Q% T9 i/ Y% l2 T3 [# \& z7 g, Y& M9 y" U( j# P" q! v
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 Z" _; E" [. }; L- j  ffunction to do the same job:8 f7 j8 d6 s  Y
9 O) Y4 L1 J' D
   push    00                        ; OF_READ/ ?7 l2 T; i0 z2 K% |0 E! ]
   mov     eax,[00656634]            ; '\\.\SICE',0
# N. Y, J* {( N* W3 b% C   push    eax
' W( u+ u5 V9 N" z( L3 E, }   call    KERNEL32!_lopen: n5 |) U$ l8 M2 x% x
   inc     eax
- b; ?2 m$ s! l2 {   jnz     00650589                  ; detected
( V$ Q* U, B; Y( W' ^   push    00                        ; OF_READ
9 i- Y+ s6 V$ C4 k   mov     eax,[00656638]            ; '\\.\SICE'
& P% V/ s1 f) H, p8 K   push    eax+ n1 O& G) i. V7 x! ^0 Q
   call    KERNEL32!_lopen
7 q, C' P/ J0 C! s8 [   inc     eax9 u, b# |8 G$ h. G3 f
   jz      006505ae                  ; not detected
. ^( S" q5 m" q0 \8 E! V& k6 _& O9 M' q+ A& X/ N% |: n! e! C1 y2 p
6 a; B( H6 `0 E  b' b6 }5 k% j
__________________________________________________________________________, l& |) S3 L- ?

& y% b& x' y# v: lMethod 12
/ q6 e7 T3 G. G& ^# z=========& M4 p& ]% c# n3 D1 h# P. C

7 w4 N5 N" N5 F' eThis trick is similar to int41h/4fh Debugger installation check (code 05- B/ Y, b3 R& ]1 }( \( o- }
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( s# k( X- t8 |( W+ f% f1 Mas it uses the VxDCall backdoor. This detection was found in Bleem Demo.7 u4 r, P# V) }' m. |/ P" W* a

) y: `% X3 r8 H4 U/ I/ K  O' R   push  0000004fh         ; function 4fh% u1 M- E. ^6 Y- B2 e$ z8 Z
   push  002a002ah         ; high word specifies which VxD (VWIN32)" ]; d0 |/ z/ W+ _. x# @3 W4 J( @. d
                           ; low word specifies which service
7 N. R/ B+ V$ d- k& X& v( L: |                             (VWIN32_Int41Dispatch), d0 E5 l: L! a( V6 |& M' W/ z
   call  Kernel32!ORD_001  ; VxdCall
! N9 U: q2 A+ z3 q/ Z   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 L. ]$ F4 Y& b8 b7 p   jz    SoftICE_detected
6 K+ l, F& C8 G$ [3 y2 U1 X: x+ u1 j
Here again, several ways to detect it:- ~, q# [6 h% @
1 {' j+ |; C6 p: L' p, _5 r0 E2 v* }$ R
    BPINT 41 if ax==4f
6 D: T8 T: z5 u- @8 I- P
6 v! P$ M: r2 y- B3 K2 k& I% u    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 P) I" ~6 A( d4 ]1 U
: o# k4 \4 Y3 {$ d" K, j( H    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( z, f+ _- l8 ]5 r: Y

2 m1 {: L# u" D) m. d! J# r2 f    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
! y9 W. |5 p& a1 g/ P: A
( h( I. I/ C0 ]__________________________________________________________________________- J% f/ ]. n. k1 V1 m8 m6 w" @& _
" `" M% P6 r% t- |2 r( L
Method 131 o: W' Q) r, M$ q' ?5 ]7 [: S
=========
: s: V( ^' i; p9 T& X) S
& f/ F4 ~  U2 @& e0 ?7 j) CNot a real method of detection, but a good way to know if SoftICE is
+ {3 @& U) s5 F/ r/ v) }# Uinstalled on a computer and to locate its installation directory.
; R' ~5 u$ U0 p) GIt is used by few softs which access the following registry keys (usually #2) :
( f* B8 J) n& _2 u7 w! r
! L: V+ U! P" B' C* p/ O, n+ _1 V. W-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  f2 @% g" ^: g0 @. j\Uninstall\SoftICE
. N6 @4 \/ g+ c7 v+ f-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ X/ y2 a# F! r2 a- q' O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 K8 Y) |+ }& T5 e
\App Paths\Loader32.Exe# I# u  a$ p! n. i% w

2 s1 \/ t/ X6 u$ d! X- e! z* @$ {4 s$ s0 d: E/ H+ T# t# A  y; y
Note that some nasty apps could then erase all files from SoftICE directory7 a. Z7 H' l* }
(I faced that once :-(
$ I! _: |7 T+ g3 K% ~
; y; s( C# F+ _Useful breakpoint to detect it:( ~1 h4 `% {5 k$ \! S) C( X; H; T' a

! d3 I( c1 y/ R, y  F: M! l     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'( B; y/ e) T! Z) `+ P- a' b
4 X! ~+ B, Q1 {
__________________________________________________________________________; D* l+ D0 [/ q4 e6 I, x
/ O* t+ _# |2 l( I# o0 F

4 x' L1 z$ Y- v: d4 n4 Y2 `Method 14
, ]) k, E. x9 |* L+ D=========0 p% {, n: k4 R0 X6 B3 x

) B3 D: T2 Z" l, ]' H/ x7 c! ~- ~A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
& o' h: Y' y  J* \8 M3 |is to determines whether a debugger is running on your system (ring0 only).
8 y6 a) [4 E. F" ^: D
6 y- c" U% P: M  `7 F. u# w8 h5 H   VMMCall Test_Debug_Installed; h1 k) J7 K8 p3 I% t) s6 C
   je      not_installed
0 [# d8 a+ ]5 S9 F+ `7 y" u
3 Q. V5 v6 {! P% X6 F7 OThis service just checks a flag.# b% r2 x* ?3 i: q5 r1 R1 a
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-13 11:32

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表