About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
6 @9 I# T/ k7 l  U7 Y<TBODY>
- S4 B! f( c, [6 t7 [- r' b<TR>/ {0 Q' V# V" p8 ]; F
<TD><PRE>Method 01
2 g2 _0 c: [: o5 E=========3 s: i( D, n' C: u+ V, W4 k) U
9 q2 E7 z9 M7 o1 `" G. j+ B- ?) c
This method of detection of SoftICE (as well as the following one) is$ }; X: _& ?9 ]% a+ S# H: k( L
used by the majority of packers/encryptors found on Internet.8 \) G. K3 d; S
It seeks the signature of BoundsChecker in SoftICE
& S& ]$ M7 B  w7 q/ x4 [3 L
& u% G% T3 N3 x( K2 a    mov     ebp, 04243484Bh        ; 'BCHK'! x1 \( o. s5 c: t: o
    mov     ax, 04h- g' k& j( ?) h( b0 k" b
    int     3      
5 ]6 ^6 i; e/ R  [% c, f    cmp     al,47 n5 L, I+ t% S3 ~( L6 n) ]( m8 y
    jnz     SoftICE_Detected
" {9 L: }: L, @' t  B' y$ y: I9 t, I1 h4 `' ]
___________________________________________________________________________4 f6 L! _* u) H; j( S

% \. `; [+ \, q' ~3 c3 \- z+ Y: VMethod 02
3 a7 v  i. ^  Q1 D  L$ P=========9 ~* Y6 \: t# R( k9 O& ?

2 p! Q, u7 \$ m+ r" ?1 e" x( ZStill a method very much used (perhaps the most frequent one).  It is used
7 Y* r. S$ N$ o) v; T/ _' N3 v- ]to get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 J/ V9 A$ j6 i- C& [5 R( n/ Q6 D
or execute SoftICE commands...1 x2 z2 k1 i, c& L$ F5 m# }# T' u
It is also used to crash SoftICE and to force it to execute any commands
/ D! d* n1 w/ ^0 {$ ^1 q" ~' ]2 P(HBOOT...) :-((  & ~# c# j6 i8 J2 I: ~4 j

  y6 ]& U6 B+ F0 F. mHere is a quick description:
/ E  i5 ~* {' L/ ?! `-AX = 0910h   (Display string in SIce windows)
/ s" U$ b7 P) a# u- U/ Q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)* _/ y# f! c+ @6 s
-AX = 0912h   (Get breakpoint infos)
8 O# W5 O* R5 h/ q' ?( B6 [$ B-AX = 0913h   (Set Sice breakpoints)! Q, W% i" g: ^5 l" E5 Z
-AX = 0914h   (Remove SIce breakoints)6 `5 \; f4 g0 a0 Z. n7 X

6 p( N- z( M/ Q3 SEach time you'll meet this trick, you'll see:  m! Q1 R. t( @. {
-SI = 4647h
4 [8 A/ ]6 c% w( o5 ]4 Y9 ?-DI = 4A4Dh( g, O6 k+ }& ]2 Y
Which are the 'magic values' used by SoftIce.0 d$ J: \0 B$ N% x' O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, Q. B9 h( B( V) _8 ]. {3 v3 {
. `. _/ M( k+ L/ VHere is one example from the file "Haspinst.exe" which is the dongle HASP5 X2 g9 z- C. K1 ]' r/ G1 A
Envelope utility use to protect DOS applications:
8 q! N8 P& p& c5 |4 ?9 o& `: B! E9 _+ J8 q* y" D$ i" H; I' ^

" w0 m, T7 P% r0 j4 q6 e. J4C19:0095   MOV    AX,0911  ; execute command.
  l; S9 G( w$ U# ?! n6 ], E- n4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ a5 m0 a( {3 m6 W
4C19:009A   MOV    SI,4647  ; 1st magic value.
% H/ K( [3 O  V2 W: p4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; N2 W+ U( M. t/ r8 t5 Y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' J# n1 ?/ ]0 K% e! ^
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& F% T8 u/ c. M# x& ~$ E3 }4C19:00A4   INC    CX. }- u# A, x$ v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 o3 w7 O0 J; P6 y; O, ?
4C19:00A8   JB     0095     ; 6 different commands.; J, k2 U3 v# H
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& ^- F) u' w0 B. f* y( E
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 ]1 U6 F& L: Z, X# ?! h5 S4 t

1 N, K5 n* u1 W$ y% gThe program will execute 6 different SIce commands located at ds:dx, which! N& N# w. q6 ?% A8 y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.' X0 Q7 E5 |- {
  r( j( P0 D) D0 ]2 s
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
! N& `- ?: H  n: j: E" ~* A___________________________________________________________________________
# J  ]5 J, W5 F/ W9 d: |3 {" B4 V9 T7 n' [

! C/ b9 G) k# {9 @( pMethod 03
( e3 c) \: \2 h# z6 s=========  o8 r" q- Y* Q

7 \3 e% W4 |+ U$ Q3 k4 ~# }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h& L/ b7 C% R% ^$ |! L8 j
(API Get entry point)/ H: f  a3 _! y
        ; ?6 `2 P  S9 p& K$ h

. w. D. a  B5 W7 i, V- j" G    xor     di,di8 [& o* t. M8 }& A! {% R4 B
    mov     es,di
% j5 u7 N4 _( P1 g    mov     ax, 1684h      
# e3 l/ Q. g4 n4 o$ A1 r$ x3 ~    mov     bx, 0202h       ; VxD ID of winice
2 |0 C' N; @3 {- M/ b    int     2Fh2 n0 Y, M$ Y/ p& |: _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 l2 l3 v  C0 t4 h+ U2 E# d
    add     ax, di
) r6 Y  J& J' M* y1 ]# L    test    ax,ax. W1 c/ o- @( ?1 y& N
    jnz     SoftICE_Detected3 m9 M3 @0 [4 }% p
; S: X- P) f5 W, U; n  p" C! S
___________________________________________________________________________
& Q# v6 Q! G- w! B+ n. X6 m5 j# _/ a; f7 y" h  ]# K. r
Method 04- `3 c  s' A! m% T( Z3 X
=========% {8 G3 C; _1 R: l/ W! |' z$ S7 t

- h, g/ d# Y1 l. n8 c, x9 g; @Method identical to the preceding one except that it seeks the ID of SoftICE
$ T6 T5 _, A- C( {! [6 r- HGFX VxD.3 {1 t& j" B5 V4 Q! V7 \; O, ]

' a& }& q: \* w9 O1 \, \) t+ V+ W    xor     di,di
4 ^# @3 D5 C% p# i6 A3 U    mov     es,di$ j) {1 y( K" S0 I
    mov     ax, 1684h      
) `8 J, j  w: N) D: M) P% b( o7 I    mov     bx, 7a5Fh       ; VxD ID of SIWVID
: E/ J& S& Z, f3 M" D' E" d    int     2fh6 l# _! ]/ e2 `0 C* R; H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 j$ S& l' Q# U; o% k4 O
    add     ax, di) W) X. P3 m- e3 E" F- s6 r
    test    ax,ax
4 i5 g6 e) X  E8 h, R    jnz     SoftICE_Detected
# w) N3 U4 }& v4 N2 E1 y, p3 U$ e3 n! X  h  c
__________________________________________________________________________
9 d  ^; H( r6 R, d; N
& Z! ]+ X7 p+ T
# G* X* i6 p! d9 E4 tMethod 054 }) U) _/ S. m: g0 u- d6 Z
=========
2 h" Q3 m2 h$ n: v- L& P' N+ c. I/ F9 t
Method seeking the 'magic number' 0F386h returned (in ax) by all system0 k7 Z# M: f# F; r4 L
debugger. It calls the int 41h, function 4Fh.2 s8 r5 n: g9 @/ M6 S
There are several alternatives.  
' d# M$ s& v; G7 [+ J+ y6 B1 B, |- i! R9 ~6 R* G# w* \  E
The following one is the simplest:: U3 |/ F) s7 Z) d

8 b* o* l( k, T* _9 u+ X    mov     ax,4fh
+ E8 ?; G6 ~9 a/ G5 B5 T4 d: d    int     41h- N7 J7 n- R  ^
    cmp     ax, 0F3864 h. z5 K5 o/ E5 @' y. B
    jz      SoftICE_detected+ t% e* j+ z1 s2 f- G
/ f6 _3 `2 ^; ~9 R

6 Q5 p6 |  w: u( O% }Next method as well as the following one are 2 examples from Stone's 3 {2 v: `1 q9 c
"stn-wid.zip" (www.cracking.net):
0 p1 E- P( {/ Y6 B) Q+ P( t7 y# a+ B
    mov     bx, cs/ C5 b8 _$ }0 N$ P0 q' C% s& L- Q
    lea     dx, int41handler2# V7 w6 h% k( \- `5 h4 _) m: k
    xchg    dx, es:[41h*4]: r5 j8 x6 ]& U9 u0 A  b' q
    xchg    bx, es:[41h*4+2]' s% E+ n: T6 m
    mov     ax,4fh
& R  ~( t9 F' i+ n. L) Q" f    int     41h7 N5 c  I: ~! j: A% E% T( k- ]
    xchg    dx, es:[41h*4]
: L. f1 @( i" O- k    xchg    bx, es:[41h*4+2]
/ }' v# Y9 f1 y" ?2 Z    cmp     ax, 0f386h1 W; W0 X7 {3 V
    jz      SoftICE_detected
' q' ?( U  B5 F% E# ]# G8 y- `- M0 q/ [0 y6 i. d
int41handler2 PROC
8 p, v; B% y8 B+ v    iret
. ^( i# \* j1 E, k; C3 K7 `int41handler2 ENDP
7 u9 S4 ]# e% W7 p/ c! X* I5 A' q
+ Q) `3 p; ?( v5 V, a; L( z9 P# W0 Q* {: z* D0 P3 s3 `1 d! @
_________________________________________________________________________
- Q7 u; b- G" f# W4 X
9 R' ?! V" V0 d( q4 r2 W% _
9 O& Z6 a9 E; W0 t1 RMethod 06
! h& Y) z4 S. C/ M' ?( d: }: p=========
; ]; E; p9 c5 n% Q8 c7 c, v/ H' Z5 w  U4 O% [8 o& Q
8 g" p2 G* a2 y) D0 ^; f$ k. j) O
2nd method similar to the preceding one but more difficult to detect:
1 G- k1 }3 g3 i/ e* Z( ?* ^, E" _5 P0 h4 |. O+ @- {: R/ \
! \4 J( l! w" p# h8 v  K
int41handler PROC* x3 C9 i- {) [3 q
    mov     cl,al
3 a- x+ O2 a6 D3 m( S  y    iret4 |9 q  i6 R+ {! H. F
int41handler ENDP8 P/ x  S; R5 z; b" C

1 ?. X9 B  H# p# q
" N) b/ n  ^; d    xor     ax,ax& A% h! J- d8 A
    mov     es,ax4 G! |* L; q, S
    mov     bx, cs3 D9 c- R' M5 ~" I
    lea     dx, int41handler( A% Z7 L+ i4 ]
    xchg    dx, es:[41h*4]/ m1 d3 ?/ @2 S4 Q/ h; \2 E
    xchg    bx, es:[41h*4+2]
& v3 d+ k6 P$ X    in      al, 40h/ V, C( o( @2 O( |5 X
    xor     cx,cx0 J/ W6 s' V& y" E4 B- {
    int     41h* X0 U: U9 ~9 w/ G3 G3 Q6 @* j
    xchg    dx, es:[41h*4]
) P; y8 Z' m$ B/ N; S, o4 E3 \    xchg    bx, es:[41h*4+2]1 C1 d: \+ B2 {' x0 s
    cmp     cl,al
; A/ A2 o- c+ F    jnz     SoftICE_detected
) E# r* F/ J' l% u- }$ W- |- T- X
' w  S) }1 d4 P$ z  s+ p_________________________________________________________________________# `7 p6 V9 I0 C4 d& V  |; V/ z4 A2 |
& ^8 \# {7 b; `$ Y
Method 07
' H. _# C* ^1 e" z=========, l( j) @& E' K0 L- i5 l6 P6 M
4 z5 e( x, {1 i3 Y
Method of detection of the WinICE handler in the int68h (V86)
6 F, `* x! i, p
& F5 _3 z1 H  \* v  {8 S" [' ?# r    mov     ah,43h
& ^( C& |* ^2 f; s, {9 e  B  u    int     68h3 L: [0 e9 H  W+ S- ?# G
    cmp     ax,0F386h4 [! D1 S5 d9 _) Z; {; G5 l3 f
    jz      SoftICE_Detected' \2 Q/ c+ H4 U) H

9 |0 O5 B8 x8 P1 B  g9 b0 q: a+ n5 D4 v' T+ c2 F
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ L1 b  y1 y1 B) V
   app like this:0 }+ D% N& }& C" o5 ]/ P

2 C- m) h/ A1 w* ~  W* c9 J   BPX exec_int if ax==68
, }# P" R$ x$ ?3 S8 ~1 u- K   (function called is located at byte ptr [ebp+1Dh] and client eip is
! G3 Q6 |6 ^" E   located at [ebp+48h] for 32Bit apps)
9 r; M0 U: y& Z) d  M( O7 m__________________________________________________________________________
) h% k8 }1 J2 g9 y' ~# A. u* q7 J9 L5 q  }/ g2 f' Q% R9 v
, V( _- Q5 h1 Y! ~% y
Method 08
: L- r- e2 @5 ~  `& \=========
9 L" n! w1 R8 F! M2 E$ l& E; e9 V% U0 e: T* ]4 j. N
It is not a method of detection of SoftICE but a possibility to crash the( K% ~" S+ ?4 M' p9 Q
system by intercepting int 01h and int 03h and redirecting them to another
) C5 v$ }: z. w8 X7 \0 u: M9 ]routine.
5 k: V* J3 Z; ^; ^It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
0 x- ^: V* T% W$ e( f9 N' C% Sto the new routine to execute (hangs computer...)
2 ^+ Z3 _$ s( T: ^$ B: S. @0 X" T, J6 m3 `; i  a. @8 T2 S
    mov     ah, 25h
7 H* P2 j3 ~3 T; p; @/ b2 d/ l+ ~    mov     al, Int_Number (01h or 03h)
% x6 S7 r* a. v0 e: w0 R( @    mov     dx, offset New_Int_Routine
0 D5 J1 V6 T5 `7 S+ u# G    int     21h
% m8 |9 |" h0 r% y% `9 Q
2 w1 W" L% c+ z" h" f2 L0 R  h- O$ [__________________________________________________________________________
+ h. K  A+ w$ N  Z7 h% K2 f- R$ ^& A% ]
Method 09& `7 g" y2 @/ O# _* `
=========
3 R/ L2 O; d' r8 ]1 ?
% d( I7 m! |; ]( oThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
2 w' o1 O8 J, X; x2 lperformed in ring0 (VxD or a ring3 app using the VxdCall).
$ x" s. U) {+ |. g4 E4 h( B! }The Get_DDB service is used to determine whether or not a VxD is installed7 A3 [8 ^3 R7 v1 Y
for the specified device and returns a Device Description Block (in ecx) for
9 p) Y1 g. X2 r' q0 u) dthat device if it is installed.
: |7 P$ Q1 _! I% P
( Z9 v! u4 U! v: q. F2 Q$ k   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# I( B( m; G6 a2 Z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ t6 G# d) Q# k$ c" y
   VMMCall Get_DDB
  i3 {* A$ F& |4 m3 y9 E: z- e   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( Y5 t3 @2 c4 N6 M/ w. M  q; y- g6 A! f6 u: l1 K; g" Y
Note as well that you can easily detect this method with SoftICE:6 S, I4 O3 D6 d
   bpx Get_DDB if ax==0202 || ax==7a5fh$ a; V" x) S2 z& ^, B! o8 k4 c! o
, ?: }% ~: H2 B- P0 i
__________________________________________________________________________
$ A0 A1 S& U/ G" X6 f
* z+ E+ p$ ~& TMethod 10" U) k7 P' B3 U2 A& J3 v- f4 e
=========
" c( R( S+ N- z& j- b& c( Z
; b' [% k% @5 V7 a- R5 M( g=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) o2 l4 E( c, U+ C  SoftICE while the option is enable!!9 o- Z5 \% g( P! W7 d2 {

! U& Y7 @% \: I4 [3 Z4 L/ eThis trick is very efficient:) i8 C$ P: O( ]! H/ \8 [
by checking the Debug Registers, you can detect if SoftICE is loaded
7 S  @' c# [- _! E- X0 y! m(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
3 a1 d! j8 c  W, j7 l/ Q9 s* z1 G  vthere are some memory breakpoints set (dr0 to dr3) simply by reading their
, G* c4 k) W, i* l( [" \% Svalue (in ring0 only). Values can be manipulated and or changed as well
  p8 Z. W- d# Y* B2 f3 {(clearing BPMs for instance)
6 S4 Q3 ^7 m9 U9 c! L  k( n/ }/ U* P
__________________________________________________________________________
. ~& j( `$ u) N% x1 n! i$ ~' J
& R5 M" v( y" W, H: ~Method 11! X; Z7 E! M; c
=========
1 ?5 ?8 a. d0 G& n" ]9 b+ b' `7 A5 T4 I' `
This method is most known as 'MeltICE' because it has been freely distributed
& Y, q' Y" M: v1 nvia www.winfiles.com. However it was first used by NuMega people to allow6 _' N8 x) v) A: p5 E
Symbol Loader to check if SoftICE was active or not (the code is located
! ?' ]' Y# e( H- k1 `9 ginside nmtrans.dll).  ]% z# F5 r* E: Q

1 |* A5 y" `! t: a( H) fThe way it works is very simple:
7 c2 O% G$ e3 X$ R9 qIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 t2 W& z) H2 r- u( l
WinNT) with the CreateFileA API.: A1 i6 S1 l1 ]# E* H  j! L
$ J0 i) F  c+ b) g9 ^
Here is a sample (checking for 'SICE'):
. f$ D- S' V$ U5 a& F: |
! F+ r8 S" b6 _/ e" gBOOL IsSoftIce95Loaded()% Q2 C( w2 E* a. _
{
( z$ D& H, [. g, e# g   HANDLE hFile;  ( }, D: }$ l7 w
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
  _1 u$ m" n  z, a: g* w                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ |. R( Y$ G+ S5 S
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
0 x/ L- i* b; v2 `7 h   if( hFile != INVALID_HANDLE_VALUE )' ?2 \  q& I6 I7 g
   {
% X" ^, E8 V9 q+ K      CloseHandle(hFile);
% A" [) o. {; A) x/ H; f6 k      return TRUE;
: p3 b3 M# x8 e4 F6 w9 F   }
! z2 I+ ~" ^; F: o9 {' i( z9 i$ d% d# `   return FALSE;, ]/ ?3 l! j6 Y% b8 U
}
4 T3 _7 b5 c" h1 m! t5 e# X; r/ W: w$ D
Although this trick calls the CreateFileA function, don't even expect to be. k# N* J' Y. n% Q- g* H1 x1 P
able to intercept it by installing a IFS hook: it will not work, no way!
' U7 y" [- E% e$ V& E3 D4 H. G" XIn fact, after the call to CreateFileA it will get through VWIN32 0x001F" u2 a2 {0 i: z4 d9 I: |
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( Y! ?6 q" _5 T: \and then browse the DDB list until it find the VxD and its DDB_Control_Proc  n! i" Z- h5 X! K' U: Q5 m
field.
4 K) a; i0 F* sIn fact, its purpose is not to load/unload VxDs but only to send a
3 h" f8 v6 t3 eW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 R5 O' |7 u6 O6 A. p, U3 |3 b) gto the VxD Control_Dispatch proc (how the hell a shareware soft could try
$ G- ]5 m( ^3 Y5 F1 ^$ P, ito load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 u2 k$ G* {# o. D# mIf the VxD is loaded, it will always clear eax and the Carry flag to allow
# o$ S8 z& y" H, t) i5 D- Oits handle to be opened and then, will be detected.
' |# _4 r$ k5 M& i: y- rYou can check that simply by hooking Winice.exe control proc entry point
% y! ?7 b1 j6 L' {while running MeltICE.6 Y" z+ t. }! h' b7 A3 A- u  k+ O
% b* |+ h1 f4 A
; _8 A5 D" [; K( }* ~
  00401067:  push      00402025    ; \\.\SICE
- j3 B; \1 s9 `9 k* i" u- s8 `  0040106C:  call      CreateFileA' R# o8 r+ G7 X! P, |8 z  g! X# ~: u
  00401071:  cmp       eax,-0018 ]: Q1 r9 d% I
  00401074:  je        00401091# l2 l  G# h7 Q( J: j, g

8 y3 Y0 p0 q4 I" e
5 \. @/ K6 ^! K% HThere could be hundreds of BPX you could use to detect this trick.6 L/ y/ h+ r8 h* e, ^
-The most classical one is:7 t; g- _5 t6 M, t3 Y7 K
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
3 ^+ i6 K' `9 b4 u) @6 D# E$ Y    *(esp-&gt;4+4)=='NTIC'* }: G5 X# \2 A( C0 x% d- Q9 i5 B
; g9 Z9 J+ T7 v4 f  l
-The most exotic ones (could be very slooooow :-(. p/ b' w/ b. k, ?4 w! L9 R6 ?8 c
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . Q% e# Y: i& w9 F
     ;will break 3 times :-(
1 i* u' w% v( S5 q1 I' W3 y  W$ Y
-or (a bit) faster: 2 a5 ~; R) I! r6 P% M
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 W* Q( p( R1 `9 C
( z, {3 v+ b7 ^2 W. p+ t   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 z& ~, r; a" U2 g' ]8 f     ;will break 3 times :-(
. u* z, {7 \+ G& e2 `
( V0 s; z- z, b- X  @-Much faster:
' n$ _6 t9 [! f   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! ?$ H: u6 Q6 y/ E" i* T2 Y  x& |9 ?' K9 x( ^0 x! u
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 F. }% n0 ]3 X+ i# M9 U8 ffunction to do the same job:& ?- }4 b0 s) `4 R7 z

/ M6 x! H& Z( E* o) B) r) i   push    00                        ; OF_READ3 R) m( L( Y5 a3 V6 Q5 ?/ H- \' e
   mov     eax,[00656634]            ; '\\.\SICE',0
' f! G) m. P# Z; G' l   push    eax9 T, O) q9 N' \* b+ H6 E" R& s% G
   call    KERNEL32!_lopen
( \- H. }3 D( q+ @8 j+ A6 h+ d* @* k   inc     eax
# ~( S: r/ G! c+ _! n5 [0 h   jnz     00650589                  ; detected
+ a7 h& l$ Z% M' @. c- A/ k   push    00                        ; OF_READ
1 Q/ H" S+ X/ |( u5 [: |7 f: n   mov     eax,[00656638]            ; '\\.\SICE'( }( M* d6 X' [  c
   push    eax
  x$ u& r+ C. X" A$ B7 L- u   call    KERNEL32!_lopen# F9 J4 X6 G: C: P) N8 L
   inc     eax! H& u7 \5 ~* \/ q9 r+ G8 }" i
   jz      006505ae                  ; not detected
# l& K( G' }; Q: d
5 m$ B- r0 Q% O* o! H1 I5 h
7 c, n, R7 y/ }% @4 V/ [__________________________________________________________________________* x& T  i3 p  [* \' h4 b6 q
5 ~/ C8 g% M0 W4 B& D+ k% K
Method 12, r+ G. d9 D& p5 C9 ?
=========
; C3 u) f/ E$ f- t! r  P6 b- \4 C" R7 @! Z4 {6 l6 e
This trick is similar to int41h/4fh Debugger installation check (code 058 P7 S+ e8 o* M/ S! g
&amp; 06) but very limited because it's only available for Win95/98 (not NT)8 x% i4 A0 }! B
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.% j3 P8 I) R8 N4 t$ Y: V
# \( J, }- q! h3 M
   push  0000004fh         ; function 4fh9 t- q* F2 L7 h
   push  002a002ah         ; high word specifies which VxD (VWIN32). L  a9 {. u& d1 ^
                           ; low word specifies which service# Z' |5 _2 d! Z2 {0 M5 R5 n
                             (VWIN32_Int41Dispatch)
4 ?" D; n& o6 B' G$ ~) }   call  Kernel32!ORD_001  ; VxdCall# T6 H7 a7 Y& E$ s7 N& Q2 e
   cmp   ax, 0f386h        ; magic number returned by system debuggers
4 U* ?2 O, M& J; s' t   jz    SoftICE_detected
$ }! E) C# k8 z9 Z8 r, O' E# Y6 q) c' [/ u
Here again, several ways to detect it:# h& V- J: f# b) ]

1 Q; E' l0 t' _3 I  K    BPINT 41 if ax==4f
$ l! H! ^1 j* _0 }1 J9 I+ x, L
2 j! \  D% h5 f& T" R4 Q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one4 R8 s  X- [9 u# L- M/ S, c

* ]! ?0 }" N1 g3 u, [2 |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* D2 S$ f) E! t/ k% I6 p# U7 n' }! Z
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!" K2 ^( E$ T9 H) Y& c
/ B5 Z  u) q5 r  S+ e- s  @+ _& ]
__________________________________________________________________________6 l; m. V- K% u: c! c* W" [

/ ~& P4 I' U; J. w9 |4 YMethod 13
6 Q# t+ q& L- z6 E# M7 T5 N=========
7 \/ o; L7 J* q5 Z4 F+ ?, q& X, s3 \5 |& {. H
Not a real method of detection, but a good way to know if SoftICE is
' U! h6 t! Q* \+ g4 f1 w2 Sinstalled on a computer and to locate its installation directory.$ Z& _# ?6 T6 P; `) E
It is used by few softs which access the following registry keys (usually #2) :/ l8 S# f& {3 ]
) t' Z5 E$ T* G! }8 k8 L
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ G; T& D0 n- A! K
\Uninstall\SoftICE
: u4 x; g/ W3 i% I7 J-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  o* V" @: T) f
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; s4 o8 p* e' M& [0 i/ y7 ~: z4 H\App Paths\Loader32.Exe% p' l+ x5 y$ C( Q9 O: T( W/ z: t

8 n4 U' `' o% Y
- f% e6 |4 K* Y- m/ c; rNote that some nasty apps could then erase all files from SoftICE directory
, T. {* u8 ^- P( B  g8 e(I faced that once :-(
! w2 c# ?+ t4 h( w: K
0 C5 V0 X2 P6 y# K% M5 wUseful breakpoint to detect it:
" U* J0 T5 v5 f. ]8 |( F+ I) t4 }2 M' z8 O9 q1 c3 s, @! {8 I
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; `! O  m/ {- P+ g8 f: x& M$ {+ b0 K: k
__________________________________________________________________________8 Z9 V3 m: K* N$ \9 c' A

; {, S% ?3 p& H8 K( `) w* h- Z3 C+ S( V6 R& S
Method 14
% \8 p/ j5 ?( V! G3 E8 ^) Y+ r=========
/ S5 E; L9 r. ~! Y* u% |7 l3 V1 l2 K6 J5 c' l$ f( K' ^2 N
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( c" a1 p2 ~# C9 C. Ris to determines whether a debugger is running on your system (ring0 only).. E8 N& Q! Y" p* R; a% a
/ Y( p9 l& c# ]
   VMMCall Test_Debug_Installed+ z" F( J8 o2 n7 D' O. l/ ?
   je      not_installed! G. V* S# w( K$ K: L% \) O) A8 p

; z0 \3 U' U) \7 x3 ^- wThis service just checks a flag.! q4 C6 L# u# }
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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