About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
: q% x) ~7 N6 I: O) c) H( |7 ^0 O4 ^<TBODY>
/ g6 @4 l! v3 Z& X$ `  {<TR>
! Q+ j5 f( X9 u+ K<TD><PRE>Method 01 5 h# v) A% K6 F( j$ R7 P0 \. R
=========0 a3 V" f, W! g0 K! }; ~

" _8 g  u2 M7 B( a" F/ RThis method of detection of SoftICE (as well as the following one) is( t" n% {& @/ f& v8 P/ `3 e
used by the majority of packers/encryptors found on Internet.+ m1 A* c1 U* k! J1 G  m9 r' F+ L3 T+ b
It seeks the signature of BoundsChecker in SoftICE
9 w) }  h3 T; v3 Q; N; n" m9 t+ M
    mov     ebp, 04243484Bh        ; 'BCHK'9 G  ~! m  c8 [3 _
    mov     ax, 04h8 k  w9 r5 x3 @3 z: o/ H5 ~. ~4 }
    int     3      
. u& S. t0 J4 Q4 t! j    cmp     al,4
% H" @; h3 P- d4 w0 s4 S6 W! q0 R+ T  r    jnz     SoftICE_Detected
. g# I1 @" ^: b" Z3 j2 c3 p4 c: |9 D" ^/ n* [# z
___________________________________________________________________________
9 `, h# c. P' h# W1 p
6 r$ @/ u" G! _: o% c; lMethod 02* [" ?) w0 z! i
=========
, \5 K8 u: I! V! i" K0 w2 B! s) u6 C' O/ O4 Z
Still a method very much used (perhaps the most frequent one).  It is used
3 r9 @& W) o2 S: g6 l" cto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 T# h+ w. Z" L* F# L; u6 ior execute SoftICE commands...& X( P$ ]4 }# ]- [' K
It is also used to crash SoftICE and to force it to execute any commands% h9 M  Z0 k  U1 |
(HBOOT...) :-((  
2 [' ?$ s, Y1 I4 [2 Y$ ^, N3 N; O  {$ {: p4 i
Here is a quick description:' k2 N% D' h" R+ }
-AX = 0910h   (Display string in SIce windows)5 ]8 f; u4 F0 o' `% y* \5 h
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)' M' u8 T, X$ w' R- W5 O. T$ O
-AX = 0912h   (Get breakpoint infos)
: I: g9 G7 c5 h-AX = 0913h   (Set Sice breakpoints)
0 Y# A* m+ B( a4 u-AX = 0914h   (Remove SIce breakoints)1 ?: r* x! C* F( R+ G# m

