About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; G) ~" p- _% s# m3 p+ L<TBODY>
+ N" N" W- p& O<TR>
9 K8 L7 n, @3 {  \5 x6 v. M0 Y<TD><PRE>Method 01
: `* N; ^5 d6 T6 k2 {$ x- a7 ^=========) u$ `* K. d" R" u* Q, p
; Z0 m  K  M, |% k3 M7 E- t) W$ M
This method of detection of SoftICE (as well as the following one) is
1 c8 ?4 w3 S* o, Kused by the majority of packers/encryptors found on Internet.
; ^7 |0 s5 ^, u; {" |5 F: G" m- s# VIt seeks the signature of BoundsChecker in SoftICE
5 T' Y, V3 c; G' R
; J) ?( w* E- n! r4 Q    mov     ebp, 04243484Bh        ; 'BCHK'
  ~, {, h. p* v' J+ O6 V    mov     ax, 04h
5 o- T% J  r. G' v4 w. d: S3 S    int     3       9 W- e% G  ~2 X+ j
    cmp     al,48 [& g+ N3 b1 ]1 N. W
    jnz     SoftICE_Detected9 Q' A/ L3 S$ G' `) i7 Y

3 E( D& P" y4 ], H4 C# j6 G8 P___________________________________________________________________________
; H$ q4 R: R. u0 V- k- F0 x1 Y" f" {( {7 }8 ^' a0 _! r- B" I
Method 02
; h6 f0 }' z% h' U% |1 r=========
5 u( f# |" ^- K: B; {' ?
1 F3 [8 o4 g6 F0 t2 NStill a method very much used (perhaps the most frequent one).  It is used8 I, q$ T" m, l) w
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
  q: e, B3 b. Gor execute SoftICE commands...& o( ~; p: [- e6 G* v* a! z
It is also used to crash SoftICE and to force it to execute any commands
% l6 A0 H) A) \8 r4 H7 [(HBOOT...) :-((  
9 W3 b7 ]* N0 @4 `% b6 \" O7 D8 @8 y) n; A1 i6 L7 q. V4 H
Here is a quick description:, T3 [# i5 z+ X. i  r) z! N
-AX = 0910h   (Display string in SIce windows)% l1 V) n7 E8 x/ E/ j; d
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); B' q6 x* F. q& q$ T0 Y; E
-AX = 0912h   (Get breakpoint infos); ]0 {8 @& s- K
-AX = 0913h   (Set Sice breakpoints)
& b" d# b* g7 _/ `1 |& V' S3 `- h-AX = 0914h   (Remove SIce breakoints)1 y. ^7 b) h4 f: F$ Y2 E7 N
7 a8 J7 E  {6 B2 g# s
Each time you'll meet this trick, you'll see:
8 Q: j& i& Z2 }' l$ h. T-SI = 4647h5 o8 j) R( J) I* J# V2 K
-DI = 4A4Dh- Q9 C5 m1 T& Y& l* n2 d
Which are the 'magic values' used by SoftIce.
% w& U3 }1 X/ qFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
8 k) ?( H3 F. X+ T( j" B" m8 k8 l( |7 f; L& M2 H; t2 R
Here is one example from the file "Haspinst.exe" which is the dongle HASP) L- D; ?: i; W. n
Envelope utility use to protect DOS applications:
( h2 }0 o. `5 x& g1 g& ?0 y
5 V4 M- S  y, o1 a, B7 g3 i
* B8 [7 D2 S) |. _( q2 o) l4C19:0095   MOV    AX,0911  ; execute command.
# K. S# l  ^! {! ?4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).! ?. J( R, J7 q7 E
4C19:009A   MOV    SI,4647  ; 1st magic value.
' ?5 ]$ f/ Y7 p4 B- p- c$ Z4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! W6 |: Q3 h, n- ]4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& b5 K& j  j4 H" l, `4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ K3 _. m/ ~) `" h% R4C19:00A4   INC    CX8 `8 A. S! l8 r# ]6 B1 Q
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- v. _0 N. U0 z( s4C19:00A8   JB     0095     ; 6 different commands.
% @1 l2 t/ f) K1 u4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
# s2 \+ h3 l  L4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  t; `/ [  \! m, P4 K4 O! _: f
$ A7 h* F5 \, i" n8 S/ j0 C. y
The program will execute 6 different SIce commands located at ds:dx, which
0 c6 g: K, J4 R# Jare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.0 ~- V5 o4 W0 ]; O7 T
+ @6 R% P' X4 Y7 y7 \
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' I/ o6 I4 W9 f9 o___________________________________________________________________________* d0 |8 a( D$ _& C0 t
* H& R+ b8 e7 f0 Z9 m) u  k

  i; N/ y+ u! f& rMethod 036 e) B9 f6 D* ]4 Q' ^7 F
