About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 K' ]9 ^/ a4 A( t, w<TBODY>% ]4 M" v& [; k
<TR>! ]/ u& K' z! W! c3 u
<TD><PRE>Method 01
4 v1 t- ^, m$ ^+ r0 j5 q=========
+ R2 l" c: m1 M% c9 e' t& k3 t  S- m* k, ]% B& M
This method of detection of SoftICE (as well as the following one) is
  F/ w* K  q' ]5 k$ q+ V9 Xused by the majority of packers/encryptors found on Internet.% E/ N0 u: k% v; Y4 V/ [( A
It seeks the signature of BoundsChecker in SoftICE
# c+ E0 j' ~' v* S: d1 q$ X
5 ]6 @$ \: g* x    mov     ebp, 04243484Bh        ; 'BCHK'
# b: `) W# `) r3 W+ b    mov     ax, 04h/ i2 @! A7 R* t% b( ?1 X
    int     3       ) x( z0 \* m; g6 H
    cmp     al,48 P: J' O5 r- \/ n
    jnz     SoftICE_Detected
. m: W3 P. [4 }' }6 \) f; R9 `- y
6 I& F2 n3 M. O, b+ F- k# C___________________________________________________________________________* [) t5 u3 r8 Q9 r1 q! l
  J4 g( y. U% a  s0 e* w
Method 025 w+ L9 j" w/ `  Q& t0 Y0 ?2 D* [9 r
=========
, m5 \0 ~" V& l: E8 i, W6 M/ ~  t% S% k
Still a method very much used (perhaps the most frequent one).  It is used
+ o" V/ S0 @/ Q( x( X, O; f. Nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
! R" l/ x! _. N2 {, y& gor execute SoftICE commands...
, `) z+ ]0 @% a$ b! M# }It is also used to crash SoftICE and to force it to execute any commands8 ]% C$ S- c6 i# S9 w
(HBOOT...) :-((  ; b, @- a* P- T: |
# T6 h/ x7 R7 R! M2 J* @
Here is a quick description:4 c9 I: ?$ |" ?- `
-AX = 0910h   (Display string in SIce windows)% w3 C/ d$ _6 N% Z: {2 o
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 [2 w) k0 r: E: ^; d. E-AX = 0912h   (Get breakpoint infos)/ W* b# k( w, y* w
-AX = 0913h   (Set Sice breakpoints)
* u5 z& j+ D% A+ j$ j( F* |-AX = 0914h   (Remove SIce breakoints)0 _4 ]  I6 G' H  L8 \# u9 ?

2 b! i) N! P2 M0 tEach time you'll meet this trick, you'll see:, e; F; k, ]; J$ Z5 }8 E& R2 A
-SI = 4647h
! q  k8 W# t4 V, K-DI = 4A4Dh& e7 b$ `* m% t! O( j) l
Which are the 'magic values' used by SoftIce.
. T; |4 T1 K- V' e% a" D! x) WFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
+ o! z; p4 Z0 c3 G$ R+ w
& u3 p% v2 [" p9 _! D4 THere is one example from the file "Haspinst.exe" which is the dongle HASP
# b- e1 Z) }( i$ K2 F6 hEnvelope utility use to protect DOS applications:( z3 W9 C  w5 L% m" T7 a
5 r% z" r5 E: w5 p1 d9 u! y

' Z. O5 `6 y/ V* Y0 S4C19:0095   MOV    AX,0911  ; execute command.
1 _. {3 a- M7 ?: c; R4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! R: U0 r+ q' c( y4 i4C19:009A   MOV    SI,4647  ; 1st magic value.
2 z4 ^  J1 y! S" z/ ?; ?4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
( k- w; |. j# r  |! S3 a4 E4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 c5 j) b: V9 x9 I( m. z; t4 T4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute, V0 z, y/ U2 [! D, j
4C19:00A4   INC    CX6 R, b% T, u! c; p
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 ]3 C" o/ d: P; d4 |* q+ p* S8 n
4C19:00A8   JB     0095     ; 6 different commands.
( V% }1 a8 g9 t& Q7 k4C19:00AA   JMP    0002     ; Bad_Guy jmp back./ h) B7 d" g5 N& @6 y: {: U
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  _! D+ o* x. W( F2 ?
3 Z2 `: f' M6 P8 I7 s7 g5 ?: y
The program will execute 6 different SIce commands located at ds:dx, which
/ e, a+ _/ i) h2 a& [( t8 ^are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) e, E' {' U$ _3 J2 H" g
8 J: S' G  H6 D  ?& b* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ {0 @! v4 ^0 l. Z1 O
___________________________________________________________________________  J- k: x( Y5 l

* ?& ?. {0 {+ ]9 X3 _) ~
5 J0 U. Q( X0 I* V* ]* ~& cMethod 03
* Y/ V) u* c8 e9 Z1 r1 z0 w=========% ^! G- K8 [( F! |' F  h

  `% Q8 n! f  }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' Q: v3 l. h) @
(API Get entry point)
# ^4 b  L, J/ _0 U        
6 J. K( I! _, W1 G0 S' [# f6 ~/ }1 [1 X7 b0 \* q) ^- B8 C
    xor     di,di- _3 r, T) |( t) ^
    mov     es,di. I& A7 M  b! Q% z1 ]
    mov     ax, 1684h       ' i6 V, g  b; q- B# b0 t+ x+ P2 k
    mov     bx, 0202h       ; VxD ID of winice- @/ b& a' e( I7 d9 n
    int     2Fh4 g2 f; W; H: w+ Q/ Y: x& l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 V- p# Z) F* M( Z4 k: Z
    add     ax, di
