About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>, j+ n* z) D  b& ~3 @" h
<TBODY>
1 h8 T4 ?0 Q( F7 [& d9 G+ t<TR>+ U7 C% H  M' I" z) C5 x5 ?
<TD><PRE>Method 01
- X! f2 `1 p- h5 H# e+ Q=========# O7 ?$ r/ K6 d  @

; T0 d$ A# }/ \( x# k8 W' nThis method of detection of SoftICE (as well as the following one) is
9 V, B7 D4 }, R7 Sused by the majority of packers/encryptors found on Internet.+ E# z% h9 H- U: F
It seeks the signature of BoundsChecker in SoftICE
+ K# k% y/ E" b, g9 ~( Z# I& u0 b5 K! q7 N
    mov     ebp, 04243484Bh        ; 'BCHK'7 C3 U" p$ u! n- i$ n- J- C
    mov     ax, 04h) v: g$ x" u$ X7 |  _! t
    int     3       " d3 |4 {! }8 R7 f
    cmp     al,4! [. r- D# U* [$ s5 ]+ y" g' _
    jnz     SoftICE_Detected/ q9 j  k5 E7 n& B

3 S$ `  P$ ]9 P___________________________________________________________________________
' V7 u6 i% f  u7 t
7 g8 m. }/ F" U2 {3 ?1 C, aMethod 02
4 k% a5 g: z0 w, ]4 h( X- [=========* J$ D9 x  g( O$ d

+ C3 m( ~# n& x9 v! G  F' R6 UStill a method very much used (perhaps the most frequent one).  It is used* b% Z' H& u1 N0 B  Z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 E2 S; w1 b' ?1 X8 \or execute SoftICE commands..." B9 r2 E$ b; c3 W1 J7 J
It is also used to crash SoftICE and to force it to execute any commands
0 g! i4 |+ h( w8 \+ U# S& ~$ k% e(HBOOT...) :-((  1 C! H2 S5 x6 [4 {' S! l$ B- N
' \$ |$ l7 N! }7 G4 ~
Here is a quick description:- r& |% |/ J4 ~) L( N/ [; o
-AX = 0910h   (Display string in SIce windows)4 ~$ W9 `2 I0 y6 r1 h( M
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# \9 {7 q5 u( v5 Q% @$ X-AX = 0912h   (Get breakpoint infos): M4 R$ U9 e1 j2 b
-AX = 0913h   (Set Sice breakpoints)2 b- |( w* U1 o( O  A
-AX = 0914h   (Remove SIce breakoints)  E% I$ B! G- A0 r4 R4 W; q
6 J! M6 w! S# T  Y  l9 V
Each time you'll meet this trick, you'll see:9 A; ?" D& t( I
-SI = 4647h
9 m; ?; J  W! t; C$ x, d-DI = 4A4Dh
2 t1 }( I: Y6 b5 L" JWhich are the 'magic values' used by SoftIce.
; W7 Y$ i+ G# k6 n  H6 vFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% n& w; M. v' O* k( q4 F& O

4 A' K" {8 W; r( f: T+ YHere is one example from the file "Haspinst.exe" which is the dongle HASP6 B7 ^0 m) I+ O2 w
Envelope utility use to protect DOS applications:6 y  [0 [2 ]  m# {+ \

- Y+ H1 I0 D, B+ s! O/ o' f' L1 K( \( o
4C19:0095   MOV    AX,0911  ; execute command.
$ A; \0 m0 m. }" K: R5 w4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 ?  k: J- t0 }$ c* J
4C19:009A   MOV    SI,4647  ; 1st magic value.
1 v3 W2 z/ p! c' |8 l. l- X% y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.* ^) H# O4 G  @  n! a
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 }" _) s3 C: Y, A! _
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
1 @1 m( C0 Q$ E( P! p2 |4C19:00A4   INC    CX
9 j  i: }8 j8 K8 }) h$ z$ ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" y) \+ s+ a' s4C19:00A8   JB     0095     ; 6 different commands.
5 h0 r$ P( O  S* K9 i' x; H2 Y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' F3 c" P- ~/ T. y. y  D4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 ?* Z. w( J$ h7 O: z- J
& y! G5 X+ Q" B2 A0 n5 S: L# EThe program will execute 6 different SIce commands located at ds:dx, which) a+ ]5 r8 K0 A% z# }' w
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
0 ^' d+ P3 J6 L. I
0 _. h, v$ ~0 J* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* F, d% B3 g4 D. X9 r7 O___________________________________________________________________________
  o4 Z+ b! K! v* ?8 v0 T# }4 ^+ \( U) y7 L" _) ~7 h) }

! Z9 p4 F7 ~- D0 v/ c6 m5 RMethod 03; k  f7 `" J' u& H! E  c  {( |7 T8 _
=========
/ x: s) z. {) S  ~$ R- r0 d; _( `/ A0 e8 v
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ x8 J$ P+ o9 P2 W. `8 T
(API Get entry point)
- r3 e+ m$ c/ W        
' G. z( L) n6 w+ H* t9 Q
6 c* r1 I- X1 w4 R$ @" I6 t1 z' W    xor     di,di
6 G1 M2 c* X3 G% U6 f6 K+ e    mov     es,di& ]1 j! L* f0 K5 k  d
    mov     ax, 1684h       7 ^: [" |( u# s4 M
    mov     bx, 0202h       ; VxD ID of winice
  Z1 @& \6 Q) Z  T' V    int     2Fh
5 n4 `. a4 q% h# c, o) h    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 [; `" g/ H% u; {1 J, a% o    add     ax, di# o5 T8 W$ B8 E2 o
    test    ax,ax
* X* O, Q. b1 j1 x; `7 F& Q/ Z    jnz     SoftICE_Detected6 o' b8 c+ n/ J/ O: J
7 p, o( I# g) K& s" X3 \
___________________________________________________________________________
9 i. s2 z) q/ V% _# O* a  t" X: H2 g8 {( S" H1 R( r4 x
Method 04, o: z5 O+ ]. r3 |  n
=========' T0 {+ G4 X) c/ t+ l  ^9 |

8 y* W4 G7 G5 z" n, [Method identical to the preceding one except that it seeks the ID of SoftICE5 g* T( A$ v- i5 I! }6 @) u
GFX VxD.
6 w; U8 E1 ~/ y$ T, r& l3 j% z' f5 f2 J* E' W( b: G6 E6 n
    xor     di,di
) W, P7 j: ?/ ~7 w7 r7 @    mov     es,di; I; E* L7 o! T
    mov     ax, 1684h       & x- j: \  j4 v/ M7 B3 s
    mov     bx, 7a5Fh       ; VxD ID of SIWVID. \1 h& u! ~, E) `! e" N* `# S7 t
    int     2fh* N, d7 A4 W# `
    mov     ax, es          ; ES:DI -&gt; VxD API entry point, m# u3 L) Q8 y8 ^& [& {
    add     ax, di$ [" r* g& m1 c8 q
    test    ax,ax; c6 M4 c. A, W
    jnz     SoftICE_Detected
) }" `+ q) c9 M, }
1 o( N' Q' O: D% X__________________________________________________________________________1 Q) H) d' i+ c$ r1 w$ o  \- o

4 T: Z# i8 i/ D7 l: B8 A, j0 W
( \! r8 _  Q* F0 R) IMethod 05, T; Y9 e3 L/ Y) V. A' y
=========! M4 `) p2 m! P, p4 L
/ G) e2 G% Q: k# B9 R
Method seeking the 'magic number' 0F386h returned (in ax) by all system, P* ]) R" A4 N
debugger. It calls the int 41h, function 4Fh.
- [- k7 O3 |6 IThere are several alternatives.  
- r2 P5 t0 x! v  c; K& Z$ ^5 H$ D6 i4 K& t7 \( g, E
The following one is the simplest:
( B* `% c) N' L% ^' j+ O! K
" y( G0 z. E2 C5 w# E5 i! U    mov     ax,4fh# {* h2 v( c& U# S
    int     41h
8 R# [! q9 }, i9 m3 p: {7 k    cmp     ax, 0F3861 b% w. a( O! Q! I- e
    jz      SoftICE_detected: [" j4 t8 x0 X; g: K! k. C, n
, x$ G& }9 \7 ?' \  y6 x% O/ H
! M, H( t& y/ Y+ a0 k
Next method as well as the following one are 2 examples from Stone's
/ I+ c- Q  c. }( m+ d7 B"stn-wid.zip" (www.cracking.net):" j8 M' i* W7 P, M! y. c0 W& }
/ O. T( z9 _$ }' o
    mov     bx, cs- V8 ^, M1 m; w" I0 g  U
    lea     dx, int41handler2
( Q" [. W4 g7 r4 U2 J6 q+ S    xchg    dx, es:[41h*4]# Q# C/ Q* y- c. g
    xchg    bx, es:[41h*4+2]
# A/ z$ Q& }6 s8 S- I' v' f  l    mov     ax,4fh( S" @$ e2 j) k) o2 M+ \3 ]
    int     41h
: D7 Y- e) j1 r; Q) `    xchg    dx, es:[41h*4]
2 t, K9 I8 T; Z7 X* ~6 {    xchg    bx, es:[41h*4+2]
. a  c) ^1 j- W; U8 o    cmp     ax, 0f386h
/ F) D; _7 _: c# w, H4 S    jz      SoftICE_detected& ]! {' L  K& S! f) B% K* }' {

5 |1 i: `0 N' c7 zint41handler2 PROC  P2 ]/ q) [$ D8 ?
    iret
% C4 S" _( ?& Q9 e) Sint41handler2 ENDP
3 T) ]' @+ g8 n! Z+ I, ?1 x( @1 H; A, v
- |; O# l, z  b. Y
_________________________________________________________________________
2 x' H8 L* t' G& a
& w: n& j+ `7 D8 R- ]$ ?# J# B. i8 m1 u/ r
Method 06
8 F" Z( x+ [) I$ B. a5 X/ _5 z=========
, A1 M6 I2 K6 W: V- P/ l, F' }6 l8 V
0 a7 d$ n- G+ a, J3 P; j1 Y
, u  y2 u3 s8 U6 D4 T0 S& Q5 _2nd method similar to the preceding one but more difficult to detect:2 @* \- \  D( M" O$ `

