About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>/ C; x: H3 Z2 }7 l
<TBODY># V4 L' E; [  d1 V
<TR>1 p# z6 u# p$ D! p+ }
<TD><PRE>Method 01 . A3 c1 W0 ^+ j6 t. r' d' ]
=========
; |) M% x5 w, k
5 u( e  h7 _/ S3 B* IThis method of detection of SoftICE (as well as the following one) is' \3 G% Z, I1 L8 z
used by the majority of packers/encryptors found on Internet.
: N8 k- @9 n! HIt seeks the signature of BoundsChecker in SoftICE
) O7 P" U+ @  ^& T/ v8 U1 v( ~( D6 @2 k6 J  L& ^% ^
    mov     ebp, 04243484Bh        ; 'BCHK'$ |* ~! ]* w0 D
    mov     ax, 04h
' s8 y( |+ s0 O0 B) p* s    int     3      
, u' S: E0 U' y    cmp     al,4: a* M! `' Z7 T# W. y/ h. V
    jnz     SoftICE_Detected+ f9 [/ U# P; C8 G4 ^0 S  i2 y- j/ ]! H

9 r2 u+ f; H0 j8 n3 [: D3 W1 i, A___________________________________________________________________________8 [' p. h+ s' c4 C9 f/ p

2 e  Y) G; _$ y+ u2 a, i  }1 C' aMethod 024 n* p7 F, N. e4 T3 N! u
=========3 M! X  f8 _  V
* d3 E; D' D* N8 e
Still a method very much used (perhaps the most frequent one).  It is used) v+ |- H& }( A/ ~
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,. u- k4 T; @! _9 K( r0 _8 J  M  J" a
or execute SoftICE commands...  E7 {( I, a4 t$ x% [6 q
It is also used to crash SoftICE and to force it to execute any commands0 s" B* Q5 J% b/ k% [
(HBOOT...) :-((  
% U6 g8 q4 B& h0 {4 g
+ v- P3 P7 X1 _Here is a quick description:1 i; [8 _3 n' I1 @9 E" P# F1 i# v, e
-AX = 0910h   (Display string in SIce windows)' |4 L1 }# F3 w  F0 k6 P6 f
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
8 R6 S& y8 L( R4 x' J-AX = 0912h   (Get breakpoint infos)! G- b8 \1 n1 g
-AX = 0913h   (Set Sice breakpoints)
7 [6 `% m5 T1 |: i  b-AX = 0914h   (Remove SIce breakoints)
& [' t& E( ^' ^0 W' }. N1 W) |! D, K$ U6 F4 a! a( b+ ^
Each time you'll meet this trick, you'll see:
. l& Q4 J& w# K& ^4 j1 ~' B-SI = 4647h
3 G- s' y9 T. G1 H) w5 ]-DI = 4A4Dh
+ g  q; x! s6 Q. T/ B, S7 K, |4 aWhich are the 'magic values' used by SoftIce.8 X, T; ^! e2 u4 V
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, A" M+ W8 E) Z6 x) I5 H- U) f/ `# m4 Y1 p
Here is one example from the file "Haspinst.exe" which is the dongle HASP
; z. {% Y# }/ NEnvelope utility use to protect DOS applications:
. k8 o% A% t# h3 G. e& ^, w3 k5 P7 \  l( f. y5 A( _- v" {0 m4 L
: |  D3 g& x5 o  S. U
4C19:0095   MOV    AX,0911  ; execute command.6 ?7 ^0 `& N+ V. c& o
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 p: B# V; h: v4C19:009A   MOV    SI,4647  ; 1st magic value.+ @8 p) R# q$ |% |% h1 ?( F
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; h! a4 M9 S' l* h) x  {4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 ]! d9 r" |2 y7 {* `4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: B! C1 w) A, b+ }9 @) K4C19:00A4   INC    CX) V  ~* M* T4 w; s% l8 J" z" L
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
, @+ ~! J( W' L( |4C19:00A8   JB     0095     ; 6 different commands.
1 g8 x# t; m( Q& F* d" i; R6 h" _4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  ]6 K) g. }/ I" D/ S8 ]
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 F& m' S# G/ Q1 l( H

( Q0 K9 Z, m8 s, n8 d: I; K! N  U- m1 MThe program will execute 6 different SIce commands located at ds:dx, which  o  i7 N* A+ G! D. p2 q, r. b
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: _+ ~4 f& S$ Y! ]3 v
* C$ E! y* Q" `$ H
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ j* v# A3 J8 e  g; O: o* y
___________________________________________________________________________4 y9 ]/ D( L7 w2 _  c
* g, i8 `# R& ]: N) p# V1 l
$ J, M3 }- Z( [) T
Method 03, Y( f; ]4 t* S7 r2 v# y! a  }0 x
=========1 K( l) J4 c" j& J, k
* a, D0 x/ Y7 @' j! ?! |" R
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* Y  o( a6 R: j(API Get entry point)
7 I3 W' L& P  h$ W9 {        , _7 w/ n  f  r8 o6 I& v" w9 [7 g
( s9 q6 O. t+ L2 o, m- W( [9 m
    xor     di,di' e2 f+ l5 \* C. |& l' Q
    mov     es,di
) w. y; y0 B; e    mov     ax, 1684h       ( D/ n; h  d  \# N9 }3 ?
    mov     bx, 0202h       ; VxD ID of winice
- p6 G, X3 ]- G6 L    int     2Fh/ y+ x( E1 _# _4 w. ]/ l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 d% g- B& I* P    add     ax, di0 C' \7 s: v% Q9 o
    test    ax,ax4 c" H! k+ G( ~
    jnz     SoftICE_Detected8 w* z% Q! L7 \; T$ ^

& b+ w" v1 e7 q" j___________________________________________________________________________3 c! L/ e. T7 X( E7 J; m5 f

1 w. T- l8 X' B. b! j4 `Method 041 J3 z8 d. m0 [$ @7 u; e
=========3 z2 M  H& U' G9 W; a* \( H' l! p, t

( B6 a$ |: d* x/ S* }3 ?+ q6 l; VMethod identical to the preceding one except that it seeks the ID of SoftICE' x7 ]- k- p& W  c0 Y" V
GFX VxD.+ h2 ]1 g& T% N! ^" |& q* H9 s& q
0 V4 I. |* u. Y) T! I, y
    xor     di,di
) X+ [3 x' }1 [) n9 n    mov     es,di
  n1 S- S2 C# Y- J    mov     ax, 1684h       ; Q  P9 }' a. I; \, K
    mov     bx, 7a5Fh       ; VxD ID of SIWVID) P' d6 j3 ]% v  D7 _4 u/ v
    int     2fh
