About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
* ^% d5 p- I5 v1 k# a2 ]( v# c<TBODY>4 k+ Q$ h: X+ _1 N' U
<TR>
: e+ H1 U, Y: B( Q. ]) F<TD><PRE>Method 01 2 i; j8 r- H; n
=========+ z& u* l: K! C, W% P
1 c9 \" c6 S0 @4 z* ~8 n1 i0 T, y
This method of detection of SoftICE (as well as the following one) is% ^, V/ a2 P# }* }! C* \" ^2 v; d( ]
used by the majority of packers/encryptors found on Internet.
+ i, {1 k1 i) _It seeks the signature of BoundsChecker in SoftICE1 w9 W: B6 m% @
* I% w# z% `, S# k. ~' r
    mov     ebp, 04243484Bh        ; 'BCHK'
/ M9 a! U4 }- _* W4 `) j3 D    mov     ax, 04h; `+ j- J6 h, r2 H, c; u" X
    int     3      
+ d! k7 Q3 S1 K3 B* E; }! |% j    cmp     al,4
; Q3 d4 u. _3 E: R( i    jnz     SoftICE_Detected
4 G) p. K% g! }- [% P3 w
: Z- x  Q& a3 \& v6 j___________________________________________________________________________( [" o1 `& s; y! z" }, U
. }! u. H7 ^' @, O
Method 02% w% m. L) a1 H
=========
$ g" }1 F$ S% X! z$ |9 ?5 _
. T' y) Q$ b3 f) ZStill a method very much used (perhaps the most frequent one).  It is used
9 X. n1 @2 Y" o& b! bto get SoftICE 'Back Door commands' which gives infos on Breakpoints," k" d# c# Y: y5 j* @+ t; M
or execute SoftICE commands...
' @( G2 O' V& `+ o3 [It is also used to crash SoftICE and to force it to execute any commands
" D+ t  y) d; ?% G2 v5 G: u(HBOOT...) :-((  ! U& i+ z+ Z9 o4 J

  M" Y" p3 x$ h0 p% yHere is a quick description:
2 b6 h7 h. u" z' e8 L" z2 f& S) Y-AX = 0910h   (Display string in SIce windows)/ U7 j/ X2 q( E: f; T
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): `: _) V/ N# v2 {! C! M0 L; w+ o* j
-AX = 0912h   (Get breakpoint infos)
, a# t$ k" V  V9 ^- m- D* i2 Q" d-AX = 0913h   (Set Sice breakpoints)
# y% @- B) {  a. G! b* \8 x( W5 P2 H-AX = 0914h   (Remove SIce breakoints)& E1 N' _* F5 J  B* o3 B  m, ]
: D8 T* R" @+ a- P; u, e4 I
Each time you'll meet this trick, you'll see:
: j1 d, v- R; g+ g% {2 R3 z-SI = 4647h/ P" H2 f& H! I8 D3 Y1 S
-DI = 4A4Dh
9 {6 W8 S/ C! |+ `" I& ^3 G: H: K' y' OWhich are the 'magic values' used by SoftIce.3 G/ F2 E) Z+ p# O! ]
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.* H& X, F) D+ c5 R

! x2 N) b1 V+ w" Y( a( M6 d$ eHere is one example from the file "Haspinst.exe" which is the dongle HASP. i2 Q2 C' n7 |- N8 {+ ]
Envelope utility use to protect DOS applications:
: X" R6 k5 X0 p# a' G
: o8 P2 Q. S9 `4 {4 \% d2 M4 @+ y3 E- m  x/ i4 Y
4C19:0095   MOV    AX,0911  ; execute command.
" ?1 i6 l1 m5 `4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 l6 }+ r+ l: q1 G# X4 s: u: k
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 I4 n. i; H. ~& v" J9 ]5 `4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- G8 K: C7 b) \& b& m5 Q& u3 p4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
( l6 F# {0 c5 F4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- k! f3 m; P, B1 O
4C19:00A4   INC    CX6 v0 W* X/ f. `1 u
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
+ N: P/ v" \7 q5 ~$ X9 o4C19:00A8   JB     0095     ; 6 different commands.+ z5 c- F6 t5 ^/ _& ?$ t
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, @$ X$ p6 B" G0 H, z& ?/ T, o$ U4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' X2 G7 H% d0 \1 T; A# p% Y" b0 S2 x, E0 W7 [
The program will execute 6 different SIce commands located at ds:dx, which) v8 ]# L' |( |) r4 L
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% l0 ~# X/ ~- d, s  O  U
+ c& `. v+ u  I' j+ y
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.0 W1 c9 M  O* j$ ^( W. z: y' k
___________________________________________________________________________# X6 v6 y. M: I
5 s: F- a4 g3 V) w4 U  g
8 \+ \- s7 T. T& B8 d5 F! z
Method 03  _9 f5 n6 D2 E8 e+ w( Y" k
=========
4 D0 j: d7 i. J7 o3 ^/ E  ]. I4 r
/ A. s% s: z- W! t. X; xLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
) L& C7 B2 Z& C! x3 S5 K- G(API Get entry point)
- g& v8 I0 c: m- f* S( W) X$ g. ^" [        
0 {+ ^. S& z5 s
0 o6 k% q% ~# S4 X5 e" s/ b# p    xor     di,di/ W; e" f) x& Z
    mov     es,di6 V( H; n7 G/ t
    mov     ax, 1684h      
. _% r, L( W, I6 V    mov     bx, 0202h       ; VxD ID of winice
! a6 a2 H7 R! H/ n# k" p    int     2Fh
8 s* u- o: U, |& \& ]- ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ F* z4 w# S- r: H4 V" J4 c7 N- g4 s
    add     ax, di
' b: U2 F3 \* `& b+ g2 c' I, n    test    ax,ax
6 W- D' Z. [! c( v$ P+ S    jnz     SoftICE_Detected# p/ k) G2 G; [+ ^: P9 S' g
! k/ E' t' p7 U0 S) E/ P+ A) ~
___________________________________________________________________________5 x' i1 T" E* r5 b

/ k  R5 ~: ^1 A4 FMethod 04
; q& a* J1 C, y, r+ G0 X* f=========( ~8 w$ ]* g/ V. G
7 d* [8 G! @6 S' {9 g/ Q; |
Method identical to the preceding one except that it seeks the ID of SoftICE
" _! v9 O- S  ^; [, EGFX VxD.) l' V9 |5 t9 C5 I

) h0 Z1 u' X& |/ E, K+ p3 F    xor     di,di
) w0 y( D+ T+ V1 p    mov     es,di
' h+ _: r4 D6 d0 ?: M; w9 {$ J    mov     ax, 1684h       ( W5 E2 N: A. I" }2 y8 z7 L
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
- p; R. _4 t3 D: u3 H8 _    int     2fh
  ^, n6 g, B) T$ L    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" b9 H7 H, O- c$ y- f+ Q, }    add     ax, di
+ ^; D  b, ]# O; |    test    ax,ax  `+ _# C; R& I
    jnz     SoftICE_Detected
1 U3 D' u- v) V$ K3 U4 A! [7 L& M/ M: D0 E
__________________________________________________________________________; @# N* m. ^& ^  X7 L- ]* }  q( z7 N

# e  f7 H4 Y# q# z. s% q% o( I/ l1 u0 z7 l
Method 05+ R! V/ f1 y+ O% H* g& j
=========! i( @: T( d; d: m6 b

8 ?4 f+ L/ I8 @! i) {1 o$ sMethod seeking the 'magic number' 0F386h returned (in ax) by all system6 Y0 v/ R+ A% X0 ?- E3 l* O
debugger. It calls the int 41h, function 4Fh.
! I- z$ r. ^' ^0 I0 r( T, ^There are several alternatives.  
2 t% O9 E8 o3 u, F$ C* K, y
7 V% ?# F: ~1 E$ S2 \, d! `The following one is the simplest:
9 \; m# l7 t# d6 J+ K( O: v9 {: f( k8 `
# ]$ p. W# K. a, s! T    mov     ax,4fh
/ }8 m8 B6 |4 \/ K* ?    int     41h
' m, n* ~" c8 {  I/ {4 O. G    cmp     ax, 0F386- W" i. j9 f" |0 W
    jz      SoftICE_detected
! c* j( ]% y2 W* E0 C+ L
7 K8 m+ q# A' h- Y( n2 [% y$ t# V4 J* |2 M$ d7 ]
Next method as well as the following one are 2 examples from Stone's
  ?4 p: I5 {$ f- ["stn-wid.zip" (www.cracking.net):* R/ y! N) w% ^) k: W% M8 j' G; ?$ D' E

6 N9 n: K8 G# y: u% \: W" M    mov     bx, cs
. r. o( ]. k. D8 w/ B    lea     dx, int41handler21 ]& @& v# q+ g& {8 P& M( `
    xchg    dx, es:[41h*4]' `' E4 d1 L  N) d9 c6 A
    xchg    bx, es:[41h*4+2]
