About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>2 m" w3 a! [2 G# q  d8 R* ?$ B
<TBODY>+ L  W* g1 @( }% Q: y* |! |4 n
<TR>
8 b. _* E9 Y/ W; L0 Y<TD><PRE>Method 01
* x. @, L( p+ T, x% p=========0 o6 v4 \" g/ P& m, x( Z; ^% \
4 D  m; h* F2 L$ q! V7 H
This method of detection of SoftICE (as well as the following one) is. P% o2 f, }  ~" Q& H
used by the majority of packers/encryptors found on Internet.0 |/ W/ n7 W& K
It seeks the signature of BoundsChecker in SoftICE
; J. e! Y7 q8 Q5 z) P2 G5 d6 @& u/ U$ `9 ^0 R6 ?
    mov     ebp, 04243484Bh        ; 'BCHK'
* A: q0 l  U& c0 ]& y    mov     ax, 04h( c/ S' A; g+ Z0 g1 D
    int     3       1 P! O; o) w2 T7 v3 e, ]. x; t* |
    cmp     al,4: P7 T4 j' E( s1 |2 z' u8 s
    jnz     SoftICE_Detected
  D# n% q* l+ m3 e8 S* [6 n. T6 t* u- d7 @
___________________________________________________________________________
- T5 w" H: s% P! N' Y9 E# I' W
# g$ L2 [2 e% H; S! a% lMethod 02- b, w& A0 I" S* g$ V
=========
  t. I  S9 B; H! p/ P( `
) l$ J+ k7 P5 D1 G0 J) }Still a method very much used (perhaps the most frequent one).  It is used
" e/ T% b! l* R+ |* y: S0 a7 ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,( ]' o8 _, a7 |3 Z
or execute SoftICE commands...
+ X) Y, s: j( b* c, T5 {( R" RIt is also used to crash SoftICE and to force it to execute any commands$ \% j0 ~" T& g/ @" N. T
(HBOOT...) :-((  
) ]) b6 ^7 V0 I# R% @! O! @" E5 v: B5 a4 f5 N" s7 x: e
Here is a quick description:
3 m8 M7 `) l/ K1 }-AX = 0910h   (Display string in SIce windows)8 y5 x, a* h0 k' G" W
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" h+ I; K$ j5 p2 Z/ H-AX = 0912h   (Get breakpoint infos)
2 s* g  N  E8 ~* i! ?; _5 T-AX = 0913h   (Set Sice breakpoints)! i+ t! i0 j; r; X0 x9 q% K
-AX = 0914h   (Remove SIce breakoints)
! _6 y% c9 Z7 [, m( s* s
% J0 ^& t$ d, Y) W4 ]( R% E1 _3 lEach time you'll meet this trick, you'll see:
# [4 [3 n5 @6 s( Q4 C-SI = 4647h
3 C9 h: M9 a, I9 @1 v-DI = 4A4Dh  i6 s$ O' o7 S4 P! w3 C; q$ ?' D
Which are the 'magic values' used by SoftIce.& H" e0 ]+ ^/ t% H2 n8 M
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 `( U% f- e1 C1 `
3 Z! o# W& c3 ?! v8 W2 E- h* S
Here is one example from the file "Haspinst.exe" which is the dongle HASP) y. S1 C: r0 p
Envelope utility use to protect DOS applications:* p9 ~* M( a: m, X/ g6 `8 _- b

) |( R  g2 `1 R' w! G  p* Q5 t8 w
+ T0 \/ l. v! b& A) V* N, _4C19:0095   MOV    AX,0911  ; execute command.9 @+ N( r+ D1 j$ O4 M
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
# \% S4 r  Z7 u  R: ]7 ]( y! ]4C19:009A   MOV    SI,4647  ; 1st magic value.2 }% D- A* T+ c2 P: f7 Z5 Y. c
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  D8 v" O  L& k% F- V4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
8 o5 M* T. F, E, {0 D* w  {4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute4 G; k" z& x( p, l5 U. p( x# \
4C19:00A4   INC    CX
3 @& O9 J, d$ i) _9 O2 q. T4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute& a+ H, A  _: E( \/ Y# r
4C19:00A8   JB     0095     ; 6 different commands.+ E) o% n3 |: L% N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ S5 W& e( U! Z4 T7 X4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" u% c$ I: O" n/ j! o* M% q

+ y" P4 a) ]( Q* GThe program will execute 6 different SIce commands located at ds:dx, which# L* ?: |5 l; C/ W# H' X2 r' h8 ?
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 P1 P( L1 g2 p

8 x) q) d# F& @% X4 ~* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ \+ k$ r5 b  A% ]& O  I/ p: q___________________________________________________________________________
- l9 F6 ?* J, G* K3 I* `
, ~4 F9 g) G1 g- G
- T5 E) n* b" t8 ^  t/ p& oMethod 03$ Y: h/ N+ [( [- L
=========
' G4 Z/ T; \5 R* L% K; V) A' Y9 @* K. b; T6 ?' _" |' h; ?8 |" }
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* Q4 O& Y+ l' W* K0 y5 y(API Get entry point)0 H) j% Z+ m- i3 X  N, X: u! Y
        ) t5 e5 S6 W$ h! y, Q

