About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ e$ I7 T" T4 E3 S
<TBODY>
  u6 k. m% D. f* j) X* ?<TR>) X' G8 N2 v3 v
<TD><PRE>Method 01 2 ~: v: v" O7 ]3 p$ L7 `
=========; }1 n  k/ P% `0 J/ m* o( _

3 {* a0 b2 }% z  \This method of detection of SoftICE (as well as the following one) is  ]1 g& W$ D! ~$ Z/ d
used by the majority of packers/encryptors found on Internet.
8 L1 C4 T+ C% _4 R% NIt seeks the signature of BoundsChecker in SoftICE) z+ R" ~8 t* ]! K0 a# x8 o8 Z
8 r9 ?& }- u9 l, i7 H/ Z
    mov     ebp, 04243484Bh        ; 'BCHK'
; }0 _/ i, y4 T+ U    mov     ax, 04h2 |% }8 f% t! C1 o& _- a
    int     3      
, E$ q) A6 P+ |6 A! ~6 l: j    cmp     al,4
7 Z$ q& }& o( ?; h$ v: ^3 J    jnz     SoftICE_Detected
( o$ x, [2 T4 @# P) S  Z( z& |5 u3 P# q: P1 o. S5 K0 M, U% t
___________________________________________________________________________/ s5 ^1 F' s7 W6 w' U
$ ], x: d# ~/ U
Method 02, |: P" C+ {( M4 c
=========
5 z/ Z$ b: j1 h& F# o
( I0 X& r9 }) H! `( T) \0 U- AStill a method very much used (perhaps the most frequent one).  It is used0 m3 o5 y: R. s, s
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 `7 d4 u" N, C( @! Q3 K$ v" Cor execute SoftICE commands...
& r; w) E; p- e9 ~8 F7 h1 T2 LIt is also used to crash SoftICE and to force it to execute any commands
+ @! P1 Q: z5 [0 K+ G(HBOOT...) :-((  
5 I, M' U0 \  a3 r6 O& n( y& P8 W4 s0 D9 Q
Here is a quick description:. c0 p# v' R8 I% [" a" k  q
-AX = 0910h   (Display string in SIce windows)
& U9 C. c5 U" F! u9 l-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
, V$ Y' ^7 a3 M& m6 w-AX = 0912h   (Get breakpoint infos)
3 v# G: d4 x# ]3 e' |-AX = 0913h   (Set Sice breakpoints)
% w9 u, R6 R7 C-AX = 0914h   (Remove SIce breakoints)
; Q" |' J& {; ^. v+ d& v/ K7 ~. F2 c* T9 v- q) ]# b
Each time you'll meet this trick, you'll see:) D  I* ~/ M$ L- r" F* ?
-SI = 4647h3 n$ x! c( v) j* r) r4 `# ^
-DI = 4A4Dh
& D( y+ V5 A9 PWhich are the 'magic values' used by SoftIce.# k  ~; p7 k; I1 @5 D5 N$ A
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 A) X- I0 s7 @