8 t- |3 Y: m. n9 Y  h; S2 h9 @/ H5 A    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 [! H& P& I- `4 k
    add     ax, di$ D2 k" _. `; t6 l  R. T; B
    test    ax,ax4 v/ x1 l& X( h) i. P5 }5 M! c  S
    jnz     SoftICE_Detected
# M- n( p6 W3 H* ~
! n  W3 H* z7 m# w__________________________________________________________________________
: m' d& j. x) x
4 N4 q9 n. Y/ C! x1 z9 E1 y( s0 {, a8 R  b8 c
Method 05
" Y, p0 r" W3 R9 g1 K9 G; K% A=========
3 s% O1 |7 f9 w9 q: {( }/ E) c& T
; `1 ?8 }5 E' F$ ]Method seeking the 'magic number' 0F386h returned (in ax) by all system
" u) _5 [' v0 p% M3 g3 W6 ydebugger. It calls the int 41h, function 4Fh.# }: |% ]5 W$ T" Z! _  O
There are several alternatives.  - L2 l- h) C$ a

) G$ E8 R, q$ nThe following one is the simplest:
; j2 J: c/ `6 o: r
5 w  Y: _5 F# m    mov     ax,4fh
$ v5 p( X3 ^+ R# b& \    int     41h
, J5 i) h' O7 C0 i: ^/ v; f    cmp     ax, 0F386$ Y5 z2 @6 T# V7 }+ x
    jz      SoftICE_detected2 j+ i  Q: d/ r8 O* @2 H% d! H/ r
+ |, t; T( s4 `6 g- ^1 y# u

- Q5 S9 ~: r0 ?# b4 zNext method as well as the following one are 2 examples from Stone's 9 {, y: _7 H& D  l: e/ d
"stn-wid.zip" (www.cracking.net):
, E1 W/ y3 [  s+ O- e- q" _  b" u8 J/ c, J8 `; Y
    mov     bx, cs
5 b" R' Z: P1 B; V# ]7 ]    lea     dx, int41handler20 z1 L# L) Z; I; ^
    xchg    dx, es:[41h*4]
1 J+ B! J( R) r$ J% d. c1 V    xchg    bx, es:[41h*4+2]
/ r4 }9 o% y: T$ E; X4 `    mov     ax,4fh
  C0 R# W) |% f' Y' B    int     41h
5 Q1 t& Y# `% B% x8 E/ f& R    xchg    dx, es:[41h*4]
) j2 R' p6 `& I9 P- o    xchg    bx, es:[41h*4+2]
! j. `6 o1 `7 a# x    cmp     ax, 0f386h0 `/ t4 p( k, f% w9 e; ?+ Q
    jz      SoftICE_detected2 ?. D5 P+ \; l
5 Z, B7 n* o7 n9 z- O0 R8 ~% d3 k
int41handler2 PROC+ N+ k. S+ T$ e
    iret4 \& l; l9 a& U8 h5 y
int41handler2 ENDP
: b  P& ]+ R! `3 Q- x7 B, v7 U% e2 u7 g6 W8 L/ m( e  Y, T
0 J! V) }' O) C8 A* Y
_________________________________________________________________________6 c2 j, O8 p4 c9 [8 `, U