( A5 e  a. ^7 p    test    ax,ax
  V6 E. v, t5 y    jnz     SoftICE_Detected1 |7 _- E" P7 q1 i4 x' N
5 s1 t$ q- r6 G& e0 M5 t: f) q/ a
___________________________________________________________________________' e7 k  L& e2 {  T
" G/ H4 T/ C1 V/ T. r
Method 044 x' r$ N7 \6 W( Y# i  C, `
=========
- D" n% t1 s3 Q- L8 e- g" K4 F4 B& H- ]( V* ]  r
Method identical to the preceding one except that it seeks the ID of SoftICE
5 }: t, [; G3 X8 F  ]% o- FGFX VxD.
+ ^* D! Z& p6 ~( h$ C2 u  C0 g  E$ A- z
    xor     di,di: h, N6 a+ V' ?  n; a- J6 M* ]
    mov     es,di; C( U: S& R- }  @! e/ l
    mov     ax, 1684h       $ [" w; T1 U  x2 f; w
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( T" j- c$ l9 L0 P2 f+ {+ o    int     2fh
! @( \2 H5 ^$ A) L7 {; K3 }* Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 R2 C& r* n# Y. V; l4 P4 P    add     ax, di
5 x' z/ h4 ?# s) C  i9 B/ C$ x    test    ax,ax
6 ~% ?+ g8 y* T4 {/ z: v5 ?/ ~. C$ a    jnz     SoftICE_Detected
/ k+ H3 L& T! M: I  L; O4 [$ a6 N9 y9 S9 n) _+ K# T
__________________________________________________________________________
- a& Q6 N" a7 X* G1 B7 r* x
# {6 v1 F% _( Z$ d  ?$ c/ _
* R9 }7 F  D$ c' v2 vMethod 053 S7 H* x/ N/ Q3 Y( h  }+ Z
=========
- D1 J; Y: j) Z+ y, e6 f! O; u5 p3 i4 P$ b
Method seeking the 'magic number' 0F386h returned (in ax) by all system
, [$ P) e5 m4 j) ~# Wdebugger. It calls the int 41h, function 4Fh.
: D8 S. [7 f" d" [1 A- k/ o8 Q! b6 eThere are several alternatives.  
0 [3 G  J. d1 q% r( t( I# E( D) S, P2 T
The following one is the simplest:7 h! e! g! t) V/ d

! l* R  m! n5 }. p9 Y  `4 e$ X    mov     ax,4fh
+ l) W  H! v/ v) I' K9 @# w5 F    int     41h
' E. ?3 \. i7 L& E6 z. N    cmp     ax, 0F3868 y9 |2 }) e/ n0 o* t# C
    jz      SoftICE_detected5 N1 z: V3 M- J/ a  `1 e

) E) @, Z, @+ M: X! @0 W' @2 x% Y
) `5 u* y' u, o8 q9 _Next method as well as the following one are 2 examples from Stone's ( Q# c2 X+ N( T2 \4 e0 V. ?" f
"stn-wid.zip" (www.cracking.net):
/ n3 y3 d' p' w
& S% r4 r/ T/ f0 D7 c9 d) {* O    mov     bx, cs" {# Q# y- x0 x5 j7 _' J
    lea     dx, int41handler2
/ Q+ m0 I+ v/ Q  z    xchg    dx, es:[41h*4]: t: a( S/ j2 P: Q: u
    xchg    bx, es:[41h*4+2]: k( w+ L* x. e- T6 @* `
    mov     ax,4fh
( R7 X( Y7 Z8 B    int     41h  T' C9 [6 T& @. K% a/ U' A( |
    xchg    dx, es:[41h*4]
+ P3 j  [+ n! a; P* l    xchg    bx, es:[41h*4+2]
# k$ T4 {3 [3 v4 O0 z    cmp     ax, 0f386h, Z0 E/ w* Y' U3 [2 V" O0 _
    jz      SoftICE_detected$ T/ S) Q" u6 C2 L
: E) E, ?3 B7 ?5 H( R! W
int41handler2 PROC+ Y* ^7 H$ s7 {& O
    iret/ S9 _( n6 X# t5 s& }. T8 a- X
int41handler2 ENDP! t  D2 D5 O+ e: `+ T5 @
' H4 {' u. P) w2 F, J' B/ s1 ~+ Y" S$ g

' ^5 G+ `& a/ N4 X6 c+ ?5 ^9 ~' }_________________________________________________________________________# \2 ^$ e) Y  N# a+ Y
' G, c, b: U, |- N! T" ?
# }# _# ?- Q2 T, K7 t8 T
Method 06
; n* Q8 d( R6 e, o=========7 @$ w+ Z7 |1 e! l9 |# g' v

5 a* T* _3 c% a! t
5 }* I5 W$ y+ x7 s2nd method similar to the preceding one but more difficult to detect:! Y) O5 d; A  u7 @7 I) E# R

/ f6 B3 M$ f6 o% @! t7 y4 |& r# n, j4 C* E5 C5 ]: i- A
int41handler PROC
, F! }, |; y$ y: b1 b1 c    mov     cl,al. H3 }; h2 \$ W3 T& y: p
    iret0 _% Q6 V- M' k
int41handler ENDP3 ~7 K' y" |3 F( @1 N5 ]: a

6 P6 s! b4 b& H6 t! l1 n& e0 ?
% g6 S; c  H' U- x. i    xor     ax,ax
1 l1 H2 ]4 U7 ~  }; X4 F. E/ e    mov     es,ax. p) X* i: C& g) y& @) u% I6 T3 a
    mov     bx, cs
