About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* w: T% R8 p  P& Y
<TBODY>; F% ^) Y+ Y- }: q; y3 |/ _
<TR>
# X# n1 X2 F9 {<TD><PRE>Method 01 ! `* t5 v: y, t: Z! G, R
=========
- k8 y! f0 N6 W( Z; ~1 D4 v
/ e! d$ ?9 B4 t6 A$ ZThis method of detection of SoftICE (as well as the following one) is& ^/ x' M+ E4 l  R1 }4 f2 c  d: }
used by the majority of packers/encryptors found on Internet.( A* @7 ~! c# `% H* P: X( F
It seeks the signature of BoundsChecker in SoftICE
: l3 \! P% ?6 L" e" N- N; y1 ]/ C4 v9 q. {% p# N
    mov     ebp, 04243484Bh        ; 'BCHK'
8 J" ?' a1 t2 ]0 n" M    mov     ax, 04h8 i5 k1 _; s7 z9 j% u
    int     3      
! Q- L* p6 r1 L! F    cmp     al,4
* k% ]) Q  F  _0 r; I% e3 t0 p$ g    jnz     SoftICE_Detected
9 q$ q6 I- n4 n/ O
5 M+ o4 c3 p5 S! y) @+ F___________________________________________________________________________+ f. m. _1 I* P; ^# f

( r1 p3 d3 k& D8 K3 }  RMethod 02
5 z5 n' Y) s5 w$ h# `=========
) q0 k; c. S+ O
% k# L, Q% P& }6 n/ H: D, P9 ]1 Y  _Still a method very much used (perhaps the most frequent one).  It is used' @; m0 g! p, Q9 H' D: w* h; t6 b
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 h: G: M  W8 \1 J
or execute SoftICE commands...8 G$ G+ `* J* a! R4 Y1 S
It is also used to crash SoftICE and to force it to execute any commands
. X' z# _! x* J* b7 q0 C(HBOOT...) :-((  & X6 C* g' y2 E- |4 p

9 N2 X0 I) U7 h, K# NHere is a quick description:  f$ l8 i4 A1 Y" d6 o
-AX = 0910h   (Display string in SIce windows)
' m2 T$ y# r* z1 q; ?0 k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 i9 L! U5 o  }( ]5 Y1 W8 `-AX = 0912h   (Get breakpoint infos)0 K# B8 a9 v  O, r0 G: p1 D
-AX = 0913h   (Set Sice breakpoints)
8 f7 `' o: ?8 H0 q-AX = 0914h   (Remove SIce breakoints)% G5 o6 ^- u3 C' k- K; |

, K/ r7 V( K0 U2 }Each time you'll meet this trick, you'll see:
/ g4 G* K, h) V- N-SI = 4647h4 a  L( L3 t' Z# t7 w( R& [- {
-DI = 4A4Dh
/ p! x; r# e# |* ^Which are the 'magic values' used by SoftIce.5 k/ A+ `  D  w5 @8 A0 H
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, T& j6 `) D% }2 H- ]
3 U1 k- S0 d/ U( E3 C9 g  a, EHere is one example from the file "Haspinst.exe" which is the dongle HASP
" M( R% h' I# @5 t' R' mEnvelope utility use to protect DOS applications:
0 K7 D; d. y+ W( K7 i4 }2 K
; U$ ~5 n. j! S. C3 J# Z/ D& V+ v4 v. I) g9 a
4C19:0095   MOV    AX,0911  ; execute command.
& o8 {1 C6 J& o. n% w* a  d4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).! C: p+ A0 t0 Z- W6 o( N  l
4C19:009A   MOV    SI,4647  ; 1st magic value.
3 G4 b9 F1 v) ]0 h0 M7 L* L. ^  q4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! K  y, a' k+ S) A) E1 k
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
$ F8 W1 o3 x6 Q. S4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 S! [1 X( Z9 C5 Z" b  C1 y
4C19:00A4   INC    CX9 d2 b" h, d; [) s: j  J- K2 {$ z' Y) m
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% Z% b; R) @2 u, i% G
4C19:00A8   JB     0095     ; 6 different commands.9 I' }* s' {. c& p( ^- l3 C! J% W
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.; J: j' ^) Y  \9 a; X" T3 r
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 j9 e  F# D7 F7 y, q6 r
; A1 w- y3 O1 X- Q
The program will execute 6 different SIce commands located at ds:dx, which
2 M1 S: d2 X0 u. m: X% k& O+ k# @are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& c3 G1 o* F" C+ Q: o) |1 h0 p
+ B5 q6 |6 p1 n4 A* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- m( m( r: O; J; \, P) |
___________________________________________________________________________
+ G- Y7 |- a0 \7 o$ R: q) m. ?
* ?; |- k1 m6 P6 q9 I$ T8 W) F: \9 n
Method 03- J3 ^0 H) Q/ t7 @1 r& ^
=========
2 C, U- W" N2 l* _. Z  U" n! e3 M, O' E$ ~; H. j
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" \  h7 `" I5 O* k
(API Get entry point)3 w5 {7 Q) ^7 C1 L8 x2 o- p: W
        - s4 m: R! |2 m; U! r" Z