4 D1 c0 \. P- B4 D/ i& T3 q/ R# p# j( f& s# y$ g
Method 06
0 l. o+ H; {- S+ K) q/ r2 d5 P=========
6 ~! ~6 Q) V+ E/ N( c  r0 Y' o5 d- l- h9 H. n7 V8 e
3 X9 [( V# _/ R! f9 \; R/ L0 l
2nd method similar to the preceding one but more difficult to detect:# S0 |, D, W9 R2 w5 c! g
' b* R4 S2 S& B- ]4 N
; y3 _/ P+ c% I
int41handler PROC
( ^8 s  |! Z( m) e  h3 W    mov     cl,al
$ W# B8 H( I# @; ?% M" J7 ?5 J+ f    iret6 B, r/ \$ r: L! u; R% k
int41handler ENDP
" _& {4 i( N- D; [: C; B3 a8 S6 V& v* S9 X0 w8 h0 ^. Q+ q0 S# `
1 P4 v4 F1 d  A
    xor     ax,ax
6 U% p6 s5 F$ o8 A. |" ?( N9 x    mov     es,ax* Z* B5 m9 C" |8 g
    mov     bx, cs# s( y8 f: U' H) h8 w# I3 `' o2 x
    lea     dx, int41handler
: B( h8 Y2 F8 r5 M) h) m# O2 u    xchg    dx, es:[41h*4]
! \! S/ z. t7 c* J    xchg    bx, es:[41h*4+2]
. G& O1 G( F, }/ P: W    in      al, 40h
* x4 |3 p' s2 F$ ?% {+ M3 o    xor     cx,cx
+ f8 g, R$ b- ?+ i5 p1 G    int     41h
4 r4 s; v2 e/ z* G+ B    xchg    dx, es:[41h*4]
. O5 l: g) J1 G) I; G3 a6 r    xchg    bx, es:[41h*4+2]
. Q& I; O% h' }, [% D7 ~    cmp     cl,al) t: ?+ p$ F2 A: K* |1 p
    jnz     SoftICE_detected. l( \  `1 B1 l. B9 g9 L- N& n0 b
5 ^# n; v: I  X; K1 Q. K
_________________________________________________________________________5 ^  p7 s6 G4 _; O
% o! ?, h: b- h
Method 07
+ X  L" J- _6 S4 D2 s+ f7 \=========/ q+ ?/ ^+ V, o# U& h& E+ r
+ t4 R, a: @/ s7 f
Method of detection of the WinICE handler in the int68h (V86)- H& \- ?( W, Y+ y6 C6 ~% u7 |

7 ?2 [+ }; q7 \) q    mov     ah,43h
. k6 e4 s0 v  e, s+ a- v    int     68h
0 f+ Z% I" O# m, Y    cmp     ax,0F386h# S6 l6 _" x  U  q
    jz      SoftICE_Detected, M" c# a/ ?6 g
3 D  v1 E' |5 ~. M* E$ v7 h# b

2 _* \/ K0 V/ [6 \9 R, g+ Q# l=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 j2 I# ?1 O8 h; L+ @, S   app like this:
4 H. F5 `* c; c; B7 M8 d5 b4 @/ U
   BPX exec_int if ax==68
. s: w4 V, D& R   (function called is located at byte ptr [ebp+1Dh] and client eip is
; ~0 d; Q8 ^7 t! b  Q   located at [ebp+48h] for 32Bit apps)6 c. v& O7 e$ }9 Y, T' l# D$ e& ?
__________________________________________________________________________
1 J7 t- I# B# [- h/ x, @6 G2 G3 c7 T" G6 D, z. i3 X8 p3 ~* u# _

  J, f* i$ v) i! a5 a8 W/ i* zMethod 08