=========1 x% }7 f  N6 p% [* E  \6 Q
2 n2 v$ c6 }6 f# `$ N7 O
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' v9 }2 e2 J) |' }) r- F
(API Get entry point)0 y% J. f: M7 g$ a# S" N
        
0 i/ N! _* V8 r9 L& C0 y9 X, K% ^. n! M+ |
    xor     di,di
: z3 ^/ f8 o, q    mov     es,di. V7 b! e' ~0 H* F2 C/ W; C2 f
    mov     ax, 1684h      
5 W! a9 _: k$ v8 C" t# a    mov     bx, 0202h       ; VxD ID of winice6 f' }" A  S, t/ h
    int     2Fh, `2 R  O6 X$ g# K+ e
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 w/ I! f! d4 g( M    add     ax, di$ I  \' Y! Y7 `7 w# E' ]" R
    test    ax,ax
1 W6 a0 V6 `; r    jnz     SoftICE_Detected
4 S9 Q# D8 [- b8 F7 v! V
; E% D+ |' F' j. v" ^9 e, S___________________________________________________________________________
# ^. i) T) z0 b, @3 n- ^& o( a# ^, p0 p# D+ B* U
Method 04
$ }/ \$ T* C) K- G& v6 @=========  k  X1 m' f$ ?) @1 ]
* X9 U; l: Q5 g' v
Method identical to the preceding one except that it seeks the ID of SoftICE3 h  K  B( l0 H4 k( i0 e) b
GFX VxD.
$ {4 D4 `/ H, J$ Z# f1 _4 \  R2 @; V* |4 x! }
    xor     di,di* Y3 n0 L" h  n. p  M4 e5 X
    mov     es,di! m+ o0 {0 ?$ q6 q, |% T
    mov     ax, 1684h         ?& v5 R: z: v: r( d
    mov     bx, 7a5Fh       ; VxD ID of SIWVID" {5 J- s1 X/ ]' _# P9 B
    int     2fh- h/ n, n/ e+ w6 r+ g# A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% z" M6 Q1 e( \  P3 Q! c    add     ax, di) m- i  h* I$ D1 X- h
    test    ax,ax! ~. z0 q/ ]7 r; q
    jnz     SoftICE_Detected
! N" j5 ]. H) ?7 g& M7 S
* {4 q  k5 D: J4 b# [) }7 K% U__________________________________________________________________________
9 W* @7 M6 O" b: o  \0 V
4 _; w/ l8 j7 E/ q
$ H/ A) S8 s$ w; n$ B; gMethod 05$ x$ O0 S  @4 d. p
=========
# b8 m% |! F; D) g$ I& a  z7 @& T& u0 n& U/ g# t
Method seeking the 'magic number' 0F386h returned (in ax) by all system4 X' p- z1 Y* ^6 V8 F
debugger. It calls the int 41h, function 4Fh.
; ^9 @# b3 s& i3 a9 RThere are several alternatives.  
; O! L! |2 ]2 S1 ^3 _' y+ k: v6 J4 X( k
The following one is the simplest:
4 \$ v% V( d* B1 D" f# M' w; y' Y. i( a# r
    mov     ax,4fh
2 {; r3 w" i* {2 X. @; @    int     41h
5 B  a1 ?( ]: i8 U' e    cmp     ax, 0F386
6 t& O! R% K* G. R% g. j    jz      SoftICE_detected0 ^5 |: ?. n$ Q( w0 T/ K
, m/ Y: X/ C9 n2 p1 \
* Z2 g  A9 ?% d
Next method as well as the following one are 2 examples from Stone's ' t9 ?% |( m+ r" e
"stn-wid.zip" (www.cracking.net):
, o/ |0 U0 s$ Y. k$ G1 k
; N! j' T0 d6 c1 K# S. M: z    mov     bx, cs
+ j  ?0 W: y3 F/ }    lea     dx, int41handler2/ D% j9 }7 S' R+ p1 ]- x
    xchg    dx, es:[41h*4]3 f7 ?3 U; ?% ^; k) T4 N
    xchg    bx, es:[41h*4+2]
0 u6 K1 u1 F5 F% p- ]& h    mov     ax,4fh- n& g3 p( n3 [/ P; ?, E; O+ n
    int     41h
$ b: e9 ?- E' S1 o" _$ R8 A# R9 d( ]& L    xchg    dx, es:[41h*4]4 {( S1 T$ ^8 c8 N7 p( i. D  O) K& s
    xchg    bx, es:[41h*4+2]) s2 M2 s/ U5 ?! d+ r: ~
    cmp     ax, 0f386h! `2 a( I3 K! W3 l
    jz      SoftICE_detected
4 T! K& s( J' Y7 T" f4 l; a0 ^
5 K& [7 S4 t$ _; D& |& dint41handler2 PROC
7 i' x. A# C$ Q$ V% b/ k3 [0 {    iret
- Y2 z- U! n( E( E: \8 u. [int41handler2 ENDP
: P/ ^# F- c5 ^6 G8 I
* h7 m' y4 j& L/ R5 T# r' ]3 p6 N3 g5 m4 X, a6 h! q
_________________________________________________________________________" O5 ]0 }3 K% M1 E5 g

( N$ E6 N2 F& B* f. c: i: C) r0 U! K. D$ h8 d3 @
Method 06. I4 p1 U' B- L) b& r
=========/ U* L2 j5 J; R3 [, u3 ?. O
! _8 Z: F- J- h" P; L' j: ^7 p

4 e, |6 z5 ~, l& }9 V  N7 c  a2nd method similar to the preceding one but more difficult to detect:' i5 M7 E- l6 u/ R# f9 s( N
1 O$ Z3 z# F& S
- T4 Z& b0 p, z  L& A! f1 x/ ]* Z
int41handler PROC
# D0 P% e% `1 O! E( o: M, s    mov     cl,al
7 C/ R* F7 X/ H' f. c0 A    iret
3 v0 S% @; d2 l* K8 y+ [int41handler ENDP
& k1 B, o5 W: S* i" i5 X2 _% o- @* F. w5 T' F# H9 X$ X; }6 p8 N& J8 e

6 L: n) W% ^* U- e+ T. f. ^( ?0 N. h5 r    xor     ax,ax" V+ p( m7 X& }: h0 e0 X) ?$ |( g
    mov     es,ax4 Y, K% \8 x1 u2 o. m9 z% [
    mov     bx, cs
) ~: U( D" f* c, F. y; v2 e    lea     dx, int41handler0 L; |8 ^1 X  @/ }( u; \4 ?2 S: n
    xchg    dx, es:[41h*4]" S+ ]. ?8 a* h) G
    xchg    bx, es:[41h*4+2]
; o+ N+ n4 H4 C2 x: v7 _    in      al, 40h) g( f7 p3 p+ w! m' n
    xor     cx,cx- ^) F" g8 I2 b- ?
    int     41h/ x- L/ p* {3 E, F% q  k2 h
    xchg    dx, es:[41h*4]+ v) f# a: G  q1 Y6 Q' R; W" n: b" A
    xchg    bx, es:[41h*4+2]4 k- P3 h  k" T- g6 H" {- W
    cmp     cl,al% o  g+ w1 l4 t  X% q7 _* M0 C) ^
    jnz     SoftICE_detected9 g' {, h% f- _: w

+ H! C! l' `. r; A+ X. n2 V_________________________________________________________________________  _( Y* y' D4 }, d( t/ K  c
3 V  Y( j0 X: q2 k! r
Method 07
3 s' ?) p3 f; f  B7 V=========" w4 I6 h  v' C# Y; n3 U, c0 ~4 d

) Q' n" `6 ?4 N, R! y# ?Method of detection of the WinICE handler in the int68h (V86)& E; d' W# `& h3 E% q

/ [) h* C% R( R& X: C) u7 p) O    mov     ah,43h0 G5 ~! T: C! I$ R, k
    int     68h
4 {* I# ~7 H0 m5 _# N8 v0 c; `    cmp     ax,0F386h
! z8 M0 K/ d' L" e5 C0 v& U    jz      SoftICE_Detected) p  V; V$ R- M# o: f0 k
4 J5 D% C7 G+ p

0 l/ Y- Q, f# C=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 R( X  B5 k  Y   app like this:" J0 r1 Q8 k9 p) f( R

8 _5 o2 l4 T. B9 U( Y* n* g! a   BPX exec_int if ax==68
6 ^" p  y$ [3 G  _. M0 f( o( C' [   (function called is located at byte ptr [ebp+1Dh] and client eip is- m! C$ C/ F9 W  f- Z  H0 A
   located at [ebp+48h] for 32Bit apps)1 X; r. X4 X$ T& W& G5 r
__________________________________________________________________________; k9 v2 i; K: r
* h& h5 v5 x$ {/ o$ p
, y, P- b" \; B6 W
Method 08
+ W' p8 g7 E% m1 Z; _7 l  e=========$ P: @6 F! B. B/ Z; n2 x) W
1 v( }7 x) G( D
It is not a method of detection of SoftICE but a possibility to crash the
' a/ D* ]1 Z& K; Csystem by intercepting int 01h and int 03h and redirecting them to another* _* j7 v6 p) K0 {
routine.9 ?* B( m$ p) r# Q, [+ F
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; `  e- F  s  f) F
to the new routine to execute (hangs computer...)
" ^! _4 q# W& {$ P# ~0 V
" Q5 A0 @/ ^  s8 u6 C0 B/ d    mov     ah, 25h
# O6 A$ e( D7 z0 q2 ]0 w    mov     al, Int_Number (01h or 03h)
/ F2 ~" s, U& _    mov     dx, offset New_Int_Routine
- v2 t' W; j+ \* Y    int     21h4 e* P% V; X3 p# E
8 P. w; x. g' X; `4 M# v7 L
__________________________________________________________________________
( Y, m' f# K1 u0 h' o8 `0 c& x8 }/ k0 b, p, H: u- |
Method 09
4 \4 R) X5 _% Y% C=========
' M  \7 c9 m. q' m% M3 }* L/ U( H2 t/ y6 Y# g% x; w- \' L
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
' H: e' d. W2 Y3 y" S9 Nperformed in ring0 (VxD or a ring3 app using the VxdCall).
* D+ ]; S) E: t" SThe Get_DDB service is used to determine whether or not a VxD is installed
3 u& V) R9 j1 m9 L( W7 nfor the specified device and returns a Device Description Block (in ecx) for8 m- o5 \# [- H  r, b, ]3 x
that device if it is installed.9 R: f& l- W: s" Q" @8 n+ ~

' m0 I% K# @' K! G3 Q8 g, y0 N   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
& z% s5 W. e1 M$ F: o2 D   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( |, O4 Z2 _' e6 ~   VMMCall Get_DDB
( ?2 X; u* D- ^7 k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
8 V8 o3 l9 `, ~# J% U2 N
' A. K5 ?" _6 X2 t  P" d% g( g9 ~9 YNote as well that you can easily detect this method with SoftICE:& T$ k1 Z: c2 E; h" R7 _' c
   bpx Get_DDB if ax==0202 || ax==7a5fh
) U' y! _/ N5 j/ f& ^7 C4 \" V" p+ q" l0 S
__________________________________________________________________________
; L; L5 D' m" [3 e/ q8 q6 W
1 v4 v3 C5 {1 U$ F: kMethod 10
5 W6 p0 _1 i6 v; [% b=========3 @9 O- ^( p0 F6 a$ c
5 s% I# ]& _1 b+ r, ?9 H
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 U5 e! |* [. f' a
  SoftICE while the option is enable!!  \" K$ u  l  Z/ h

7 W  {1 c, m/ J8 B% Z$ Y: UThis trick is very efficient:
# j+ i. r. e5 x; C- \by checking the Debug Registers, you can detect if SoftICE is loaded( {0 ]/ j1 `! X1 E7 j" W
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& |8 R6 _, c, _! X. |# o6 J; ~, Rthere are some memory breakpoints set (dr0 to dr3) simply by reading their, U% `% t5 I' H' D& ]
value (in ring0 only). Values can be manipulated and or changed as well7 |2 `+ k4 t0 h) m% @+ f
(clearing BPMs for instance)9 _0 e  g0 c- |, X

) J1 B5 I: ^5 G! I" h+ s__________________________________________________________________________# e  ^) G+ W' f! z. F1 q) ?* V# P. J

& Z) P8 u& Z8 ^$ D5 r0 C. F7 V$ ?Method 115 y( v4 U* }4 Y6 k1 ~" L+ m7 f
=========( G, o) E( ?8 D% G$ L( y" k

6 X, X% f; q7 N, S% _9 vThis method is most known as 'MeltICE' because it has been freely distributed2 k$ q! {2 \; L
via www.winfiles.com. However it was first used by NuMega people to allow
+ w. T/ F- ~$ `/ GSymbol Loader to check if SoftICE was active or not (the code is located, W9 J) A4 b. f/ {  G6 T- y5 _
inside nmtrans.dll).- V$ I& x2 Q: v6 X  B
1 v' \/ n" H2 y$ ^  o% @( o# ]
The way it works is very simple:
5 @, [3 H. ]. S% j  }1 CIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* C" S! f1 D) T, F0 G* R6 vWinNT) with the CreateFileA API.
2 @0 W' b- z- }9 Q* y* }  B: W5 D* [2 K  n/ e
Here is a sample (checking for 'SICE'):
0 c% k3 R8 v! A- d2 f$ F
" `' z. r5 [2 a6 V) ^( N, EBOOL IsSoftIce95Loaded()
7 w/ q  z; i: v. I{$ k+ U$ f( m1 b' V: u8 F
   HANDLE hFile;  
& U& ]. f: R  V   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 N1 v$ M$ M, D1 {" B% c, b# m
                      FILE_SHARE_READ | FILE_SHARE_WRITE," w- ^+ g/ @: T+ L5 d$ O
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8 t, N% L% A( m4 Z8 B   if( hFile != INVALID_HANDLE_VALUE )
! m) d% J+ {! m! j0 l( F   {
; ^  e: C( q4 a, [4 e2 s      CloseHandle(hFile);
$ r/ C6 i5 ]1 c3 p9 z% c. k      return TRUE;; t( O  E* k2 _$ @) h
   }
( g( t: P8 X0 w" e0 g' w; ~4 n   return FALSE;9 b6 @, w- J4 ^' A- y! x* M& O
}
) E5 J6 c9 L/ m3 p7 L* @. x( ~
$ F0 Y) E; ?4 ~3 O& d( AAlthough this trick calls the CreateFileA function, don't even expect to be# {9 A$ F. {. s
able to intercept it by installing a IFS hook: it will not work, no way!$ Y# C! w/ ~2 Z4 x( [
In fact, after the call to CreateFileA it will get through VWIN32 0x001F+ f: [$ C' h# U/ |, Y& m: @0 v% I( n
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); |- Q  Y; a5 B; @% s
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
6 p8 l9 X/ B) a" z5 }field.
- s( J/ M( y  i  _2 ZIn fact, its purpose is not to load/unload VxDs but only to send a 5 u2 Z: J9 u" _$ ?
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( y$ w% d) P: I' s
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' Y: B5 P$ N$ U5 [9 f  Z  v9 x
to load/unload a non-dynamically loadable driver such as SoftICE ;-).! u' X5 P% ^# Z5 d5 t5 Z4 d
If the VxD is loaded, it will always clear eax and the Carry flag to allow7 u, ?" [+ N4 O" d0 s8 V
its handle to be opened and then, will be detected.5 v$ e) R4 |/ f* }3 C
You can check that simply by hooking Winice.exe control proc entry point2 S: o' T( ^( c6 p
while running MeltICE.' ^, h, Q9 Y4 m- ?5 k4 j

! M( }% W  U% E) w  f# X. C9 V
) E( `  O! a* f  00401067:  push      00402025    ; \\.\SICE
5 p+ @& }# x1 c2 q  0040106C:  call      CreateFileA
5 v2 H2 o5 T" d: L5 o% Y  00401071:  cmp       eax,-0014 k6 c. E5 q% A; S5 k
  00401074:  je        00401091/ ?3 p5 f+ y, [  z' D
2 y9 {$ m  w* G
! A0 `3 Y# m! a( a6 q2 V% S
There could be hundreds of BPX you could use to detect this trick.
8 j: j4 O6 W% {  l2 Q  v' z( J- d, i-The most classical one is:( x) S8 k, F+ e1 @, ^& N
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 K9 d- A% P1 f% z8 i5 e$ @
    *(esp-&gt;4+4)=='NTIC'2 }4 o: D; d5 f0 g' d6 i+ T2 ~0 V' n
0 i5 ~* A  y5 f8 z) A- z
-The most exotic ones (could be very slooooow :-(: x; g4 Q4 L( Q! [, s$ @- p6 C
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& X% W5 _* {1 v$ C     ;will break 3 times :-(0 k8 z  k) G! i" `% [6 m2 C$ _

  F: i9 |7 t* [% l3 M  O5 {-or (a bit) faster:
9 @4 |# b9 r1 |: Y- S& f+ U   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
5 e  M7 R+ h/ k. d
% ~, }/ x1 r! v4 ~* {- z   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 E7 C6 m/ I; F6 Z& Y( Y     ;will break 3 times :-(
) h' }% E& c& o( j$ E6 `
  R% H5 }2 j7 I/ N! z! }- {-Much faster:1 B: g' X' h4 z: s6 w/ K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 N8 q. u, f- J5 A# x) _5 Q- |" Q

1 p$ T- j/ [3 K0 cNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
; |% S3 r  ~0 Ufunction to do the same job:
0 a0 }: ^2 ~5 X2 c+ g7 M, |1 m. Q& R$ v* q8 m2 r7 f8 D: t5 Y
   push    00                        ; OF_READ
, X6 C3 q7 v% U$ I' y   mov     eax,[00656634]            ; '\\.\SICE',0
$ j$ i! s& B3 I! b( w8 S1 V$ O5 h   push    eax" v) J+ R  ?4 ^" C0 O3 @
   call    KERNEL32!_lopen7 q' ]8 u* q% f. }! O6 H5 ]+ N$ C( A
   inc     eax9 c7 F6 d. ^0 y( o0 I
   jnz     00650589                  ; detected0 h0 Y- L: s" i8 ]" M% z, H
   push    00                        ; OF_READ! P* l( S2 o$ I% b5 D9 @- j
   mov     eax,[00656638]            ; '\\.\SICE'# B7 {$ _# P9 [$ p
   push    eax
1 `9 O6 }1 x1 h' V/ Z2 [4 U9 K   call    KERNEL32!_lopen$ R! G4 I# ?% A, P" {$ W& J4 ~
   inc     eax+ p' K7 W! U* S0 P& ^6 V
   jz      006505ae                  ; not detected
: I2 W0 |2 B, g2 f. H- P
+ x1 y! I8 c5 {
* B$ h( S( j- d: `: Q* l" S0 ~4 k__________________________________________________________________________- r5 X( g. _  |/ m$ T2 {" U1 M
2 k& X9 X; l' i  l! E/ `
Method 128 s6 |7 g$ a/ M6 m8 S4 ^
=========/ E7 _; A) |6 B% I, N2 G* T0 c# z5 F1 U
8 m  Y; s2 c; L0 O3 G7 b
This trick is similar to int41h/4fh Debugger installation check (code 05' V0 s; A4 k# K/ [+ o
&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 T$ l+ u$ }+ Z( \
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
5 R6 d0 \0 \, f1 c& t- i* M' d* \* f" v$ ~  P( E/ w* W
   push  0000004fh         ; function 4fh4 q5 `) o" x$ e0 s; ~2 C
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 |% W- s: ~1 h2 P3 r
                           ; low word specifies which service4 g4 W( P- s' m8 m. W1 f- e
                             (VWIN32_Int41Dispatch). G6 L$ l, X8 J! x6 b  C
   call  Kernel32!ORD_001  ; VxdCall$ b/ k  I) d9 M6 t2 ?/ E
   cmp   ax, 0f386h        ; magic number returned by system debuggers9 j, B/ r& Y+ L* }9 ~
   jz    SoftICE_detected
; [" M0 H: I4 `
- {; A- u7 j; x/ d$ Z4 HHere again, several ways to detect it:
/ r1 k& J  ^8 F% L; w, |5 U( g
1 q9 }0 k2 W) F$ C* G: m    BPINT 41 if ax==4f+ N* z6 ~9 O' Z" B* {/ G* B0 i6 T6 n+ f

5 Z8 F4 _3 u8 h    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" j. @5 ?& e7 d" v- Y3 I: n
7 Z7 Q" e5 t1 r2 I+ r
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' E+ J1 z; n5 t+ G# f6 O5 J
. F* y# s/ f! m; Y7 K2 T4 G5 ^    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
& @9 a; n% W5 N2 q& V) M" m  ]+ {4 o5 A* y! o% Y
__________________________________________________________________________  p, m- o2 K/ ^, q* y8 U7 `
: G5 m: h  F6 U$ w5 v
Method 13$ l+ r, p1 S6 W
=========5 ^  U# [2 B, _- W: }' `
# M$ M: b$ L. r) \0 w
Not a real method of detection, but a good way to know if SoftICE is
( ?1 O+ c! r$ f, [+ u* ]7 \! w1 @installed on a computer and to locate its installation directory.
$ M! o1 {  M. Z( ~: }/ {It is used by few softs which access the following registry keys (usually #2) :8 O) A3 ^" T: J3 k4 ^8 j4 L* `
* q* j8 h2 y7 g! M- M
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 P5 e  o8 D  G- J0 z. p7 q. R* C
\Uninstall\SoftICE# _9 V1 H9 ]! _9 Y3 u
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ \6 b. B% j2 ~+ b! t-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 [, ^5 _' {7 ~/ S1 J\App Paths\Loader32.Exe) `: H8 W4 h5 M% e2 F5 C/ g' t3 b  r

( H3 F' u7 _4 z3 G9 l; q& d& v' K) `
) t0 Q! m* Y% [Note that some nasty apps could then erase all files from SoftICE directory+ b# d" u7 X9 L7 k. X
(I faced that once :-(* I8 ]/ W) z0 K8 A: L
3 H/ s7 N8 G7 ~/ e
Useful breakpoint to detect it:
! m. q% n2 u) B2 J+ c% j3 Q" ^% G6 `& j/ q& f# S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
( ~6 K" i. ~' ^# j! K. J3 x1 q2 @3 [+ J; W) J3 `
__________________________________________________________________________; v6 N$ @* K; l! K9 y. S) `. X
/ A6 b# P  u+ G2 T( @/ |) a

' h" o8 u+ w$ @: M8 J) Z' AMethod 14
, r3 Y" j" D6 |/ \=========, x# @' K$ U) B& x6 F

: E" P# M8 p9 H1 ]( g' m+ R( WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ l. d9 n  r, m# a3 ]& ?  B1 g: A8 W
is to determines whether a debugger is running on your system (ring0 only).
! U8 b2 ^3 [4 j% d5 |9 |3 P6 }2 o( T
$ A7 a- d) U. g# o   VMMCall Test_Debug_Installed- x8 ~. k& h" Q! ?3 b
   je      not_installed
0 ^  ~; [. f( n% S* `, N
3 |% k3 K  t( b8 FThis service just checks a flag.
4 s% T4 l3 W3 ~) a* K0 c</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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