About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: E! \  y! g( j' O
<TBODY>4 o  L' G+ J% p& l5 y0 l* C' r- f) {
<TR>
6 B( T4 [5 t. b3 e  U' f# {<TD><PRE>Method 01 " Z% N  E# o; r8 g; N  q
=========
: I5 u) a) A7 u2 P1 p) t  R& |" `3 ^* f) `
This method of detection of SoftICE (as well as the following one) is3 K5 s: L4 i5 U0 k5 t! }
used by the majority of packers/encryptors found on Internet.
8 W# I3 R; q& U& N! n) x/ a* mIt seeks the signature of BoundsChecker in SoftICE) z) m, q, L+ d$ f. Z
: J8 R7 T9 D* k
    mov     ebp, 04243484Bh        ; 'BCHK'1 C$ }+ ~! q. w* A' M8 K, h  l
    mov     ax, 04h: I6 h; Z) Y. O4 ^
    int     3      
& x1 a* r+ s  f$ O& F0 [" h    cmp     al,4
9 x. \) Q2 X  p: O+ R- o: n1 H    jnz     SoftICE_Detected
, b0 x# T- ~4 o% @9 _3 K0 J  I% b1 @- h( Z) @% E" i& V
___________________________________________________________________________
6 I6 I: {; V" A7 b/ j) j& W
' v+ Y8 A) A- K# O/ BMethod 021 l1 @5 M) Z3 V/ T
=========  n3 w7 g+ e8 Z6 a' Y# j
+ G: A" P( Z/ e. ?/ [8 E+ @
Still a method very much used (perhaps the most frequent one).  It is used  X5 V3 b/ }( W7 I9 r/ h
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 x, x/ U9 p8 m( T* H% i# w
or execute SoftICE commands...
! J" {" S- e" H) K1 mIt is also used to crash SoftICE and to force it to execute any commands
  ^2 H$ D9 l& j; Z4 x/ A  M(HBOOT...) :-((  2 H! _$ L) s8 Y# }# F. B" i

) z  W) u! b; F- C2 f; ^" f3 NHere is a quick description:
. j+ q: k& L6 p& o. B, W3 Q-AX = 0910h   (Display string in SIce windows)6 F3 J: _4 g3 M7 H9 F, N
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* x6 ^5 s; z) s( N0 a- @-AX = 0912h   (Get breakpoint infos)
+ R; ~) Q' z4 c% j9 u& X-AX = 0913h   (Set Sice breakpoints)& R. G3 v' Z( l) S
-AX = 0914h   (Remove SIce breakoints)$ V# v9 m% @! N; p# z

  |- p* C# y. j2 QEach time you'll meet this trick, you'll see:+ @5 }. T8 p$ k' m
