About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" |/ p- V+ F2 `: L8 j! X' F' G1 ^
<TBODY>
, d( Z4 U( J) ~4 L<TR>6 K  {: y' l/ g4 }* X7 k
<TD><PRE>Method 01
3 p& e$ Q' u2 t" a=========
# |2 p8 {' F" P+ F- d
  C, a1 W6 U( K+ a6 N! D+ K" kThis method of detection of SoftICE (as well as the following one) is
' g$ ?) p0 E) K% B5 M- t& bused by the majority of packers/encryptors found on Internet.
9 ?2 G/ \- I6 X- `! dIt seeks the signature of BoundsChecker in SoftICE  N$ E. E2 I0 Z& P) A2 e

2 L, a0 a( a8 Z5 y+ O    mov     ebp, 04243484Bh        ; 'BCHK'7 {7 B& Y* n, C# {3 r7 a
    mov     ax, 04h! x4 J: f" _  S0 f1 k. m2 K: H: T
    int     3      
1 A1 J3 j/ O* H% ~: [    cmp     al,4
7 b6 o, w5 `- E( C  l2 k    jnz     SoftICE_Detected
% O5 e1 p, E! [
% a2 v; }9 `5 s7 r/ y___________________________________________________________________________) l' ^( r: M; t
; X: Q6 N0 }, q
Method 02  j$ ]7 o6 E  j' Q! B( s
=========
/ J* M3 r! f( ]3 ?: ]' G: Z, \1 d# T6 e1 h( q* I
Still a method very much used (perhaps the most frequent one).  It is used7 \  I/ g; @/ C. Y, }3 z: X8 g
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 e; B9 N1 q* V4 U1 h/ y6 S; Mor execute SoftICE commands...
8 k+ t0 q$ K- q1 PIt is also used to crash SoftICE and to force it to execute any commands
# G4 `& x# D: y3 R- j9 z(HBOOT...) :-((  
+ l" O% u3 j  ^; [
+ m5 n. i3 @& Q' oHere is a quick description:+ M! M) U  n# q' Q. Z6 w$ M
-AX = 0910h   (Display string in SIce windows)0 Q0 a, f8 ?0 C7 j: w# O' D
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ H: M5 g( ~7 ^-AX = 0912h   (Get breakpoint infos)7 T5 F7 s6 K4 D* _* a' s8 S8 w- _
-AX = 0913h   (Set Sice breakpoints)
  p* m* E8 x& w5 G$ @-AX = 0914h   (Remove SIce breakoints)7 b4 S2 Q, a% [" S

' s( H. V4 \, N- tEach time you'll meet this trick, you'll see:
9 A; |9 A0 b* E" e' q-SI = 4647h
9 W6 u& P1 c9 f; m: ~% M-DI = 4A4Dh2 n" h6 u; Z/ M
Which are the 'magic values' used by SoftIce.
1 l- ]. [9 S0 _# k( v# BFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.: d& ~* ?' Q& X+ J
! d, c7 a4 b1 w# M3 h
Here is one example from the file "Haspinst.exe" which is the dongle HASP- x2 k5 o) l+ P6 B4 X3 y
Envelope utility use to protect DOS applications:$ l( @. I* U9 v! A% J
& T% Y/ E4 B& R3 k: h1 e
/ g/ d4 G# S) B  u1 u6 Y% ?
4C19:0095   MOV    AX,0911  ; execute command.3 }4 ~! I2 \0 i0 T7 u
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* I  a9 f! m9 s1 m0 N, x+ F4C19:009A   MOV    SI,4647  ; 1st magic value.: h# `, J! O( |/ y, w3 i: s
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! h5 H! p2 O( b# ~# R) S4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 A3 |" ^' X# w' M& C7 o5 s& ~( d: u4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, a$ ]+ Q: c7 ?. ~# L1 H5 f4C19:00A4   INC    CX
7 c5 J7 Q. U! D1 w7 g: G4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( |) Y5 y, P& n* A/ S, g4C19:00A8   JB     0095     ; 6 different commands.
  O5 ]$ p$ z; c8 S/ s" i4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% h/ c; a7 W4 Q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ z( B4 h, j8 v+ e! V9 q

* u8 X& j% V1 u0 U4 \The program will execute 6 different SIce commands located at ds:dx, which/ [+ E) _. p! Z. d+ s. Y# K  G- T" ^
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 D9 o/ @  ~8 I1 N/ L, ]( q, a
5 J5 m6 [+ k' f( v7 E$ u4 \0 Q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.& g, l9 @3 t8 T3 I3 u1 ~
___________________________________________________________________________
, t! a: [9 z; C3 t
' I7 F* V: d: s
8 V' K" O( ^6 C/ D' [3 W( T) dMethod 03
' z( w( }, P8 X, j! S=========7 U5 x( Y% Z5 r7 h! l
! ^% C3 l) T9 \3 E) \
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: ^9 l. Y1 ~. \1 b(API Get entry point), f# i9 K! g7 N  I5 M
        
/ A: ~& A- @9 W' L  X
9 R! f7 q+ M0 N/ U, m& [* z, C    xor     di,di
, ]" c% ^8 l4 g2 h, _; t    mov     es,di! j" X9 C3 X' |' l& a0 G4 C
    mov     ax, 1684h       ; Y5 w# M4 @# _2 B- |7 W. j0 A4 r
    mov     bx, 0202h       ; VxD ID of winice0 h, ?5 x% _' W- B0 w* S+ K
    int     2Fh. ~: }. h; @0 I1 K/ j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 N- ^' y) e2 G1 B+ ~; ~3 ^! p4 T
    add     ax, di
" d, [3 V% Q* s4 ?: n5 @    test    ax,ax
4 R6 [9 o( g/ F  i    jnz     SoftICE_Detected9 r& F9 F9 W2 o/ O9 l3 _6 H

) Y. F- J1 K: v- h" O9 y___________________________________________________________________________
9 W7 v3 ]# x4 g$ G' I
( b$ t! H$ @7 @) p7 P6 sMethod 04( S' w& L( O, S; W
=========/ N9 S, i; q% j! R

" c" y; W) @' o2 ~$ R; }7 Y' i: QMethod identical to the preceding one except that it seeks the ID of SoftICE+ J: l2 V+ L8 D# e, Q  o
GFX VxD.
! [6 R6 F1 Y7 M1 _+ t$ C' j- O7 ^! k/ @. C7 i) K, `& N- ~2 h
    xor     di,di
" p* \: g0 R# Q+ m( D! t) u. J4 P) E    mov     es,di
) v+ W7 M2 m! p) ?' r& q0 \    mov     ax, 1684h      
$ P7 |1 R3 Q8 X" }    mov     bx, 7a5Fh       ; VxD ID of SIWVID3 D" K# Q: ?! y, V) e$ c- d
    int     2fh
9 [! ^/ C7 P2 _; D# h+ ]6 k+ B    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 P4 E+ L3 f2 p7 n$ w2 s- Y6 v
    add     ax, di
) j: R+ e' K7 d3 p( w    test    ax,ax
, X/ ~$ D: W! M& k) S* N    jnz     SoftICE_Detected
9 E" m/ I$ E% s: P! V; i4 x$ _
, _$ u7 @* ], [+ n__________________________________________________________________________3 D9 N; A: X. b  w: W
4 M/ m) K, w! o2 ]" V7 v/ O

6 c# _8 ?  i* {; t% w( ]# ?5 lMethod 058 N  ~$ {( l+ Y! f2 O
=========- I# a7 N8 _: m
9 t3 l8 y9 p2 p- N$ f6 k" P
Method seeking the 'magic number' 0F386h returned (in ax) by all system" A! f' \" g( z% U4 O- N
debugger. It calls the int 41h, function 4Fh.' [  G: d$ g( \  Z4 }& Y  o8 B% h" t# m
There are several alternatives.  & b* v/ D6 z9 C: d8 S
1 w1 f; {( ]4 D- m
The following one is the simplest:
& r4 S- P3 `# }( O0 K$ o+ H  k, K' i$ ]* t2 y
    mov     ax,4fh
( m8 K; U) i- i" P; ?2 Z    int     41h3 I- Z7 u5 |* x
    cmp     ax, 0F3866 j6 @6 {  ~) y8 D& x5 a" F
    jz      SoftICE_detected% L3 w: X) k. O- l2 j! w
' J: L$ O9 X0 }/ ^
& ~' x" Q1 A2 ~: x! v& _9 J
Next method as well as the following one are 2 examples from Stone's
* h( d* a% `0 v1 k& k6 @+ `"stn-wid.zip" (www.cracking.net):# f. K; j. `" B, Z0 J

! D4 e  H* u' Z2 u  m2 p    mov     bx, cs( I* j) Y2 k, J& ~( O! @# o7 Q6 Q
    lea     dx, int41handler2
3 ?& E+ ^, s) d  g& n) c  T    xchg    dx, es:[41h*4]4 X2 u6 x, H7 i2 V. _6 x
    xchg    bx, es:[41h*4+2]
