About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' A; o6 h) k2 r5 ]5 w2 f( J6 P
<TBODY>
: j6 b- Z) n5 C7 V& t6 G9 t* u8 N' }<TR>  G# {$ Z7 S* d+ e. W0 i
<TD><PRE>Method 01
: ]" ^) E" E8 H=========
1 U0 o4 F; t8 `+ M& p
3 u9 Z/ N+ I$ g. D4 |" ZThis method of detection of SoftICE (as well as the following one) is
+ E& ~3 T. ^/ U- d% v+ g4 P: fused by the majority of packers/encryptors found on Internet.
) ^+ S; j) L+ X( O1 p. @It seeks the signature of BoundsChecker in SoftICE
+ o8 l7 W6 p8 K6 ]: x) e5 X, n. h0 C- f6 Y, v  \$ }, {# R
    mov     ebp, 04243484Bh        ; 'BCHK'
8 q1 a, N" ^- L. {. Z: q    mov     ax, 04h+ U2 k! z1 r( I9 `1 a. y4 J
    int     3      
4 C& a; @. A) }% J3 y    cmp     al,4" {+ U9 i( R- U$ c  K/ _
    jnz     SoftICE_Detected! F. a. t% J: l4 `% f; P

' A. a# M" r* K' t___________________________________________________________________________! P, u& e8 e0 Y2 V8 w; V7 `3 `4 _

' j3 k: {5 G: YMethod 02
: u3 @! Y; @/ H. C/ d- \0 c! c# }=========. X; N+ E6 v* j; t' J4 p

5 }) Q1 |* z5 n4 e1 z  IStill a method very much used (perhaps the most frequent one).  It is used4 s. V  \1 ?6 J) A7 c7 O
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: z* G# U! w) V: }5 |+ K1 ^; l, C2 Oor execute SoftICE commands...' C, e4 ?3 L0 w% l
It is also used to crash SoftICE and to force it to execute any commands
% f: J6 G$ v0 p' q(HBOOT...) :-((  
1 |. G" ]. ~0 m* B% L5 J- ]# p; m' a0 _+ F: J4 l* s! s1 s1 v
Here is a quick description:9 Q; c* q9 V9 T/ ?! V( E
-AX = 0910h   (Display string in SIce windows)
  L( w. b# X. K9 }( j: Z2 n" M7 p-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) M( Q! f* f% X# c# [; `