-SI = 4647h
6 Q; `( j( l" C, T4 e* a: V0 v-DI = 4A4Dh
1 g* M+ O7 d: ?Which are the 'magic values' used by SoftIce.  y) }' [$ l' L! X, J! {2 w
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 T# C4 Q2 }9 }, v, y" W

% m) \' [- [. M6 e8 xHere is one example from the file "Haspinst.exe" which is the dongle HASP
1 K' k; ]$ S. a. X3 Y% mEnvelope utility use to protect DOS applications:: T+ W: Y" N5 N0 P5 K
; ^  G0 S% a6 M7 {* z
8 `' D$ ?9 ^  S$ S; _) u9 T* g
4C19:0095   MOV    AX,0911  ; execute command." K; ]0 k, u9 v
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).+ v! r# r) q6 l
4C19:009A   MOV    SI,4647  ; 1st magic value.  H9 [) q( |$ K+ y# M3 `
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& H3 d; p/ V1 |; x4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 T7 l$ j7 i* T  a. f) F
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  o, P- A. l" a! H7 X4C19:00A4   INC    CX' ^% T) J: ?2 v+ R+ C8 `
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- s. t+ }; C4 v( l6 H6 x) z4C19:00A8   JB     0095     ; 6 different commands.6 R: X/ R. P2 z! D0 M1 ]
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.( ?, S6 e/ q2 l6 o* d2 t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)3 D! l1 N6 J7 I
( \, R7 [& L" h" b
The program will execute 6 different SIce commands located at ds:dx, which' n6 `; N2 d; w+ G+ p7 ?
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# ]$ l$ B% C3 o1 s  }5 |
2 P0 F6 H6 d. B6 x; w* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: b2 G7 t+ e& X  T$ G___________________________________________________________________________
# z) s; ?6 N( O8 G# U! H
1 e+ a/ {% f2 k# D1 @" h
$ K) i  t  L. N! E6 s; \Method 03
* l" @; O7 t* w6 }* N  X=========: E& i2 m! R) c6 s  ~9 ~$ M
7 Y5 m  [. p. F$ n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ m# \% N& q4 A2 B5 _(API Get entry point)4 R- l$ E( A4 A7 |! C1 |: _
        
; H+ ?" O' D2 G- D' L: K* u# U, L: S+ F( O; Q7 L1 a
    xor     di,di
; x6 Z% K3 n6 M3 L; O  ]8 e    mov     es,di# S) J0 h2 i7 I4 Z7 n
    mov     ax, 1684h      
3 h# u5 J2 ^  `* k6 D2 c$ e2 j  v    mov     bx, 0202h       ; VxD ID of winice
1 d' G9 W% H( G' @    int     2Fh( j7 j  }' k& {# L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% C4 i( [. ^, E8 M; ?) A2 E( t, @    add     ax, di" r" n2 q/ N" J+ W, b) a1 B3 u
    test    ax,ax, b* X- d  j* I# h
    jnz     SoftICE_Detected- T" k2 k6 |* b1 q; ^4 S
/ O! C$ h5 ]+ G& B+ r3 j, r
___________________________________________________________________________
" @  ?1 h- V; X/ Z, P% k. s' z. Z' q
3 I: {' B. H  B7 V! zMethod 04
6 g. ~, C# h' y, q: r% c=========) W- ]$ \3 u5 V' T& K7 M' ^

4 U5 w2 F3 p* g+ k3 U+ FMethod identical to the preceding one except that it seeks the ID of SoftICE
9 a% [6 H" q9 h! lGFX VxD.
2 ^3 t( ~. `2 X5 P
& X. _; ~3 e2 \- C. B0 U" L    xor     di,di
7 Z, H) L6 n, K" y    mov     es,di  |7 j- I- @; [! M
    mov     ax, 1684h      
  p/ {: J! `1 _' t' i, {" g    mov     bx, 7a5Fh       ; VxD ID of SIWVID( j& ?5 m$ e5 q. G& y# O
    int     2fh/ k( N. n7 T# g# P% T. w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point- M3 b- _5 N* n( y2 i+ e7 l
    add     ax, di- j; Z7 K4 I5 ]0 o' L' I
    test    ax,ax8 E. H% [8 ^* _
    jnz     SoftICE_Detected
6 v5 ~) i. o' ?. S/ C8 z5 f
2 `6 V' U4 q* `4 Z% |$ R__________________________________________________________________________
+ I/ r5 @! q) V6 Y  a1 G! f2 T: p0 V% A! X2 b
" n( L" `& P! S: q
Method 05  m$ o* W) D- t
=========
& C" E8 D. F, A7 j
3 l' X' \, Z1 U% x/ o5 \8 y% s7 _# TMethod seeking the 'magic number' 0F386h returned (in ax) by all system
* I$ B. Y- H  Pdebugger. It calls the int 41h, function 4Fh./ g% Z3 k5 C  |+ J& ^
There are several alternatives.  0 `& W  F  L5 r1 t; w

' T; Q. [5 [. C2 _2 Y, C4 `The following one is the simplest:
( [0 Z6 x. d6 F7 {6 l1 c$ `' V; s; }7 z0 H8 \
    mov     ax,4fh* N, N6 V- F# }6 @. X
    int     41h
; k& O- l& J. g: s    cmp     ax, 0F386
9 I: Z1 V7 E& V. l% p0 z. R    jz      SoftICE_detected+ f) p9 }/ v% _2 C' j# A7 |: E
* j& v- }2 \4 t# o- H9 [+ M3 b6 Q

, L  w7 l; j  g# ]Next method as well as the following one are 2 examples from Stone's 6 O3 K0 E7 B! C$ A- I
"stn-wid.zip" (www.cracking.net):
- e1 @. E) \8 a& U) p0 ?- f& B, e7 h
    mov     bx, cs' p, c/ M7 v: i( l# P- B
    lea     dx, int41handler2
) V  _' ^9 d- s6 K9 G' A% {: ~    xchg    dx, es:[41h*4]
/ E3 r1 U5 u' s7 U" _6 I    xchg    bx, es:[41h*4+2]' P5 u: Y# j/ F1 k
    mov     ax,4fh9 T! Z1 w- P( M6 d) L
    int     41h
8 q) }1 \* T, e- N* N" b    xchg    dx, es:[41h*4]& B5 U& `" r5 r( S) w
    xchg    bx, es:[41h*4+2]3 [9 j! ^" H/ n0 }$ |0 _1 B
    cmp     ax, 0f386h5 g& \4 r1 d' [- x4 e6 H1 v* X0 C
    jz      SoftICE_detected
9 M; F' p" j6 [/ t2 H
7 V7 Z4 y0 `2 p9 Sint41handler2 PROC
6 A; M7 |& q; h. |( q    iret
5 U+ N7 m' @3 }9 v3 ^& b; P6 Sint41handler2 ENDP
4 `  X$ `% S8 L! y- t; b( q+ B; f2 S& X8 W  Y% W% t, g" O
* P" c  _+ ~  C. N; F
_________________________________________________________________________4 Z: L' F& S0 `
" ]/ {+ l, j: Q8 B* R% I
, s2 V- j7 z1 q1 {7 @* N
Method 06
$ I2 h# |& |! d8 h. a! }=========
& n$ f4 C0 a; Y, f5 K+ b! i
" b% w- F+ X" X
! d# [7 D. g! ^+ M9 ]6 i4 e2nd method similar to the preceding one but more difficult to detect:# D+ R5 M0 y1 g( b* T
( i6 x2 S% I  }8 F( P+ ^% b
0 R+ V  Z- N! T4 L9 M
int41handler PROC; o9 l7 J, l* Q( P, R4 S1 b. j, S
    mov     cl,al
4 L# {1 C0 g0 T5 a" M- N* S2 j0 e    iret
  ~* z/ }. w5 _. O" b, Mint41handler ENDP) x2 a1 p/ w2 t0 t# @
$ _0 x& r9 K5 Y9 o

/ N2 J- b$ w" R- l$ `: d    xor     ax,ax
. v$ Y; B, G  |) {3 E9 L3 X    mov     es,ax; d* c" a$ P  \$ C
    mov     bx, cs# P8 {/ d3 P) U8 m% f, T0 T: Q
    lea     dx, int41handler4 C. b5 f: ~! j
    xchg    dx, es:[41h*4]
  q% b4 `9 _0 V0 R! O    xchg    bx, es:[41h*4+2]
  @0 b* }( j7 F! b$ s& ?# I, A/ q    in      al, 40h  ~$ _+ Y. G: E: ]8 Q
    xor     cx,cx
6 l5 r- S& k. j  @% f/ ]    int     41h' I. b; `+ [. i) b0 j
    xchg    dx, es:[41h*4]
9 P. }2 f  ]0 d4 w0 \( g    xchg    bx, es:[41h*4+2]
% [! E; I/ g9 T4 g/ O    cmp     cl,al
4 M* f, E! i5 q; b- S9 B    jnz     SoftICE_detected! o" x* D; I, U' |0 g: R

$ d2 p+ l8 x4 H8 \# c8 U2 K1 R8 |_________________________________________________________________________
0 G% Y5 B  ~7 B3 k( l" c0 ~3 |' ^& R" a' f
Method 07
& e7 \8 U, o1 T; F& \3 ^=========
( F/ r' j7 `; _8 N, A* E
4 F! X9 t/ V: d$ C3 N; eMethod of detection of the WinICE handler in the int68h (V86)
1 x% Z0 V% A7 r' v2 Z2 `, E2 ]& _# G; V0 I3 w
    mov     ah,43h7 F  @6 A! B0 B1 [+ {% a
    int     68h) \* c, T) K' J  s6 S1 }! ^; d& A9 k
    cmp     ax,0F386h, I" F/ ^* z2 ^5 D' S% R# ]
    jz      SoftICE_Detected. s% z8 ?: V, e% a. ?9 @; q

1 p2 R( H1 {0 }$ s+ M7 g8 J8 S
' h) L! T  Z' Y4 n=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& g" W+ S# K" @! V
   app like this:
& W1 ?3 w5 }" J/ Q4 e; x2 @' o6 t8 H/ F+ w
   BPX exec_int if ax==68
  {" `3 N! g  }6 s  q# U   (function called is located at byte ptr [ebp+1Dh] and client eip is/ }6 ]% E/ \7 ]7 S8 V3 v; l
   located at [ebp+48h] for 32Bit apps)- Q( \6 x7 n- u; ?% B+ O) N# k
__________________________________________________________________________4 `  p1 H8 C  s/ R, ~

/ M) q/ D3 \9 a8 N' c* M
- ~; B* q! j8 _Method 086 j& w% U2 w0 U: H8 b
=========& b5 x0 N, ]7 B

" o' y% Q# a- ~" H4 QIt is not a method of detection of SoftICE but a possibility to crash the: f- {8 O7 u: t% k
system by intercepting int 01h and int 03h and redirecting them to another
8 k- j: O6 h2 x; F2 C( Vroutine.5 e9 W0 R4 I8 j8 J' w
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points8 G+ i+ d" h5 s6 K# G7 l
to the new routine to execute (hangs computer...)! E& K6 _6 x5 S- v3 j1 g  ~
- d! M: y; ]4 U# \9 u
    mov     ah, 25h2 K8 p1 t. k8 z" ]
    mov     al, Int_Number (01h or 03h)- X& C( l# L9 P+ u5 f, u! i
    mov     dx, offset New_Int_Routine; `9 E- s- X) @( |
    int     21h
" `; i$ K2 E" [* R6 C
, Z$ }% d& x' h& S* ?) @__________________________________________________________________________
  q4 v7 P0 T6 ?" I" T
- a! Y1 }! {$ IMethod 09
4 I" P4 A+ l$ W" F. p, J=========; F) z9 z' Q; U3 F9 q

* q3 U6 }- g9 g3 ]* JThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* `8 P. @8 Z; S, z5 b
performed in ring0 (VxD or a ring3 app using the VxdCall).
2 a7 f, Z3 c1 a* J* L; F( cThe Get_DDB service is used to determine whether or not a VxD is installed0 H# H6 t! [1 D0 C8 D1 Y
for the specified device and returns a Device Description Block (in ecx) for
, ^, _, K& L. I9 Y: g; Q; h2 wthat device if it is installed.1 R8 o) \  s3 N1 D0 ]8 A$ X
5 o) T2 K1 x$ ~; y
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 Q# G6 `9 y/ U& l* X% a, {
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 o/ x, d8 |! X! r4 Z' y
   VMMCall Get_DDB
* H+ Z+ h6 V# v& k6 X   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ G( |% H1 k5 K! d2 q

$ y8 N; c1 S' b, X/ X! {Note as well that you can easily detect this method with SoftICE:
8 B4 \. a3 {/ ~/ a" Q7 A   bpx Get_DDB if ax==0202 || ax==7a5fh
3 a( g4 V) j; Z6 T, f. h; A
5 O# ]* X6 T% p  |6 p__________________________________________________________________________- c' u. d7 u- ?  W* k9 v- N/ ~

; r0 X0 F" m( P- E6 QMethod 10
' m! T/ X/ e* }9 `! c4 Q=========- T; l0 o# A" b

( i0 b; O1 s6 V5 t9 @9 h=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 e% o- Y9 A% ~- _1 ^  SoftICE while the option is enable!!+ L; a5 d2 G7 |6 h; U& x/ D* ~* L0 O

+ r  w% R" J4 k- P. cThis trick is very efficient:9 z. S! z; @* ^4 B8 [/ E. F% e
by checking the Debug Registers, you can detect if SoftICE is loaded
% `- A. @6 n8 g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" i0 l, h) l  l7 ^3 h  C2 h: F7 Qthere are some memory breakpoints set (dr0 to dr3) simply by reading their
1 Q9 t  X# z/ ?6 ?( v# }8 qvalue (in ring0 only). Values can be manipulated and or changed as well" z- W: j- k0 e2 [6 L( J. u
(clearing BPMs for instance)
9 H  z; z6 V' ^' Q9 U- }' p
( r5 P7 Y" r% C5 _! f' T__________________________________________________________________________
# e$ ^& Y* k1 K8 p: }- Y7 q- q$ R" I, A! j! m- R3 F
Method 110 W' V% W5 O( \% R$ w+ S
=========
7 k8 c" {& n1 p" k. a9 C$ S. ?
This method is most known as 'MeltICE' because it has been freely distributed3 W8 E8 e* ^/ e
via www.winfiles.com. However it was first used by NuMega people to allow
, G/ M# t3 {9 i  WSymbol Loader to check if SoftICE was active or not (the code is located
* I9 T# m! n8 z% I' i3 C- ]; v$ xinside nmtrans.dll).
) E* c/ D* A. Z) R$ v. u* S+ O
* D% w* @% n( ]+ O" X8 F  K  kThe way it works is very simple:* ]$ s# r( ^6 y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 [0 ^. S5 ]9 {5 [
WinNT) with the CreateFileA API.
& H1 m# }; I8 ^' r$ s6 }# {- }7 }4 o8 P
% r, y1 @5 l7 a- r. l9 Q. i! BHere is a sample (checking for 'SICE'):9 p& p" I$ x* k5 S
4 C) m$ i6 G. Z; I
BOOL IsSoftIce95Loaded()* Y( }7 o8 Q% s4 e, H. G
{; I+ g! D7 ~: T& m; |& B4 \; ?
   HANDLE hFile;  
- c: [( q( q0 c5 I# \/ @% A   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ r. ^6 e9 P4 S' G) L2 @# ^9 K, _
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ R: H! C9 |8 `& R$ {                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 ~- m8 k+ l7 i  r
   if( hFile != INVALID_HANDLE_VALUE )
+ y' u9 c7 H2 X   {
6 ~/ q# j4 v/ Z4 n+ a      CloseHandle(hFile);  K, D0 t( w# ^1 H3 w, [
      return TRUE;' a! u  y% L/ ?( _& l5 E9 X
   }
  T  S2 G1 H# z- Z9 K   return FALSE;
$ z; r& [% g2 i9 z+ C8 h. i, K}
$ l4 z4 c2 [7 U# ]1 [5 ?" S' d2 T& Z, L( u9 T' m  x9 \
Although this trick calls the CreateFileA function, don't even expect to be
3 F9 B7 `  v$ ]/ e  k  l, F5 Fable to intercept it by installing a IFS hook: it will not work, no way!
3 s4 ~1 N+ G3 v3 v6 WIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 H; l2 U8 l" ?8 Z3 k& p/ u! v2 Zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' g* _' X' b) o, I3 f5 H5 z
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ Q4 M4 Y: C) s9 z) r" tfield.
9 i& A% X6 Z' Y  RIn fact, its purpose is not to load/unload VxDs but only to send a
$ n- X* o9 m" }! a+ M6 ?" xW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 [  ]# C5 g: h# s0 ?
to the VxD Control_Dispatch proc (how the hell a shareware soft could try2 Y( O' U% q. z0 g1 U0 V6 \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 y" l- \2 h) }  s5 I+ u+ n2 w" [If the VxD is loaded, it will always clear eax and the Carry flag to allow
) W! d4 B0 C* `/ Q& S4 Y9 Iits handle to be opened and then, will be detected.* P4 f% i" G/ x+ M. l5 K) }, Z
You can check that simply by hooking Winice.exe control proc entry point
/ x$ J; E$ g9 d2 [# L  g' t  kwhile running MeltICE.
9 ^6 j2 t" N; J% b2 ]2 r! Z6 a! k; b. W$ s( A" p
; T5 C" A$ L5 }* z( t- ^% z! ]
  00401067:  push      00402025    ; \\.\SICE% e* E, o0 R/ Y6 b4 N. M' u: b2 D
  0040106C:  call      CreateFileA
+ k& f) h: \" O4 _/ [6 T  00401071:  cmp       eax,-0010 t- D8 g( I0 ?; t" Y" R" k4 U
  00401074:  je        004010911 ~; s2 I4 {/ {! c8 B& I, q% H

- j3 `$ q+ G4 k. j, @6 _% H7 z+ D, _. ?! E
There could be hundreds of BPX you could use to detect this trick., g. e" `+ M0 o( ^( D  K* U/ `, m
-The most classical one is:
* A' `- d, [1 {/ ?& G  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 V1 e0 J$ R+ l; e4 J
    *(esp-&gt;4+4)=='NTIC'
! R; J8 V$ k" b. w
1 {* ?6 b- @: S( @0 l& L-The most exotic ones (could be very slooooow :-(7 X$ Y4 N1 Q5 J4 M
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
' w) z% I, j8 M6 I& l* H: s     ;will break 3 times :-(2 i8 h, P2 N1 ^

. _7 M0 ]4 D& }0 [8 c-or (a bit) faster:
: y, v5 E6 H2 d9 q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ M( Z: y# {) W6 }+ u1 o$ l* T6 c$ K8 A
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  / @$ u0 l9 k# s
     ;will break 3 times :-(
' Q. {! ]3 U9 `, _( y; F" O) n' f+ H4 D/ o! K6 W7 Q
-Much faster:
" l! m0 |  T4 e6 l* z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 S: Z8 Q2 W$ U
: j1 m& ?3 I. X6 g5 Z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen7 c# I# Z( ~' m. z; @' m3 R
function to do the same job:: i# k# C; e$ q8 L5 z- j
6 H7 |9 [- v" D1 E1 a5 I8 G) ~
   push    00                        ; OF_READ- T* r' E% Q( \1 x8 ]2 \1 b
   mov     eax,[00656634]            ; '\\.\SICE',0
5 n5 i) l/ D6 \$ U/ Y; i* j& a   push    eax
4 j7 Y+ {% j2 [   call    KERNEL32!_lopen
2 D: h, n5 a9 H8 s" ~0 h   inc     eax- c7 S) o' m* W
   jnz     00650589                  ; detected
- p! _* J, x. l& }0 Z- R4 k   push    00                        ; OF_READ# @; b5 f9 B# e9 E; d$ r  y
   mov     eax,[00656638]            ; '\\.\SICE'7 O/ `1 F9 ~8 m
   push    eax
$ s' z, C3 V9 g   call    KERNEL32!_lopen
# K) O( M( D  \! L   inc     eax) @3 ]. t  L! g" y  P9 E
   jz      006505ae                  ; not detected
# X" w2 P# ]# j1 Z: U4 L, F1 K5 m: P, G0 Y1 P$ Z6 a1 r7 w. y1 o

5 h9 ?0 E4 h: E: m/ j/ N* e% X9 i__________________________________________________________________________
1 ^3 F' l4 c' P' f: i$ b( j% A' i* f! O. o" E9 q
Method 126 X9 U; g4 m/ ~9 U+ L% b# R
=========+ @, i0 }; ]  t+ l
" b0 L) F# \( ?: [! n- g
This trick is similar to int41h/4fh Debugger installation check (code 05  _* @3 H4 I0 u! ^$ F( t% k
&amp; 06) but very limited because it's only available for Win95/98 (not NT)1 Z( ~: ~8 `9 C
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.4 p" \) E; Q& r4 e% h# d

7 L# C8 l9 O6 \* q2 A   push  0000004fh         ; function 4fh* Z* H& Y, U- ^7 S
   push  002a002ah         ; high word specifies which VxD (VWIN32)
, ]8 T* d% f+ _  I                           ; low word specifies which service
3 P. V- F# f. k. p                             (VWIN32_Int41Dispatch)/ M, w. C( z! b6 W
   call  Kernel32!ORD_001  ; VxdCall" e) y2 n3 x& v8 O3 e
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 A) Q3 M- T& A" [' S8 Z# s+ p2 E
   jz    SoftICE_detected2 H( k8 C1 V& @9 @6 o2 C  Z1 z$ Q

0 u# c& K. S) k6 J1 R; AHere again, several ways to detect it:% c' J  A! e6 }9 Z
! ~) j( v8 W! `- f1 ^! i/ E  s
    BPINT 41 if ax==4f
8 ^" ]+ D9 b* G1 F. U2 b3 _, H. t  \  w+ J$ @6 `  ]& U: |/ J
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 H7 t, P2 |' I9 b$ J( a* X. b+ d$ q! i1 \: x; P6 c8 K* c2 c
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 S0 W, e4 Y$ m9 L! I2 s
! b1 W1 w0 ?; s! b8 C) L7 ^$ ~: Z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
, [5 e4 i8 |6 f; j" s! l9 o7 e
9 v( t7 l  V! W/ f) @0 O) \__________________________________________________________________________+ b/ q8 ]: Y0 b" q) w8 l

7 a: Y" F; a1 N* i% C5 S# aMethod 13
8 `2 W" Y% g. o$ m5 q7 q=========: A+ }0 `7 [; e! f
; i% ^% `2 C' a% h3 q
Not a real method of detection, but a good way to know if SoftICE is
( }& R' l% N, o/ V* Hinstalled on a computer and to locate its installation directory.2 R7 _  ~% o  `
It is used by few softs which access the following registry keys (usually #2) :5 P) T! V- i  U6 D
& g/ a5 |0 \  T5 t) ?; e  |
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" b7 @0 m  G& Y+ V  f
\Uninstall\SoftICE
% @* O8 L7 t) R" D1 G! ?-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
  A9 B2 K/ V9 i% a! Z* R-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# a( [7 p1 t4 l$ C9 m
\App Paths\Loader32.Exe
/ z( I% n) s4 u. k9 I' _" T5 B* ?) s6 X' X. J) o
' s* j+ M9 F* P- S
Note that some nasty apps could then erase all files from SoftICE directory
* |* i4 T* k2 M, F; a7 X(I faced that once :-(
% @- B" _) E: ^3 `& b! x
% [. h8 v+ K) j; fUseful breakpoint to detect it:
# q( h( H3 Y2 `: b! y+ c/ {( A, D- Y( Z, l( T0 _2 n
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 c6 g2 a% n7 v  G7 |+ P
2 I: ~8 @6 Y% C__________________________________________________________________________  e/ A# n6 K( D- W- D- M

) Q$ n* p1 S" {
. t! D) u3 ~* k1 BMethod 14 7 o, Q% O( X; B: V, _* R
=========9 j7 Z7 Y$ u- |7 J# {3 c# g% S
7 Q# `5 a( @: _! D
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 i1 t  f+ x( I) A7 k* N  J
is to determines whether a debugger is running on your system (ring0 only).: s% @- _* H9 S

: P1 R* F" M- {# }! s   VMMCall Test_Debug_Installed
7 Y# u& l6 }  ~3 {/ F; Y5 n   je      not_installed
% g( l3 u. }0 f2 L
3 s; _2 L( `0 y$ U. B& {4 OThis service just checks a flag.
- x5 y7 I+ q7 p# \; k2 r" d) s  t</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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