. F& {. T0 b1 P5 [. Y) y- XEach time you'll meet this trick, you'll see:
. i( m% P% o; h" G-SI = 4647h: P8 _+ F  q$ p( @* b4 c1 Y3 x
-DI = 4A4Dh( `& `( d9 h1 H, D
Which are the 'magic values' used by SoftIce.' z/ {2 P* D# s9 t8 ~7 m
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 q8 G+ R* g8 @7 @$ \
7 T* [5 n; i% U
Here is one example from the file "Haspinst.exe" which is the dongle HASP/ j% E. s) h2 v  |$ q
Envelope utility use to protect DOS applications:
1 l( h+ y4 ^. x" x! d8 Q. Y6 C7 C  Y( d  N2 K2 [
6 C  _" E; e; |* @1 z: }8 o; a
4C19:0095   MOV    AX,0911  ; execute command.' ?9 B4 D( d  I1 I3 C0 C
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).& b6 u6 N0 P9 t. G; J  ~
4C19:009A   MOV    SI,4647  ; 1st magic value.4 p0 v' h9 y( W0 ?9 L
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.+ z' D& F; p3 o- L5 N
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 W$ b: |3 s" J% F6 K. `
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 j; c. X, `6 t4C19:00A4   INC    CX1 X9 A2 G. i0 H$ g
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( R/ A' w- e4 s4C19:00A8   JB     0095     ; 6 different commands.$ Q* G# m1 o5 S5 K& y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.. {' l7 n! {8 m" Y( {2 D  _5 K
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! C7 ]- P4 f8 P3 V! }. L7 Q
, T. x. K8 X6 F1 |0 p
The program will execute 6 different SIce commands located at ds:dx, which8 z$ |* Q0 ~! s! b4 d0 w
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
$ M% ^( Y/ f( ^, I# U& H
4 e7 t0 N7 G* a! v0 U8 }- i! y* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
0 V* [$ @+ S6 Q& Q  E) V___________________________________________________________________________& ~' r1 s2 w4 {1 s. n5 J" }: G: b

/ Q6 S; D$ r. E. a- a% L; s" r1 h  Z1 C4 w- A) S# A% `
Method 03  Q" D+ n; {! M6 @3 X0 _
=========
$ |# h7 Q4 @! W; N% e; S
1 T! M5 ]+ S4 I: T. G. zLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# |' K. v$ Z7 ]5 q(API Get entry point)
& \8 ^) O  \. O/ h6 \% I+ s        : m( M0 K3 }% |0 Z
* {8 c& H' v0 m7 ]1 U" B1 E
    xor     di,di. p2 s( B! y" g$ U: Z+ n0 ^: c
    mov     es,di
( _1 e& S7 c- S- |3 f    mov     ax, 1684h       4 _! S6 O7 _6 d6 s/ k7 o
    mov     bx, 0202h       ; VxD ID of winice+ d! g: @7 b; V6 Q
    int     2Fh
/ P* P5 [3 v4 v/ L    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ I6 V  {# K5 W2 T& x# C4 @
    add     ax, di
3 n& I+ J, L. j+ e& V/ g    test    ax,ax
( o) n' ~. G; L5 `# {" A- O    jnz     SoftICE_Detected) D2 b* M# S! ?3 D" v

# L# W5 S. E; }___________________________________________________________________________' g0 d/ i' p$ R9 l' B& H* G

" X! D' ^& i9 v9 A8 G# SMethod 04
) ^. ?; h1 n4 a1 F7 W=========
; O9 d" ]5 w4 a! M
$ I9 R- `. E* Y4 q' M9 f/ CMethod identical to the preceding one except that it seeks the ID of SoftICE
8 L+ s4 q1 K3 r& S& VGFX VxD.( j+ d2 T) }% m+ j

9 S6 x5 Y( \, Y9 M+ H! T    xor     di,di
6 @2 a- j8 _' I# f! d2 t* u    mov     es,di
' l9 X# ~! M) ]7 m    mov     ax, 1684h      
0 }2 O; Q, Q, t0 P* G- M3 f    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 K4 `9 A/ z  b3 O7 z
    int     2fh/ f! w1 l/ `: y# x5 I, f8 X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ _0 b5 Z# `" L* }# U' v, j! k: y
    add     ax, di
  x4 h0 p$ H0 U1 U. Y* f    test    ax,ax# J" q$ R# j2 F8 k0 ^; I5 I
    jnz     SoftICE_Detected
- ?$ X9 v; G' }' U* n: E+ C2 D" h
" l5 z% |0 }, {9 y* t  [0 ~__________________________________________________________________________6 b' N. X9 G9 Z% L2 H
+ y3 i+ B& X, i6 A4 ?* }$ ?! s

% x# K, f$ ^3 v7 C0 EMethod 05. i* h0 _8 K6 A, S& o% U4 p
=========
! f! \0 u1 {% c* w. C- a% a; W! a. x8 A/ n- F/ E, M
Method seeking the 'magic number' 0F386h returned (in ax) by all system3 y7 Y& D; U1 m' }- ]# b  D
debugger. It calls the int 41h, function 4Fh.
  u$ L# i" r+ A% m$ {+ a( T/ T- }& WThere are several alternatives.  . y9 V0 }9 Q, m7 Q2 D
% K! |$ v& U0 j/ _7 K( |
The following one is the simplest:5 [! O- j% R2 t6 p% ^  }( G4 p& @0 \" r
' {, l4 v: v% P# D6 R+ A6 `
    mov     ax,4fh
( e' `; D) J+ u8 w( n    int     41h. P8 k1 v+ p1 e9 f* M
    cmp     ax, 0F386
4 X+ N! u2 Z+ f! N* y: h, ^8 n    jz      SoftICE_detected
' p) Q- A+ X- ?* z$ q  `+ z0 p' P# x+ n) t6 V

7 P- t" A$ S- t6 j  l* QNext method as well as the following one are 2 examples from Stone's
' h) d/ Q9 c) j6 S$ p"stn-wid.zip" (www.cracking.net):
3 S" ^' g. T2 H( r
- {$ q4 r8 D( M$ \( U0 {( Q7 z  X    mov     bx, cs
9 r/ k# p/ |. K6 w, N    lea     dx, int41handler20 f" F9 q) J8 O7 E4 R$ @& [. W
    xchg    dx, es:[41h*4]
: [4 }4 e" f. @& Y    xchg    bx, es:[41h*4+2]
( Q4 O2 }! W8 y' ]! N3 L' \, s& M    mov     ax,4fh
$ q- l) M0 w( x& {9 C' a4 E    int     41h
1 o4 ^! B% J8 e( G8 V    xchg    dx, es:[41h*4]
  G. k* z2 G7 _8 I( s  e1 z5 D    xchg    bx, es:[41h*4+2]3 d  C/ v+ N7 t7 J
    cmp     ax, 0f386h6 K8 x+ g# ^% i" S+ x# R
    jz      SoftICE_detected
7 a, d; n- R# `. u
) W7 d% t) z/ _8 n3 V( z( y- lint41handler2 PROC, J4 x0 m! [; z9 S$ i
    iret( b2 {! l% Y/ c
int41handler2 ENDP: Q$ @& J5 Z" Z/ p, B! ~
0 G5 G6 s' w5 `* i
0 t7 C/ U# X* L# w: S$ I
_________________________________________________________________________) c- |* ?7 M& J1 G  ^

. q; A& y& B9 I
7 T/ ]& m8 }+ ^7 W: VMethod 061 c  E: F, o  l; S3 M
=========8 m" b- ~8 k6 B, V' e) D! d2 x. D

  ^0 Q0 x- G* T0 ^1 S# b: Z4 G, Z3 s# o1 {) e8 g  \$ S" ?8 u
2nd method similar to the preceding one but more difficult to detect:
5 ?0 r. N& b" G% L- S- f4 W7 `8 F0 O  v( O8 }1 Q6 R: i* A" S

$ \& L* h3 O7 H# w, b  \) xint41handler PROC  J7 T" F; t& ^3 F; o$ [+ N. j! M
    mov     cl,al6 {% p! b" K& ^; x6 M1 L) f3 X+ \
    iret
* a! g: E0 s9 b( ^int41handler ENDP
7 E6 S) Z+ G; Q3 i, N
' ^* B. J) _7 o, g$ ~" x8 s& J$ _( z/ K
    xor     ax,ax
! p. C/ z7 H" Q' M    mov     es,ax2 B& C; X9 N: W+ C0 L
    mov     bx, cs
% V9 q1 O2 [1 h/ H$ p  @& {    lea     dx, int41handler
. h, m1 F: C: G6 f5 e! c. \    xchg    dx, es:[41h*4]& y1 E6 a* q- {. a. \' L2 P$ A
    xchg    bx, es:[41h*4+2]
2 A& `$ h& M& `/ A  s8 M    in      al, 40h
8 e* z- h; O- B, Z1 h* c( |. N7 m    xor     cx,cx
" {3 f7 ]5 h4 a& \+ e    int     41h2 Y+ }. O: G1 `- K
    xchg    dx, es:[41h*4]
$ }: s) m# T0 o7 B! F9 a    xchg    bx, es:[41h*4+2]+ s, v( z7 E) r
    cmp     cl,al& z% V. v+ C) _7 T6 {0 D
    jnz     SoftICE_detected
3 O8 i" Q4 T  c' V
5 n- i9 ?% B5 u_________________________________________________________________________
2 J1 ]: x6 X# P+ X- X% z  z
/ V8 Z: I; x. |- H- }( y' lMethod 071 T) W6 _) F5 H2 h
=========1 m6 f8 ]/ a3 N5 _8 L8 S& Z

8 ?% Y+ L- I4 q& m; b+ u) yMethod of detection of the WinICE handler in the int68h (V86)8 q$ U# d/ B5 R! N

! I8 c; i; l/ O1 q# @/ I    mov     ah,43h  l- x" G! p( w& R
    int     68h# g7 l& c9 _3 E0 ~% f
    cmp     ax,0F386h/ @+ N  |& A, b7 b& ^8 n
    jz      SoftICE_Detected
# W# ^' r  e% x* E* t/ |
" F, _. d) N! G* R* R4 K
4 ~5 G+ @7 ^1 B* I, `& x; ?( ^. }  H9 S=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' q/ C* M8 N+ E
   app like this:
) {* H: x  o  Q- z0 Q
2 c) C8 t7 V* P/ |; A   BPX exec_int if ax==68
3 F+ r2 X/ G3 p   (function called is located at byte ptr [ebp+1Dh] and client eip is
1 I) v( d$ U8 l6 M5 j   located at [ebp+48h] for 32Bit apps)
, V& q+ T. N( o  c, a$ R: c7 @__________________________________________________________________________
7 x# h' u' D- ]9 S4 E; Q' T. X3 G( r5 }! e; t
: K3 ^8 f2 m4 k: B
Method 08  h1 t- G* i7 E- x! z2 c
=========
* v( K3 w9 \7 ?7 d' Y' s
" Q0 F1 ^$ G" K1 f) [( q3 s* P* o3 fIt is not a method of detection of SoftICE but a possibility to crash the* T$ [7 L- x) }$ V5 v4 h% w. A5 C( }
system by intercepting int 01h and int 03h and redirecting them to another
, l7 ?0 a% A7 G& P& ^routine.
! A  U% B& O4 S  A# XIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points  v; R  z, M3 m: s& R: s
to the new routine to execute (hangs computer...)
9 L' B$ J' l5 L! `# _4 b. e/ Q0 a
    mov     ah, 25h7 h9 m" p; z' V8 y1 O- g/ ]- g
    mov     al, Int_Number (01h or 03h)
; _( a% n7 F" E    mov     dx, offset New_Int_Routine
* p8 b, v( h, A4 T: j- m    int     21h( e" {1 E$ y6 ^: Q3 E& s
( F! w. d0 H' L- c" o9 G' _0 v6 ^- U
__________________________________________________________________________
3 x/ w0 M5 s  E7 ~
% [+ u- o; m7 a8 x9 G9 |5 x8 iMethod 09
# Z+ o( H6 ]! s  ?$ R1 j/ Z7 {6 }* p2 A=========$ i5 u0 W6 z% [6 G  `3 b

1 {3 U4 L& o4 M2 i. d% X" f# DThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
. J% W& ?, b/ _: gperformed in ring0 (VxD or a ring3 app using the VxdCall).' T! [" M& ?4 O5 @% Q! x4 n
The Get_DDB service is used to determine whether or not a VxD is installed" L" R- e! I( R9 z
for the specified device and returns a Device Description Block (in ecx) for9 G: y, K, T# L
that device if it is installed.
' [( Q$ b$ C; N3 l1 Z" Z& _4 ?- V, H, {
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 w$ n( n1 Q8 [. U5 K3 Z& J9 I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
) K5 B6 |  Q5 F2 r# G: M7 z+ s   VMMCall Get_DDB
  ]# `% Z; t2 {   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 W. U" G* r9 o8 A' j

/ c; N7 I' v0 UNote as well that you can easily detect this method with SoftICE:9 |! j! I4 o0 p! J: Q4 Z- n/ y
   bpx Get_DDB if ax==0202 || ax==7a5fh- l3 I! j( O- W* ]" T

, N* ?: ?' v+ E6 u+ ]) |: N# t0 D) @__________________________________________________________________________" c7 [3 }! ?$ |8 j
) k2 i; n* ], g* M* A
Method 10+ b  {' u( i0 H: d6 r$ C
=========. S$ W) f. w, n8 z* y: W. z

% d$ D0 N# e. l0 h! b: _# u9 L6 C=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 m" u* x# ]! }6 m2 L& i6 p
  SoftICE while the option is enable!!
- v- H) E' M* M6 b; H# x
+ l$ M! q* m  r8 L8 B2 X# D( cThis trick is very efficient:
! d0 J1 C: C$ oby checking the Debug Registers, you can detect if SoftICE is loaded
0 e; l8 u$ L; w( I(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
& n! f$ F1 G4 ^there are some memory breakpoints set (dr0 to dr3) simply by reading their8 Y+ S7 c2 k( |9 z/ [( L7 e
value (in ring0 only). Values can be manipulated and or changed as well# o2 }8 \# c) X7 O
(clearing BPMs for instance)( C" W4 }/ u7 X

$ z& `: `/ r+ T& S' \1 e9 U__________________________________________________________________________$ n3 B# O  e1 X  r: m6 L) Q

: {5 S! u, I- |Method 11; J( `* X: t3 H  K7 v
=========: t5 c  {; @& N" _

1 ]* P. K4 p0 c  T) ?) _! ZThis method is most known as 'MeltICE' because it has been freely distributed
9 ^! B5 W) H  j  ^7 ^7 y9 Z+ q' ^via www.winfiles.com. However it was first used by NuMega people to allow
( c2 {# G% Q. J4 w' [2 }, w2 iSymbol Loader to check if SoftICE was active or not (the code is located3 C; X& `* l" t, _) N6 w$ i4 d
inside nmtrans.dll).
& O6 Z- ^$ ?: c: _: o. M
3 o9 u  \8 l6 X) k* S* nThe way it works is very simple:- s0 }- U7 J0 i) E9 ?# ?
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
, Z1 |7 }1 i' A" u! tWinNT) with the CreateFileA API.# W- b9 G; D& d
9 E) R: V5 x, i3 ~1 v$ k
Here is a sample (checking for 'SICE'):4 a) J" n; c% E) b& g
- O( P  `. |4 h+ P
BOOL IsSoftIce95Loaded()
( b! Y& K( _8 A+ r: R) @$ _{. I7 z9 \7 ]% I
   HANDLE hFile;  0 i( U# K. D! M$ ]$ y7 c+ h/ w* `
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
9 [. n+ y2 r& I                      FILE_SHARE_READ | FILE_SHARE_WRITE,
; \& W/ n6 b4 n& |5 n                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
, C3 b, n7 ]. l   if( hFile != INVALID_HANDLE_VALUE )
" U. r5 i: G+ n% X7 ~   {8 H) ]+ P. q* N! V& P- |
      CloseHandle(hFile);
* }9 Q" E/ |% Z/ N1 o      return TRUE;
) w# j; f* n! P( U! _   }2 Q4 m2 d; |% @( a: Y; }
   return FALSE;
; j0 [% ]$ k& B2 ~" \" M) X# g}
# U+ S# {  v. X) ?! P, V8 k4 L- s, d( t4 G
Although this trick calls the CreateFileA function, don't even expect to be% q/ p% b7 r/ N% ?) z, C' S$ r, Z1 E
able to intercept it by installing a IFS hook: it will not work, no way!
% x4 r  L: l+ x2 M( C1 j& UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F. I+ w" Z8 @5 {3 W- ^5 B
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function): G+ a  U0 o( |0 h
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 b9 c7 @5 ^3 s8 ofield.
% W1 \6 m2 M% D1 W) W) w+ XIn fact, its purpose is not to load/unload VxDs but only to send a
0 A6 e4 G. e, c) LW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 {, k1 U7 @5 m0 O* A2 W1 M  C" pto the VxD Control_Dispatch proc (how the hell a shareware soft could try
* y$ A2 t* x* Q* ?5 ?, Uto load/unload a non-dynamically loadable driver such as SoftICE ;-).( N9 ?1 c4 D2 A3 z) L& G+ u2 m
If the VxD is loaded, it will always clear eax and the Carry flag to allow" m: S& _7 _( \5 }  C: T
its handle to be opened and then, will be detected.
2 \7 w* V6 I0 W* k' lYou can check that simply by hooking Winice.exe control proc entry point- K( Z6 u, a0 R9 A$ u
while running MeltICE.
$ S8 U8 q  ]7 P$ z# u5 K, U* B$ z# }, ?0 s& O& p5 }  T
0 T5 v$ H. N4 u; A+ p
  00401067:  push      00402025    ; \\.\SICE
0 @& F( t% Y% V( s/ p  0040106C:  call      CreateFileA% d! k- s$ M; ~0 ~; \) p/ I9 F$ z
  00401071:  cmp       eax,-001" N( T; v" p0 N
  00401074:  je        00401091
, \3 [7 Q2 `1 z
; t- Q* l% [: ~* O4 ?# ^5 X; p- n9 W3 [4 |( E( D
There could be hundreds of BPX you could use to detect this trick.' w! V# n+ s: R% T, `: }
-The most classical one is:7 @; C: r3 e. h1 n  s! Y+ s
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ J  h/ i6 {" s! ?8 o6 ?( ]
    *(esp-&gt;4+4)=='NTIC'
# H9 f, T& b+ z
+ a6 V5 D: Y; r$ E% C8 `+ w-The most exotic ones (could be very slooooow :-(/ Z4 i; ^1 k4 g7 L! P
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- f' _4 R# v* }9 V: Z     ;will break 3 times :-(1 W5 F2 C, C1 h+ K
4 E* U; C7 d( U# W/ [
-or (a bit) faster:
+ O7 j" L$ s: z) q* {   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): Y: [! G7 d& t* {+ Y" [/ ]! s
+ K- f4 n& L! G. ~% |
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & K( R  a( E' G# z( E, Y# j
     ;will break 3 times :-(
6 h. w' @& M2 C" ?, b' k7 R. a" K# s) m+ o5 L, F" R
-Much faster:; U  ?: e" B) |" H
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ n5 o" K; c6 o- s3 k

% ?. N6 @3 n4 G- U) P. UNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
6 Y+ N8 G7 K" q6 ]+ [function to do the same job:
# u: b) }3 i* l5 t' ?6 _
0 A; o' _5 S$ E& a   push    00                        ; OF_READ
3 n2 V+ t3 t# h( d   mov     eax,[00656634]            ; '\\.\SICE',0& u0 X7 f0 d0 v- Q' ?
   push    eax
) p8 B3 Q. m5 g. L- d   call    KERNEL32!_lopen) a& Q8 S7 m5 L* G
   inc     eax/ u1 L8 T0 C- O! U2 h  p+ c
   jnz     00650589                  ; detected
1 j5 t0 M: d# D, g% x' g   push    00                        ; OF_READ! q' ~  \$ `# P7 o7 B
   mov     eax,[00656638]            ; '\\.\SICE'( L! {  K8 e8 d
   push    eax1 b3 V. e; `( K8 P' a+ z4 W
   call    KERNEL32!_lopen3 f. p% B. D7 H" n+ c
   inc     eax
' x2 m$ C3 g  R3 z   jz      006505ae                  ; not detected7 N: o" [" N, G

- {& I* R1 x) x. Z. [5 _* P7 c: E  f4 c4 B
__________________________________________________________________________( T0 J7 F4 }- [3 e
- X7 B  x% G0 q, @/ o9 I
Method 12
' b  N- X& N3 g=========+ r3 q8 E, J# B& Y- S; O- ?) x' j! k
0 F2 |" A3 U, D: ~" ]1 ~
This trick is similar to int41h/4fh Debugger installation check (code 05
4 s9 I, ^$ `4 c* Q- A. R7 A&amp; 06) but very limited because it's only available for Win95/98 (not NT)
& T* Y# \" h' n8 y* g. E8 q: r2 \as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ p6 Y' y& ~+ o0 v
# z) a. h* Y- [8 M   push  0000004fh         ; function 4fh5 u& w% X4 G; S
   push  002a002ah         ; high word specifies which VxD (VWIN32)
" v3 u4 V* I: L                           ; low word specifies which service7 P. K" \9 ~, e& M1 w( |! j
                             (VWIN32_Int41Dispatch)
. j& M; a5 P! T5 e3 {( ~   call  Kernel32!ORD_001  ; VxdCall
# s/ w3 o* b; I: V: p   cmp   ax, 0f386h        ; magic number returned by system debuggers( ], }  B: r" p- _  @1 K
   jz    SoftICE_detected, N8 f& B: ~# ^+ N7 _% j5 m+ ~
4 q. ?) Q$ w# }' w' z
Here again, several ways to detect it:; v( o) b0 x* p2 C* }% ^4 W: t

5 k3 B- m& W" d4 b! v    BPINT 41 if ax==4f$ I( [' F" L; \4 {5 e5 ~

& ~' U  d& u; d" M. |/ D    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& k/ [0 B0 [8 m& d: E% |- i
( b# B8 D# ~% Y9 T  ^" D5 n    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ s" d; H3 l/ j: Y% }4 B# q& A4 s  \
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!: c7 J: ~- L, J2 t, @
" w$ @! N3 i# F( [2 f7 h" U
__________________________________________________________________________. k! z" B0 R; [. j
+ l7 K  a; r. g4 V2 ]
Method 13
4 i* \8 e1 m: d' c  E=========! ?  z, I7 B- C' d

& f' x5 \( ^6 ]. `. W0 jNot a real method of detection, but a good way to know if SoftICE is. ?3 K, ]- `* l$ w, W
installed on a computer and to locate its installation directory.
# x  a" T2 ]" B* D4 VIt is used by few softs which access the following registry keys (usually #2) :
" g% @8 _; h& b) H/ y9 k9 J# r3 F: W! @( V+ E, |! o; s
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 `; @$ I: {5 \: w! u' |/ J+ c
\Uninstall\SoftICE
  g2 ?" s4 @, s& }- v* C( [-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 ?, T1 X! j- E2 t# I. T-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* r3 f4 L, C1 \! }3 p2 c2 q
\App Paths\Loader32.Exe: j8 \% G$ d. ~9 g
: q6 E  q6 d7 l( C, P% s7 p
  M) [% s8 H' C
Note that some nasty apps could then erase all files from SoftICE directory$ S! f4 ?( [1 B2 Q
(I faced that once :-(
1 h, c- ], I, s. f! ?1 u
( L- e! U, _3 Y# HUseful breakpoint to detect it:
, S5 p' O/ e1 y6 k# K6 z3 E6 _9 f5 H4 C( H  D: w" Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'" E) d2 b6 K2 f* V" a) T! E4 u4 i
! ~) I4 [1 p" v
__________________________________________________________________________9 v5 R5 ]5 S. S8 x% T/ l

: n  K) B+ d1 W4 m+ y7 R8 m0 M: n" ^/ M( R' o& b2 a7 h
Method 14 . g8 F, _, [0 o/ m, X
=========5 d* g7 n2 U0 Y! a

. y. x# [/ \0 u9 Q( Y9 \A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ s" h3 \! e( @1 a. Kis to determines whether a debugger is running on your system (ring0 only).3 m! G' C. r1 p, A5 k) Y% d' J
' T3 ^" _* `2 N4 o  K$ j8 M
   VMMCall Test_Debug_Installed
  w- N0 y! K* R   je      not_installed% E. q1 ~: y$ U' e* ?

9 `# D. O9 F# A+ m6 @' k% `This service just checks a flag.8 ?, m3 S- J  z
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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