6 w% O/ w$ p8 j, n( W. J    xor     di,di
+ P  P6 t5 K  e; _/ |/ i    mov     es,di, C7 ~$ K8 P, @, ^# H+ X. p" w
    mov     ax, 1684h      
" D6 ?2 d5 P0 r! a' j    mov     bx, 0202h       ; VxD ID of winice2 f8 C) q) K+ [) L+ d
    int     2Fh! b5 s  h5 T8 i1 _* o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) y% r9 |) l4 u! p' G# l4 Q- i    add     ax, di* K2 ^* x; n0 `+ ~7 ?" A
    test    ax,ax0 i  a; f7 H8 g( s
    jnz     SoftICE_Detected2 E' l3 G/ \0 L, |4 P2 a
0 P5 H! T! {+ Y1 f1 B8 V* V. b( D
___________________________________________________________________________
5 t2 c" I6 i5 t; e: N
' l" v: S6 R& `- [* A$ d4 uMethod 04) r) r/ r6 T2 S
=========
' t  f- T$ u( w9 z
7 g! m& v1 C, k4 }; x4 V0 G+ AMethod identical to the preceding one except that it seeks the ID of SoftICE
. s" Y; U. w: x$ v' i: xGFX VxD.7 \) T  ~: I1 X3 X& l& e+ n# B

  }! `& q2 E2 w, m    xor     di,di
, j9 Q, `, k4 D- J! j" I& b1 e    mov     es,di7 k& j, ^5 w9 R6 }" Z+ H& c- C( L- Y
    mov     ax, 1684h      
2 T/ `) t% o" I, _    mov     bx, 7a5Fh       ; VxD ID of SIWVID
/ A& ~: S2 a1 L7 U6 t; j) J0 ~    int     2fh
2 ~4 U$ w. m* k+ \2 j9 J    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 C* I& R5 l! I2 v
    add     ax, di
$ Y8 Z9 H# \. V& }! F    test    ax,ax7 |. w* _3 y4 Z) u
    jnz     SoftICE_Detected
6 ^$ \( R& I) \
$ u" A5 f' _: I5 A__________________________________________________________________________
& k; f  X1 D( G% T
8 T; k+ S' u( N1 S" A( z6 ^) j2 P  h1 o  m2 K
Method 05
' b* i8 o2 G; c# @=========, ^/ a7 x$ y& K

( [# {, ~( K1 N( I" E7 g. cMethod seeking the 'magic number' 0F386h returned (in ax) by all system
. e# B! O* v/ K) Y& h& C6 K4 i7 odebugger. It calls the int 41h, function 4Fh.
8 S# m$ ^9 F0 E$ X8 D6 B. H+ u- V; VThere are several alternatives.  
0 K. @" ^# c" N9 Z- f
2 a. N' h. E. z  EThe following one is the simplest:
/ D; h* |, O$ g, ?8 g5 M, i& ?4 L( u: b3 }4 a: C) S, I6 ?
    mov     ax,4fh
$ O: _% N, T7 b0 d. w+ `! X    int     41h% x( E1 o, T6 {
    cmp     ax, 0F386, I/ s5 y) |" g6 B& X
    jz      SoftICE_detected
: q/ _5 Q, i$ G* c& i8 W. n) n1 f, `8 z/ T8 `( d2 j3 ?

6 a7 O. e9 q% P! j4 ONext method as well as the following one are 2 examples from Stone's . }9 `% ?2 k, G* r4 `: [
"stn-wid.zip" (www.cracking.net):
( z, u1 z5 _1 N* I" d  A; |, U. M5 c
    mov     bx, cs
, ?$ d& x; ~4 T8 m1 n- W* X    lea     dx, int41handler2( v% _6 n) {$ n
    xchg    dx, es:[41h*4]5 A! G' ^- f+ D/ }7 l
    xchg    bx, es:[41h*4+2]
: \$ N- S, s7 U5 N    mov     ax,4fh
: C/ a, V8 h/ s2 l5 W) ?: k" `+ `    int     41h
, m0 c2 B. @4 T: p, W' H5 E    xchg    dx, es:[41h*4]
5 w& [7 h: J$ O/ b    xchg    bx, es:[41h*4+2]3 h- u* Q) g' T# m/ F' ]
    cmp     ax, 0f386h
" t. m" j9 l) r- H% \    jz      SoftICE_detected
& l" O2 u: t6 `& P
6 m+ v' j- l- nint41handler2 PROC
: Z+ c4 e( y/ K9 G& l    iret
+ y5 [3 g2 P* k4 B  Aint41handler2 ENDP  T* i) a% |/ R2 V! C

; j1 c' q' j+ B% C! M
' n5 Z" L& U, w2 p( C6 Y_________________________________________________________________________
- m' u7 i, J0 P& _2 ~- M6 x. y- w  i- D% S$ u9 a. w
. Z( R8 X- i" C
Method 06
- o: A! f( a! U% ]. ]) _=========1 a, q2 v3 }7 q
* p* c4 n2 A  y1 f7 E

4 q* p2 a& S( X) B  s2nd method similar to the preceding one but more difficult to detect:7 V) q. B+ x9 V. \" i9 l! o+ O' o

