About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>/ L7 g) J4 S- a( S# [( K/ ^
<TBODY>
) S5 N0 [# C& R7 v9 \: G<TR>
& U- z, d4 L" P& m) ]" H0 Z<TD><PRE>Method 01 4 z7 d+ [+ {+ K" P0 m; x4 l
=========/ w& ^( d( B! T+ W

$ l6 u8 D6 O/ P9 n. }7 ^) NThis method of detection of SoftICE (as well as the following one) is
9 G4 g6 `. v( j) M4 k2 ]: D6 R3 i( Rused by the majority of packers/encryptors found on Internet.
- G2 y  e2 q  ~0 `It seeks the signature of BoundsChecker in SoftICE
$ h, G, }; \( O- c6 h
- X3 U  I& z8 a2 S- X+ ?; b( C& _    mov     ebp, 04243484Bh        ; 'BCHK'
7 P: G5 h; P0 X; B/ Q    mov     ax, 04h2 c* L7 z5 R2 ?" ~
    int     3       ! U: H. N3 |' D+ ?- N
    cmp     al,4/ T9 O  y- f+ X) Z" `, a- f/ v. G! H, M
    jnz     SoftICE_Detected4 a/ P7 K" n: y0 l( @; t6 ]; |) R3 c
( V/ ?0 D# [' M/ q: y' E8 x
___________________________________________________________________________
0 q9 b2 T+ z5 s4 A; y0 z& Q# q
' d: y# C) K' Y0 e+ f6 D$ u+ XMethod 02) S# P" m5 H8 O7 \
=========
4 s% Q' `1 T4 l5 F# v! p3 z: [) @* A5 N' C- o, s5 b- @  h
Still a method very much used (perhaps the most frequent one).  It is used/ t6 b  L  A* S+ Z5 h2 A2 H+ \
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,1 S' q4 F1 }' y0 \" w
or execute SoftICE commands...
- A# W; j$ A' u/ s1 j$ AIt is also used to crash SoftICE and to force it to execute any commands
: c8 M, g- v. B" q8 P" o) `(HBOOT...) :-((  5 Z$ x: a% q0 \
; Z) {2 c: R7 |
Here is a quick description:
- F, Z. j5 R0 S: M; p-AX = 0910h   (Display string in SIce windows)
+ v! {) d" |1 }5 Y: N4 w& X! q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 E1 d4 W) l% u
-AX = 0912h   (Get breakpoint infos)
# H1 ^1 d' C3 O, r3 J-AX = 0913h   (Set Sice breakpoints)( K7 ]( q/ A7 c; N: M! @: I: D
-AX = 0914h   (Remove SIce breakoints)/ g1 i4 y; Y3 z, w: m. K6 |) V
3 b  j; C' d$ e' a! g5 K
Each time you'll meet this trick, you'll see:
' Q3 F; `! X" g! S-SI = 4647h6 H7 f9 W9 o2 w* m1 N; u! x
-DI = 4A4Dh
0 [& y2 v3 T- UWhich are the 'magic values' used by SoftIce.8 Q, v& Q$ g4 V- n
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.$ I1 R$ R- T3 g% x+ F  U8 M$ @

/ l+ y/ b$ P$ t4 w& vHere is one example from the file "Haspinst.exe" which is the dongle HASP( h4 \) z& ]. v; [
Envelope utility use to protect DOS applications:
2 R0 S( Y, b: k4 o& u% c6 d' h+ v) M9 K- T

$ |% ^# k1 a* L- F4C19:0095   MOV    AX,0911  ; execute command.
( R6 [( d- b. C; S4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! a- a: h, x) \- b2 E: P# `4C19:009A   MOV    SI,4647  ; 1st magic value.
# B# h; @' u3 \- x4C19:009D   MOV    DI,4A4D  ; 2nd magic value." a$ O  Z. |6 Z* M3 R" e+ \% p& M
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 E( k' ]4 F) [7 y4 K, i
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute; ]1 I+ i( q6 W# B3 c
4C19:00A4   INC    CX
0 c0 S5 I) \# Y: e# R9 T4 `' R# M4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: Y( k2 ~7 R& f
4C19:00A8   JB     0095     ; 6 different commands.
) \9 i$ ^* K7 ^' z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- a% q7 U" U8 V1 k1 S) C' O4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 R, ^7 M; N0 I8 D/ h* ~- l) z
7 b* r+ `% ^, k/ v$ t/ XThe program will execute 6 different SIce commands located at ds:dx, which* C, H+ o4 q" w! Z6 M& z1 p# }
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- [7 v4 d: W3 C% O7 r! Y
  R; Q! Q8 a/ O: y; x, j* t
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
" T5 [* s# M& ?$ z___________________________________________________________________________% G3 b- r! x" [
- l$ r# w7 Q. ?9 |* ~9 a
1 \' v& m2 y% k( g# t5 ?: m# w
Method 03
" R' v: H0 x. @) e$ O=========0 \3 a# o2 D# k6 d: e! V) @7 M

' h, A% |: G4 g1 k, i: f4 cLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: f4 b( z; M1 ?- D- n5 ?
(API Get entry point)
2 O6 i, z% |, i" H: H2 o. }        , N2 W9 K7 h+ l3 p
; y2 n* H0 H2 \$ n
    xor     di,di/ _- \, C) Q% F( l* Z1 `
    mov     es,di
( c3 g7 A. q) s4 x' U    mov     ax, 1684h      
- A" D! N# r2 ]. N; f' x/ H    mov     bx, 0202h       ; VxD ID of winice
  _0 Z8 n" q, ^. J& J+ S1 W0 d* j    int     2Fh% I" h4 x/ a' f9 e
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 M7 s1 l3 c3 ]5 J# E
    add     ax, di
8 X/ V3 \* Y4 u    test    ax,ax& {' m6 X& d- w9 r, ~
    jnz     SoftICE_Detected
7 S, {( i$ L) `+ f! M- H% s8 t. _% j; D
___________________________________________________________________________. P6 m5 w+ h8 d
  X( P/ J9 M/ W  O! g
Method 04
7 U" Z+ I+ h& L) P7 G) _( j& W=========
( K) O0 {6 r$ _( f# t" ]
% u3 C" c! k" h4 kMethod identical to the preceding one except that it seeks the ID of SoftICE8 G0 u5 J9 i, s0 L- z# G' X
GFX VxD.
& H9 J' n% x4 y) m, Q6 z% `6 x8 L
    xor     di,di
+ @0 |+ ?0 e: e3 K0 @2 s. J    mov     es,di! S- l2 C7 H5 y; j. K
    mov     ax, 1684h      
  r0 h* c( h5 q) W- W- f3 K    mov     bx, 7a5Fh       ; VxD ID of SIWVID  \; g+ V, l  `* x. W5 M! w
    int     2fh- O6 w! J5 A  ?" p
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* l: u/ N& L  y/ r9 Z) x7 V    add     ax, di
4 V0 u- X) V- h    test    ax,ax
! {. @1 d6 ]: I# u/ ~    jnz     SoftICE_Detected0 Y6 G0 k& e; [: T! O

8 l- E, _; L0 Q9 c6 N. A  m* U& }__________________________________________________________________________; G7 d- w% l5 t8 s2 \: L2 ]2 [# R1 b4 m

4 O1 U' u9 J8 q5 F( H
( u! t' [2 E7 D! ?1 m5 GMethod 05
2 H7 G9 a& |3 p- s. z=========
3 c1 }( p: C- |4 `) i8 n: H7 |) J( v+ a* r! e
Method seeking the 'magic number' 0F386h returned (in ax) by all system
/ j* w1 {9 r  vdebugger. It calls the int 41h, function 4Fh.6 Q: R' J, O" T
There are several alternatives.  # r! a) F1 t, x. Z
: z/ G; U# Y( O, k! t  i9 t
The following one is the simplest:, c- C( ^& Y- t3 i& {; H: O
7 h- G" l" S2 I% K
    mov     ax,4fh$ {* `! G8 i. J
    int     41h
. {- p6 z! x1 k  j    cmp     ax, 0F386: Y( P8 t. A; }5 H/ X& Q  j
    jz      SoftICE_detected
$ o) }' H9 }9 v, o& {' g5 y0 j
. H6 _% U4 ~7 c# a5 ^) t) u4 H# J$ E% ]: @) k% u
Next method as well as the following one are 2 examples from Stone's : N; |1 w5 t' U, Q* r( l, f
"stn-wid.zip" (www.cracking.net):* K, b( G& ^! o$ s- |8 K' A: w
! Z- e# g# e6 ~7 o1 N/ l
    mov     bx, cs! Q0 c+ I! f9 m( v- |6 S5 l
    lea     dx, int41handler2
5 t% F3 ?$ E& @  W3 U    xchg    dx, es:[41h*4]
& K# ^5 X6 J& q" A+ ?# ?    xchg    bx, es:[41h*4+2]
; m, V  t; P3 K& f$ G* P    mov     ax,4fh# ]1 O" O$ w+ J5 A. y1 j
    int     41h/ ?7 c* @$ M- _$ \
    xchg    dx, es:[41h*4]
: s$ q# c6 I2 S  U6 r5 B    xchg    bx, es:[41h*4+2]* |8 Q5 p8 e5 W: D) J6 f) l
    cmp     ax, 0f386h
& `5 e* l1 |5 i2 K( z/ }! _    jz      SoftICE_detected6 N# I  M6 N8 w" S8 A5 F0 E

5 Q3 R+ `) d& X" ]$ _int41handler2 PROC
/ ^. b. d( [: x1 M3 C4 ?" X( A2 l    iret3 ~& K  o" |: S2 I7 r- ]2 _
int41handler2 ENDP
7 m+ L1 i  S  B5 a6 A# s  Z5 Y5 t6 r

. ]2 N3 e8 O* T+ m" {/ c_________________________________________________________________________' g) E/ H6 I1 ], U( e% k" O

) [, m( Y% d3 O! @4 N. s3 z! Q" x$ n2 q8 a
Method 067 L7 o4 M8 B& \) B' M
=========
6 d: Z8 R9 W# L0 n5 X( Q
& V5 b5 `( M7 h( H+ n9 M. H
! \" o/ f" R; m( N4 [4 `2nd method similar to the preceding one but more difficult to detect:0 K* ?& J: o1 S1 x
# Z* o1 a, P% R

6 m6 S' U! ?# oint41handler PROC, t- ?7 l2 o' G! ?7 n
    mov     cl,al6 _6 [! j2 R' B! s! c7 L7 A
    iret; i: z0 ?  J' i
int41handler ENDP& t: c; W( a0 g; ]

& y9 N' ?3 s: Z' @) x0 m5 G1 `* S
7 o5 n" [# g4 u5 {! f, c    xor     ax,ax6 G/ {$ |: k% t$ E5 s
    mov     es,ax8 p/ q- ?! k7 |$ G* S
    mov     bx, cs& f: r% F; s& c
    lea     dx, int41handler" O3 G% K  r* p: X
    xchg    dx, es:[41h*4]
) d; v0 T0 d0 m( R    xchg    bx, es:[41h*4+2]
& f/ ^6 |+ T) O3 h) H  p% B    in      al, 40h- ?3 `& w7 }9 q- C
    xor     cx,cx% z* E$ t, |0 B; p2 U
    int     41h
" C8 }2 Z7 N4 b' r. A, h, O    xchg    dx, es:[41h*4]" M9 Q1 u& J. X6 C4 O( o; N. O& n
    xchg    bx, es:[41h*4+2]
+ @7 p2 z, L  G' g  o+ |$ h8 z    cmp     cl,al
4 Z0 [  Z. E% ~    jnz     SoftICE_detected7 z! x. j+ [1 b
' u- p: B1 n" f% S
_________________________________________________________________________
! V4 C5 R$ u# i" f
7 s! ?( S% c9 D8 G- S. ?! I% x+ KMethod 077 \8 w& I1 [. |: G3 ]
=========
+ ~& J* B4 }9 S; _$ S: S) h* g* B! c! R- D4 A1 Q5 J" P
Method of detection of the WinICE handler in the int68h (V86)" A7 C. \  |( b' `
, J" f+ L1 \6 l& u
    mov     ah,43h7 d0 r5 m' V5 n4 b* O) Z0 [4 O
    int     68h2 `" q6 z2 e* c/ j+ a6 p& a
    cmp     ax,0F386h
7 j: }) s7 y) D$ Q: H: z    jz      SoftICE_Detected
; l* Q' B+ N- Q8 x7 o! L1 Z# o& }$ U" ^* i

* f* ]+ t( f( m0 W=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 w3 M# b9 \% O, x, T   app like this:
+ y/ ~7 g* s  F$ N
! f( n/ V! G" |  g1 d: t0 m! s   BPX exec_int if ax==68
' I  }# v) y7 w0 {% G/ u9 g* j   (function called is located at byte ptr [ebp+1Dh] and client eip is: h' F2 L& E5 r( v: F# N. D
   located at [ebp+48h] for 32Bit apps)2 g% Y7 R6 ]  @" Z2 G( k: y! n
__________________________________________________________________________
5 n* n' D# F2 K2 |& ^0 y
$ ]6 A) N( i: e  [3 u# i  J) I) n
7 O& i, v$ q, n3 E/ b  rMethod 08- C9 u8 _: o  p8 T. k* a3 i7 O
=========
1 K! U% h3 u* r; g$ ^0 Z+ f: y! M$ b, `$ U* M) Z7 O( e, P/ `
It is not a method of detection of SoftICE but a possibility to crash the4 u/ r  C" R  b! c9 b* k4 `
system by intercepting int 01h and int 03h and redirecting them to another4 s8 U8 Z# [: n5 I
routine.  p8 h  C" [- _
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
* N) I. w( |7 uto the new routine to execute (hangs computer...)
+ k/ [! M4 [8 M! [3 P
- S' G6 ]3 S) F3 G    mov     ah, 25h' n8 v# O  y! b8 a. J& Q# T
    mov     al, Int_Number (01h or 03h)- K  A! F- a7 Z- t) M2 J0 b
    mov     dx, offset New_Int_Routine5 F$ m7 N0 z$ ^  i
    int     21h
' y6 S; b! @. y, f( K  }% P. N7 A) L% w* k7 a7 m0 F
__________________________________________________________________________+ z, S' P8 T# _3 D. w

* c6 G5 e+ l7 \) Y3 W# hMethod 09
# M4 z* ?8 ?3 S1 X" R2 H2 A; u0 p=========
# M' L. U, |% P1 g) o7 v1 I
, [# ?: w/ X5 |) }2 X* x% lThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
: \$ H/ [( e8 n! z& s8 G; zperformed in ring0 (VxD or a ring3 app using the VxdCall).
) P( g* X( [' B0 KThe Get_DDB service is used to determine whether or not a VxD is installed3 N8 t# Q/ f- q, Y8 b
for the specified device and returns a Device Description Block (in ecx) for( w9 i- r( I' R! N9 J) S1 r$ Q3 ^4 @
that device if it is installed.
+ j* G7 ^: y+ h+ A1 Z& B% S( x7 X8 M# v) R7 `" q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID" T8 u, I9 A' t2 ]. x9 M% `5 {
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
1 ]# `: `$ u; @; R" n" r   VMMCall Get_DDB
# k, R! w6 \' i( @0 k& B   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed0 s/ E( V$ @. |8 A0 [

# s; o' ]0 t0 t1 @) c# p8 ^1 J% {; QNote as well that you can easily detect this method with SoftICE:
) j# f; n/ T& B% \# f! F   bpx Get_DDB if ax==0202 || ax==7a5fh9 q+ ^' `' a7 i" a. I$ v$ b9 Q

. O- S% S1 t9 w/ o+ Z7 w$ z$ G! p1 g__________________________________________________________________________
2 l5 S2 D& q9 ~$ z6 l
" J3 T* v' G# |8 ~( w' rMethod 10
  b: M  Y! y/ z=========) [5 j4 t  ~( q4 Q4 y& {$ x
# c) U8 s/ t9 n
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with  Z  G1 g, T$ ~9 H# t( J
  SoftICE while the option is enable!!5 b, W0 f' W; W" ?7 A
4 [2 ?9 |# ~, Q9 W: ]# f
This trick is very efficient:: W/ j3 H" d/ F) |) a
by checking the Debug Registers, you can detect if SoftICE is loaded0 ?; R( e- O! L" k4 K) c
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
0 {) Q7 {; C* w5 Sthere are some memory breakpoints set (dr0 to dr3) simply by reading their
1 F' y% e) h) Z# z3 }* _+ `9 Jvalue (in ring0 only). Values can be manipulated and or changed as well
; a3 E. Z4 H* V7 X" k$ Q(clearing BPMs for instance)
6 Z/ r' k8 r6 N( |' b) K
! e0 P1 Z! \% `: L__________________________________________________________________________9 a' [5 w+ w" H. g* m9 n3 k

3 |! |6 G3 N$ u# i0 K7 h0 g; {6 C4 KMethod 115 B9 ?( e. P3 B% u) D2 B0 `7 E
=========- B9 S9 e  g7 R0 l) c' Q* O

7 v8 d6 {4 D+ F* T1 IThis method is most known as 'MeltICE' because it has been freely distributed
/ Z* i( \2 ~; q5 q+ n0 _8 `% Tvia www.winfiles.com. However it was first used by NuMega people to allow
* l" {) u# m9 NSymbol Loader to check if SoftICE was active or not (the code is located' m+ e8 s6 F0 ]8 E5 B6 m! [' a2 ^
inside nmtrans.dll).& T, l3 D$ }0 r9 \, H9 d
. }  {! g# X6 O% N
The way it works is very simple:6 F( W# z( @. E6 C8 m+ h
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 I; A. r- w1 }
WinNT) with the CreateFileA API.
) X# n; j' `- ~' L6 k/ g
) \2 }) R0 d& o  Y7 e5 b/ V! D$ pHere is a sample (checking for 'SICE'):
3 H2 J9 Q8 K/ D- j& l
) g: Y2 t. E8 \% ^( r3 s1 HBOOL IsSoftIce95Loaded()- A; Q# V1 L$ Z+ F2 b: i8 C; ]
{
6 [  C  h4 N0 b* X0 s! I( X   HANDLE hFile;  6 J5 b2 d# z0 }5 J
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  ?- n  x. y8 R* ?7 v8 }9 Y* S
                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 X, c8 H) m5 s1 ?8 ]
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; v  l9 D  \6 @5 _. m& Q- ?   if( hFile != INVALID_HANDLE_VALUE )
, T) F7 s* L5 V% g( Q! x   {
$ I3 l6 m7 ~* I0 M% s1 g6 _( Z" \/ M      CloseHandle(hFile);5 S5 q# a5 |( b8 b
      return TRUE;( g9 J2 T- a1 Y, J6 S
   }
, f: L# {6 v& K$ d  {   return FALSE;
- F! y, t, B* N/ K0 b+ z$ ~' Z1 b}
+ H* E$ w0 Q! j$ k: T( T" V3 i' n6 i% A9 Y
Although this trick calls the CreateFileA function, don't even expect to be
. {7 J: b. R, r6 I7 [( nable to intercept it by installing a IFS hook: it will not work, no way!
7 w( B( v# y* b& u# RIn fact, after the call to CreateFileA it will get through VWIN32 0x001F* u) ?" j$ a+ `6 o& }& l
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)& W6 W1 G2 p- Q2 T- h# ?, D; p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc6 t: G5 @' O3 S# ]# Q5 u, n1 L
field./ P2 p4 t" P' c: o5 Z0 ^+ |
In fact, its purpose is not to load/unload VxDs but only to send a - E8 U( V- Z  d, b2 K- w1 E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 g* @# [. J- l. t; q$ k
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 f( v+ p/ c4 L: Dto load/unload a non-dynamically loadable driver such as SoftICE ;-).& h6 U) c4 c4 Q% j! f
If the VxD is loaded, it will always clear eax and the Carry flag to allow
7 Q3 `- f6 {  r) K9 Xits handle to be opened and then, will be detected.
0 O7 z4 K$ m) ?) G; Q) M+ b  CYou can check that simply by hooking Winice.exe control proc entry point
7 u% d- d" Q/ }6 q4 f, ~while running MeltICE.
0 O/ [% t7 v* J
( A: }& z( j. N/ \  g9 p% J5 m% p- e  d8 q$ P" {& d( i
  00401067:  push      00402025    ; \\.\SICE; x7 N7 C% ^" _* r& B- e
  0040106C:  call      CreateFileA
: w* h4 X) r; J( Q# k. T  00401071:  cmp       eax,-001/ T* M  @. f' ^( |/ B8 E9 T
  00401074:  je        004010910 l7 l: I( d( w) Y1 e

( \8 }( @( C% D- g0 m) W
$ u( l. x8 H3 u6 f+ SThere could be hundreds of BPX you could use to detect this trick.
+ A4 n0 _1 ^, ?6 d, w! m2 R0 y- X-The most classical one is:: h6 ^! ~+ c3 r  @" q5 q. |' A
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ D3 C/ h3 `3 q8 u+ [: N8 T% K    *(esp-&gt;4+4)=='NTIC'
4 g% I4 `1 L" R) y( F; L8 |8 a0 k. E/ n' o7 q4 L
-The most exotic ones (could be very slooooow :-(
& \5 |8 B, _: M   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " w& e3 u1 J$ Z, h: ]) W# |
     ;will break 3 times :-(
5 |8 i- ?1 G1 V# P( [2 {- N# _9 j1 E; s) A
-or (a bit) faster: 4 }2 |$ l3 g$ [! v. r+ w1 [% ]
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) N3 @6 Z2 j3 a0 L* Z7 L/ U5 T0 \+ C+ r8 i
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) a: ~0 u: a9 b# T
     ;will break 3 times :-(
) z/ b7 A7 K' k  i& B& s6 g) t: O9 u6 Q
-Much faster:
6 w4 a9 _5 A( v, T- U' C  C" E   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
- L/ _. O* Y; y2 \9 i! q  P' C
3 ^! k" {% q- \. j5 }. t' X6 FNote also that some programs (like AZPR3.00) use de old 16-bit _lopen1 J# z# @$ g" [, L4 O- l  w
function to do the same job:0 r$ a; g3 k" K* d+ @! e

% D! w. C. G7 u   push    00                        ; OF_READ
8 g5 X# k/ e8 Y/ A7 w. V; P% V9 S   mov     eax,[00656634]            ; '\\.\SICE',0
. W! ^, u" b: \2 k   push    eax5 @) }+ Q* H" U; F: C( B2 Z0 C
   call    KERNEL32!_lopen8 R$ ?7 W. i0 @2 q" w
   inc     eax
* D- O- m. T+ i. M" v/ y0 O   jnz     00650589                  ; detected' K1 Q9 @1 @- T. b+ Z
   push    00                        ; OF_READ
2 Q3 x9 v) J7 V3 W; n   mov     eax,[00656638]            ; '\\.\SICE'6 M- |* B2 q# r  @
   push    eax% o5 t3 E- q) d( S: Y: }7 }
   call    KERNEL32!_lopen0 Y* M! X; b3 D% I; V" J3 r) r
   inc     eax& w1 f4 a3 d: W. B; P; p
   jz      006505ae                  ; not detected: }8 e# V- }1 k0 Q( n6 x7 R
, @2 t4 y' D* R0 _
& X& d" p4 f/ r- x+ N& v/ P' M* J
__________________________________________________________________________5 \0 e8 S% F: z5 x6 U, p

" b" d8 e6 c; `, zMethod 123 P9 e* m  E! V
=========7 O7 _$ f2 F, s4 i% \
4 a0 U0 @. j9 X+ D/ h5 Z
This trick is similar to int41h/4fh Debugger installation check (code 05) }" t& C4 r* @- t  c6 ^3 p
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' K' a% }% e# h% W5 r( q8 Oas it uses the VxDCall backdoor. This detection was found in Bleem Demo./ [$ U3 y. @8 F" J! C6 Q

- M  l$ B& Y7 d9 p: v* U   push  0000004fh         ; function 4fh5 s! f$ S! I$ S
   push  002a002ah         ; high word specifies which VxD (VWIN32). _  N: P# G7 |6 T: C. z' C3 S4 Z
                           ; low word specifies which service
1 B- o9 V- I/ U$ y' L5 i                             (VWIN32_Int41Dispatch)
1 [( B7 X- E) T: u. V; ?) T+ }   call  Kernel32!ORD_001  ; VxdCall
2 H" S8 P2 K, S   cmp   ax, 0f386h        ; magic number returned by system debuggers$ T8 `* j% V! |( Z2 ~
   jz    SoftICE_detected
6 N5 n5 r" z) q% X6 _' F) q9 f$ Q' z3 g
Here again, several ways to detect it:
6 E/ f: W3 ~5 X) r+ a2 W" |& X6 h# n  T% P4 B' Y% D
    BPINT 41 if ax==4f
# ?. X2 x( b, D
( P: k3 [4 B# y/ m, B% l; G" m- `    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' E7 `7 h9 c' e: a1 |5 ?$ H  @1 ^, p
! l* r& B0 }+ i6 _+ v( W9 A    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. w0 q# K7 ?0 H% i2 Y; `, I4 G

4 s! p+ V' _) I  A    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- t4 \. \& a) M1 P
. m0 J' R4 O6 ]& `7 r+ k__________________________________________________________________________
8 w" ]* Z8 n5 I5 r, g$ w
- r5 S8 K  S9 g) i( ]7 _2 c9 ?Method 13
% O8 R( M( R" ]=========, t0 w7 u1 Y, f0 J! a4 k; _( u/ B

' d/ Y% ?5 z+ A' u+ E8 \Not a real method of detection, but a good way to know if SoftICE is
) H% E: i( T  einstalled on a computer and to locate its installation directory.
- p( }6 ~5 {- k  D- u% F9 y. NIt is used by few softs which access the following registry keys (usually #2) :# F- y2 N! g( t2 e; I( F  C  S, k

& ]6 r$ E4 ]% M1 x1 o-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; ]7 H. U# f. O  o! `
\Uninstall\SoftICE
- g! g/ c) A* L: v5 w* b-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% O# E5 g0 D3 w6 y5 {
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. Z3 V! Y5 C3 I; h2 U3 v/ ^$ _# ~
\App Paths\Loader32.Exe" H. s  @* t3 N: h+ {" J4 I
4 T( Q7 [! Y, a" X8 e

$ e- j+ a  O/ C2 H: cNote that some nasty apps could then erase all files from SoftICE directory
2 L( s/ {' l6 t6 ~& o(I faced that once :-(
- N& a" G: G: C' t! R
1 F, V- C* e% z, ~$ O5 `- w8 Y9 |- CUseful breakpoint to detect it:+ A1 S1 v7 R6 m5 S" d
+ U( F3 I: ?6 E$ H
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 \' Z! W! |* y7 L1 w1 x0 ?7 y* v( S  R) a
__________________________________________________________________________
. I2 W7 v( t. z9 ~9 U1 E. O. t- g" a+ X  y  Y, C8 Q

- l! {# E+ ], T9 {7 v" K/ nMethod 14 7 P9 H8 r5 P5 Z. x
=========
" F9 [7 h* x* n4 X* n3 d. J. G; m9 j) c4 N6 _
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# P! f- y5 p/ k" R% h; q- W' Pis to determines whether a debugger is running on your system (ring0 only).
/ H4 U* B* f5 @" a6 Y3 i! f3 B( l: n) I- y
   VMMCall Test_Debug_Installed5 x: _- _# x/ e- w  v5 x9 {2 z
   je      not_installed1 u  Q: n! L. V: B! @$ Q

+ H  q0 a8 _& T! y6 G: B/ kThis service just checks a flag." a4 _/ a4 r( ~8 ^
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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