About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, u! M' M) ]6 M8 M* ?# L0 o; i: O! c<TBODY>
5 V: j. ?; Z, f& m7 c' |1 _<TR>6 r- k) Y0 |1 t, ]* r% C2 Y
<TD><PRE>Method 01
9 I1 ]. E' |, E1 U) U  i=========6 U0 c9 o" j1 F  [/ X* j

& P% y, j3 j1 j9 QThis method of detection of SoftICE (as well as the following one) is
, _8 B8 c+ n2 ~/ f8 Jused by the majority of packers/encryptors found on Internet.
1 W: o5 d2 g: [7 k8 Y$ lIt seeks the signature of BoundsChecker in SoftICE. A2 S% f5 I: y. ~' ~; S( m" Q

, J( g( h- C* V; a7 M# q    mov     ebp, 04243484Bh        ; 'BCHK'; {8 B* T! c3 U" r5 M
    mov     ax, 04h# b* P" q* ~3 E
    int     3       5 X5 }3 j9 M5 I' {! |% Y
    cmp     al,4! R2 N7 D/ d/ X; T
    jnz     SoftICE_Detected* f5 @9 b( t$ j1 l; d& V0 H9 b' E
5 Z: F' Q4 p8 L+ f6 y
___________________________________________________________________________- X. _; _0 L( O  U1 x" R/ x
4 o5 p' F' F9 T& m
Method 02" }, t( ~0 O7 r# L, k, v$ }
=========7 K: E. q3 s3 f! E+ h+ F: B6 P
. B0 ?* [, `+ g" `7 T3 C
Still a method very much used (perhaps the most frequent one).  It is used
! y4 q+ _; R5 x4 y# ?+ gto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
* Z. u- K6 h' |3 C% A  ^or execute SoftICE commands...
0 A( f, t% G) F/ W' T& GIt is also used to crash SoftICE and to force it to execute any commands6 U3 m% Q7 ?! |$ N# f3 ^0 M; I0 W
(HBOOT...) :-((  
& L  C, z6 ^  V4 i  h8 O; x$ E# o  ]1 A( j$ |; {7 \
Here is a quick description:
- r( O( S) f( x-AX = 0910h   (Display string in SIce windows)
5 @5 B; `7 l( l) U8 R-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx). s1 U8 R" X( n3 |8 K
-AX = 0912h   (Get breakpoint infos)
9 Y4 w9 ?- M+ A: C1 x-AX = 0913h   (Set Sice breakpoints)6 x: s0 }4 U: e) J  y, y
-AX = 0914h   (Remove SIce breakoints)! `2 L8 Z0 t" F, c0 w

0 g4 U" {# z) p! ]: J! q. Z1 `Each time you'll meet this trick, you'll see:8 ~" f3 [, N( ?" w( G
-SI = 4647h
+ |- \8 t8 j4 U; ?2 m5 ~-DI = 4A4Dh- I0 {; k2 }' v8 `  ~$ v/ W( v
Which are the 'magic values' used by SoftIce.
: ]! w/ K5 T% @0 M2 TFor more informations, see "Ralf Brown Interrupt list" chapter int 03h./ c, x) c. E; N' d. u( L0 O( H; J

& u0 s$ Z$ ]% P1 W' d  AHere is one example from the file "Haspinst.exe" which is the dongle HASP
: Q( C5 a8 P' fEnvelope utility use to protect DOS applications:
$ A. O- [" n3 e# m
  f# J2 Q& t8 T" M; X8 G- k9 `: T4 X% R
4C19:0095   MOV    AX,0911  ; execute command.' @" W# s! \4 P
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ X& ~6 U  q2 G$ ~. g
4C19:009A   MOV    SI,4647  ; 1st magic value.$ D& Q3 f9 {7 D* I8 h7 i
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
) n+ q* ~$ I8 i$ t+ G* S' O6 P4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
* @1 e* Q2 ^! C/ D) C: c7 T8 w+ D9 E+ m# V4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ u' S% v6 G+ a$ Q, A- o4C19:00A4   INC    CX, }/ E5 |6 s: h2 E- f' l
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute& r1 y5 l0 s( r7 V) G
4C19:00A8   JB     0095     ; 6 different commands.
, A9 ?; V( y1 C$ F! g& N; e4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 g- e5 A. N2 s
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :). ~% c/ V" T2 k; S; V

' B- O7 [. W& j% j+ }The program will execute 6 different SIce commands located at ds:dx, which
6 v! b+ i* {, `7 V% K. l3 Z! L* L$ ]; Vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 F$ n& L( \4 |0 M: j4 O3 ]. q
: O0 E/ M" `' t0 f4 W  m  p( P* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.0 r  E% @0 Q2 R' W: {* Z- ?
___________________________________________________________________________& V9 z" T+ t+ I6 J9 ], n

( P& H7 v9 v. k2 l  M
5 \" G: R/ O+ XMethod 037 q( R1 |* s2 a; Y# r
=========
5 Y$ G  X6 O, n* g# _; F
+ i1 j' w2 [0 E( ~Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h. c2 s8 U0 l* v2 V$ n
(API Get entry point)! @% A2 I# j/ w0 R  M: M
        
# z9 Q  ^+ m% h! k( c3 s( E
0 D$ c: k5 l2 v* `, h9 p; o    xor     di,di
$ S3 j* z# {- A3 l    mov     es,di& s. Q7 {: _8 Z& K: K
    mov     ax, 1684h       ; m) W/ ^: e& j6 @; h# v
    mov     bx, 0202h       ; VxD ID of winice* j& S: U; ?4 D. [. M, y, a& d
    int     2Fh& Q& w: [9 d( u) ]# k2 K1 U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 u$ E4 _( V+ S2 R& i# v    add     ax, di
2 j. l0 C% a2 T) W    test    ax,ax
0 C  x' a4 W* H' s* r# }; w    jnz     SoftICE_Detected
# I" t  `" ~* v' ^% V0 ]/ I
% Y- R/ y% u6 W3 u" t; M___________________________________________________________________________% e+ {. z- y+ y$ V7 ~
. d* l+ G& c+ P6 D7 ^
Method 046 J; i7 Z% U2 W) K2 ]+ m) M  P- R
=========$ I5 E/ o1 |7 g0 \
) j4 a: k$ r0 A
Method identical to the preceding one except that it seeks the ID of SoftICE; Q- I, k! L5 B5 p+ N
GFX VxD.
' T- h0 c( M; \; T% {, M( r2 [9 }3 {$ F! Z  m
    xor     di,di
0 w( D2 g7 d8 b8 s2 ?+ V1 ~    mov     es,di* o& x9 f: P, r5 d: |* a, m7 h
    mov     ax, 1684h      
! D- f& j" c4 a; O    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 `# i* F+ M) C4 f    int     2fh
) m. N) ]: E6 I5 f    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* \* J9 \$ R* }" b# k1 a    add     ax, di1 t) \/ X; k4 o4 z
    test    ax,ax) P9 `, b: C6 r0 n  F
    jnz     SoftICE_Detected- j2 |4 ~# R$ w5 N+ e! n: X1 b

! I2 S" }7 t- x" o2 v( C, ^__________________________________________________________________________' Z, p% _( _( F- f

) l+ w" s/ L, Q1 j/ B8 z  @0 v; ]3 q
Method 05
; Q1 K6 j+ v- q+ j: K& [=========3 v4 H( R, b4 W3 h, m
! {9 |% Z7 `) z8 ?* K) B
Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 U6 t* Z+ ?/ D' P$ \debugger. It calls the int 41h, function 4Fh.6 N1 P. ]; ~2 h) A' @* L
There are several alternatives.  
% Z% Z5 G% r7 J- c" S; z9 n! q7 s
1 |6 A: @- Y3 k- d7 Z, m( xThe following one is the simplest:& y  ^$ t( @# f" d* Q
9 [8 q9 w$ v7 B$ X5 h* V" Y
    mov     ax,4fh
5 x5 D4 d! M. P$ U5 Y    int     41h
# c, f  D% F9 c! `, }# }* p    cmp     ax, 0F386
5 b' G4 r( E$ }8 L; c* u    jz      SoftICE_detected3 A$ C4 s3 r8 J- x! a/ k

& M4 n! L& [# i! \4 G1 M( g' v, K- u. D3 g* A; `4 @
Next method as well as the following one are 2 examples from Stone's ( |, J4 {) Z% S& H) p7 r2 h
"stn-wid.zip" (www.cracking.net):
1 B. |/ |, K2 H( g& t* z; N9 C0 b3 Z9 Y4 {; l; p: {/ o# a7 A
    mov     bx, cs
8 I- i) H0 E8 n4 q    lea     dx, int41handler27 |( Y/ ]; e" ?. z3 k0 q. m: V9 G- t
    xchg    dx, es:[41h*4]
0 F* w  C! G2 l+ f3 T# X( j    xchg    bx, es:[41h*4+2]
- F$ n# ]1 f* A2 k    mov     ax,4fh
/ F3 n% a& k( \) [* x- i" ]. X    int     41h+ b# G1 ~; ^) F% U
    xchg    dx, es:[41h*4]  s2 Y: _7 j  Q
    xchg    bx, es:[41h*4+2]; a# M  }( v) L; K( e
    cmp     ax, 0f386h
9 m6 R$ o/ u* F7 [4 L. L9 G, w1 S    jz      SoftICE_detected( w% |; f4 i: O2 a2 @9 p
& T" H5 r# m+ f
int41handler2 PROC
% Z0 R5 ^$ J- r) O4 D    iret
5 `7 [$ [* E" g7 u2 U9 X5 Xint41handler2 ENDP" z: F; L9 _9 {0 t
8 w$ c; ^) x  D- d" p: u

/ N9 V- {8 m+ Z" v_________________________________________________________________________
3 l( H0 H% v! R: s5 b; ~, h# x& T: T- K
! ~6 {( p# e* X6 I. [. ?
Method 06
, t: c! d; x, Z0 }# v6 ^% n=========$ x6 d4 {- H2 v- _

: h$ W) Y* y- q# ?  U# t& E( Y9 u& _3 v, ~, C% r
2nd method similar to the preceding one but more difficult to detect:- T. l2 }9 ~: Y5 c* V
0 U; p0 j) y# `9 U4 E0 T8 l$ g

# P& X$ S2 U% i% `! X7 Vint41handler PROC
' H4 x0 t6 ]+ S: p: {7 i( S. ]    mov     cl,al7 o. W8 P$ j+ t/ ?
    iret
& z. S' B8 E& }' J" W6 R  mint41handler ENDP
% o0 t. r5 S8 n0 E2 O8 S+ I$ y
! S% X9 ]' v0 w- F9 E# d+ Y) X% i$ S6 m
    xor     ax,ax
1 y- r- H# x+ P0 Y$ U; S    mov     es,ax
8 C0 a# Q6 B6 @9 u    mov     bx, cs. p$ K$ \) b( p7 @# m3 V: n
    lea     dx, int41handler
" r, }  \- h; h& U$ s. x    xchg    dx, es:[41h*4]
% h0 T4 A' f7 ~- ~! r* w2 i    xchg    bx, es:[41h*4+2]/ J( S# o4 p' f% y- E
    in      al, 40h
) e6 {: I0 n9 z+ X! S; n4 x. M    xor     cx,cx
) Q; t0 P5 p3 f1 l2 ~) o# C0 s    int     41h6 t! I1 v) O" r
    xchg    dx, es:[41h*4]
5 O% e; l- O: z  G  j- _& K    xchg    bx, es:[41h*4+2]# d- g9 Q8 J( M3 ]7 _4 v
    cmp     cl,al
& i  X5 }' a0 u' B    jnz     SoftICE_detected2 c+ h& y6 H* a/ s- x" M
+ G" f2 ~" v& n( M+ x  R" l# p
_________________________________________________________________________
7 S- ^9 G5 u3 i" g
8 f0 [1 E0 g. t8 i# N( u# J8 }' WMethod 07  Y- K3 g& c# ?9 a6 k
=========
, N: u4 P5 J! ]1 z, `/ [
, j, r: Q8 n/ Q! P: N1 H" }Method of detection of the WinICE handler in the int68h (V86)
/ y$ P2 Q1 T2 `' V: X
: c+ P  R5 R8 Q0 E8 a& C; m) L3 ?0 r    mov     ah,43h
3 i1 N$ l( U7 M) `; V    int     68h3 ?$ ^* g6 }2 [* f  X. F7 H5 p
    cmp     ax,0F386h
' ]; M* T1 }% S# ?    jz      SoftICE_Detected5 j5 E7 C& V' g! l* x# j
% z& p6 s8 p8 C9 X
  S; K. V6 N5 N3 j  q
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 J8 s7 M/ u8 X8 Y
   app like this:) g  A: X$ B# d% |

" M: o, m1 e! a   BPX exec_int if ax==68& {* T' A, I8 A
   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 g, B) }' ~; u* c   located at [ebp+48h] for 32Bit apps)
# |" k, Z/ K" z% R__________________________________________________________________________
, p& D6 @$ {6 u$ {" ?
8 o$ H0 c5 Q* v6 W9 j0 V8 r9 u" {
2 C2 u& D' _) A, X* CMethod 08# Y1 [" t; M6 G9 `: j1 G
=========
" u/ {  I* [! \" h6 \5 v9 T5 \& A4 G' A, J  H! B8 q. w+ m
It is not a method of detection of SoftICE but a possibility to crash the' u; G* L. k7 H7 i# H$ |/ ^
system by intercepting int 01h and int 03h and redirecting them to another! r% q% Y" U7 r3 E0 B
routine.8 s0 Y7 W: h/ q3 _
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% ^( t4 F- Y" H3 T6 O: D" ^+ ]to the new routine to execute (hangs computer...)3 u! r2 q, k2 h& L  L/ P+ R) j* V+ j
4 h7 ?' O: k& G: @
    mov     ah, 25h
& \: C& ?0 q5 J( ?+ {    mov     al, Int_Number (01h or 03h)' M$ a  k. D; E
    mov     dx, offset New_Int_Routine6 S6 ?: O+ V* r, \* J/ G
    int     21h
; H8 I- K* S2 m1 |2 z* V3 l% R8 k+ |: h2 ~( d
__________________________________________________________________________, d; `" `+ C3 [; \. {9 r
: C% r; x! G7 E' L& w! |3 h& n
Method 09
; }6 A' O+ q5 o' H1 d6 ~- _/ l=========! r6 H" D6 V: W: ], N# M

+ P  m/ M  {+ x# m; c# qThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only2 Z) ~% N1 |. s" x
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 h3 L$ Q2 z5 \  V7 h1 W$ h7 ]The Get_DDB service is used to determine whether or not a VxD is installed$ j  L; ?1 D- E! x0 A
for the specified device and returns a Device Description Block (in ecx) for3 `2 l! _$ X2 z! v) s
that device if it is installed.) \6 N) F7 K+ E5 S

. D$ B: W- [5 A( V1 a$ g5 `. d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 P9 l9 _( l4 ]+ L5 O/ i8 W' y   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& j/ L# y7 u( A   VMMCall Get_DDB2 d7 D6 [9 g3 ?; i
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% h' l- O9 o0 N6 s9 s) ?5 g+ T, \# P
0 }' x0 i0 H9 }) ?) D# l
Note as well that you can easily detect this method with SoftICE:
' b6 @2 z* g- Z! S" F3 V) u; H   bpx Get_DDB if ax==0202 || ax==7a5fh; u  f9 h+ {8 E( G: j
& Z1 \2 X0 p; r' M
__________________________________________________________________________
9 Z, f$ M1 _5 N& P( f
! q% t  v9 v7 e6 ^$ GMethod 10
. j& ~. b2 j8 A=========8 i2 g9 ~" D+ G) B7 s+ M6 u% V

( o6 n! C& K1 N0 j, }=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 ~5 \6 E2 |; T" J6 d
  SoftICE while the option is enable!!
& p6 T  c, T  o. a
/ ~- H5 y, e1 M! }This trick is very efficient:
2 H1 O* e8 U! F% Jby checking the Debug Registers, you can detect if SoftICE is loaded( Q. ~; X0 u$ W! K9 ], H6 F
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 L( s: H$ o* _+ M) f$ O9 sthere are some memory breakpoints set (dr0 to dr3) simply by reading their
' |/ D; G) K/ I' C* }8 {value (in ring0 only). Values can be manipulated and or changed as well
, W) k8 L" C  R2 W3 ~(clearing BPMs for instance)5 p' G) L% g+ W% G

1 N8 @" Q& a* H. k' q__________________________________________________________________________
, e+ n$ n$ U; _3 y
" N) s+ g1 F) H' d; ?Method 11! G# ]! E& l) G$ |. Y  O9 A
=========
# ]! I0 b7 P4 d( j
% b3 ?, @$ m4 H2 p# I7 LThis method is most known as 'MeltICE' because it has been freely distributed
9 G- \! s4 g2 @8 qvia www.winfiles.com. However it was first used by NuMega people to allow
! v0 M0 r, W$ R6 x8 KSymbol Loader to check if SoftICE was active or not (the code is located7 e5 ?! {; l) Y* H2 t' L
inside nmtrans.dll).
" ~+ J3 l) s1 p0 r3 R) o5 N' f7 \9 H
The way it works is very simple:
1 i. S7 K+ q1 xIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: n7 C8 W) O3 J" F( I% x7 ~* ~. iWinNT) with the CreateFileA API.
1 R( i6 R( J, C/ ^  t
+ E; u9 D7 }6 O- y' jHere is a sample (checking for 'SICE'):
3 p% c# ~' D! {* i6 {& L) f
6 o+ D, F' i4 Q' l1 c( P& GBOOL IsSoftIce95Loaded()
/ X! L" ~9 |# j9 ~/ X7 X* O) x1 z{( Q' Z1 L) m1 p) G1 l% b8 |
   HANDLE hFile;  * I' f. I6 A8 |
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) f: N) d; _: Q3 C
                      FILE_SHARE_READ | FILE_SHARE_WRITE,% p# s, e/ `/ W7 L  H- Q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; n. `: q8 @( {4 K' e1 _   if( hFile != INVALID_HANDLE_VALUE )( Z3 A3 h0 e) d, d' D
   {
6 G9 m7 N) V' {3 K! x" f      CloseHandle(hFile);. ^# V& K& P8 {
      return TRUE;8 u5 d9 e- [0 ]/ f% f
   }" b, \" w6 {7 c' N% h
   return FALSE;. m" I+ G. o( Z+ C* X0 [% v, M
}0 {' V( a, O3 i/ [4 C% o
9 o' h0 ]$ G, v$ B: l
Although this trick calls the CreateFileA function, don't even expect to be
3 R! U6 `2 M2 Q* r+ qable to intercept it by installing a IFS hook: it will not work, no way!9 d$ D& u0 k% o& `% l" b
In fact, after the call to CreateFileA it will get through VWIN32 0x001F4 C" I2 a! w4 Q9 y1 H* ^
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& d7 b1 _! j$ a3 O' A% ^+ zand then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ }' P0 E& q+ F0 y0 N% Wfield.
* K1 O* g) r( QIn fact, its purpose is not to load/unload VxDs but only to send a 1 p4 I0 z" l; X: O- m' w
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 e4 l0 F; V. N/ ^- |: K( C
to the VxD Control_Dispatch proc (how the hell a shareware soft could try4 B# ~5 Z% S, a, B, l, }3 N' Q1 p
to load/unload a non-dynamically loadable driver such as SoftICE ;-).$ }* J- y# T/ l) T
If the VxD is loaded, it will always clear eax and the Carry flag to allow
5 r4 ]0 p7 p+ d3 I1 H5 t$ @its handle to be opened and then, will be detected.7 J. E  W5 f6 A! w9 ?
You can check that simply by hooking Winice.exe control proc entry point
5 |( u: }* Z% nwhile running MeltICE.4 V, c8 R7 j$ b+ b
# @# b- {, s( y  u
  i: P. Z1 E7 P" \
  00401067:  push      00402025    ; \\.\SICE5 c; }, q5 o" y9 V& f
  0040106C:  call      CreateFileA) j% }. n/ {: {+ ]7 e
  00401071:  cmp       eax,-001; f  B" L1 P' J7 S3 f! k9 {
  00401074:  je        00401091/ k- F- M5 _6 I  N* D: w
) h* S6 V3 w8 ?6 I) `0 S

5 e5 b4 L( L! C! }9 b+ T' r4 }There could be hundreds of BPX you could use to detect this trick.
) J- |$ B5 g6 s% s6 ^6 Z-The most classical one is:& v2 @1 `7 W$ U& S: B% C' M
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 [! Z3 c( _$ m/ ]6 N
    *(esp-&gt;4+4)=='NTIC'
* I8 c4 S9 }; K! J* _  M7 Q2 z% m1 u
-The most exotic ones (could be very slooooow :-(/ ?- s/ T; w4 U" d: V8 }) g+ j
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 M7 Q1 K" J2 ?( P7 g, \5 i
     ;will break 3 times :-(8 g9 g% N" e1 x) U2 z5 A2 O
4 S9 n8 {% V% S2 v# |) {
-or (a bit) faster:
7 }  Y- Z. E2 X/ x$ T7 G! P   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 \2 ]$ Z4 ^# P- t% b6 m7 M- N
2 s3 @& C, X# P
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ |$ A# n( M) O9 }7 v3 z     ;will break 3 times :-(  H; s# {  d4 @! O- f1 G& U
# L8 }( a  ?$ {/ `2 _: Z
-Much faster:* n# W1 g# F  `( q8 G
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ h+ H! Y' ]: c$ e8 i7 j9 T: [+ i( L6 L, k4 R8 _7 l
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ G# u8 x: n0 |( B9 A: m, ?function to do the same job:5 O7 X& a' c& U" p
  C, J& V* t: F
   push    00                        ; OF_READ' G1 W0 Y; M" T
   mov     eax,[00656634]            ; '\\.\SICE',0% p1 A2 F9 [9 B6 u6 Z9 V
   push    eax* A% _* }% b4 n& s; Y' L2 H
   call    KERNEL32!_lopen/ `# ~- W) M. O3 {
   inc     eax
6 g" s% A, J: w3 N$ u   jnz     00650589                  ; detected
8 S7 I0 w; Y) h7 u* S! T: {   push    00                        ; OF_READ# Q+ v) P8 {- }: M$ H1 Q* a
   mov     eax,[00656638]            ; '\\.\SICE'  P* H  A0 t. n3 k" C: H6 Z
   push    eax
# Q! y' M) Z$ Y; \   call    KERNEL32!_lopen3 G: Q1 B! R9 p  Q; `
   inc     eax# a: u3 A+ s7 P, a
   jz      006505ae                  ; not detected5 I& e1 y$ S2 c) S1 C
7 S! B7 ^; N/ ^- {$ f
: X$ h8 M& u: B: n8 z8 T
__________________________________________________________________________
6 I4 N7 m# ~8 S
5 f  p# E: l- X8 }Method 12- e- l& k3 A6 }6 `) e, B9 A" M6 K
=========# R2 n$ L& t/ f+ f, I4 H
8 ~$ f1 x) G+ Y/ A
This trick is similar to int41h/4fh Debugger installation check (code 05
4 ~5 X/ Q% [% \, X0 k& ]7 ]&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ o( r2 i- x+ ?9 yas it uses the VxDCall backdoor. This detection was found in Bleem Demo.# H' ~" E3 o% Q* w
! _6 e/ c  `7 Q( Y
   push  0000004fh         ; function 4fh8 {( ]" X7 n: r1 _
   push  002a002ah         ; high word specifies which VxD (VWIN32)% o$ W! ?- \8 b% o2 Q
                           ; low word specifies which service
2 [- u" g8 e( [* {, q$ a                             (VWIN32_Int41Dispatch)  {, E& {, @: T" P  W) W% v6 ]
   call  Kernel32!ORD_001  ; VxdCall
( y( L. E- R/ L2 `9 D* D0 }   cmp   ax, 0f386h        ; magic number returned by system debuggers
. W  f1 |7 K+ ~" ]  ^   jz    SoftICE_detected2 H  S5 H8 J; i( k3 f+ g

0 }' i# [' z. H! _5 U; YHere again, several ways to detect it:
; L! `7 h" \+ j
. x% o4 m0 f1 [6 U: R/ R0 |" a' P    BPINT 41 if ax==4f
& I" b) P( b2 y% a8 t# C! Y6 S
; b& A  D: [0 x4 ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 q3 L7 \# Y/ O" J
% m. w7 I) Z* _7 Z. C    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! s- y' m: K8 V* b5 G7 ^$ r
) v# v' L) |0 X: b8 W- P
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, S" ~  a. s6 Z4 f1 a" B6 r+ n7 Q
/ r7 x* F- E& L9 I# j; m
__________________________________________________________________________# ]$ Y: n  X# h; ~# }) u1 a

" v  }, C# [' C8 cMethod 13
* i: [: R+ V* T$ R=========4 S* C0 S+ y0 ~8 g0 A7 t+ c0 g
! P( c' a/ x* t- o6 @# U1 X
Not a real method of detection, but a good way to know if SoftICE is- Q# z0 _' `+ p' I. J; u
installed on a computer and to locate its installation directory.
! s* p% `) v* X* f# b: e4 L. KIt is used by few softs which access the following registry keys (usually #2) :
  d( {' P6 G& m& s: ]/ p3 |* d. Q/ W0 d) u1 o" R
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) U+ X! K0 I) c4 G/ T+ R7 y! h\Uninstall\SoftICE$ [4 c. [# \" Y+ z  K% X9 Z" {
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% V! ~) w+ G% X. Y7 @# X
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; y) g. _- R, w0 x& B  p\App Paths\Loader32.Exe
  L! h5 V7 y4 P$ z. b* \: I
7 k1 J% A/ D8 C0 S& p( ], D% m
! Q% U% d& X" h4 tNote that some nasty apps could then erase all files from SoftICE directory
% ?5 C& p0 ^. S+ F  S+ w(I faced that once :-(* k' H: c/ n1 t  v7 \$ H. W

$ K2 T" n( t) \, b  BUseful breakpoint to detect it:
# Q! }& ~& ?' s0 m, @, J! z, e2 @8 L4 A: A8 w* C# h4 j1 u2 S+ O
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'+ D  r. y! c' R3 a/ i

5 a( r" y! ^5 ~7 f5 l$ |  w$ q$ {__________________________________________________________________________& w; L6 W% V3 d

$ n# \; x+ ?& V/ s! ]: |  J3 L2 `! M$ s
Method 14 , f2 x! E# K' f, S4 y( j
=========9 i/ ~6 O6 M1 b* b; k1 C: ~; N

7 \% K# W) H. v* S. b! n; {A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
1 I+ j# @6 M& y2 X" |* u) T( Zis to determines whether a debugger is running on your system (ring0 only).
8 e4 @4 Y* Z; f6 A, v) A( S' r+ v% d) ?8 ~4 u: [* T: L
   VMMCall Test_Debug_Installed
7 r2 M% F2 r" e6 Z( o: k6 _9 x   je      not_installed9 m" i2 p- V$ c9 K% o1 q2 i

# X3 Z4 e9 e: H. HThis service just checks a flag.: @' ?* e( U) K9 t
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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