About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>/ Y& V, \) ]" \
<TBODY>5 _! ^3 D8 I  p9 e; p& v8 k
<TR>
# }! s4 f) I& C) [+ n( y<TD><PRE>Method 01
* E1 J) {; G% i, P/ V9 J=========
7 R6 k" K: D; h% y' G+ w# A7 N2 k6 s. w+ d
This method of detection of SoftICE (as well as the following one) is
" w8 v9 g- S# `& E, Bused by the majority of packers/encryptors found on Internet.9 Q% x# f- Q7 t9 f) u( c+ Q
It seeks the signature of BoundsChecker in SoftICE  {3 y, v2 c) L0 z* ^  x

* B- Z" U/ z' P4 _' J9 x    mov     ebp, 04243484Bh        ; 'BCHK'% h+ J( `2 B5 M0 S  o7 j5 t- ]9 H
    mov     ax, 04h
0 w) U1 q* D4 ?' U# E    int     3         W! r0 e: [) E& F; W3 ]2 G
    cmp     al,4; s( Z) |6 t& a  x9 c* R
    jnz     SoftICE_Detected
( r4 c, g5 F7 }
8 f$ I& p  ~" w- I___________________________________________________________________________
$ S$ _5 P& {$ M" E' W7 Z  J0 w* h/ ?6 q3 i- S( j5 F) K
Method 02
6 u' X' p, Z% G( `- |=========+ ~$ R  Y  w- p  k; ~3 L9 d0 p

, L' ]/ R& @$ O% O. V6 JStill a method very much used (perhaps the most frequent one).  It is used- O6 q1 y& K+ m2 U$ G3 N
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 r% {8 z! _: A% d! t' C; \
or execute SoftICE commands..., e  ^" V  q; ]2 A& l2 Q
It is also used to crash SoftICE and to force it to execute any commands
, r7 F9 h1 c$ |! o(HBOOT...) :-((  + k% @" r/ g  F

  B4 N5 P" E/ e7 @8 p* A5 IHere is a quick description:) |) K) o8 S( h- S, S  l
-AX = 0910h   (Display string in SIce windows)
- _1 q& R8 \( l9 a* u7 m- p& V-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! a3 U9 n9 ?0 n5 n
-AX = 0912h   (Get breakpoint infos)6 B! ^- k+ g, @# r2 Y) c3 H; b
-AX = 0913h   (Set Sice breakpoints)
1 @  x* A  |% g% f-AX = 0914h   (Remove SIce breakoints)
- r$ b' b$ g! g( W; t/ \$ o; N& Y  @' L4 n0 Z, q) L, Z
Each time you'll meet this trick, you'll see:
4 h0 X$ Q4 x4 Z7 M$ c-SI = 4647h
$ j7 }9 m* Q5 Y; p3 v4 D! F-DI = 4A4Dh9 e3 U) h  k/ |7 T8 K7 v3 C8 l
Which are the 'magic values' used by SoftIce.
4 _7 J6 o& c) O+ V5 g4 v  F& TFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 p3 E8 g' ?, q" M: u9 i

# U+ c* r: |4 |" m  S( M3 eHere is one example from the file "Haspinst.exe" which is the dongle HASP
& u1 m" ~- X; V$ b3 p% d) p+ p, pEnvelope utility use to protect DOS applications:1 Y- f' E0 v' @

& ^5 ~# I+ w0 H% ?; \4 m( m# T( I6 w. i* e
4C19:0095   MOV    AX,0911  ; execute command.8 K. _6 t& U  [5 v* S) @+ X7 @
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 c! g/ ?! _. D' s" h8 c6 }" D
4C19:009A   MOV    SI,4647  ; 1st magic value.
: B2 u- D# s2 n+ V4 T. Y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 j1 z; _- d* T* B2 V# j4 L; Z/ T( C
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 Q' r8 T$ j. g- |
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* ?/ g* |) S7 }- i: L
4C19:00A4   INC    CX
1 j+ K( A, ^4 f4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute+ ^8 a' C. o" m* y; A( f, ^
4C19:00A8   JB     0095     ; 6 different commands.
! T3 b* y# A( r3 [8 X* V3 c4 m" f4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: i1 A2 a) u: R4 L4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% {1 n; P0 n' R+ @: k
! |1 G3 c3 \4 A6 J3 ^
The program will execute 6 different SIce commands located at ds:dx, which" Y1 W  i. m  b" `7 A
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! s. j6 m. y* \& C8 c. Q4 Q! A
7 ]" D" f: [7 ]" m' }* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
! }: h' A8 N. X3 X___________________________________________________________________________
2 H# P; M5 ^2 Y) O; x: T) z  q  J& W) {. @' u