# ~9 I! v( L* b0 l- d' D# t! U4 h! R; j. `
int41handler PROC7 Q) e2 H: |0 @3 x: D. |- g0 ?
    mov     cl,al4 ]- ?# ]! c1 f, D9 h4 n0 a1 U
    iret
* R2 {4 S$ v9 E* K% a" X8 lint41handler ENDP
  {; O( `: R+ W5 t! i/ s5 Y5 A1 C% O: W% N; E! f) e! n
3 J# y% N2 y1 R- o* X
    xor     ax,ax8 t; h9 j# O0 U2 N/ ]8 i" O
    mov     es,ax
2 s3 l5 y: V/ U    mov     bx, cs
$ C$ i1 f, g( D  p    lea     dx, int41handler
5 P5 Z5 m/ L+ L1 {4 M    xchg    dx, es:[41h*4]
$ K. i1 y  F( v& L; J    xchg    bx, es:[41h*4+2]- c: V( V4 B9 a+ [' n. y) m# Q
    in      al, 40h6 A7 q3 z0 P  M. k
    xor     cx,cx8 @( k9 [1 J1 e
    int     41h
! X+ {7 H( P( `3 V( D' |    xchg    dx, es:[41h*4]6 U6 o8 Z; m( r0 Z
    xchg    bx, es:[41h*4+2]  t" u* V; c" G: l
    cmp     cl,al
1 y9 p/ |' \5 }    jnz     SoftICE_detected& ]1 E% k8 s. J5 F! X1 b3 `! i

9 P8 ~5 g) V& ~: Z2 I_________________________________________________________________________
; M0 V1 r. \1 S3 q. N
  {9 v% v3 J. H6 h0 A9 `Method 07
' K) |. D& ~0 X2 \' }=========
: r% S3 R: d' y3 L5 g% z& T+ c1 `- B
Method of detection of the WinICE handler in the int68h (V86)
  x' @5 z" e/ `. q3 Q# t
) n) D, T0 a# N7 n* F; P+ J# y/ M    mov     ah,43h# y5 e0 M5 L8 {  w
    int     68h0 F  M5 X& A! ~! y" Y6 O& K7 O% ]
    cmp     ax,0F386h
* p$ q; Y1 o: l+ z( m    jz      SoftICE_Detected; d9 O2 R6 n  Q
, o3 }5 Y) K5 P; v

/ l& g2 O: k3 G% ]=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) I% x8 P" \- L. |, R* }# D" z$ A1 t+ }$ p
   app like this:
# C% u" C5 W% Q9 l4 S# Q5 u! I5 f! X. |0 i& F3 @6 C3 w
   BPX exec_int if ax==68
. v$ W5 X% c/ O   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 U# O$ e, ~6 ?- W5 l6 I6 Y   located at [ebp+48h] for 32Bit apps)
- ?: _3 E1 ^- m8 b( V__________________________________________________________________________2 m3 y, G, ?. j8 X: E
4 B" D3 i+ w! l

) `5 R9 o# p& s% tMethod 088 R' y( A, k8 ~" a" P) S
=========' O, [6 ?/ g3 F4 p$ ]7 Z

/ G. f, N& L9 t: ]% t9 |1 K% YIt is not a method of detection of SoftICE but a possibility to crash the
3 E. n1 w% F* n) Msystem by intercepting int 01h and int 03h and redirecting them to another
* m$ P/ T# w- Z! l) q2 \5 Eroutine.
- l6 S2 W$ r; LIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
3 Q; N5 t: n/ U( nto the new routine to execute (hangs computer...)
, W2 G" X5 X- C1 ?2 h7 Y- z5 D# k+ a4 G8 T/ \
    mov     ah, 25h
" X1 W3 v% E/ g    mov     al, Int_Number (01h or 03h)3 J2 j" U3 Q6 i/ g" |6 H; ~
    mov     dx, offset New_Int_Routine
6 i# F  i8 g. A, n    int     21h
& z- t/ r4 H9 P# t% k
* a. s0 m6 r( \7 C% @" `* n5 r__________________________________________________________________________4 `' d8 ]1 T: X6 H' x6 }- T

7 }. ]( F  O0 S3 [  rMethod 09( [& f8 s! i: f3 M  u
=========) l) ?. x( d5 N4 M, T
( B+ s) @$ c8 u8 x3 j3 e7 N
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
' I9 n1 n1 T; rperformed in ring0 (VxD or a ring3 app using the VxdCall).
' y3 s  N7 B& J) B# `, D2 wThe Get_DDB service is used to determine whether or not a VxD is installed
0 c  G) V% O( ~4 h: hfor the specified device and returns a Device Description Block (in ecx) for
. D8 R8 g, B  dthat device if it is installed.
# j- s) o! z2 o' k
' Y" C* C4 c- a* v   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# i5 J' @" J6 J% g- {   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
  [8 M1 F- r& |" E0 C9 k! Y   VMMCall Get_DDB* R- r, n  t; q3 X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ n: T/ D3 s) v* X1 ^% n# Y" N' f& x7 n  [
Note as well that you can easily detect this method with SoftICE:
" @" T6 }- J8 y; p$ D   bpx Get_DDB if ax==0202 || ax==7a5fh
+ R( }/ ^3 O+ K  ^9 S7 L
# q: t! w0 R/ m9 }! C, k__________________________________________________________________________
) M* Q+ n3 @* p2 q, T) W+ Q- O
5 c3 F/ [. t6 X+ c# ~+ k2 Q2 a6 yMethod 109 i7 d6 i7 N* Z5 T9 A3 d- T
=========
+ h! n/ v3 J% `  O' G
5 u$ e5 B& T- X=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 D  p5 D' S: b. _1 ~1 {* I* l% Y  SoftICE while the option is enable!!. E" ]* N% b% n7 L3 c% w+ g
, d' r% |. x" a; p3 w8 P; G- X
This trick is very efficient:
$ R4 d; L, r) `3 c5 y0 y! eby checking the Debug Registers, you can detect if SoftICE is loaded/ D' f  E2 Z8 h, |5 d& o. f  U
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 h( s0 K2 H6 ~
there are some memory breakpoints set (dr0 to dr3) simply by reading their
9 ^" w% `- B+ R2 h0 h9 fvalue (in ring0 only). Values can be manipulated and or changed as well
- e8 v7 k& \( Z! ~) e% W  i(clearing BPMs for instance)
- F1 x* b" z# ?% ~
: N9 L7 \6 G6 B7 {( Q& E; ]__________________________________________________________________________) c/ q( Q$ Y  K2 ~

+ L8 D1 E% d6 w: F4 X6 AMethod 116 D; R2 K0 m$ y8 N. R
=========
2 y3 e( B' W9 A- i4 n
- L5 n1 f; a9 x& ]( uThis method is most known as 'MeltICE' because it has been freely distributed
4 y" }. w- _6 D' E: l6 ]% U+ R- ?) v( bvia www.winfiles.com. However it was first used by NuMega people to allow
2 |, h8 m$ C- |; a+ U; Q: p" NSymbol Loader to check if SoftICE was active or not (the code is located- a/ |. t8 m4 T3 D5 x
inside nmtrans.dll)." F- k. K& C; x) Y

7 U$ d5 q6 _) ^, s3 l+ i$ UThe way it works is very simple:
$ u( w0 N' j& u5 XIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. X0 i& e+ P/ U$ ^WinNT) with the CreateFileA API.! n/ e8 |* D7 L& ]# E

) A; x3 S/ z& DHere is a sample (checking for 'SICE'):, L4 w/ o8 H: |6 s8 @; e. S2 b

! L4 Z( a3 ]* J- L2 ?. d" I/ TBOOL IsSoftIce95Loaded()8 `1 W, P4 k# i* W5 j2 W4 e
{+ K. Z5 X% O% K) Q& m  v
   HANDLE hFile;  
: `4 Q4 }$ A7 s8 B  ]   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE," c2 ^3 z+ h% g, u4 ?  I3 h
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 K1 B: g& T4 w9 l                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' h4 @% V# d1 W# k& f9 }
   if( hFile != INVALID_HANDLE_VALUE ): ]: v- X/ R1 p+ [) p$ Y8 u
   {
; ~- @  q  S" `/ n" w      CloseHandle(hFile);5 c; r$ m7 j, s( Z
      return TRUE;
) _9 }- n6 K4 l) b$ d& \   }
" U% }; w: L( o; S/ i   return FALSE;4 |1 {! H8 T! Y# p1 z9 Y0 t) z) E
}$ O9 c; P( r, f" ^$ ]( o

1 m0 S9 m2 o$ n3 D* g* d: O3 }Although this trick calls the CreateFileA function, don't even expect to be$ ^  D' b. x$ |' G$ V5 F! ^
able to intercept it by installing a IFS hook: it will not work, no way!! C4 G- [) _; @4 `3 x
In fact, after the call to CreateFileA it will get through VWIN32 0x001F1 A$ S$ k. O( Q2 Y3 y( e
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) m0 K. w& K: f; k7 }and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 s6 B3 C5 C; i4 ?* M8 l1 f
field.$ w9 v& {5 |0 S9 Y* P9 ~+ }
In fact, its purpose is not to load/unload VxDs but only to send a   ]' Z1 _- \+ S/ R. J; |6 ]
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. j0 n0 O# _1 e3 }" A+ _3 C2 lto the VxD Control_Dispatch proc (how the hell a shareware soft could try, @- p; ?" n* W' U# C! G
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 i. M' w" E! B$ sIf the VxD is loaded, it will always clear eax and the Carry flag to allow
& o% e3 e8 z7 T$ y5 x  Bits handle to be opened and then, will be detected.
# j0 L' n' ]" f; gYou can check that simply by hooking Winice.exe control proc entry point
$ y- D" @' p" Z7 Y+ i8 X9 Ywhile running MeltICE.
" b' F9 l+ H( n" T5 J3 V7 j+ A5 r& D+ g& ], O
9 w8 [, ~: B8 L1 W. p! W# b3 e
  00401067:  push      00402025    ; \\.\SICE
7 H& b4 s5 K, K4 p$ j  0040106C:  call      CreateFileA
$ X$ a: q" ^& y5 w; D' z  00401071:  cmp       eax,-001' d, s, O  `% h; _
  00401074:  je        00401091