-AX = 0912h   (Get breakpoint infos)
6 K& `$ }8 y# `0 V+ Z& F9 \-AX = 0913h   (Set Sice breakpoints)
! }4 [+ @+ Z! O! V/ @-AX = 0914h   (Remove SIce breakoints)
) C  A+ }" i$ T( E+ W- t/ P1 \" Q. @! _9 L; h  b, F# j- M( p: M
Each time you'll meet this trick, you'll see:
! M3 m. g0 H# j; m! T! J. x2 Y* O-SI = 4647h
; T% ~+ S2 g5 P  a: T( F6 C-DI = 4A4Dh/ ]5 R( W8 H/ D, o7 {: }- U
Which are the 'magic values' used by SoftIce.
% x4 E1 c( C. e. ]For more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 g  Q+ y7 b2 R! r/ L7 \" E
7 Q4 ^% Q2 j2 t3 k/ Y* H: M
Here is one example from the file "Haspinst.exe" which is the dongle HASP0 E# f9 R+ n' c& r6 M& F% i0 u
Envelope utility use to protect DOS applications:. a/ k4 V7 @* a/ k

3 c# Q+ q2 \" i  b2 e6 C$ }# x* }, c+ \, f' u# n0 y; `
4C19:0095   MOV    AX,0911  ; execute command.9 K2 f/ i  ^/ w+ b; Z7 U9 L. t8 H( j
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 t3 a' j$ y* x, V  P( [6 B
4C19:009A   MOV    SI,4647  ; 1st magic value./ A) k9 S2 ~" `; R( f4 e9 V# H
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! \4 p( R" f6 ]1 b" f+ G/ Y4 y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ V" {. ]0 v! e. b4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* r3 [% i! F0 M. M4C19:00A4   INC    CX0 O- `! d, R* p" U+ u6 f9 t
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# d: X# J, K& a4C19:00A8   JB     0095     ; 6 different commands.. w3 a+ y, S# D7 D' d0 P
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 f" M/ T" q( [7 ]. ]' t" b
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 q  `2 N9 B+ |2 s0 s; U, K4 X; _- w+ b% K2 p* h& c; o- l& w
The program will execute 6 different SIce commands located at ds:dx, which. q9 a% X) t" }0 K
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ [, @7 e5 P3 ^+ H, `5 h; u" V1 h; o# M- l
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; G* p/ i* Q4 _3 J$ p___________________________________________________________________________
& M2 R# J- n2 h7 D$ x  `$ f" R2 ?
' z/ v$ A. y# d) y4 O: z
# V" K6 G1 Y! ]Method 030 s' M$ i6 g: B0 y$ w3 p7 w0 Q7 i
=========
, d  S6 r" k' u1 z3 ?, d& v% h3 h6 r, v& c) c; B7 ]
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 i# S$ N4 w, [! c9 o8 l
(API Get entry point)
7 k' s# O" y6 K3 y! G8 F        5 V+ R. i" c6 b# v( C
: [* x) [0 R) h, S
    xor     di,di
# g6 e  J2 c( f. m1 H    mov     es,di
! s) P5 f8 W3 q    mov     ax, 1684h      
+ @; p4 `, T$ k& z4 x9 W    mov     bx, 0202h       ; VxD ID of winice
0 `1 {  g: e) Y2 m3 |2 d+ Z    int     2Fh* r) J, `  s. S5 h8 M0 R2 n
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 K/ I# t1 l3 B
    add     ax, di
1 ~6 g' D1 I1 D+ h6 L* h9 y    test    ax,ax
7 D3 P  ?2 M, `8 e    jnz     SoftICE_Detected, {+ W0 l2 \! u1 U% ^+ L  B
) N6 c$ r/ p8 y( s$ p
___________________________________________________________________________- ?5 H0 ]/ ?% y4 s$ y( ]

; y8 K7 w1 h  x9 W% `% ~Method 04
) h$ k: V: M) g- W4 |=========6 T9 q8 R$ Y4 p# c

7 |: q; j- d, Z$ [6 ?2 k: {* cMethod identical to the preceding one except that it seeks the ID of SoftICE  c5 ^3 P8 p  A9 z3 z3 j
GFX VxD.
2 I4 j$ l; _8 D, n: b4 l) }$ c) S+ V7 F0 \: y, j
    xor     di,di0 }& H, G' Z( U+ B4 Y5 B' x
    mov     es,di7 G1 u: c+ f  K( }
    mov     ax, 1684h       5 A$ }- H3 m! U7 T6 I9 ?
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
- q! W* ~+ i; \, y: _* Z. Y    int     2fh
/ j/ L6 ^2 m2 w    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. {4 I% Q1 m2 J# k3 l5 w    add     ax, di6 f6 p/ e$ ?/ v9 Q) `
    test    ax,ax
+ E' m* V1 X, o9 o! o' T$ e    jnz     SoftICE_Detected6 M; I3 D5 H8 C2 t/ }* A' A( r
& m8 i3 B7 @0 N% Q; `( m
__________________________________________________________________________
& j5 v( S1 Z, q5 ~0 N; S  R, G% v# w/ M3 G

) U+ j1 `8 |6 s: P# s. WMethod 05: |9 y+ E* W, |7 X% w5 O
=========
: w. p" Z# l4 ^$ y! b$ S  P7 w2 D) U9 h% ?  D4 B- L0 h
Method seeking the 'magic number' 0F386h returned (in ax) by all system
9 Z/ ]' O$ A& Wdebugger. It calls the int 41h, function 4Fh.5 q3 p9 v# @9 G! H# @! A; }9 f2 {
There are several alternatives.  1 {" W; V- `* J( `2 _8 k
; J9 D* f4 Y! q9 _3 F: @1 ]
The following one is the simplest:
6 m. X- D0 l8 T& s
! V' ~" T: v7 ]    mov     ax,4fh
$ _: F5 r9 k+ @( o" f    int     41h- I, ~/ k) S; j/ d0 K
    cmp     ax, 0F386
) k* x" i( ~; m* X1 i) N    jz      SoftICE_detected2 J# T  }  N9 a7 x/ y7 N
9 ]9 H  E, E/ t" @

