About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 b5 x7 \4 @/ Q! M! h5 c6 B4 K+ {3 i
<TBODY>
/ ^5 M& P8 V1 O1 u" P' b<TR>
: A7 l+ Q. p* U" j1 [2 {<TD><PRE>Method 01
* ~2 G' u' G+ g=========  p$ ]$ o5 K) B1 T" s1 P

% Z5 l( y7 F/ D$ Q: bThis method of detection of SoftICE (as well as the following one) is2 h/ `+ k/ C" m* k" n5 m7 Z/ L
used by the majority of packers/encryptors found on Internet.
7 a/ h6 Y% H: U  h. t  gIt seeks the signature of BoundsChecker in SoftICE. D  a: G4 T5 J2 X/ W9 c" [+ k6 {
+ N7 K3 g' ~5 T; V' f+ M( M# W
    mov     ebp, 04243484Bh        ; 'BCHK'
; {3 s* r" d  C! V: U, a% L4 E$ f    mov     ax, 04h
5 Y0 l- m5 z3 W, N4 D* O: z    int     3      
6 G$ e- w' k$ i( r  n    cmp     al,4
2 q' x3 d) a5 D5 ?( E+ _9 z4 [9 y    jnz     SoftICE_Detected
: Z0 F9 w% }5 g
- Z; W" B; S1 K5 y___________________________________________________________________________! x2 N" A/ o/ d: V( K9 d* V' n) A+ J
/ G3 W( F, t" D4 }6 c7 o8 i
Method 02) K# l2 t+ m8 u7 {
=========
& R4 _( I: m% Y* t3 s/ X
/ D/ Y* b& x5 A6 m" d' }Still a method very much used (perhaps the most frequent one).  It is used* W4 I9 W% s) d
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 m5 K! Z6 L" ~; d8 Ior execute SoftICE commands...
# ^, v: B) y+ `8 C( a" ~It is also used to crash SoftICE and to force it to execute any commands) z' p) c9 H7 B+ G
(HBOOT...) :-((  
" W! t5 Y" W8 n' N0 F8 p$ p; A+ ~
Here is a quick description:
4 e3 x4 j1 u" k0 Z3 ~' ?- S2 N-AX = 0910h   (Display string in SIce windows)
% m5 l. c; n, u, [: }; f3 H# u-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)$ B) D% w6 k& Y& i, C+ V( a2 C
-AX = 0912h   (Get breakpoint infos)
5 Z9 ]$ S! v6 }. A-AX = 0913h   (Set Sice breakpoints)
7 O5 d. b8 n% ]- Q  q5 v-AX = 0914h   (Remove SIce breakoints)
* d. [! H" f5 o# N* u; ]/ h" K, H+ y8 K& ~
Each time you'll meet this trick, you'll see:  C" R: k: T  o0 n+ v( f, n$ z" H
-SI = 4647h; R8 y+ ]/ ~, ?3 K* B4 d/ x5 `
-DI = 4A4Dh
0 p# t! U' ?! Q2 X! S: RWhich are the 'magic values' used by SoftIce.
$ ]1 R4 y5 c' b0 [2 R7 H$ o" E/ x* `& }For more informations, see "Ralf Brown Interrupt list" chapter int 03h.1 R' }, j* S  d, |- b9 i/ Q
& V8 u0 ~+ l# C
Here is one example from the file "Haspinst.exe" which is the dongle HASP
4 P. i6 Z2 G, G8 JEnvelope utility use to protect DOS applications:3 R- B/ v5 a# `3 P! _3 H- n1 x

