About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( X. I5 Y/ A8 z/ r" t+ u<TBODY>
' L2 Y% _" u3 E- ]<TR>6 }7 H7 u5 [: k' `( e
<TD><PRE>Method 01
: _0 l4 u5 }5 n! O=========2 {5 y# ]5 ?2 g2 s, F9 i

2 r+ ^: G4 A+ G4 i+ I9 N  eThis method of detection of SoftICE (as well as the following one) is# d) [4 U: j9 b. x, z1 z8 X5 e
used by the majority of packers/encryptors found on Internet.' z2 g* h+ j5 ^& \) [
It seeks the signature of BoundsChecker in SoftICE) p  t' E4 f; H- Z$ R

0 \2 s2 N" ]9 H% e* H: g' h' u* t    mov     ebp, 04243484Bh        ; 'BCHK'! J* H% n- x" U( H2 z- F
    mov     ax, 04h
" B  G) Q' K( Q1 m7 ^4 j  `2 X    int     3      
+ m( J! r4 ?* e+ b; Q    cmp     al,4$ G2 F) t5 ^1 [8 K0 N
    jnz     SoftICE_Detected
1 j6 F$ m! ~7 [0 a' |# [& P% }3 I' s% }" H/ L! E
___________________________________________________________________________- `$ m; w7 [6 ]4 I- w4 o
; k( P7 D, Q, J+ D' }+ e1 i) U% B. |7 S
Method 02( d3 P% ~+ x+ e7 X0 j4 E  H  z
=========& p" R% G  @9 S8 C5 D; b1 I/ M( @5 O2 f

2 W5 a0 x2 {( v' S9 oStill a method very much used (perhaps the most frequent one).  It is used
: K4 f# d1 b- v0 Kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,& U' a, B' x7 u* y, }; O% W
or execute SoftICE commands...7 f" y( D2 J9 K
It is also used to crash SoftICE and to force it to execute any commands
& h0 v1 x6 |* _5 y# R(HBOOT...) :-((  
7 c! ~  W- \' e, A, w
4 H" X+ O- _/ e+ {! d$ D: v) ?Here is a quick description:
% Y: G2 ~" Q$ _: H-AX = 0910h   (Display string in SIce windows)
- i5 f5 s/ h5 n5 W) `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)/ c/ V6 p9 T: _- ^
-AX = 0912h   (Get breakpoint infos)+ T) m* S) y" n0 ?5 P8 X' [
-AX = 0913h   (Set Sice breakpoints)* {% u1 F; U3 K
-AX = 0914h   (Remove SIce breakoints)
4 c/ e7 t; R, m* q
3 ]3 G! z% p' ~Each time you'll meet this trick, you'll see:4 U. x: R( ~' B0 [: D% V
-SI = 4647h
7 t9 `) w  H0 g2 P-DI = 4A4Dh
, _7 S) E& s. S" k; i7 }1 OWhich are the 'magic values' used by SoftIce.0 n3 H7 A: k; @& h" }: S
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
4 C6 }# c4 @5 b- V6 Y5 I1 ~& G( P3 P  O$ n5 z8 ~9 j7 H" K
Here is one example from the file "Haspinst.exe" which is the dongle HASP8 v. H( T9 O2 J. l8 D
Envelope utility use to protect DOS applications:8 p& Z! q3 `+ B9 q( x* d$ @
& o0 S) ?0 D% j0 Y% f/ `( o0 C

. d+ H! [# _% l- d7 B2 t4C19:0095   MOV    AX,0911  ; execute command.
6 t0 T3 E( D$ I) O6 k4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).* k2 n5 e7 i' f- V& [2 Y% u
4C19:009A   MOV    SI,4647  ; 1st magic value.
. K& L5 o, X. D9 [" M0 v  o4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" |" t  T# |6 D4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 B% d/ }7 J( p: B1 v, F
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 a: F/ u  i. X. k4C19:00A4   INC    CX
, m5 w3 H5 r; }% }' d; B" y" f! S4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
+ \. P! [. F. O( B! {6 `/ k+ Q' q0 ]- n4C19:00A8   JB     0095     ; 6 different commands.
3 I" e6 o8 g2 n' h# ^- p/ _4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% J5 U( ~/ g0 G* _
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! _( r# q- R% L$ `/ Z

7 z$ l# t5 v, r& N$ bThe program will execute 6 different SIce commands located at ds:dx, which
0 a+ X$ {$ g* t# {* \6 [2 @- F' `are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% y+ h" B3 `9 |. {0 |8 `
, Q6 O, b, `( G0 Q5 T9 w
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.6 _7 y# r4 }! p5 P) F$ W
___________________________________________________________________________
7 r- p, T% u8 z  K
! j! {5 [1 q0 ?% a
' a) @0 |2 S8 c+ qMethod 034 B# A6 D( C+ h
=========
  Q/ L. a8 h6 {' N% H! ^6 d- x  H$ W
' U! N' V- Y, b+ H0 s: K  rLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h2 C8 d6 r" E2 d# j! ?; L( N0 S( h
(API Get entry point)% k1 Q* E; \6 K: b$ b! e" `$ g  k
        
  a; Y/ f5 m" s- k  v( E# e# Z3 L% ]: {. w' ~
    xor     di,di
  K0 l9 ?5 ~/ \- g; O0 Q7 l    mov     es,di
1 D/ N% Y& \2 e1 @" }    mov     ax, 1684h      
" y' ~" T& \) J( |    mov     bx, 0202h       ; VxD ID of winice
. R( {* M& }; v4 I6 t, S4 m& ]" ~% a    int     2Fh
& w$ \, O7 M+ k  K7 w2 m    mov     ax, es          ; ES:DI -&gt; VxD API entry point  p) O! a: K8 z
    add     ax, di0 D5 b3 q: M+ q5 I& h
    test    ax,ax
" m1 `, ]. _# z: ~    jnz     SoftICE_Detected4 n! `( r8 f; H+ u6 |0 \
8 ?" x* z$ J8 p- v
___________________________________________________________________________9 n# Y, w6 f4 q# U3 ]5 i

. X; |/ F9 R6 K- Z) ]# YMethod 04. A. {/ q' L5 ]9 A" d
=========
6 P* u+ ?4 R8 h; S) s8 f# L/ Y! ~. B. K- U2 O
Method identical to the preceding one except that it seeks the ID of SoftICE! Y& g/ \  s# ~7 P5 i) E
GFX VxD.
  z% m) H8 I- a7 H