9 D. t9 c$ \% DHere is one example from the file "Haspinst.exe" which is the dongle HASP
$ ^+ ~) t8 e' n; W! oEnvelope utility use to protect DOS applications:
6 P. o" o; z4 ]2 m# F# V0 ~5 e% c* P, p: y5 G
) Z7 @$ L$ P! Q7 d. x! `% _3 L
4C19:0095   MOV    AX,0911  ; execute command.# M8 R" n# j- v6 e: a( ~0 s" v8 X/ n
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. o) G/ ~8 a) J& J" W9 G0 L
4C19:009A   MOV    SI,4647  ; 1st magic value.
8 U& V2 \+ \% c5 ~4C19:009D   MOV    DI,4A4D  ; 2nd magic value.' @8 H6 P. V! C+ }8 a8 l
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*); z% H/ F7 S5 Q1 A1 ~
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ g: N6 d5 R+ q6 K) K; X2 T8 K" S
4C19:00A4   INC    CX% [) O( O8 `  `
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute4 H& n" \/ H, J
4C19:00A8   JB     0095     ; 6 different commands.6 s1 L, c9 ~& p) Q4 y$ U
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, n0 t- H7 l* L5 y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 v, v' z5 ~$ O4 M( ]" I
) M& z0 G/ _, o) ^; P4 ~The program will execute 6 different SIce commands located at ds:dx, which
$ A6 W5 ?$ h3 d+ y# b2 Lare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 o5 R  r+ m6 f2 m, J1 M

6 n$ f) M7 D0 r( K( ?1 g$ k* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ N* \7 t( U  j2 p___________________________________________________________________________$ @6 l7 z' f. F; f/ J# |8 ]. v

$ B& K, T) \3 u% Y& F) j: L$ j/ l! B" V7 ^
Method 03
4 ~- A/ {: ^* i( q=========  V+ o4 q( z  W, t" s

$ F. M: q" r. X. Z# U/ m) A' Y0 mLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& ?5 D4 b# x0 a( R4 @(API Get entry point)- P; v" d, F$ l  `/ [' W
        
' k/ ^# t2 k# y) ~4 L3 `: N( r" X3 K
    xor     di,di
% n3 y" p% l5 u# _    mov     es,di
- `3 L: B/ S: j. u5 {9 p    mov     ax, 1684h      
" V2 q1 s( n  H. b! M. X    mov     bx, 0202h       ; VxD ID of winice7 K  H, j5 p2 w0 O- K' M
    int     2Fh6 f8 E0 k* p* ~: P. ?
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: }. E; ?& I5 |
    add     ax, di
7 y  @! u. V/ ~" o- y6 O    test    ax,ax
1 J$ }5 x( }1 c$ x* k8 A# R- d    jnz     SoftICE_Detected
, a1 _3 \  O3 `  c" M, A  f% U
# ?+ r9 b  w# L7 `___________________________________________________________________________) _+ x: }/ M( Z, h$ x8 R  r
2 |) t3 k: g% t0 M! l- y/ ]
Method 04
* t' j2 l: V3 n=========4 M9 U) T- x* k6 o( B$ J
: S; K/ |# t! y
Method identical to the preceding one except that it seeks the ID of SoftICE
7 E5 m. u7 k& }0 Q: t' D- QGFX VxD.
' D( a* d+ c+ \- p; p
8 G, q/ k' @% @/ }    xor     di,di; E  u% t$ W9 d. l
    mov     es,di0 u% q1 h$ a4 u9 x
    mov     ax, 1684h       , U. ^! v+ w- Z" L, i
    mov     bx, 7a5Fh       ; VxD ID of SIWVID. m( K% z. |" B+ G/ q
    int     2fh
7 E' _+ O( H' o: z. }3 P" Z* X1 w9 M    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 c  [' H2 `) Q2 I6 ?/ e    add     ax, di4 r& \! x' R' d
    test    ax,ax