3 {3 K; ]7 m" E+ I7 K* t=========
5 p$ M* w5 u  r' r$ i# S+ A. T
& [- u* _; [# T3 }: oIt is not a method of detection of SoftICE but a possibility to crash the
; m2 h# D& o9 n, N$ _* L" ?' S( z$ rsystem by intercepting int 01h and int 03h and redirecting them to another
4 O0 F; [; S; C3 Hroutine.
# v; B0 m$ F, R# Y( k) jIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points8 r8 u! Y/ q0 c+ Z  S
to the new routine to execute (hangs computer...)
2 y1 W! o1 F/ ^* x) a# R. d1 m% U; T" N" N2 h# j
    mov     ah, 25h3 Z$ }2 j& b2 Z# a$ d  [* g
    mov     al, Int_Number (01h or 03h)2 ~) [% ]: i, w& \, i% y0 X0 l
    mov     dx, offset New_Int_Routine: |; U% G/ L0 Q' R+ s2 u
    int     21h+ [0 n2 x4 x: g' P) c* d# Q* k" u
" A8 l' C7 G7 \* a& y: I, w! r1 P
__________________________________________________________________________
6 b$ ]1 a* w' Q7 {% q1 @9 I6 I$ S' R6 s* F$ B9 Y5 `
Method 09
9 C' l- p  C# q' l0 O  \=========/ X$ v3 s6 x; M! S3 g

$ F1 J9 |7 j3 K2 r7 g$ kThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! z0 T2 I3 m9 Z, \& J5 I0 z
performed in ring0 (VxD or a ring3 app using the VxdCall).
) U, y/ I# m  k# T( _The Get_DDB service is used to determine whether or not a VxD is installed
# `6 ^' Q! n/ q5 L( L/ d# Hfor the specified device and returns a Device Description Block (in ecx) for6 {$ Y6 Z+ c6 Z% z% s
that device if it is installed.% `' K0 B; D' }7 z5 P8 O

% |, e; |6 ?. t+ V   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
9 J" [- k6 Y' z6 s2 Q   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! @' d) \! r' q+ i  y+ R* B1 g   VMMCall Get_DDB9 p- M8 A; k$ g3 k
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
# c0 ]$ y, H# R* x1 _5 ?" L$ a- Q- _) F7 A2 o' e
Note as well that you can easily detect this method with SoftICE:; L/ ^9 O5 }/ C( p* y
   bpx Get_DDB if ax==0202 || ax==7a5fh) {0 P) {/ q1 n) L
# k# M9 L1 M1 U, r
__________________________________________________________________________
9 t( h; e- {# l* G0 Z+ g  ]  `5 [% U
Method 10
/ x, G+ \3 h. F1 L' _=========3 E" Z" C! ~9 t
# x4 n: Q6 Q9 G% F8 A& ^' T% d- O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, {0 }6 c* L: P) X
  SoftICE while the option is enable!!
! ]+ x# Y) l* p  V1 [' n. j" p' P- L! R5 ^, H$ Q* z: k
This trick is very efficient:
1 ~4 ]4 M0 S, a! D# Aby checking the Debug Registers, you can detect if SoftICE is loaded9 D( B+ `6 h/ G' r; b  M
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
; d9 W/ Z: ^! o9 v& ~6 Z- Nthere are some memory breakpoints set (dr0 to dr3) simply by reading their
: \( g+ M2 ~! ]value (in ring0 only). Values can be manipulated and or changed as well' N/ H8 J' q; m$ a+ G
(clearing BPMs for instance)# B& `% I& m: M3 h6 p