- `, |$ t/ d' |, eNext method as well as the following one are 2 examples from Stone's
1 H0 s6 b6 w/ `& h"stn-wid.zip" (www.cracking.net):: d: x5 U* }! ]! B6 v
) I0 U" F) Q9 ], W2 r1 m4 a8 j2 Z
    mov     bx, cs
9 Z4 ^: ]7 R6 `+ K  J0 A1 F    lea     dx, int41handler2, p9 B, ^/ @' n" V5 l' T! E
    xchg    dx, es:[41h*4]
6 v7 J! t+ s- P' n, {% n    xchg    bx, es:[41h*4+2]+ C2 ~- Z0 q% C# ^' o& K. B
    mov     ax,4fh
& k: R0 G$ \1 p  x: x    int     41h
- |( j6 t# R" c- i( w    xchg    dx, es:[41h*4]' P. y& d( O. B" U, r- j( S$ E
    xchg    bx, es:[41h*4+2]( s2 c" G& H  O) u4 C! c: w0 x) Q7 B& R! G
    cmp     ax, 0f386h
. H4 e: s) ^$ [$ b) c# Q: s    jz      SoftICE_detected+ y! {( p1 w7 b6 C2 \

! {3 u$ ^/ w1 z7 P1 a& f6 Pint41handler2 PROC
9 q7 P! w  s5 y' @( n. z+ U+ A    iret7 V  g' P' q# W! P
int41handler2 ENDP
$ f. e  d4 j9 V2 U3 M) v  i
9 p, e4 X# i5 q' C& y* N3 Q
) z9 J  [9 {, W, Y2 ?_________________________________________________________________________
( d& K* e) [& I' V; q6 H) h! `5 v" T2 g# c
+ p2 R# e1 d+ o
Method 06
3 O4 F! q5 U1 P7 M=========
% M& [! D4 V7 m5 N% A0 o  V+ I0 }8 Q9 W* i2 Y: R& P( d6 u* ~

% }0 ^8 t, k( ^; [2nd method similar to the preceding one but more difficult to detect:
( y8 u' Q$ w6 t5 m& d
* o9 S; r6 O& a4 _; |3 ^6 e8 ^% y3 U+ i0 J
int41handler PROC
" T2 c$ b. |3 V' q  U- `, D    mov     cl,al
4 T) m. _; [7 j; X: E  m/ |    iret4 Q0 {* _* `2 k5 U# j  I
int41handler ENDP, P6 g2 R, ?- x9 g+ _
/ `% @2 u* k/ q9 P/ n
5 e7 _4 K( o) P; O/ P
    xor     ax,ax
# x8 @' r7 ?5 V9 W4 ]) x) w" }    mov     es,ax
- ]4 f4 \# U& o  H) u    mov     bx, cs
8 M0 X9 O9 z; ]0 f0 h+ s    lea     dx, int41handler
* \2 M8 ^# Q, {% w" u    xchg    dx, es:[41h*4]  `( _0 j0 {/ ~" J
    xchg    bx, es:[41h*4+2]
' |& e9 D) u' T% w3 Q# x, \4 B# O    in      al, 40h! g4 U# I  Z/ V3 u
    xor     cx,cx
5 e- E( E% ?) o0 N" A    int     41h
7 i* F# r3 k' L    xchg    dx, es:[41h*4]
6 B7 h) Y$ B. e+ ]0 K    xchg    bx, es:[41h*4+2]
2 X  M  ^  f  y    cmp     cl,al/ z: U1 w* ]: O0 @  k, N
    jnz     SoftICE_detected