3 a, H' J* K* e& u! d9 }Method 03  f9 W3 Z1 G5 y  L* B  |! B
=========4 o6 d/ T* d- R1 \; u9 P

* @  l$ x# A9 H! n& @# u  `Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( v. G' [" [1 x# v( S3 d(API Get entry point)8 z4 |: p# |4 _: ^
        ' v7 K5 Q  n# `/ s! P

3 M: O$ n3 S, a/ k; s9 b- _) a3 `    xor     di,di& O1 l. u6 r- K- d! ~
    mov     es,di/ M* A: o* e+ V/ F2 ]  P
    mov     ax, 1684h      
; F$ R1 {; p( j9 e: T  i" ~    mov     bx, 0202h       ; VxD ID of winice% z/ |* p6 a, t7 e
    int     2Fh# V9 J, s5 _1 E5 u6 B" X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ }  p& q5 [: k% U/ P- I    add     ax, di
) H& d" U& w! U: y$ f/ B    test    ax,ax- c. A) g* Z$ o) V4 f4 z
    jnz     SoftICE_Detected+ Z. P  C1 q4 l
. a0 S5 `9 g) w
___________________________________________________________________________
  Q  W4 A- Q9 w3 X% a! `
9 t4 m) d6 h; W8 L4 H' BMethod 04
7 I* ]9 p# `- J7 y4 f$ X0 k3 O8 b=========
1 S2 y% f2 C% O7 {  ~, v# `- N( ]# ~# f
  C; b0 o' E7 X& Q; k* sMethod identical to the preceding one except that it seeks the ID of SoftICE
; ]* f% f! U* nGFX VxD.
) L- S  B, B: w& j
0 T. \1 s4 v. K2 f8 @+ M* p    xor     di,di- D' B0 P% Y+ `$ q/ c
    mov     es,di6 p1 u& L0 q; A* ~
    mov     ax, 1684h      
/ r2 ]) U3 a: u9 Q* i/ d2 d+ N1 R& _    mov     bx, 7a5Fh       ; VxD ID of SIWVID
+ P, Y- p% ~9 l    int     2fh9 Y& D. i8 f4 [; T; n* K4 d4 n- }
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 p' p. Z( W% C. s+ w+ z
    add     ax, di
