About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
" r% f# Z% x0 Z<TBODY>
  s+ w3 ]6 z2 l+ r7 g<TR>
. N3 A0 S# i% Z- V6 D<TD><PRE>Method 01 - B! f; A. Z- z# h% O; n$ X
=========
- _! T% S2 I6 ~4 i+ c- X5 b; n: Y& n& ^. p
This method of detection of SoftICE (as well as the following one) is* a4 o0 b7 M: x3 H
used by the majority of packers/encryptors found on Internet.
6 P0 q1 n' u( D( _It seeks the signature of BoundsChecker in SoftICE; y. Q% u% }5 D5 ^: C, S
7 d# {: c! ~" y! e# r8 S: \1 Y# k
    mov     ebp, 04243484Bh        ; 'BCHK'6 i& Y! c2 F# y, Q/ _
    mov     ax, 04h1 [  B7 Q7 H; e  C! g
    int     3       8 d/ w  [. s8 W- u: ^- n- T5 ~
    cmp     al,4
) U% c# A& A. o    jnz     SoftICE_Detected
' z/ s# X5 ~/ g
& m# A/ A. i/ r5 R; e___________________________________________________________________________
8 k6 p% ?( ~- l3 n3 Q1 L
6 a' z3 h% I7 _* z/ P9 [Method 02/ @% A0 \$ |+ L# U+ e- ]- u
=========2 G" z1 g$ ]' g7 R

, v; ?- I  [- g, L6 E: W1 f5 ZStill a method very much used (perhaps the most frequent one).  It is used9 h5 P3 f& j, {- W0 W0 j5 `
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ v( Q8 B5 Q8 _9 W' qor execute SoftICE commands...( A, r+ w) U. A  B: d  v( N, V* [
It is also used to crash SoftICE and to force it to execute any commands% M6 f6 [5 u* _' V# H
(HBOOT...) :-((  
6 J# ~# O/ o6 n4 D2 y2 a
. x  {2 ?$ |( P* N; `0 m  j9 ^Here is a quick description:
/ I+ B  {1 X: a-AX = 0910h   (Display string in SIce windows)/ |; J5 [  @* z/ Y, h+ \
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)& N' m) D/ x9 y2 A& ^$ f' o" H
-AX = 0912h   (Get breakpoint infos)6 Q. X) v7 H1 ~0 }
-AX = 0913h   (Set Sice breakpoints)1 D# C$ U3 `7 e) x: L7 X8 O
-AX = 0914h   (Remove SIce breakoints)
" |9 W1 K' s' u  |. z* |
# l' l6 {1 j4 `; ^8 a. t  A0 ~% g8 GEach time you'll meet this trick, you'll see:
( y! }* {/ ]  A' K/ ]; I-SI = 4647h" a9 E; o# r& D( k# N# p5 t5 \
-DI = 4A4Dh, H& {! a$ z0 r0 K* P( d
Which are the 'magic values' used by SoftIce.
+ e9 I+ a- q" X6 Q1 }0 l3 M7 \For more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 }  K* Q3 W' G9 r$ F% P/ o
$ U' x* Y. m5 t) H  e$ g/ B
Here is one example from the file "Haspinst.exe" which is the dongle HASP- c/ I/ n: y* H9 g
Envelope utility use to protect DOS applications:2 Z  z* f( d1 j2 u& I! P  F+ e
0 ?- c$ }9 ]: g# m7 X& L$ |
& j9 G/ x# \4 @2 ^4 g  u
4C19:0095   MOV    AX,0911  ; execute command.
/ j. m6 s4 q3 G4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 S" P3 r% `0 Z9 r, ]  I+ J4C19:009A   MOV    SI,4647  ; 1st magic value.' w# X3 M3 o" k
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- ?) l0 i+ U0 q( @$ U& A) Q
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)0 N) D9 b6 y: j; D4 h; |8 x6 J
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ H+ p% C$ {1 x. A3 y/ I( K4C19:00A4   INC    CX0 q; x$ I7 E* D  F/ a! v3 W/ d
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 O" I. k5 [, Z% @" @4C19:00A8   JB     0095     ; 6 different commands./ R" H- O4 d; Y0 V
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# c7 |  C$ a4 L( l2 @# d! L
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); f7 G) U1 N* w2 P

  d2 \. g$ V: h8 fThe program will execute 6 different SIce commands located at ds:dx, which- Q, l) |5 \$ g+ e  l2 g# L3 r
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- j' b( k4 j/ \- P" Y3 Y6 @  t7 i* [# o+ V
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.+ x  p! A7 H1 m/ S+ ?. [) z* N- j
___________________________________________________________________________
$ Q; r9 [# b0 b1 L6 X/ K7 J& D0 Y. Q! h
, w- \2 j  V$ \" T
Method 03
7 a7 n8 \0 Y! v=========$ H* ~4 p. Y% c) X+ l$ _
" M2 M3 F. ?7 u; X9 Q
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 a- F, Q4 V4 b& d4 C( J  u5 S(API Get entry point)$ c# S* T+ d: D7 A
        ' I- N: D4 U6 p5 y0 r) E
$ Q- g# b" S1 h& B$ C
    xor     di,di! q! i4 ^3 }& N: |% p- ]* G
    mov     es,di1 H" @( T* c* {& n4 V- @
    mov     ax, 1684h      