2 V5 i4 b, B% x1 E3 P% V8 q  D6 i( d& A% }, t9 Z8 j
& r2 c2 G/ Y/ _) n' d" M1 H8 ~
There could be hundreds of BPX you could use to detect this trick.1 L3 ~/ X- ~! J
-The most classical one is:
# J. R+ f/ A; }5 k1 ]  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 G% k' Y9 ?4 s$ @- O' j2 P    *(esp-&gt;4+4)=='NTIC'
( G& M  ^3 V3 W/ E1 @( n" m: J' Y: J- q; p0 S
-The most exotic ones (could be very slooooow :-(
3 F% p  m& c8 @. k   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
# w  b- q; N) J7 L$ P6 Q& C) \4 {     ;will break 3 times :-(
0 |1 m. d, q7 \" Z
, ?8 P2 V* i) D! e6 G! h: o-or (a bit) faster: / N8 `$ P1 X) V9 A1 q  ]5 b' C
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
& f' s2 U# @  @0 C6 Y0 _  y$ X: W( Q# z6 ^3 B5 T+ U
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 s; p# X. ]6 t. A6 Q
     ;will break 3 times :-(
: \, [+ O8 @6 ~5 i5 _8 e( i% v
" a- P# f* Z' M, p" H-Much faster:5 [9 n. K' f5 g" [
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 ~0 @$ U8 l% e8 e+ x
! W, n5 T3 v. p$ q& q# n. a/ k+ I$ [
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
; L2 M/ N8 E$ \' z  Qfunction to do the same job:
8 W$ ?% h' o# Q6 c' u( _* f0 R+ f' M3 e2 v' R; L
   push    00                        ; OF_READ
6 b( \. t+ g+ M   mov     eax,[00656634]            ; '\\.\SICE',0
8 H8 l( z" N) `   push    eax
! w2 Y+ j5 H! o, i5 R   call    KERNEL32!_lopen# ~5 p8 B+ V6 L6 f  j6 |/ h
   inc     eax% X5 D3 b1 v. u( h, b5 h! @! D
   jnz     00650589                  ; detected; n6 S4 [, t0 _. B* V, G' @
   push    00                        ; OF_READ
! h+ e) D! c( l4 k; R0 }3 j   mov     eax,[00656638]            ; '\\.\SICE'  Z1 ^  U  W7 m" Y* _
   push    eax
* O# F( k3 D$ g1 j5 j   call    KERNEL32!_lopen
" f. m: B8 ?5 t$ @+ w   inc     eax) p/ a  e8 e8 m. N2 N  r/ o
   jz      006505ae                  ; not detected
5 p* X$ n  B9 d  V; @  T0 T+ j# ?

9 ~" s! ^# F: l; W* a1 ~1 ~__________________________________________________________________________
9 N2 K1 B  u: F3 W' I. W0 Z. ^5 p) s5 m. \% J: s* I2 _! C+ }
Method 12
/ Y. _) @5 \4 Q4 d! n9 n/ y=========
9 x6 Z- x+ {& T% I0 q9 W7 J" Q2 b' |. m
This trick is similar to int41h/4fh Debugger installation check (code 05
/ f+ u3 A. u$ l- o8 I&amp; 06) but very limited because it's only available for Win95/98 (not NT)
9 D1 R9 _. q; n+ ~as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; j. _) [# ?) E" E, Q
; Y( X& n0 M" X5 ]- Y, R
   push  0000004fh         ; function 4fh
6 ^1 C+ L2 @" s8 V/ p8 o   push  002a002ah         ; high word specifies which VxD (VWIN32)
. Z* p1 o/ Z, S. _                           ; low word specifies which service; K# i( R; j6 d# r" T4 H* T
                             (VWIN32_Int41Dispatch)
, {0 B6 }1 Q: ]   call  Kernel32!ORD_001  ; VxdCall
2 {: i' q( X8 G8 D6 W3 r1 Z! N   cmp   ax, 0f386h        ; magic number returned by system debuggers" G3 ^% @. d# u6 R
   jz    SoftICE_detected
% R( @) _, M! }0 ?4 \, t) I5 }" Y1 W
Here again, several ways to detect it:3 J9 V$ e! D2 ?  a
/ T1 i( Q: m% q) l0 z  k
    BPINT 41 if ax==4f
' t+ Z3 R& R3 N, c! K
$ T# U3 @% G5 X5 ?$ D" l    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one; i: |, F1 o, }' Q9 K. b# N, |
: c' |9 k) f0 m4 _$ j
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A6 n0 I  V% l  K1 H3 M' }% E2 M3 f
3 Z  E- {0 n" p" N& {' d. I) i
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 I$ N& M; a) K! b7 A9 ~

$ k- I6 n9 s8 D; }% }( h__________________________________________________________________________
; Q* {" o4 W- Q+ x$ @4 s; y& ?1 E) N. s
Method 13, U# ^$ m6 O: G/ X0 U2 a3 u
=========
, @0 I2 V% Q* b+ y) ~% `3 B% X* S" P
Not a real method of detection, but a good way to know if SoftICE is
3 o+ P8 S, C& q9 |9 C" minstalled on a computer and to locate its installation directory.) w* L7 V/ T4 L& Q
It is used by few softs which access the following registry keys (usually #2) :
1 d5 B: t8 p* N- K( @  @* m  t4 D- k7 m
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. ~' [* [/ n( L, `7 i* ^\Uninstall\SoftICE
$ `4 P- d  u' S, S1 [-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 C9 z( ?0 S6 Q/ F- c
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# H8 p/ P% W. A) w1 c
\App Paths\Loader32.Exe, f+ p" H6 B! o% j- r

6 g* y; o0 }' |& _/ U
+ m% A& V" a0 P# GNote that some nasty apps could then erase all files from SoftICE directory# I6 B) R! I+ j( t
(I faced that once :-(& v' _+ s; @! J; P8 }  _2 h
5 y- ~; h3 f% H  h+ k  F
Useful breakpoint to detect it:! Y/ c. @+ ^- {; B. M0 J
( |) [, f7 c8 Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. |  D3 m7 Z- [" |9 r; ?. u( v- X/ u8 w; r
__________________________________________________________________________
2 S9 S! ^2 p( l7 o- I; h- h# @1 U3 X3 [+ Y* U/ o3 ~

# ^- w' V# i& L( `- VMethod 14 : u; _$ n& ~: H- G9 g
=========
. P! g( n3 d* u+ n) J, b: s: w; z: }; `
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* r5 U  C. F3 d: w8 M7 j  c' _
is to determines whether a debugger is running on your system (ring0 only).
# L9 ^. O! g, ^! P0 W+ O
% T, \) ?/ S. ^5 {8 X+ N8 P/ \   VMMCall Test_Debug_Installed$ B1 ^5 E: T5 r
   je      not_installed
* m' s2 m+ Z% i( c
: v' \6 t- b, h  D! B( ]: B) ~* j+ O3 WThis service just checks a flag.
$ E. k' u4 e( q- @5 r/ W</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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