About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
4 o! F* h  W3 y, l3 U- c<TBODY>
  t% H9 U" a  ^) g9 x+ O7 V4 w<TR>7 b7 {0 h& p) l$ Z: e+ J, s
<TD><PRE>Method 01 5 A, M; r* ^  x2 k: U7 U! ^' b7 J
=========+ h+ A& t$ x4 z% L8 f
. ~  `9 B" I" V9 _
This method of detection of SoftICE (as well as the following one) is0 k) T; Z* o8 h
used by the majority of packers/encryptors found on Internet.5 Y( o9 f) B9 W4 G
It seeks the signature of BoundsChecker in SoftICE
3 P! A+ n( y% }7 w' ^- K' |
4 d$ z. k& ~8 _, c/ W    mov     ebp, 04243484Bh        ; 'BCHK'1 |2 j) \. [) F( e$ \3 w; T! G! d
    mov     ax, 04h
' p. {! S' j% f) n3 q! @    int     3      
2 N. j0 l( i+ B8 V  N    cmp     al,4
2 L% U6 I1 j3 w6 I    jnz     SoftICE_Detected
+ I7 T/ [9 a; H* v& z5 L5 k4 R4 p% i# q
___________________________________________________________________________5 y. {6 h  i: {) L' X( N

6 i6 J' o0 U- y9 W" a3 z- {Method 02* P( O$ [+ ~2 |8 t% @$ \+ c
=========& x: \5 q) B/ c+ i$ d- E3 G9 @

8 V( H: O9 Y# oStill a method very much used (perhaps the most frequent one).  It is used  a5 Z$ }: o" R' i. w* d
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 B0 W2 g0 d$ Oor execute SoftICE commands..., U8 [1 }2 U) w" o0 b  k/ \9 M
It is also used to crash SoftICE and to force it to execute any commands/ L( j; f- L& U: m, j7 C2 b7 E5 H
(HBOOT...) :-((  
. u6 o3 `: b' a1 \$ L/ W( V
; |9 |: e9 Z) _6 w- h: f3 KHere is a quick description:
6 F$ U8 _" R; ^* _, e-AX = 0910h   (Display string in SIce windows)
1 S( j9 p# G. _$ q* F0 Z-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# E8 n5 ?- R" @5 R/ Y-AX = 0912h   (Get breakpoint infos)
# ?" f' ^# `" `$ r' v! S-AX = 0913h   (Set Sice breakpoints)
( [8 N; y4 R/ f8 w-AX = 0914h   (Remove SIce breakoints)3 V, @) K9 ~# V

# J9 f8 Q: ?# G' \; N5 ZEach time you'll meet this trick, you'll see:
1 S, i5 T0 r' g: G! a; Y4 {- R-SI = 4647h( f/ Y  Y" c, o( O/ k
-DI = 4A4Dh
0 R& s4 F* e. h; c! TWhich are the 'magic values' used by SoftIce., n+ h$ l5 f/ A: ]1 \
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* U$ H! O" F- k0 k% a4 C

  Y- L0 G3 `/ wHere is one example from the file "Haspinst.exe" which is the dongle HASP+ i, V9 e" t. S$ q1 E$ A3 P- f, B  r! ?
Envelope utility use to protect DOS applications:
! J4 q3 B3 J) H9 s2 z' S4 i' ]3 [
3 Y5 g( t8 x5 k+ B. t4 L2 @6 `- x" h4 q% L, x5 _6 y
4C19:0095   MOV    AX,0911  ; execute command.
: j+ e3 r8 m! ]4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- e/ u8 t! _) b- l4 b. r4C19:009A   MOV    SI,4647  ; 1st magic value.
) G/ ]: B9 }' V4 r4C19:009D   MOV    DI,4A4D  ; 2nd magic value.% C8 a$ q! ^1 w! ?# s, V' G
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- i$ G& m4 J+ ]5 H4 v$ ^$ n6 F4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ x0 n$ u' _. d" Z! [6 T- t5 A4C19:00A4   INC    CX  E5 L3 _: e# n: H5 o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 b* c; H: N  U  A+ d4C19:00A8   JB     0095     ; 6 different commands.
* d  K8 j. b1 E8 `) V4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& y% {1 ^6 t& T8 m+ S
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 x& j, {0 L$ {9 F

% D! q  o, U0 _& b5 U) {1 H# jThe program will execute 6 different SIce commands located at ds:dx, which/ V* e: o2 ~& y& r
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
2 q* M# d- s2 C5 {. n7 Z1 d
& v. \4 ~2 B4 ]- c: r. ?8 z* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ m- s2 L1 K, O8 z( G4 S: o
___________________________________________________________________________
  E$ D8 z, E, V' t
0 ]) T0 S+ T/ r, a
# P" _! ^1 V( j# l0 o; p' K, eMethod 03
' p% e& t9 Z7 q* h=========. q! y+ U( Z! P$ J- J  e/ t9 j. Q

+ L6 k* R4 _5 {" j* V9 S- [% vLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. _- |" i; C% U' ~
(API Get entry point)
. b' I- C6 E: y3 a. n        
9 W, p; P* l) T, e2 r  B" m
9 e$ i7 V4 D; T$ k4 o7 ^/ v    xor     di,di9 r/ R8 }3 h& k8 r
    mov     es,di
( ?: x0 i5 i! q, q. k$ }9 @; T" t# w    mov     ax, 1684h      
' m) P% R1 M. p* Z, Y    mov     bx, 0202h       ; VxD ID of winice
/ X+ f* e+ ]; W2 r* Z    int     2Fh
& ~: u; C7 N4 q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. [, Z) e, t# B: [7 H3 r# k* P- t) p) o    add     ax, di
/ r3 l" A9 I' ^, h' J" C1 ~    test    ax,ax
1 ~$ |7 S% S5 Z) V' ~0 D/ F    jnz     SoftICE_Detected7 z3 e, A. E$ K) g: b# Q" x
! s6 H6 }$ P9 V* e/ P2 d) e
___________________________________________________________________________
/ e* V6 G7 U  V5 R5 a( |" {) I/ z! V1 V( n! z
Method 04/ Y5 |4 C1 k6 c1 N, M8 y6 U
=========
( S6 g; v, E" w% h0 r
1 ?3 y+ N9 r  @! D' PMethod identical to the preceding one except that it seeks the ID of SoftICE1 w& ?8 D, t4 ]
GFX VxD.
: c% h5 y" M9 v4 c) k, T' X- u3 [* n. |& o9 b9 G( p
    xor     di,di
, D$ N  e% j( h8 L& H    mov     es,di( t0 R; q! N% Z% W6 m# o
    mov     ax, 1684h      
4 R' }" S0 E. O& n+ J+ n0 |    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 d: t; M% s& u7 C1 S& N    int     2fh
* H) _& T# u7 F    mov     ax, es          ; ES:DI -&gt; VxD API entry point% }* p3 K' T: p9 r" v( j
    add     ax, di
' D& j5 z" R% R. B) K  h7 t& Z    test    ax,ax1 F$ q. U5 P5 j1 R+ g8 v, Q
    jnz     SoftICE_Detected0 \$ r9 ~/ E' u2 `+ _