# R( D( z  |, i" |, E0 ]/ E    mov     ax,4fh
' |% Q  a% B' \( J7 I1 Z  f/ S: @    int     41h
( ~5 ~7 q: h. r) ~* ^# S    xchg    dx, es:[41h*4]
# G# b0 V* ~. L7 f+ g( o4 k- g    xchg    bx, es:[41h*4+2]
4 B4 G. r1 f8 R$ p2 b    cmp     ax, 0f386h  c. w) m/ p7 h4 Q' H9 a1 K6 t" ~
    jz      SoftICE_detected
, q5 q/ f$ g: ~- ], M' p8 x- L, m# _4 q8 O) t9 d8 Y2 j3 T
int41handler2 PROC. ^7 T7 t, {! x/ q9 K  ^
    iret! ^/ ?, J7 Z2 I) ^- g
int41handler2 ENDP6 u: \+ l, A5 k& u8 I& p

5 _" z) t  o& \$ }$ P% I$ E: @' _+ w' X7 q- N
_________________________________________________________________________
  f, I5 X) z# H1 x" E* `% c% ?! s  r1 ^
) u- B$ |2 N" y" h( M0 W/ S3 ?& G" I3 \2 a0 H0 V$ B
Method 06
- L3 ^/ Q( p2 h. i! \% O6 }! F+ [& x+ t=========
# b6 L( K" o9 I  A7 ^! {; A: A/ Q. T. J6 I; I8 f' a) ]
4 g8 \! D$ T( F
2nd method similar to the preceding one but more difficult to detect:# y- z/ O/ h% i: H* I7 |
6 c0 w. f) y% s" l

  Z6 _8 f* i* S3 ]" [0 A9 gint41handler PROC
5 w) F* S: M5 J  a/ Z  ~    mov     cl,al
; p$ @8 c2 U( i* W: g    iret
# u5 W0 E6 M% A0 a/ m1 Sint41handler ENDP
5 }0 J- Y! o9 i2 X- {3 S# T  S
4 |* V9 ]/ |1 w& R4 {5 B: W
6 y; y' Z  C* I- C1 [6 g9 v    xor     ax,ax7 _( x. e1 ~9 f3 R( n
    mov     es,ax
" D% W9 F1 X, Z    mov     bx, cs
2 ?" Z' C& u, J( |5 u    lea     dx, int41handler9 m. g9 U' W4 M# Z
    xchg    dx, es:[41h*4]
6 v; h" D* V$ _& l4 c    xchg    bx, es:[41h*4+2]
. g, m% _9 x7 v+ X; A' |7 d    in      al, 40h" Z) A! C' e0 M0 I8 u
    xor     cx,cx+ Y3 p: I' f7 [: k4 r: J
    int     41h8 P- q# h/ M7 ~1 ^
    xchg    dx, es:[41h*4]- x; ^/ M% }5 C3 I+ d) i( U# H
    xchg    bx, es:[41h*4+2]6 h2 `3 R# i- ~, v% H& q3 E  i
    cmp     cl,al
: f' u, W, a2 \8 F% @    jnz     SoftICE_detected
/ @$ c% K: u8 @" H& W! M8 i
' z( b% a8 T; _) ^; Z# D1 N_________________________________________________________________________
$ U6 Z3 V+ [, G9 |; A0 h
, a) L8 B  o1 H! g& l! wMethod 07
9 i* X/ @1 I* |# P& h=========' s9 N0 u) f! J( E: o
4 `) H8 N: n( F" O/ O0 Z: K* a5 G
Method of detection of the WinICE handler in the int68h (V86)
+ Z( j2 \/ G% l
6 J; Z5 x' n) S$ k: v1 x    mov     ah,43h
( O/ ?& H: C: ]0 V: E$ p    int     68h
. _: o7 h" s% Y9 N    cmp     ax,0F386h+ S! ]2 {; {" d+ T
    jz      SoftICE_Detected
/ a' S- T7 f% ?' I5 s1 I/ \- Q1 l5 z( Z4 Z5 v
* V/ L: S* U- n; Y; x
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 ?* |0 B  [$ z# F# w- b/ v; [0 _   app like this:) l. l2 x$ k, ], |  V' u
; B4 p5 S% N7 y( ^, h
   BPX exec_int if ax==68
0 @5 E# n! w1 }- B- \1 d/ @$ Y/ Y. n   (function called is located at byte ptr [ebp+1Dh] and client eip is* z6 D' x& }7 S4 k
   located at [ebp+48h] for 32Bit apps)
; J  q, ]' a2 M8 T2 u__________________________________________________________________________0 o7 H/ k/ T# _' s1 `8 s- C$ I
; F( y, s% W! \& F; h9 _' S% ]
: }& a( Y8 U! W
Method 08
! \6 R1 m' O6 S8 t7 E=========. s4 L- L, r9 O" t
7 @; W3 d8 R/ F
It is not a method of detection of SoftICE but a possibility to crash the
. }; x) B7 V  Qsystem by intercepting int 01h and int 03h and redirecting them to another
/ X, _: [& @2 `routine.
8 d3 t, H+ d$ u- S. Q/ CIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points: s( H8 t( ]# r" W7 @: ?( z' q
to the new routine to execute (hangs computer...)! w- S" f% `9 T

0 C  S4 L* R% l4 \  s9 R+ K    mov     ah, 25h% _0 I: u. N) h  d$ u2 v; c
    mov     al, Int_Number (01h or 03h)
4 y+ ~: g% T# d& d; m" b( F' v    mov     dx, offset New_Int_Routine
9 g1 C+ q* e5 [4 g6 W! ~    int     21h
. [3 @; E4 A  Z5 t* |, ~4 K4 P
1 c, ^- B% r, h2 P3 P' e__________________________________________________________________________
) m. C3 B; R, k2 A$ R/ Z8 O# ^7 ~
3 @) y! Q8 ^# K/ n3 hMethod 09
6 g9 F" o8 d7 Y0 F) l; ^5 T=========
0 X( r& j4 C7 z2 P! a" ?* c4 O% c9 g# p- a/ ]4 M
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& v, J9 G% n$ ?  \' s0 ~performed in ring0 (VxD or a ring3 app using the VxdCall).
: H1 d! q5 Y- [; _/ CThe Get_DDB service is used to determine whether or not a VxD is installed$ b' N, q9 Y$ T% O, O7 U( p
for the specified device and returns a Device Description Block (in ecx) for& p5 {2 v% T( s" ]
that device if it is installed.  p( T/ J$ j: n0 i4 V

3 r/ D$ Q$ p; u5 x5 N   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# U5 m. V3 s% g) @& {- @0 [, a
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
: y  r8 [' }. t" F9 h4 k   VMMCall Get_DDB
& T7 B. F8 c# L* p! @   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ @/ I5 }9 ?0 {6 m( ~; n8 o; d$ t* k4 _# S. k" Y$ z" h+ A1 r$ B0 |
Note as well that you can easily detect this method with SoftICE:
  {# p4 ]- ^' V4 Y# n5 S  }& `8 X   bpx Get_DDB if ax==0202 || ax==7a5fh; p6 Y0 p; F9 J. H  Q4 D/ ?
( ~& W: ^% \* o3 Z% |. b. l2 a+ o
__________________________________________________________________________  |2 X' q, {6 C8 i. r  B! }2 d( v' Y: W

. ?8 K$ u2 j8 L/ jMethod 10- R2 V) s6 u; m
=========
$ F( I, [) J0 M; z+ |! ?8 F& O% B: s5 a
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with' s0 \% O4 d. |) G6 b
  SoftICE while the option is enable!!7 \0 F! v4 P  c+ d* z
# B  y+ A4 A0 w
This trick is very efficient:- q- g+ o0 \9 K# m2 D4 L/ S! {
by checking the Debug Registers, you can detect if SoftICE is loaded
( v/ e  M0 Y* p- h5 |(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. P+ C, F" q' |  |there are some memory breakpoints set (dr0 to dr3) simply by reading their9 r: N) \# G7 `. _
value (in ring0 only). Values can be manipulated and or changed as well+ _8 a* [" L; O. |5 ~, S; g
(clearing BPMs for instance)
) H+ [, {; J2 m. A3 [/ a" l4 ]8 s1 G% \4 V8 b$ q7 }  D
__________________________________________________________________________" y% [$ i5 ]/ j5 J

- ]" T5 A& i/ ^9 B" ^$ K* v3 n' u9 wMethod 11
4 e* E0 M8 W9 W, [=========
0 c; _  p: b& C" q3 s  O0 b4 _* Y; s" X7 T
This method is most known as 'MeltICE' because it has been freely distributed
# W; d3 Z# ?4 v2 K& z6 N! Dvia www.winfiles.com. However it was first used by NuMega people to allow% T* d* p$ V1 o
Symbol Loader to check if SoftICE was active or not (the code is located* s) Q0 y/ s* q' ]- e$ t  i2 V( C
inside nmtrans.dll).
0 l5 h# t6 g; f9 d' v7 L; B2 F
5 F9 ?$ g7 @! |: m5 \The way it works is very simple:. X4 V+ D$ k4 _+ _8 ]1 {; O- y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 i2 R% ~1 Q7 O+ w' n& @
WinNT) with the CreateFileA API.* L" }5 V5 Z; B4 v( Z/ R1 |2 N2 V
7 X" p, @0 T, L$ t# c
Here is a sample (checking for 'SICE'):- p7 h- l% ^6 e5 ?3 G
: o! j; i3 W6 q( Q" ], o
BOOL IsSoftIce95Loaded()( b2 n7 m- R- s) y) a* h( |
{
9 e. p& P( e1 ^" X& S5 z   HANDLE hFile;  
( P7 n- U2 t$ {& {   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: z* i: y' f7 _1 o- s1 X; j
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  Y- t1 [$ e  y* |% c5 U3 S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' D9 _( X* W) x8 x! C) a4 E0 f
   if( hFile != INVALID_HANDLE_VALUE )
* {& c! L$ |1 _3 ~1 }0 M   {
9 K* [2 m  c$ ~8 o! f' y7 J# m      CloseHandle(hFile);$ i! P  c5 g- O# G& I
      return TRUE;; j& ^3 B9 V) O' W' Q* K; m+ h2 g
   }6 H, E6 p1 V1 A3 ?" R8 G
   return FALSE;+ t0 C: B, |1 x: b; |
}8 D6 _: w! X, r. |' q6 I
3 Z) c% l6 _$ c6 y* A3 h; f
Although this trick calls the CreateFileA function, don't even expect to be
" p" {* L9 k2 q' W  {able to intercept it by installing a IFS hook: it will not work, no way!2 R5 ^$ J( J, v+ l. A+ M0 w& z
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
5 j, q( ?  e- j" U1 jservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)" L; j, W% `0 S. V5 s
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
( y3 N. D6 S' q6 ~field.! R+ {& V/ v6 ]- l) I+ y' z( G
In fact, its purpose is not to load/unload VxDs but only to send a
3 C) v: A0 W" d4 aW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 c+ [! T6 |7 e) i% \8 u2 q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 M$ r" @# l' d( _) V. I9 Eto load/unload a non-dynamically loadable driver such as SoftICE ;-).) T5 G8 t6 c9 z# ~* l  v4 ~
If the VxD is loaded, it will always clear eax and the Carry flag to allow
1 x. Y( P& X. Q. e- I' cits handle to be opened and then, will be detected.
, C" E0 e. h% A0 @* wYou can check that simply by hooking Winice.exe control proc entry point& }8 Y( S# t( }; a3 X' E- m( {# z
while running MeltICE.0 p8 w1 J8 K% ?( Y8 ~5 A1 P: M

: L1 Q, W# e: C6 w# v2 p8 g- }, h2 E8 S) U+ S6 B
  00401067:  push      00402025    ; \\.\SICE3 `6 K. ]' o3 E! z9 n4 U, p
  0040106C:  call      CreateFileA
% p2 ?: A: B1 a7 L: y$ H  00401071:  cmp       eax,-001
& N& m- P- G+ B1 W; o# H" J9 d  00401074:  je        00401091+ r( U9 p/ D( W, _* Y
+ f/ T" k' k' |3 g; i
+ W$ X0 p# N1 G& u$ `* O1 Y% u5 @. {
There could be hundreds of BPX you could use to detect this trick.8 w1 ^( {- _, E" {9 H' w# Q
-The most classical one is:/ g3 @! u# R6 J9 m% E& l
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
3 M" u* O; {+ N$ R    *(esp-&gt;4+4)=='NTIC'' O) @  A8 [; i$ X' m# o0 C
1 D/ f; U! U1 g3 g* }
-The most exotic ones (could be very slooooow :-(
3 v& |# Q$ v5 @, a7 f   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 h$ I% p+ Y+ i) A5 H2 l5 Y; H     ;will break 3 times :-(
0 `& ?: q: {7 y9 Y' w
+ N, @9 H# L. I; j  Z-or (a bit) faster: ' ^% G4 {- I/ n' e1 R& W
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 ]% B( `4 |+ z1 D. S2 x% G, j7 v' r: v
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 p2 v" G1 g3 ?: G5 @& u: R
     ;will break 3 times :-(" ^: e' }& e6 `: e5 e5 D: l
4 Q' `" k& j+ e! w; H6 w
-Much faster:
6 I% d4 o: D8 W9 e  i   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. I5 ~% i8 Q3 `* @) g( O$ l
7 B3 [1 k' v: q, S9 J
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
! K8 w1 R4 w3 o/ u& S$ ofunction to do the same job:8 Z. Z7 H) r4 {0 X( v8 @

. S& g8 k% a7 a% M& A: m' z/ U   push    00                        ; OF_READ9 Y, R+ v5 |) E3 ?$ s
   mov     eax,[00656634]            ; '\\.\SICE',0* {2 i& n5 w3 t/ C5 z" e, c
   push    eax' G" ]' Q4 J. Z# i' G2 H
   call    KERNEL32!_lopen& R1 _2 V' l/ k, ]9 ~  V! H$ X
   inc     eax
: @; i: t6 y, d" P1 Y   jnz     00650589                  ; detected
; ?7 d3 e1 h9 ]   push    00                        ; OF_READ
2 M# t1 M( [- p+ |3 b8 u   mov     eax,[00656638]            ; '\\.\SICE'4 Y. n7 ~1 Y) _+ U+ V
   push    eax$ B7 s. e) D. q0 Q. E# u
   call    KERNEL32!_lopen
6 i! F# q- W" Y$ A4 ?! ?   inc     eax* ?  L" \3 q3 N3 y' k8 s
   jz      006505ae                  ; not detected+ ?2 j" s, ~2 t3 j0 B

, D  J: u! A! A
6 h6 F. g) M7 w! t3 y/ q__________________________________________________________________________+ D% {8 o, ^  g# h8 p6 ]
2 n! C7 j4 F5 D) u3 Z* M/ s+ ^6 `
Method 12
) c/ n: V4 j, K=========
* Z$ ?0 g" t9 u- O$ y# z, Z% B. E! m2 F3 }( |$ t3 l
This trick is similar to int41h/4fh Debugger installation check (code 05
" h2 A3 L7 |9 c&amp; 06) but very limited because it's only available for Win95/98 (not NT)* Z  X+ Q  y$ k: k2 O& X/ X
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.: L7 S7 Z8 t+ c; d

7 Q, y! ^% S+ E* q+ M* ~1 C9 w   push  0000004fh         ; function 4fh, o5 N7 Z- k; z
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 b+ @$ \/ W" D% x& n- [) \! m
                           ; low word specifies which service
  s, E/ f6 _; y6 }, a+ y1 s9 C                             (VWIN32_Int41Dispatch)
8 ]$ G8 ?. o- Z5 s. R   call  Kernel32!ORD_001  ; VxdCall
/ J# z8 \9 A  L4 M/ s/ m6 {8 r$ P   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 q( S9 I$ z( i6 c3 O3 U   jz    SoftICE_detected
% _3 N5 o& ^* A! T) v; L
( s  C+ j- R% u% V: @! @- ^Here again, several ways to detect it:  `* x) |- R; J  G2 W3 B
$ V% L- j# F6 R+ }
    BPINT 41 if ax==4f, H3 o' Z. v& i& Q0 ^" ^; I

' @) X" Y! {/ t; l/ ]3 A    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& i/ _" J  I+ ]( @
* O. E" ^, P+ |% v    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- _2 }! C- i" a. v& q) q* H4 A6 p9 g, X! Q
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) _7 r8 @# {$ x9 W2 K

0 W8 x3 _! G  f__________________________________________________________________________; @" W" }; o  C& b" u1 N7 C& }
" l1 S8 I5 H6 Y2 s+ ~+ Z3 I
Method 13$ @+ F' ~' y0 C7 n( u
=========* n  N3 r! b* `) e

- w; P% d4 I4 K: h) J# K1 x/ wNot a real method of detection, but a good way to know if SoftICE is: ~0 H- L. e( O. P, T% b+ H  q2 K% @
installed on a computer and to locate its installation directory.
) l# @) G2 V- eIt is used by few softs which access the following registry keys (usually #2) :$ h# \/ l4 R0 }0 x$ R- r
! w0 N' z; }. C7 I, p* z6 ~
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ p1 ~8 M" z! [0 f% W\Uninstall\SoftICE& D+ H0 K& D1 p
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
9 d/ P5 X$ |/ l3 T! F/ d' I-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 _5 |- A- x* h9 \5 _- F- Z
\App Paths\Loader32.Exe
7 \7 c* ]/ M. c6 d. f7 B( ?7 [9 F5 U$ u

, W( E2 \9 k6 Q: u8 z3 NNote that some nasty apps could then erase all files from SoftICE directory; c- ?8 [8 n4 e0 P
(I faced that once :-(7 X) [0 ^: ]- h6 i9 n, q6 O
0 K4 `+ \# L! X. {; H- u! U
Useful breakpoint to detect it:
$ E1 n; o. H% o$ H
) D" W1 E+ a' R3 c* }- D     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'7 m" p) V; [! B4 U4 I& |8 S; ?  X
% v8 d3 a+ s8 C+ J7 B5 ?4 {
__________________________________________________________________________4 h5 l- H2 a# G; Y' `: |0 ^  I

$ f$ A6 ~4 f- a6 o  V! i- m4 j9 u! p. R9 z, o# n
Method 14
, V! Y* y+ n( k* \( S) z=========$ P" M/ J/ |. r
4 ~6 J) ?# h" Y3 T8 R
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose( U" m3 z! {4 ~3 c- Q, z9 r
is to determines whether a debugger is running on your system (ring0 only).$ u4 M0 [# I' i5 \4 K% Q
. W1 x/ c% {9 ^0 R6 y# m' M: u; Y7 ~
   VMMCall Test_Debug_Installed
2 Q" u$ T$ s1 j: D   je      not_installed
! Z. v& }$ i* X- |  Y/ r# |1 y2 c7 Q6 S, V) o2 `* c: m
This service just checks a flag.
  F. w- s( s% {+ x$ R! g</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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