About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" }) u3 a* q) ?& O" a
<TBODY>
; r4 j3 L- k+ e) Z0 a. ?) [7 K<TR>
+ v' z4 f5 d, i2 q3 \3 W<TD><PRE>Method 01
; a. s' ^; b+ ^2 f  u6 H=========1 ^% g& c! \1 W6 `6 p2 |0 X6 l  K

8 P+ B* a. w" A' S$ w* l: aThis method of detection of SoftICE (as well as the following one) is
2 M7 C7 s+ s; ]1 dused by the majority of packers/encryptors found on Internet.
/ t  x9 a! K  }It seeks the signature of BoundsChecker in SoftICE% u( l& H0 |2 H) j2 r5 _) |- d

+ W" S& Y) Q7 m9 J. d) Y    mov     ebp, 04243484Bh        ; 'BCHK'  }0 T- n* }8 H; {; k  n4 s9 E
    mov     ax, 04h
8 B- T1 k- Z: W+ l    int     3       ; h# Y1 U: n4 \  J
    cmp     al,4
  q. v/ `1 d- e% d! m5 `  e  r  {! j    jnz     SoftICE_Detected# g! x; u/ o3 k2 b7 h# e1 M
! v' r' b0 ~, t2 \- N1 A9 }
___________________________________________________________________________0 ?) m! u$ e1 Q! U. i7 v+ ]; W7 G
4 M- D6 v, }6 q. j& z0 f: `. k- _' S
Method 02/ z/ ?  L' H9 F$ b
=========
# q2 W4 e$ D+ D! {& s5 n6 i4 u; g6 E! A4 j  b1 R7 x
Still a method very much used (perhaps the most frequent one).  It is used
. [& a6 F0 g" `1 v8 j* hto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
' C( F& X  H% G1 i' _or execute SoftICE commands...
% A. p7 [  W+ T+ }It is also used to crash SoftICE and to force it to execute any commands" {2 x' r2 Q8 z. i+ `
(HBOOT...) :-((  + O  F5 a  Z" P# W/ F

7 D) d: `# _1 a$ S8 zHere is a quick description:
' E6 g  V- k% ]$ a2 s-AX = 0910h   (Display string in SIce windows)
4 s; k; M0 c0 U* ?) `0 T. ?-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
; H$ s8 e$ y' j+ g; e' @0 T-AX = 0912h   (Get breakpoint infos)
8 z" Q* L$ _8 U5 _-AX = 0913h   (Set Sice breakpoints)
, L0 |+ W7 u. V7 S# M. l1 @-AX = 0914h   (Remove SIce breakoints)
1 @- l; e0 N; A) W6 q
  o' I$ f5 J0 uEach time you'll meet this trick, you'll see:! L6 }2 c6 O; @7 U% M