( E. k. m6 T* T7 i1 S& A7 L    jnz     SoftICE_Detected
3 m2 g, P  k' ^* z9 l  a' M/ r4 I/ x! G5 q6 B5 ?' u
__________________________________________________________________________! x7 A: g6 ?# Z! G- ~6 _0 Y  B
7 M8 Z) b" {+ C5 b- k) E3 ?, U3 T
4 |! @/ i8 w/ I# E5 q
Method 05
$ H6 `. R5 n+ {, A=========
" q" D" x( j8 y0 i# O) M/ `- f) u) r( C$ ~5 ^& ~1 c- M% J7 {
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- ]8 R$ K7 J: t4 u8 a' D" t6 b6 ~3 h3 Ndebugger. It calls the int 41h, function 4Fh.1 T7 d, g1 B) Y4 ^1 ?8 p: f
There are several alternatives.  
8 |, M8 g) i- Z( Q0 F
# o$ m( p: Z! }, ~' ~+ c" iThe following one is the simplest:
" @2 [" \* C3 a0 t* @
( ?" U4 q+ z3 S6 N  N) W    mov     ax,4fh
2 I  X" a: ~# l5 @    int     41h: I" C" N  R# R& l- m* y
    cmp     ax, 0F386
- `" _9 G4 N- i" M9 U+ w    jz      SoftICE_detected
0 S/ ~, Z+ `1 Z7 N; e
2 L5 X4 i" O4 c7 @+ Y# c6 e% |- A1 S" y( @% o2 t
Next method as well as the following one are 2 examples from Stone's
$ i+ e6 X5 m4 ?6 L"stn-wid.zip" (www.cracking.net):# @1 o5 u$ O8 Q/ J; |% n
( [( W% S0 I4 U& {8 ?4 Q) e$ X3 A: @
    mov     bx, cs$ m% i, ?9 w9 p: @% J3 l$ y6 a# ?
    lea     dx, int41handler2
) i) k  s, W9 E( X- x    xchg    dx, es:[41h*4]( S4 c8 \' C( C3 V) E
    xchg    bx, es:[41h*4+2]
) M& O: M# G+ T2 }    mov     ax,4fh
6 z1 A; T( q" U; Z2 w2 N    int     41h0 A% N( C5 n4 e9 |0 i+ ~
    xchg    dx, es:[41h*4]
6 g2 V4 D6 e# Q3 N    xchg    bx, es:[41h*4+2]
+ e( p& l( z9 l: A, h    cmp     ax, 0f386h
" U. r1 s+ {! q' e" Y    jz      SoftICE_detected
( L9 f2 k( @( G) e5 O) e  y
) @7 q$ E% r# f+ S4 B3 |% sint41handler2 PROC* P( [& n; s9 i' F( w
    iret. i3 X, ]: m$ H! g" ~- b
int41handler2 ENDP
" }- j2 H+ {% T& x
- Z$ c1 i& ]) T% {
  r$ J6 H; T9 A3 D4 `: j_________________________________________________________________________0 O" Y5 i9 A. J6 q* {; ^

3 m$ i, d/ v- C5 D  _+ Q8 g' Q4 W9 }# P6 Z, E+ J
Method 06! F, B( |! k8 R6 [) h& C  a* }
=========
, l# [9 G2 S( `5 w
9 @1 I1 r' V9 N1 n/ A5 G  W. P7 w9 o. f9 M5 Q4 H
2nd method similar to the preceding one but more difficult to detect:
+ w9 [- [4 }9 f! T& l/ S/ N' v+ @/ a/ _0 z0 y4 N
! A2 ^5 E, l, l$ a- U
int41handler PROC
0 {1 J8 R& h; J& V* T: ?) ]    mov     cl,al- [0 y3 }, n* U' b
    iret
: _  G! Z6 A( A9 cint41handler ENDP
+ t: c" v0 G$ a$ ~
6 k2 a6 i  t4 \% d9 R$ q
3 v. V1 P2 |0 ?1 y    xor     ax,ax
( r5 E2 {4 V. w/ }/ E: i; a3 {9 ~    mov     es,ax/ ?! J  P1 U- }- F) ~
    mov     bx, cs
: n$ G' u! @) ]0 n; N    lea     dx, int41handler
4 m4 h: d) q: F( b3 c    xchg    dx, es:[41h*4]
7 \- A7 p6 ]7 ]9 x: ~( [/ `    xchg    bx, es:[41h*4+2]0 a( ?4 T- N9 r8 |4 j' {0 l
    in      al, 40h3 a  J/ A. Y4 D3 ~
    xor     cx,cx
4 M0 Y9 O9 f, z, a+ m    int     41h
, O! x! B* A/ f    xchg    dx, es:[41h*4]* s  U% Q. G9 @* c, I% G
    xchg    bx, es:[41h*4+2]
' m5 N8 M, F1 j2 c6 R    cmp     cl,al. w0 o, K) V# [
    jnz     SoftICE_detected: }& `% M, Z) d% k; \
( m5 ]6 ^& F. u, `! ]5 @" B% {5 y/ X
_________________________________________________________________________
; V, l8 M$ @1 @; f" u
3 P8 G/ |5 X( w' r+ bMethod 07/ f0 X3 Y% y8 ~! V& a6 V- }+ N/ D' C
=========
2 m7 q0 J3 t3 Z# d$ p
$ v% Z4 o6 t1 Y, N5 `/ MMethod of detection of the WinICE handler in the int68h (V86)
: G' G0 x' W  z3 B! l; R2 ?. w8 y* x
; w' F8 H; \( j' t    mov     ah,43h7 ~( `. E" G. m2 m" E' q8 ^
    int     68h) @6 Y2 p: M" r1 I
    cmp     ax,0F386h
% r' w" w( _+ Q/ _    jz      SoftICE_Detected
6 O# b$ m: [, l* ~
2 G0 o% B8 b1 x8 K6 ]# [+ b* G
7 d# @+ H# p  g  A=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 p/ ]6 h2 O4 F4 J: S9 _2 Q: c- T" c
   app like this:
9 P& m: }$ W. c6 Z7 ?+ d, `( ^8 `' D3 G% a
   BPX exec_int if ax==68
6 V& I& ^+ w. o   (function called is located at byte ptr [ebp+1Dh] and client eip is
- _6 L7 [0 v$ k5 ]   located at [ebp+48h] for 32Bit apps)) G' {8 a  Y5 c$ O7 y
__________________________________________________________________________7 N# M7 s5 z6 S% h! k

  m) p8 D$ v" e
# y  W- K9 L! N* y- P1 s8 [Method 08
- n0 l# Y! z: t=========, W9 l% ~+ [9 Z  u8 Q/ R

0 t* p( y/ b, i, n5 FIt is not a method of detection of SoftICE but a possibility to crash the9 s5 |" S$ |9 ]; `) Y4 _" V9 w
system by intercepting int 01h and int 03h and redirecting them to another6 M* i4 b$ [% \: B5 l0 i; B
routine.
3 O8 F* @; x4 m( w! T) lIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 `5 A$ L% a' [9 b. p) A4 Vto the new routine to execute (hangs computer...)$ K0 T0 @( z" Y  `0 S# }3 q/ Y
& ?: S) ]9 }* e& U! F6 G
    mov     ah, 25h. ], {) n* K; ]' n. T9 c
    mov     al, Int_Number (01h or 03h)
4 s7 t+ F0 k, U% p    mov     dx, offset New_Int_Routine
0 e) ?6 [$ m2 E9 b7 c    int     21h
* r: {/ A6 k* _+ i  [4 Z$ F1 W, B" C! n: j
__________________________________________________________________________4 [, D. N: a5 K: P

6 ~1 C3 K! m5 x1 l5 xMethod 09$ x; u" N" M7 @+ l
=========6 |! A" n5 z6 R. v4 y* f
' p. s7 Y6 k" G. }  Y  v% O
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% J- ^0 i+ }. X. @performed in ring0 (VxD or a ring3 app using the VxdCall).
; n) S9 v6 \# eThe Get_DDB service is used to determine whether or not a VxD is installed
' }% A! e0 u+ T1 Y- x8 \9 C0 z0 _8 Pfor the specified device and returns a Device Description Block (in ecx) for
3 _* H% ^, H+ f" X7 C/ c! K% mthat device if it is installed.! o6 k" H1 z! n# h2 G6 N: R& B& I
( {1 ]% C/ h9 N- f- c
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 }: K" a7 A) R7 J  D0 e; G# y   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" ?0 E: Y; G+ R+ q* @6 F" a
   VMMCall Get_DDB% A& W; ?, M: G' ]2 F
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( V) v, ]3 e2 G$ N7 C! v; o' f; x. D, y4 l6 I9 f9 ~" h7 Q
Note as well that you can easily detect this method with SoftICE:: Y+ K& T3 x3 j5 {6 S
   bpx Get_DDB if ax==0202 || ax==7a5fh
, [9 x: J  A( Z/ H" O1 T) ~, u
) m- V2 ~$ `  h+ P2 U+ G3 i__________________________________________________________________________! Y( {' D  W0 ^6 Q. A4 m$ L

) Q6 U" J2 P" I/ n3 K3 \7 TMethod 10
, k6 x6 v4 u9 F2 d  g, y* ^2 H1 u" f, K=========
& [9 |5 w" s" [1 N( U# k% p* i' J
2 m* N  {3 \( [' I+ [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 Y/ j; k/ M' V6 q, z) T6 R2 w$ y  SoftICE while the option is enable!!
. T% G& E- {9 d0 }! J! D, u& X4 d6 g$ ]$ j8 x8 M
This trick is very efficient:8 c, `7 U" c9 K7 L/ V4 s' [/ q2 o
by checking the Debug Registers, you can detect if SoftICE is loaded
6 C% C9 a; r, C/ s5 w9 ^6 q6 ?(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  }9 G1 H4 ~7 }; A# B1 Cthere are some memory breakpoints set (dr0 to dr3) simply by reading their. P% W) U; n% k' ~7 g
value (in ring0 only). Values can be manipulated and or changed as well: u, D8 U* ]" Q# v& P. g
(clearing BPMs for instance)
+ C+ ^6 V* h6 h) F. J6 |! s
' @! i$ }% L# R" O( x9 n% Q3 U: H" j0 g__________________________________________________________________________( Q7 }( X% f9 G* [  k) W3 c

+ p( ~3 {! P/ _' I( T3 u# T1 `# {Method 11- E2 j" e7 g$ P3 M5 ]% n  T
=========2 ]) I9 h' {% \
4 [: t) v3 H! K. Q9 v: I
This method is most known as 'MeltICE' because it has been freely distributed7 J$ y1 L, Z; u, ~: V
via www.winfiles.com. However it was first used by NuMega people to allow" J2 R, N! M; R; K/ H2 n  m' L# i, s
Symbol Loader to check if SoftICE was active or not (the code is located4 r8 |% @7 a) _! E. r" N: s8 G
inside nmtrans.dll)./ K2 Z4 }$ V8 W4 m