+ Q& ?; ]' j+ P' m' \
__________________________________________________________________________5 P/ X- v. L% n

3 W. i. ~' |7 E; r% _# F$ l5 Z. o1 I2 L& M. O
Method 058 z2 H) w$ u& i
=========2 l! V- Y, v, ]( m# u, R
8 w3 c* I: Z1 k0 X$ a
Method seeking the 'magic number' 0F386h returned (in ax) by all system  l( f/ E5 {; \( [
debugger. It calls the int 41h, function 4Fh.
! m' _* w5 ^( f4 m1 t1 Y" CThere are several alternatives.  
9 S$ t: b1 p" c: {
$ R; _7 V/ `# x! M# `# @  kThe following one is the simplest:; B3 |1 `) m: m# x' p% ^
% o3 r5 `) o* |: o# |
    mov     ax,4fh
* G% |% W2 x0 E8 z  @3 y# j$ r( V. g& C    int     41h# m( W; ^  i5 T& ]" |; ]% `, a
    cmp     ax, 0F386
0 k8 @8 |7 X% {7 f7 v- r% `    jz      SoftICE_detected4 {' C' N( _/ B3 \8 m  v' p# |

* F, t9 L, K! i
5 A- i2 Y0 p  A: m. O4 o( YNext method as well as the following one are 2 examples from Stone's
/ `3 T- E3 n+ ^, H: i"stn-wid.zip" (www.cracking.net):
! N/ h0 t; m! ~. V6 M) ^( x8 t$ F$ T" @
    mov     bx, cs# c" `3 I" U: y: ]! D7 Q, I
    lea     dx, int41handler27 `( G& @- a  V# G9 f
    xchg    dx, es:[41h*4]' E( n3 |( @& U, v, [5 i0 B2 T4 V
    xchg    bx, es:[41h*4+2]
' F/ v8 `% c1 N' T    mov     ax,4fh
  o/ v+ s% _& f) c$ j! b    int     41h
9 ?: j0 Y4 C/ F: \0 A  `9 W5 Z! o# n    xchg    dx, es:[41h*4]" F2 L% z- C% B6 }- h8 m
    xchg    bx, es:[41h*4+2]- `( o' ?: s1 x. W+ Y
    cmp     ax, 0f386h
8 m( k- M- ?/ u8 W0 R+ e8 W6 X0 \* x    jz      SoftICE_detected
0 L$ Y, }  ?0 W! R0 ?
8 p( S; ~* U2 e: B$ l" S; Y9 Tint41handler2 PROC. b2 Z+ E5 }, X: W, l! @" e
    iret
/ ~6 C* l7 l9 G" ~8 f* Zint41handler2 ENDP
0 m5 x  P7 L) W8 w$ l6 [4 _
) U0 N6 z+ p( [9 x- w' E% p; w% q2 k4 K
_________________________________________________________________________% h9 A2 F- |7 V$ k

3 ?5 m1 M+ m% }& o! T" N9 Q
; r, X+ I2 }' P. D! mMethod 06) [6 s; R1 h. r- z
=========
" {" R; f0 D% h. v
( X- F( S0 u! M6 k' K" ^5 n$ N
# @/ O9 f) _& t6 A2nd method similar to the preceding one but more difficult to detect:. ?. R  _, f: o. o- u

+ }8 ~( @7 K& g3 d9 j. R# k# m; \5 s% h  o
int41handler PROC, ^, c& a( g9 L2 a! W
    mov     cl,al; s1 ]/ L; `5 v( r4 P8 |8 A, H0 F( g
    iret
; S9 D6 }& E/ m) v" ?7 P  i+ gint41handler ENDP0 e, R4 w: R; Z3 T  l9 r
7 b% {1 j' T' h- p4 F4 O

, p2 `9 p' O! W# J! J6 e1 [/ \    xor     ax,ax4 [+ q) C  M' v* w* I1 ^) q1 U/ V9 t
    mov     es,ax
% u  s6 i. O& P9 H2 P" h" P    mov     bx, cs9 d: ?' f+ T4 V9 D- n. D% x/ ?2 w' f
    lea     dx, int41handler; \  M9 Z$ S" ]; U8 o& x: G2 a( e8 {
    xchg    dx, es:[41h*4]$ Q' Z! R! C0 N9 E
    xchg    bx, es:[41h*4+2]8 f! z. C  n9 [2 @0 N7 f) \% v+ r
    in      al, 40h
  Z4 C6 |* h. R! W6 k& J+ z    xor     cx,cx
9 h$ {7 ?* @" d4 \/ |1 B    int     41h" I. w% ]4 j; a1 y; N4 Q& S
    xchg    dx, es:[41h*4]
/ t4 d! ?" o- X' D, G( p% }    xchg    bx, es:[41h*4+2]" n: I. l: @* @7 |$ z& A: T
    cmp     cl,al
) S  M# s7 j) ]    jnz     SoftICE_detected
5 u8 M8 }6 a" D3 D+ z. P( z
0 ~, _- u4 O  {_________________________________________________________________________8 v0 q2 E1 k5 V6 [+ {0 e) ]5 r

& ?! H! G" i4 z/ XMethod 07  ~& p, B  w7 H
=========1 s5 Z/ H: P" v! E- |& E7 Q

6 ^9 ^! L5 E9 f: Z0 cMethod of detection of the WinICE handler in the int68h (V86)
6 R/ Z* H) L' \8 u# N6 F9 F  R" ~/ l0 [: c" i  W' G9 Y1 F' m/ \
    mov     ah,43h; M) O  W8 [  e0 ^
    int     68h
8 I; \5 b. E8 C7 Y3 A7 B; G    cmp     ax,0F386h( C- `0 A& ~& ~9 E. u
    jz      SoftICE_Detected  P. G8 [7 V/ D$ u

* Y# @- I1 P+ a% i7 a* C
& K6 z, C/ G. x=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 q6 [& G: p  [) k& K  E2 L8 x. v
   app like this:
' g9 b; O! N9 q/ u* S. f8 U# v/ G4 J0 z! e6 D: L  E! Z  {
   BPX exec_int if ax==683 r+ {$ v+ L" u% E5 t4 V/ z9 O( ~
   (function called is located at byte ptr [ebp+1Dh] and client eip is
: q2 n  H' K$ }! D, ?   located at [ebp+48h] for 32Bit apps)
) L4 H8 B& Q+ y" W__________________________________________________________________________
4 L# X% ^) v% t$ P# ~: D6 D4 |- s# S; y. G

. {" M% O! I6 P) M/ I% n0 }# DMethod 08! d* U: O* y  T6 L
=========
! o+ a8 V' _1 o& q1 U$ N1 I1 E! Y: e% P1 \2 T
It is not a method of detection of SoftICE but a possibility to crash the5 w/ N, g5 I2 f3 `1 e9 ?
system by intercepting int 01h and int 03h and redirecting them to another
( k0 C* E4 ^" ~+ w$ Vroutine.
  `& H; O$ k9 _9 a- r: @$ h0 eIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
( b- X1 y/ A# H! xto the new routine to execute (hangs computer...): `/ b) _9 ]& j5 h8 [+ U( n
2 k! S* l" G1 Y0 G; I( X0 Q
    mov     ah, 25h
5 p" j, I" B; }: h. P    mov     al, Int_Number (01h or 03h)
1 Q, l  X6 c8 W" G1 E    mov     dx, offset New_Int_Routine
5 P  F) w4 y% L! i5 |! D8 d* n( N    int     21h- L5 `- C- o$ ^* E4 k

3 W7 L9 D  {0 B__________________________________________________________________________
; u, v# J( |+ V- j/ ?$ k
0 |$ K' v/ ~% D* [Method 09
; @1 A/ L9 R8 M=========
+ ~6 E* J2 b* {8 e) O) |- U# g; V) r
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  V% ^# w  O- ]( c4 ~9 F
performed in ring0 (VxD or a ring3 app using the VxdCall).8 _" ~" V6 k, Y  l! M3 q1 `
The Get_DDB service is used to determine whether or not a VxD is installed2 Q3 x3 a4 N4 Q
for the specified device and returns a Device Description Block (in ecx) for: ^- _) f" }  y( J  }- }8 Y7 @1 E, n
that device if it is installed.' ]3 K: _9 i' V, Z' h

2 R% T" b8 p( k   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID. m0 G& b% ]7 @$ H
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)) Q7 @% V- P& Y: N' U  h
   VMMCall Get_DDB
7 U% q* `& t0 j# c9 i+ Y/ x   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ Q4 M4 B" r* L& U' v1 }6 j
' |' |, |; Q% HNote as well that you can easily detect this method with SoftICE:; x; ^# }: @. ]3 [3 E- [" a
   bpx Get_DDB if ax==0202 || ax==7a5fh
; ]+ v- q& }* A  ~9 T: e, ?( W' r  m
! `1 ?& ~2 ^6 L. Y% [+ Z' U__________________________________________________________________________
8 C: Y6 x4 a1 ~+ F# O" u# u) t$ Y- g" U
Method 10
! ~9 w+ A' ]7 L- z=========5 g/ W" {+ H4 c3 l! `" J& y) q

1 M5 D0 S% a8 V( w" R: w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with; K0 o! z# D+ u9 K  Y
  SoftICE while the option is enable!!; f5 R) \- ?1 ]2 _7 s& T

' u0 Y0 E# r/ c5 T  uThis trick is very efficient:, J, s( ?! D" m& x" [0 b5 b
by checking the Debug Registers, you can detect if SoftICE is loaded2 R7 E6 k8 {1 _
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
' N# r$ u- J' N! J5 q4 ^9 Z% qthere are some memory breakpoints set (dr0 to dr3) simply by reading their/ W+ F: n9 H. S6 I: p( ~
value (in ring0 only). Values can be manipulated and or changed as well! x7 X' F  u4 k7 F
(clearing BPMs for instance)% o9 i3 O8 c9 V' i

9 y5 ^2 Z8 P9 t5 h8 Q. i__________________________________________________________________________3 [- l: i; P9 w

; v* y- Y$ r: [& M' W" G# gMethod 11  J' n+ C- B; X( L  w
=========
$ B2 ?+ A- ~+ s7 x& _
" P7 Z+ j0 D8 b. h2 }% ZThis method is most known as 'MeltICE' because it has been freely distributed
/ |2 w' I% K1 \via www.winfiles.com. However it was first used by NuMega people to allow7 M0 I# l8 {8 ~$ x2 Q' n
Symbol Loader to check if SoftICE was active or not (the code is located
/ A5 u2 S4 Y$ w# b; G4 _inside nmtrans.dll).- j: b/ c* R5 G
+ x# b$ l7 t2 B$ _5 y9 w" L1 i( `# P
The way it works is very simple:! Z0 {( L% ^% |" @3 F
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ A' M  ]( m  @( q8 h/ h, ]2 i" OWinNT) with the CreateFileA API.5 P& [! E+ M; H: }2 E
; H9 `8 W4 v1 g& a+ H4 k
Here is a sample (checking for 'SICE'):
$ Z- U$ M: X, _! Y) c/ S# k2 c
  D& C* C- b8 v7 M; `" r4 [BOOL IsSoftIce95Loaded()! Q0 b6 X' `' y, s- b
{
: b; M, j8 e  K) c, g: M   HANDLE hFile;  
. |( d5 a, }! Y7 \# N9 J  }! D& V   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ h% x- ?0 s" u3 `% P
                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ w! \. c- F# }. Q# Y
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8 i' h6 A9 w  \4 v$ i0 p3 R! @   if( hFile != INVALID_HANDLE_VALUE )
; \( A$ m+ f: j; Y3 w   {4 }" ]0 H+ U) S  j
      CloseHandle(hFile);* O$ f! S. W8 N: _+ u. N% ]# [
      return TRUE;
, J0 B* C1 l6 K( |, I0 \: v   }
, r( ?4 V; X) ?6 I+ y   return FALSE;4 h6 X# X5 P; @5 }) b
}3 K) }0 ], Z5 n' u

1 E: T7 q, `. u' p* u( ZAlthough this trick calls the CreateFileA function, don't even expect to be
- @) A; U* X* Sable to intercept it by installing a IFS hook: it will not work, no way!/ P; v: ]! t/ n
In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 l1 N$ M: ?) f8 H- B) H
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)$ ~2 v% c' A0 F
and then browse the DDB list until it find the VxD and its DDB_Control_Proc9 h3 _! J+ B  {! ~
field.  W  K% [* ~  A2 Y# j  n# J
In fact, its purpose is not to load/unload VxDs but only to send a # F( e. ]- G# v
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)2 V: A1 o6 E# e: z+ T& m
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 {# Q* O5 f4 J0 Y; w8 Cto load/unload a non-dynamically loadable driver such as SoftICE ;-).  W2 ]. u. R0 D) U8 b# j
If the VxD is loaded, it will always clear eax and the Carry flag to allow
- S" R- m4 s# W! K5 tits handle to be opened and then, will be detected.
, j0 C: e' s$ S5 r  FYou can check that simply by hooking Winice.exe control proc entry point4 |! M7 g/ G" u* a' H- Q+ c2 E
while running MeltICE.$ _, J0 j) j+ r( z  I; q5 f

) V2 {3 N( d$ z/ ], z4 O, i: m! ~# r" ]+ q
  00401067:  push      00402025    ; \\.\SICE
; z  ~) k- l/ y0 S  0040106C:  call      CreateFileA
. q% q3 _6 K7 U9 R  g  00401071:  cmp       eax,-001
$ r& u4 T6 U1 g; j7 l& G6 m; C2 Q  00401074:  je        00401091% k1 L; a; A3 R0 S

0 }8 a1 b/ R  L: w6 [$ R* V+ o9 r0 D. v. a5 g$ z% ^
There could be hundreds of BPX you could use to detect this trick.
0 s+ l3 G! d4 A/ L-The most classical one is:
/ l  v; c4 N4 t: M' r: [  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. [8 n( i/ j# z6 ]* [. `
    *(esp-&gt;4+4)=='NTIC'. c0 A7 U/ y, H' }% A1 c+ [
7 y: \/ Y+ H. d+ b+ k% d
-The most exotic ones (could be very slooooow :-() N' w% B" P1 b5 R+ l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" y5 s1 n0 @& T9 ^' F     ;will break 3 times :-(
/ [5 U/ ~* n, W2 I$ ]3 |3 g  d% c4 ~3 v$ s% Y
-or (a bit) faster: + B" V; F! j' ?
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# t- {8 N0 I+ L) p
& G. S- W& `% h2 b   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 u7 b) L2 F% I3 J( g( b0 R+ B+ ^     ;will break 3 times :-(. a  }* k* d7 X1 m0 r

' w+ ?8 b* P3 N( m4 G$ y1 d-Much faster:  Y; Q7 Y# n4 {7 A2 S( ~
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
5 t2 i; @  @& k+ v! M- s
% {. w$ s" O2 mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen+ v, ?9 P8 W' Q( W# c& a' P* _+ t+ D, ~
function to do the same job:
* z' F0 N) d% ~& U9 D0 b" q1 y; @; Q- `+ |
   push    00                        ; OF_READ2 V( G& o. k& P5 w( m% d6 p
   mov     eax,[00656634]            ; '\\.\SICE',09 G  R' C' ^% U
   push    eax3 x6 L( p2 ?0 S! C- n
   call    KERNEL32!_lopen
" q) |' i4 B: D$ g$ y   inc     eax
( t. k0 J! i$ A4 |4 J8 j   jnz     00650589                  ; detected6 ^' |- T8 B& q  F3 K; I4 U
   push    00                        ; OF_READ
3 I6 f) t% O5 c1 Q: ?   mov     eax,[00656638]            ; '\\.\SICE'
3 Q( l$ b1 r% U! f- g3 s   push    eax
' ?2 M( V4 O9 E3 c   call    KERNEL32!_lopen
; }; H) ]/ ~' y+ S  A. _   inc     eax/ |' H, B; s: @% {% N( b. G
   jz      006505ae                  ; not detected
7 f. E$ O- Y- R4 D; _. v& [
, d$ l; L# n0 k' ~8 t! ~% V+ ~. R; _9 d$ F1 _3 J9 H- v
__________________________________________________________________________9 O8 B# o5 `3 e8 W7 J

  h0 T6 H+ [7 B8 QMethod 12
( _4 I$ g2 b- ]: P- H3 D=========$ y& j/ o( R% ]; L7 _" e5 c

& [' h" {; ]9 j9 R+ r6 ?This trick is similar to int41h/4fh Debugger installation check (code 05
! _( ]/ [* q! T+ k# j&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ B6 V- h1 F9 t, R4 b" q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; _3 k0 p' l/ w' u: f& \7 d
" v- @+ s' v1 N- e
   push  0000004fh         ; function 4fh
+ r7 U/ E* P6 O9 m7 q   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 Q1 I( S+ |  \! x( c: j3 I" _! k                           ; low word specifies which service
9 ^7 w" [2 h6 D2 b                             (VWIN32_Int41Dispatch)4 ]0 u% C$ O0 a$ X
   call  Kernel32!ORD_001  ; VxdCall# y$ q! S: [+ P) C  w9 o. ^
   cmp   ax, 0f386h        ; magic number returned by system debuggers- y! \2 c- Y% E0 W' Y) D
   jz    SoftICE_detected& ?. Y6 r; u: v! l
$ j. i8 B; N/ U! ]  {/ N
Here again, several ways to detect it:
( Q" x0 V! W. Y% [) N
0 h* m9 b6 f3 C5 g7 M- H4 G    BPINT 41 if ax==4f
8 Z. t* k7 e% ?# A2 Y6 W$ K# ?; v8 y7 }" }/ G# H9 z
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: V. }' N, ]$ y# a' W
8 O. D9 M  a8 }; y, s; U: D1 \( G  N    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
( P: ~" }! Y$ ?9 r  x( n3 P! `6 ~- h8 _! E
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ Q7 D$ I# L; K7 \6 \
" t$ I+ @# J$ x: |$ h# b5 k__________________________________________________________________________' d, W0 q* ~  Z  P* \+ ]
: H. Y+ e/ R) h' L  y$ m2 z" y
Method 13
, {1 q0 w) j9 W/ Q3 B# P=========- O5 p. i% C; X7 m9 X' V3 A

' E8 w0 l5 g) \/ ]* SNot a real method of detection, but a good way to know if SoftICE is
- I" H+ B/ @6 i7 c  t0 Winstalled on a computer and to locate its installation directory.: J' l# N' e- x' C2 n8 ^
It is used by few softs which access the following registry keys (usually #2) :
, p) S, K# \/ Q! ?9 O; Z
2 b4 o9 |3 x, b$ ^2 j  u: ]  `. w-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. F1 H; e7 w' a6 m\Uninstall\SoftICE
  t+ O. `5 Z; k2 v9 M9 c-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
3 N& n* {: e* E* V% ]  P& ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 J% ?9 R7 L/ J& D+ Y& S8 [- h
\App Paths\Loader32.Exe" Z5 g/ p% G4 `0 X* `* V3 L  ^6 H& S6 H( L
, p/ P, B6 f+ c  n% K& l

0 j, ?2 U$ K$ R: _/ J0 X8 qNote that some nasty apps could then erase all files from SoftICE directory
& Y  V7 L9 t& Q; b! A2 u1 w& V(I faced that once :-(
; E2 V1 j9 f' W, N
& H% C1 H, A$ `! NUseful breakpoint to detect it:- X" L7 F2 U0 p) V$ U! R

3 h" a5 P$ g- p( b& m     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& f8 ^4 p1 L% Z) `

  ?8 C- t/ G' l__________________________________________________________________________
7 ]- c, [( l, T0 A+ I( w. u
7 p. D) m! R$ r2 p6 G6 [2 H3 ^  c! l
8 ~9 T6 y: y% ?. s& ZMethod 14
$ o; f, @$ _9 l( G1 O+ |; ^/ C=========
. d* ]8 d$ _! A9 r8 ~7 U
& ^9 j( S/ Z( p4 W( D7 E2 D/ i2 {A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
. V* l8 E8 ^$ _; Kis to determines whether a debugger is running on your system (ring0 only).( }% v2 Y+ N# m/ d1 U: n3 B
& P! I4 H6 U5 J. P  j4 p: q8 L( `& z
   VMMCall Test_Debug_Installed
% c/ i. f4 @+ x/ X5 K   je      not_installed
2 [. y  q1 ~# O6 _$ L0 W$ Z. ]; x& e. w* n* t; `9 n: c+ P3 d' y' h
This service just checks a flag.
$ w# s* f7 I$ r4 a</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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