-SI = 4647h  N6 n6 f) X, d$ ?
-DI = 4A4Dh
% o8 N$ N1 V7 z+ b% L% w3 wWhich are the 'magic values' used by SoftIce.% {$ A: e8 h' A
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* j$ c2 a* N; r

; R- h* _7 M1 d0 |/ ?Here is one example from the file "Haspinst.exe" which is the dongle HASP2 x7 |1 s* {7 y" z. B' R
Envelope utility use to protect DOS applications:
7 K( [+ J7 c7 ?7 y) n$ j1 i6 Z* C0 @, M6 L( w% n

& p  W3 k2 p3 \6 h1 G4C19:0095   MOV    AX,0911  ; execute command.  g6 R! w/ ]5 e9 f
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 X. W7 J( S1 ^7 j" `9 T  z9 Q
4C19:009A   MOV    SI,4647  ; 1st magic value.+ M$ ]8 O" q; ^1 e& |0 B! y& g
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
) Z7 N( a. p  p' e4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 m8 d8 G$ N8 P, v5 b4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% ?; R8 L( C: z# [) h* F
4C19:00A4   INC    CX
( x  T8 J" ~) q4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! R4 U/ e9 o7 f3 D
4C19:00A8   JB     0095     ; 6 different commands.2 ^2 a( z$ t0 C; K& I- h
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' b9 G$ f8 a3 l9 w3 i; _4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)% |2 Y2 R8 ?, w) `2 z& z( W

: U3 e8 T& i$ ]+ {The program will execute 6 different SIce commands located at ds:dx, which9 v% s2 s  w4 w; B: @6 V
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 [* w- f$ h+ Z; w% E
/ X/ w& Y8 t( X; e* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." ^" s3 t& J/ j5 L
___________________________________________________________________________
, b5 c/ a$ H2 u) \0 N+ V# ?) f0 i0 Q: ~

* c, i9 s8 d' k$ b/ e7 A  @9 y- EMethod 03
  ^1 H' [  ?* e& E; y=========6 R% u  f5 J: k9 D  `5 X' X

" W$ J5 g6 g6 E5 J9 x" |2 Q2 Q& XLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! a! e& i$ b* ^" ?- T
(API Get entry point)
5 F6 I! K& y& @0 V# n          T1 p  m2 \  {: E4 v( C& R; G1 k/ ?
  `7 F0 R7 p: y" r) c4 O
    xor     di,di$ N/ e; w. K3 W' k, F8 P
    mov     es,di* {4 l2 e+ F$ I0 b. K) [# k$ }
    mov     ax, 1684h      
  u, D. O* I- n# I2 ~+ a: j    mov     bx, 0202h       ; VxD ID of winice9 P" M- h% c. U& w3 p  X6 q
    int     2Fh  ^2 y1 D; z. S5 m  |. P& y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 V' x1 v5 Z6 d# w6 ?, T
    add     ax, di
( J  Z  T1 T. e: s    test    ax,ax
+ x# R8 p1 f& G    jnz     SoftICE_Detected
% I" Z" ~: h5 W! |+ h! ^- `  b0 j( p
___________________________________________________________________________8 h. V, [1 X3 d! |# G3 A1 ^
* S6 Y+ O& P( G: W  }
Method 04
3 T4 C4 q9 b: a0 V=========8 G* P# f, A1 J2 i' x; j: J
, l3 O' |' b' M1 s: ^
Method identical to the preceding one except that it seeks the ID of SoftICE
3 w& E- H: V1 x: b- BGFX VxD.
0 |4 R/ U) r" r9 l' w
7 U/ K0 K! ?" u6 b    xor     di,di
6 r( f! a5 F& {4 M    mov     es,di
  a9 m' [- n! p2 C' M: h$ c9 O    mov     ax, 1684h      
! s$ U- d7 C  }% F  G: j) P( Q    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( [, p! S  i( K6 P. u    int     2fh- n. X3 p4 K/ P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  Q/ ~" ]( O& m1 ^    add     ax, di
6 X! I0 j$ N9 B) T; v    test    ax,ax5 N0 ^0 v+ X; ?, u, l
    jnz     SoftICE_Detected
6 s% S* i( T( q. R) p5 i7 y9 S, ?6 T% \8 [% U% K7 V, i) K9 f
__________________________________________________________________________
4 e/ f1 t) w* R) g4 r* t  U- x, e& \* r  l1 d
$ h& X: Y  _$ j, K/ D
Method 05' [8 E, `( n6 B" D! Z
=========
& f+ s" O7 p+ H. _1 j0 d# K1 \& k6 ?. H- L: q4 K
Method seeking the 'magic number' 0F386h returned (in ax) by all system
; ^' X  w1 ^4 ddebugger. It calls the int 41h, function 4Fh./ f# o+ ~! |9 l' Q
There are several alternatives.  % r5 S  R7 m" Q" F

" i% }7 t/ p" |The following one is the simplest:/ v' e; K! K, n9 D$ ?, l8 D
: s3 h5 S! g) ~0 K0 [: r) g: ^
    mov     ax,4fh8 T/ v* s" }: m# |7 L
    int     41h
3 Y7 [/ @8 I9 c& w' W  G    cmp     ax, 0F386+ c  j9 R% Z. R4 `
    jz      SoftICE_detected$ z+ _4 k7 O" m

" X; G9 C' e6 A, X& j& C# l! }: {$ U: W
Next method as well as the following one are 2 examples from Stone's 8 E7 V9 Z5 i3 x. D/ u
"stn-wid.zip" (www.cracking.net):& [( N5 F& Q& i" f
% ?, f' O/ M$ e+ I. w0 V- E& d
    mov     bx, cs
  q; V7 E+ _; B- b- R* y    lea     dx, int41handler2
$ T& y5 r8 X- G) [' D- X0 I    xchg    dx, es:[41h*4]; [  K3 E& E& z! ^
    xchg    bx, es:[41h*4+2]9 q( K; U; B* P  R% h+ _
    mov     ax,4fh8 q& I7 q7 p2 W0 v
    int     41h
" p! s) E3 b3 ~. g# M0 _' u    xchg    dx, es:[41h*4]
4 I& L4 L0 `5 h( k( K! R    xchg    bx, es:[41h*4+2]4 V! o, a. Z7 H, T
    cmp     ax, 0f386h) j0 |9 g  h: q% V( z2 `
    jz      SoftICE_detected- Y8 h$ L3 X/ u; `% [% l

/ K( T- x9 ^- i1 g; a# Fint41handler2 PROC  h& c8 D5 s$ x) J3 k# F4 Q$ }
    iret3 \% H4 I- H# O
int41handler2 ENDP' h: x! N1 g" y5 {
1 B5 r- B: C7 |9 T

  Z" P4 O8 n! K0 f: W" h_________________________________________________________________________
1 Q) C* a$ N$ k4 t/ S3 q4 t
6 R; j& K! L( Z9 |
1 c% [, g) ^: J" a! fMethod 06/ i3 H1 k, S7 {8 n- `& z# X
=========, F* b& Q- u: Z6 I9 P4 x
* X' Q' f0 T) r5 k$ W9 D

; _8 k- s- I# _* }0 ~* ]2nd method similar to the preceding one but more difficult to detect:
% w4 S, Q. a7 O9 p2 T" y* u" K4 g# y/ V, X( `2 \& l

' i9 \, h/ S( ~( _int41handler PROC. K" \" G2 }, ?! p! ]6 W
    mov     cl,al
  {. E: }4 t. y5 F. N9 I* t    iret
' g, J. e$ W9 Fint41handler ENDP
: t& n/ t' e% J" q: f# g% B. _* f% M; |% V
% e1 Z4 g/ L) j/ d9 A& j) o( l4 n0 t
    xor     ax,ax' L: \% g0 j- N& g8 T
    mov     es,ax" |; ^& Y, u4 B  A$ r8 X
    mov     bx, cs" ]$ ~) R4 {7 ~/ k7 E1 B
    lea     dx, int41handler
; ~- U/ G$ N8 }    xchg    dx, es:[41h*4]8 G/ Y; D' C2 B* I2 u6 e
    xchg    bx, es:[41h*4+2]
5 [" n' ?* E  z: h6 C' x" x6 U    in      al, 40h
" Q  V: a  B6 [% I    xor     cx,cx/ h0 C7 M2 }" M  L' T& L; G
    int     41h
1 t; U4 t/ t  `; h6 L    xchg    dx, es:[41h*4]6 p0 n& u" r, ^* t0 y
    xchg    bx, es:[41h*4+2]7 \% q9 ]/ o  s, f( i
    cmp     cl,al2 F* O: J9 Z3 @/ D
    jnz     SoftICE_detected4 h) b  t3 I, Y$ I

1 \0 h9 n4 R5 g1 @8 J_________________________________________________________________________- y6 R) r9 T8 k, z4 B; G  s  a8 |
% v) ^( L: f8 i# i7 L7 V9 F6 i
Method 07' d$ a' h$ c, P
=========
" U& ~7 |: G" Q3 |8 ~& X
2 @! k$ }& F0 |2 n+ [$ a# K3 `Method of detection of the WinICE handler in the int68h (V86)
, R" Q. ~1 P9 ^7 Q; {9 d5 {3 ?' K2 G0 G' l
    mov     ah,43h+ y$ s8 {+ V7 l' u0 Q0 X# K
    int     68h
! x; `6 P6 a7 ?0 M    cmp     ax,0F386h
% J) ]' H% Z+ z0 H, [  R% w4 S    jz      SoftICE_Detected
9 {! k; X4 W2 G3 n4 d3 k0 r1 z, Y( j9 ?2 t
/ v& o9 T( b7 d1 v0 X' T# a1 q
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( L2 D3 }& x7 P   app like this:
% U4 u- X2 o( z& I6 {/ a* R7 p7 C3 o( Z! V4 b
   BPX exec_int if ax==68# Z( ?! c5 d. ?$ K" i
   (function called is located at byte ptr [ebp+1Dh] and client eip is
# F; K8 z/ s$ H7 Z2 X   located at [ebp+48h] for 32Bit apps), E1 G4 J" I4 G2 {
__________________________________________________________________________
) {% o( ~1 ]% X$ ?6 H3 H
3 M' ]. I9 ]  X! N/ b. i5 @- s, H  B8 p& }" ?
Method 08
/ E! z3 ?' K) R5 u; B=========4 x2 b( o6 O" {' P; u9 Z$ |
8 T$ t3 I; d% T4 D0 L1 t
It is not a method of detection of SoftICE but a possibility to crash the5 t3 F% E: U8 f+ y) r% m4 L
system by intercepting int 01h and int 03h and redirecting them to another  l$ P! t9 Z! U9 Y
routine.
" M5 w# s" \( _* R( |& I) aIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; _7 l. U5 E# |- n! O
to the new routine to execute (hangs computer...). S" [3 \" j7 e8 T
( B/ F% I  B$ ?
    mov     ah, 25h9 y% V' z5 H: ]1 k6 S0 X# S
    mov     al, Int_Number (01h or 03h)& ?0 V) v, j% m
    mov     dx, offset New_Int_Routine: z) ~  d8 w. e
    int     21h' x1 z& D: h4 g9 ~) Z/ ]

# J+ \" p% |, N( G! d% N__________________________________________________________________________, _0 h; w3 D9 e2 z

2 `2 k8 F$ R( p" Z2 t. J9 O2 B# HMethod 09/ Y) N5 @1 A# E
=========% p; R' b) \1 E; c$ o& e
/ B& O$ C" h9 u/ ?0 a9 m. ?
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only& K5 p8 b* z( q# E. G# d6 \
performed in ring0 (VxD or a ring3 app using the VxdCall).% X0 K. s& t) s
The Get_DDB service is used to determine whether or not a VxD is installed
7 O5 H' {' m+ O0 z6 gfor the specified device and returns a Device Description Block (in ecx) for
) R1 U2 r2 G9 o& q! x* L2 K  bthat device if it is installed.
# e8 x3 d) r0 U) `6 m0 O1 k" Y
' `  J6 L1 j- B3 {, v   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID0 i  p7 i0 l4 y" W! a) q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ m( A2 z( H/ K! T3 q% D  D  d
   VMMCall Get_DDB$ {3 ^' Z) A9 V8 ~
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* k9 U8 g  T& ?, e9 L

: A9 B4 \  W. c0 zNote as well that you can easily detect this method with SoftICE:
: q& {4 l- K; y/ d   bpx Get_DDB if ax==0202 || ax==7a5fh
% }+ {/ V; b2 {2 W1 i! u/ C2 F' K0 _
__________________________________________________________________________$ p/ M( f: z4 T, b  W
5 d- T, \, b1 ]
Method 10
' n; N3 }+ l) p, K, H# G=========! o# g/ O! L; Y1 ^# h) c8 s
' r+ V! j$ B+ E
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with$ }: P* x, [( J  q6 z8 z( u3 f
  SoftICE while the option is enable!!
) `( ~+ d( Q/ e& K" y( ]' k0 b% d: X. m, ]( g
This trick is very efficient:1 p1 h& `1 H! Z+ T: K( M
by checking the Debug Registers, you can detect if SoftICE is loaded" O( x( U* E& E; Z7 o0 P
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! D# b  P! _" Q9 S- l- C
there are some memory breakpoints set (dr0 to dr3) simply by reading their: b6 X3 l5 J$ c8 G- c
value (in ring0 only). Values can be manipulated and or changed as well% t9 M2 a" a0 p8 B: S
(clearing BPMs for instance)
" a0 D' f- M3 k
6 Y& }8 u4 Q& @: A2 d2 ^__________________________________________________________________________1 T, l, Z8 ~1 h; x& p
, }6 Q, ]3 X. c' {- ~0 Y9 J. s
Method 11# J  `( s  z! ~0 z
=========- r  Z  X9 }- r! K( r2 E% J/ N
" \. Q7 T# H" g% n7 K+ i
This method is most known as 'MeltICE' because it has been freely distributed
- O' o0 z6 \% `7 q& a; S4 Lvia www.winfiles.com. However it was first used by NuMega people to allow: K1 J( F. U4 O4 j$ Z$ ^" |
Symbol Loader to check if SoftICE was active or not (the code is located
+ N4 v, g  I2 e5 y) rinside nmtrans.dll).
# X' ?/ [# x# |& G6 \  g1 p. o) w" {3 }) @. z) @
The way it works is very simple:
* P; g+ Q" E6 p# fIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* h- M" G  ]8 T7 m- MWinNT) with the CreateFileA API.
9 M( U- N9 `) }% J: ?3 q' w$ p
0 _3 s$ ^1 c1 SHere is a sample (checking for 'SICE'):5 |) S$ d) ]* F7 x/ p1 K

( j4 A' G2 p7 Z. i8 ]BOOL IsSoftIce95Loaded()
( ~3 W0 m! T3 V; M{
, f6 \3 [, D* S% q# l   HANDLE hFile;  
8 r2 i3 H6 g6 V! F' L6 `" e7 w   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 g- y4 u5 t& K4 x
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% t# K  s* E( M" R. E                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ ?: [: D4 E$ K- |7 B   if( hFile != INVALID_HANDLE_VALUE )
3 c2 V' I$ z8 q( G: B   {1 h5 l! B% s' B6 P" \/ j' y$ p9 Y' e
      CloseHandle(hFile);, b9 {. F6 [( y) d5 W7 m7 i" }) `
      return TRUE;% [3 V2 E+ S7 u: _7 j6 b
   }
8 S. V+ c# G1 ~. n, O) |; S' K9 q   return FALSE;5 O' r3 N# k  H; U8 j# F. w, B
}; t" l2 M% @# l9 n# M
) j% t. L4 Q0 ^
Although this trick calls the CreateFileA function, don't even expect to be7 w+ p( S) r- |0 d) S- n
able to intercept it by installing a IFS hook: it will not work, no way!
. }- @* b. ?% Z! a: b; j- CIn fact, after the call to CreateFileA it will get through VWIN32 0x001F& {9 L. P8 x- P; t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# Z9 a% U) P- Z, ?$ [
and then browse the DDB list until it find the VxD and its DDB_Control_Proc( M- F( a/ `* x. w, L8 u4 \1 G' D
field.# u( l$ ?; |# D; ?
In fact, its purpose is not to load/unload VxDs but only to send a ! t2 Z4 s4 |- d$ D% Q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 [& l  W9 m' y6 _) Y5 C9 tto the VxD Control_Dispatch proc (how the hell a shareware soft could try& t# y( q  s: q, _4 ^9 w3 d% S1 i$ R& W& D
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
( a9 E- z3 P/ i; x. SIf the VxD is loaded, it will always clear eax and the Carry flag to allow! e: k' ?! e( z) ]: N+ H
its handle to be opened and then, will be detected.
/ S9 @3 Z8 X/ h1 K$ c0 oYou can check that simply by hooking Winice.exe control proc entry point" E1 `- r; `! b% L; p
while running MeltICE.
0 e+ [1 o+ w' p5 w7 E
+ l) X  H8 O( {6 f' Q! d
) J; z4 s0 V4 Y: M" U  00401067:  push      00402025    ; \\.\SICE
, T9 d. p5 v  \. D- j+ f  M& n0 U. L  0040106C:  call      CreateFileA
5 U! u% j7 m" Y1 m7 x' H  00401071:  cmp       eax,-001
( O, u  y0 S- [; p( E& u- u  00401074:  je        004010913 Z  x7 W) m5 W0 ?

) ]1 z. d  E, z3 u% W* Z+ E( @! [$ ^5 F" F9 f) ~. g7 h! Q
There could be hundreds of BPX you could use to detect this trick.
0 ~4 a; @: d7 N1 Y- N-The most classical one is:
% p7 i' f. p* w  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. p" p+ ^0 b* I' Y/ }. J
    *(esp-&gt;4+4)=='NTIC'4 N3 a8 t4 p. I7 I1 \. `
) g- A5 l! _& i3 b. E
-The most exotic ones (could be very slooooow :-(- i# V  O( {* N. j! S9 A
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % o- i- F8 r# V. S# R
     ;will break 3 times :-(3 a, c) p" e4 h: p" D* v

% q% t- t- T6 A. n8 q- z- Y# U-or (a bit) faster: ) A2 X/ n0 @' ?
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) F& o' t& Q' V3 g" h$ F7 l% I1 {) @& f+ F7 [* X
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
2 P- \: t& H) ~& L     ;will break 3 times :-(
" b9 j! _+ D, [; e8 T9 U
9 S: g( l; S( r( V' [-Much faster:
- ~: A3 r, Q/ C9 g* `, x( Z: ?   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% q# A9 b% O3 `

4 v0 z* b: C8 QNote also that some programs (like AZPR3.00) use de old 16-bit _lopen& }* U: `5 a8 I% P9 \3 j- t; q4 t6 }
function to do the same job:
. d4 s" {9 t+ X# e4 F3 d. `; X1 o; k5 v5 t) a. ^
   push    00                        ; OF_READ
+ Q; P3 M4 M; J/ ^9 B; C7 g- s. n. b   mov     eax,[00656634]            ; '\\.\SICE',0
8 \/ |4 i* G8 l   push    eax
4 w1 f, Y8 |1 N+ N   call    KERNEL32!_lopen% F" x2 Z) p2 o5 j  I; t* }
   inc     eax
& D  `! `- m* O4 }, `) k, `6 V& g   jnz     00650589                  ; detected
. J) b; D' D, E   push    00                        ; OF_READ' ?3 Z' h$ u6 _* y4 n: E
   mov     eax,[00656638]            ; '\\.\SICE'
5 u2 U# y& A3 e4 W   push    eax" Q: i7 i& j* ]/ g
   call    KERNEL32!_lopen( h4 O0 w  i9 F* D/ ^" L4 {& D( i
   inc     eax7 Y' q$ z/ h! l. r
   jz      006505ae                  ; not detected. ]# l: |' Q- e

. W  I2 ~" V! s+ z/ w9 j2 l4 p  _* j. S* N  Q( u# U- K
__________________________________________________________________________
2 ^& Z7 W1 h, D7 S, T2 i: b3 g3 W  ?0 K0 J( X6 |% r/ Q: R
Method 12
) j0 D1 f& T* L=========3 X, t; R2 v) h% d
' u' @+ a" X9 g5 O8 |1 k
This trick is similar to int41h/4fh Debugger installation check (code 05
5 M6 `! D* X: A' }&amp; 06) but very limited because it's only available for Win95/98 (not NT)
5 _4 w$ r; W" m; Las it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- h0 e, M% O( y5 H' m$ X
% l. n3 C# @# E9 ?% C+ ?   push  0000004fh         ; function 4fh7 t- y; a+ b  n" x+ z! t, w% P6 B
   push  002a002ah         ; high word specifies which VxD (VWIN32); x) h5 ~: Z% R
                           ; low word specifies which service
& E1 v+ O" c- R( h7 [' N                             (VWIN32_Int41Dispatch). b) R" ?$ l9 K( `/ w8 W
   call  Kernel32!ORD_001  ; VxdCall* C) k$ e2 L  q
   cmp   ax, 0f386h        ; magic number returned by system debuggers* [- [/ ~3 Z. S2 M
   jz    SoftICE_detected
8 {( U$ j% L7 P3 S/ P( P1 c; i
* }  p# B: F3 i5 v4 W: i0 j+ ^: IHere again, several ways to detect it:! C1 |8 R4 u2 n# ?. l
; ?7 j4 q. ^- A
    BPINT 41 if ax==4f1 `% ^1 k. D# N  H
) a/ i/ i+ J3 H2 r8 }! ~
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one( A! H2 d5 V" [0 v

$ h5 ]2 I1 V8 {5 Q1 q0 D    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* ?1 |1 g  K* a- u5 T# \3 h/ U

$ G$ u: v4 ?/ L' x1 k    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
3 h# |( b+ q6 g4 F& g
5 M2 ~% a7 U9 |# d( U8 l$ J% w__________________________________________________________________________
6 |; p7 m, c1 F: d# w0 K5 }  [% e2 ]4 c3 A) R0 K) p) G/ m
Method 13& N! A0 r  i$ M9 {$ Z2 W0 Q/ b
=========
8 Q! D* k4 d! N: i/ x5 Z# x" d
Not a real method of detection, but a good way to know if SoftICE is% t( M- k! f4 |+ O& a
installed on a computer and to locate its installation directory.; _# s* k; w. u3 ?/ ?
It is used by few softs which access the following registry keys (usually #2) :
; W* D6 V9 I7 h9 W, ?- ^! K
& ~4 ^( A( S) N9 S1 E6 i-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ Z% p. \7 r6 M' D0 ?4 M4 ]+ G
\Uninstall\SoftICE/ M: u% U. v! Q6 v& Q+ _( D/ v
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
5 N5 j) }9 u$ G( `: V& r-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ C9 f+ F6 p6 _# g* `\App Paths\Loader32.Exe0 I2 j7 l; U0 O) W4 Q
$ j3 C: X7 e8 ]( c  n; V6 P+ ]# b1 f
. t/ N* C% z$ n5 f* x! k
Note that some nasty apps could then erase all files from SoftICE directory. q% x- D/ `& E. \$ q
(I faced that once :-(
% d3 ~; \- X( _7 f* v5 T7 Y* d6 m1 x2 J$ U. G
Useful breakpoint to detect it:
( M. g+ t* q( `3 V7 X5 T) |* X! H( L" q. x
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& C2 e: f; ^1 K: f; D6 \! i
" m2 i3 `7 P9 x1 L% M+ @__________________________________________________________________________& [; O$ t/ T1 R" A. [0 E' d+ \

3 X# U% g9 z' P4 l* m% J, f- H  u2 Y) i
Method 14 ) h4 U  n3 b! H
=========
; @1 U5 V0 }/ e7 w7 O1 q2 S# @" r5 c, D/ x. J) h, U; I
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) h, R# ?7 X$ c' [2 lis to determines whether a debugger is running on your system (ring0 only).
% ^& S2 p8 b; r( q8 [0 x8 d3 Y9 g6 {- ]# Z
   VMMCall Test_Debug_Installed1 m2 }0 E1 Z  Y/ e) m( G
   je      not_installed  A% F4 E5 p& _- P) Z4 |) @
& o; g1 ?: s0 @3 F: H2 o, O8 b
This service just checks a flag.
9 e6 e- ~' V/ h6 ?</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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