About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 u+ Q2 _  c) O" j6 o
<TBODY>
6 n: U& r# M2 Z, f* f7 ^) V  j1 a<TR>. ]3 N2 [8 F0 j5 S; F
<TD><PRE>Method 01
, l: G( U! |* ?0 B9 D=========# {2 d4 L7 r4 }7 q/ r& ?
/ f' O! p4 Q' |! ^9 Q, B9 |! D+ x7 H
This method of detection of SoftICE (as well as the following one) is5 |/ V& J/ \& N5 B
used by the majority of packers/encryptors found on Internet.
- {. }' q: O% G) P# A" R! a- HIt seeks the signature of BoundsChecker in SoftICE
: O( J! `  A( v/ I) i. v0 P8 E* d( D5 p2 w' Y% [  H) W5 F
    mov     ebp, 04243484Bh        ; 'BCHK'# G8 }3 N: ]. T
    mov     ax, 04h9 d8 S, B9 p0 x2 U  w$ z$ M: n0 ~
    int     3       7 s! M0 _: A& T( }1 s8 p  _8 G# w
    cmp     al,4
% H+ k6 O, F) g' Y( _! W    jnz     SoftICE_Detected, s! z9 k7 T+ y; ~$ o8 X
  b7 Z1 _' B& E: V/ E1 r( L7 U. c
___________________________________________________________________________
2 o* F' t9 D, f, B4 b
" [" w3 b" b3 K. [Method 02: K" P) p7 Z4 {/ [/ t0 E
=========9 y: M' r7 }, ]( h' ^
2 c9 _" q( R' ]
Still a method very much used (perhaps the most frequent one).  It is used" F3 @3 M7 b0 R3 F5 [! T1 `
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,1 C8 M- h! P" F0 @! A7 K
or execute SoftICE commands..., o$ }& v( a/ f
It is also used to crash SoftICE and to force it to execute any commands/ ^, U6 s9 O$ j8 y8 v  q
(HBOOT...) :-((  
; N: t% ?$ l" Q; f( j6 K5 T% h1 ~! A7 k( X- W# c
Here is a quick description:
% W# q' |- A: B) F( T8 ]-AX = 0910h   (Display string in SIce windows)
  p( V1 i, ^8 [6 y1 \1 q' n-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
3 w5 [4 E+ \4 q# k-AX = 0912h   (Get breakpoint infos)
! V8 _( K2 \% q# V3 ~" H+ }-AX = 0913h   (Set Sice breakpoints). o  K. T7 z9 g
-AX = 0914h   (Remove SIce breakoints)" M; R0 |6 C! l' L/ \( e
- J7 W0 ]7 v  |% t3 H) V
Each time you'll meet this trick, you'll see:
  j7 h8 n0 G3 l$ Y0 P! e3 x-SI = 4647h
! m3 w3 \7 A/ L0 |3 y1 W% }1 @-DI = 4A4Dh
! _1 m+ A9 }' `" jWhich are the 'magic values' used by SoftIce.
" T1 I8 n! y4 j0 N; g+ \3 pFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
7 h! V. f- ?- V3 v% g1 c+ q6 Q2 T
% T5 J2 H* _8 w2 ^( K: b% s* OHere is one example from the file "Haspinst.exe" which is the dongle HASP
' p" u/ ~! v( AEnvelope utility use to protect DOS applications:7 \2 g" O! R4 U! _

! j; }+ U/ r  F3 _4 D) y/ G) J6 O2 c& m# f; N% m3 a
4C19:0095   MOV    AX,0911  ; execute command.  ]" K4 Q$ L" R0 k! R5 e
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: [4 j% W! r* u4 t9 b5 L- `0 g0 C( `% S4C19:009A   MOV    SI,4647  ; 1st magic value.
: y4 J' t7 B# X4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: j3 n2 E9 P7 ]% G. c4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& h* B$ m% H7 m: T5 j) h- y
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ k. _- |; C' x7 H5 }9 e
4C19:00A4   INC    CX- J% I  m  |1 d+ @, T4 e( _& \; T/ p
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 P  b; c8 p. h# L2 [8 L
4C19:00A8   JB     0095     ; 6 different commands.
2 x$ X0 n; w" u) h: j; ?4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- t" l& C# U- q6 D, u7 n& Y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 c/ Q6 b* p0 Q- U# y

, p* G  S$ f5 ^; n6 CThe program will execute 6 different SIce commands located at ds:dx, which
! `6 ]. U" r  f* ^are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 h3 {; x3 |$ V. O
. }$ w) U  l* q8 L* \7 r( T3 i
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.( I! f' J, h: M$ \" u
___________________________________________________________________________
# `6 ~# J  E. Q: C7 x8 L2 _4 A& h5 N6 L: W" ^- v- k

# k. V8 Y! N- t, ?' D% x2 z! `  OMethod 037 m( l( }0 `! X! L
=========
' L) W0 `. i) }
7 z& }1 ]9 h9 k' v# j& \9 Q' o7 r# KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& G, L2 [; T- n1 h(API Get entry point)
' f* Z9 Z1 ]/ r! s1 T# o2 @" d        
  V$ t/ W  \7 v/ b. c% Z* u
; w1 W) J& s$ b    xor     di,di5 g+ v& q7 H& V
    mov     es,di+ D+ G& g0 `6 b( L& Q' S) c' Q# O
    mov     ax, 1684h       $ U( e* V. m$ W8 P7 t6 T" U
    mov     bx, 0202h       ; VxD ID of winice
( u* Q  ~( u2 @6 x" d: l6 y    int     2Fh8 y3 l8 K0 L2 D# O, K. S$ h" W! @
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 c# K. l' n: z, [! x" R    add     ax, di+ w0 O! c! ^* k$ u& z+ V* Q3 z8 ^
    test    ax,ax
3 ?+ L$ n1 P1 o: N$ N    jnz     SoftICE_Detected
+ H& \6 M9 r' \; }* e
3 A, c3 a  b3 C- ~2 ____________________________________________________________________________2 O0 z& f7 g1 m4 A( d2 S

0 w( d4 M& k  x0 aMethod 04$ X% J, b9 C/ V7 D/ N$ Z
=========% y$ N2 ?7 F9 v, V  Q- N2 L

. N6 I  B0 F1 P% s7 j% u' UMethod identical to the preceding one except that it seeks the ID of SoftICE; T4 {' i  V4 r' t5 F' |
GFX VxD., z- l, z+ }0 f2 `( C# n; K

' D* _( M/ \! {% q    xor     di,di
6 w% |4 D% _4 d. W) N3 Z8 B    mov     es,di
- S' I  C# S; H& S; q    mov     ax, 1684h       . F4 \. s! e+ z7 }
    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 @' W5 @3 C0 t& c+ q
    int     2fh" Q- R' R: J5 y2 ~% ^% b2 J
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 N* e% Q( @2 l6 J. U2 h    add     ax, di
9 W$ ~6 N; ^0 H/ ^    test    ax,ax4 f+ }. u* R8 C+ @: C9 D2 x
    jnz     SoftICE_Detected