8 ?( Y1 ?2 Y' p& j* d1 z( Z( A    mov     ax,4fh6 L1 e$ Q. ]1 E: U, I( [: ]
    int     41h5 R0 Q- r* l' a8 |7 k1 e- `% E# o
    xchg    dx, es:[41h*4]" ]& e: {5 U: U3 _9 B# ]6 y+ ?
    xchg    bx, es:[41h*4+2]
) z  `. ?# Q* Y7 _- Y) z$ ^/ g    cmp     ax, 0f386h. Z2 l1 ?* l% _' d( Y3 B4 C
    jz      SoftICE_detected
; t( ?9 Z: F, F+ X$ l. I# s0 t& P; ?  }9 y
int41handler2 PROC
* @+ |4 y9 M5 @0 M. `, t    iret5 }% i( l; _- c& [+ u# K
int41handler2 ENDP
6 ^" k, ]2 i' n% }$ w0 r! Y7 [
8 r$ D; I8 R: p7 ?9 O( p* g; L1 Y
/ x1 N1 Z* R# d- \8 ]% Q_________________________________________________________________________! C5 G  k' R, f# `( l

. ?, z# a  I3 g0 ]. V) [$ H! f+ h& b6 R- a* P
Method 069 y2 i& O3 K- e7 k7 w
=========
# Y  M/ E$ l' d1 Y  a& o1 V% P/ B- `0 V2 m
! k" W0 C3 x1 O4 k( g
2nd method similar to the preceding one but more difficult to detect:
) w# r/ ?5 y" A, y1 ^0 Q" f; R  d8 }7 Y* D

9 \0 e9 `3 O- o0 C" X3 K- }int41handler PROC6 _$ i9 I5 ?( j5 s- {
    mov     cl,al
2 H4 x/ ]% d8 O* k  w    iret  [' G) B7 @# ^  o- l7 Q1 Q
int41handler ENDP) b; S, v$ T2 ^# Q. l8 r. q% w
& R' V) \. I" p6 x/ a; P

& U6 W  ?( {- f& G+ l& w* ?    xor     ax,ax3 ~: ?: F# r, {% w) v
    mov     es,ax
0 u) l7 ?1 x6 X2 i0 H    mov     bx, cs9 x% }0 ~: v4 v
    lea     dx, int41handler
8 k7 m# q; u* s; g2 R    xchg    dx, es:[41h*4]
; A, g0 C5 |3 b$ O    xchg    bx, es:[41h*4+2]
& X5 o% x) A, Y" F( T    in      al, 40h( E5 z/ O% F' T- B1 J
    xor     cx,cx
& s; C" W' v1 K2 ]& p/ S    int     41h
5 c* L* m% c- N2 A# P% M; E& U7 J    xchg    dx, es:[41h*4], j! e6 D) W3 z7 L0 w% s# ]' |* X" q
    xchg    bx, es:[41h*4+2]
3 }% v/ D: ^% |6 O7 R    cmp     cl,al1 [. a$ B: F) u1 H
    jnz     SoftICE_detected' O' Y& d3 M. x) t- B" O  W4 X0 C' y
7 X% z. G. `( L! M) T
_________________________________________________________________________' V# q; \  v9 g

/ z+ A% Q, Q5 s1 O% l! _9 i) w  @Method 074 v& D0 j9 ~- p( y1 [
=========
2 w; c! x6 Y2 F# s% p3 I5 s; f- z0 c* C% W; r
Method of detection of the WinICE handler in the int68h (V86)
) D7 J( p' N2 Z
* x8 Y0 `: H8 I    mov     ah,43h/ r8 B# U4 M2 f3 I# o
    int     68h. ?8 A/ Z" v- J! `! E; j
    cmp     ax,0F386h
# x/ c( Q0 L/ j, L4 a    jz      SoftICE_Detected; u4 I& T6 q3 A3 ~- C1 n+ }
7 P' g2 J( k2 @- j: }; v
! I3 ]" W5 L. d+ _
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
% @& s6 _- }7 `" ^- ~5 Z   app like this:
9 ~! t# `6 K, k/ a. ]( x* v4 Q- B, |  G  S5 T: s+ i
   BPX exec_int if ax==683 U# g6 B. D" Z- c/ H
   (function called is located at byte ptr [ebp+1Dh] and client eip is
' O- I% W  Q$ ~) [- r   located at [ebp+48h] for 32Bit apps): _( B- A. H4 e/ q
__________________________________________________________________________
, }9 G7 }  P% v1 ^- n3 q. J1 G9 F4 M9 Q, P
: ~: w0 w0 a/ v  a3 w# s: \
Method 08: ~! |/ L3 b/ X+ w( z: E
=========
' u/ ]* z1 M9 j5 M; H% S7 k4 e( t; i) H  w
It is not a method of detection of SoftICE but a possibility to crash the9 R* \3 V$ j0 r5 t1 U
system by intercepting int 01h and int 03h and redirecting them to another$ c1 W1 g4 g7 _) ]' m( U
routine." F% p$ Q" _# ~2 P2 \  H2 k( d1 Y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- T! _  {# ~3 M0 T0 Bto the new routine to execute (hangs computer...)
9 n/ b+ B# f! O4 k: L. F$ c4 W8 P- r  ]6 o8 a; N" b! d
    mov     ah, 25h- }' a2 l% U. ^9 m
    mov     al, Int_Number (01h or 03h)1 B* h: L4 [* Q% P) k
    mov     dx, offset New_Int_Routine
  [. ~2 u0 n* B1 ]1 p3 |8 V    int     21h' S( `  R+ y( p9 w, L; h( U3 x# i

