About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
! I! @! y1 f% L9 S* O. M5 \. p3 x<TBODY>
: B- i2 O: G7 E* S. s, Y1 D<TR>
: }) B8 T4 Z1 e# d* Y& Y<TD><PRE>Method 01 ( m) P/ E, g5 D% H# {# x
=========6 x: R4 J* Q. W/ f3 g

9 r# ?9 g' G1 d! b1 s4 EThis method of detection of SoftICE (as well as the following one) is9 ]- u- w) B7 B4 W( k$ T- u
used by the majority of packers/encryptors found on Internet.' n0 F) k& P7 u5 ^+ i3 k/ i! y
It seeks the signature of BoundsChecker in SoftICE6 I4 \  c% o( u; t
4 Z$ @% s6 h' p0 a. i
    mov     ebp, 04243484Bh        ; 'BCHK'
- u: P+ w- ~  I; W) Y" Q    mov     ax, 04h" l5 u& s9 O8 Z% y, a; r: S
    int     3       9 s* ~( Z, l- L1 F1 K; ~/ b
    cmp     al,4$ s5 S% K, E; T5 u
    jnz     SoftICE_Detected' P! E) E9 d7 v1 N( G5 ~

( ~: v! g. a7 C' ^, A& Q% W___________________________________________________________________________
5 Q5 w: |) {4 q/ N9 R9 W+ S
; X! G# M! K5 k; b* ^Method 02+ f9 f( n, [2 U2 M' o: }5 U  ~
=========: @7 m9 D" J! |

" |) O/ U4 I, s, J2 tStill a method very much used (perhaps the most frequent one).  It is used
2 B" F# r! q+ }. D( q! z  Q: J! \to get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ ]/ |, ]6 U7 Q; [' K; F' ?& i% W
or execute SoftICE commands...5 u' K6 H9 ~" s, }
It is also used to crash SoftICE and to force it to execute any commands
* j4 M4 w: ]# P(HBOOT...) :-((  ; M5 w7 O( ^4 ~2 A9 S' C

: B  H, X" Z. O0 QHere is a quick description:! h: K8 N& q/ |. ]! {
-AX = 0910h   (Display string in SIce windows)
1 F* \. a: i. k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# f6 y& i2 @9 `5 {1 c* V-AX = 0912h   (Get breakpoint infos)
. p# [- z; E( u6 T-AX = 0913h   (Set Sice breakpoints)
0 D- x' x, X1 I: W. C, s3 o' a2 U0 e-AX = 0914h   (Remove SIce breakoints), e% @- g$ E% C; O2 l; ]" T4 D" o$ e7 P/ W

5 t! _; B+ z/ y; r  pEach time you'll meet this trick, you'll see:
' n+ x( o) I; Y6 ?+ ^-SI = 4647h* {! R) ?4 O! s' P- o
-DI = 4A4Dh. R7 O0 ]+ N3 g  P1 F' P
Which are the 'magic values' used by SoftIce.
8 G' p' y# F4 q/ @5 tFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
8 |4 Y, B' i5 n: \' _
$ K3 u0 b9 Y6 M/ \. |Here is one example from the file "Haspinst.exe" which is the dongle HASP
2 t6 J' k2 K& W' |, IEnvelope utility use to protect DOS applications:
, S! w, W9 I  |* Q/ S' b0 J4 m
+ N! g6 ~) c: R! p# `. ~* W+ O1 c; h. x7 x8 k: p+ [
4C19:0095   MOV    AX,0911  ; execute command.3 R, Y; u3 ^8 N& @# g
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
3 B8 H( b9 @7 c$ W2 d6 P5 u/ V  j4C19:009A   MOV    SI,4647  ; 1st magic value.+ L4 H: p1 i( f8 i0 B: S; r
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.+ r$ h* ^% }6 p, U5 w& [
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 Z' ?0 ], u4 }' i3 \4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
9 j5 i0 b* K$ q: u/ z- a& y) F4C19:00A4   INC    CX
7 m, o) t1 R3 l# E4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: i- T; R( V; `8 @  r) H( u) G0 F
4C19:00A8   JB     0095     ; 6 different commands.6 P1 D! @' Y+ B" m" E# w! J  U5 K/ h
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 x5 v/ g7 x% e4 U# n
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 _8 P$ x; h0 R! J$ J" K* V# U* {7 f% w, L! b8 s+ i7 u. r, T" E  F
The program will execute 6 different SIce commands located at ds:dx, which
% t, _) K7 p. S4 ^7 V- T- @6 z9 Vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 Z! |0 p7 j, ?" B  T% k$ _  W4 K9 _7 T$ _" p
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.& v1 Z3 ]% G+ y. t4 G3 J$ G
___________________________________________________________________________
+ E" |3 s! d% q8 L) F: D; ?1 ]6 x% o* P, y3 b: i9 t