1 t! D5 ^- t1 @+ ?    xor     di,di
- @$ d, s; h* B. p8 H/ S. O4 a! L    mov     es,di
" E9 m8 g! |8 e& V* `9 o    mov     ax, 1684h       . A, \" _& x0 @: m: m  z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 `' ^6 C- z) K! ]5 F+ _    int     2fh
& l: Z* m, R2 Q3 ~: R2 C    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 I) q6 P1 s! P& Z* }; i4 @
    add     ax, di
* \; O7 G+ `( Q& `( q' {& X    test    ax,ax& Q( K% K# v' S1 d% M, v9 |1 c
    jnz     SoftICE_Detected0 ^/ d6 `8 m: Y" @0 k2 m; ]
5 ^5 |2 T0 ~/ |: F! }/ J0 ^
__________________________________________________________________________
3 ^% _, x% G& C# D6 n
# d, J& B! D, L4 P+ i
3 |% f# ^4 p: [9 G4 C9 y& K* fMethod 05/ I+ N) [  A/ Y: W' J4 ?% H3 c0 b
=========( V0 i6 H9 e& e+ W
/ d8 r9 o/ v5 K: D# A
Method seeking the 'magic number' 0F386h returned (in ax) by all system
+ j4 f; O5 z& Pdebugger. It calls the int 41h, function 4Fh.
: e$ d! {) r9 [: w" p" ^+ KThere are several alternatives.  
" V* ]! y7 T; [8 t7 [, `6 |8 ]6 ^$ l1 g  q/ r) [
The following one is the simplest:
2 @8 @+ F8 X# P! X( c! |/ S
* b" b: l2 X- K. v& L; T. R; a    mov     ax,4fh& @- a' F- @, @' |7 u* A/ Z+ }! V
    int     41h
# z; G' Q, ?6 J    cmp     ax, 0F386
) `& F  ]* B! _& l- x) s9 s: Z    jz      SoftICE_detected
8 p2 o  O) d" X  l# H# b/ Z2 M6 \8 ]. B8 q6 G

8 Y  M! \. R* O: B; `Next method as well as the following one are 2 examples from Stone's
& s* k! J- B6 x. A0 |"stn-wid.zip" (www.cracking.net):
7 L; z" P' g. b/ n3 f8 H
! R' V  n1 h$ {2 G    mov     bx, cs. e1 A% R5 F0 @
    lea     dx, int41handler2