: y/ Q, O' K( m# v: }' @    mov     bx, 0202h       ; VxD ID of winice7 L% N! b) y' l7 F' D$ e
    int     2Fh! `) w. h5 Z: j9 N9 W. u
    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 [9 O5 g9 Z1 l! o  v$ T; V/ G
    add     ax, di" W% Y) l+ I* W% k' i" \' i
    test    ax,ax
- K* R( m( ]+ H, D2 d    jnz     SoftICE_Detected1 e3 o0 v9 O7 ]7 N4 P# }
8 `- W- F1 Y- F& N+ `4 Z3 }! X
___________________________________________________________________________7 Z2 L* _% X+ y# P- R) x7 w

! u! P4 j; Y# Z; W+ ]2 M5 i% @3 s: bMethod 04
8 x. H3 Q, d* @- e: ^=========
# Q% C4 s" ~; l% L& y; C: V3 n( I4 d  o  S1 r$ L3 W" k% y# E
Method identical to the preceding one except that it seeks the ID of SoftICE& d# r8 W9 V" x' a3 r7 z7 n
GFX VxD.
. f1 t: Q; T( c  S# o% @8 {! P1 x8 n
    xor     di,di
0 y- o" C. d/ T0 W. D    mov     es,di
9 U1 d' N4 i# T; F) u% t    mov     ax, 1684h       8 E  {+ W( t) p1 h* k
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. v0 `7 L5 ]+ F' [( j8 d. H    int     2fh
4 n& e0 x. e, S; B( w    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ J+ M& U* x7 t& d
    add     ax, di3 l1 H0 q% ]3 C) A# {
    test    ax,ax
* o1 ], }  q0 S$ q" I    jnz     SoftICE_Detected. N2 {: A( A" a9 U2 R9 l& S
8 f6 M8 h$ I3 Z; b$ a
__________________________________________________________________________4 S% z4 Z& g9 P, G6 [3 w

! `- J* m* I/ C- [! O" ~7 ?' }0 S7 l7 ?
Method 05
  r* K5 e) d( S$ C! \=========
* H4 e( M+ l# A  ]$ P- D5 Z3 X- H; Z, d( `# H6 ]5 R, G, [, S! Q# m
Method seeking the 'magic number' 0F386h returned (in ax) by all system
0 Q! Y7 w& k) ~% L$ p. Ndebugger. It calls the int 41h, function 4Fh.
; g: I) O9 x: h, l1 ]7 }1 iThere are several alternatives.  ) @# f' l# |8 l. ]