5 D1 R- u6 e6 v( F4 R. a8 I, g, G4 V2 t7 Y
_________________________________________________________________________: l+ ~! m( G0 J1 N7 ~
) Q8 R- W8 P/ J$ e
Method 07
, R2 k3 l3 Y& k=========: }# F3 y3 |# Y

- S) s+ \1 `& T; L2 f9 yMethod of detection of the WinICE handler in the int68h (V86)! w/ Q; m8 Y6 M" B, U7 x4 P

/ o; P( k7 t& w% c    mov     ah,43h
5 g0 I- J0 s6 O9 c    int     68h
5 X/ ^+ h9 \* f1 u( U9 p( J7 Q    cmp     ax,0F386h9 T* N1 I# o- h1 R0 G& C
    jz      SoftICE_Detected
( F4 s9 k2 Q, b- _* u7 ?6 [8 t
  `5 u# E. v# M* H$ \: A; u' u0 i$ b( F# n3 M
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 J0 O% t) m* F( S& P# M
   app like this:6 I% `  d  A5 h6 i

6 C1 M1 W% Z. Y9 J   BPX exec_int if ax==68* I: U8 N7 {# p/ W2 M
   (function called is located at byte ptr [ebp+1Dh] and client eip is! n3 z& W: ?9 X% E" o# }
   located at [ebp+48h] for 32Bit apps)
7 ^! w5 E$ `4 L; ^$ X8 A__________________________________________________________________________5 g5 [# y9 i# M) ~/ ~4 h

5 }/ o  N$ y$ x0 Z1 G% L; H2 {6 t, d( f2 j, P! e
Method 08% ?9 @) E  g; n6 J) r- v1 ?9 v9 {) Y
=========
: ~7 Q% b; J& z% a2 \  a( L. f4 I: Q2 V" ^% w6 z+ q
It is not a method of detection of SoftICE but a possibility to crash the& e) @: K" N/ l; a
system by intercepting int 01h and int 03h and redirecting them to another' H1 N( s2 B& v* ]4 ~' E7 D, p$ ~0 U4 ]
routine.
  o- F) C8 M8 `  jIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points/ Y! ^0 p9 X5 R9 k' y$ X
to the new routine to execute (hangs computer...)
+ g5 X& m6 O! X" ]' @& B9 F% P  m* A" M/ F/ k, M( r; |% z9 \
    mov     ah, 25h
( U( v0 s2 Z( ]2 e    mov     al, Int_Number (01h or 03h)4 X7 q, k; _& Z* c" K
    mov     dx, offset New_Int_Routine
6 Q+ D2 l3 D% v# g8 ]0 {    int     21h
) _1 _; G3 `; s3 T9 X4 `
9 \  A7 Q2 [2 B$ b' k6 p' }__________________________________________________________________________/ Q* t0 }  u5 Q4 T" y
& p" Q  B) @+ B
Method 09' _8 U) Q2 K$ k( h+ A' u
=========- e  U, @7 n- w
" r" u9 O  q' N) P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ ]6 v/ \0 D7 P0 v5 s2 R3 l
performed in ring0 (VxD or a ring3 app using the VxdCall).  L# ]0 D  K. Y- u9 e
The Get_DDB service is used to determine whether or not a VxD is installed* b# n; @# B, o. J# W4 }
for the specified device and returns a Device Description Block (in ecx) for
8 ~6 ^8 Y% a( z: X# V. j* {that device if it is installed.
" X  h( d" B% K+ K1 |3 [
) i9 {7 u* f# F, }/ Q0 d   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 k* G7 B4 b8 D8 j# i' s5 P   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 _* ^' N9 I8 r% I" G
   VMMCall Get_DDB2 o7 R- j2 \$ X8 I0 C* y
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
8 k- T9 |: R/ ^* N/ r0 s! M! P" s5 S5 _; d9 g# N. n
Note as well that you can easily detect this method with SoftICE:
4 b1 j; U# L1 K4 a0 `9 ]  E   bpx Get_DDB if ax==0202 || ax==7a5fh
, k6 c. g6 y) K* T+ [; K
1 v" e- M& l  f. a8 h( S8 P% w2 o__________________________________________________________________________
( `* h/ g+ G9 o8 }6 I3 t0 G; s9 d$ m
+ P9 Z" A5 ^& X: j7 F) H) ~  PMethod 10
; D2 J" J" G7 X=========2 ^+ _. H; P( a) I+ H

: k" F/ W1 u1 \+ j6 k=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 J5 w$ _3 y+ ^
  SoftICE while the option is enable!!, Z( x: ^9 G. F
" M0 n5 D% A4 @& |5 u+ R8 Y
This trick is very efficient:" v- T3 i* l- l5 D# I
by checking the Debug Registers, you can detect if SoftICE is loaded
( B. d! L4 n* [' a( o9 j0 u(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if- b" Y5 i( M5 h! x  \' r1 V
there are some memory breakpoints set (dr0 to dr3) simply by reading their8 @' L+ u5 ^! i0 v) A
value (in ring0 only). Values can be manipulated and or changed as well
* z+ _% a' p6 ~' X' e& k(clearing BPMs for instance)
: d9 e; K6 t7 z: H! m3 U
1 D" u+ I4 O0 H2 M+ q& H__________________________________________________________________________
; D$ y6 n: H; W& \; i) W7 |, Y  p7 p4 B2 |! M
Method 114 [2 K8 L! u) m' U
=========
( {* p8 B3 f4 w2 c/ R$ ^5 z! b# ~
$ j9 D5 d3 }0 B* c2 S' Z" w5 hThis method is most known as 'MeltICE' because it has been freely distributed6 z' P5 X: P/ i4 r! _* C$ I" A
via www.winfiles.com. However it was first used by NuMega people to allow
- ~+ _) O  t% R8 u' F$ {9 S2 mSymbol Loader to check if SoftICE was active or not (the code is located7 c4 }2 M' \# K% W. ]
inside nmtrans.dll).* O" W" b4 ]! W

' b8 l- ^3 J; F% t, VThe way it works is very simple:# e* ~6 Z1 S7 f7 p6 @
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; Q* b% l/ L7 ]! W5 @0 X
WinNT) with the CreateFileA API.) k: K  T. j- O- F% _2 Z4 C6 d

& M& v6 C  `# b9 tHere is a sample (checking for 'SICE'):$ R+ s) {% h7 G6 O; w

9 R; _, E! v' c4 fBOOL IsSoftIce95Loaded()
4 ~6 v% h$ `9 T6 F" O{
  _$ Q! a+ l" K) f4 m   HANDLE hFile;  ; k" q# |6 ^% |
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! n/ o9 g4 e4 {) j9 [# k7 B                      FILE_SHARE_READ | FILE_SHARE_WRITE," M# U1 Z$ p: L# C8 d
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 H7 e# u; N' [3 n+ v8 N
   if( hFile != INVALID_HANDLE_VALUE )' n" `7 \0 ^2 j# ~% C# q
   {1 g) d) V/ i$ q, ?! N
      CloseHandle(hFile);9 y' h( O9 t( ^7 U/ [/ P
      return TRUE;
" P- B3 B& x( M! G6 s1 f7 h) w( e( m   }$ S' j, ^, Q9 |0 t
   return FALSE;
1 a5 H8 w! G  n: |+ Y6 _% ?: N}# C2 O- q' N) p% _" n% J

