About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
6 V! e, a' B4 S( `4 a2 T& C9 Y<TBODY>
7 c) G' q8 O# |' r3 ?<TR>& {& C' {; _8 Y" S; `
<TD><PRE>Method 01 0 e+ k# x( K0 \5 h% h) |0 n
=========7 c% U. {, u6 r# L; C
0 i$ E, g' b. S% ^! z5 j/ N" H$ W
This method of detection of SoftICE (as well as the following one) is  H1 E1 ^2 n  w4 S) `
used by the majority of packers/encryptors found on Internet.
( _& t; r5 n6 t+ d" pIt seeks the signature of BoundsChecker in SoftICE5 g/ }% c, T, a( D4 ~) G6 J; ~

0 i. \: L3 X2 a  @) r; e5 y    mov     ebp, 04243484Bh        ; 'BCHK'/ \+ Y; f; A* j3 u
    mov     ax, 04h
/ v2 r4 i" t* @) r    int     3       9 h5 f( ]  z% X. h
    cmp     al,4
( y& M1 T1 R( q# z    jnz     SoftICE_Detected
7 n8 N$ n0 e1 Z7 U* J* z$ t6 p' p. y9 |8 x' ?
___________________________________________________________________________
. o+ Y$ t0 G( p% K4 u' @0 L7 {# [& m' }" ~+ K
Method 02
, h$ i. B4 X7 \2 V, m' A* \' e=========6 A1 l; p/ g- @5 H* L' }/ O

4 {* s5 E! Q: ]- i  j& ^6 Y7 WStill a method very much used (perhaps the most frequent one).  It is used/ g7 ]$ N. L4 s! \+ W5 ]$ h
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,# f: r- p2 H- C  ?- G+ ~
or execute SoftICE commands...$ Y5 Y* B3 O! R' R  L& i. S
It is also used to crash SoftICE and to force it to execute any commands5 i7 }# U% |  W
(HBOOT...) :-((  
- M; J$ m% K! e6 Y6 K7 F0 I# g3 \. {6 Y5 h$ Q& `: i
Here is a quick description:
1 X0 {) D! z& G  q-AX = 0910h   (Display string in SIce windows)2 O5 W+ [( h* I6 l& K
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! D' }. ^- a9 m' I7 `4 Q) I
-AX = 0912h   (Get breakpoint infos): B7 p5 Z. Z( z9 x5 P/ h$ w/ [" ?+ ?
-AX = 0913h   (Set Sice breakpoints)
! c( N" R3 J" }+ i0 `% N2 K' W-AX = 0914h   (Remove SIce breakoints)
* `, N2 I* s2 k0 o! D0 I$ d
  D, g5 p2 V% JEach time you'll meet this trick, you'll see:
% u1 S* _  C( o5 O6 Q-SI = 4647h7 l1 m% s$ T; R: E" B# Q; x0 I
-DI = 4A4Dh
: O  y  O& x6 l/ a: ~Which are the 'magic values' used by SoftIce.0 N# I* @% Y4 z5 X4 a3 `
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
4 a& `! P$ S" F0 T
. {" W: n& ^( ?  S- C) ~Here is one example from the file "Haspinst.exe" which is the dongle HASP# ]$ o6 l! F8 a# J9 Q, i6 P
Envelope utility use to protect DOS applications:2 m9 L# R0 u) d; m) X1 e0 ~& S
; ]- |  O: a- u" S

! E5 n% n, s+ \( M6 s* ?5 P4C19:0095   MOV    AX,0911  ; execute command.: F; B  r' v& ~+ I$ T2 I
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: s. U' B5 k/ i% c, _2 x  m! X4C19:009A   MOV    SI,4647  ; 1st magic value.: k6 Y% F0 N. ^  _1 V1 f
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  a, ^7 N' v5 Q1 b
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% g; f7 j4 X1 Q5 |1 w4 H4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* c$ @( R( f. C  K4C19:00A4   INC    CX! {) u' f: T$ w; |; R
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
, y* \; @! p8 p4 H, f3 j4C19:00A8   JB     0095     ; 6 different commands.
$ G9 N$ h( Q8 @9 h$ }3 A6 ^4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: ~7 B6 r! C3 L3 d- J4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% T4 k  J7 C2 x  ^% b0 D( h2 j9 @7 e6 {2 n+ ]- U; C
The program will execute 6 different SIce commands located at ds:dx, which' l' F. B7 T4 P6 r
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.# y- Q7 X7 H* R0 x# y, X! A

- z4 o& G7 X+ n* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
6 D2 {! G, y2 u___________________________________________________________________________
, A% [# N, q) X8 W" F) f+ ~
* J- V6 C7 a9 h* l8 V
; w# W/ B+ Y: H/ IMethod 03
* P, P2 r8 \' m2 t$ y+ K=========
7 K: l$ w; V+ f- X1 S
/ A1 }: ~& l' V; O. ALess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h1 Y% [. T" V! U; ?* {
(API Get entry point)  @7 B+ G0 ^, h! l' v; J
        
2 G( t  r5 _% m: x# u  J& V" u" l
    xor     di,di" K" C: m3 k* {  [" C5 F
    mov     es,di! f3 I7 L+ K% I0 F- ]
    mov     ax, 1684h       ! M2 b8 I8 P; R2 I: K0 ~: c
    mov     bx, 0202h       ; VxD ID of winice
2 Q+ b3 b6 r3 A  v: p8 c" O0 V, V    int     2Fh
7 e. w2 G1 k$ M3 V; i6 f( B% v    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 d5 u. O( F8 N2 t' F. F6 r    add     ax, di
. k, i% [- F! F# G2 j! d. ]    test    ax,ax
" o! w4 `( r$ f    jnz     SoftICE_Detected
# z* j9 ~' h0 `' L& t! ?# M1 [9 x" Y+ e
___________________________________________________________________________
$ v! ^2 z/ B) Z, ]
( v9 d) p& H4 M- f% ?% dMethod 040 e) ?0 w/ h( C) W* B; R) F
=========
# @( O' [5 j$ X, i  O. A% [* m7 @  ^; s0 O( ~
Method identical to the preceding one except that it seeks the ID of SoftICE
! C& |* i7 {5 A2 i3 hGFX VxD.* ~0 S  \- ]. j& o* O; [0 e
1 [7 N% `  |1 G3 M2 |5 `
    xor     di,di  v, N: E7 @' t; Z# B; t
    mov     es,di1 Z  t7 y& O: j) C$ m" H
    mov     ax, 1684h      
2 P$ f( L4 M& O" w* B8 Q7 x    mov     bx, 7a5Fh       ; VxD ID of SIWVID
6 H/ B7 Z. a, i7 C2 g( c" B4 I7 H1 [    int     2fh
# G! e/ T8 H) ]7 a$ N- @- l    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* p* B* |: f: K  [3 X5 g/ D    add     ax, di
2 }+ ^# D* W* ^' _* d- @    test    ax,ax
) v& t$ J9 a9 ^& N    jnz     SoftICE_Detected
; F6 u# W5 R2 A& f
% F7 h0 i" C! A6 U__________________________________________________________________________: }  D7 J2 S/ ?7 T$ j* m

/ W9 p' T, c  B2 [, R) F
* x$ Q: u/ Q, K. _$ K# G) YMethod 05( J2 k8 _* R, N
=========0 c% Z" @( g6 |3 b7 Q# i

" \7 d1 n0 l$ R8 eMethod seeking the 'magic number' 0F386h returned (in ax) by all system
# k# `8 G% o) F  [0 B( x$ sdebugger. It calls the int 41h, function 4Fh.4 ~, S* j- Y/ `- b
There are several alternatives.  
5 Y) f2 a. F/ L" {
1 c# o! ?- ^+ e4 E, |) LThe following one is the simplest:: u* {+ {; E9 D) k: C  X
& g8 @' F; I! x2 Q3 P
    mov     ax,4fh) y+ i6 B, U- d9 N& N
    int     41h+ b9 O! R( E+ p" v0 W* M+ |' L* E2 S
    cmp     ax, 0F386! _3 H" @* x9 w0 \5 y
    jz      SoftICE_detected
4 K+ J- h$ ], l" H; g2 e$ x  w1 ~& K0 M* }  A+ [, Z% o