. b2 M6 E% ?( {    xor     di,di$ h5 ?0 M4 O, V& k
    mov     es,di
4 K# J% K4 _) _0 ~    mov     ax, 1684h      
9 b6 \8 Q6 ?# e* ]9 v- l. ]* O! p9 r    mov     bx, 0202h       ; VxD ID of winice
8 U% y6 r& p4 X* g    int     2Fh
+ ?5 b* L7 R' f, Y- p; @    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! ?1 N- A* r' m% |5 |, n    add     ax, di
- @1 U8 ?/ [- P" @0 f8 k. v    test    ax,ax
; U& [, E2 D9 X1 M+ p9 G! a    jnz     SoftICE_Detected
' s' R" ~5 u* M3 B
& z) N4 P5 ]1 C3 ]___________________________________________________________________________
% Q! D- U  d4 r; I$ [, B! A
& U6 O4 j8 t: \$ z, rMethod 04" e: F, J8 G' v( c2 `# B
=========, \7 Z. g7 N$ E& D/ e1 t

9 p% S2 p7 Q& ^1 N9 p( WMethod identical to the preceding one except that it seeks the ID of SoftICE
  K8 {$ z& c) u/ vGFX VxD.
" U( O. D6 @5 F- Y/ J: @/ S/ x7 e: M2 k" M: g
    xor     di,di
' r7 N" |$ A5 y2 e: ~    mov     es,di3 E0 T4 s% G5 U5 I) j, Z
    mov     ax, 1684h      
3 D# }+ b8 Y2 @7 T! x9 T    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% b( B! X% Z! h1 p    int     2fh
) `" D; Z; @. D- G. ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 [2 a/ |, f9 x, ^. f- O    add     ax, di: W" x1 ?% t$ ], a
    test    ax,ax* ^2 C8 M" C" I* I$ E
    jnz     SoftICE_Detected
' a0 p7 r% n6 G3 w. H
7 X9 ^* ~. W0 `: q; R7 g% C( c6 d__________________________________________________________________________  T" @; w( d, v5 ~! u7 E

" @7 p5 L9 P" X" X9 g  H5 k/ c0 T! ~: `. [6 q! r$ d
Method 05
; q$ Z, ?* ?1 M) Z=========8 a& _0 w: v- C# t9 l
* ~% j: J4 P9 R2 v
Method seeking the 'magic number' 0F386h returned (in ax) by all system+ ?* Y+ x% _0 \0 z+ ~! Z" e
debugger. It calls the int 41h, function 4Fh.5 c+ i% \+ F" o
There are several alternatives.  ! Q& [% b2 K( ~* d9 v' h

- @% v; f% y* ^) s! x4 ~; Y2 oThe following one is the simplest:
. @0 g6 T' D4 p/ ]& h
4 v% H, e0 `0 k. {" S( t    mov     ax,4fh
' v; i! ~7 y) @    int     41h
( j; |$ Q- R( ?% I; L% K    cmp     ax, 0F386
' C1 d! {- ?' a/ ^3 ~+ y% K% J' Z    jz      SoftICE_detected. t# J3 N' }9 u& K: }* ~  {1 m8 [
; a' @# L4 Y# P* T! q
2 K7 ^$ F3 q4 F( A% V* v% N. a
Next method as well as the following one are 2 examples from Stone's / J, X& R! P$ X7 V; Y* J
"stn-wid.zip" (www.cracking.net):) m/ X# T/ q; D  Z! h" Q( ~' |

; l; F3 U1 A9 b. m) V& z    mov     bx, cs2 W9 _* N1 n1 `( ~4 g: h+ n5 [: D
    lea     dx, int41handler2$ s: `2 q" I0 D
    xchg    dx, es:[41h*4]% r2 R8 x8 c, C3 S/ d
    xchg    bx, es:[41h*4+2]
4 i+ k$ {7 G7 v5 P    mov     ax,4fh
* w- W! r. J+ D    int     41h1 o3 S# A+ |; y; L
    xchg    dx, es:[41h*4]
: X& z. P) }! M9 U    xchg    bx, es:[41h*4+2]
' a% L2 ?/ m0 I  j. s( e    cmp     ax, 0f386h, i2 ^/ K) J4 E5 b8 H0 V) Q
    jz      SoftICE_detected
! _( k7 B5 z: B' t1 \- @& f+ a7 x0 d5 k  X) _/ y7 b6 ~- s1 N# Y3 n
int41handler2 PROC! l3 Z& K/ T" n( G' v
    iret
& J! g5 J$ V6 Y( I& L. _9 Fint41handler2 ENDP
$ b( i3 {+ U3 w, w" u/ r" n
6 y+ \0 u) o6 o9 H+ |, K( d
  s7 |, Z  u, j% J9 l& a6 d_________________________________________________________________________
3 g# P3 V9 h" f. N5 Z  y5 h! p4 Z4 Q$ v6 B& Q) G' U" y
! r) |) F0 t% Y* u5 _: Q
Method 062 s6 ?; n" E3 j4 T2 }6 C2 n/ S; P2 o
=========
" {! I: h7 _) M5 ~: u0 ], m6 x" [( M. U
" h  Z+ P, C' L2 x( T: b9 m
2nd method similar to the preceding one but more difficult to detect:6 ]* e6 _$ M7 u. b# B
5 V9 k2 i/ D. I7 I7 E
5 U6 E! _* T8 U  w% P7 l3 p
int41handler PROC
( V2 w6 R: u- \0 w; H# A0 K; v; F    mov     cl,al; b0 K' z$ A% U3 X
    iret( r2 S$ v' r( W$ d3 f5 }& W9 P4 @& s
int41handler ENDP
: F1 u5 e+ {' P. X8 x) m! u0 H# A  Y3 r7 ?
" o, u: D2 P/ ?9 F1 J2 X' R
    xor     ax,ax
$ J/ t3 u0 F1 `* [    mov     es,ax4 r  F0 l4 ?, M
    mov     bx, cs
6 H4 I9 f6 }. d+ ]- p( L# _    lea     dx, int41handler, f; F0 O# ]6 E0 u1 k/ w. x
    xchg    dx, es:[41h*4]" k( [# ^4 ^% t3 T. c1 @( K! ?
    xchg    bx, es:[41h*4+2]
/ B3 t- w) U$ e- P    in      al, 40h' y" r1 o0 C3 U) Q
    xor     cx,cx/ n6 g% A4 d) s+ }7 P$ a, O: y, g
    int     41h6 ^/ j6 `1 C; ^) C( F) f9 L' l
    xchg    dx, es:[41h*4]4 Q9 O; o) x9 ]- A
    xchg    bx, es:[41h*4+2]% w- |0 K8 |9 [1 _! V9 s
    cmp     cl,al
/ F+ J: g3 g! g8 t, _$ x- [    jnz     SoftICE_detected- [- t- m; {+ x1 _4 t

* s+ l* i9 F% J2 \_________________________________________________________________________. M. I, L0 o7 s" M+ S8 C. j

0 [! v5 n3 |0 H& u' x% a1 vMethod 07) Y/ S: Z8 u$ r2 @( s# t- ~2 s
=========
$ T9 B6 H5 V2 h- ^/ @$ O# Z7 w" w* ?6 i9 Q( h. U( }9 d
Method of detection of the WinICE handler in the int68h (V86)! z# N1 `% }2 |
8 V  H# f6 R% [! t0 X5 [
    mov     ah,43h
% y. c+ P6 S. [9 y7 }    int     68h
9 H4 M' Y- g; h    cmp     ax,0F386h4 I8 h  K. d. y* z% N' X$ ~4 @
    jz      SoftICE_Detected; j, i2 x5 A' t
9 S* V$ }' D6 z8 @) ]
, S, P9 U% z, J9 i
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: n" K" E, E6 J5 Z: G8 R: i3 W) l   app like this:
5 T2 C# j8 n# k5 Y& U
# C2 l+ ~/ @0 I: A1 q   BPX exec_int if ax==68
+ i9 M7 Y6 z8 E) I. Q! b# ?3 u' U/ n   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 Y# _" R7 L5 e7 P3 Q, m1 g* J   located at [ebp+48h] for 32Bit apps)' O/ g5 T$ ]9 Y; S3 |9 d
__________________________________________________________________________
( [  k8 j& M, y! a% k' R* f1 h/ k' o5 e! ~% v' a* G; V, Y+ y
2 P% \0 P  {; R, v- D3 ~) R% D. ^( L
Method 08
1 e6 N8 h& {- J6 v" ?; Q=========% k7 {' J5 L. h. T+ _& h  h/ |

" n% w% \7 P  T; c5 @, L- f! cIt is not a method of detection of SoftICE but a possibility to crash the- T$ u( A+ }' K" r! {3 u3 P0 H+ Z
system by intercepting int 01h and int 03h and redirecting them to another- h: Y  W+ k/ w( y; L
routine.
2 j" v! N# \! D  n3 S( Z) d, KIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points. a6 T' d' j9 h, H: Y
to the new routine to execute (hangs computer...)
6 h  I( y7 |/ i9 X/ I; t* g  S9 s3 E7 G* [% A8 D
    mov     ah, 25h
: f0 a  v; Q8 O9 k: {' d2 h5 l5 O    mov     al, Int_Number (01h or 03h)* h6 A0 A: J/ b" F9 o! v" p. V
    mov     dx, offset New_Int_Routine) f7 l% w% I, K% }" o8 d
    int     21h$ M3 Z! R, e8 Z" }( k4 Z: \

0 ?- M! ]3 s* W% e. w; m, t__________________________________________________________________________6 g2 z( q2 a' I3 |$ r

. M) f5 V2 k* P; }) C7 B2 sMethod 09
$ c+ [& T8 ?6 ?5 p- q=========% o, J+ N# K4 b* B
; k% z4 V% q* W' m+ i
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 i  {  l5 u$ t% i3 D$ }
performed in ring0 (VxD or a ring3 app using the VxdCall).
. {) s! R* v4 R" S: J* _The Get_DDB service is used to determine whether or not a VxD is installed
) D6 _( Z5 O) Wfor the specified device and returns a Device Description Block (in ecx) for7 B' M- N( ?1 K, ]: D7 A
that device if it is installed.' O* y' U" r- Y

5 |3 }; I  K5 X   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
* G1 I3 d; r3 F8 @1 A- Y   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 J/ p# \* I  N* ]5 `   VMMCall Get_DDB
8 X8 C7 k9 K( z0 W' {' T- h   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed- K% }0 U7 W- ^5 l

! |8 ~% J3 U+ K" zNote as well that you can easily detect this method with SoftICE:
4 m/ c% y: ?* B. w) f% r   bpx Get_DDB if ax==0202 || ax==7a5fh; ?, \! e8 h. i
# S6 }+ B# @3 W4 {$ B0 ^% W5 k1 s
__________________________________________________________________________
# F) b' b% E7 i2 E, C1 i$ H3 W5 E& ]7 u6 m
Method 10
" O& e& s: k5 N0 F" w, d=========
8 Z/ S& x. b$ I  A- o
: F) {! h0 y( U: T- _=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ k5 O8 A/ e) U% l6 J& `' w2 p# E8 [  SoftICE while the option is enable!!
+ o: K3 |+ T# x$ t7 q; u
$ P0 S6 B7 {1 ]  R: F) ~This trick is very efficient:( S5 A& Q; y% y9 L" y4 A
by checking the Debug Registers, you can detect if SoftICE is loaded' q5 L/ B2 k# R
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 e% e4 d" @! y( J$ E& C  Z+ l1 X3 {there are some memory breakpoints set (dr0 to dr3) simply by reading their! A0 R/ q  N8 L/ f- D' l: A* D# A
value (in ring0 only). Values can be manipulated and or changed as well
- F1 o% H9 H- c0 }& ]4 g2 Z(clearing BPMs for instance)
: V8 k+ t0 J! j8 v, [6 q+ Q( j1 |+ Y' w" y, R+ y
__________________________________________________________________________
& n' |  y6 X5 b; \3 F& G$ q1 K7 o9 v& R* a: `/ F/ P+ h/ d: R3 R+ s/ p
Method 11
& n7 h$ c) m$ S1 i=========' N/ N6 A: ?" l7 C
9 ^6 T. a: O: v" W
This method is most known as 'MeltICE' because it has been freely distributed: L* R6 `; E/ _( s5 x. U+ r
via www.winfiles.com. However it was first used by NuMega people to allow' K; K1 j7 M, g2 |0 n8 ~
Symbol Loader to check if SoftICE was active or not (the code is located. ]; n4 [# p, O; m* s/ k
inside nmtrans.dll).
) [/ P& T4 Y, ~4 S7 r4 A& h, {' ~' L+ [: U7 H  ?
The way it works is very simple:
0 {$ M0 H- s" \" Y; ~, T% D/ gIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 f& b4 E0 r. x) _* h% F
WinNT) with the CreateFileA API.% w& j2 r4 h, F: w6 }
) n+ ?' r: ^% G! R. p
Here is a sample (checking for 'SICE'):
( g: g9 }. _* r: A0 h3 O( J- T. E& ~
BOOL IsSoftIce95Loaded()0 E" l# o3 g  M: O7 @( V
{
; l; M2 a8 X# @0 V) _   HANDLE hFile;  + }7 D* L  `: ]' O# }! j# c: w
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
, W9 l4 e, g# h                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 h! ^* S  u4 g' h. ^# M" y3 |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, ]% a  u- S9 M6 f! Y
   if( hFile != INVALID_HANDLE_VALUE )