; q# F% _+ d4 C- ~6 |2 aAlthough this trick calls the CreateFileA function, don't even expect to be
+ R5 J* w6 B5 _5 I( X0 T3 A5 Jable to intercept it by installing a IFS hook: it will not work, no way!; T/ f0 b* F* J. U6 i: ~- X' _/ q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
: |: {" m3 H' H' k$ xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)! ^  {' V! ]' u4 q' U* B
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 b$ Q! ~" c: Qfield.
( Q# g/ u' j- O% ]! TIn fact, its purpose is not to load/unload VxDs but only to send a
( N+ M+ s6 t) c- f7 VW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ }, W  @: Z8 w1 D) h
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
9 h+ x* k+ D) t7 {# d+ g6 D7 e/ Vto load/unload a non-dynamically loadable driver such as SoftICE ;-).2 ?& f5 \- c+ k0 w* W5 A# y; O
If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 y. M! a% a. k3 \& l) Gits handle to be opened and then, will be detected.0 W% A# ^1 A" t$ j* K7 l
You can check that simply by hooking Winice.exe control proc entry point% e; s0 l. l/ l. b! u% }3 J
while running MeltICE.8 Q  W- U& R$ F+ m2 L+ d; w! E

/ R" X8 @. k, x/ l4 w% u  [% z7 E9 K& x3 k% M) [- s
  00401067:  push      00402025    ; \\.\SICE0 h/ p; B; F7 ?) Z5 n
  0040106C:  call      CreateFileA