! N' w- l7 F5 l3 o9 g( R9 Q: J    lea     dx, int41handler7 K7 x2 y. W1 b& N; s
    xchg    dx, es:[41h*4]1 P7 G( x& F1 [/ z
    xchg    bx, es:[41h*4+2]2 ]: U) l5 g. c
    in      al, 40h! t' w+ f( S6 [; d+ V/ `0 I; X; R
    xor     cx,cx- O! i9 W8 c6 j7 h, O
    int     41h7 X% g5 J5 [* U* B; s
    xchg    dx, es:[41h*4]: [4 S+ S  e% z5 q2 F+ ?+ t
    xchg    bx, es:[41h*4+2]
6 P' y4 C( H$ p0 R- a6 J* b' p( a% s    cmp     cl,al
7 p/ ]6 T+ t) e$ O0 ]    jnz     SoftICE_detected
5 P/ y4 a8 `5 n! c/ A+ M- n
! l' c, a5 n% C1 q& L+ l8 V_________________________________________________________________________
) e* i2 e3 t& N# B# T& G
5 o4 d6 k5 H; Q9 UMethod 073 o" b/ @2 `1 {, Y9 e
=========
. `2 x) Z  W  _1 o! w) m1 D3 E! \; Z1 P2 ?/ V; W' a
Method of detection of the WinICE handler in the int68h (V86)
2 c' A& q- x: _) D' w! W; R3 _6 V0 t: o+ m& w% o& T
    mov     ah,43h( v8 d- h# h: H! O  J
    int     68h8 x8 ~. ^4 v  o5 w; O; [
    cmp     ax,0F386h
) E, P% j* J6 E2 N    jz      SoftICE_Detected/ \2 i/ {0 a! v# Y" |: Q
9 y4 y/ R$ ^" P( f% `

0 |! ?- Q/ S8 |. K3 E$ F, D=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& H9 t1 O! R5 V) B' v) L$ z! o
   app like this:
1 f5 S' r! E8 \  ]; @- h/ r
0 `; F. J7 ^8 A& H4 k6 h   BPX exec_int if ax==682 T8 K# e; Y; h
   (function called is located at byte ptr [ebp+1Dh] and client eip is  K% S( y9 Q6 D2 J
   located at [ebp+48h] for 32Bit apps)
! @5 [2 M- Z/ Y$ s__________________________________________________________________________) r, y& {: E9 h8 Y1 @& q
: A! W0 P" v8 L, @

* J5 ]9 x" c, ?Method 08
) D: [+ j" E/ f3 q- \& s3 \=========: o% x  a  I- n: l2 |4 V

# v$ J' f  F! cIt is not a method of detection of SoftICE but a possibility to crash the2 L, w9 y% D, e% `% l
system by intercepting int 01h and int 03h and redirecting them to another: C$ _: P: N$ c3 g* W# s; \
routine.
' U' ]# |: J5 T9 Z" K' v! Y, U8 k) w1 RIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points" o1 H* K1 P& M0 ^; ]
to the new routine to execute (hangs computer...)
. y+ |7 G: W! f. |3 C" K$ t: h6 G4 ?0 d9 v) R
    mov     ah, 25h
  ~# \& J( r  ^. U: h6 \5 T4 `* F    mov     al, Int_Number (01h or 03h)- O3 g: d, h: o9 B. e: F+ r
    mov     dx, offset New_Int_Routine