' v9 R/ I. \/ g: Z" F* jThe following one is the simplest:2 P' Q+ [, j1 {2 u5 Q

, \* s6 k& s, B8 a6 s6 n- b    mov     ax,4fh- \1 J" w7 r  d
    int     41h% B+ c( |, ?- l' `9 Y  y0 P
    cmp     ax, 0F3860 h5 j4 L3 x; H
    jz      SoftICE_detected" G- L& C7 L0 n: _7 ^, W' V

1 U/ U" n" T( e5 ?9 j0 _5 T) b5 n, U  s: o# o
Next method as well as the following one are 2 examples from Stone's
) D0 {" }8 m- k- c6 w/ V"stn-wid.zip" (www.cracking.net):
/ Q& j) \4 U8 m2 o$ D) \4 l+ ]
5 U( z2 h. q( r: @( s: Q, i  {5 e    mov     bx, cs
' o+ Q/ ]+ c6 P6 c/ T7 ]8 v) A    lea     dx, int41handler2
0 B' C2 F2 K! H" M. X    xchg    dx, es:[41h*4]( m/ r* p( h$ A# d) v
    xchg    bx, es:[41h*4+2]
8 \" W3 j4 d3 y  J5 a4 a) M7 ~    mov     ax,4fh
6 S! {$ T6 ^  v$ O# q: y! u: e2 I) {    int     41h
$ e/ [2 d% ?, D* i    xchg    dx, es:[41h*4]3 G: B$ |, b# S. c8 {4 f, J2 `
    xchg    bx, es:[41h*4+2]
8 b. `8 l3 {4 U9 g    cmp     ax, 0f386h; [) {9 M7 `' y, y% x2 M9 j( ]
    jz      SoftICE_detected1 f( w9 K7 P4 b, |" T8 z
4 z& E9 n' V1 T+ r+ M: ]- J3 o
int41handler2 PROC1 w, `2 f2 V- S8 M# A' a
    iret
* v/ f' x! p( m1 g" q+ Xint41handler2 ENDP
. C; N. ?1 G- g* e- h5 ^/ M  s" C
. o% z8 N3 J# v0 A' ^- z1 B- y( j  c) {! v# y; o
_________________________________________________________________________# w  `, G9 e3 C* D- a; c
7 R! g/ q0 z2 d& y9 ~9 c

, W% H3 p% s2 J) AMethod 06
' ^! u; {4 ]) {, J=========
& a" A4 x" l; b4 {/ s/ V- `  W" Y, G, O1 L# j, t3 D7 E

  w2 i  a) N+ I( V7 H2 R2nd method similar to the preceding one but more difficult to detect:1 L2 e, g0 o% j4 K/ N/ ~

- ^; f3 Y; ]! X3 M9 C* `5 K- s# [7 B2 t! I( j5 s7 t* V& @
int41handler PROC
/ `% o; l) H9 h4 e* H    mov     cl,al  _: f, Q$ ?* H: s1 c6 h' b
    iret9 p3 D. f$ k: l! T
int41handler ENDP
" V& f. {* ^5 A7 e2 Y3 t* _$ d) Z4 Y
$ t# e6 D& R$ H& W! Y& m
    xor     ax,ax" c( S! v% v9 N& L/ ?  s& V  ~
    mov     es,ax  f) J8 e% d/ g; L9 g( `3 ]( i% B2 l/ Z
    mov     bx, cs/ {& c, g) A! n1 u2 K8 x# X  w
    lea     dx, int41handler
! z% d/ J3 e7 A7 ~* b    xchg    dx, es:[41h*4]
7 h/ W" [7 d0 t' K; }    xchg    bx, es:[41h*4+2]
* {1 O! T% N1 I' N& V3 m* _1 O) T' p    in      al, 40h) d- L! j! z- F3 @7 \( m
    xor     cx,cx0 F* l4 x* U) t5 Y) `3 B8 f
    int     41h4 m+ b$ r& D5 C7 e( n( t7 i
    xchg    dx, es:[41h*4]. B/ ^+ C. P) `  h' D/ {
    xchg    bx, es:[41h*4+2]
8 }% Y, Q( P0 P9 x0 j. a3 B    cmp     cl,al
: u/ B& R9 _, `) B0 t4 u, ^5 y    jnz     SoftICE_detected
# W9 M6 P1 M# {5 S$ d1 M7 j# X* S3 i( F& w9 O# w- W
_________________________________________________________________________
  Z- K5 [* L; }+ _4 ~; T2 u3 j( R) Q4 o$ `
Method 07
, ^! q* |7 z- R- J=========
# Y' ?5 t1 {  s1 h* _" b) O2 z2 j! V/ X9 j2 G
Method of detection of the WinICE handler in the int68h (V86)3 e9 q% @" t6 r  M" `

7 d/ _* r& U8 [8 V) H% |    mov     ah,43h6 w% N& k5 x8 U
    int     68h* M, o' a' b9 a& N
    cmp     ax,0F386h
4 U% }1 e8 w% k4 {    jz      SoftICE_Detected
4 \5 c! h6 o2 D5 _9 p: r/ l: [# P# E+ b' }. E

7 m7 {% Z6 U8 q=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 g: y- ]; ~, p
   app like this:
* E" r3 W$ }- y- `  C1 V# E9 @4 l, r. D/ _, z
   BPX exec_int if ax==68
: ~4 k7 j2 p/ U, L% k   (function called is located at byte ptr [ebp+1Dh] and client eip is
: C: Z9 s5 u6 T  d   located at [ebp+48h] for 32Bit apps)' I" M) P; I5 a$ c! S+ [
__________________________________________________________________________
1 B7 j7 O' L2 Q  D& h
7 {7 Q3 }$ K0 q% S6 P  P1 w$ H
+ v0 F* x+ E: D0 U) B( M' l4 PMethod 08* c! y; p/ S. M) \
=========8 P/ h3 g" @/ d3 J+ g5 p9 N
( {3 Y$ k) Q' x7 X( u$ m, o
It is not a method of detection of SoftICE but a possibility to crash the& T1 k4 h* B5 o$ U3 N6 H0 ?; E
system by intercepting int 01h and int 03h and redirecting them to another
7 ~( Y! S* d8 Q# {9 ]* \! n9 D, z, Rroutine.' ]/ u7 P3 ~# t# E4 L& X
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points. M* G/ x/ F$ W: f, w
to the new routine to execute (hangs computer...)/ e9 Q1 A2 z6 U5 b# I) ]
, B( b2 F+ r6 D
    mov     ah, 25h* S& D; {* |8 O1 {) i" P+ y& f
    mov     al, Int_Number (01h or 03h)% x0 e  q7 p0 b* u* U- x* g1 Z
    mov     dx, offset New_Int_Routine
) c7 |8 D7 q4 D9 p; H    int     21h
% L% n5 w1 w1 E$ L7 H' L, {: E( U! ^+ Z- T9 Z" _7 d6 ?& [' z
__________________________________________________________________________
/ @% ~- ?! S2 w- r' u
) e3 ?$ X+ A5 b* X) oMethod 09
* \! D+ `: M. {4 j& n=========. z! H. ?# Z; V3 }0 e, N

6 C4 n0 q- u: @; g2 K: d! eThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only. n( [1 A- U! b0 E1 f2 c/ }
performed in ring0 (VxD or a ring3 app using the VxdCall).
7 R3 h  v! e6 ], ~1 YThe Get_DDB service is used to determine whether or not a VxD is installed
  c9 _% U: U7 V* a9 r8 hfor the specified device and returns a Device Description Block (in ecx) for
( v/ e* u/ Y9 Athat device if it is installed.3 a0 I. q% y  I/ H8 E( @' d- p# B- |
4 @1 D0 s: _7 }3 D
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID% j/ G8 d) @% K" H% y
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 d/ W: P. Q6 y( R0 w   VMMCall Get_DDB
; }7 u- o- ], m/ u0 ~0 M   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
3 X; p& S& Q& J9 D8 N; c6 I( Q: X
3 Q; M+ I  v/ ^) u/ I7 cNote as well that you can easily detect this method with SoftICE:# x3 P2 T% W1 J! \4 ~
   bpx Get_DDB if ax==0202 || ax==7a5fh
8 f3 o' f7 U% Q+ U( M0 c$ n; e- Q, U/ F4 J& E' P
__________________________________________________________________________3 S0 B. M9 R9 \1 Q. F0 b5 Q5 R
0 L( b" B6 D) G( \
Method 10
. ~0 K5 J0 }/ f) o( E=========
5 L1 }9 z' J# B2 X$ e) J7 O# n: w1 r! q" b- x7 }6 d) k4 P
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
: x3 L; M; B; V" `) i! b) g  SoftICE while the option is enable!!& v6 H* G- h9 Q. P2 {: K: K# p1 M

/ \8 h+ ?) R" A: o$ \! {This trick is very efficient:
6 n- \  k6 y" g2 t2 nby checking the Debug Registers, you can detect if SoftICE is loaded5 ?0 E( u0 d/ D  x. M& n0 T* S
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( L3 C' l$ l3 C+ n9 wthere are some memory breakpoints set (dr0 to dr3) simply by reading their
# I9 K% `7 {7 D4 ]7 b6 S* S- q) Nvalue (in ring0 only). Values can be manipulated and or changed as well
) d  Z6 }2 \* p+ `" i' }- n(clearing BPMs for instance)
' e" ]( ]2 M3 @. f; m- B
7 \; F/ |+ ]5 d! u__________________________________________________________________________1 V' C6 v6 z' W% a3 q/ D

0 J; s0 [9 i  c1 ]; i0 GMethod 11! w& y) T. G+ D! E- h
=========- |% J) j" g; {8 f7 q
0 W; ?: m8 w$ o3 ?
This method is most known as 'MeltICE' because it has been freely distributed# y* y. Z2 l' P/ D
via www.winfiles.com. However it was first used by NuMega people to allow
' t3 I0 R- K1 f; _0 ^8 hSymbol Loader to check if SoftICE was active or not (the code is located
( l3 q" T% W* ^4 M6 Finside nmtrans.dll).
, }9 i0 _7 {$ t4 b* I: o% ]) x6 Q3 S: @
The way it works is very simple:, \; F7 d; }) I5 r( K
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
3 w* f1 K5 L- P( |" wWinNT) with the CreateFileA API.
3 h; H2 \! q8 u& [3 g4 ]( K* F9 a% b6 ?) Y4 A4 I
Here is a sample (checking for 'SICE'):
6 {7 G9 I3 p/ S) |; |2 ^, t; ~6 V2 X3 }6 ~: W: ?" P
BOOL IsSoftIce95Loaded()1 D- B' w; t; \: i% y. O' _
{
, w" k3 R4 w- u   HANDLE hFile;  
, i: e# t% B3 J- t$ F+ M, l3 g4 }   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,! u. m1 i8 C# F
                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ S( M7 J- e( F& i( Y
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 V4 _* N- Y; ]) Y: j/ y
   if( hFile != INVALID_HANDLE_VALUE )! M# X: G. n% ]. e+ T7 w0 h
   {
3 f! E0 t5 m/ x2 c: s3 `      CloseHandle(hFile);
/ p7 Z6 s' t/ Z. y) j* l' S      return TRUE;
4 P  b% B0 L" Y5 H0 j3 v- l   }" w/ F- Q6 |1 i4 j
   return FALSE;9 Y- Z0 k$ I# d' f5 `) n
}
+ j" j8 C8 Y, Q/ r: Z8 C. W
' Q( C3 U4 M( e: R* a7 qAlthough this trick calls the CreateFileA function, don't even expect to be8 o8 j* ?0 Z" e0 j! b5 T6 _) Z2 `# u
able to intercept it by installing a IFS hook: it will not work, no way!
0 C/ W4 G+ P4 i% H( PIn fact, after the call to CreateFileA it will get through VWIN32 0x001F, a  F+ k! V$ |$ n/ |3 \' J
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)$ s/ S) t+ M1 ^6 j) C
and then browse the DDB list until it find the VxD and its DDB_Control_Proc4 u; M3 v, \; n( ^7 H
field.
5 s  U& q% y9 X1 G6 a' aIn fact, its purpose is not to load/unload VxDs but only to send a : e. i  `. ~2 j- c
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 U+ Q$ I- e% B  P8 w0 w  B
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
8 @5 s. }/ C, @4 e, b7 u* Eto load/unload a non-dynamically loadable driver such as SoftICE ;-).# h& \, N; h. }1 c# T9 [
If the VxD is loaded, it will always clear eax and the Carry flag to allow
/ h* ~0 h4 }7 d% o0 x% s5 \# uits handle to be opened and then, will be detected.
2 i3 O5 i, q, D% pYou can check that simply by hooking Winice.exe control proc entry point
6 V  ]+ X* f' W. n' `while running MeltICE.
2 h, @- b% Y( y+ U$ Q0 U1 ]9 ~& \9 l3 |3 L0 [1 D7 f
5 C* g5 o8 L" V, }  ]; o
  00401067:  push      00402025    ; \\.\SICE
( E) L* O5 N; ~0 r+ S' x5 a  0040106C:  call      CreateFileA
/ V) U$ u  K5 [7 j, Y5 v8 ~, ]  00401071:  cmp       eax,-001
. L% R* _8 J, D$ Y  00401074:  je        00401091
8 Z# v  y0 C+ x% \. [2 ~4 Q- }  S, A$ p1 c$ i# W
6 v( ]% [& h' ^" G- J8 ]
There could be hundreds of BPX you could use to detect this trick.
* [: `( k6 U2 G% ^. W/ e1 |* r-The most classical one is:
9 H. y/ _1 l! C% a7 X! U  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
6 V  a; g1 t5 u/ w, a0 X    *(esp-&gt;4+4)=='NTIC'2 X+ N$ M" {- J2 j' ^5 q* S6 J
4 ]$ t2 f6 M1 M7 v8 ]3 j
-The most exotic ones (could be very slooooow :-(
1 t" O6 p) W! S* B4 l   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  2 _% ~$ {- H8 d* G' U/ N
     ;will break 3 times :-(2 J2 f( S9 B) z% ^, r

9 F) n# r- y& y, Q: X-or (a bit) faster: 0 _/ M" R$ k3 B
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')+ [4 u5 @" I! h

. ?. h+ r( l! |   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 `& l5 b- w. I  B# Z& W' K
     ;will break 3 times :-(
- x: T. ^4 m1 p* u" o% }, U0 t$ M* _* \  v
-Much faster:
- w& O' U  t  @3 N/ [   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 e  @8 c2 C4 ~) M: B/ _2 e
! y: ]& n2 B5 K# Q
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
: U* T8 I5 w" Z3 W3 z* i% m, `function to do the same job:. t! |2 L0 J& L0 G$ d
, z0 i7 u6 x, m5 h
   push    00                        ; OF_READ# v' S! J; S" G( i' l
   mov     eax,[00656634]            ; '\\.\SICE',0
% m) k: N! ^: b% u* p   push    eax* ?. r. c" T3 F5 {$ G
   call    KERNEL32!_lopen+ E! k! C3 O, }
   inc     eax
) ]4 ]. n5 p3 Q2 ^6 E: }) [" r   jnz     00650589                  ; detected
7 k6 Y6 R4 ^6 G) m! |) C, E   push    00                        ; OF_READ
' x+ k5 u$ i" ^" j: F& }   mov     eax,[00656638]            ; '\\.\SICE'
* X) Z( }. F3 v) A   push    eax
5 F- ?' ~' d. l$ l$ u   call    KERNEL32!_lopen
- {2 n0 J- w7 q1 d   inc     eax
' q$ J- j! L8 j" d3 M/ E   jz      006505ae                  ; not detected- D$ ?* n. |! u) X/ \' _3 }
1 A' V" R) P! s. q5 j% O
. V% C4 m6 t+ k: C
__________________________________________________________________________! Z! ~( i. l; x1 |$ ]$ o6 O" H. l
5 D- W5 f( S1 d- v5 i8 }& r
Method 12
  x3 B3 d( \' H" P, e; G=========
6 a& o- _! g: K( M* D, n+ X' A
This trick is similar to int41h/4fh Debugger installation check (code 05
+ h5 W3 i' k+ m0 k  e$ @1 C&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 k% n  _  o" H3 j# r9 a
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; d0 p. c+ o- Z& b7 i7 s- t. |6 G/ s& c2 K% P# u4 X2 f& y) `( s
   push  0000004fh         ; function 4fh
6 ]8 M. v- O' {# j9 ^   push  002a002ah         ; high word specifies which VxD (VWIN32)3 C8 N7 ^% R, B" ?( Z  _8 F. ]
                           ; low word specifies which service
- N" }! ]% v- i4 ^                             (VWIN32_Int41Dispatch)
8 |* g# Q5 i: W( c8 n   call  Kernel32!ORD_001  ; VxdCall$ P2 D" V1 f1 B+ a2 k
   cmp   ax, 0f386h        ; magic number returned by system debuggers" H/ g9 V0 {  o  e7 D4 g, _8 ^
   jz    SoftICE_detected
: I4 R/ d) h9 \- ~; W- H; j0 e. ~# x
Here again, several ways to detect it:
2 H4 o8 a9 T: B9 u; g! a# e: k) O9 `1 K; |& r3 d* C7 Q
    BPINT 41 if ax==4f3 o, K9 L" B# H! R" L3 l
% s+ q4 U% ^$ e! N3 P% @
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one% Q; p9 N. V; o1 \  ~8 S
% b" R7 E# E" @- X1 e
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; I* H) x* E: {& A$ ]- a
" d* A4 `1 H8 u' D    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 o7 }/ K8 ^* r; v

4 ]5 ~/ G0 A- B' z: q; K: K__________________________________________________________________________: A1 @8 d8 e8 a) R