, A! A' }/ f9 V# A! [; l& e' g: O) K1 a8 w' P) [' K0 Y
4C19:0095   MOV    AX,0911  ; execute command.
' I' i+ I  _4 @4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. H8 c& @' L% @: ]- ?( h4C19:009A   MOV    SI,4647  ; 1st magic value., U" Y% ?' t: Q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. v! K* W& V; |5 _4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- B5 l$ B, R) }6 h6 M* Z4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* T7 y- j# e0 }* A9 c7 E+ S
4C19:00A4   INC    CX
4 M& a( D" \8 C4 U: K; w) @) Q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- f3 c4 j' M8 a( w+ j& f1 f% C0 v
4C19:00A8   JB     0095     ; 6 different commands.
# g2 G$ {; d2 J: x; f4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 L. X8 k( x. o
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
. `- D' x' T7 x$ n* s2 U, ?; ^2 D& j/ }" Z" Q$ D: V1 W  c8 y4 p
The program will execute 6 different SIce commands located at ds:dx, which" E5 C, `! @9 d2 j# n
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.( ^  W7 j# W# h  }# n- s
* j* p( q7 R# g
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 H1 j* }3 |# }( Y# ?___________________________________________________________________________
! u% N* V7 p# `5 u5 l& `$ r/ C: [! Q# ]9 V7 I& x
7 j0 ]5 d5 o; v
Method 03
! }7 f7 `$ V3 `% L" a=========
0 n  Y4 I' D) ]& F) J( B$ ]5 ]6 Q
- D( ^: d. V5 p: N* lLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
- k" Q! J; V/ v& X& v& p(API Get entry point)
  h+ M: V5 K, d. e$ z5 Y" e        4 q' [' s+ L: ]( D# j
' X. {# c4 C" b4 Q$ [( M- }
    xor     di,di
5 N7 S% j2 M# t0 C: l    mov     es,di
5 }9 d9 e- H; L) B/ r4 q: O- {" }    mov     ax, 1684h      
. C) B6 v$ M: f- J9 [; L$ _5 v1 D6 t    mov     bx, 0202h       ; VxD ID of winice
2 h7 G# C( N; y/ J- `8 E9 n, l    int     2Fh" i  C* x1 U! T" f4 f( m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 _* ?+ K' R. U& p! f" G# l/ C! t    add     ax, di+ h6 K, Q* B& b' p" r5 J& c
    test    ax,ax# |8 d- j! i2 p2 }1 n0 G0 \8 m9 ~
    jnz     SoftICE_Detected
* U# E' i& f% E( ~( F$ d) m6 T$ f" Q' t* S$ G8 P% B2 O
___________________________________________________________________________# w4 z1 J; P, \2 _* q

& L7 t7 B( {% o" u2 tMethod 04
* f& K( q& [9 R=========
* }) U/ V% @: S5 `$ }1 E
; O2 D0 v  T" g- i. u$ KMethod identical to the preceding one except that it seeks the ID of SoftICE
+ K* F: t4 b6 K0 R* }9 E, PGFX VxD.
  O: B: u# K# b* E/ d( @2 |0 o( M6 I7 M( K; ~4 M  I& [
    xor     di,di2 o2 o9 m, A0 q* F
    mov     es,di) D. C5 n( ?6 x7 P4 a: |
    mov     ax, 1684h      
; t8 Y) p& A) H( Z. L9 a' t    mov     bx, 7a5Fh       ; VxD ID of SIWVID
: Z8 K7 a( }) X) v4 _1 z    int     2fh
' S" Q% T5 t- z! a5 P) U7 D    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, t1 J' Z6 h+ k1 c    add     ax, di2 G! Y6 d" Y# u6 ~: T+ M& E! n
    test    ax,ax
' e0 |8 U- G2 s$ R. t    jnz     SoftICE_Detected
# Y6 w4 x" B) m6 y; x' E0 e- f8 b
__________________________________________________________________________8 b2 I& G0 m( g% @  p/ O( o

& w- ]8 P* [# K* }6 A, r# i$ Q. X  W" {
Method 05
5 t2 @/ f/ f1 b1 J% C=========/ F3 P/ _1 p; ]2 W% b

+ a  D0 a; W  m  z4 Q" KMethod seeking the 'magic number' 0F386h returned (in ax) by all system- @7 D; l& U3 T7 R
debugger. It calls the int 41h, function 4Fh.; u& B& i6 x* ^9 z
There are several alternatives.  , c9 s! t* V0 p5 i- W- K6 o
' o( y8 X3 G$ t. `6 }: k
The following one is the simplest:
, ?: d' J8 e/ I
/ x- u0 s* s) Q0 ?. k. O    mov     ax,4fh
; z: j9 d( u! Y( B9 P6 n    int     41h
# W' v( P0 D' n, @3 J- X    cmp     ax, 0F386
# b, I5 V, i1 V6 E% Q0 h    jz      SoftICE_detected
+ c; y9 |7 s. w8 L
" ^" `( z  Q) f' W  d
/ N/ L+ I. e8 [3 ]* O; S& NNext method as well as the following one are 2 examples from Stone's
7 ?8 u4 ?. l# K"stn-wid.zip" (www.cracking.net):
: s7 m! v! ]! W; R( w* L% R. U1 s; C) x
    mov     bx, cs
' Q2 F$ h" g/ y6 w# K1 H2 k0 S2 y    lea     dx, int41handler2. `' g4 M: \. S- [5 ~* {
    xchg    dx, es:[41h*4]$ w* ~, {/ X5 K6 L: P* z
    xchg    bx, es:[41h*4+2]; c+ i- Y( ~* H2 P; W% y) ^( R* a5 Z
    mov     ax,4fh
3 @5 G# @- V( q" g1 A4 @6 M# k1 H    int     41h
4 M* |/ m4 t" j# D/ f; f( {5 B    xchg    dx, es:[41h*4]
! V1 E" P" i2 H; @+ Z+ I+ @, h1 n- K: y    xchg    bx, es:[41h*4+2]6 g+ e+ h4 P7 m% N
    cmp     ax, 0f386h% F6 ]  |% X/ K1 _
    jz      SoftICE_detected
7 G$ k* `) b4 {' p5 }3 D9 G0 u- `! W  z
int41handler2 PROC
) O- k- W& i4 P& _) l% O    iret
0 T. I) X; Y$ Z+ `: k+ L  o8 Bint41handler2 ENDP
$ Z* M5 l- p; y
- {1 `- u6 ?9 U
# ~4 O  o  U2 U, X" J/ Y_________________________________________________________________________
4 Y" @5 ?. e5 y, m2 ]) V" y; L2 s+ K& h' V$ c2 D0 T

( e2 F! S; z6 n. |Method 06
. b- q( }$ O; P$ L/ v2 U=========, J6 x/ L- ~0 P  u) i* t7 V' H6 Z

: x) h' K8 J7 Z! Y% K2 [1 c( s0 R  D0 W: I
2nd method similar to the preceding one but more difficult to detect:, d  X  p' c% P, c; R5 D& }( D
* @% s: y8 [; d* Y+ c& x5 P. a

7 {# y' u! w( {0 j) W9 kint41handler PROC
+ H0 C2 l6 n, T% a2 \% |    mov     cl,al
& y, {* _7 Z# w7 u: l    iret% o( o/ z7 N! M' m0 U
int41handler ENDP) ^8 V7 d( u6 L$ ^( u# @
5 f0 |$ m1 Z: n  y1 m
: j3 v9 o6 S, A' w
    xor     ax,ax+ J- B2 b, Z  ^. r
    mov     es,ax
& ]- ]4 c" x$ N) ?    mov     bx, cs
- A/ b; j1 z& V6 R* h, \5 s3 }$ `    lea     dx, int41handler, ~0 S5 F3 C' S4 F% k
    xchg    dx, es:[41h*4]& b) x$ ?% Y% E
    xchg    bx, es:[41h*4+2]
% f; V5 J# }* @1 p: z    in      al, 40h/ F, k- ~6 \1 l% g/ P
    xor     cx,cx! E: N5 F% G9 g# x4 `* [" i) f
    int     41h. k6 U1 O- T. Z* D$ u3 h/ i0 x
    xchg    dx, es:[41h*4]% R3 e, `9 ?* E$ j! i
    xchg    bx, es:[41h*4+2]
) |3 I! m/ I; d# m    cmp     cl,al
7 M+ ^. q- J+ P" K8 _0 ~# ]    jnz     SoftICE_detected
) V9 w( B9 L9 j
& s  @+ d3 N; x$ w( Q_________________________________________________________________________% ]. M0 b1 J& A" ?' q

" R* z. T0 _  a1 K1 O2 z+ ZMethod 07. B& x$ u, Y* g
=========" Z, W: r! A7 I0 d: P' ^
% U/ R% ^  k6 I
Method of detection of the WinICE handler in the int68h (V86)6 ~& B1 j3 l; }+ J0 E6 [* }

2 z9 y$ _5 A; O* _  [. ]4 ]    mov     ah,43h
$ ^, R6 I( T" ^0 j; |7 m' D    int     68h/ d/ ?+ F! o2 g' A
    cmp     ax,0F386h
9 _7 ~' b5 c3 U    jz      SoftICE_Detected
. k7 Z: u, e, M) K# s9 Q$ X* b2 U, p' F1 f
' @) T* a/ ~0 p+ E- Z4 |! j
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ }# W  u: E4 v% [  v   app like this:1 |! t& K, I" y  |$ m; x

# ]1 |, c6 H( Y, Y* c   BPX exec_int if ax==68
& m! n# }3 ?5 ]* L" Q+ M  s6 `   (function called is located at byte ptr [ebp+1Dh] and client eip is
: ]+ ~* p( D$ v, D1 i   located at [ebp+48h] for 32Bit apps)
$ i6 ?8 M- ?& w! R; ~__________________________________________________________________________
, l% B6 g9 j: Q: x" K
3 z% c; m8 k3 {& s6 Q7 p  a9 {! q, m% z
Method 08
  X$ R- F6 a$ O=========9 L& A: S9 s' q& S" J

, q/ W2 U  e" x7 L* R) eIt is not a method of detection of SoftICE but a possibility to crash the
: M3 f! }0 T9 F# V& c# t1 lsystem by intercepting int 01h and int 03h and redirecting them to another* r" S$ t7 e  |7 r
routine.; Y1 j5 o# {9 q1 t5 E* V0 M
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
! u! v1 R( D6 h9 tto the new routine to execute (hangs computer...)0 @3 C" [4 z0 a6 K. |9 p; ]: F$ W

. Q; e  C/ b1 D/ k& {) i6 x$ j    mov     ah, 25h% z8 ]: ?* f* l9 _% u
    mov     al, Int_Number (01h or 03h)1 v5 y/ F5 ?* J9 l' X- q) N
    mov     dx, offset New_Int_Routine
' q( \& N1 T: d) J    int     21h
9 t" F( s: |3 i( J( |/ z8 L+ k* \4 w6 q6 j2 n
__________________________________________________________________________
. I9 ~  F) O4 W5 O5 q3 X4 k+ ?' `* J6 r+ F/ Q3 f6 V6 K7 _8 D8 {
Method 09
0 T% Q: S7 ^) N. ^8 \! ~=========* }7 H* [) s% l; h8 {

( t9 {' N& S# A, G, ~This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
3 U$ k2 G8 e2 eperformed in ring0 (VxD or a ring3 app using the VxdCall).2 n1 o# k+ k/ E/ {
The Get_DDB service is used to determine whether or not a VxD is installed
- z: K3 ]7 ~: Q' K/ I2 F2 nfor the specified device and returns a Device Description Block (in ecx) for
. G; F3 S) x7 M8 N( [  W1 Kthat device if it is installed.0 w1 e  g- z( z+ I/ q
8 y* q0 |/ M0 X& f& X
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 z' A8 T0 k- E! F8 M   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), _8 K) [2 _/ G: |% v: h2 r1 E
   VMMCall Get_DDB# w  }! m, A# I  @$ [4 V
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: p' d. k9 Z2 `+ L+ a) W: [# Y
2 A* v! J4 B1 ^Note as well that you can easily detect this method with SoftICE:7 K  X4 P: `/ _' t
   bpx Get_DDB if ax==0202 || ax==7a5fh
8 j/ w7 ]9 ~& Z! w
9 A( I1 p& k, g__________________________________________________________________________
  o6 B% ?- A( C8 m) |4 H) {5 ^5 p* r6 r/ b- [& ~$ U) X) ~
Method 10
' h2 A! z3 A1 |9 C5 i* L2 U1 F! j=========
0 [/ F6 i* _0 M8 C+ @+ Z% o% P# z6 y( L- G, V  O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 p# Z! r3 g9 j" j" e
  SoftICE while the option is enable!!
4 f& p0 g  |' L: ~% I* c2 ?' _2 ~. Y5 X  u5 F7 M  A# o: F
This trick is very efficient:' t2 x5 a, J$ ?1 f
by checking the Debug Registers, you can detect if SoftICE is loaded
+ Q+ _/ ?' b" Z& A4 A(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 f8 Y6 s# s$ K+ u' P' K" X* W+ i
there are some memory breakpoints set (dr0 to dr3) simply by reading their4 L: I$ F5 h8 G! d
value (in ring0 only). Values can be manipulated and or changed as well
/ z, @. w, g! f) Z+ ?(clearing BPMs for instance)4 b& p0 E) r2 X; Z4 R

( ]; Z! B- T2 N3 P0 K__________________________________________________________________________( v2 E% A6 @; p- E4 w! N* P2 K. }8 J
5 f5 d& J; f! R# y: C
Method 11. D1 o+ \" p! t% v
=========
* o! F3 S$ X. k. t* J# ^  A+ A; c) M% s. c$ L
This method is most known as 'MeltICE' because it has been freely distributed: T( U' [; S1 v& |8 O  O& S" V1 c8 N
via www.winfiles.com. However it was first used by NuMega people to allow
) B; J& g2 m% h7 P; y* K8 HSymbol Loader to check if SoftICE was active or not (the code is located
  R; R1 F3 l, Z& q. g- \: K8 ^4 uinside nmtrans.dll).$ v" W2 ?9 d" p8 |) f( E: \( p1 l7 X. x

1 H7 O; E) w# a  `4 a, P: |5 VThe way it works is very simple:5 q8 n& k% _4 L2 @6 ?1 o5 e
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& s& q7 E5 @8 _5 g& \/ h5 GWinNT) with the CreateFileA API.: l% d: P1 Y/ ]" u4 r* X& Y
3 t2 _" ~9 v% i" `5 Z
Here is a sample (checking for 'SICE'):- V3 Q2 @6 A" C+ M; f8 M- T+ v

4 [1 X, A) t$ ~1 _" j* Q5 p2 tBOOL IsSoftIce95Loaded()0 I/ [! {1 x$ a/ ^9 c
{# q  H3 C4 G/ h$ n, C
   HANDLE hFile;  # L8 I# J, x' i
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ A! X9 \/ W7 b$ Y- t                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! d- \8 c$ n9 _, y+ T/ Q& V                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' K* T: e# p  J* P   if( hFile != INVALID_HANDLE_VALUE )
: g" @! S# R( v! t( [3 F6 m0 |   {/ L( A; |% O9 q* i5 r
      CloseHandle(hFile);
& }0 p! Q0 ^/ e% P9 V9 X9 ^      return TRUE;
7 J6 Z+ B9 B! Q+ p   }, Q/ Y& @' M* C' P, y- V" `
   return FALSE;
, _: y! D& e$ x}. \- x$ w. G5 z! T6 G. T* p

  B% Y2 M3 Z) ?2 J! HAlthough this trick calls the CreateFileA function, don't even expect to be