; [( f! M. C* P. P9 iThe way it works is very simple:
  d# J6 l7 I# O0 V0 ~) N' t( ZIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 Q( r! c  T0 q1 B9 s' tWinNT) with the CreateFileA API.2 v) a2 E; L0 E- I8 D

# v  }" q' X$ L/ @' AHere is a sample (checking for 'SICE'):
8 A- u; ~) a. @, ~
3 G) H# Y9 p$ S( d; }BOOL IsSoftIce95Loaded()
, l7 u6 j. [* y- {! R! q{7 t0 Z: v/ X% z2 W8 Y, X
   HANDLE hFile;  6 r5 Z# l% Z1 e5 y2 \
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 S' V# A' E) r7 u6 X& j. p9 s                      FILE_SHARE_READ | FILE_SHARE_WRITE,2 _. {" Z5 t5 e5 T
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
; b& x5 U4 e' _" k- M" s2 I$ c   if( hFile != INVALID_HANDLE_VALUE )
% H) X# g6 ?' V  s: h& k   {
. N4 K- v& I$ F$ l0 y4 h8 Y+ n+ e5 k      CloseHandle(hFile);* _& Y3 D& U+ M& Q4 u& H
      return TRUE;$ ~( t5 M" E1 w  i+ u0 s# w
   }0 f7 s' F; l: I
   return FALSE;7 z. @0 z$ v  m( G/ }
}
0 k/ b( H& n3 z6 ]/ r- v) b: g1 W! @0 e: g& I1 ~5 q0 K+ M
Although this trick calls the CreateFileA function, don't even expect to be
4 x* f" T; A# k6 q+ ~. B# Y. f9 cable to intercept it by installing a IFS hook: it will not work, no way!
1 w* d% @0 g6 j8 mIn fact, after the call to CreateFileA it will get through VWIN32 0x001F9 J7 x" T" |! J  t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' B" k0 O5 a# x3 @% I" \! O# Y" ]
and then browse the DDB list until it find the VxD and its DDB_Control_Proc% k* i* b+ s- z/ g" U. q  q
field." k# F$ Q3 p* P& o
In fact, its purpose is not to load/unload VxDs but only to send a 2 D/ G+ x% y. ^+ y
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 o5 I  j' j; }; [to the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 {: B# u; J! g& |# ito load/unload a non-dynamically loadable driver such as SoftICE ;-).3 e! h6 e$ ]" l# `: m, w
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 ]: A. P* N5 p: h0 K2 u
its handle to be opened and then, will be detected.' V' @0 v5 v1 {5 R6 L4 [
You can check that simply by hooking Winice.exe control proc entry point1 @; M+ M4 o! }  I' k/ N5 _. S
while running MeltICE.* K- D. |7 s0 w* c- f1 M
, N3 v- M6 i) _; |1 t