0 E/ r5 L& G0 U) r3 PMethod 03
5 o" `9 z# L0 |; i! s=========7 j: \3 [& `0 W! t0 }
+ e! `8 f) S7 l7 v
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 \/ B9 h3 S. h5 z(API Get entry point)/ ~. q& s9 _5 ?3 X) A/ O
        0 }, |9 @# Y" c  \

7 ^$ x% a' m4 `    xor     di,di1 v8 K6 h/ I9 Y
    mov     es,di
; {! z' W: x# [& S    mov     ax, 1684h       & K  |! q; g; U* L: L8 A
    mov     bx, 0202h       ; VxD ID of winice! e" o8 \7 n. y. p. {
    int     2Fh
3 B" m! F7 _5 m+ L$ w    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 l" l' X* T  `) f* a% T$ U7 `    add     ax, di) W. h4 ?& C- K' K
    test    ax,ax8 z! R1 j1 `( B9 e
    jnz     SoftICE_Detected
9 R. L, |3 {* F9 `2 @4 e; E5 \4 i
___________________________________________________________________________
9 {, ^3 R0 B$ W- s6 i0 G! @0 {9 Q( X3 |
Method 04) n4 e5 a" s: }! h/ [4 a$ ?
=========" T: ]* n, w- @1 `$ T( l

7 B, F. `) t1 o+ W  O# Y! c% HMethod identical to the preceding one except that it seeks the ID of SoftICE! s, |+ L: v5 L- _/ M
GFX VxD.( Y4 g* o" S5 ]+ K. E2 B$ C2 p% k
5 N: N& @! r; X/ E& N6 C
    xor     di,di
& s: i# s2 A8 e6 a0 ?% K& {    mov     es,di- a' q9 R  ?3 t5 l9 ^% s; f
    mov     ax, 1684h       7 k" q: {8 T( r3 q3 q! a
    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ Y$ v/ s- w( R6 z
    int     2fh
) i& v4 @/ f1 f; S    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) k% O0 F8 R- r8 m/ B    add     ax, di
1 P- s$ I! x/ C, U# f    test    ax,ax
( ^! M! Q0 D0 k    jnz     SoftICE_Detected
) U4 J, v' d( e8 K: M
9 L/ @3 K5 m5 G- J! y/ t! M__________________________________________________________________________
; w8 }/ A- i0 _0 X+ f  I; V" n+ K! K& g* x- O9 J

' Y' ~) J0 _7 b. V& G0 XMethod 057 M' p& S/ c6 ?, G3 @8 |
=========
0 O' ?8 M: b- s+ A# v
! y( S1 p) p, K1 I( Q) rMethod seeking the 'magic number' 0F386h returned (in ax) by all system
$ q; g6 b! f4 [. I, j: s1 ^debugger. It calls the int 41h, function 4Fh.* Q$ C9 i7 B! b" ]$ T
There are several alternatives.  6 y, ]* Q" _/ z) z2 ^% Z9 x
8 p0 ]: Z$ L0 t1 k7 u
The following one is the simplest:
! n" f0 f* Q# l  r( s
  V+ a/ y0 m/ F& V' g    mov     ax,4fh7 `9 a2 ?- B% z$ i9 J
    int     41h
% k' x! `) e) ^1 S    cmp     ax, 0F386- }) `" H, F8 t
    jz      SoftICE_detected
+ h2 m, V! h3 g8 }& a* v9 R
' A$ k7 G9 P$ h& a! S/ C
1 W4 Y4 ?" ]# ~  j/ INext method as well as the following one are 2 examples from Stone's 0 V( S; D3 h$ `2 ~
"stn-wid.zip" (www.cracking.net):
  S8 @! q" P9 F# Y# H' h) k9 v1 Q, E) a  I! U0 W
    mov     bx, cs# l5 d9 t8 Z+ {' o! J9 }
    lea     dx, int41handler2" o4 C7 Z" \' X
    xchg    dx, es:[41h*4]3 V. t, P4 J3 S! [0 R( a; R1 ]
    xchg    bx, es:[41h*4+2]1 S# V" W0 f- ^
    mov     ax,4fh7 n9 Y& A* K! L1 S& c* E
    int     41h
- B+ @% P( Z, c    xchg    dx, es:[41h*4]. q. i4 O/ g1 W" i
    xchg    bx, es:[41h*4+2]
- M9 M5 t& ]& T+ F+ k, i  O    cmp     ax, 0f386h% X; L7 |, ~% t+ Q0 z) A* _5 b0 [
    jz      SoftICE_detected5 t/ I; D: f2 v; T, X
$ J9 \3 }' W. t4 b" x* J
int41handler2 PROC
) ~$ Z+ t: z$ r, b    iret7 E6 ?( Z- |: J
int41handler2 ENDP8 H) A2 m  S) I% ], [

, `6 _6 M' C, u  ^: t/ a8 Y% s# J
/ i2 R0 M: f: d) a_________________________________________________________________________* X: D8 U! y! T% j" @

* _% P' s: n' Y8 ~" ~
3 A6 d/ X) U2 ~Method 061 Q% K" g5 `7 k
=========
! L3 s/ i1 T5 f$ }! b5 ^& F0 _- V. H" Z& c% N; U5 a( o6 N/ w) g* |, m