. R# S8 Y' D. w5 O" B$ s% W
, {) L7 B# Q0 ]/ {- d/ Vint41handler PROC
7 V% B' q/ `( O' y8 p+ {    mov     cl,al
( u! o- G. c6 P* Z1 _1 T    iret
7 U$ ^3 l- V  Q0 b( }* mint41handler ENDP; g6 A- h8 a' f5 C# E; y5 l

; Z& \- }( i& f4 _
  x; \/ g! c. ]9 |; k    xor     ax,ax
. u4 y; V  v0 W    mov     es,ax
& Y2 r7 v% Z; D" y) q: u. R    mov     bx, cs3 {" R2 }( w, @/ w
    lea     dx, int41handler
4 I1 @- ~* c4 {' c( v% E4 L1 c* d    xchg    dx, es:[41h*4]
- {" z* J3 {* t  h# e+ Z    xchg    bx, es:[41h*4+2]
4 l7 N$ ]' P. x  d; ^! ?    in      al, 40h
: P" b) U% B& i" W+ v! w( {0 y    xor     cx,cx6 b4 Y/ v1 S/ K5 g2 l9 O8 _
    int     41h/ @, I6 K: @* I! V) p  S% D  ]
    xchg    dx, es:[41h*4]4 u4 J. o9 N; o' Y) h
    xchg    bx, es:[41h*4+2]) {4 ?9 l' j( R$ A- ~" U
    cmp     cl,al
. b, Y2 e3 t: }( q* ^9 `    jnz     SoftICE_detected3 u" P- g8 Y1 ?- _
$ M! X1 p- d$ \
_________________________________________________________________________
# K& C: A' T, p, \% W: a. x( h& Y. |0 C, [3 ?
Method 07
; j% z/ B( I3 t! {* K7 i# O9 R=========
9 s1 Q' j, N1 \1 O  R
/ h( k! V6 _$ S* H" n4 QMethod of detection of the WinICE handler in the int68h (V86)
0 F3 s  ~) T8 F; k+ R
. F7 e4 _. E) j; _    mov     ah,43h! j1 S% b3 E# ~6 T
    int     68h# r0 D2 _; D+ M; H( {# E5 F; r  u
    cmp     ax,0F386h
0 q' o8 U: |% i' O$ Z$ c" x    jz      SoftICE_Detected
7 Z& ~- p0 G5 e* B; V; h0 H1 l  h4 a0 S7 y9 ~

! R. o* r3 D; `+ v' i: o=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ C3 E: Z- A- L" `' W) F2 I! C$ i
   app like this:! p! s" {5 Q- S* Z# }% P
8 Y' ]; K" Z3 F, p0 h6 N0 A
   BPX exec_int if ax==68
; B6 k( s' o! \0 [   (function called is located at byte ptr [ebp+1Dh] and client eip is, {9 q6 h, [' a5 Z2 Z
   located at [ebp+48h] for 32Bit apps)7 v; o0 ?' O% I6 @- c# B+ x
__________________________________________________________________________1 d4 M/ Q) Y9 ?& }" F" X3 \3 ?