& w( X; V6 `# S: \' V1 ?" p9 E4 \  00401067:  push      00402025    ; \\.\SICE, e/ w: |6 _8 z$ u" Q
  0040106C:  call      CreateFileA
/ i; R0 r, x/ z7 ?  00401071:  cmp       eax,-0017 s! d  h5 s$ K, N& A
  00401074:  je        00401091% Z1 ]* q9 X: O2 Q' t

: [7 I- B! a7 F. z+ n
9 B8 o0 H% i0 P4 J) WThere could be hundreds of BPX you could use to detect this trick.
7 R) z" a7 Q8 w. v; a* q1 x-The most classical one is:
7 E' G8 [5 S5 I0 ~, E7 k8 c6 G  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 {1 E) D% S' L+ T6 e) v9 q
    *(esp-&gt;4+4)=='NTIC'; _8 j4 p% P' K7 S

$ C; D5 Q0 T8 F$ Z4 S' J3 h-The most exotic ones (could be very slooooow :-(
( M! w2 V: ~/ D) j   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ) s: q7 b& C7 h( U0 B
     ;will break 3 times :-(! G' p! T# L& N3 e0 z
5 U  }# \' M2 _3 `* Q
-or (a bit) faster:
9 B0 g& j# T# P. ]. X8 T   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 }  M' |, b& t6 s" B9 ^, p- G3 l9 c& ?. w3 E
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% J4 A0 ^0 F1 X: P: @- r     ;will break 3 times :-(
3 k+ W0 F0 L, G' F# ~8 A9 m
2 A0 S+ d! d. y6 f% j-Much faster:
* f- @1 }/ p) t. g: z; E/ F   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 W9 t% b3 m4 [$ S9 |9 I+ m8 c

; w% }3 f1 V1 CNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 k" l2 ?" b/ i/ pfunction to do the same job:  |* ^) X. l# t6 P
% X! t7 ]7 A  i3 F0 k% W  _
   push    00                        ; OF_READ! R+ R: L+ Y8 q) w1 o. r( C
   mov     eax,[00656634]            ; '\\.\SICE',03 {+ l4 _1 c# Y* E/ t
   push    eax
9 u5 h8 k- Q& X9 w7 k6 g: D* a   call    KERNEL32!_lopen1 A6 v) @/ M* c
   inc     eax
. ~$ p" R% Z9 \- [7 H   jnz     00650589                  ; detected
6 @, @0 O  Y) d* f   push    00                        ; OF_READ6 H$ m" M" N$ @4 P( ^# E- J1 Q& U
   mov     eax,[00656638]            ; '\\.\SICE'
8 C* W) c3 S# _. \5 A7 J1 F( d2 @$ s   push    eax. N! j/ ]. Z2 c. D
   call    KERNEL32!_lopen2 f9 q: r, a5 u# u
   inc     eax