8 h. V2 |: z0 i& p. A2nd method similar to the preceding one but more difficult to detect:5 Z% z; \1 p! X) b. \8 c
# L) e6 D5 ]4 ]; a  K; j
# c- R: D, v% _2 j5 [' N* P
int41handler PROC
' g3 `, \- w2 \7 P* }% {: i6 G    mov     cl,al  V0 \; D  u8 B& o% N3 o4 V, k3 I
    iret
5 Y9 e* N4 J" f/ z7 N8 Cint41handler ENDP
# m: S0 r7 ~! z4 j
' G# e1 m, }" ^4 t7 x
- X2 V: N1 l# P" I. R0 S4 v& h    xor     ax,ax
4 h# H8 M0 f" E6 q9 F    mov     es,ax% w2 h5 f8 }- R% Z4 K. v, U
    mov     bx, cs0 T' {+ V' J) G6 O' G0 S* A
    lea     dx, int41handler
# c7 X9 X9 |8 j$ ?9 W) n* E* [. ]    xchg    dx, es:[41h*4]
) S. S) y. I' t! n    xchg    bx, es:[41h*4+2]5 b! K0 }: i! m$ |+ |6 W
    in      al, 40h
+ y& }! i* G$ b9 F; }7 O" \$ K    xor     cx,cx8 E5 W* E. y( d$ C9 P
    int     41h
0 Y4 ^  q  V2 R; n7 C* m    xchg    dx, es:[41h*4], f# }6 o) R1 k1 X) n1 n8 w8 m
    xchg    bx, es:[41h*4+2]/ `. \6 b4 R5 p
    cmp     cl,al% ^+ U; t; c" |7 n& Y8 n
    jnz     SoftICE_detected
  X+ e6 t0 H  i/ j( [  f' A+ k7 ~# O" t2 E! `4 f$ i