: v( Y2 v6 C3 l4 [1 q! R
$ E0 w% [3 P6 A) h' W1 B: _% `Method 08
7 g- s" `: |6 H2 G; g=========# s  `* q" j8 y
# \; }. Q4 C/ h$ E6 G5 g
It is not a method of detection of SoftICE but a possibility to crash the8 t" y& H, s2 p; C( |' p$ m1 b
system by intercepting int 01h and int 03h and redirecting them to another
" ~- E/ {+ u* U% X* Z' ]routine.
) f% [- C. e% _1 z% B  |It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points! b# a2 m# U  c; ~
to the new routine to execute (hangs computer...)* i2 a6 Y. m/ T

4 W2 n( e3 h% _8 r- Z; \1 I' I/ G    mov     ah, 25h
. K: r( x/ _( v    mov     al, Int_Number (01h or 03h)
$ Z) k" a! C  P. b; M  N: k  w    mov     dx, offset New_Int_Routine& ~' ^) V- P2 @
    int     21h
& \% |/ \+ t$ w
& a7 n2 r6 D# i4 w/ ^__________________________________________________________________________% ^! F! V; W* J" ]

( n* O5 R, m. ]( C" F0 zMethod 09
' n" H' V5 l% h=========& a8 ]/ }9 U% P/ c9 n2 i

. j+ @0 Q9 w" vThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" T, f1 P& x, d& g
performed in ring0 (VxD or a ring3 app using the VxdCall).
0 s2 M+ [5 l* J, w7 \The Get_DDB service is used to determine whether or not a VxD is installed
* t" w- N: E) L7 nfor the specified device and returns a Device Description Block (in ecx) for" P: J$ R; o$ A& R3 M
that device if it is installed.
! D) k" U6 a0 [# K- ~0 ?
. U" t0 ^: W3 ]" V# q/ {2 t   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID5 Z* K+ g- R% [& z! m8 N9 t
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 f' R$ A9 M# J6 h+ Z   VMMCall Get_DDB( l8 u) y# y: t  i
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed) O5 \# c" `0 A7 B* p5 E# ?+ e
# c: t8 [/ g  K6 m* O1 S7 S
Note as well that you can easily detect this method with SoftICE:
" |' h0 W$ i- {% ?2 M8 A: k   bpx Get_DDB if ax==0202 || ax==7a5fh
* M" b8 Y/ @# h5 ?7 p( `+ J/ V3 H1 r, R: a1 I. p- `
__________________________________________________________________________
# n: U& w% I' n7 R0 a! D9 s. |+ H8 o2 R. v8 T* @2 \
Method 10& E9 T) z2 c( r' O5 Y8 J
=========' m, B1 }+ W1 Y% p" |0 P6 t; N) [

% q8 I- _5 D! T; k=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ y; G, l; }; h! t" J  f0 i  SoftICE while the option is enable!!
: N4 t% r; K% v4 E: j0 y* ~- ^6 @/ s/ q' F
This trick is very efficient:9 L- u  R9 N& @
by checking the Debug Registers, you can detect if SoftICE is loaded
) s9 U# c! n/ f4 y2 G  p(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if+ p7 [! G, Q8 r, e" U4 ]. Y
there are some memory breakpoints set (dr0 to dr3) simply by reading their' C# X  ]. O" z2 k7 m3 m+ j
value (in ring0 only). Values can be manipulated and or changed as well
/ @3 G; O2 Q2 ~(clearing BPMs for instance)
/ R7 j7 T( ^6 c& D, \* g1 G; \- \1 E) y% x) h( D
__________________________________________________________________________) l1 e$ C' ?& l8 B
# i9 A+ R7 Y0 O; Z; ~4 E7 v
Method 11+ C9 J, j- m8 x9 m, g' e% Z+ p
=========5 c- X0 n/ v3 I* a
* m, S6 d+ w) Q: r0 \! Z
This method is most known as 'MeltICE' because it has been freely distributed
- F& l/ N. ]3 n# j- M5 wvia www.winfiles.com. However it was first used by NuMega people to allow& |* M3 Y$ z6 i3 s1 R
Symbol Loader to check if SoftICE was active or not (the code is located
, W' p2 V' p. oinside nmtrans.dll).
) B& c8 V5 c& y( l5 V/ _. |( m0 \1 ~% k9 C/ G. O/ U  Y
The way it works is very simple:
# m6 q6 h/ s- ]/ N9 BIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
+ d! H5 ?" F! L3 e% D: W. o& J% \WinNT) with the CreateFileA API.
) N; `& n  x- S' o( Z4 |- C  o& ~
+ U$ T* g) ~; w- V+ h' N3 H$ KHere is a sample (checking for 'SICE'):) i! Q& b& r/ B1 f

6 x# M# u5 y. n* eBOOL IsSoftIce95Loaded()
1 S6 u9 \6 l. x( j{
  ^4 ^8 n, I/ f3 [/ }   HANDLE hFile;  ! H6 d' B: m4 c& o- s) o; @
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
) Q# F. M6 E( {8 q. g4 U7 l4 Y6 G                      FILE_SHARE_READ | FILE_SHARE_WRITE,  _  H0 I) C5 A2 V6 {$ i5 }5 [/ ~
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 N- o: z! R( Q' S% d   if( hFile != INVALID_HANDLE_VALUE )
' f0 ]% e. R7 [   {
3 f4 n' D0 C: b      CloseHandle(hFile);* }$ D0 o) Z0 z9 n- E3 F
      return TRUE;3 v& P4 S) f9 ~; r4 {
   }
1 [  B; x2 P0 x( Q' e   return FALSE;
2 k7 O0 P. V" E# ?" M}% e! B  C9 V7 G) Y  u

, o- h$ ]/ f  e2 A0 P( mAlthough this trick calls the CreateFileA function, don't even expect to be
' J; k6 L! s" e7 I' dable to intercept it by installing a IFS hook: it will not work, no way!
% v, g  m' m5 [: b) }* EIn fact, after the call to CreateFileA it will get through VWIN32 0x001F! @0 y) B/ l' {/ J' t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
' X$ _1 h3 b% j5 C: K) ]* q- |4 Fand then browse the DDB list until it find the VxD and its DDB_Control_Proc
, u3 R0 ]" `7 t$ K. w. Ofield.
. Z' K/ m5 n) ~$ f1 eIn fact, its purpose is not to load/unload VxDs but only to send a : F& y+ @9 w0 j6 E& m, N# D6 J
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), Q0 k8 J/ z3 ^" O6 [  V5 e
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" `4 }7 F7 F) c- ~# ato load/unload a non-dynamically loadable driver such as SoftICE ;-).* S; y* y# Q1 F0 v; x
If the VxD is loaded, it will always clear eax and the Carry flag to allow
# o& Y2 ~/ U$ E* zits handle to be opened and then, will be detected.
0 x5 e2 Q8 @$ `; ]5 |# A6 GYou can check that simply by hooking Winice.exe control proc entry point+ I) Z4 k/ ]9 C4 v
while running MeltICE.
  `+ H1 o" g- t