. U* y+ O8 r. P% f$ d3 G' ~    int     21h
* v5 E1 V) l/ ?" x: G3 g& Q# m
, j! C% V, p( a__________________________________________________________________________
9 Q& d/ F8 T! [8 Y& w# j9 |5 J  M( p" e4 |0 ^# [& i8 v
Method 09. U1 y6 \7 G- O% }$ m2 b6 w: @
=========
6 P' C! [' K/ t, ^  C! q# Z) Y6 l, ^7 [) W0 D3 n+ [
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only& [6 ^; o! Z5 N. @' J' F' _
performed in ring0 (VxD or a ring3 app using the VxdCall).
/ E3 g4 y- e# T/ ]- d% ]The Get_DDB service is used to determine whether or not a VxD is installed' i1 i* s( k2 G: ]; r" o+ c0 X
for the specified device and returns a Device Description Block (in ecx) for
5 L, R# V' d/ L) Xthat device if it is installed.9 l' Q3 j$ g3 U( X5 y( V0 H

' v: g( J5 U" }* Y7 D7 G0 v   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ {8 w# g+ `6 f1 P) d' x   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
  ]. d' X& N8 l" q$ L7 C   VMMCall Get_DDB  i. H0 b' g1 X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
8 C# ?" \$ _" b$ d7 W" I, f8 e4 |  K2 ~, e
Note as well that you can easily detect this method with SoftICE:% n7 @4 C9 P, V2 K0 J! J# K
   bpx Get_DDB if ax==0202 || ax==7a5fh/ W& s) R9 A) [( |2 c. h1 ^

9 @" `0 ?+ R" q__________________________________________________________________________" H. C- w: H& A. b% E

: I) I: Z. X8 T, R9 W: F  T! pMethod 104 N- a: Z( v  @# ^8 |
=========. z* w7 W. H' j0 D; N* p5 J/ p+ w0 x

) r) @% S. T0 p" j2 t9 f=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
: P9 A* k: N6 t8 `; F  SoftICE while the option is enable!!0 C5 @1 O4 X6 ~8 r  B

1 q8 r- o& J, s2 eThis trick is very efficient:: {5 X) w0 l9 j% E5 I
by checking the Debug Registers, you can detect if SoftICE is loaded
. R: Q& N- J& Q$ Y(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
! C/ f- y) V" |; Mthere are some memory breakpoints set (dr0 to dr3) simply by reading their
* K6 L( h; b9 x* Lvalue (in ring0 only). Values can be manipulated and or changed as well. d8 k- ^2 O* L- N! T( C5 |
(clearing BPMs for instance)) j2 H0 w. i$ i) _4 E* x8 C

- \( l/ @3 X* I" f__________________________________________________________________________
! J+ R0 K# ~: U" ]8 w! D# m8 l
3 C- v  F2 w6 G  v8 T2 AMethod 11
, o7 l: _/ p- i+ C9 G=========4 t3 P7 C7 l! s. q

+ p* L/ Y' l/ h4 n9 D3 v+ C% ?# d) PThis method is most known as 'MeltICE' because it has been freely distributed4 M. O5 u, y6 y0 `% O, c, r3 F/ z
via www.winfiles.com. However it was first used by NuMega people to allow
8 y- n  B: g  I2 x* E7 MSymbol Loader to check if SoftICE was active or not (the code is located2 S' U; c8 w" ^& p
inside nmtrans.dll).
0 `/ L$ k; e( _6 c" M2 c0 J
* }8 b# G* A# r2 CThe way it works is very simple:& }0 A. E& H" V3 ]
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
" J6 [2 B0 J2 c; o* G! KWinNT) with the CreateFileA API.
/ Q$ b, j3 v3 }, @/ O% _  L0 o
( N! }( g$ D9 THere is a sample (checking for 'SICE'):
6 e5 i8 z& e7 u0 H7 z$ ~; S6 G$ G
BOOL IsSoftIce95Loaded()
8 k1 d$ f, G5 J* J7 K{
0 Z/ n( h, }! o: t, q" |, Z: {   HANDLE hFile;  4 q# O; B; E2 |+ l. I2 J- k
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
7 \8 I- w; C! B9 t) Y2 b# o                      FILE_SHARE_READ | FILE_SHARE_WRITE,  X% o  ?2 ^3 U& W% {) V, o+ t
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);: H; S$ c. l0 Y# a0 W+ g
   if( hFile != INVALID_HANDLE_VALUE )$ ]$ ?# T8 F, h9 n' {2 o% f
   {
6 f7 ]# {$ c7 b/ ?+ a& x      CloseHandle(hFile);7 O. Y: j# ]* l
      return TRUE;
" t8 t8 P/ D/ `$ E- b3 Z   }  M' R/ }5 ]8 ~, P! H
   return FALSE;