3 K* d  M3 Q6 t' Z  00401071:  cmp       eax,-001
# O8 J6 v% o& Y% a! I! c5 T  00401074:  je        004010911 T* x/ T2 B7 s# S2 X3 i3 p

' D0 v: m1 \7 L4 X  }; K& B: c% l
There could be hundreds of BPX you could use to detect this trick.2 K; A) k& C; I
-The most classical one is:& t6 O# G3 W7 s  q. Q
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- [) q0 l% {+ J3 n7 T    *(esp-&gt;4+4)=='NTIC'
4 Z6 {* P7 z6 r4 m3 I; h. D4 [  p) D
( ?# Q# N; l9 z8 r5 E& m-The most exotic ones (could be very slooooow :-(
; Z6 R5 A2 g  n5 E+ J1 L2 z# U   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! `! e* ]; m9 p% C
     ;will break 3 times :-(
( \2 w- w. ?4 H( ?7 |) W
  }' e- V" R6 v) v/ b( J' _) B-or (a bit) faster:
7 ^) A5 q' n& t2 P  Q' i   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). b2 d, A8 o, |1 N
6 j1 z  G% |. N$ S
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ' Z4 O/ |4 J- B9 ]" z
     ;will break 3 times :-(9 e( ^  O* g; o% w% d

8 d8 y! d+ u7 b( q8 |-Much faster:
7 c( s' W+ K8 f! Y4 H   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 t9 D/ ?! _; V' R& M( z% h6 V0 g5 v: p) H; r
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 E4 k7 _4 |$ q# O0 h1 \function to do the same job:
# B, k) E+ F9 j2 D" G8 f9 R3 ?
   push    00                        ; OF_READ/ B* p! S/ Y* |. o- R# m  M5 }& g: Y6 y
   mov     eax,[00656634]            ; '\\.\SICE',0+ H) x( Y, y, C% g; {7 B
   push    eax! `( I8 l: t% e7 M6 y
   call    KERNEL32!_lopen
) }# [7 I1 \1 O4 h) y7 ?   inc     eax' i/ j9 `7 k) n* D+ C# |
   jnz     00650589                  ; detected
5 n' M: _$ c6 e2 }2 Y! e9 D- [   push    00                        ; OF_READ
& a. j  B7 n; j   mov     eax,[00656638]            ; '\\.\SICE': o: t6 ^4 v, ~/ \5 W
   push    eax
' e1 T' R* F( D. @- L   call    KERNEL32!_lopen4 K& L, T( |, @! c4 g) Z7 `. o
   inc     eax
- D* M: V8 m: p8 z   jz      006505ae                  ; not detected
3 H: f- E' f: o, O
7 L7 A+ r. F6 r& O- {) j& f) r. u$ Q1 {/ x& ?/ [  f
__________________________________________________________________________
( q+ k/ S6 D1 w  S' o
2 \0 Q5 F- {. JMethod 12
0 i0 H+ U! s6 {. V=========% g" L% ]% g$ l* e/ Y4 N$ s+ ], u

  ?' K4 b: a) c& jThis trick is similar to int41h/4fh Debugger installation check (code 05
$ L( \/ x7 q; y" r+ v&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 C. G( u$ x: L+ k7 s7 u$ i
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.0 v% u% B' m0 `) M0 H' F% h, g

# u4 ]: O1 T  [% c& T5 y3 |! h4 K   push  0000004fh         ; function 4fh8 N) \/ Y1 \0 A
   push  002a002ah         ; high word specifies which VxD (VWIN32)
, n0 V" W5 ^! Z, f: l% `                           ; low word specifies which service; C6 M+ j: W& q. c' n7 N
                             (VWIN32_Int41Dispatch)! n7 U& U# K2 X( c3 }# g0 E. \- Z
   call  Kernel32!ORD_001  ; VxdCall& f) b3 ^+ r* m; @/ w
   cmp   ax, 0f386h        ; magic number returned by system debuggers
' D+ _+ R( t" w( D* [( y   jz    SoftICE_detected
  C  D/ x0 Z& c1 R& X8 m" Z
# q4 E8 _2 K: J2 }" \# V; T1 bHere again, several ways to detect it:1 a: f1 o. x4 C& R7 G# \

1 _. t6 L  r8 r! R' B/ ]    BPINT 41 if ax==4f3 {/ H& o5 ~5 y* u" Q2 D# P

+ c, z' {' s4 l2 U' C2 |* ?    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  `1 X% k, ?: v# {3 U$ H# l
/ H: E- V! M% Q, L) f$ G    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" M) B8 f* X( Y
$ Q( V" S! l) w9 f* S& D; U
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
& u0 j" z9 y0 g  |- z) C: A" t7 V
' m: [1 y8 k' Y7 x6 P__________________________________________________________________________
8 W" ]* P3 k' l' a" p3 |# b" l$ b# i- T) R' p% l$ Q" }) c8 L
Method 13, e2 Q' B% F8 R: T: s, M( M3 r
=========
# g$ W! q9 S' N# p" I" O: N+ n$ i, ~, p
Not a real method of detection, but a good way to know if SoftICE is
$ @8 n& K" w, r! A8 i! P9 yinstalled on a computer and to locate its installation directory.. D1 S* e. ?& |$ t& u3 H6 t4 P+ G
It is used by few softs which access the following registry keys (usually #2) :
) `% L6 p/ q1 _1 ?* ?, V
5 f' n! V8 m. z( B-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' N1 m9 H5 ~- `0 L2 d" |. d- Z% n\Uninstall\SoftICE/ X! d: T% y9 Q" k
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 ~  H6 A7 A1 K: t) q* q" i9 T-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! h5 S$ F$ F3 p6 U8 e+ p1 b\App Paths\Loader32.Exe+ A7 ]7 @  Q6 u% p

4 @4 y' i7 k; _0 c8 [+ i
; H( s/ K# ~1 BNote that some nasty apps could then erase all files from SoftICE directory' A1 i( J  i9 H. A
(I faced that once :-(
6 A- y+ F: B& b% R8 ?
2 K" G# {/ ^2 {: m2 Y6 |Useful breakpoint to detect it:
8 L; {# c, x, }4 [; t. o( s1 S) ^. E9 n
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE', e( Q0 L% I* L! r. u7 y, M
" q6 I& g0 X" H6 Q
__________________________________________________________________________( }0 l$ Q; [2 R8 `, Y! U+ R2 [
+ B3 f1 S7 R9 c' T: l! O$ n
: f9 ~' [8 G! m1 s0 E6 B! y% ?
Method 14 6 }( h4 j4 I% ]5 h# w9 z
=========- k# K/ T8 G9 r$ _& H

4 Z1 R# u" r$ W, JA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ F+ n! v" ^7 ]+ @1 Z' _
is to determines whether a debugger is running on your system (ring0 only).) C5 l5 L( o2 z4 P% A1 @
$ t2 d8 @( D  A7 u1 q$ Y4 [! y% ^
   VMMCall Test_Debug_Installed) J( k8 U- w! [0 b
   je      not_installed
) @4 N$ _; g0 I# l5 H$ Y
; J# b' z1 ^& t7 K! u/ oThis service just checks a flag.
0 H+ v% ^/ r+ n+ |$ b! _" Z</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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