7 ]$ e1 M) o" W9 u' F5 Q4 X5 Xable to intercept it by installing a IFS hook: it will not work, no way!
) S( h0 \+ f4 `4 ^1 D* g' gIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
' L- C& u  p8 d. a# G  \. m& L- cservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) l) A5 ]. z' y" ^# J" |; r  @% `
and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 C9 l, v) a% D# v
field." p& u0 Z" ]: e, W2 a
In fact, its purpose is not to load/unload VxDs but only to send a ! x% c9 e' [% D- t
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( W# H  ^5 P6 S' Z" V* h3 \4 ato the VxD Control_Dispatch proc (how the hell a shareware soft could try8 E. Q) O) q- p% f' i. w
to load/unload a non-dynamically loadable driver such as SoftICE ;-)." F9 i+ r( o7 @8 @4 R
If the VxD is loaded, it will always clear eax and the Carry flag to allow
. G( B; z7 C' hits handle to be opened and then, will be detected." R- m* I* L. ]& X; o! U0 p
You can check that simply by hooking Winice.exe control proc entry point
7 `1 Z; s7 n% A) E+ c( Owhile running MeltICE.
; @0 q1 g4 i' R1 ?8 h/ Q" s+ h3 Q! j  }( v. b% F
, |: U- h  a5 {; ], h. e
  00401067:  push      00402025    ; \\.\SICE& [( E* a3 B2 x+ L" p5 t
  0040106C:  call      CreateFileA
% f& }) ~* \$ L/ g  00401071:  cmp       eax,-001
  h3 [, T1 y/ t5 e% |  00401074:  je        00401091
) g9 b* L* g% u6 I/ c! n# N; ], J. l6 j9 G* \* c
3 k; s6 ^4 K6 o0 z4 C  b% n) `- s
There could be hundreds of BPX you could use to detect this trick.
9 q1 [& T/ I6 p8 z3 i3 N-The most classical one is:- D$ U$ F3 ?# K; x$ V/ |! w
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
& f5 q. [( {& b  J! C/ r4 h    *(esp-&gt;4+4)=='NTIC'
! }. ]! v0 F) S  r6 i! ?7 w% T
( z; ], c- M' c2 t' @" M( Q3 I# h-The most exotic ones (could be very slooooow :-(" L5 F* m0 m0 I  J$ R+ A
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! {2 ?* a2 @. V     ;will break 3 times :-(
3 O3 ^* N; P6 l& x
  a+ q+ F. G- \$ s3 t0 x/ U. [1 n1 C: O-or (a bit) faster: 7 u3 u, N* x& ]! B5 ]
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) Q1 N! G! L( `0 F+ G. z8 w+ t/ a# f+ q1 O: C7 c# x
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # z0 n8 m2 t) ^) z3 h+ @4 m( R
     ;will break 3 times :-(
$ Q+ d; F3 ~$ v/ y$ B+ L4 L3 H) z% F3 K8 _1 S5 z6 t! S8 S3 x
-Much faster:  ]1 j) U3 p, Q* }
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
6 ~' H% u1 }: K% o1 ?5 Z! ?* b
4 X5 x4 l4 X0 {, RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
7 }, K- r# ]1 v1 zfunction to do the same job:
' q1 P  T& ^5 d& P# O' B8 q, E3 s8 h8 c( o* e9 S
   push    00                        ; OF_READ
0 w. J9 }9 m3 Z+ ~   mov     eax,[00656634]            ; '\\.\SICE',0
2 Y+ B- ^* w+ A. i5 o, V   push    eax
- _9 O/ B0 w4 H. R6 l   call    KERNEL32!_lopen& e) h! X$ D# R2 M
   inc     eax
- `+ u6 M& i4 L1 n   jnz     00650589                  ; detected
% V/ ~. g1 O1 i* r8 ]! j7 E   push    00                        ; OF_READ; u; _8 H) b5 _: e' i- O; Y
   mov     eax,[00656638]            ; '\\.\SICE'  d  n# ?. ]: |
   push    eax# B* G5 L1 [; T
   call    KERNEL32!_lopen* y% {# D/ h* r% {
   inc     eax6 K8 L3 H1 f- R$ e$ _
   jz      006505ae                  ; not detected
) H& a4 }6 `& B
" n6 S7 m- _8 W% a& f/ c6 Z- @, x$ h6 v
__________________________________________________________________________
- h0 J* Z, J# o' x( U
# R0 D3 v4 A2 \" XMethod 124 Y" B: @  @. f
=========, r6 t. ^6 }) B: y& F) C! w
! W: K1 u6 T, h0 `) C
This trick is similar to int41h/4fh Debugger installation check (code 05+ Q6 h4 v/ n' i1 P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
* k& l# b% H" nas it uses the VxDCall backdoor. This detection was found in Bleem Demo.' R; W/ f( W7 q4 O" ?* h

' e1 R3 r0 P- B4 b: s   push  0000004fh         ; function 4fh* J# D! P9 _0 b
   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 O1 n- O0 C: @; b9 @. w8 O                           ; low word specifies which service
1 _& l. N9 a: I& J9 n8 l$ x  M                             (VWIN32_Int41Dispatch)
7 l- X% k% a; R/ ]+ I   call  Kernel32!ORD_001  ; VxdCall7 F7 e% N, C3 [
   cmp   ax, 0f386h        ; magic number returned by system debuggers
8 G/ t( K% F( m( D* o! t   jz    SoftICE_detected- Z8 D" x, }  i8 A3 F& E
, b; r4 I. [3 s3 ^; y" V
Here again, several ways to detect it:2 H' K8 s# u$ p5 D

/ O- O) A" r+ a7 {  e  k    BPINT 41 if ax==4f- V' {7 C4 m7 R& a

" B5 L# k# |9 p) H8 j! h4 z, l    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 a/ c4 {4 E8 R
- o7 f. B  c4 G: w* A( ]+ B4 P. Z7 f
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; \5 t$ [* p# i# P2 w' S4 M8 M
1 `- e. `% L$ h* p
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, f2 Z6 f/ J2 ~" u) X/ j

: ^2 [" j+ z7 j) M__________________________________________________________________________/ O5 c, D5 ?( d" z& d: w
# Z; T1 |3 {3 J/ Y3 U# u
Method 13% Y! ^7 y* p9 L* m4 U7 a5 U! z
=========
. H+ f) k% w4 S- p+ V- j& j8 j
& m4 x; Z9 H* t* d5 QNot a real method of detection, but a good way to know if SoftICE is
1 `$ W- e" q6 D& M. P* sinstalled on a computer and to locate its installation directory.
, n: d, r; F/ \% M6 ZIt is used by few softs which access the following registry keys (usually #2) :
8 @2 W8 `4 ?+ v. r* P. _9 x. _, {3 y/ u, m0 M
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! o; @7 N' v) y* K' l* F# T9 o4 ^\Uninstall\SoftICE
% u4 g1 U# l  U( M: {( |' E-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 N7 ~8 }8 O. D  K- @
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# X" {, v, O, c4 o6 B$ F2 \\App Paths\Loader32.Exe" X3 j, z/ u7 }6 F7 Y: U* o

  ~: [0 T$ J9 x4 r( y$ n3 ^% u6 n( o& I) [0 ]/ k1 G7 r. i& h
Note that some nasty apps could then erase all files from SoftICE directory
+ H  t- G- _5 U/ Q) c(I faced that once :-(
& _* B  ^4 Z- p3 a) y6 ]3 g  ?! O- l& E- F* t0 R6 A
Useful breakpoint to detect it:0 T# @: D$ _& W/ s( e; `; x" I  b% X  f
9 C+ [  f" |" k0 X3 r
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' G6 n7 e# L5 U  r3 V/ [3 @! _. s3 e& n! D$ g+ c! G( V/ n* {" K8 P
__________________________________________________________________________' D1 d! X# g  D; X* h+ l; n

9 t- B( d- Q- ~" o7 l5 J
6 B( k: q; F1 K, K" qMethod 14 ( W1 Q2 t5 x/ P" [
=========
7 O, D& b9 z7 l1 x3 t" G9 p* H6 d
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% G; J' N, |" I: nis to determines whether a debugger is running on your system (ring0 only).
# g& a; w3 I1 J* R5 B1 v% C* o  z9 Q# i; h: h
   VMMCall Test_Debug_Installed6 r" S$ N  l" J( U0 b! V
   je      not_installed0 O1 c0 @: u8 X# R  W7 S
- ~! q. b! V: ^: K/ L+ C
This service just checks a flag.2 ^% {. E. o0 Q) @! l
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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