4 [0 _7 A' R# X# ~) A! I. O$ O$ b   {
- R/ C0 }+ p4 u' Y      CloseHandle(hFile);7 E/ V8 y/ Z4 _
      return TRUE;- j- @- |& f& z- M, D: q7 A+ e
   }
2 |9 I; o; y3 ]- b- j   return FALSE;& S0 z2 z8 @+ A6 K5 C2 s( \0 P1 y
}  L" n4 p( ?& ?/ u% ]+ e

0 I- r* o' Z) b" N# uAlthough this trick calls the CreateFileA function, don't even expect to be
7 {' M! U3 C; f$ t# n0 Jable to intercept it by installing a IFS hook: it will not work, no way!" ~- G1 E& q" n9 G6 U5 V! q1 e
In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 `. W, g+ t4 u8 ?  n) f7 W
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
4 Y5 Z" `6 M, x& o$ ^& kand then browse the DDB list until it find the VxD and its DDB_Control_Proc- e2 u! G" N% Q7 T9 X: H
field.
0 D. s+ }) \- u* f, VIn fact, its purpose is not to load/unload VxDs but only to send a
1 |5 j. t; i0 @4 c+ K- JW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. f+ I- c7 K3 d, h2 w) J1 d; rto the VxD Control_Dispatch proc (how the hell a shareware soft could try7 Y; [+ u. `$ ^+ T& a3 n6 R$ m
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# |) t( d2 u7 M& K( f  w; yIf the VxD is loaded, it will always clear eax and the Carry flag to allow1 }0 F/ L. }2 J+ U: W8 d5 B0 l
its handle to be opened and then, will be detected.
4 O1 A; H7 B9 q$ W. NYou can check that simply by hooking Winice.exe control proc entry point/ c5 f; y: E) x% l' [
while running MeltICE.9 ~5 @) A+ _6 ^9 V0 r
4 c( X5 h* z. j7 H3 k5 y
9 s2 @: n. L+ F* P, s
  00401067:  push      00402025    ; \\.\SICE
, s* L3 j1 W+ |) g2 R; y6 j  [  0040106C:  call      CreateFileA, n- Y' d6 U( i, B; b; g3 V
  00401071:  cmp       eax,-0016 G& @2 l1 v" l5 q8 T
  00401074:  je        00401091
% W4 s. o' |/ P8 D! U
% K5 ^& M# k( U+ ^1 Y. R8 C& Z# E5 F; e2 O9 ]. ^; a* f3 j3 L* b
There could be hundreds of BPX you could use to detect this trick.
& v4 j4 u2 |8 j/ e( F* }-The most classical one is:
: e# }8 d# ]; `2 u) p  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" ]6 O. y) h7 X
    *(esp-&gt;4+4)=='NTIC'% w0 \2 Q  Q9 \: Z9 t, M- K0 [; E
" I) j& n0 w! u, s% F
-The most exotic ones (could be very slooooow :-(
/ Q  Y" t* k* D   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 s3 J& f1 E8 p4 U$ Y
     ;will break 3 times :-(
( b& B1 {1 \0 _- Y. B& y' V* T1 _) X2 M8 k
-or (a bit) faster: ; \5 X: x$ F! j6 Z2 l# [  ~* [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
( S+ a; h: @0 y1 A2 R3 R' F: R) m* {# `7 P
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  % R8 P7 ?$ ]* _7 K. ?
     ;will break 3 times :-(
7 t6 o' p/ B* |# c. w% J# g; ]7 f+ l8 M0 F
-Much faster:
1 Q5 U. T2 i" L! f: y. {2 F- m! {   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
4 N" G6 p0 L) ]0 O4 o# J- G
* d2 b( I5 k' ~5 RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen  L; Q# b! _8 `5 J4 U7 i: _- y$ S
function to do the same job:. P8 E! ^8 L* p# }1 q4 {' c$ |7 j1 E

8 k. v" l+ N  f- S" h   push    00                        ; OF_READ7 d2 o/ t) S5 K2 c3 A" ]
   mov     eax,[00656634]            ; '\\.\SICE',07 v* \, d4 Y- s+ r0 d# q1 O& @
   push    eax" w4 e$ Q  f7 [- j
   call    KERNEL32!_lopen6 h3 }- k. a) i/ `# ~: g
   inc     eax- q3 d+ B3 F% O: [( Q9 u3 @6 Y
   jnz     00650589                  ; detected) R3 X9 ~: _- c" {' y" M4 v. I
   push    00                        ; OF_READ
3 w% Y8 F& w" f& o5 l8 ?3 P0 f   mov     eax,[00656638]            ; '\\.\SICE'
; u0 P6 u5 [; j2 p; Q5 q1 m) f% Z   push    eax
" q( s, ~7 _: w2 j   call    KERNEL32!_lopen& `. `& \# g3 I8 B
   inc     eax9 z4 W# O. \  ~) Z# L+ d" A
   jz      006505ae                  ; not detected
3 q. m+ l2 N( Y$ E& H$ }
, Z3 d. o$ O3 B7 w% [% F3 O( v# F1 B+ Z6 K  F# \2 A
__________________________________________________________________________
! Q) e2 j2 O3 N' X/ _% ~+ T$ @7 J7 T4 c% R) N  s& D& B+ ~
Method 12
. k/ T# h, o% J5 u! j% _0 b& W% {- X=========) J6 f* N( K! m. U

. o) f1 @4 K. y5 T! ?; o0 kThis trick is similar to int41h/4fh Debugger installation check (code 05% u6 U6 }7 R, o8 S. R
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' w5 ?3 {) a) i7 x, Das it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& Q6 g& v$ A; Z) Q9 @; F0 T+ k$ N" O
   push  0000004fh         ; function 4fh
: r" R/ D: O+ M$ y   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 `" T) U! }, p                           ; low word specifies which service
) W+ G0 w" W# v8 a                             (VWIN32_Int41Dispatch)
) S  Y7 b+ u( L& e0 j   call  Kernel32!ORD_001  ; VxdCall
) C! X* s2 G5 U$ |& Z+ `   cmp   ax, 0f386h        ; magic number returned by system debuggers
- v/ V  e) Z% Q8 {& U) ]8 l6 E+ F8 F   jz    SoftICE_detected4 X. ]: `3 c) |
  t3 s$ ~, f$ P" K
Here again, several ways to detect it:* ]' g7 D# ~9 C1 w2 I- @" z

( q3 p9 L0 S4 v5 Q5 o    BPINT 41 if ax==4f: L5 s. ?& b! E% i; X. G

  ?$ ~0 C1 |  r    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
$ Y( I) i( O( L7 G: q7 f. A8 B8 f/ Q( b6 m0 Q( Z
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
2 R7 [2 L# |- o7 O, L+ k/ s5 s+ S) q2 s9 J  _
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!( i( e7 u1 F7 Y( f

% `$ r( [! w1 |" \& z__________________________________________________________________________
( t1 }- X7 p/ S. g9 h7 h/ o: J
* H, t9 P$ s+ SMethod 13( y# t/ ^4 r0 V  {
=========
, Y* c; u+ f) N- u  a% J/ J5 v% g8 K9 Z, O+ o
Not a real method of detection, but a good way to know if SoftICE is
% P+ F9 m9 s8 }1 oinstalled on a computer and to locate its installation directory.8 s7 j2 D. s6 R- f0 K
It is used by few softs which access the following registry keys (usually #2) :
& O" ?/ a/ H; ~  C( Z. X
/ a9 L% C' A8 O" e+ p7 O-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ M1 T; M' C- ~6 r9 n\Uninstall\SoftICE
& A. U+ m8 g' w. J) i-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
/ |* s/ D" H4 T! G9 Z+ F-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ v. v4 v; }/ {( x; {; \' `2 @5 M\App Paths\Loader32.Exe
; ]2 o* F1 Z+ K& F% r
1 v! ]) N$ G8 k: n4 y1 J7 P$ e* E, J
Note that some nasty apps could then erase all files from SoftICE directory
6 c4 g+ h% E# C0 N9 G- r(I faced that once :-(& w6 v/ j& `8 {: J' r  y/ S
$ @; N2 R) t1 Z0 X" H- Q* \
Useful breakpoint to detect it:
; B2 z& ]% g% m
9 s; e0 k% `' r1 Z3 y% l! c/ Z1 g     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  O( ~& P" ^+ ?) m

4 M) |4 ?: L) E' G__________________________________________________________________________
! [% L3 e: o  s# b" v3 j4 b
; e# l4 K- H' J4 a. _1 z" P: H" v2 t! M0 }' p5 w' e' v2 H. e
Method 14 9 x2 s! s, Z5 r1 J; [$ W
=========
  s& }$ t3 ^$ s- t% d( l8 e1 K$ x4 m, Z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 h3 a' S* i+ f+ ]- Bis to determines whether a debugger is running on your system (ring0 only).' e  \8 u( A1 `! w% a% l
" v9 v! W" k9 q! V
   VMMCall Test_Debug_Installed; t' v( h5 L" A% j$ Z! U2 Y- e0 z
   je      not_installed
' y6 I- n1 J- O* P1 o" e  }1 H
7 p( f2 }+ u* fThis service just checks a flag.$ N# ~* \1 T! D- E
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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