8 s5 J' u  h, e" U- F1 s5 x- r}1 J" J/ A4 l* q# @
5 S( F3 J/ ~! Q" _
Although this trick calls the CreateFileA function, don't even expect to be
0 T! p8 k6 D1 y' f) I. H. fable to intercept it by installing a IFS hook: it will not work, no way!
- a+ ^; h: ^% oIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
% c5 J, ?' Z/ e' Uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 C( |0 E3 C6 b0 Eand then browse the DDB list until it find the VxD and its DDB_Control_Proc0 V6 x% }2 |# T0 C( ]  P# u
field.3 M# g& G- W; _* x  l/ N9 u$ T; S
In fact, its purpose is not to load/unload VxDs but only to send a 0 h8 s8 F% j0 h& ?
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! F+ G$ q' `  {% bto the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 k) q9 @, w( n) y0 `: d$ c. lto load/unload a non-dynamically loadable driver such as SoftICE ;-).
- |$ r( l9 U1 fIf the VxD is loaded, it will always clear eax and the Carry flag to allow
) g. |2 |6 t8 S4 Z! l5 G! l: q6 }! dits handle to be opened and then, will be detected.
; a; f7 L( Z4 B7 G# o  l5 sYou can check that simply by hooking Winice.exe control proc entry point0 g( ~, p9 w- h( c, v, Z6 A1 ]( y
while running MeltICE.4 Y+ }4 d+ y- M# I
( X+ y% S% `+ h% c$ O+ ?

5 y' a2 k% O; N/ n' C  00401067:  push      00402025    ; \\.\SICE6 q* l" b) t- f% ^$ L7 J
  0040106C:  call      CreateFileA# n4 b: }0 L9 k
  00401071:  cmp       eax,-001
& ?0 @# v* j, e5 b  00401074:  je        00401091
% e' I/ h% [2 e* w, y) n7 _& d4 ?' t$ e+ Z) @2 t# Y! z+ H  u

: @( G4 l) V, `% w  _7 L% kThere could be hundreds of BPX you could use to detect this trick.1 L9 T) C- P4 Y, t0 _" K
-The most classical one is:0 v, Y9 l2 a( q" k! |
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; z$ D' J: g" P8 C
    *(esp-&gt;4+4)=='NTIC'
" ^1 R  F, @; K, W% D: [) ?) Q6 A( v) M. T3 j
-The most exotic ones (could be very slooooow :-(* L- p- c; {. ?+ z6 k1 r
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    `% I6 D6 i0 v, k) H6 U, L
     ;will break 3 times :-(
; A! I* |. p2 Z9 b: B- ^% B/ `4 [( o8 T" E
-or (a bit) faster:
6 {* H' u/ N3 X   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')7 p4 q  X, H$ v6 e* N% r; d7 E

. n& T2 Q% m+ ~$ L   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'    c# @" d/ g( ]* h  ]
     ;will break 3 times :-(* B3 T1 D/ {2 k; u$ U: E" ]6 ^  \% F: E

. j6 @" r" ?" H9 J7 T-Much faster:2 Z2 V1 _  `2 B& ~. W
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
6 D2 `; v1 d- }6 ]
+ e1 @8 o7 w% u3 H6 O( h9 d: ]' pNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 |1 n* N6 ?0 _' N) @8 Mfunction to do the same job:
9 _' b- u5 e& B; _8 l. H% K: ^  K3 X, C& x; ?* S, j" l- @8 q8 I) G
   push    00                        ; OF_READ& n( J! Q+ i0 E
   mov     eax,[00656634]            ; '\\.\SICE',04 x3 `: }8 o! d. H
   push    eax, C. m* h/ O: J" T: R
   call    KERNEL32!_lopen
7 \) y) Y$ h% \   inc     eax
% Y( X" R0 Z9 B' f& ~, r# @& T   jnz     00650589                  ; detected
* D2 }5 ^/ q$ l; A8 V% _: m2 p   push    00                        ; OF_READ
1 L$ e7 [; ~/ T! P( v% e: H   mov     eax,[00656638]            ; '\\.\SICE'5 m! c0 F! y  K
   push    eax
8 r7 K0 \5 s1 n5 d( L* U4 W* D   call    KERNEL32!_lopen
" c4 Z+ f! h% N- k' V1 @   inc     eax
" T$ ?- X. Z% U# A2 s   jz      006505ae                  ; not detected5 Z$ ^2 j7 ]* t
8 V: C/ s0 M! c1 k

9 B$ r/ z; j# N" E- k3 t( ]; z__________________________________________________________________________- T* E$ B. R% N) f
0 l5 x  V* E* q3 [  F# P, ]
Method 123 a( D8 V$ w; J; r) |
=========
; e7 q' I9 \4 |4 u
2 {2 Z. |  x$ \% ~% e$ F* E" ^This trick is similar to int41h/4fh Debugger installation check (code 05
- K7 C* h5 u6 ?3 d: E&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: t5 t0 h4 U& w8 i  w5 Cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.6 s; F# E  F1 S" ~2 R

: Y" a6 I* z! W   push  0000004fh         ; function 4fh
/ q' O+ j& e; X; X7 o/ n8 T& S9 ^- O   push  002a002ah         ; high word specifies which VxD (VWIN32)9 j- W% [4 ?( m7 `, p
                           ; low word specifies which service2 A+ c! h  i; R* f4 f
                             (VWIN32_Int41Dispatch). w9 K2 {/ [4 B/ N
   call  Kernel32!ORD_001  ; VxdCall
" }0 {, T, n! i: p   cmp   ax, 0f386h        ; magic number returned by system debuggers5 q  {+ L% `$ a3 E) T% U* S; s6 M, x
   jz    SoftICE_detected- Z6 C( i; m) }- l4 ^# |
  g, q( p) I* F' w5 c' O
Here again, several ways to detect it:; }% g+ P1 ]& E( D, a
& C. _2 k6 I( ~
    BPINT 41 if ax==4f' S1 o$ S1 G+ F& |

! z; g# Q' w6 U4 f    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
% G  _! ]: V' M
8 I" S# }/ S& Q9 ?+ t5 B    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A$ ?5 R' A& L/ q5 t  V- k

6 x! E1 I+ o0 \7 ]/ `! a    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
: x5 d4 @0 @) m  h; r: {& C- i3 U7 ^4 Q3 p
__________________________________________________________________________
0 n: Q7 G. n3 T  M
; i1 Q+ ^% m- ~# ~Method 13+ E+ L$ u, d5 T8 c
=========7 k- r5 v; \6 g0 B& e$ ?  k4 R
/ i3 u9 @( p! p3 S3 [2 G6 d
Not a real method of detection, but a good way to know if SoftICE is* X9 }* ?& y& W. [  h( h( g
installed on a computer and to locate its installation directory.
* B/ g" {4 ?; ~- n/ v9 p( SIt is used by few softs which access the following registry keys (usually #2) :8 J! D* x7 `# |5 L
; m- H# h- N% B; u
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: P8 @2 e8 x2 I" ^! F. W" a
\Uninstall\SoftICE
& _* M: G0 C, m# J* I-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
9 M8 h  u" o, l/ e9 N) L7 L& N-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 i1 ~+ j& l( P3 _
\App Paths\Loader32.Exe3 |8 }9 ?8 i( x6 l) `5 {
$ q& r: z, O; w/ c& V* J4 \. h

/ X; T7 R. w! B) ANote that some nasty apps could then erase all files from SoftICE directory
) j0 L6 ^+ L' H- ^9 S(I faced that once :-(8 b; ]- M+ U) Z; {4 C% o

$ f2 L* ~# H. l; HUseful breakpoint to detect it:! `( d, v$ t0 ?
( c. b6 Q" z) T/ U9 r/ {$ K8 {
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 c1 w7 N2 }) D" h! m$ T

$ r- e+ @) Z3 h, u4 W, D__________________________________________________________________________* }% i% K' r0 n' q- j6 ^
0 H+ Q# f5 j+ l# F$ R, a) E
. P1 d6 Y* H1 E
Method 14 " Y( ?- I( j2 f7 f
=========
6 s  I4 W3 S4 ^. {) |0 ]/ D5 W+ s6 c/ s) m$ g# J
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 K, W4 ?' N) f; C) k* B
is to determines whether a debugger is running on your system (ring0 only).
; G' u% X& U0 H" Y* J9 w4 n* \+ ?& e+ f4 @; M. \
   VMMCall Test_Debug_Installed
* g3 ]2 V- e- Y: B3 Q; S0 N   je      not_installed; K* Z9 a. `) t1 c& R9 m

5 o& {0 p! p8 ]This service just checks a flag.2 h9 \* b+ y, p7 {
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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