/ r& i: F$ ?0 q7 I__________________________________________________________________________3 }8 v* {6 L3 ]% v+ H( f
% r& ]5 a9 l% Y3 U, e
Method 11( r* N" }( W. [7 }
=========8 S$ Z$ @, r/ I8 N4 j% b- I( n" P

2 q( z/ k2 i- s3 d, U* S& VThis method is most known as 'MeltICE' because it has been freely distributed; @! L9 t) W% D; y- a' S% t  R; t
via www.winfiles.com. However it was first used by NuMega people to allow5 v2 S& R! C3 F( k& h
Symbol Loader to check if SoftICE was active or not (the code is located. v8 y3 E2 u+ P4 F& x8 f
inside nmtrans.dll).* E2 n2 B& ^( y& Y- d) b* v3 H3 q$ x

- w- x4 x+ D  T! r- fThe way it works is very simple:" x9 j# q, O- z9 _, P9 p# y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- N, \* k. j; r4 qWinNT) with the CreateFileA API.! U3 @. k- h) Q1 [4 [7 d

0 F$ n. ?" e- W8 H: B2 g) w- C' _Here is a sample (checking for 'SICE'):; n. W* F; X  d$ F+ f- _- w% @6 q

" P& R( m% J" x3 E# G6 ZBOOL IsSoftIce95Loaded()7 H6 R  ^7 O% f% {
{
6 H+ X, \: h2 N: N: M- S   HANDLE hFile;  / B; Z* c/ c- x) `
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,! C8 v( q% g" x+ w5 ?) J$ x  e
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 r' [3 v9 K' C" t                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
# S/ |# ^1 e1 l, p, ?   if( hFile != INVALID_HANDLE_VALUE )
, Z8 D0 S2 R% \( r5 `7 K' q' S   {. B6 v9 q: T# W5 V1 I7 ?
      CloseHandle(hFile);; h) F" v0 p/ X+ c# S+ V
      return TRUE;
4 b$ g; O3 l# T0 j   }0 V9 `* x1 z& Z$ m% T3 N5 n7 b
   return FALSE;7 y# t. F5 ^+ _% ~, ]
}4 N; e9 Q/ b% I9 x9 z. A" ]. W

" g% {3 \. H! J/ c) K7 ^Although this trick calls the CreateFileA function, don't even expect to be
! c) V+ P' P" f5 iable to intercept it by installing a IFS hook: it will not work, no way!! D/ f' q6 [& \$ s. s( D
In fact, after the call to CreateFileA it will get through VWIN32 0x001F# [) _+ u! ]# w/ B
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)% ?8 H2 i6 z' M; w7 y5 y# R
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
* X( l( S4 Q0 I( h; c0 X, xfield.
! S3 b7 B9 P7 B: O+ bIn fact, its purpose is not to load/unload VxDs but only to send a
8 m3 X. ]. t5 c4 RW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
; _" o) c3 n/ A; n( lto the VxD Control_Dispatch proc (how the hell a shareware soft could try9 X2 m# q; R6 D
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
6 g1 }. N9 F, F, h" E9 fIf the VxD is loaded, it will always clear eax and the Carry flag to allow
# ]; L: Z. S% r8 X3 ]its handle to be opened and then, will be detected.2 j: z3 d* X1 }8 q0 x4 A- ~* j& i
You can check that simply by hooking Winice.exe control proc entry point
1 Z9 d7 ~! T/ b8 \3 Rwhile running MeltICE.3 v0 X. [: d$ K+ p+ R1 r3 ^

# \; p- G0 ~  t% y, ~9 L. ]; b* z5 e7 _
, J# E' H  B# ^  Z  ~5 `% X. i  00401067:  push      00402025    ; \\.\SICE+ H& r! i( W3 @5 m: o# h
  0040106C:  call      CreateFileA
2 F& K! k" Z- N7 l* i3 C* ^. M6 T6 [5 n  00401071:  cmp       eax,-001* I$ s* E! b: {% d
  00401074:  je        00401091* _& Y% F3 X) r& q5 }, x# o9 c
8 e) [: \3 J$ ^$ e' ]
& s5 E; ]) {: P5 K8 D0 ?& k
There could be hundreds of BPX you could use to detect this trick.% O8 S% x+ A% W& Q5 Y  ]
-The most classical one is:
- H+ B+ {/ ]- s  Z; H0 i  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- x7 S1 k* [6 q) B' g) k    *(esp-&gt;4+4)=='NTIC'
2 O& {2 v$ y" |0 S) F0 b3 H  z/ v8 k) y7 L5 h, I, [! s! J+ U6 y
-The most exotic ones (could be very slooooow :-(- ]! ?+ Z3 L# h# w( A) p
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" I2 i3 q  ^. n  P- M2 I; x' U# G     ;will break 3 times :-(
' x& @$ }4 T- z
  i! t- p7 q" b! R-or (a bit) faster: ( H: O" d8 b/ m9 R8 I
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& f+ @7 j3 ]$ h* H8 w
0 ~3 I. C9 D; u- S
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # Y, K9 E/ P3 I* U' y0 N2 e
     ;will break 3 times :-(" t# H, p% a9 }* Z6 F
, L! {; u  p% \- O) g/ A& n) ?* |
-Much faster:
2 [: R% m, i8 w1 S7 n   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& `  v# U- ?* e0 v4 [7 a. s& Y0 K7 ?
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen5 g* E) b+ q8 I2 n4 P1 t( x
function to do the same job:! O4 h5 h1 N5 ?( p2 K- [% _
6 s* j2 F; u9 ~# Q9 v( S
   push    00                        ; OF_READ
; z" G& }. O  f) g   mov     eax,[00656634]            ; '\\.\SICE',04 j; a' G& i: a
   push    eax
$ f/ [3 j* J* ?+ m   call    KERNEL32!_lopen. P. z% g' N) t# ]* N
   inc     eax
7 l1 y; A% q( K4 _! K% _1 q' ?6 f   jnz     00650589                  ; detected
7 Q4 U# K2 t* w9 L6 Y   push    00                        ; OF_READ
' A5 g  w" l; s* R6 j+ H% @! D   mov     eax,[00656638]            ; '\\.\SICE'% _5 r# J0 y0 q' _5 @! C6 e* ~
   push    eax" [% A4 k; [3 B& b
   call    KERNEL32!_lopen
2 W% C( Y$ z( Z" ?# x. ]1 c   inc     eax
' T3 r  _. O& h8 h9 ?   jz      006505ae                  ; not detected
- e: |0 g( Y6 q; ^8 I7 p+ C
* |+ U8 \8 p& o2 I
# \$ a5 s! X- n6 f5 g8 u4 E2 d/ v__________________________________________________________________________5 [$ U9 h! n1 d! @$ s  r
+ e+ F* \( L; b  p% w
Method 12
8 o! u' Z; b  ?, H! t5 d# M=========
+ F; _: o  ~( w& ]3 f: E1 U
9 t' }2 x+ V& c- v+ [" `$ u* gThis trick is similar to int41h/4fh Debugger installation check (code 05) L4 Z, g) `& C
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: e8 v* p9 ?/ K( p! v6 Aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
* c: R6 `% M: `, T7 j, H( G+ P  H; ?$ h0 ?+ s3 r4 |, W, G3 D
   push  0000004fh         ; function 4fh* l, j; r  x- d# ]+ Y: u6 G, G2 z7 v
   push  002a002ah         ; high word specifies which VxD (VWIN32)
  e" O; H; M* v3 B( F6 r2 q                           ; low word specifies which service! \& D$ I$ k& O7 M
                             (VWIN32_Int41Dispatch)) b/ \, L' ~  H
   call  Kernel32!ORD_001  ; VxdCall" u6 O) ?5 m5 |) S$ Q$ k* ]
   cmp   ax, 0f386h        ; magic number returned by system debuggers
! y" o+ {' O/ K% I   jz    SoftICE_detected! v4 j; t% x" N

" L! L8 T3 o1 g5 j0 [Here again, several ways to detect it:, m# e6 K. N/ R8 L/ R. [! A8 Q  i; ]
% o0 e/ {* @/ Z  j: e
    BPINT 41 if ax==4f
: x: s- q5 D$ U5 c
  q* Y7 v( U. p    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
+ Z/ x/ D3 X# N! O+ ]# z2 ?* {. B7 N$ }- k& W
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
2 ]# K5 r; U/ E: q$ Q8 H7 _0 N$ J$ N* O. R. }: ~6 u
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  r' ~& z2 c" d8 R8 P7 `9 k

4 w- F0 d  m7 ^. [' g( Y, ^# [__________________________________________________________________________9 J& }2 p4 m( p8 O* L% f8 u7 j% m
- r- u2 C7 P4 X. V
Method 13
: _! N( S% B- j) Z: b) `=========% k* R8 C: f' k. }& M# k: N
& h! [% g" k6 ?8 b9 m! K1 L
Not a real method of detection, but a good way to know if SoftICE is
; u7 |$ Z2 w3 e  ]; s4 sinstalled on a computer and to locate its installation directory.
8 f9 I3 F  u" D5 J  _It is used by few softs which access the following registry keys (usually #2) :
: T" M$ s# i% N) P* v! e8 b" j0 H, j( h
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! b9 {& |# T+ X3 B* u& Z; L9 S- }- B
\Uninstall\SoftICE
$ q/ S0 H, E1 C  T1 G4 p6 Q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE+ [3 ]6 g6 T! O8 E9 w' M" }4 T
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& H  g# ]2 @$ h" U
\App Paths\Loader32.Exe
% E: H+ K3 Q% T# Z7 Z* w" ^: p: o- Q  p) v) W$ W, L0 B5 I

4 g- k$ t6 B  c4 pNote that some nasty apps could then erase all files from SoftICE directory, v# ?% o& ~3 g
(I faced that once :-(% B4 Q$ j3 g$ V
6 M3 e8 P7 a4 T! @  R: r
Useful breakpoint to detect it:5 O# D( a+ p. {3 |3 w
$ Z- ^- U' |  @- j; \
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) _9 d! |: Z7 @5 \; n$ u! r2 i+ x: g- ~0 l: N) i
__________________________________________________________________________0 F$ ?. n& P% N( a

9 a, `+ E& K0 m  q
/ T8 g$ `" _) a( ?6 NMethod 14
. V% s3 I5 Z* g2 G4 M* p  `=========4 ^! I& s  c2 ]3 e

! N' |$ `5 r+ N' Y9 `A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* q' b, S% j1 N1 G5 G6 e
is to determines whether a debugger is running on your system (ring0 only).
. O9 M+ m0 z) x7 {4 W$ }  N' T& O: O9 e3 v1 s4 \2 `
   VMMCall Test_Debug_Installed
! N5 x8 _, K7 M! X   je      not_installed
5 t, V' K. a8 d0 y. _! O9 d( V4 K+ s, |& }" U: V1 c1 }
This service just checks a flag.
+ E5 f6 F/ ~' M% L) g</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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