. i2 t4 c7 D4 W9 f+ k9 BMethod 13- Q0 w: t  H# g4 x; }$ k/ B9 |: x& s
=========0 K8 F4 W/ |8 i

9 w$ d; t) o: ~0 @3 v2 d2 S9 BNot a real method of detection, but a good way to know if SoftICE is! m$ e2 _" S6 I6 U) ~, Z
installed on a computer and to locate its installation directory.  |) C% R+ T, D, Y
It is used by few softs which access the following registry keys (usually #2) :& l* c! |: [& o1 d
0 G; e& j$ W3 \- J3 K0 h
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: @" P5 b# J" N! Z! G8 m1 ?\Uninstall\SoftICE
2 n% l! |! G4 c-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. m7 p; y; t& A# ~( a$ ~
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( j# A, R1 g, E6 [' I1 d- @\App Paths\Loader32.Exe
( A. A2 |. o3 w6 a# s$ V. T3 k
1 j1 [. k% Z6 a: B# q5 z5 o1 A: s
Note that some nasty apps could then erase all files from SoftICE directory4 ?8 c" A$ W2 `2 }( F  d8 a. a$ e8 _
(I faced that once :-(6 u  x2 A% g; x( C, v" x  G" l7 J
5 Q, u( Z2 p! u" T$ H" V
Useful breakpoint to detect it:
1 x+ I) i; H0 b  l* Y4 n( d. }( E2 Z. U/ Z7 C: d6 i9 R& t8 X! S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* C+ ^) \) x8 e/ f% A2 i0 |
; b$ K6 R; _6 Y; R) a7 w( o" Z__________________________________________________________________________0 H2 O9 X% {( a- z" c) j

" S1 `) m! Z4 ?" O! p4 W- m9 l* S5 S/ J' l
Method 14
5 ~9 ]! B$ F7 V4 h" P3 H=========
5 `# d, C* e% E7 k5 W$ Q) b8 Z3 r$ f4 ?1 w& L( P7 k+ L- N
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose8 _  N( Q3 a* `& y2 q3 x3 c
is to determines whether a debugger is running on your system (ring0 only).
( A0 u% y, s1 l. }" y) i. E9 Y( |) P3 S9 k- ~+ u
   VMMCall Test_Debug_Installed
8 I2 |, }% f+ }' V   je      not_installed
( _8 d7 a7 g" U$ z+ _; o4 c' f0 w7 w( c' v1 c) w; ^
This service just checks a flag.# }; B7 D+ S9 V  j! F* a6 n4 Q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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