About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% n( \* V4 T+ j<TBODY>6 l4 E8 o1 ?2 F! E' S5 Y! @
<TR>6 d9 b4 ~) b* n# `6 V* b; K
<TD><PRE>Method 01 & P: M! T1 k2 A: ?2 V
=========
3 }) K5 b( C% x/ q  X8 i9 S. J- n0 N. v" X( s2 m
This method of detection of SoftICE (as well as the following one) is
2 c) t( [6 P% x: I% ]- vused by the majority of packers/encryptors found on Internet.( }( ]5 q+ q$ a
It seeks the signature of BoundsChecker in SoftICE
2 l3 n/ ]$ o3 n
, a+ I7 o0 C+ _    mov     ebp, 04243484Bh        ; 'BCHK'
9 H9 _1 i" {& h5 j    mov     ax, 04h" ]* J1 O% y2 B8 e6 S# k# N# `
    int     3      
- {) h3 |7 X- G$ P+ e, @3 P    cmp     al,4
  G7 A4 x# ~  u    jnz     SoftICE_Detected" }9 G. }2 g5 L9 z* M+ L  w1 Q
4 F: _( \2 U% k0 u
___________________________________________________________________________( r* `8 X/ _0 w
" c" z. _, M* c4 H
Method 02- t3 q, I7 H& j6 d; m6 u
=========! p* ], y4 L& T2 H- X# N
2 s& [; \- p) U4 @: c' `
Still a method very much used (perhaps the most frequent one).  It is used
$ Z0 w/ ~% {3 T( I* ?to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
2 d6 m5 E/ z: ?" x6 Q. @  O; b  }or execute SoftICE commands...
8 z7 d4 {. ~: c( VIt is also used to crash SoftICE and to force it to execute any commands
% a& z  i* Y6 P. d1 D2 {(HBOOT...) :-((  - D0 K& q1 j6 }3 a
# g: [6 |$ M" B6 C  w
Here is a quick description:1 x: d3 z, r% ?# N+ O4 o0 [1 c: d
-AX = 0910h   (Display string in SIce windows)
6 m% o! ~8 c- `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)4 x1 Y; [; j, I0 \+ Q) k2 f
-AX = 0912h   (Get breakpoint infos)
' }. T& J( J7 ~  u% w-AX = 0913h   (Set Sice breakpoints)8 R0 X# j  m  w  m& U8 Z
-AX = 0914h   (Remove SIce breakoints)
$ a& y1 h& d0 F) ?: A7 ?
- |: p! t. g' g: G1 h: zEach time you'll meet this trick, you'll see:  c, P# ^' W- [; N; J4 X% w4 I
-SI = 4647h; N. k9 a4 v  f3 z" m% D
-DI = 4A4Dh- u3 J5 K+ A) \7 H7 A( f
Which are the 'magic values' used by SoftIce.
& l2 Q- p+ r) Y8 |For more informations, see "Ralf Brown Interrupt list" chapter int 03h.8 X# T0 ~8 k7 t5 q4 G7 g

8 K, _& S- f- c. y" o. N- V" ?Here is one example from the file "Haspinst.exe" which is the dongle HASP! l1 I+ z9 _5 I- D
Envelope utility use to protect DOS applications:
" D+ N& g# ~* ~0 j: {
3 R) T% V' d0 T6 M2 z7 [
2 z# x1 C- \7 B" I' m4C19:0095   MOV    AX,0911  ; execute command.
  M2 P" n& d+ E3 b4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- w- v6 d, j- T" ~1 j% G6 h1 Y
4C19:009A   MOV    SI,4647  ; 1st magic value.
. E/ c4 x; o5 U6 X% R4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" w; x0 {1 k5 K5 G6 P3 @4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 k7 g& E1 L0 O8 \9 j' o4 v6 @4 c% `4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 b, ^# T1 }9 H. J8 {4C19:00A4   INC    CX& k, ~& |1 I& m4 K' ^( ~& \
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute* ~: t1 e1 |- t7 L4 a) A* E
4C19:00A8   JB     0095     ; 6 different commands.7 x2 k: f: M# i2 m8 _5 J5 W" p6 z
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ a, }. R9 W) Y& S4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- l+ m+ X& |8 w  t' G$ f4 p1 m* t3 r* [& _: n+ |( \8 b: |
The program will execute 6 different SIce commands located at ds:dx, which+ S, P2 |( {! h9 d' A/ C/ o- w
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  G, w8 p  n! H# x3 @4 f  y) ~2 E: u- L4 f0 X- [
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 b( f7 S2 T8 N' W
___________________________________________________________________________
  d- E+ M: {' \  U
7 N8 B0 Q- r3 q2 C0 Q
7 t" N% @( y$ _5 fMethod 03
) u8 G- n+ [$ P  \7 }=========% J: [+ n% U! F0 k
% n9 W8 ~; \. U% C
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 z$ q  ~- W8 z5 H( Q(API Get entry point)1 L& ~) a; a; h; w
        ' K; p. e+ M4 `
6 }5 u* K9 R  J
    xor     di,di
$ C8 d$ ^5 T3 y* E& u    mov     es,di7 l% W. N1 s: N3 P7 [4 ~( y' }
    mov     ax, 1684h       . \  k, V, W  L+ H8 j: X, d' f: H
    mov     bx, 0202h       ; VxD ID of winice
$ v- T8 E% f& Y8 r" U) d* t5 f  n    int     2Fh. e6 _- B: X; k# A6 N# k  \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& @: m, f. {$ i6 u5 @( I    add     ax, di5 {( ^; c( i" t4 H, |; k: s- W
    test    ax,ax
& @) e7 d) v% c0 i, f8 [7 a    jnz     SoftICE_Detected
3 d# h2 e, K# W8 ?# Y9 X
, M. N4 s- I* Y% `$ q___________________________________________________________________________1 f8 J* E4 ?3 u/ `+ u

, y" w4 t0 A! F( ?" [Method 04# f" k; j5 a' L; P, _  U
=========
2 i- e2 Z/ X% b. q: R2 A8 U8 {2 w* n3 d5 o7 O7 k, P7 p4 Y1 f/ x
Method identical to the preceding one except that it seeks the ID of SoftICE
6 L/ k3 q) r) H* uGFX VxD.+ v6 Y" C# a9 {
' g: C6 \: d" }0 Y, w9 J" q
    xor     di,di2 s7 w' c1 h) J0 s; V
    mov     es,di. O0 V2 I  y. U
    mov     ax, 1684h       ) c! P8 a8 `: U2 k" y6 |" D" _+ X" S
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! y) u/ h. a0 B    int     2fh
2 \1 s" S! k# [5 M    mov     ax, es          ; ES:DI -&gt; VxD API entry point# }$ p- r* S$ C- t8 y9 Z/ C
    add     ax, di/ G: N( R9 _* v, m9 p7 _1 b+ l3 i$ \
    test    ax,ax& {8 E) |! N* x$ e3 h5 c
    jnz     SoftICE_Detected, V: }. o$ c. `7 M% y6 [3 |
1 B4 e- r  c; S  A2 s4 e5 x
__________________________________________________________________________  o0 \: `& l# i2 W" m$ d2 q
- y3 J6 I3 x0 J9 i

) v- ]& ]; A8 ?: m$ ^Method 05% T* F) m1 G( s6 Z) [4 M
=========$ }' P3 W( h1 D$ U& H* z

" _4 |; S& n/ T+ B3 X& iMethod seeking the 'magic number' 0F386h returned (in ax) by all system
9 {& [. e) k( L6 a* B6 ]$ Wdebugger. It calls the int 41h, function 4Fh.
$ n3 A) K% N& T# ^, b# LThere are several alternatives.  / B$ ?6 r/ x( f- P% C- G

, U/ W7 f4 x3 o1 K. @( c1 AThe following one is the simplest:
$ L& e$ @# A- t6 F( k
  z/ F( V7 C3 o* |& T4 z    mov     ax,4fh
1 b) c2 h/ J3 G4 m  X1 C: c5 \' g    int     41h7 A$ u; n5 V- {1 x! l: {; R
    cmp     ax, 0F386
9 y. `6 \0 s4 m7 h# n6 `1 l5 b) H0 r    jz      SoftICE_detected
- Y( Q, H/ \9 M  }8 b" u+ w$ h5 l6 d* I* C& Z: g

; {) _& A7 b$ j- z* q5 ]Next method as well as the following one are 2 examples from Stone's
9 a3 c3 f( R* I2 |"stn-wid.zip" (www.cracking.net):9 h- }$ k9 m. k1 H' t
) v1 q( N: q7 |7 p) S( C  e6 Z5 D
    mov     bx, cs1 j1 Q' r' a; {; Q8 M& Q% V
    lea     dx, int41handler2
& |! e0 a( l; Q3 o5 o    xchg    dx, es:[41h*4]0 X2 e  u0 v; \# j+ A' ]
    xchg    bx, es:[41h*4+2]
  G' \4 Q3 o, F- t! L    mov     ax,4fh
: ^9 J2 S0 t6 G    int     41h! c6 R; @0 J1 o: h5 U
    xchg    dx, es:[41h*4]2 v; @5 @- Z. m/ a, m; u5 p
    xchg    bx, es:[41h*4+2]
' W6 y& A0 t. h9 N, s    cmp     ax, 0f386h
' s  b- S: w% o    jz      SoftICE_detected4 C. R, i! E; D/ ]3 D

& i2 d5 r, H" g: ~7 K2 B( ~int41handler2 PROC
: ~3 @' G+ j; F! v    iret8 c; U& T! Y$ E! [$ d9 g
int41handler2 ENDP
% s! N. E+ ]! L" x6 N4 @9 S% e3 j8 S  \1 Z
% Y# `- s+ B/ N. `, P# P1 g: y. @
_________________________________________________________________________4 f* n. R9 p/ g. b1 N3 W) x- y8 _
" N8 k1 W( @* z6 x

. h) R6 S5 C7 sMethod 06
2 }( G; D; [5 O$ q8 c# f" K=========+ C; a0 ~" r1 ~( P# X

' g0 Q3 F! f1 u+ A0 n5 Y3 p1 b* H  C. P: ~
2nd method similar to the preceding one but more difficult to detect:
1 a3 l; e1 A: H! a1 @) u1 F
8 b6 j! Q7 `. g( g+ t4 D2 H+ i0 D" m( E3 Y1 @" v# y' M6 j! m' P
int41handler PROC% N/ K' j. V- G+ `4 c
    mov     cl,al
3 R' T7 v  l" N9 k8 g! }7 U    iret
9 X" B0 F7 ?; i, g0 h$ |" E7 H7 fint41handler ENDP
7 b$ V- s# `' e6 Y$ Y5 W
. \$ z, K9 k$ h% q$ n! b' H  v( t3 L$ @# B2 h8 `7 B# s* s% J
    xor     ax,ax) z/ v3 a9 x) X
    mov     es,ax
3 |3 [) l' X- Z    mov     bx, cs8 b7 h1 x3 X$ C; o' v3 u# s
    lea     dx, int41handler$ G  f  d$ s& c
    xchg    dx, es:[41h*4]9 T5 L9 `) V( t
    xchg    bx, es:[41h*4+2]
( U+ u; I9 W7 }+ _+ A3 v/ c8 {    in      al, 40h" s8 x: Y: f" n! U4 y+ W$ z
    xor     cx,cx
8 \* E& [  Z) `/ L) A* T% v" l; U    int     41h) W* s/ _; F" M: c) q5 R
    xchg    dx, es:[41h*4]/ B0 ~4 D% [5 C
    xchg    bx, es:[41h*4+2]
9 U" `( x$ M8 i# h! o4 N    cmp     cl,al
1 ^* r9 y0 j9 b1 H" b* r$ x2 |    jnz     SoftICE_detected6 [; Y2 s3 R+ F: X4 |8 y* y( z
& j% D" Q. x# o5 L4 X/ D
_________________________________________________________________________% l( e8 c* i4 h& g. w7 @

& `% Z. Z6 F9 G/ X  _4 ZMethod 07
0 V4 [7 c1 M" c9 {=========
& T3 p  h% |% q; p2 s3 W) e5 N1 R! [
$ o- s6 i, [, x, W, G! XMethod of detection of the WinICE handler in the int68h (V86)* M: H& }1 S; Z' v1 E! y/ h

) m" e, E1 o# \. `+ ~    mov     ah,43h8 m8 y  h  V$ z# F6 S
    int     68h) O, U: k8 _. X8 W
    cmp     ax,0F386h1 f: L- ]9 I) [/ m. B
    jz      SoftICE_Detected
( i) @  {: b1 @0 T9 x4 _# y
: R; R2 K* D8 I4 f( v* o" r# f
# q: c$ Q# K6 P  K5 ?1 y$ i=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" L% y" Q5 g( R# x3 J, A   app like this:
- H+ @8 n* ^! _0 S: r: }& V
, j% b7 t# ]* O* _) v7 D   BPX exec_int if ax==68
7 d8 f" t, f; D. V8 L1 V   (function called is located at byte ptr [ebp+1Dh] and client eip is
0 N/ H4 }( D  j5 ^( ~& o& u9 _8 A   located at [ebp+48h] for 32Bit apps)
, f2 s9 V* P, e" |$ U5 s__________________________________________________________________________
7 R6 S, K: U0 R
. g; |$ _7 Q" |( W4 R5 k* m5 m* [# A* U5 \& l( n+ F- i6 s
Method 08
. w" O6 E2 x  A4 _; c4 \4 k; M=========
$ H6 x/ z% Q/ R" K0 r! c
3 }6 z9 `5 T  L% d% ]; J# c! jIt is not a method of detection of SoftICE but a possibility to crash the
3 w. f+ u: [- B& ^system by intercepting int 01h and int 03h and redirecting them to another
6 |6 i0 V: W4 i; m8 T4 _) [routine.# m# T$ h# q2 w" z4 P4 r: ^" _( k/ u
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ d, X. J& U  v5 [& ^to the new routine to execute (hangs computer...)
4 N9 U$ f7 M6 f& [& X8 i/ w
& R" B9 o& T  r, S1 H4 ?    mov     ah, 25h) f# V0 q/ A. B6 t! A
    mov     al, Int_Number (01h or 03h)3 S! W) U( A8 p  \8 U
    mov     dx, offset New_Int_Routine: m: H* z, Y1 m+ R& ]7 x1 y
    int     21h
  w& S  S# A- V' ~7 T9 |: ?% o7 J  q; b  G, H2 r. g1 ]
__________________________________________________________________________$ s: N% d/ x# o/ q; [

; A! Z( R2 |/ \% w3 wMethod 09' T" r. _" C) M7 Z( a2 {
=========
: h* T4 w$ {! R5 {
  @7 X+ |3 g6 V# fThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
+ V7 Y- t% ~3 dperformed in ring0 (VxD or a ring3 app using the VxdCall).8 z- F* V. [) R( Q- f1 Q" h
The Get_DDB service is used to determine whether or not a VxD is installed2 O0 G1 R# o  I& K! H# T
for the specified device and returns a Device Description Block (in ecx) for
/ J) k* x2 z7 o; v5 o1 _! G. [3 bthat device if it is installed.
1 V' w, S+ b# p2 G# X$ }' g6 m, g8 y$ E
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 ?0 T0 [4 D+ n) o: x7 N( \   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)# H- s' {5 i" A! w$ ~  P
   VMMCall Get_DDB
3 B$ O/ U. p6 e' B% n  N- _! c  t- k7 l   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ d1 C8 y: g' ?! P* B' M6 U1 V/ T
0 x$ ^; D2 f, p  QNote as well that you can easily detect this method with SoftICE:- H- _! I9 u0 P/ n! \# p
   bpx Get_DDB if ax==0202 || ax==7a5fh
9 I: n" k' @' S( l$ S% I- j; A3 O* z+ o2 Z2 ^3 K
__________________________________________________________________________0 K. [" U( ^  E6 S

. Z+ D2 A* H. C( A0 o8 eMethod 102 B9 s8 |1 V+ H& l  \# r
=========, F: M9 V) w) x+ g# i6 J1 {
3 h0 g. [+ |7 a' o
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 v$ U$ T) ]4 E$ G8 r  SoftICE while the option is enable!!3 b) G- \; B2 d: z' r* ~2 t2 [
5 b' M  \4 f- A
This trick is very efficient:, h/ {8 R% k% l+ Z  V- v
by checking the Debug Registers, you can detect if SoftICE is loaded
' K& a5 T# ^0 a2 n6 M+ ~(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' [- x, g( t; c
there are some memory breakpoints set (dr0 to dr3) simply by reading their, x. G+ L( ?2 k+ t! _" P# @
value (in ring0 only). Values can be manipulated and or changed as well2 j' h4 P# p9 |1 D8 C+ m+ u
(clearing BPMs for instance)! w' j6 b8 m: N
2 U9 V6 O0 F1 |0 ^7 R
__________________________________________________________________________3 C: I& s4 b5 N3 |8 v5 t0 U

& ]6 K; K! E5 L. F* X, q3 v7 x% QMethod 11. z) B/ |' a* ^
=========0 \7 U1 [9 ^6 C2 b; |
7 R3 T, c# u/ v: b6 ?( g
This method is most known as 'MeltICE' because it has been freely distributed
9 [3 r' h% b3 Z9 w" jvia www.winfiles.com. However it was first used by NuMega people to allow
# Y9 Y: V" p- j) QSymbol Loader to check if SoftICE was active or not (the code is located3 x" f6 t+ y% N8 Q- C/ |
inside nmtrans.dll)., ^* _; V, q8 {+ I$ Y3 l8 r0 M
; X  l3 Z/ n( z
The way it works is very simple:% j0 g( |2 F; ]/ s3 Q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for  e, V0 Q" \! e6 v/ b
WinNT) with the CreateFileA API.3 x" l4 V# f0 c6 }( V2 _
  g: r$ m, D5 z8 n
Here is a sample (checking for 'SICE'):
6 n4 K5 ^/ W* y
" E1 c$ _- Z8 M" F! h/ s+ FBOOL IsSoftIce95Loaded()4 y8 T9 J2 Q9 v
{
/ [/ J5 u9 K/ U$ v   HANDLE hFile;  
' k7 ?0 ~5 G' H# ]$ `# e1 z: E   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 m+ Z' f) r6 w$ j/ Z* H" Y
                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 P5 l5 T* y9 T& ?: D7 x. n
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* v$ m' @) P" V/ J% f   if( hFile != INVALID_HANDLE_VALUE )  S/ c: E, z3 ]: o
   {
- r; W1 t! `% E1 W3 {" z      CloseHandle(hFile);" f5 g. Q# G0 a, w+ _, [" O
      return TRUE;8 I  Z3 L. e; ?
   }& R' r' }; ^4 N( E/ I
   return FALSE;  k9 K0 p) s) w% g
}. _9 V. f6 O% A  m1 m7 u0 K8 A( d4 Q

5 \0 z6 `1 \; f" v, X& W  k$ U, {* cAlthough this trick calls the CreateFileA function, don't even expect to be
# ?. l: f' X1 p: |& B) Cable to intercept it by installing a IFS hook: it will not work, no way!: `/ `2 w% L7 e8 O# |& F: J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
' ~1 b: J7 [( P2 V8 c5 P/ @7 Pservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ o/ S' s7 o5 q; {1 `9 _
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
* K3 Q' z3 N5 [& W! |  c. M9 Afield.
7 L& O' w2 F) p$ ^In fact, its purpose is not to load/unload VxDs but only to send a . }. r8 V8 E' v( Y, X; d- r
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)2 C+ L( @! i7 l( C
to the VxD Control_Dispatch proc (how the hell a shareware soft could try& R2 B7 D( o- J* c
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
( x+ [# p& h- ?! xIf the VxD is loaded, it will always clear eax and the Carry flag to allow; X& O( r# W8 [% V7 n
its handle to be opened and then, will be detected.
3 S0 g  K2 w( K# i0 {6 o: GYou can check that simply by hooking Winice.exe control proc entry point
6 ?+ [. \9 D4 {! Dwhile running MeltICE.
3 k/ g/ c$ R  T! U# O7 L. S# ~
* V6 M# A6 Z8 G& w0 O) ^: [. f+ A: m7 j, o* _, A
  00401067:  push      00402025    ; \\.\SICE
3 H, C. B- d8 x  0040106C:  call      CreateFileA
! ^% Y( P5 ^3 z; q& |) Z+ r7 s  00401071:  cmp       eax,-001
7 D) {1 z2 K+ C! ]6 W  00401074:  je        00401091* U# ]5 d) _! a" ~+ @
; i  g( L8 Z3 s% l7 }3 M9 i

! f& e7 K% [2 ^; cThere could be hundreds of BPX you could use to detect this trick.! t4 F4 H8 u9 F2 @9 h' h9 D3 x3 _
-The most classical one is:
5 b5 G5 |4 g2 [; r+ Y( R1 t  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 M) |+ A4 ^( L; G
    *(esp-&gt;4+4)=='NTIC'/ V) ]4 _; B+ ^1 A) {
6 a" ]" l+ `4 X$ L7 t' a
-The most exotic ones (could be very slooooow :-(
* e5 Q+ r9 z% U/ v- V   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " Z3 H' k* t% b! D+ e  r; ^
     ;will break 3 times :-(  C8 `2 E* r9 d' |0 T  P
( o; [4 y6 F, z" E3 O
-or (a bit) faster: : C# r3 L2 K& f! e1 j( {. k
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')4 g* N. S. ^% |! ]. X* D

: z4 @+ _6 o3 p- ?   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
! e: |" U. [6 s) ~: X* @     ;will break 3 times :-(% J4 [1 o0 _; r+ J- l% x4 q1 L- E

8 }# M: s$ O. \8 J% R- o, ^-Much faster:
, q$ H: ?4 |+ R   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% ?9 M7 p6 h/ H% y7 r) [; m5 c
, I# J% u) D% s+ T- s- K- _; B
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
  j, O+ k1 ?$ Pfunction to do the same job:
9 \; v+ Q5 G& \2 U$ S5 A, V& L( h4 h) o3 j& b4 S% V: A0 E
   push    00                        ; OF_READ5 ?7 @" I0 f. o, ~3 p
   mov     eax,[00656634]            ; '\\.\SICE',0" @5 M# R$ i! N1 f
   push    eax
: }( `5 v2 e2 e. o0 N   call    KERNEL32!_lopen/ ^3 v' D' g% j  I
   inc     eax
* Q2 o6 |" x& Z   jnz     00650589                  ; detected/ P! K% n5 A/ h  w+ ^
   push    00                        ; OF_READ
) O. }  e  ~* C! Y( n% D. _   mov     eax,[00656638]            ; '\\.\SICE'0 B( U; C2 c2 @5 p. I( t
   push    eax
+ ^2 W1 K+ m" x   call    KERNEL32!_lopen
* Y6 s- p2 F3 D2 g7 K) F' b3 ]   inc     eax% y, p9 K  H$ E/ l2 i+ {$ {
   jz      006505ae                  ; not detected
) w1 o) O4 G* d/ }& [3 J6 y$ R0 g

3 s% N1 ^; U6 f1 }1 N/ A* [2 ]__________________________________________________________________________- T0 ~7 G: m: I  u, E/ H8 a) w# B

4 G5 {) C- {0 [Method 124 y, ^; ]8 ?3 `5 s/ m: Y+ ?& l
=========" `8 f7 M6 K" ?  C

* o0 Q. l1 r1 ]- j9 BThis trick is similar to int41h/4fh Debugger installation check (code 05  j5 A9 o$ a+ {( F! b
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
3 c- s1 F8 }; F+ {" U$ {! cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 j" c8 v& [5 B( f7 _# z' u- H5 u9 B: d" N! f- P
   push  0000004fh         ; function 4fh3 W, {4 U  V4 ?' Q" E
   push  002a002ah         ; high word specifies which VxD (VWIN32)9 y) Q0 }5 ]. z
                           ; low word specifies which service
$ t5 p! G" Y  w+ K0 d                             (VWIN32_Int41Dispatch)$ G  ~6 O3 `# n+ ?- I. ]
   call  Kernel32!ORD_001  ; VxdCall
. J) ]$ C( W8 A3 ]1 D" z- o5 L   cmp   ax, 0f386h        ; magic number returned by system debuggers) j2 [# p4 v2 D" {
   jz    SoftICE_detected
3 I9 Q* i5 T: t: Z, L8 b1 r4 K% c6 F# Q& W( z* n8 F
Here again, several ways to detect it:
+ }4 a! @* S- t' S5 o
/ T0 h6 i4 |3 R+ z2 Y! Q% o    BPINT 41 if ax==4f% k% b1 z# G9 T% ^% A, Y9 a- m, L- V

3 L6 X! v5 v# n. W7 V+ a    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- ?5 s: I( S8 b) u% `

, v! h0 p3 u  Z5 M: [0 x; ^& I9 Y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A# }0 E- D& `* o. ?3 f6 G6 @

, k) i( B. V8 D# I+ \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 {2 e, m. T, d4 n8 S2 Z% q" Y3 `

2 _/ O8 W! G( {' l6 G- N9 v__________________________________________________________________________4 `" t* ?2 q3 s# `2 [; J

& D; y: t- ~5 kMethod 13
6 ?) w' F$ K4 g, }7 u* b4 }* G4 C2 a=========
/ y! W- j- s( |& z9 [6 v- j3 W4 ?
Not a real method of detection, but a good way to know if SoftICE is
  D0 Y% e9 U6 j  L5 W  |installed on a computer and to locate its installation directory.1 x; ]( r. d7 ^$ X
It is used by few softs which access the following registry keys (usually #2) :
1 u* J% i7 \  I: O. p4 A; B: Z$ l! w3 P+ H7 s& q9 s
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* T* v$ k6 s) x
\Uninstall\SoftICE( c  ?1 C9 q7 o2 s: Y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE" X  m4 M3 z$ Y
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) k- k1 |9 Y; K+ I5 F( b5 m\App Paths\Loader32.Exe
) e" U! l- b6 p& h7 F$ A
8 k1 T' t: ]" E, ~( s2 e4 B; G5 {" R3 A8 q, q
Note that some nasty apps could then erase all files from SoftICE directory1 W, ~! `+ u+ i- I) m5 y
(I faced that once :-($ Y4 u* b4 c8 O, o- s

3 a7 Y! U* ~5 D% r( j; c$ m8 q2 ]Useful breakpoint to detect it:
& n  l' T1 }9 r
3 R4 {6 r: n2 N' d8 W     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
: K0 j7 O& A5 ]  K; a' I
% F1 l7 N1 Y  y" ]__________________________________________________________________________& }/ ^( E/ c1 Z

) R2 K% l7 C! A& R! g' ~
& p/ n4 @" g! [+ O+ CMethod 14 : Z, h, _. M5 \7 O% g! V1 d
=========
2 @$ b: A* f1 ~, C8 n
+ E" P) k8 r7 i6 ?! z5 rA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 I& G* V5 S) ]$ t0 F. iis to determines whether a debugger is running on your system (ring0 only).% T% n! S* E' e0 C3 n; u
+ w3 [% ~' F& e! X: k4 k
   VMMCall Test_Debug_Installed
7 ^$ A) r. x  \   je      not_installed
9 A6 S. n) {" n) @1 a
' \8 v1 O6 R1 ?: R6 ?This service just checks a flag.5 T- y" g0 _3 _  _* w
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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