! S1 i9 X4 J1 b) j' b/ z) |    xchg    dx, es:[41h*4]
5 w2 N. F5 t0 m: i, L' |    xchg    bx, es:[41h*4+2]% b6 }# t' j; ?1 ~' i
    mov     ax,4fh5 H; V, S% g: G5 b3 J! @
    int     41h$ X- G2 b- t- Y
    xchg    dx, es:[41h*4]7 t' ], p# y8 I* V& }; X6 W
    xchg    bx, es:[41h*4+2]5 |( q7 Q1 f4 r7 K
    cmp     ax, 0f386h7 O6 e- s" x# m4 o3 U
    jz      SoftICE_detected
8 J- y/ G3 l( X2 w5 m' B" s
% C2 d) U4 x( W$ z7 d/ Oint41handler2 PROC5 u0 _3 |( v, r; [( U  ^; i+ E
    iret
8 }, Z  w, }- j, V$ {1 Sint41handler2 ENDP& W% j0 t' T$ m/ q3 Q& K

5 \! F5 Z/ _: g* N2 e1 u+ v) p) Q' n
5 A; A- |" b+ Q_________________________________________________________________________
( z& s+ Z: N2 L* x/ B$ R) }6 [  s9 c$ H* J

7 L% o) u+ x+ mMethod 06
) P- {4 j- [% I$ W; i: T/ M=========8 X1 r( Z$ ?5 ^+ g* c$ K' b5 g
4 l- T' X, d% s, H
3 x; ^" L0 a$ v( X' b* a+ Z
2nd method similar to the preceding one but more difficult to detect:# f& L$ C, \3 U5 b  K
  }! \+ f9 ~$ z
, d. s! r  |/ \# a8 x3 d
int41handler PROC9 \$ x( E+ I. f3 l1 @
    mov     cl,al
4 M. g3 H4 P& \- w7 C    iret
7 g: S$ g6 p2 F7 a8 ~' |  A% hint41handler ENDP
1 Z) t( l% N/ z+ ~, |7 A4 x9 Z8 F. e/ x
3 _& ^) N8 h* S& s
    xor     ax,ax
" U" e  `2 }: s# B* w    mov     es,ax
0 P/ U7 Q. e+ ?. i- W0 `    mov     bx, cs/ T1 m# W5 l# I- N/ K; \2 j  N
    lea     dx, int41handler" f+ P$ y$ E. M$ G! `7 Z
    xchg    dx, es:[41h*4]: m' L: a: p% B1 e
    xchg    bx, es:[41h*4+2]- n% m9 z4 D+ u' H. L/ x
    in      al, 40h8 o! o8 H: l3 p
    xor     cx,cx9 U0 F' k4 s4 n5 G1 C' p1 e
    int     41h9 B" W" M6 S, s- K$ v
    xchg    dx, es:[41h*4], t; f+ B- h  D
    xchg    bx, es:[41h*4+2]
; g, h( }  B3 x/ ~8 @: [+ Z! x' ?    cmp     cl,al3 `( j0 n& k$ e5 c
    jnz     SoftICE_detected
! x. [# }9 c2 H  o/ \- N
& T  |; J' |- m* {0 K  V. r_________________________________________________________________________0 G: ]0 I, m$ F+ }( F8 y
/ A5 q( k$ Y' {1 i
Method 07, e- O) s& R9 a) {5 Y$ j2 T
=========
, Z) T. c2 f) F
2 k9 [  {7 Y! f0 F5 o% zMethod of detection of the WinICE handler in the int68h (V86)1 {9 l) T6 G$ N+ k+ X; q/ z

6 J* M' B" E4 A0 S" y8 \) D1 H    mov     ah,43h- W) ^% H4 q0 D8 `4 n# N
    int     68h+ g' G$ @7 b  K  \, v! C! `; }5 m
    cmp     ax,0F386h& p+ V# ]* `. U( R
    jz      SoftICE_Detected
+ {8 I( ^2 X/ Q" m( J% s( q/ v" z8 Q" I% X1 u8 ]/ c, @3 v

. t$ h* p: _8 C8 n=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
* ~9 `3 b% j9 S+ A: w2 P- m" Z   app like this:
+ ]6 g( C3 p9 _' `7 q) f
; H9 h- C5 {' I5 G4 B   BPX exec_int if ax==68% h' v! v7 \# O# ~
   (function called is located at byte ptr [ebp+1Dh] and client eip is
4 w4 A. l) E/ J   located at [ebp+48h] for 32Bit apps)
4 ?2 g: p6 _. }% O/ H' o& d; u. t2 j__________________________________________________________________________
" M+ U3 M( _( n  m* }" Z) ~+ F# Z. Y- P6 H# j! f) z0 [
' y" n7 ^8 o: ?: ?0 O: h
Method 08
" E$ ^! W) y& `4 h=========
; q* Y" g5 V6 P5 Q
9 t9 d) E3 I  t3 z, RIt is not a method of detection of SoftICE but a possibility to crash the
$ g8 G  S  E0 i5 W* Z3 rsystem by intercepting int 01h and int 03h and redirecting them to another
) t9 W, ~% ?4 e' S7 ]! ?routine.) {+ V/ U1 Q% E" A6 D) D
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, J6 ~9 f: H& i8 ]4 u& F' @
to the new routine to execute (hangs computer...)
( i6 ~  V' S9 L/ S) l4 C# W) D1 `
7 Z" y0 O# \, _    mov     ah, 25h* H& z5 I$ ?  \; \. @& d# G- K
    mov     al, Int_Number (01h or 03h)
3 P' V/ @$ r# P! |    mov     dx, offset New_Int_Routine$ ?# e  x1 D. b6 d0 B4 Y* r
    int     21h
8 ~. q5 ]* s/ g: s" X# G& \4 E: E5 W! i. j
__________________________________________________________________________
, V, Q: I! P) p' r' y* {5 Q: V1 s9 v# a! p0 V' a
Method 093 g4 D" ^  K' H5 f
=========9 O0 p* {5 c: t" H

" e7 \) S7 x9 Z% d9 HThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: m# v2 V7 \6 f. B6 R2 c
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 ?% f+ `7 f/ S1 N9 BThe Get_DDB service is used to determine whether or not a VxD is installed
* \7 M) ]: {3 B  b% Sfor the specified device and returns a Device Description Block (in ecx) for$ ~5 h# C' z+ Q
that device if it is installed.
: O% P3 n: V+ p5 P3 I% i" a8 y- |" J- r
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 S" G7 d4 D6 Z/ a7 S& x   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ z" A  ?" g: x
   VMMCall Get_DDB5 j! ]5 o0 z6 o" b
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 S* p5 i" Q8 G% m6 i9 {
2 h, ?8 J; u# f" U* d4 n- Y* PNote as well that you can easily detect this method with SoftICE:2 r5 {+ L9 w/ m" f9 m* L
   bpx Get_DDB if ax==0202 || ax==7a5fh7 f5 _3 j% e( d9 q7 ^6 n

1 a$ X" N2 |/ x1 t5 w9 ]__________________________________________________________________________
1 p7 q3 |9 k& H* I* D7 h2 ?  Y  P0 w& }. f0 d8 o6 e) M' o$ o
Method 10& b& W) `; I" R* V( w4 m
=========
* l5 x% S( p" J9 @0 y7 ~2 v6 u* c7 h6 L  a. k# k! l1 r; v
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 _3 ]+ p. j5 e/ R
  SoftICE while the option is enable!!
2 x- T% Q4 J, c# l9 d# h. s7 M1 K8 n/ }3 p% {0 x6 D% |
This trick is very efficient:$ F) @% U/ F9 t
by checking the Debug Registers, you can detect if SoftICE is loaded
, A. Z0 \9 @4 g6 m$ U(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 D% v, T/ ?! e' v
there are some memory breakpoints set (dr0 to dr3) simply by reading their
, J7 {2 c- ]3 i, P5 k; c. dvalue (in ring0 only). Values can be manipulated and or changed as well
9 u/ R! f% \9 F(clearing BPMs for instance); q: E" j3 K: R- S# |, _0 z
  Y: U4 R: {) S0 d& T
__________________________________________________________________________7 S+ N$ E1 G+ x/ _4 f

9 i8 y: f! b4 t. }" X8 r5 I$ ~Method 11
) t/ J7 d! d9 L' G=========
1 w  E% e- Q9 W: C1 Z
6 v% Y  I- `% n) `- bThis method is most known as 'MeltICE' because it has been freely distributed" C, o$ F0 }1 q( Z( c  d, n8 M$ M
via www.winfiles.com. However it was first used by NuMega people to allow
8 M" S) V, ?! m' @7 hSymbol Loader to check if SoftICE was active or not (the code is located- H# S8 A; b3 x% h8 n
inside nmtrans.dll).
8 w5 Z. S7 k' c& ~  t% R4 ?% l* D* ?* Q0 A  C; E
The way it works is very simple:
% i) R/ Y& o$ x" b( D: B) N; DIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for6 B' p' y" q/ F' f; F5 Z: ?
WinNT) with the CreateFileA API.
" |# a% F/ l& [7 _1 n6 o  D4 S/ d" a3 Y( f+ x+ h5 ?0 I- x6 k
Here is a sample (checking for 'SICE'):
1 V0 P2 `4 @7 P. G5 J: _+ r
5 V. \: Z- K( X4 I& _% SBOOL IsSoftIce95Loaded()5 W( N) R% W$ N/ X" T+ P  h
{% i1 O+ u5 R/ }" Z
   HANDLE hFile;  ' b2 ?$ V, s1 ?- C" _2 [* d8 D+ ~7 F
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,! v+ V7 Q$ z. _3 G* R: C! @
                      FILE_SHARE_READ | FILE_SHARE_WRITE,' B0 \6 r% I" H. R( d
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 [3 M2 Q8 Y/ J9 |( R, ^' e   if( hFile != INVALID_HANDLE_VALUE )
) b7 o5 l5 S8 C" V7 o0 b   {
/ T6 }: U0 Q5 T$ ], d      CloseHandle(hFile);+ b; B1 D! ]5 G. J5 g# Q7 |% m. K
      return TRUE;
8 L; j7 v, x/ p8 f0 A3 F& n' h! U5 s   }
/ x) F5 u' g$ w: A3 E7 s3 X   return FALSE;
$ w/ P: i) i7 U9 K9 |}3 E) r% \; U: q" z( x5 c
! i% G2 b- r5 M9 k  [
Although this trick calls the CreateFileA function, don't even expect to be, J5 |# j0 w3 z7 o4 \) ^
able to intercept it by installing a IFS hook: it will not work, no way!
) w1 j6 N) F/ B, A" v7 L" b6 v" YIn fact, after the call to CreateFileA it will get through VWIN32 0x001F$ P( S! p5 {- \7 s$ w
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 v* ^4 e: c% g5 A  T/ A
and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 W% x8 `& |! t1 Q8 l/ Y
field.
2 R1 v: @: r6 R8 O# PIn fact, its purpose is not to load/unload VxDs but only to send a
9 s# X5 ?; \% T, }W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 w6 W8 w+ I$ O, Ato the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 p* ^9 R5 r, vto load/unload a non-dynamically loadable driver such as SoftICE ;-).
- K! ?' v7 c8 I, ?1 B5 hIf the VxD is loaded, it will always clear eax and the Carry flag to allow
6 `  \' a' ?/ v" g0 [6 D. bits handle to be opened and then, will be detected.
$ p0 ]% z: Q$ h1 t) [# |You can check that simply by hooking Winice.exe control proc entry point
8 P/ [* `, H- r2 xwhile running MeltICE.
* Z3 ]6 Z3 R( j) T  ?7 c' Q2 P, h- e3 N: F