& j. H0 E) i6 I7 f__________________________________________________________________________6 x+ @8 z0 p' W& n
/ B% K) \, x4 P; {7 n6 B
Method 09
$ U. N$ S( {4 n7 l: S4 x=========
8 B) @# b5 E2 m
. a! y% o; Q' I2 u3 b: qThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
3 F( w! S: h0 f$ Y" tperformed in ring0 (VxD or a ring3 app using the VxdCall).
( S# |5 I1 T7 p  U4 \3 cThe Get_DDB service is used to determine whether or not a VxD is installed
6 j* y, F! ]5 c- F9 G+ m* O* x% xfor the specified device and returns a Device Description Block (in ecx) for
1 X0 ?" B/ o- j& vthat device if it is installed.
  N" t4 E% l8 Y  C6 X
0 u9 F; E+ h+ _% w   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# J9 l* f9 q6 }0 g5 c
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 E; J" j) y8 i/ C* j0 r6 ], m8 w
   VMMCall Get_DDB9 Y; v+ \! ]& x" V' g
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
3 k+ D/ {) `9 v7 h( [& C& v$ T/ ~) K7 i
Note as well that you can easily detect this method with SoftICE:% }. \4 ?6 \( Q+ [( W" D
   bpx Get_DDB if ax==0202 || ax==7a5fh
, S6 b/ Y& f3 @& k
; y  l" V/ ~8 Q__________________________________________________________________________
$ ?9 V$ {, d, H7 f! e
, D( I% X0 s# X' @Method 10
, c% z# ]: ]; r# E- O9 o, R=========
9 i( t5 ]. e6 I* m" }( P  M" F& k+ ~$ a4 i  c* b7 {
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ Q8 E; n2 y  B! }9 d9 o) x4 r
  SoftICE while the option is enable!!. x/ a% p8 o# C* ?' b3 U* V+ d' [: g

( L8 o3 q6 ?% C( AThis trick is very efficient:
: e# c& t/ g$ X1 T% Pby checking the Debug Registers, you can detect if SoftICE is loaded. i5 P7 G' k$ K! Q5 ]
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if% t" r. Z0 ]' l8 \# R8 v0 v
there are some memory breakpoints set (dr0 to dr3) simply by reading their
% j0 w( P( o4 r. ovalue (in ring0 only). Values can be manipulated and or changed as well, u) b% Y1 \& c+ R- U
(clearing BPMs for instance)
4 F* p. q" C7 S4 O! a6 b
& t0 B/ L& p0 q' q__________________________________________________________________________
) h2 }( A( P2 v  R5 n, t! w! }
; i% G3 `! M7 F0 w" ^  J1 _. _5 jMethod 11
' M( R% Q: t- [, g1 C" v2 {4 f9 X=========4 W- t* V& i# A, B+ p

- P! O% X4 ^2 `/ N0 j3 EThis method is most known as 'MeltICE' because it has been freely distributed; P  o) k5 w* M9 f3 S1 V. K
via www.winfiles.com. However it was first used by NuMega people to allow
5 M) [9 V8 F3 r  }' q5 x0 C+ WSymbol Loader to check if SoftICE was active or not (the code is located" p" f4 G! `( g
inside nmtrans.dll).
2 v; I: z/ y& M" I5 Y; W$ X/ |- x% \- I: ]. Y+ g* ]& j! F% G( Z+ G
The way it works is very simple:' f- Z# w' d" Y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 n$ \1 y% p' a$ n3 i3 A: s1 [! f
WinNT) with the CreateFileA API.
1 x& y) F- h+ ?: M1 k2 P' a
& F, y0 Q( v5 i' s& G# V! l6 CHere is a sample (checking for 'SICE'):
4 R3 X2 a) F2 q3 a: ]5 ]8 b7 d
9 l' L2 @, y# y$ d( H1 j7 h; }BOOL IsSoftIce95Loaded()5 ~; L0 y% c0 g
{
; Y, R0 s1 T6 ]3 b( ~   HANDLE hFile;  / B7 q5 G$ Z2 D, B' O9 S
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! [0 ]. }" ]3 m2 Z; d                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  l9 Y% A$ G2 {4 A8 P) `! b3 {                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- F3 v" G7 \' l$ C  Q5 ?/ A   if( hFile != INVALID_HANDLE_VALUE )
, `3 h( `( H2 i6 L/ L   {" Z* @- q& J  q$ C" r7 D
      CloseHandle(hFile);+ [- E! K; n" c6 d, E; M
      return TRUE;! M  A8 I# O) L& `1 X/ m
   }" ^' W2 r. \8 h9 E0 d' f
   return FALSE;
8 p% u4 N1 k7 U/ @& [- ~2 U}' s9 F7 x6 _+ L: {* P: @6 \

- l9 M" J( y; eAlthough this trick calls the CreateFileA function, don't even expect to be7 Q( L% l! k# p2 y1 b
able to intercept it by installing a IFS hook: it will not work, no way!
1 S5 c. V5 i- w  lIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
* W$ s" y# ]/ f: `: _% J% \$ mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' ]4 D4 U" J" A2 u/ f8 V
and then browse the DDB list until it find the VxD and its DDB_Control_Proc+ l( s' ~$ }9 s5 Z
field.0 c6 F. s# B4 f1 |0 M; N
In fact, its purpose is not to load/unload VxDs but only to send a
/ t- R- l, p& J% ]W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 _0 X+ D, g% Y3 u) ^& Tto the VxD Control_Dispatch proc (how the hell a shareware soft could try5 E4 e" V$ J; B
to load/unload a non-dynamically loadable driver such as SoftICE ;-)." f+ P6 y, J8 l. e9 n: T( R$ b# W
If the VxD is loaded, it will always clear eax and the Carry flag to allow. z* [1 F6 o7 E3 u
its handle to be opened and then, will be detected.8 u- ?! I' \# Z; g$ H. k
You can check that simply by hooking Winice.exe control proc entry point4 a8 k/ a  X% p: [) G$ `1 O  |
while running MeltICE.. f% g) d! x  a5 V! X9 x2 w
7 }% V) T1 ]0 D( o: V' S" [
& X! j5 X5 F' M* n
  00401067:  push      00402025    ; \\.\SICE2 K  I5 f+ O; y% ~
  0040106C:  call      CreateFileA6 v+ C6 G3 q( V+ o. s
  00401071:  cmp       eax,-001) z* P, [: o2 v, v
  00401074:  je        00401091
- \$ X3 s' I4 X( o, F3 y8 ~- z: s; c6 u7 H" a) \

' ]( X7 K( O7 Y/ BThere could be hundreds of BPX you could use to detect this trick.' A. G( Z+ l* s) S8 a7 D7 E
-The most classical one is:
; z8 |& J; m. Q, x) o0 @+ A  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
' `$ q; w( w( a5 g3 \8 G    *(esp-&gt;4+4)=='NTIC'
" h# q& p$ X0 s6 w. `0 Y2 C/ O. y# l8 t
-The most exotic ones (could be very slooooow :-(
6 r4 c7 U/ v1 M5 M7 _+ x5 n   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
: ?2 ^+ v& u- }: h" A1 ?6 U     ;will break 3 times :-(
; g# R0 a& b9 o" L* {; A, G. M- @# I1 \! W
-or (a bit) faster:
# g, C5 A+ G# ?   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). W8 f" P- G. z
% G; n" |( Y5 ^$ X
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( {* k  t" }4 ^& u
     ;will break 3 times :-(0 m0 K8 r2 N7 x! P
* E, h. S( U1 [8 c8 B2 g5 e
-Much faster:
1 S( G' N+ k, g2 H. U$ ~   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; g6 L' m* b0 \- k
7 A6 i7 V- U( ]# nNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
8 p2 Q' \% d2 y0 N. Ofunction to do the same job:2 V4 W. _& t0 K

( I7 ^* C$ S) ^  d# B7 e5 Z   push    00                        ; OF_READ0 B+ x) u8 Q+ x5 q
   mov     eax,[00656634]            ; '\\.\SICE',0
+ d" R! s$ ~6 d  H+ H5 @   push    eax' ]3 \# g) A% R! U, L4 b
   call    KERNEL32!_lopen
* `. U0 j/ I, t& w8 m   inc     eax  v( ?" [# T# v- m( r4 r
   jnz     00650589                  ; detected. p/ T3 z- I; x+ l' w; o8 P, ]+ i
   push    00                        ; OF_READ
. Y; h3 `% ]9 T4 d   mov     eax,[00656638]            ; '\\.\SICE'
# `6 r8 m& y3 P   push    eax
8 I: k5 {& R7 F$ x2 T, S" p# e- R   call    KERNEL32!_lopen
3 w8 V1 u& m1 H( P, A: `   inc     eax. x5 r# J1 }. u6 T6 Q; [9 A
   jz      006505ae                  ; not detected6 C8 b1 B& b2 ^4 @" Y
0 W0 g; ?0 }( I4 a/ B

; \- Y  a0 q! X7 j9 ~$ N__________________________________________________________________________7 c5 U/ @' \. j# K# K

+ g% H( k& c4 w$ p% C4 K5 RMethod 12
  S! x6 ~; s* _0 V% |=========3 w7 X$ C) D8 t" r5 R7 r
/ K6 e' j; U: g* o: Y, O
This trick is similar to int41h/4fh Debugger installation check (code 05
6 n4 F$ Z0 [# U, _&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% v3 I' G1 {$ s5 xas it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ B9 S; z4 V. U/ V1 u

8 j1 k) V* N& A5 ]) f   push  0000004fh         ; function 4fh1 b* u# F# h/ A
   push  002a002ah         ; high word specifies which VxD (VWIN32), M! F3 ~8 j4 f- f
                           ; low word specifies which service
, z8 Y! V0 o( D! U                             (VWIN32_Int41Dispatch)" s* @) ^! _0 E+ Q4 f
   call  Kernel32!ORD_001  ; VxdCall3 B" L- k9 N$ x5 D
   cmp   ax, 0f386h        ; magic number returned by system debuggers
) s- @- ]; y# v6 ]- T% E   jz    SoftICE_detected' E- S6 G# ?/ h" ?. I9 r! @

) m' e, G9 b" L0 ]; THere again, several ways to detect it:
+ K/ i3 i  L& }/ I& t
: ^8 U: A9 V- w( O2 m    BPINT 41 if ax==4f
9 O7 y, i" Q7 m
) Y  {; W- @" p6 S    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one$ G! a. ~+ h1 r" o0 a3 x9 v; g. g
% ~/ C9 t, _- E" Y' @3 R
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  |" F# ~; _+ g- [

8 P! l" l8 @5 F0 Z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
  h( c2 l- }6 Z
3 |4 p! ^& l1 ?! w$ O- m__________________________________________________________________________' @1 v' b" E+ ~' ^; }7 U* w3 w/ N

5 a5 ?3 y) |0 iMethod 13
, \0 |: V' L6 q6 G4 s=========& X% k3 G9 W% G
% C- L9 B& C+ ?3 Z$ w! @
Not a real method of detection, but a good way to know if SoftICE is
: v# u/ u* Z$ }( d( einstalled on a computer and to locate its installation directory.0 f/ W" C& y2 d7 q$ S2 D$ B
It is used by few softs which access the following registry keys (usually #2) :
6 ^7 [4 j( C+ e5 [& |4 K" O9 d+ |! l* u) U3 V- j
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& m" X+ R& u+ J1 ]% @6 G
\Uninstall\SoftICE
# }* y; ]* _! E5 P) q% H-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE2 v, Q$ N, ^) u- C/ v
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 Q+ V4 j: Q; e\App Paths\Loader32.Exe
% \; B$ N8 t) N: V, Y0 d% M% J+ l  x- }3 }
# [6 K% R* {. \# b, P- [( z
Note that some nasty apps could then erase all files from SoftICE directory
+ H8 q: q; R5 z(I faced that once :-(
' }6 w( {9 |1 N4 U" ^- _$ ^
( w6 l: ~2 h; v3 l2 g6 ]1 V% O% lUseful breakpoint to detect it:
& V; o& J( d: p' D& @5 {9 |
! t3 o7 }/ z; P- ^$ Q     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' d7 E3 u3 y6 _- K( G
% h. Y5 W% `$ ~* c__________________________________________________________________________6 d8 Q! t& ~8 R- {- s$ g2 o0 _

9 O; X; S& @& x% i, g, y" }
( w& U6 S# `( x; Z- ^Method 14
) g8 l4 S/ J0 j6 ]=========7 m7 t4 Z/ {4 ]9 u  U; s  Z
5 P) l! K- X* b
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 ]5 I3 n8 i: }# g7 g$ A. J
is to determines whether a debugger is running on your system (ring0 only).
7 g" w3 D4 O8 j4 ]3 E9 f( o
5 _9 ?: [  A; e- p   VMMCall Test_Debug_Installed  P  b* K+ N7 l% j3 B. ]
   je      not_installed$ p" A, O. z* I4 j# A' a

: W! ?+ X( V+ g. N7 Z' |% HThis service just checks a flag.. y& F  t! U! c! J$ K- E0 P0 w
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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