_________________________________________________________________________
; Q! i+ r8 h  [
! H: s- h8 o- I, zMethod 075 X- W6 ?* [( j' M! q
=========$ w: O' P: h) b$ D/ P

; O( z+ [' s2 V% o  {) s& R1 WMethod of detection of the WinICE handler in the int68h (V86)
; p, J. ~! T3 ~+ k( l
. K1 q7 g9 \% o* |8 \    mov     ah,43h4 d9 M) V8 [6 R7 B# i
    int     68h
: f8 R  O. R( j' V2 M( P- h    cmp     ax,0F386h( t8 j# V' h1 f% Z% Y
    jz      SoftICE_Detected
1 L1 o8 D* J' b& e. a; q4 z$ ?' t% l$ d! w( b. g8 s- l! s3 e1 F; z
! O  z# q% h1 K
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 y  B0 J" j( Q5 f0 r   app like this:
3 l6 Y1 J1 M3 f' x
. d% w7 T8 c5 c   BPX exec_int if ax==68
0 K( {  ^$ _0 t1 c5 {; {   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ c" [& |* u6 S; t  d; S# ^   located at [ebp+48h] for 32Bit apps)3 y( N# k5 I  d. d" c- B
__________________________________________________________________________
& B% k+ U) x& x7 s: v- |
, o3 r" D1 u6 T2 |' \
. m" e8 _9 }$ {+ S8 \$ O/ rMethod 08
) h' d$ z, w4 [  w! u2 c9 Y) k=========# {' m. f- H/ o/ p2 H/ H

! @7 P, e& f/ F+ M; I5 j( k/ qIt is not a method of detection of SoftICE but a possibility to crash the
/ ?$ y+ {/ ~  @3 f9 Tsystem by intercepting int 01h and int 03h and redirecting them to another
2 u, _3 b7 q1 ]( T; Kroutine.
; r" a1 s4 q5 n. [' jIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ n5 z$ }+ ~, m( C9 V3 `% E* dto the new routine to execute (hangs computer...)" W- v; K" ]9 ?1 K, W6 [

  P5 j/ K% i% g2 G$ Y" D    mov     ah, 25h4 w4 r; e- k- d/ p0 \6 Q% G
    mov     al, Int_Number (01h or 03h)
7 m% z4 ?$ C9 J    mov     dx, offset New_Int_Routine
/ h, c! y. n# f    int     21h
5 m1 f# q  A8 a5 u' A( V; W
* N$ T) l% y, j2 d) }6 \__________________________________________________________________________( s1 T- m* n( \( u6 L' u. v* |- h+ T

# `3 N2 Q: J5 w! }* X2 uMethod 09
. i% u( Z3 g8 k, C8 z% _5 o" O=========
- L# A1 R7 p! Q* o; p  ?$ \/ [/ ]$ u( T! X
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only0 [( F" Y# U( ?# F+ U: s
performed in ring0 (VxD or a ring3 app using the VxdCall).4 |# o# A( k# a3 b
The Get_DDB service is used to determine whether or not a VxD is installed
! l4 p" X8 Q3 m) O1 h- g8 gfor the specified device and returns a Device Description Block (in ecx) for
  t; H0 @! s6 [* N0 m- D, ]that device if it is installed.; G! ?- o/ V' M, b

% V8 b" h" V% }# ^5 @+ {   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID: I6 W7 l3 M' l, g, K" S
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)9 M4 K5 X1 T1 q5 O/ v3 D$ z
   VMMCall Get_DDB
9 y2 Z! P: g; ]- k$ ]" @, \   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 Y2 s) p7 Q5 p  ]. [  |
( B/ ]. V* P9 T4 d
Note as well that you can easily detect this method with SoftICE:
) a8 U" P) N/ _1 l, l   bpx Get_DDB if ax==0202 || ax==7a5fh
% w3 ?: l" D" A3 B1 v1 G. w2 Z  b- P% w' K0 q5 f. D1 Z
__________________________________________________________________________: w5 J1 I( y3 P8 X+ |) r" [, Q
9 n9 ^  \2 Q8 B: M. M2 o
Method 10; Z8 t7 I: M; J- V9 T6 E6 h
=========+ O* @# x2 _- O9 ]# {

' i& ~# z, x4 {' f# U- u0 y=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 N( [4 D/ A, y) q0 t, l
  SoftICE while the option is enable!!
! B( Z4 W6 P7 S. O2 H7 ^  n. x3 W) V3 n) k" D! {9 S- _( L
This trick is very efficient:; W4 ^; }( _) R- V( C: v; Y$ ?
by checking the Debug Registers, you can detect if SoftICE is loaded$ }& ]) G4 F, k4 `" i
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 o- e  q! Y" [, h" B$ D4 x9 ^
there are some memory breakpoints set (dr0 to dr3) simply by reading their
; F& c0 p3 z- c4 [  fvalue (in ring0 only). Values can be manipulated and or changed as well
- q  w3 @5 ~% D% X# [  U+ O4 F(clearing BPMs for instance)- v( T2 H$ [- q# X5 b9 |7 t3 d( ^
& A/ W7 P! G% {2 R$ `
__________________________________________________________________________' U1 E# w4 L! Y- l. j

3 E6 D2 K8 Y+ J, b( n& AMethod 11
) ~0 `  K- `# F=========. O; K8 r6 G2 t/ G5 j- \1 f

8 l* d4 @! }) ^2 }! vThis method is most known as 'MeltICE' because it has been freely distributed; R$ R. [% M3 _) G) E4 [! W: c. C
via www.winfiles.com. However it was first used by NuMega people to allow% e6 @2 ]  y( N" H2 {
Symbol Loader to check if SoftICE was active or not (the code is located5 [- ~. c% x" w
inside nmtrans.dll).
( t4 ~. \( [8 M- b! n4 ]: {8 t9 K
The way it works is very simple:- e' }) s3 L4 s+ O
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; q6 N/ ~0 U4 L- H& e% SWinNT) with the CreateFileA API.; j# ^( g! }# X$ x( \1 `
$ F$ Z5 c& \% x" q+ D' m9 o& a. g
Here is a sample (checking for 'SICE'):
/ A( ?' U& t. \; N9 d
8 K  D+ U0 `* T) |. h! e$ }BOOL IsSoftIce95Loaded()
4 J1 w3 q4 [( V2 S1 L! h9 b{
7 G1 T& l2 z$ t. D; y. g# v   HANDLE hFile;  
! m9 j9 k) ~* }6 C% k   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: N7 B5 w' c! V% }" R! W                      FILE_SHARE_READ | FILE_SHARE_WRITE,
, m+ S% Q& _( Z8 h# D                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 t/ g1 k* M: O
   if( hFile != INVALID_HANDLE_VALUE )
% N! Y+ I) k  |. k   {
+ X6 i, U1 y' k' \! U6 h/ q      CloseHandle(hFile);6 L; ]4 o6 t7 A+ O$ x
      return TRUE;
7 k# a2 ]$ @& I   }
- D+ J8 @, |) I4 W9 U) _7 `, J   return FALSE;
$ i3 R8 \, e- U( D" `8 m% @4 E+ n}
0 i! Q& b0 q& j: @- d- J# e4 M# X$ r$ v+ m) N! u  W
Although this trick calls the CreateFileA function, don't even expect to be5 H3 H" i; a. ~* }
able to intercept it by installing a IFS hook: it will not work, no way!
0 V% ]' L1 }- ?& BIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 _6 c( b4 M. M$ Z) Dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
+ _8 s  f3 Q2 W0 _3 v0 J; tand then browse the DDB list until it find the VxD and its DDB_Control_Proc
% s9 n1 f# y' _0 d& ~8 n8 lfield.
: W- o( r& r8 q$ I- ZIn fact, its purpose is not to load/unload VxDs but only to send a & W6 P1 S/ |2 p$ p* `0 f  z$ o7 @& @
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
  F' ?4 P: t4 Eto the VxD Control_Dispatch proc (how the hell a shareware soft could try
5 Z# M* ?+ Z  @% ]) a6 B( Wto load/unload a non-dynamically loadable driver such as SoftICE ;-).
/ u* {. U# B0 ?2 {" MIf the VxD is loaded, it will always clear eax and the Carry flag to allow) \' o5 @4 }- m0 D6 d2 u( F0 y
its handle to be opened and then, will be detected.9 ?$ g4 J2 i: k) w& n. c
You can check that simply by hooking Winice.exe control proc entry point
! ^1 W: V0 C) {9 i" h, Vwhile running MeltICE.; @3 L5 Y5 ~$ }
5 S  v0 g7 g' O# L' ]2 n" V- G
. g4 ]7 {; t  e6 X$ O* ~2 X
  00401067:  push      00402025    ; \\.\SICE
1 w0 p4 h$ B2 U7 E" H  0040106C:  call      CreateFileA$ ?. ~( {: H( \" b# w$ h" }6 @
  00401071:  cmp       eax,-0013 ~$ t! u: e1 I" H7 [# `+ b
  00401074:  je        00401091
" ^$ x1 E/ S/ M4 ^7 e- ~7 p, N# I3 x0 s5 V

  g) V$ X% f; Y# g- v% V: @There could be hundreds of BPX you could use to detect this trick.' v( B8 a7 G1 ^+ N. ?9 c
-The most classical one is:
0 `7 f- |: A5 ^  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ k9 B/ i9 W7 U  @5 \% k    *(esp-&gt;4+4)=='NTIC'! D) \" j- G. u5 M+ Q
" s5 x5 g. U5 [! P1 ?  L
-The most exotic ones (could be very slooooow :-(
3 ^2 N/ a& ?5 h" e1 y   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 p. p: U) y6 i$ k- G; d4 N; i
     ;will break 3 times :-(
. z; a* A8 t5 c4 d: r4 F# O. c: g/ c5 E
-or (a bit) faster:
3 Q9 X8 E6 S8 p  o2 z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')% V3 \, R8 }; K0 s5 N
" h/ g+ T. N8 E. D
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
8 y! s* w* h& H: K     ;will break 3 times :-(0 @: }( F1 X6 C+ @+ \9 Z
- m9 p, U9 Q0 A
-Much faster:
  p+ k, G3 G# V! U6 j/ y0 D2 V   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
: p# ^+ d( _* K" Q* |0 V: l  s1 m5 n7 @4 Y0 T; {! D
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 q7 b( h' C! y9 d' Pfunction to do the same job:- k- F& ^3 L! b! Z0 p

4 @3 j' \* c' `# q" |7 P0 Y   push    00                        ; OF_READ, q1 J- d( L' q, w! |+ o* l( c3 l
   mov     eax,[00656634]            ; '\\.\SICE',0; i1 b, E& S! s& \& D! Z6 Q
   push    eax
8 t" ]: s+ S( C7 p6 U0 Y$ |: Y$ j( O   call    KERNEL32!_lopen0 H) K9 _# T/ ]' T  ~
   inc     eax
% g  Z) S' \6 D7 s6 a: n   jnz     00650589                  ; detected
+ z1 b. S7 r  c( y- ~% P   push    00                        ; OF_READ
! b7 }: ?) g; X   mov     eax,[00656638]            ; '\\.\SICE'
+ h9 P9 M: b) g1 O   push    eax7 W8 N/ B- T8 [4 [% m0 n
   call    KERNEL32!_lopen
% _; n$ W; v/ T0 q3 U( H7 |7 s   inc     eax
3 R: J! R$ w+ z3 G, j   jz      006505ae                  ; not detected) }: N& q5 r. G3 V% p  J$ Q

' u4 `6 x  k9 X& k. P1 F
- S% l) r+ ?8 `  A__________________________________________________________________________$ F/ f: i! G/ j# Z* u5 a) i" l
" B( ]' f- ]! s" H2 G, X
Method 12
! H1 J1 {" @7 p# S" p# G& M5 h4 o=========
  Z1 _+ K& \. p2 ?! S
, K0 h* U4 P0 q" ], z! l  {; LThis trick is similar to int41h/4fh Debugger installation check (code 05+ W. d- B: s' [- c4 G% z, h' O! O# b
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
2 B+ Q1 `1 m( n0 j8 p/ S- nas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
% c9 ^% J/ p& w, }7 `( B+ ?6 [$ ~* r+ \' D  b
   push  0000004fh         ; function 4fh. |8 S% }2 T% G0 A
   push  002a002ah         ; high word specifies which VxD (VWIN32)
- `: P) i* `  A  Y7 d; Y8 ?                           ; low word specifies which service
7 t5 h' O  ?1 ]( Q# [! ~! q1 G                             (VWIN32_Int41Dispatch)
1 a0 `- G/ i  D) D$ x   call  Kernel32!ORD_001  ; VxdCall
( I& ?/ _. z3 F# d; W) b   cmp   ax, 0f386h        ; magic number returned by system debuggers: }+ f4 R; I' l+ f, z
   jz    SoftICE_detected
, M. n! y, V' S! s, z) K6 Q3 q
7 U$ c7 \" U( M+ v5 eHere again, several ways to detect it:8 y6 q/ n3 u$ D9 {& [
( R/ i0 X! s# V2 e; T9 k
    BPINT 41 if ax==4f
1 q! l; L" b( Y  {. b- Y  ^& j+ {1 y
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 d% H& I1 ~8 k$ r. E# Q/ O1 a8 p
, Y) u8 F0 o$ g1 S  |8 g( |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! y" c4 h1 c: P* g) B- W  t8 j; t; Q7 l5 f$ ]( \" V5 _, ^! E
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 V/ H7 V; o2 ]# ~" D( ]3 a
0 j% N* R9 [4 O/ c! {2 `8 z__________________________________________________________________________5 U7 y. y) V7 g% q. _
% ~+ m5 @% _: W2 C. L# t. t
Method 13$ y7 U9 `' c* @0 G- S
=========# ?2 E  j+ P% k0 T( [) g
3 e& L) z# L# @& B0 I8 o
Not a real method of detection, but a good way to know if SoftICE is! ?, q  T: X; I% s4 s
installed on a computer and to locate its installation directory.
  B  K1 i8 L( k) n+ I5 _% i( ]It is used by few softs which access the following registry keys (usually #2) :
, G' c. ~$ b3 g% ]4 ]  S/ l6 U' ?7 }9 t1 J3 ]+ e2 @" b! V$ v7 E
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& _% s- ?) {, a; Q- E7 S\Uninstall\SoftICE1 n' r4 ]: Y. z+ L2 k1 A" X
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 _$ G! T: Y# M: L5 T. ]1 V
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ u; T; t8 P6 n# V4 \. n/ E
\App Paths\Loader32.Exe& d: y- L" Z4 s0 p$ l* M2 m) R! k

" E3 G2 r1 d' e* r4 X) ]6 X2 d& P" `% z
Note that some nasty apps could then erase all files from SoftICE directory8 V! P9 m( T- Z$ M  C$ {
(I faced that once :-(
: m/ y  b9 @: a( P+ u* Y) s9 h+ L9 ]$ L! i( P/ U  `6 w# H) t
Useful breakpoint to detect it:( i' m0 \. y5 r/ w. I. T" K4 N- @
6 J7 G4 V4 ^7 q6 u
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& r% u! c; f# z# V7 h6 u0 w
  }( J7 V6 G. a5 X' \. N! V  u__________________________________________________________________________& s; z* M3 I# m. ^0 h
& [, k6 i7 I: L: w, V7 ^! ?

% O" r' N/ W& t# N$ L. e$ n) _. A, mMethod 14 7 {2 s4 {8 T9 o# H1 y$ C# w
=========/ B5 T0 O% q4 k( P% Z2 c- U8 Z

5 H( X2 ^# g2 IA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 a6 _4 W9 K3 s/ A' i8 b
is to determines whether a debugger is running on your system (ring0 only).- f+ W  s3 D6 s$ ]
1 \8 `% z7 b) @5 J% O* m3 T
   VMMCall Test_Debug_Installed8 U. _2 R0 j- K* U; o
   je      not_installed+ n. u4 x  ]" r6 s$ M" _3 U' N5 D

: w  |  s/ k% A- u% gThis service just checks a flag.; a* T) v% J0 t, n+ P* S
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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