6 f  R( e/ S8 |" i2 l& x  00401067:  push      00402025    ; \\.\SICE
$ K# z# z7 p7 {3 r* ?  0040106C:  call      CreateFileA4 f4 Y+ a0 b. j0 L8 |
  00401071:  cmp       eax,-001$ a: t( s9 r# Y/ [& U: a' h8 e
  00401074:  je        00401091
% W( d1 d- t" h9 C3 ~
7 I/ w  r6 M  j. P4 W! W# |& K4 `3 N. F- ~. Q# P0 I
There could be hundreds of BPX you could use to detect this trick.7 ^" j+ {2 [" S. D3 L+ {9 b( x. V: X+ t
-The most classical one is:4 F. L- ]+ j' t" f: q8 K2 A
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ z9 W  ?/ k+ J  T    *(esp-&gt;4+4)=='NTIC'
$ @+ V+ K# U+ y1 Q7 {9 c! T9 u* G3 H4 M7 _6 _9 \
-The most exotic ones (could be very slooooow :-(
; }# U' E. {- }, P  m' n2 b* \   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
. x: }; o! ^, _# K, O7 Y, B     ;will break 3 times :-(5 V8 j, |3 |9 m; K( ?( ?* w- C
+ o% S( @6 I# K" o
-or (a bit) faster:
6 R, v( F. T& z8 v   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')* ?4 `  t& n( b) e

; h2 j7 h; D& o, D   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'    h% m5 `1 L! E6 `- V( d3 s
     ;will break 3 times :-(
* v9 R$ t) @, }0 R4 q& K; i) n7 _; L4 J+ M9 k
-Much faster:
0 w6 h' S3 \0 L$ A4 O2 d   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ S: v) [" F* G$ o7 a3 r% X2 l( \1 k" h
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen/ T) Q8 g7 U4 k1 w5 V
function to do the same job:- w6 r$ E1 t' V* A

4 `1 w& q& ^0 q6 q* {" K   push    00                        ; OF_READ; l" u9 g1 K7 M  V
   mov     eax,[00656634]            ; '\\.\SICE',0! K* d) r+ w* R$ M
   push    eax" F: V0 p5 U. v% S* A# f& ~
   call    KERNEL32!_lopen
/ e# F! A& v; E& l% ~$ V9 R   inc     eax
, W. X6 x7 c$ c   jnz     00650589                  ; detected
$ l$ N. B3 @. X3 B, Z" g   push    00                        ; OF_READ
% |& L1 ~0 K- U) O. J; m3 ^   mov     eax,[00656638]            ; '\\.\SICE'
3 n- I* x; Y1 e1 U) O; v4 ^8 ]   push    eax: m7 f- x* z/ z7 o* t
   call    KERNEL32!_lopen
+ ^$ n$ H$ V) G' a& U3 {   inc     eax6 ]# v, |+ i" T3 e1 W3 [) j  ]3 o; t
   jz      006505ae                  ; not detected8 U1 |2 h, h: I3 k( a; `3 b
) G. l# q  \9 [# X) `4 ?0 Q
0 g; S' X9 T/ z: Z& T" B" [2 K6 ]
__________________________________________________________________________
: y. l/ j. p1 i" b/ p) }# C' }* }
, W3 |# b& Z: b" k! |Method 12
5 h4 I: i2 n; h/ Y) X! _+ X, h=========! ^/ e9 C- t! ]+ t+ v