9 z: W7 @: X, n% T2 ?# k   jz      006505ae                  ; not detected
/ H+ v* ?2 i$ c# V& E
3 A  |# K' P: H7 X# e! H6 Z4 m7 z* [# p% E+ n0 b. z$ k" I
__________________________________________________________________________+ G; X- P- W1 h( p% K  ?) V; E) b3 m

3 G8 B3 ?% y- M( H. M# {- bMethod 12$ d8 @. [4 M& o) u3 }( U" E
=========1 b5 \1 s* V& T- C) Z

9 |. {6 k5 \" {This trick is similar to int41h/4fh Debugger installation check (code 050 y! j$ `2 I) y' O0 C/ }& E
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! E- F% [8 s0 V: Y/ Ras it uses the VxDCall backdoor. This detection was found in Bleem Demo.( ]5 T  {( f4 ]+ J1 J0 {  k/ D% J
' v! }" s5 u/ i( p! B9 c4 w
   push  0000004fh         ; function 4fh, z- y! Q0 h8 Z6 d+ {; q$ G8 e1 @
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 L% C7 L7 L& N+ G# W, y% |! C- q
                           ; low word specifies which service4 L' e0 q3 T' c! w6 g
                             (VWIN32_Int41Dispatch)5 ]. \) L! I" I% T
   call  Kernel32!ORD_001  ; VxdCall
, `' V7 b- e: b0 ?  l7 M/ s# t   cmp   ax, 0f386h        ; magic number returned by system debuggers
5 b$ t; z1 Q7 k( D   jz    SoftICE_detected
+ ?/ H- ?' z8 i% O! x% O* r% J  l/ }/ K) Z& r
Here again, several ways to detect it:
  ]- ^# l7 D) c7 Z/ u; ]3 Q3 t% o7 F) j+ x+ h& a) A
    BPINT 41 if ax==4f' W/ }; `# k$ Y7 ]

9 x7 P3 s+ M! u8 u$ K6 @. e    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
% u5 Y. G1 O# @) B6 y) \8 x. {4 W% u' F/ G4 U0 z: o
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A% X  z/ g. h# w/ `8 F# h

- {2 l9 }+ O" Z8 W  ^    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# ?8 C, @' i9 @; V, z' v8 _

; T4 h# \6 y" w5 A__________________________________________________________________________0 l* A9 z: \) Q- \

1 X- w1 r9 I) g* A0 W8 R( d, CMethod 139 V& c7 o& r, i
=========" U: q, a* Q- C2 S* q
' h+ Z5 \: I5 t! F3 D3 R
Not a real method of detection, but a good way to know if SoftICE is
: d' G* x; |% ainstalled on a computer and to locate its installation directory.
( _% y& I- I! H+ G* P9 |/ ]( U8 |; wIt is used by few softs which access the following registry keys (usually #2) :1 C( m8 N* Z4 t+ M! h

$ N4 l# t0 Z- g& e5 e-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 R" ~. h# W+ Z$ ^\Uninstall\SoftICE
. B' Z$ z+ h; m+ c-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( {# j4 t# q/ d2 ]! H' ]% A-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  J! e4 y5 d. o" Q7 j* ?3 L\App Paths\Loader32.Exe
- X- v' R+ c# `$ Z. J- Q. w" f2 y8 d! b1 W* z0 u* E% B

8 Y0 ]+ m* p4 j" ?- m7 g# YNote that some nasty apps could then erase all files from SoftICE directory
. h% [# q4 ], C(I faced that once :-(
3 [6 {4 }9 Q5 R. J2 Q8 a% ^6 S1 c0 H* S6 r" Z; m+ G( v
Useful breakpoint to detect it:* j: m9 _' B1 i0 Z% q0 d# f$ f  F1 X3 @

( O2 g3 k" R5 O0 @7 x     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! V$ o7 R4 H  j0 v  _: A
% Z# X9 T9 K+ b, Y  t
__________________________________________________________________________: O+ B% Y. u3 ^& W0 w% c
' C8 i3 [, M4 X- ~4 B9 {
  u6 D7 h: K# }; G  q
Method 14 7 {) L0 p5 C6 ?2 u4 R" s9 F
=========
+ K; O5 E* {( z5 ^7 e5 H1 ?% y, g( R2 y8 s- ?
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 _# d4 a1 u1 }* A5 X. D7 Eis to determines whether a debugger is running on your system (ring0 only).
) f" z! V; V1 ^7 ]* X
, |  z) b5 h2 c: W4 }$ x. e# ?7 o) r   VMMCall Test_Debug_Installed
2 u- @# |1 l* b   je      not_installed
3 o( j, P2 s  j# F- c! ~! M" p+ L- i( |; g9 i8 M2 Z* h9 P$ f5 y$ q
This service just checks a flag.
  h  D; j. w4 y9 H9 Q# z</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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