; b# [$ P  C: x( B' f6 O+ {7 f
8 _; p! Q( ~) X, W8 D: q__________________________________________________________________________. ~: A: z1 R# l

/ @' C0 r/ `4 h+ G( n2 M
( s. g* ~) L+ |1 K* xMethod 05
( x! F7 V# o! z  X. z  j=========4 N) i# g' M  @- m/ b, `  a
3 c& |$ m1 ?* }' m' I* p6 E
Method seeking the 'magic number' 0F386h returned (in ax) by all system
* t, E; A+ Q4 M. d/ N+ Hdebugger. It calls the int 41h, function 4Fh.
/ ~3 N5 r, S8 n- R& @  {There are several alternatives.  
/ J/ X5 v% L% v. _4 J! I6 x$ v) {. s7 y
The following one is the simplest:
( v9 s1 J% V5 o- z' G& t5 @
2 l0 D2 B: E* m6 Z    mov     ax,4fh7 b6 u6 D7 R' i
    int     41h2 J# B6 _/ Y. a8 A' z+ K' u% [. ^
    cmp     ax, 0F386
: Z, f* [+ n& \/ S+ d" G    jz      SoftICE_detected* l% D- J3 f5 ^: W
& O5 i% G7 P. d7 y2 S

' K" H8 O/ M) w* g$ mNext method as well as the following one are 2 examples from Stone's
- l1 l1 P: t" {: [' R"stn-wid.zip" (www.cracking.net):, p) q7 c9 ?" j# l% O: @

- M  [  P; Y# r" I0 r$ w0 `    mov     bx, cs: b/ c+ d7 P  u) e: P
    lea     dx, int41handler20 w: ~8 J9 ~. P
    xchg    dx, es:[41h*4]7 f( k4 G( E7 H) v; |. P. v3 V
    xchg    bx, es:[41h*4+2]
) j* ~  X+ R" P8 @2 f    mov     ax,4fh
7 I6 {8 N. W, x    int     41h
$ r9 O7 `4 k8 t8 M  K    xchg    dx, es:[41h*4]$ ^8 q$ r( M& U% o
    xchg    bx, es:[41h*4+2]
0 o! u3 v$ O, F: `3 p5 r2 c    cmp     ax, 0f386h' G) P' b1 ^, |
    jz      SoftICE_detected& |2 f3 F8 j6 w" L

! S- e! |+ x6 k2 s! mint41handler2 PROC# S* `+ m6 C( |
    iret
1 x% m8 h+ Q# vint41handler2 ENDP
0 G* I+ {5 B' e& J9 ~! u( G# w# T
) I/ n& h, f% C6 I, Y9 t: m: k' Z3 j$ i7 D8 z3 y7 e
_________________________________________________________________________$ ~3 r  H8 d7 {; Y. w
* `( N5 @3 I6 D# E
: d& r. _7 H, j/ ?3 ]: x) P: J
Method 06. {; r2 P7 |' Q' F6 ~* Y
=========
% L5 [  d/ o( ^8 k$ t  {& ?( j
8 g  w8 M: H' \) N% i$ K1 R+ \& K* g& h6 b
2nd method similar to the preceding one but more difficult to detect:- ^9 L" ]2 U: C5 X' P4 {  T/ y
! S! c/ a; x+ M6 \1 {0 u1 V2 e

  v& y! X3 z. T; l4 b# ^3 Pint41handler PROC3 L# b  u: v6 u2 f: {4 [
    mov     cl,al" N3 C  N# w8 B- M" S6 c
    iret
2 s: c0 U' {# K- Lint41handler ENDP
& U% g6 G8 e4 Z) _, j% @1 w3 r) j
6 ~9 c# p! O& y3 B. d. k) T: n9 ~# ?8 I! @+ |% f: V
    xor     ax,ax
; u/ d2 R; @6 V& Q1 `5 k    mov     es,ax
2 e% i9 U  e/ q& `$ T. T) b1 O- K    mov     bx, cs8 J) M$ s% ?# Y- x+ k
    lea     dx, int41handler; ?) D' V( i' S2 p
    xchg    dx, es:[41h*4]% y" p8 g8 e% U: H
    xchg    bx, es:[41h*4+2]
4 L3 E4 b6 E. I) i$ q; J/ M    in      al, 40h
- h1 e0 h7 `. w$ h& s5 v    xor     cx,cx4 x+ Z; |# r/ L" `& `9 f0 T
    int     41h0 k/ d3 S6 u# c: B- A
    xchg    dx, es:[41h*4]$ c4 c" J# }7 _5 H
    xchg    bx, es:[41h*4+2]6 R( c  ~0 L: U8 u
    cmp     cl,al( d& a$ v7 f' r: a
    jnz     SoftICE_detected
) @7 ~7 x5 q( c! {$ ^1 B2 C
. g# i: N9 h2 u7 n" I7 _3 c  U_________________________________________________________________________
- T2 T6 G& ^3 A. [
8 Y$ _3 a9 N! k# CMethod 07) C" ^4 o+ ~+ o& r7 l
=========4 R, `8 A  [) M8 E* y2 d5 e6 m% q

) j. c) R4 ]3 j* t4 ]( \/ d$ d9 oMethod of detection of the WinICE handler in the int68h (V86)
5 J6 @' d! t  f( B, E- t
* y0 I& ~' \6 t& M" U8 W    mov     ah,43h! H  Z/ @3 Y) F+ ?. V" |, Y
    int     68h- r$ r/ A7 I5 u, J5 W( b& }& e: Q
    cmp     ax,0F386h
2 c" x& H! u# _( g    jz      SoftICE_Detected3 A9 a- S0 e/ t# K

1 Y# {' G) i7 D4 t5 C' Q
+ T/ Q7 T" {  u2 Z8 k0 w/ k=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
8 w' i3 |, K  R! H1 l% ~$ |   app like this:
- ]8 ^# Z- r* Q0 `/ h3 m0 y* n
% a% T& ]# Q9 a7 ?   BPX exec_int if ax==68% ]! t; x. |; ~$ L
   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 ~- c4 l8 x' U4 ~; Q; h8 t   located at [ebp+48h] for 32Bit apps)
/ C* n8 a( M$ K__________________________________________________________________________
7 K* Q+ ~5 N5 k0 p- @5 Q, t- c8 `) m$ J; ^8 x! f5 n

1 I7 C, R$ l+ Q: x% u/ fMethod 08" h" a5 }% V; W. s
=========. q( f1 ^: Y6 X4 ~

) ?: h& y+ T  I& p) vIt is not a method of detection of SoftICE but a possibility to crash the
1 U5 H* M& ^7 k3 C+ H2 k2 Ksystem by intercepting int 01h and int 03h and redirecting them to another
# o+ O8 {$ ]7 y* @' b8 j4 \. R8 Uroutine.6 b6 \& _  l# K3 V8 J* X6 C8 |
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& Q' ^: E, h3 I/ Q
to the new routine to execute (hangs computer...)' G" F( [) x8 S  p% h) A# m/ J" D5 e
2 ?# c# L: ^) P; i, ?
    mov     ah, 25h
/ j7 J' T1 i5 I. M1 O$ J    mov     al, Int_Number (01h or 03h)1 m& i, i6 \9 ?" A' ^3 [
    mov     dx, offset New_Int_Routine# R0 T5 U* o$ K
    int     21h5 v( ^! f7 ]% n( `0 I3 D5 e9 Z# M
+ i! @5 {% F7 _6 l- X  k2 {8 @
__________________________________________________________________________( o+ S& w& z, K0 \  \

, y. `0 Y% `4 A7 yMethod 09, C5 t3 q1 ~$ c
=========2 P, A$ J6 v, p* q7 B

( O, @, c7 |! x% u6 l: I8 jThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) |2 F* d, O$ b) h  w; _
performed in ring0 (VxD or a ring3 app using the VxdCall).
% e4 Z; x# s0 i) S0 n. t9 ?The Get_DDB service is used to determine whether or not a VxD is installed3 W) k+ Z' M3 y- d- r1 T
for the specified device and returns a Device Description Block (in ecx) for: J0 E- Y. T$ G& d% M4 r/ U
that device if it is installed.
2 X- z6 y8 |' B) i, C
; w/ y( h, Q" K/ B& P* t* R5 e   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
' G6 h( B: ~; r+ H   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ S: X1 N- \+ g2 [, I# E1 S
   VMMCall Get_DDB5 }( V* y# M* o5 i# q8 S3 H
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' b4 Q- w. z9 @( C, \: k3 s5 H# |$ }& i
Note as well that you can easily detect this method with SoftICE:
$ {0 g" @# K8 ?% v: u   bpx Get_DDB if ax==0202 || ax==7a5fh
$ _: i! M+ @$ r$ M
0 y) }( m3 F6 L+ \* P( j- ?__________________________________________________________________________8 R" E: {) `! [; I6 k
  L4 x( E# k) w" n5 Q
Method 103 B* K. n* }2 u- H* [
=========
; A9 F% H( {  C4 n9 ?0 m3 m2 M3 n: W$ e5 S; ?
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
- y/ n5 N6 Q  G! t  SoftICE while the option is enable!!8 m* H! q$ g, d' T( b( {
2 y+ W5 ?8 i1 U  q
This trick is very efficient:
5 K4 t+ m& l1 R, }; N9 Q$ R% k  Rby checking the Debug Registers, you can detect if SoftICE is loaded& G& A6 l2 _0 k& `, W" s; z
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
3 u/ P% D4 c5 S9 M* dthere are some memory breakpoints set (dr0 to dr3) simply by reading their
) V" z5 z0 V3 z& S7 ]+ _; n1 mvalue (in ring0 only). Values can be manipulated and or changed as well- J: P  ?/ }, y0 `- a& s# F% Y
(clearing BPMs for instance)
, c' m! t( l7 G% p) c9 L6 x* D7 a9 @& {( G) M9 K
__________________________________________________________________________
, L5 o+ D1 [, L
  x  ~" F7 b1 E4 WMethod 11
% ~7 E5 l4 v" x/ `+ v8 u=========
/ }, E2 S& J- e: m% A) H! H6 T$ C9 a* Y9 I3 X' V& B
This method is most known as 'MeltICE' because it has been freely distributed# }# V5 D5 |: V, Z: S5 b% r" j0 Y0 J, [
via www.winfiles.com. However it was first used by NuMega people to allow9 |8 ^( q: ~0 o! K6 Z: j  J
Symbol Loader to check if SoftICE was active or not (the code is located4 F+ O8 S* L9 f( t
inside nmtrans.dll).
8 a5 r) R% A% ?+ M5 G! ]+ @1 i! t
The way it works is very simple:! J2 n* c; T( `, e- J! d% T
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( d3 m" y) ], K6 X1 cWinNT) with the CreateFileA API.
- L$ w8 B6 C# X# e* h. g" r& \6 N0 Z4 S: K9 W$ L$ A' I2 \- k
Here is a sample (checking for 'SICE'):
7 P0 H5 A6 H" U& i7 n
/ J2 n' W0 s! Q2 w& v8 o% UBOOL IsSoftIce95Loaded()
$ Y8 K! Y2 W" l/ {3 d9 d0 L8 j{) @0 z! a# d0 c2 D
   HANDLE hFile;  ) U+ J% }; D+ k+ _
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
  ?  o% g. D8 v% T; R: u2 w* a                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ \2 `) e+ ^) U8 ?' V
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  ~; d& m$ s$ R+ c9 @+ A3 r
   if( hFile != INVALID_HANDLE_VALUE )
7 j; @' J/ y! \  y   {
/ j3 H8 y( ~+ }2 g% C      CloseHandle(hFile);/ ~8 \, i$ {% X, Z: O% J" H
      return TRUE;
3 T' r: |3 \4 t   }
1 l- t0 O: B+ A$ ~3 g* C* Y   return FALSE;; o; X! c0 ^2 y! e) e6 u
}7 z$ V1 n0 }' L

  s# ?) @# J4 v! R7 uAlthough this trick calls the CreateFileA function, don't even expect to be# J/ d0 C1 |- j8 [9 k
able to intercept it by installing a IFS hook: it will not work, no way!+ d8 H3 a# ]0 b2 V& I, R! o3 l4 v
In fact, after the call to CreateFileA it will get through VWIN32 0x001F) V. d9 Q5 ^* c; U0 _1 Q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
  ^5 v9 [) A; e1 {' m7 y/ ~- gand then browse the DDB list until it find the VxD and its DDB_Control_Proc* A$ h; G0 R! C! o* H0 V2 \7 |3 U
field./ n" a. q3 Y3 }- z- F( D& v6 D
In fact, its purpose is not to load/unload VxDs but only to send a 3 {0 N. \9 S! G0 `  v7 {$ H
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 Q, F( |7 H/ `3 D* V
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 ^5 }; U: b; l1 ^8 n2 R7 Pto load/unload a non-dynamically loadable driver such as SoftICE ;-).4 h, @; x% c8 \+ b0 ~
If the VxD is loaded, it will always clear eax and the Carry flag to allow
/ [  p& Z: p4 Tits handle to be opened and then, will be detected.: C9 c' D6 a& h0 X, _" p5 E
You can check that simply by hooking Winice.exe control proc entry point& R" |7 p& t0 \- ~% y6 R
while running MeltICE.
/ N7 g& Z5 S; A  @+ _5 v$ j" M' n3 @* b) ]( K

0 R+ P# C/ P  u* u% z+ h9 [: A  s5 u  00401067:  push      00402025    ; \\.\SICE7 X- E7 |% [$ e! q" u
  0040106C:  call      CreateFileA
* p, _) y, V! w, r  00401071:  cmp       eax,-0011 }; w& X  s' f6 X
  00401074:  je        00401091
! k& G9 c% O5 ^( d! k7 x0 o) F2 Z2 z' o+ W3 r; B
2 H+ D' f; \5 u
There could be hundreds of BPX you could use to detect this trick.
% w2 O/ m9 [! D9 C-The most classical one is:
/ Y) C. R6 l" h0 O" O3 l+ L  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; ^9 g# S6 i# |/ B. K. c7 M    *(esp-&gt;4+4)=='NTIC'
+ r, D# t% Y  P3 M/ ^- {
8 `* r- L6 a  R8 K! u5 v* l-The most exotic ones (could be very slooooow :-(
# I: r# d1 a7 \1 W* G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 l* J7 [" D; _     ;will break 3 times :-(7 J7 \$ f. \4 B2 _& }6 @

4 a# X  J+ S. `  O% d' s1 z& T-or (a bit) faster: ( [0 ^8 J3 |% V2 ~, I  n
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) j7 K% s/ d* I- k8 q

1 J3 |: d' Y# j, |. b   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 L3 F7 D# m! H+ C     ;will break 3 times :-(2 }4 n. j  e- `: n2 Q% S/ D" h

* ?. g* |9 B6 ^/ p+ e( _" C  w, e+ g-Much faster:
8 N! t, d" U0 I: D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" C/ z+ |9 w9 J; i
! X3 s! N- N7 _
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
0 d$ S" m4 A2 a, Pfunction to do the same job:
4 W. e- h% D- b  ?8 d0 F4 S# T! a0 o, y/ n
   push    00                        ; OF_READ
; R- i$ G! J( B& X7 q% {   mov     eax,[00656634]            ; '\\.\SICE',04 i2 t1 N) Q( E0 B/ h
   push    eax% e" v- y( A  z3 Y! Q' D
   call    KERNEL32!_lopen; j6 t. e5 q* z# w
   inc     eax" e4 B: y- ]! U% ?1 {  _2 z5 L
   jnz     00650589                  ; detected
* y4 d1 a1 A: N) B- \/ x   push    00                        ; OF_READ
, j/ [+ Q0 O5 p! `& K8 U/ q   mov     eax,[00656638]            ; '\\.\SICE'+ t/ Y5 I% {" _) d7 ~
   push    eax9 q) i5 y4 I+ D+ q
   call    KERNEL32!_lopen+ I, T; N4 j3 y9 a3 L9 v
   inc     eax# E- r7 R- M3 @0 p
   jz      006505ae                  ; not detected
$ I  R% n) b; Q+ a- \
, U7 l! R, h4 y% W* ~# ^7 Y4 [' H# K  _
__________________________________________________________________________. v9 I2 P8 q# e0 c3 f9 x& O6 C- q

+ K: m# d% a* p# B4 C' ?7 ^Method 12. ~6 K1 p# A6 |2 D9 d8 j
=========
% K3 s* }& Q$ @0 k% F' L
, W7 }7 r, T; _2 O3 Z1 ]8 XThis trick is similar to int41h/4fh Debugger installation check (code 051 U2 y5 X1 p' \; ?1 n4 @
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% G. p0 d* N6 i, T$ c) y# Sas it uses the VxDCall backdoor. This detection was found in Bleem Demo.4 b0 E2 T+ h. ?
: t2 {# C4 W! `) [! J1 i0 M0 F9 z* V, A
   push  0000004fh         ; function 4fh$ m4 b" h" j/ }6 U, E
   push  002a002ah         ; high word specifies which VxD (VWIN32)9 i) B: h6 e# c7 E6 `. r+ @7 a8 X
                           ; low word specifies which service
2 a4 W2 e, S+ ^& I% F& K0 n* l                             (VWIN32_Int41Dispatch)6 \! T' T( r  d4 N6 K
   call  Kernel32!ORD_001  ; VxdCall, ]4 `' i7 u1 A
   cmp   ax, 0f386h        ; magic number returned by system debuggers
- C+ Y3 _& @( P; R/ C- C" S   jz    SoftICE_detected5 g9 c/ A0 v* C& R0 |/ N

/ D" Z! J9 e2 ?0 lHere again, several ways to detect it:
5 w% Q8 @5 l% P$ B  p
+ y* V. o7 i" h    BPINT 41 if ax==4f
7 J2 [- H0 \/ C9 ~
5 |& H% ^( i) x) A0 W" H9 m# v    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one; u, ~: d* G6 q" a* ^  A5 @
" M/ t& T" ~1 G/ O  }- J
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! [6 O) N" N. D  W9 J6 C
  [: [$ m+ f# A    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
$ a! U# _; H- q
0 G4 A$ M6 L8 X0 @' E% M$ J  W__________________________________________________________________________" B' q0 A# r4 X4 R8 H0 I7 M2 t+ U
2 b1 O7 ]! F) l2 y- r! g
Method 13* G2 ~) F. N6 g1 _* o5 G, v
=========
3 N- E7 u8 f" S' R# X+ j6 \/ g( Y" K0 b* D% i3 y9 k2 u' e
Not a real method of detection, but a good way to know if SoftICE is
; v* }* p# r/ U2 ]) b/ j. ]8 L7 uinstalled on a computer and to locate its installation directory.
/ ~% V! ~! `. t+ g5 A" r9 FIt is used by few softs which access the following registry keys (usually #2) :
! m% X7 C6 L5 e( T2 h
) s& Q- z  g- F7 ]# m, F) e1 {2 f-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 @. U! t1 T+ y0 x% O# x2 i  k
\Uninstall\SoftICE5 n7 o% D  _. S, s# h
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 C' B4 y2 s& M5 R" X) E" G8 H
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 I4 \; b" r) y
\App Paths\Loader32.Exe, x' Y: b2 k, Z: L, U

6 V7 ?" k. `) ]9 }0 T3 v& ^$ n, b6 w' r+ @/ {% U
Note that some nasty apps could then erase all files from SoftICE directory( M0 x: g" b( }& {) E! {0 {
(I faced that once :-(4 E+ p6 Q1 y8 L7 o' J! [8 n
- k4 z  O" s$ c+ b' n/ v5 ~
Useful breakpoint to detect it:
' P% d! m  p/ F" x$ N2 N' Z8 h7 O! F" m# b8 q' T7 X% U# N
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. s' s) m5 Y( y5 U) U3 ~; R
" P3 B9 D5 t; ?+ U
__________________________________________________________________________
: q( P# n& ?4 q5 p2 C; K
3 O6 `, a7 b- H5 |4 F2 H
( |/ y) U; Y1 O+ u3 sMethod 14
4 l$ k- P9 Y1 g8 Y=========+ p5 ^/ Y! x' q9 Z$ `2 \4 I
1 m; X( t" G4 M  ]$ K, I
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
! ^# D: E1 U8 Z# t! Tis to determines whether a debugger is running on your system (ring0 only).
* ?2 w4 p4 E+ t. m
) i% _$ q) ^2 _- f   VMMCall Test_Debug_Installed
6 Y  m9 {: r2 r4 M$ ]   je      not_installed
/ h6 |$ I8 w) f2 R1 m# G, }! z. j6 L  P% C" U! ?. s" I- |
This service just checks a flag.
$ F* h/ l2 m% F% }& `5 G& k</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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