6 d; d) z, v% ~+ H" iThis trick is similar to int41h/4fh Debugger installation check (code 050 g2 o9 i5 u. c5 [& n
&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ C2 F+ T; \  c/ C4 W5 L
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ E9 t3 d; J5 J8 @, \" Y% r- K
1 k2 a: A+ w" m7 J5 I. |
   push  0000004fh         ; function 4fh& U' ~; b! k  A. r9 l
   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 P, _! m1 {: g                           ; low word specifies which service
5 J8 v/ c5 v& ~6 z# K' B, G( F$ S                             (VWIN32_Int41Dispatch)
+ C" `( L$ [, w# k4 ~( L5 |8 U   call  Kernel32!ORD_001  ; VxdCall: m5 T& w( C1 h1 C' }% q1 r9 ^
   cmp   ax, 0f386h        ; magic number returned by system debuggers
' {! p7 |  _7 `) y" r0 U   jz    SoftICE_detected+ ]% a  W% J2 G7 ]# T! O% V

3 @  k. A! X3 m" u% W5 _1 |% nHere again, several ways to detect it:
, H/ d8 `7 l: [" H" I0 d0 ^8 S" ], p$ Y0 r0 n+ [: c
    BPINT 41 if ax==4f
, w( l- ~/ z2 R* P# z, b3 n$ k3 Y0 L: n) a  [. x, e
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' H1 B6 B3 E, T7 A9 x8 q* q
( F6 \& T; P  d+ S5 N# K2 i
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  m. @" W; u. L8 \

4 s# @/ e6 ?4 O; z9 }  n    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' R  I3 U; K' O% j: o, `2 ^, g: B. R9 p" c6 ]0 B$ F
__________________________________________________________________________, V3 c; ~$ F: @( b5 L

. k% u! [" h( S  ?4 w1 l/ T0 }Method 134 K7 Q& f1 w- z9 B) _3 O  H, a
=========
. ^( p0 |) C' E* {
8 u3 p6 {# e- s5 H. dNot a real method of detection, but a good way to know if SoftICE is
0 E4 B2 ]6 }* ?6 I$ y) {( Q. Hinstalled on a computer and to locate its installation directory.
5 z" J* q) B7 s  N7 C, {2 ~It is used by few softs which access the following registry keys (usually #2) :
4 x3 N8 C! s. U  w  \8 v3 h
& k5 Z# {4 n# ]8 M3 M! t-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* }  w3 a# [8 l
\Uninstall\SoftICE4 e! e7 o& |% O
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
4 g9 k/ h0 c, D/ o% @, _& _-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; m; r' d9 ^; |# O" C! H
\App Paths\Loader32.Exe$ i; _, d8 ]+ L8 y# c5 r
/ r" e5 b' P6 X" r0 E( k
1 E* r) q; Q& {+ w- ~+ [
Note that some nasty apps could then erase all files from SoftICE directory
7 C3 g/ r1 p; W6 [(I faced that once :-(
7 ~& e4 h/ p' O5 R3 X5 N/ q' e( m4 a" |( R8 x& o6 G2 d' b
Useful breakpoint to detect it:' D4 A: V/ K3 }" y& R8 C: k

+ G2 a9 Z" z3 x" C5 U% X' c     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 E4 U0 c: |# x- W$ T
( x1 g$ `0 n3 k3 M__________________________________________________________________________- ?* s  ]' c' D! H2 c( e* Z
/ Z5 o, i( Y6 N3 T& G' |

/ m( Q$ x' A' K$ l6 [Method 14
+ g9 a( |/ b8 E# g3 O- d=========4 G5 H: a/ h, o9 W; }8 w+ Z

' Z0 T" A( Z* S; o8 oA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose. T1 E& F& a( S4 K. `
is to determines whether a debugger is running on your system (ring0 only).
  Y3 W1 u1 B9 E; ]; e2 }: w* e- M) z1 Y, K- m  g) y: y, a
   VMMCall Test_Debug_Installed
/ A* ]& u# C- F   je      not_installed9 O; T) r" v+ g

0 J" {6 i8 F& V; N9 bThis service just checks a flag.
- O8 W* F& N1 n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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