, |5 @" s7 C" h9 c. A
# D, C& V  D6 c# L  d, s( D: j  00401067:  push      00402025    ; \\.\SICE) A; R. x, }. o, `% y/ }, a" I
  0040106C:  call      CreateFileA5 O$ W1 [+ G* h. B( V, u
  00401071:  cmp       eax,-0012 i1 E) M% N, Q2 N2 ?6 r, R
  00401074:  je        00401091
: C  E2 E; p9 {4 O0 [
& n2 K" y& u. ]7 W* Q( ]$ D$ E, a' ?' d. y0 z
There could be hundreds of BPX you could use to detect this trick.* q  t1 v6 A# O5 p5 z3 s+ b
-The most classical one is:* n% Z& ?' ~6 d5 ~# o8 Q- I8 W
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, g4 O) k5 ]/ \/ c3 P$ V7 t, W    *(esp-&gt;4+4)=='NTIC'0 K+ t6 c5 l2 z
/ i+ R! a: n/ \: o6 R& n/ J
-The most exotic ones (could be very slooooow :-(
! e4 P$ e3 o3 b  Z& `0 o1 i5 v   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  - G  M+ n5 G3 H; k3 g3 C
     ;will break 3 times :-(/ H, C4 B% L! y/ r! }: ^2 [
) d; U: _/ K; U, h
-or (a bit) faster: " u1 M% z2 E! [% N3 x1 K0 j
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ H, H5 y$ Q9 \8 `+ {4 j' U
2 g+ N( i; T- C   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 g/ B! D4 v! N! V# r
     ;will break 3 times :-(. A) `6 }$ ?/ T1 h' D

- s& @3 {( p( b( x3 B* o-Much faster:
6 o5 d9 f& V: u1 p1 K   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; Y  p( {  ?& e( w
% b& _0 \: x7 ?* C/ V! dNote also that some programs (like AZPR3.00) use de old 16-bit _lopen4 y- e5 M1 B+ X
function to do the same job:
6 L" _/ G8 j9 c5 Z
4 q1 h9 t5 \; s% z- ^4 e   push    00                        ; OF_READ' D, X+ s1 l* m0 u- q. ]4 `% {, D
   mov     eax,[00656634]            ; '\\.\SICE',09 {4 l' u3 c# v0 s  D
   push    eax
+ o# H0 b1 p4 L  s5 ?  Z! r   call    KERNEL32!_lopen. n8 _# l6 A( A6 x+ ^6 z1 s7 [
   inc     eax8 _) m  v& T* e) H5 I; o
   jnz     00650589                  ; detected
  A$ W( O; @% G5 u   push    00                        ; OF_READ6 _4 d( a) R" |4 j
   mov     eax,[00656638]            ; '\\.\SICE'
7 v; O5 O9 T6 W. M+ b. ^' n   push    eax
  V! u  s: o6 F9 k3 V* {2 _1 ~   call    KERNEL32!_lopen
# ]' p2 e) H! p  v- r. |   inc     eax, c) Y9 o  R5 C- r  ]
   jz      006505ae                  ; not detected5 r7 f. d8 \0 x) U: _/ T
- n- C5 Z: \3 u6 J

- g8 j; S. b" b5 D- X__________________________________________________________________________
% P7 }. a3 A  l7 A+ B" ]* E
5 r1 b6 e8 r2 v6 AMethod 12
- M% ?# e0 y* r6 f9 m: n8 s0 s( O% y=========8 N& ]( u0 Y( k- o) i; g* L

2 e& G6 W# V( ]6 ~# ?This trick is similar to int41h/4fh Debugger installation check (code 05
+ V  r- s3 i: l, u( S&amp; 06) but very limited because it's only available for Win95/98 (not NT). c- j( g- Z1 y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 B, t- n2 G& b+ z' \; e4 R9 |6 w! W: y9 m" u9 N  m
   push  0000004fh         ; function 4fh
. N3 m9 f( S: U6 C! `   push  002a002ah         ; high word specifies which VxD (VWIN32)
  N2 U+ t: J9 a$ C; @* \$ f. V                           ; low word specifies which service
4 n( @& s) y+ K6 M- l% o$ j                             (VWIN32_Int41Dispatch)8 p. L0 C5 t2 {9 Y0 u  P% ~$ Z
   call  Kernel32!ORD_001  ; VxdCall
5 @+ R) `# y7 Y# b* A   cmp   ax, 0f386h        ; magic number returned by system debuggers, g4 [- A" y$ A7 ~* o0 i$ d: x4 t
   jz    SoftICE_detected
5 T$ B0 E. @2 L3 z4 r4 c9 e1 q) h: u7 y, y1 |7 \4 [
Here again, several ways to detect it:
! r/ k+ I! |. }0 \
* O" L* c( G7 E4 t6 \  C% F3 E    BPINT 41 if ax==4f8 E# Z8 n9 w* C( X  G7 @

! t" l0 V4 s7 R4 C0 c) F% N  D, K6 X    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one% c, ]4 U% |$ d+ Y
& }/ [* h) F: ]/ L
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& V. \( x$ c6 J$ h  p8 ~
* F: C# ]5 B" Z+ F, s
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  V4 C- x3 e& u3 }

1 j& t+ H! y0 o__________________________________________________________________________
8 i( l- U* F, _8 D3 s. _  ?" C* s, l' w, Z3 a: G* o9 J0 h( S; A
Method 13' L) H: s0 h3 `0 G7 r5 L
=========! B# d) l& I' Z# b5 Q  f! \4 l

0 M  d) W' c7 R1 h1 RNot a real method of detection, but a good way to know if SoftICE is
6 N* z4 z! i- T* Vinstalled on a computer and to locate its installation directory.
$ w4 Q: P& M$ B) o6 g; C5 ?" o3 sIt is used by few softs which access the following registry keys (usually #2) :' j6 d5 ~* v0 D. v; ?4 V

! l( L$ H2 L1 n-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- v$ Q5 L' G+ f) [
\Uninstall\SoftICE& l# E3 p* Q5 V; A3 Q! [- }
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, \" F. S) J! t- O3 X0 t0 |9 B; R-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  ~4 T& X  [3 b! d% _) d) V% \\App Paths\Loader32.Exe* @$ L) i+ ]2 F

4 }: D+ h( j! f- {6 T; o6 ]( m! }/ e: c* ^: R
Note that some nasty apps could then erase all files from SoftICE directory' x; P, p; [, a& y( G! s. T9 c- H
(I faced that once :-(
$ B. P: M5 K+ y7 p/ M* |  o/ q( q5 }5 B7 j: M1 x0 R6 _
Useful breakpoint to detect it:$ e7 |$ o$ j2 T3 p: W; L
2 r+ R) }. H  X( L6 @5 t9 T; f
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'$ k* `( Z# G1 \( X! d

, n: n' W; ]& O3 W/ X0 M0 M: \# j__________________________________________________________________________, W: {# A; i; h) J% h* I
4 I# O$ C, ~$ F3 b
8 V* L* r) v4 R8 q/ x  S) J  Q; X3 S6 p
Method 14
0 x9 e3 Y) j; L* n" a=========+ z  D2 k; a1 n7 m2 h# o

& @  k& ~! _# \A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose( `) S. _5 S7 f; |0 {
is to determines whether a debugger is running on your system (ring0 only).
/ J1 p- q3 g0 n6 g
. i/ p* M; X+ J- D' |& r/ ^   VMMCall Test_Debug_Installed' Q( Z. S: R( {5 A8 a7 o
   je      not_installed3 s& K; u; d2 ^% Y& V

1 G4 [$ W/ R# j: vThis service just checks a flag.5 @% b$ p+ J; c( u% i0 B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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