About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>, a4 M; l. a: V$ b+ Y: C4 X
<TBODY>. {$ D2 G' A; s/ M9 ^  u. }
<TR>5 z9 e4 S* S& ^" O% q/ [6 S/ L1 L
<TD><PRE>Method 01
1 C3 u; k) o! t. x, y" F5 O6 F=========
4 @* r8 B8 _, l* ?
+ W) V. g) d, \1 W0 P/ j3 hThis method of detection of SoftICE (as well as the following one) is  k7 r7 M' e; W% Q
used by the majority of packers/encryptors found on Internet.: c% u6 P- F" z; D( @+ [
It seeks the signature of BoundsChecker in SoftICE
5 s" c. A2 d. Y+ G' z# g
( k& }4 i( F6 y: k4 C. x5 E! @) W    mov     ebp, 04243484Bh        ; 'BCHK'
7 f6 ^" L# Y3 M  f- K    mov     ax, 04h3 e( \2 E2 A: R, k$ _' s
    int     3      
7 l. E( x: i" i: W+ S6 o% K    cmp     al,4
( n! ^, J6 b( U2 O! X    jnz     SoftICE_Detected
/ C) R% q7 O. r# {5 l# ]( o1 ^7 n/ e& v7 e
___________________________________________________________________________- N. P5 s! V1 a! L$ ^
2 f. B  i* n$ e) {
Method 02
( {( [6 R* e. t) w=========4 R  F9 r- G0 P4 }' E

2 w2 ]4 N* a4 w& pStill a method very much used (perhaps the most frequent one).  It is used! D/ ]0 m) B2 |+ E
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ A4 Q" _0 U7 v$ F! ~. F: hor execute SoftICE commands...1 e+ U; h9 p+ \1 n5 q# u6 U
It is also used to crash SoftICE and to force it to execute any commands
; f% u# k# J* q8 K; @/ P(HBOOT...) :-((  
9 A( q! V+ [3 F; L8 B4 J) r# b2 l/ W: e9 k) q! c1 e; r9 I
Here is a quick description:* v  Z% j& {, G
-AX = 0910h   (Display string in SIce windows); M( O/ \" L0 E1 G( b0 g
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)5 L9 S+ K  |6 x3 \9 ~5 u6 S, v6 o5 x& D
-AX = 0912h   (Get breakpoint infos)1 ~8 e# U. M( v7 X7 c0 H) R* [
-AX = 0913h   (Set Sice breakpoints)
; Q  e9 r# K0 m-AX = 0914h   (Remove SIce breakoints)( T4 ^) L* L% f1 e# {8 a! C

) d# T4 J7 j; PEach time you'll meet this trick, you'll see:  K, Z9 F7 k5 c- p/ \
-SI = 4647h+ p! j1 R) J+ {; q: p& D$ W
-DI = 4A4Dh
1 G8 \2 f3 q8 H2 M3 A% W* v! w3 DWhich are the 'magic values' used by SoftIce.- T8 O9 [1 b* _' j, c7 }
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ b" X( g+ `3 v3 m% r- l3 F* z+ C

7 B! l8 R7 \( z* F0 e9 }Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 ~* H" b1 F" @1 FEnvelope utility use to protect DOS applications:
% L# ~8 n" d- ^; y
( j8 c$ p3 D% O9 d1 T. f% |# t; s$ _: n4 [
4C19:0095   MOV    AX,0911  ; execute command.( }) ~  L: [  i2 Z) x
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, a2 U9 e- l5 ^' O; h$ F- `4C19:009A   MOV    SI,4647  ; 1st magic value.+ M$ B0 V4 O& f" J4 D8 Z# {7 L* v4 S
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; c, k" j7 K+ i% x4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- f2 F; p# [6 R
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
9 p( P  I( \: f$ ?9 W0 m) S4C19:00A4   INC    CX
" {( f: e  z9 c7 H6 c4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
' Q! e. _" g, N# k4C19:00A8   JB     0095     ; 6 different commands.
% C  y& Y" x. Y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
7 V' k& g1 M9 Y/ k8 y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)2 V. g, o; r; ~* }. H4 F

  v( |- Z# a; E; h$ |! z9 ?6 oThe program will execute 6 different SIce commands located at ds:dx, which
3 P. G. X; J  L3 Yare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.; D9 w" K+ i4 x0 f4 a3 |2 N* `: C. w

! k2 X" ~$ f6 R# P7 p6 T! W* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& D. o9 H8 {6 @. B' `' F# H. X___________________________________________________________________________0 u' p/ I- g5 k) m7 [

/ Z% Q' r8 {' U+ ?0 f4 o+ g2 g) w1 [
" `& e, C7 ^) n: H. C  u" ~2 BMethod 03
7 r  u6 D: @& \% A4 b3 g=========; O$ U: k$ Y0 L

" P- W: c" ]* i' \$ I0 QLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" w% e  m$ I! F6 @, c' a
(API Get entry point)! ?. \9 U& W4 z3 v* `% X5 u$ m
        2 _( n6 m9 s" e1 B

; a. X! ?/ q1 ?  D    xor     di,di( ]! j5 p; Q9 H' C
    mov     es,di
+ C6 W0 Q4 e) G' ]7 v2 E/ \& K    mov     ax, 1684h       ( N2 I, m8 r+ @2 N! v3 p: ]
    mov     bx, 0202h       ; VxD ID of winice8 \9 w4 l# X8 C& v' t# y
    int     2Fh$ c- h' a/ v: l; t5 L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 o: T2 @& ~7 j, g: i8 O
    add     ax, di
* u: D% k4 f. A" F1 h    test    ax,ax# _/ t$ q+ t+ }2 T
    jnz     SoftICE_Detected4 ]: m4 q8 }4 R9 W* ~

3 Q2 ~( p- j  L/ I& a% o/ a___________________________________________________________________________4 q' P3 c  [1 l2 C! }

( L) V; r& J0 }6 w& nMethod 042 s! s+ B" F: v- m. M
=========4 S# s# h5 [5 F. T8 S! R6 f
* j8 W6 a. Q3 g+ F* k) n3 {
Method identical to the preceding one except that it seeks the ID of SoftICE
3 W* v' I9 [: r+ r$ K3 w: F! rGFX VxD.5 R8 E% ~. X- _. {( i

) j/ S6 i! u( k    xor     di,di6 X- Q* @4 o  p8 x' m+ i
    mov     es,di
8 m4 \0 I. @' m6 n: P# d- N    mov     ax, 1684h      
$ @% a& T" y4 `" p  ]8 M    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( b. {+ W+ _1 W3 D- x    int     2fh
% W  S1 i0 h8 i9 [: ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. ?* D2 c  i8 U6 i- N! A) q    add     ax, di, f# k: T* C% g9 o! r) A0 \" _
    test    ax,ax
& O( H% t5 ^. Y2 _" w9 V' A% A7 w* ?    jnz     SoftICE_Detected" |) \& V) z5 ~% s1 Q' k! n; n; s8 b
- a6 z! @; V/ Q1 |+ \6 v, }/ Y
__________________________________________________________________________+ Q1 @' k7 m! ]
0 H) b8 W* Z5 G; d( o+ e. u
% I2 Y4 P! c! r! l0 B$ a: x
Method 05( z. N# a! |/ v, j9 @
=========
+ S; Z4 C; a8 h* @
; U* r: G  ~8 {! k+ I! n/ TMethod seeking the 'magic number' 0F386h returned (in ax) by all system! O" [3 J. V, y$ r" o, r0 x
debugger. It calls the int 41h, function 4Fh.2 {# M% h- i& r2 p( v0 ~
There are several alternatives.  
6 u1 {6 C# i) M. b- e
3 R% b, r4 ^* t  J5 I/ PThe following one is the simplest:& ^; ]7 P- _& a

. z7 A" C9 k& K& N: S    mov     ax,4fh
: k% n9 N( D( L% [, n    int     41h
5 B6 i) Z5 b6 M* y; l: T0 @    cmp     ax, 0F386
; ~" g% o: [2 h4 I( ]2 a3 c    jz      SoftICE_detected8 w) U( S4 e1 N. N3 ]( Y

+ C( D0 C( M" s, M5 B; I6 i0 E/ ?( p) m/ _3 R; o3 W" b5 }
Next method as well as the following one are 2 examples from Stone's ) U! e' n( n1 c9 z) ~* z
"stn-wid.zip" (www.cracking.net):/ H! q. l9 c# E! n# ~! O" ]3 X! w; g
1 s3 w# O* p/ O4 z2 x  u1 [
    mov     bx, cs
9 y! G% T/ J+ X+ j& e4 N    lea     dx, int41handler2
! b. T5 `- D7 |2 a4 a$ K    xchg    dx, es:[41h*4]; B  B( {  }6 g% }, k! R
    xchg    bx, es:[41h*4+2]" V9 W0 |# P# `/ w
    mov     ax,4fh
& y  V) O, `! ]& |    int     41h
7 f- u: E% K! c# C    xchg    dx, es:[41h*4]
! ]9 }$ R# n% n2 C0 x+ h    xchg    bx, es:[41h*4+2]' T0 z# y- ?2 X) s+ l+ T4 v& \
    cmp     ax, 0f386h8 D% X; D1 e1 G
    jz      SoftICE_detected" A7 F" N2 R% v
! _5 G+ f# U- @
int41handler2 PROC
. Z+ w  j6 {2 a$ b6 F- L) E    iret. O2 l# A: K- ?8 `9 G
int41handler2 ENDP: K/ q3 ^  \" @6 A; x9 ~; N6 X

  _9 G/ `( {! B$ c# H/ M+ p8 J" X4 i! D( y% p
_________________________________________________________________________& ?; @6 u8 z6 h3 X7 c
1 C/ m# b- }/ P. z, H8 q
9 K2 v! Q( o* S9 G1 b
Method 06( q  _4 D: j# _
=========
8 D1 P6 v3 ]) ?8 e8 t7 }. H6 r9 Z" U
' s, y; ^* g) X# b! k
/ l" B3 \& P: e& h. k$ L6 X: k2nd method similar to the preceding one but more difficult to detect:
8 `& O4 @: m% }+ l7 F
& U4 C' p8 W9 n6 p# a
3 @0 Q3 w' K( q5 |- b- v" Mint41handler PROC+ l! b2 {: E: w+ }, B, Z# z. Q7 A
    mov     cl,al
* C6 P3 k5 c) }0 w% I    iret# O0 l; N: N, r4 u. t' h
int41handler ENDP
9 W5 w: _# ^8 |  `. Z8 c# |* ~+ h9 k5 S/ n; H( u& u' E

3 O  n, J" A/ b( w    xor     ax,ax
% s( G, [" k* D    mov     es,ax, {; W: F$ f6 y3 e1 |" M; L
    mov     bx, cs
9 m9 b0 U& b. \) }6 e! ?    lea     dx, int41handler
$ T4 p6 v# `  E    xchg    dx, es:[41h*4]7 ~. W' `7 w) }5 ?" @
    xchg    bx, es:[41h*4+2]9 d1 [/ i9 c& E2 ~
    in      al, 40h
  e3 g  {$ N# c( [& `    xor     cx,cx: L% c! U: Z3 s  O% e
    int     41h! @' O$ C4 L8 J& }$ k0 E1 D1 c7 x
    xchg    dx, es:[41h*4]9 O+ [# c( R/ K8 J$ W
    xchg    bx, es:[41h*4+2]
& D; T3 |: @9 v. C  m' C    cmp     cl,al) N- Z( `/ j4 ]) u
    jnz     SoftICE_detected. l6 F7 {2 u/ J: C, c
  @, I$ Q6 r$ e% {0 J; x
_________________________________________________________________________0 a1 P7 P; `5 N) _; Q
: D) T# e5 h  u) R
Method 07& E; ?: r2 ?. W5 j7 V, l5 `" b5 k
=========
1 D/ ?) _7 B. c) t& H( F( N4 D5 ?: O0 F. B* Y0 L4 s
Method of detection of the WinICE handler in the int68h (V86)
" `7 _( l6 j6 I9 e; h( P9 a8 e: o" }( y
    mov     ah,43h( V% Z! K  F" ?- P) i$ [! p. H
    int     68h
& ?0 i9 H" T! K& W1 I4 ]4 r1 }) Q    cmp     ax,0F386h
* o, Q; E0 g+ P2 Z- D3 z# Y    jz      SoftICE_Detected
* i" H( o9 I8 H7 m0 }0 }) m) }% W3 }2 V

& D8 G0 W+ a2 i+ D7 v! [$ M=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 s0 R. X" _- Y" E$ R1 i   app like this:
( q; R3 c5 O' v* ]9 \2 I! f. g; `. _! M& l$ Y$ K
   BPX exec_int if ax==68
* h6 y1 ~% ^$ h) i  W! ]   (function called is located at byte ptr [ebp+1Dh] and client eip is
' l  L4 s' t" j. v, B- L   located at [ebp+48h] for 32Bit apps)( M. }; ~2 z/ w' T* x
__________________________________________________________________________
6 E; c' f! ?1 I( m: W+ p' j4 ]$ s, N8 y+ b2 P% C/ D( q
4 \+ \' ~1 P0 k/ E" ?8 V- C
Method 08
8 b6 R7 N' r8 c8 l; g; `0 H=========
: h- Q  i' Z( i# \
) V& k/ C4 [- t) iIt is not a method of detection of SoftICE but a possibility to crash the9 v4 e3 M  k$ Z- S9 Y. {
system by intercepting int 01h and int 03h and redirecting them to another3 j6 I% [6 X1 a) q' n0 u- P9 e# T
routine.+ d4 y; l/ f5 ?  h) z
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& j( T! ~2 |' ]5 u
to the new routine to execute (hangs computer...)
) i/ q, C- i+ D& _: P1 U# F+ |* r+ v& s$ @0 a' c( y4 G
    mov     ah, 25h
# |# m! O7 C9 s% k& Y; Y1 v5 H1 J6 t    mov     al, Int_Number (01h or 03h)7 E3 ^& K. O  K( `" [7 w
    mov     dx, offset New_Int_Routine
- g1 w! Q# k) z6 k" c+ N    int     21h6 l4 p( }+ s+ K
/ H/ z% K( _2 q! v3 k
__________________________________________________________________________
- S6 w' r* H1 `! Z1 u1 [6 R
; O5 C8 y5 \: @" J  RMethod 09; g" n4 n3 a3 q5 c' M, i
=========% @6 g: A+ a8 V7 W. S5 {! s

* N# p) M) D% U% K/ g+ d  t" BThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
( Z! X, e& H* o8 b6 aperformed in ring0 (VxD or a ring3 app using the VxdCall).: P, ~: c9 `3 m4 F, M4 z
The Get_DDB service is used to determine whether or not a VxD is installed
0 ]) @8 r6 h: b" c' t0 L$ rfor the specified device and returns a Device Description Block (in ecx) for' `6 {" p7 t; t" ?% E; Z
that device if it is installed.
- v" J! ]! f) C8 d7 h+ Y
! Z! U6 f1 V& `2 J& g' _   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID5 Y# ]+ @; U7 t* h
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)7 s+ B1 a, H3 l3 a) p8 k/ Q# K& `" [% S
   VMMCall Get_DDB8 \  r3 a7 F1 W; D( _3 Z: o
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! q0 R: {  m& l
3 Q; K0 V) h& o5 B  Q7 l6 o, _0 E, U
Note as well that you can easily detect this method with SoftICE:3 {/ R( V% a. i5 ?& }# W: ?0 E3 @
   bpx Get_DDB if ax==0202 || ax==7a5fh
8 Q0 W6 \  q+ o! w* Q
% B; Z* k0 b/ z- t2 s. Z" |__________________________________________________________________________8 _( d$ }" B0 t& O: _& _! f3 P" {

& \' y' ^' O# QMethod 10" D2 p3 t* k3 e4 L0 v# r1 j8 z
=========$ B0 O" k5 ]' O4 c* F  J) x2 `

3 ~5 y; f) Z1 X6 `# }5 \2 J; X=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! u" D! m4 `8 z& r5 q  }7 R
  SoftICE while the option is enable!!0 w/ Z. C  e, E( R, U* |# V1 M
. h0 f2 Y2 m6 |1 |' _  j; I
This trick is very efficient:2 r3 M$ ~3 X- N6 J" k) g4 E
by checking the Debug Registers, you can detect if SoftICE is loaded' v: p1 @# i3 ?! M8 R% S
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
4 h  K  _2 Y9 @3 u9 `; Sthere are some memory breakpoints set (dr0 to dr3) simply by reading their
9 P6 I3 L1 A. T1 M: D4 s7 fvalue (in ring0 only). Values can be manipulated and or changed as well
- q* F2 r' ^$ b( f(clearing BPMs for instance)
7 y& z! r3 J% W; V8 n( q+ Z/ o
$ Z( d* o5 V* s9 F__________________________________________________________________________" y, {% D# E$ f" o% Q6 j
" ^: K: v/ w( c' G
Method 11/ o$ @  s5 D  r% a) ]/ |  X! x
=========# x5 }3 q4 D3 \% X& P9 \
( o) _) @: Y: M" G3 c
This method is most known as 'MeltICE' because it has been freely distributed
/ j5 |9 U0 b" h, ~" B: kvia www.winfiles.com. However it was first used by NuMega people to allow
/ W" F' J& ]# JSymbol Loader to check if SoftICE was active or not (the code is located3 l9 c. H" x7 o3 F' B. C# ~# f  Q0 j
inside nmtrans.dll).
! D: Z# O! ~) r6 q0 @
% w& c! A9 u7 H) P" ~# t4 SThe way it works is very simple:: v/ J9 Q8 t. m) s9 C! P
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) l5 k6 C/ U7 B  x/ f
WinNT) with the CreateFileA API.
9 s. b9 B- N& r8 @+ Q' @) y4 B5 q# a! C2 o+ f% `5 F. n
Here is a sample (checking for 'SICE'):
+ v# y3 H( z1 |& R+ e
9 k+ M3 p# L& f& g7 ~BOOL IsSoftIce95Loaded()
, k% Z: W6 O, }5 H& [/ X& t  l{
4 w# x, K' |' a2 R9 q   HANDLE hFile;  
* t1 k. Q! ], i$ Y6 P* ^   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* Y0 @4 X: Y6 P4 U# u
                      FILE_SHARE_READ | FILE_SHARE_WRITE,# M4 X9 C; d. R) Y. L8 u) ~  D3 Q7 U* m
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( Z- |9 U, {; I4 t$ n  t9 p   if( hFile != INVALID_HANDLE_VALUE )
4 f0 W1 F! `) k$ W: ~   {" b6 |! q0 R( F: S
      CloseHandle(hFile);
" ~6 m/ \' s$ Y7 }/ F      return TRUE;
! @; j8 w  E+ K0 J8 N- Y% g/ Y   }
2 R+ B7 R- o2 {* R) i  Z   return FALSE;
. J* o, C3 h2 a}
4 J: z5 \% S0 C" m
0 ]4 @1 X2 M; YAlthough this trick calls the CreateFileA function, don't even expect to be0 @* A6 c" a% t9 Y8 V& |
able to intercept it by installing a IFS hook: it will not work, no way!2 a7 P! T8 K4 ?7 W" I& Q8 z9 `% f
In fact, after the call to CreateFileA it will get through VWIN32 0x001F* }1 s' U7 }( X' g; A
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# L) x! T5 Q: ]4 G/ L/ J1 z7 }
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
6 V0 f5 D& x; s! C5 }$ qfield.8 R- r. s% J, @0 g
In fact, its purpose is not to load/unload VxDs but only to send a 0 {" R% e5 ~( w* g; I
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% U7 t0 e: Y! y$ v9 k$ ^to the VxD Control_Dispatch proc (how the hell a shareware soft could try: E+ ~" j! B; O5 |: A% J
to load/unload a non-dynamically loadable driver such as SoftICE ;-).( E, n! ^1 A$ h2 h6 C" t
If the VxD is loaded, it will always clear eax and the Carry flag to allow9 ~0 }: S9 r& @" z1 C; L
its handle to be opened and then, will be detected.
/ ?8 Y& _  o5 xYou can check that simply by hooking Winice.exe control proc entry point. e  z, \, k' U+ S# l0 c
while running MeltICE.0 c. E% s( K% j5 p2 x5 a& k
9 i1 J8 c; f0 f

; z! }8 b' r2 l& E. U* P! t2 q! O  00401067:  push      00402025    ; \\.\SICE2 Q, I1 Q( r5 N5 `4 R- x5 L; X( r3 F
  0040106C:  call      CreateFileA
; W: B7 `! f. X2 P6 z  00401071:  cmp       eax,-001
+ S' v: c1 I9 n9 i1 t$ h& b  00401074:  je        00401091) f8 |: F! M# K- \1 J

, R" ], b8 F+ j, A
3 n% L8 I# t/ f2 L* p$ UThere could be hundreds of BPX you could use to detect this trick.. l/ [8 c# Y# [0 z* X' H
-The most classical one is:1 d8 q5 N1 N$ m+ ?( U) {
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||& X' e5 d& w5 Y, {$ W# G' E
    *(esp-&gt;4+4)=='NTIC'
. g! h, \* n0 {, K  l5 z2 m. @5 w5 d# `) E6 n: D, a
-The most exotic ones (could be very slooooow :-(: y2 m8 B, Y2 Z- b: A9 d
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , W0 d& }. T  p  O1 {; i
     ;will break 3 times :-(: M+ \- g" u5 z. t  P' C; O! y

+ K4 c. q! r5 [) s  V-or (a bit) faster: ( u6 U+ O0 e' b, H, e) {0 J2 }
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
! V" m. W  ^- |. N5 H  r, b, [' K- |' f2 n7 d6 |1 d
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
0 r) N" @/ \6 D7 V% F     ;will break 3 times :-(
8 c: ]8 a- b. S8 d2 K/ \/ f* c+ _' V2 E
-Much faster:
  Z& T3 `+ X2 d! t% H   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" Q5 m( e! d: J0 @5 k
! ?) g$ j; _& O, i+ F
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% H" ^; B/ U6 ^8 u
function to do the same job:1 G' w$ e+ y! W
" b/ `. p9 k; k0 b. {
   push    00                        ; OF_READ3 I; }$ m3 B: K& p$ s1 M* O" R8 r7 v
   mov     eax,[00656634]            ; '\\.\SICE',0
* `7 P. h# U$ z   push    eax
9 m$ R& D0 D& f+ t7 g   call    KERNEL32!_lopen
1 c$ `# R+ ~4 r+ M. i   inc     eax
2 C) p$ D* _7 c* r" ]% S: L; i   jnz     00650589                  ; detected
3 `% a8 H1 y; E1 n1 N   push    00                        ; OF_READ2 I7 z. J+ K( P1 i  @' s. P
   mov     eax,[00656638]            ; '\\.\SICE'" a$ C& b6 d* x  n
   push    eax- U& j6 s, N) c: K
   call    KERNEL32!_lopen: [# `5 S8 m- I& g1 d
   inc     eax
3 L# q: _, E4 ^# V   jz      006505ae                  ; not detected" a3 E* p4 q  Z" [4 _$ D9 K3 z. ?
9 T9 o" U" s5 J) @
6 h0 G- r1 V$ t! b) t; ]) J
__________________________________________________________________________4 D# O/ T' b& K- U

1 V3 _; E/ I5 w4 U9 V6 vMethod 12
4 K, `% J: f8 ~* W=========6 j7 G5 {7 R- `7 l1 u* d, T8 A

) C! r' Y/ o, yThis trick is similar to int41h/4fh Debugger installation check (code 052 d( F7 S/ l' w4 C4 @, E
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: R! ?/ Z1 G  E( ]: mas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 u5 {. v8 M: L+ v2 l/ s4 [
/ G8 X' ~/ h/ N  P   push  0000004fh         ; function 4fh5 t+ z' v  E- ?. S5 v. B& T
   push  002a002ah         ; high word specifies which VxD (VWIN32): x, [8 J' K& i% a  @$ N3 q
                           ; low word specifies which service
2 N7 U  Y& m0 {$ ?- V                             (VWIN32_Int41Dispatch)
9 O; M, V: b  J% J   call  Kernel32!ORD_001  ; VxdCall
! W# ]' _( \: q" B/ _# [   cmp   ax, 0f386h        ; magic number returned by system debuggers  d) K- m0 }1 b' i# M
   jz    SoftICE_detected. f0 M, R7 o5 t& u

/ Y& u0 t9 K3 u( _8 ~/ y% `5 l9 {5 CHere again, several ways to detect it:5 Z) M( F6 a& s  I" {

2 j3 y" u" V4 A7 y6 q3 b    BPINT 41 if ax==4f
' \6 G: O( A2 g( p3 g8 k- n% a  o6 g2 D. l3 s
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 P" ]4 q, P) [% @
6 i& g3 \& N$ g! m4 d
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 }1 @0 ]1 L' W# f: s6 M/ B% r
. v8 E0 o& U* \# g% s/ {/ m; u  V9 x- N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& ~: C1 }6 l3 m

3 A/ s) w! ?& Q4 c) q( M, u* }+ ~__________________________________________________________________________7 m, h/ N" Q2 D* ]# j! X+ \3 W
5 E# Q1 q3 _5 I. P
Method 137 d2 T% ^- M1 ^0 z
=========
5 k; i- C7 p1 p, ~- C- i: R8 j4 m- V/ D' ?6 O$ n& w8 _2 j
Not a real method of detection, but a good way to know if SoftICE is
% Q' n6 k% `! h6 j1 c8 G& g( kinstalled on a computer and to locate its installation directory." ]! `/ u, i# [/ ^7 p
It is used by few softs which access the following registry keys (usually #2) :
. l. B/ U! d3 o/ I2 X
& l; y) M0 S  v3 i7 b* T-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 v9 s# ^( x- Q: _& x8 p
\Uninstall\SoftICE. ~8 f# [- ~* I0 ~! H' P3 ~) e
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# Q: ~- b6 t9 W8 I& @4 N6 R; ~-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' A1 _0 l  V4 E8 I2 k; `
\App Paths\Loader32.Exe
  P# w, I6 K2 z# n, T, A( J" P
5 d' q# v5 J( U+ s# G) X5 P$ V. N. D, _% J  O) I
Note that some nasty apps could then erase all files from SoftICE directory
; c8 Z- v9 m) O' V(I faced that once :-(
2 h/ H" d6 r, \" d' S# D
$ t* T+ N6 ^. aUseful breakpoint to detect it:" J) P, O& D! M$ B, [
( Y4 z& L8 S) h3 [# F) ]  \
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 Q5 {% k8 o( G9 t/ \* z$ P# o
5 D. w" ?; _9 X2 ?/ t: w& s1 G__________________________________________________________________________4 }1 o  }+ @2 n9 u2 r2 i2 X
1 F! p5 n7 V" G1 e# x

  j1 b+ b- W8 g2 QMethod 14
0 p- \1 f; q: [" c/ h=========3 U  J* n3 C$ _3 ?% h5 f3 r

! L( {. t# L" P- qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
' n4 I" o3 s$ w7 jis to determines whether a debugger is running on your system (ring0 only).3 W* ^+ n: L; \- x2 f

1 p* G; v; U7 c) f; g   VMMCall Test_Debug_Installed
- F3 i4 z& w6 O5 P8 ~1 T3 l   je      not_installed
% |; G$ K( m6 t; C/ b8 t4 m5 w* C7 x8 i4 g5 Y. w
This service just checks a flag.1 _% [/ x# c' F. @1 @8 H+ ?6 Z/ l( [
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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