3 ^' _( b0 o7 `# C5 y) v$ E/ XNext method as well as the following one are 2 examples from Stone's
: Y' V& G/ y. s: i: k6 H, E. {- T"stn-wid.zip" (www.cracking.net):
4 F: ]' O/ D5 ?: S
' U+ G! V( O3 S    mov     bx, cs
* W2 v, h! _8 g! h' d* i! W    lea     dx, int41handler2
% s: G: B' \8 `  j- B    xchg    dx, es:[41h*4]0 M1 r1 Y% R, J/ K
    xchg    bx, es:[41h*4+2]
$ I  Y, R/ |$ Y# `0 S    mov     ax,4fh4 Y1 `! U* X  h
    int     41h
3 @2 Q1 O6 @0 |& }) n( G    xchg    dx, es:[41h*4]
. [" c" k# ]5 n0 A1 L# M$ D1 m9 ?( J    xchg    bx, es:[41h*4+2]
! r6 Z7 R9 \2 E4 ]    cmp     ax, 0f386h2 t% k1 z$ N# e1 }+ _' P6 q
    jz      SoftICE_detected; R) E- m+ n1 j: W( B$ ?( ]) V

# d% K) K6 |2 T3 ~+ h8 q+ nint41handler2 PROC
4 Y$ F; C: O, m+ F2 q3 w: Q    iret
- w8 g9 u+ B  Nint41handler2 ENDP7 N! N& V3 S, {: D
9 f" S) u- t0 t- Z* v6 x/ b
# S, G! `% b" p. C# j9 M
_________________________________________________________________________
' U9 C1 l7 f* _' L8 j  p
; E8 Q- C2 [; e
6 q$ d7 d* t' X2 \1 F' aMethod 06
: n& [1 n, L* M, q=========. m1 d, }, C$ A2 l1 d! f

& Q  [) |1 n0 N; ~: {3 u7 b4 [* S* J$ m3 Q9 l
2nd method similar to the preceding one but more difficult to detect:
0 r* F0 r  c8 y
6 ^# Q& {( e" w) z  i8 d( m5 X# M; b9 u! `" H
int41handler PROC! F' l' \" y* a. g9 ?; ~7 ?; v
    mov     cl,al
. p, X4 \0 z. H; A0 {+ f    iret
; R# T5 z/ i- cint41handler ENDP* y* r/ {  E$ ]7 d) c* I0 [

% v. F5 L2 n( Y, ~9 E: R9 b, w
- o+ ]# L3 u6 [, E2 _1 I" S3 O    xor     ax,ax9 k+ x/ N: f4 U) L! Y: O" l/ H/ Q
    mov     es,ax5 W! c2 s0 X) m, ~" _& |
    mov     bx, cs2 {* A3 q1 I+ z- e
    lea     dx, int41handler! i1 n4 [1 h" z6 v
    xchg    dx, es:[41h*4]. V* ^' \( u4 N$ }1 q8 p
    xchg    bx, es:[41h*4+2]8 S4 m1 j  Q, f
    in      al, 40h
, W3 p: @+ v* g7 g+ q    xor     cx,cx" i$ y  U1 n/ [
    int     41h
* }5 G# k8 M. ^. {" |' P0 [9 o  G    xchg    dx, es:[41h*4]
! z8 g) s3 }2 f7 b    xchg    bx, es:[41h*4+2]
$ Z) O3 P2 T/ p( g8 N2 w: s4 Q    cmp     cl,al
4 {1 S0 Q+ ?9 {: ?. ~& `/ g" W! @  ^    jnz     SoftICE_detected
4 J3 \) S) `  f2 l/ i7 B$ K/ a3 }' ~/ k( b
_________________________________________________________________________
1 c. ~$ A! q7 }! e  T
! a# m1 E' Z& N! c6 Z; gMethod 07
6 O0 z9 n( Q  h2 j! T=========
7 V  w5 U1 D* E. }+ w! G" {
3 n6 @1 m- R. B3 DMethod of detection of the WinICE handler in the int68h (V86)3 X: j8 e4 B0 p) h9 D+ o+ e0 Z
- e. G8 h- u$ q  B1 n  X& H& U4 e
    mov     ah,43h
" W( I; K" |3 i, b& }+ R5 E9 W: z    int     68h
7 B5 E8 S; Y- |9 I  I( S! i5 J    cmp     ax,0F386h5 \: j" i0 S, ]$ n, A9 W/ k% }
    jz      SoftICE_Detected
! N6 g: `5 C% t: o4 h% {! s7 b- m
# E5 {$ v# D: ]) g+ ?7 p' u7 X# G7 A3 O6 H8 R
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit1 h/ ^: I& U# Y, i
   app like this:
- M( F9 i7 S" l) O5 d  R2 y3 W* b/ i" B" `
   BPX exec_int if ax==68
; w# S" l. ?6 V) X   (function called is located at byte ptr [ebp+1Dh] and client eip is$ q$ ]: X; q" n! ?, S
   located at [ebp+48h] for 32Bit apps)( Z7 t/ W3 t6 b! r$ o% L
__________________________________________________________________________7 C& P1 U" A1 @# X" A# O+ Y. S) h
2 p" b! O" d: q+ T$ N4 i

/ `! _$ z+ e6 J. u! ~Method 08
" Q% p; `0 L* I5 o=========% `" C1 ]& J: g7 `

( @$ J6 U$ H0 a0 A" SIt is not a method of detection of SoftICE but a possibility to crash the4 p* \9 M' L9 H
system by intercepting int 01h and int 03h and redirecting them to another
& x, k* R; s  ^" B. ]- w8 o% Xroutine.+ ^: ]5 A$ q2 l( d+ P2 l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# i& i3 s1 h# F6 ?0 E7 r' z9 `# K
to the new routine to execute (hangs computer...)
: s; F' k; z* R, Z4 f8 n; @5 o: }6 ]( a
    mov     ah, 25h
- I" L$ ?! |9 D) t# J: b/ T    mov     al, Int_Number (01h or 03h)
4 j$ O. d9 U; n# k9 e    mov     dx, offset New_Int_Routine( d, R( j0 Z/ }# O. \2 F" e
    int     21h
  |. Z3 D+ K+ Z0 a  ^; H3 v9 O! q' {; F! @' |$ z- k
__________________________________________________________________________3 w! q% O0 D+ r% g' W: a5 I2 d
" x0 d: P7 A$ ?
Method 091 ^9 V" h5 h; m
=========& X- E" C- n2 p" Q6 a
5 k( O0 T# c6 \4 {4 j" Q: c7 R  K
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" g8 {* F* K4 H: s+ U9 D
performed in ring0 (VxD or a ring3 app using the VxdCall).: Z" |; ?4 _3 X* `
The Get_DDB service is used to determine whether or not a VxD is installed
3 f% q& G' r' ?4 f$ jfor the specified device and returns a Device Description Block (in ecx) for
. R: R& g4 i% S7 z+ uthat device if it is installed.
. y  f  c! J# ~5 K5 o% d' d
' c' j" ~( K6 q( ^- k" g   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: O: a: }( W: g, b) R' q   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)9 Y! W/ k9 f5 e" d! w# x8 X
   VMMCall Get_DDB
+ w* Q, D" x0 v: t6 W9 b  _: `   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 J0 O0 E  L4 U7 g7 y# z

, j- Q5 h+ T7 @+ yNote as well that you can easily detect this method with SoftICE:8 h( _3 X% b1 R* F: I
   bpx Get_DDB if ax==0202 || ax==7a5fh
* W9 v* q2 {% K. q% a2 Y& c$ B
. k9 {  E! Z0 g0 B9 j7 s5 X__________________________________________________________________________
, M: v0 A& G' A- n4 Y+ y
, C/ G% i) |  q) i- H9 |Method 10
$ m; k4 ]7 T6 W# W9 \=========6 m) x2 l1 H* s8 [  S" |

2 m3 @6 Z3 y. F2 y* M; k+ G; ~* K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ {' l% X3 t3 i4 U8 ?  SoftICE while the option is enable!!$ r' v# E" J  R7 _  J2 \6 Y7 w4 R
+ ^7 x5 v- S0 P* ?% a7 q. ?
This trick is very efficient:5 C1 ]: @9 @+ r5 v4 U4 L# c! P" B# w: L
by checking the Debug Registers, you can detect if SoftICE is loaded
' C3 B; B# S# J" x(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, g! a/ J7 U7 C/ C1 `+ K
there are some memory breakpoints set (dr0 to dr3) simply by reading their/ Z3 c7 }! V" x' L
value (in ring0 only). Values can be manipulated and or changed as well
7 Y) r/ B4 q) r; Q/ u(clearing BPMs for instance)# N1 X3 Q' s( K* D
# K# ?# T. g0 i
__________________________________________________________________________9 n: n3 v7 Y$ n1 z
4 T! _9 M4 x. M$ l4 Z% ]# _9 M
Method 115 U+ ~; i* k! c2 z8 V2 U0 J
=========
/ q% L3 U0 M' D$ Q6 @  Q* n! p8 n7 v- G- l3 l- |) O
This method is most known as 'MeltICE' because it has been freely distributed
% W8 h: e( o" U+ Z5 J$ Y3 l  C4 G- Tvia www.winfiles.com. However it was first used by NuMega people to allow$ h. m: j6 X$ x  {0 q; D
Symbol Loader to check if SoftICE was active or not (the code is located+ ]8 p8 O3 [3 d. Q
inside nmtrans.dll).& t' \+ K3 E5 c+ _0 X

0 C  a0 y( Y% z5 ZThe way it works is very simple:
* Z; C) K* h( S1 B  U( fIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
9 {  d) B/ |/ f8 @  SWinNT) with the CreateFileA API.
, I* o2 B) w9 D$ r
( O. G$ _- O* {9 }; S1 kHere is a sample (checking for 'SICE'):
+ E) i" t, C: t4 I9 d; e% I7 l
0 U+ `0 W( ]& l: }BOOL IsSoftIce95Loaded()
0 j9 e3 j4 e& I, W& `8 D{5 O2 \: \* ~9 }+ I
   HANDLE hFile;  
5 \7 D: Y- z- E( U- Y* _   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 B5 Y/ j8 k* S- F- I
                      FILE_SHARE_READ | FILE_SHARE_WRITE,: F0 T3 ?+ L+ z# J2 `
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( w, S$ b4 C0 E" |8 ]2 S' N1 b8 N% b   if( hFile != INVALID_HANDLE_VALUE )
2 ~" }3 T1 D7 l$ o8 C; Z* J, t   {7 O. y. G, t* g2 P0 i
      CloseHandle(hFile);8 o3 x$ A! X% n" |6 ~0 A
      return TRUE;: c2 I% h# ^7 T3 x$ w, v' h9 p; t
   }$ y* H9 v2 m6 J5 M, D. T7 I
   return FALSE;
( B' V7 L& B8 W- L) E0 b2 S}
3 A- ^; X4 T3 @& s' \" A
0 S* q( D2 H5 p# Q9 ^Although this trick calls the CreateFileA function, don't even expect to be
! b6 s8 t" X  Table to intercept it by installing a IFS hook: it will not work, no way!8 p! ~+ e% o0 _) D: P" ]
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
6 v5 W9 a" a; h) p. n# i# Z) vservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). p/ Z, a# N9 W& _, n2 l
and then browse the DDB list until it find the VxD and its DDB_Control_Proc/ G6 X; A: n' r& F$ [% p
field.
4 }9 ]- y& M0 j, RIn fact, its purpose is not to load/unload VxDs but only to send a
) a* f! b. o- B3 r& R' |3 A$ YW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
; P% G6 F6 O: J0 X& T5 kto the VxD Control_Dispatch proc (how the hell a shareware soft could try
* g' p" J, g! c; j. N9 S' g3 jto load/unload a non-dynamically loadable driver such as SoftICE ;-).
# b9 g0 `0 q9 @8 hIf the VxD is loaded, it will always clear eax and the Carry flag to allow
4 ^, y4 M3 v" M( B$ x2 aits handle to be opened and then, will be detected.. ?: Y; x& L) j4 G5 w) ^  T
You can check that simply by hooking Winice.exe control proc entry point
4 d+ W5 H. i, h- L* x1 q3 D* T& `( w. Vwhile running MeltICE.
- C, @5 j3 G9 f6 x3 k# H8 v8 j( c3 _" Z2 B! N! l. z
( r5 o$ s8 d8 {2 S  {$ B
  00401067:  push      00402025    ; \\.\SICE
" Q; p% r. P8 P# C  0040106C:  call      CreateFileA
( b) b  K4 H, a2 v6 d) i7 A( e1 A# b* s  00401071:  cmp       eax,-001) R# M' g% b. y/ j; \4 l1 v+ Z( C
  00401074:  je        00401091
) K7 i9 D% ?! ?" e  U- M. [5 H3 }
8 |9 K0 D1 q  v0 l6 y0 ]5 V7 a4 v# s; d. V1 r" D- Z
There could be hundreds of BPX you could use to detect this trick.
' O/ I1 X; [2 [( M! C) D2 }-The most classical one is:1 x0 _" E9 e* N* t' I' E( P
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" Z* o6 c) g, h4 C( d$ ~
    *(esp-&gt;4+4)=='NTIC'
: `, C- [: }1 q( O
9 l- C  P: k8 o, |-The most exotic ones (could be very slooooow :-(/ R9 _! i8 q1 b4 d# \' _8 S- y  w6 P+ V
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " E7 P! i4 w, x4 v5 B' k
     ;will break 3 times :-(6 o, l. S) L/ j3 g
6 i2 a5 q$ O' d7 R4 `
-or (a bit) faster:
7 I3 U6 D4 o! g3 s   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), r# A7 G/ h& g# a& y; H( G+ Y$ l
1 U+ P- ^4 t+ k6 Q  D8 {" P
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
( A! s1 Z6 A! v* d) n9 n9 ~$ m     ;will break 3 times :-(
) h) A; l& o) K" U
: r% x; J. e% i-Much faster:
1 J; {9 @8 J0 `+ Q   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'  M) r4 {" i# N9 I
, a; I1 O9 {- m: ]' H& ]
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen( b+ u' P8 Z! I/ t2 e7 ~
function to do the same job:
& a  \0 \- o# E! S- q' v0 ^
/ N3 U5 O, N  A4 D/ m3 p   push    00                        ; OF_READ
% V0 r' ^1 z; b7 V; x- ~   mov     eax,[00656634]            ; '\\.\SICE',0
" [7 }% }( S& I9 j  q% b   push    eax
2 @( w$ @: {/ H! p5 u, }- {   call    KERNEL32!_lopen
+ o0 `- A( Y: P0 t* |; D   inc     eax( h: e% _5 }  W4 r2 i9 e! |
   jnz     00650589                  ; detected
4 K- S6 e$ d2 N$ g   push    00                        ; OF_READ
& i, \7 S' T1 R" B% d6 p7 z   mov     eax,[00656638]            ; '\\.\SICE'
0 H! m2 c6 K. C3 `   push    eax5 `5 V2 l" R1 r" _/ Q  d7 ]" A! i$ o. M
   call    KERNEL32!_lopen' i% i" x: L8 L+ A
   inc     eax$ T$ e& B0 C! \/ F/ n$ o2 t
   jz      006505ae                  ; not detected+ P7 D! P5 |: W% J$ s0 F6 p
; K/ c, M, o; X3 z, T5 u$ R2 m
; Q; c; T- j+ {
__________________________________________________________________________6 m7 {% U* ^- T+ Y. y  q

9 U% k' H' ~7 N' s- ]" JMethod 12
4 x% K# n6 W3 L: o7 H- V: j( i1 B=========3 w  F4 r- K5 R% f0 g' D

2 I4 h  w+ J. V9 M# K5 ZThis trick is similar to int41h/4fh Debugger installation check (code 05
* V& l) @7 W2 f  i&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ G& s( d2 o9 X( S
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.' V9 w$ d+ t: j1 T

- o! n$ D" n3 X! a. U$ A' i   push  0000004fh         ; function 4fh
# Z! T+ U5 K$ I$ T+ _   push  002a002ah         ; high word specifies which VxD (VWIN32)8 e6 R, F+ A- V7 z& G
                           ; low word specifies which service$ ~+ N: K' F% \) S/ [4 O
                             (VWIN32_Int41Dispatch)
2 X' {  y) e, l7 }+ k- _, U   call  Kernel32!ORD_001  ; VxdCall
( n/ ?- `- @# L3 M4 P: a5 z   cmp   ax, 0f386h        ; magic number returned by system debuggers) X4 t9 J; S4 Y$ P+ f# U5 N$ T4 j
   jz    SoftICE_detected
$ i  i6 W% H1 h* ~5 z) S$ ^! y- \% N. T% I9 [0 g
Here again, several ways to detect it:
" z2 |, s5 Y8 e6 k4 r9 `" B8 k' [' w; A2 z$ l( T' d; F+ T
    BPINT 41 if ax==4f& _  `# Q' C$ U1 G; ]2 Q+ h! p* E
2 e- K7 N! k, C
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, O# o$ t+ b- X7 t( t0 i# ~  _4 C. o3 ?
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  d" D! {' N: v% G' A7 f" {) H

- V6 ?7 f! x7 _! M, c    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
9 E/ x& d  _. |% z1 W, \
3 V( x* H9 d+ ~# Q3 o4 `3 R( U__________________________________________________________________________5 c2 w. Y6 [, Y7 f, V

' c; `: N* |5 U/ H, m/ g2 G1 EMethod 13
8 Z0 o# e$ v& g+ s=========' v3 H7 U# ]& ~& E1 K8 j" b* s1 w

3 I- m( y: l2 ]Not a real method of detection, but a good way to know if SoftICE is
; {1 }! a9 N" |( Xinstalled on a computer and to locate its installation directory.
' [3 F* g9 c, e6 F+ l. {It is used by few softs which access the following registry keys (usually #2) :
$ {% j* m7 \4 C; H
% v$ i2 z/ M, F-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 t* w8 D, {1 h; A. G& e
\Uninstall\SoftICE0 Y0 j  Q! A$ x+ |) J* s9 W# G
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( @3 I' H8 r. {-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) D/ z* ~, P" q: O* V# I\App Paths\Loader32.Exe
3 B+ l  C. J" \& _$ Z0 Y- f  r5 n( {* I+ {8 j, ]( Z

0 N4 G7 p: a+ ~+ J0 l/ q: HNote that some nasty apps could then erase all files from SoftICE directory/ V* P/ ~. F' Q4 B
(I faced that once :-(1 V: J7 ]3 t2 K3 Q
7 ^1 x# }7 q7 Y" ]0 H! {) \
Useful breakpoint to detect it:
+ Z3 Z  g' G+ H* R: K: w( d) V6 }. W; @7 Z2 R
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE') L" h2 Y9 j% U8 S( ~- N

) Z6 |& I6 f4 q' Y__________________________________________________________________________
* Z. s; W9 g* [& e  x& x$ |* F6 n0 d  ?4 Z& w! [( b

& }4 Z& {  H* e3 Q# aMethod 14 6 c2 M0 Y7 Y% b  U
=========  R2 s( l0 l- _- x

7 G" w  A3 X( fA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( N+ |# \" k. L# P8 Bis to determines whether a debugger is running on your system (ring0 only).% _% h6 C8 u( L6 l3 A. m: L
/ L' C  D- y; f2 l+ Z% U9 C
   VMMCall Test_Debug_Installed6 K0 t* q- a8 }7 o( f
   je      not_installed
, i4 r1 w. ]% C4 o% g* R7 s0 y9 o  v5 K2 U
This service just checks a flag.
( W7 v+ I- [9 n( ^</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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