/ {, z7 z+ R0 G1 N% o) K5 s5 \    test    ax,ax1 r( ?" V' f& a
    jnz     SoftICE_Detected
! U0 t: W9 u4 B+ [. i4 S4 y9 G, e+ F: a5 Z2 d% F( |, W! N
__________________________________________________________________________
/ }( C# M" o$ b  m- r3 `+ {' A# q
8 S! D; R6 g2 D
# H5 B- ?) ]1 N- N  KMethod 05" w9 Y4 t1 f1 D" q  N
=========& o) `2 Z: e' I7 t. g! S

1 h  u8 j5 J* e, v4 _3 ^9 BMethod seeking the 'magic number' 0F386h returned (in ax) by all system
7 m# z$ T7 Y1 F5 K. H* a+ I! ddebugger. It calls the int 41h, function 4Fh.
: D& y9 @: H% x% `7 d( B; @There are several alternatives.  * ^- I+ E' Z2 O# U

; k+ Q9 |. ?( ^* F$ fThe following one is the simplest:' o/ o7 y$ y# v2 J

* S; v6 d, a( j: x7 R    mov     ax,4fh
1 c, s9 z+ _1 `$ A6 ~/ w0 Q9 d/ k    int     41h
0 v/ ^- j9 W" C  ^0 _; _  v6 W8 n! z    cmp     ax, 0F386* t3 z  L* I. m6 N) r+ _) |! k
    jz      SoftICE_detected: M4 W; @* P% o( P" H# @
% v+ |3 U  w1 l: W
; g) K6 I' a( j# I2 M* P1 J
Next method as well as the following one are 2 examples from Stone's
8 G7 t3 ^5 I+ g* ?+ u8 v"stn-wid.zip" (www.cracking.net):2 j, L2 |) Q4 `* u: b- D& q. ]

& [5 O- L% b* V+ _6 T    mov     bx, cs' n4 X0 l( n8 B6 H2 w
    lea     dx, int41handler2
3 k; [8 I3 M: J2 f' M0 g6 k; v# k    xchg    dx, es:[41h*4]
) o5 ^1 \( ?( b( @$ B, y8 q/ B    xchg    bx, es:[41h*4+2]
' i5 E! N) c; z# M( F* ]" v( k2 B    mov     ax,4fh) T" Z( Y! b5 [; K
    int     41h1 B! y. k# R7 X' l5 A. {) W! [
    xchg    dx, es:[41h*4]
, y/ i1 O* `' ?9 f: {$ b4 w; m    xchg    bx, es:[41h*4+2]
% k5 X1 ^) I- q. V3 L+ h    cmp     ax, 0f386h
& y7 ~7 \# t- s. {9 D    jz      SoftICE_detected' c- R* P4 P; Z: C# T3 }

1 U0 t9 x: J9 z: J  |int41handler2 PROC4 ]. V7 n6 c+ u
    iret. Z" `5 q. u3 f$ E6 Z% A  e
int41handler2 ENDP8 w0 Q& P' y( U- ~, [
* ^% I' w) ^5 ?+ L" D0 z; ^' F9 ?

6 ^' w6 Q: @7 |: l; h% w_________________________________________________________________________
  U( u: z' J5 i* j1 N
, T, N1 ~; s: P+ \: @' o  s- _6 _; N; W2 l% L. \0 S
Method 06
- }& _8 y2 L0 u9 l+ v+ t6 @, _=========* L+ O. n( G: z" m9 n1 M

; F& X/ p- P. s/ X' _+ B% k" G, J+ o
2nd method similar to the preceding one but more difficult to detect:
& W0 b+ w( }; ^8 g# I( i+ ^- l9 u- g2 [; f3 {2 [& H6 l( P) u4 m
6 d% ]6 y# p% l5 H) A$ w9 D
int41handler PROC( \( G6 V, W* b6 @4 H. I0 l
    mov     cl,al* o' I, }3 ]1 k' G% ]" V
    iret
/ F$ J7 K+ P# o  g( i7 _' iint41handler ENDP
5 L7 l% `4 y- U3 Y% M: |+ ?/ E& m
+ d. e* `! @, o- \8 h9 h9 `' q
" @! c. Y+ ]% l5 ~% b( C    xor     ax,ax
- F- s6 f* l# f    mov     es,ax
$ d. v- s! {, [    mov     bx, cs
2 [, x8 U8 U& l! I. {% J    lea     dx, int41handler) p& ^9 J! Z- W. J; t) ~& G' H
    xchg    dx, es:[41h*4]
' O8 _3 a; o3 a/ L. `    xchg    bx, es:[41h*4+2]
) o; ^: E/ H) ]& b    in      al, 40h
; t) k; k/ z4 l8 ]    xor     cx,cx0 f4 ~5 G: H* P
    int     41h
% R9 [9 I9 d# W    xchg    dx, es:[41h*4]
7 v# O: P8 ~: W; H& Y    xchg    bx, es:[41h*4+2]
7 Z) j3 r% S6 _; ~' c    cmp     cl,al
- |; h  z" E5 O/ ~/ `, _) P    jnz     SoftICE_detected1 P! V1 B- l' {9 s3 O; i

+ @) U/ y+ r1 o_________________________________________________________________________
/ Z9 t+ `& L1 R( M: M/ L5 G3 ], X( q, T6 k9 {4 E
Method 07
# T( Z1 F3 q( M=========( |& p% ]7 h" ~
4 G. ]" j) A9 {) x6 |( b0 Y# p* F
Method of detection of the WinICE handler in the int68h (V86)8 U* M! B) a" i5 X& O  O  e6 \
4 }# n( v# `$ G2 K
    mov     ah,43h7 @( c5 s0 U+ E% c* u+ v
    int     68h9 a$ m& [4 n* s, k4 f
    cmp     ax,0F386h* @1 s$ B) }) T- |& W, ?5 \
    jz      SoftICE_Detected( E2 u* U# a+ u  v# G# J
1 u8 a' j' Z! I3 ]0 `# u" p

, k6 `4 B7 j, ?( T=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# B6 [$ m: l- E: m; Q
   app like this:$ N8 ~# P; s$ X+ _, l
8 \* l0 {3 T  {' r. G
   BPX exec_int if ax==68
$ R# Q6 u+ m* k8 w2 R: G   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ V  @8 A4 y- F   located at [ebp+48h] for 32Bit apps)
4 I- h% x- U$ c0 h__________________________________________________________________________
% V2 l% t. N, Q3 M5 v' g) ~; n& k0 E& X
! t6 D" m6 {9 D% G" C7 X/ J& ~
Method 08; M7 C' M* X4 i7 C2 \' R
=========- }8 F$ V; k( c+ u+ v1 u) }- {* F/ k

5 p0 G. g( }3 V. ~" _6 \0 wIt is not a method of detection of SoftICE but a possibility to crash the
2 t1 L3 k$ g" L7 h3 }2 ?! |( gsystem by intercepting int 01h and int 03h and redirecting them to another' b" x, ^; O  ~4 s
routine.3 y; a/ w6 H( U) W" Y0 R. B
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
0 s; k9 K- j; O" T$ Ito the new routine to execute (hangs computer...)7 N* R1 g  ~) M4 u- D
& d8 I$ {$ A5 \
    mov     ah, 25h' h3 N' _% }; E8 L
    mov     al, Int_Number (01h or 03h)7 V5 w4 f0 m4 Z' D7 h0 g
    mov     dx, offset New_Int_Routine
. I. B0 s2 j! J! x6 M8 @! f7 z    int     21h8 E& `6 s7 _  C/ }' A0 N' g

3 I+ M$ w7 X% b1 [- I/ g__________________________________________________________________________2 g: g/ T: d, R. Q$ v4 n
$ W. Z  u7 E& e+ m  r) H
Method 09
& C' r: N  ]1 X/ |- J: D5 a5 c% m* z5 U=========
) C2 r/ t/ e* }& u+ S8 k
6 U2 t9 ~0 d: D3 Z5 yThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, T, s5 }; F* n* X* d) nperformed in ring0 (VxD or a ring3 app using the VxdCall).7 d1 d: ?6 G) R
The Get_DDB service is used to determine whether or not a VxD is installed- [* t+ C9 D8 d, B) |5 ~% |
for the specified device and returns a Device Description Block (in ecx) for2 p( y0 S: d# E" P
that device if it is installed.
* _/ n: A3 K; O! v
5 {) o: _* M2 P   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
' N) t' a% i! v* e7 R! I4 O8 u4 S   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ T+ w$ Z/ z- z3 @2 [% L0 ^. B
   VMMCall Get_DDB. f( X) @+ G, ^2 m# @- e
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
) E/ n* d, a( E' L' b/ Q6 U
- D- E! U" i' jNote as well that you can easily detect this method with SoftICE:
) n0 M9 Z7 h5 ~4 N# i, \4 k# d   bpx Get_DDB if ax==0202 || ax==7a5fh
5 O# q( H3 N/ K# d9 t; E
7 l# `3 A, L% B$ i% d__________________________________________________________________________# C" R8 A% L! Y
. z+ o! \- E0 L3 J7 E5 ^1 y- F3 X. }
Method 104 F: Z9 \  [6 p$ _% I' m5 P, g
=========3 m$ Q6 g8 h  L9 C( P7 q

; e4 f4 d- D+ I8 {: B5 A. n=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with( i8 [4 H& Q* z% c+ O6 H; W
  SoftICE while the option is enable!!
( G5 m: x) [0 H6 S( p! c2 y; W/ W. p1 h
This trick is very efficient:. ?; `4 P  W3 |4 O; F
by checking the Debug Registers, you can detect if SoftICE is loaded# h+ A( H4 H! W6 t  K* v0 a
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 y6 ~8 X% P! i+ ]: H8 N, g4 [
there are some memory breakpoints set (dr0 to dr3) simply by reading their
8 J0 g4 K  S) E: ivalue (in ring0 only). Values can be manipulated and or changed as well
+ q( t2 r  Q0 H/ Y) \(clearing BPMs for instance)
4 k1 i, ]( T+ u) a- Y1 @- m8 n0 N+ f
__________________________________________________________________________
  ?- }7 q1 j  z* e  s' _' i9 V. o4 o. a  Z. Q
Method 11$ \7 T! o" Y$ v5 m. g4 E
=========* O2 S( |0 ^/ X( A% Q& l& O

# c" K$ s2 x' j8 q" RThis method is most known as 'MeltICE' because it has been freely distributed$ G6 L* w! ~$ y9 B& S2 ~6 S
via www.winfiles.com. However it was first used by NuMega people to allow3 X( o. X- m6 q+ _, ~
Symbol Loader to check if SoftICE was active or not (the code is located5 K8 Q0 B6 a0 N1 ^9 K/ N% ^4 Y% D. z* C
inside nmtrans.dll).
, a' t) C$ h  t0 ~) m4 \8 d9 B2 L+ N7 X- ]6 G
The way it works is very simple:
& j- y: P2 [  S: q; }, n" S. _It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
! N  Z8 B3 F9 BWinNT) with the CreateFileA API.. r( X1 a0 \  @- u; }: x

& z5 h: s- O5 X# h; S7 f) P9 hHere is a sample (checking for 'SICE'):) y3 K/ a) E; }
% M6 f5 x# o; F: w4 h
BOOL IsSoftIce95Loaded()! J! s0 v4 [7 v. l
{! r6 ]# q- E1 s/ q7 C- m6 }4 C
   HANDLE hFile;  
9 d: V+ |/ i( \2 h9 Z   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 d- d# X# N, X$ g5 F( L. {% A7 M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  [% U' `/ Q& i9 d                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);+ h! C! h% `2 i. g; a
   if( hFile != INVALID_HANDLE_VALUE )
: r) M  X  B; |  b8 Y3 i1 A# p- X   {" H! A3 }2 d7 i3 c: ?2 J
      CloseHandle(hFile);
" L0 P4 e! X( J5 I- Q      return TRUE;
7 {* I, e: p+ k! H( \2 |   }
- H2 G( j" M3 {' J$ n# W   return FALSE;" K! D: ]  T5 V9 r& v  {+ u
}/ B' G0 B# l# A9 t0 U6 I9 {& D& s
  h2 S) z; \+ ?, H. C
Although this trick calls the CreateFileA function, don't even expect to be; C1 g  v8 t* i8 q$ {
able to intercept it by installing a IFS hook: it will not work, no way!
) P  G/ j: M% aIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 `  H$ _9 M# v0 }service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)3 q5 R5 I4 ]' m9 j" p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc5 D- U' m! S# I- I, l7 r% k
field.! B3 s9 `3 x' X$ U7 u( b
In fact, its purpose is not to load/unload VxDs but only to send a $ g# J, P! ^( W
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 y% b& @& N/ m% J  ?to the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 M+ V6 p, ^/ x: k( ^2 `to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# R- D3 o. R4 U, NIf the VxD is loaded, it will always clear eax and the Carry flag to allow
* N; E1 Q! z+ x2 a; b, u9 I( k6 Z/ pits handle to be opened and then, will be detected.( Q* ~, w- W5 X  ^' R2 o# r
You can check that simply by hooking Winice.exe control proc entry point
# j8 U; I: z2 M2 Ewhile running MeltICE.% c/ _+ O+ \+ C9 x4 u2 ^" }2 v& v# t

- {1 `2 _+ l6 d2 V1 E0 D- |  h* q3 Y) U8 R4 ~  ]9 f
  00401067:  push      00402025    ; \\.\SICE2 ~5 c- N! }" t: X9 K
  0040106C:  call      CreateFileA
/ D4 P" C2 M: \7 ^: b2 h7 z& @6 C  00401071:  cmp       eax,-001) o% G, I1 m0 J& q! t4 q: Y
  00401074:  je        00401091
  ^0 m& z  A4 C' R5 E. W) P& @2 y: V' V6 \8 R2 T8 F3 i, D- [

$ h7 t/ q" r8 A/ q1 I/ s# OThere could be hundreds of BPX you could use to detect this trick.
: s3 h& j' ^( v-The most classical one is:6 |2 b2 W0 k+ G* {2 K5 [4 ?9 ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 O" [$ A; W8 K, L/ W$ Y
    *(esp-&gt;4+4)=='NTIC'
5 e; Y( A0 ^9 U
, a2 w4 V# Q/ {+ H5 f-The most exotic ones (could be very slooooow :-(
* p0 B! G, ~) Z+ V   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  # y, d- d* k! ^5 `( Y
     ;will break 3 times :-(
# _5 K/ t" u3 H% \
1 T: ?  @; s2 _: `1 s$ j-or (a bit) faster:
; |$ d3 G3 S) Y2 t* i3 E% k% f3 u   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 i& s+ H* b1 n. t; m/ E' a& s. ?) g8 `  j5 t
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  8 u: X9 w- L- M! ^! \- H
     ;will break 3 times :-(
& e: L5 [- x, ^0 p* V( e# \+ O" }5 c# L4 {
-Much faster:8 D3 \3 X; ~& O( s
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; [5 f) u  s, Y/ n9 R' q4 T* M6 M7 N0 z. o5 R! A$ `2 `
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen+ r2 d1 y1 E  v  j* b9 _8 R
function to do the same job:* j; a/ ~4 w8 J. x- D4 ^
- E" S. m; S7 Q3 Y) Z; O0 `
   push    00                        ; OF_READ+ Z) ?4 Z, v% N3 F
   mov     eax,[00656634]            ; '\\.\SICE',0* u4 t7 D5 l2 o' T- v2 P
   push    eax: D( C# d; U9 `
   call    KERNEL32!_lopen4 X7 ]! k2 r# b  Q; h+ C) x
   inc     eax* n$ G  N* n" z- I" x- e! S8 q; w
   jnz     00650589                  ; detected2 b( H& X) ?0 D: J$ F* ~& ?
   push    00                        ; OF_READ
1 @0 Y& t3 `( n6 @   mov     eax,[00656638]            ; '\\.\SICE'
6 t( ]' O. y$ |* ^, |6 z  @, n$ H   push    eax
0 c% C/ j( J9 Y$ a   call    KERNEL32!_lopen$ l+ W2 l) e* Y" w% |$ M' ]! q
   inc     eax
# D4 X6 Y6 x: Q8 c1 R3 t   jz      006505ae                  ; not detected
2 d% H- l0 @1 r! y& X( N' r$ O0 C' L0 X, V

6 ]4 A4 ]0 |. Y( q# o" @% b! u6 J__________________________________________________________________________
. {" Z- x$ e+ b! P. x
  ]: d2 O6 b) U2 ^4 iMethod 12+ j/ {' m/ ~" R9 r, P
=========
* w/ h9 f8 r' P. L, r' `7 p1 w0 N
) l- A  m4 J. R% ]This trick is similar to int41h/4fh Debugger installation check (code 05
9 M( ?* T: w4 Q. C: O% |( A&amp; 06) but very limited because it's only available for Win95/98 (not NT)( R$ V/ a/ ~' q+ i
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 b: S+ o- M# [* ?- A( H( y2 K& P! i/ G. p/ ?" f* U
   push  0000004fh         ; function 4fh
% @& B/ J7 c+ Z* l   push  002a002ah         ; high word specifies which VxD (VWIN32)
9 ?% t( R; n% x% N                           ; low word specifies which service" y  m( W# z  d' X
                             (VWIN32_Int41Dispatch)
5 S2 {1 |, j  g   call  Kernel32!ORD_001  ; VxdCall
& g4 j8 m% r9 c' `( U   cmp   ax, 0f386h        ; magic number returned by system debuggers
: f: l7 c5 J( g   jz    SoftICE_detected: w( y, r* W$ {

, M, E8 _; W5 X- a% b: SHere again, several ways to detect it:
& ]2 O. r7 {1 f( B
3 i  g4 h8 l6 o& h# k    BPINT 41 if ax==4f
' o* `$ Y2 Z+ v- o3 M0 h
1 z# T; W* I+ |, I9 T) s& ]6 G' h$ R    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  P8 g- y$ s# X: _& u% M1 f6 F- I* {% }$ \+ \2 n
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A, o; P9 d# z( ?$ @

# s9 M( |5 I/ a. r  l    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; y) \. K4 j4 I8 s
8 H3 @& o+ P& H8 _  a1 e0 \__________________________________________________________________________4 Y7 p# ]5 ]1 G
6 B% r* p3 [+ i% J
Method 13
5 O( D( s' H5 ?6 \$ D+ X=========
/ v$ q. l" t3 s5 H( y
+ z5 Q- Q! X4 k$ k$ xNot a real method of detection, but a good way to know if SoftICE is. E" [0 x% `2 Z( m+ W
installed on a computer and to locate its installation directory.
4 l) ?  B* e% E3 {0 oIt is used by few softs which access the following registry keys (usually #2) :: l7 M2 K1 m( ]* B! W7 ~* d; t

+ t7 ~' p$ |- @" s1 q- }-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 s2 H0 p2 ^* v- K\Uninstall\SoftICE
& j* u, o7 x3 `! D) C-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
9 F- K! ]) w, S6 f4 P-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 b/ w" g( [( ]$ ?! P- t\App Paths\Loader32.Exe
1 r. e* l4 \! {. n6 ~
0 z1 z1 S0 h8 g" b9 \, Z  g) }/ ~' G( L
Note that some nasty apps could then erase all files from SoftICE directory6 g6 g; K- V, s. H4 R4 N$ K
(I faced that once :-(
+ Y  h0 O2 E+ p# J$ ?9 `. {
. T$ h1 a1 Y9 a5 e; u6 t/ v+ X4 QUseful breakpoint to detect it:' f0 R' j7 L8 t: V: L" o

+ L0 W; q' v: e+ ?6 t' |7 v     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
1 B" H5 X" b' y! M0 l  H. V$ _/ V
( f# c4 r1 j  x( L__________________________________________________________________________
- f! E, R. }* G+ r$ g
2 l1 i6 O/ G4 y7 S9 w  T. M
" @+ ?" m' ?, W0 x& \  B! \Method 14
, v; f' S* G; {- B=========! r: k- X5 B  P# J# p! q
  o0 P4 c( t5 b' I1 g
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ W1 K. W  m% ^# wis to determines whether a debugger is running on your system (ring0 only)./ }" {: R# Q- @

. I  N8 @. ^( l   VMMCall Test_Debug_Installed( c. ?6 C( |* D. _2 T3 o9 E
   je      not_installed
0 l( @, v: s  T. z
$ N$ x  ^7 B5 q4 i5 Q. Y! N$ nThis service just checks a flag.
. O: G. x! p* z5 P" F$ {% ]2 M8 ~</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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