About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, }! ~0 D2 Z1 N<TBODY>( F1 t  f1 r' D; C& [/ b5 N
<TR>
6 N4 b$ K5 n* a; h% o: I9 e<TD><PRE>Method 01
2 j5 U% |1 B" T  o9 X=========5 ^' r( ]) K. L/ q6 q
9 _* b9 e* j$ ?% J9 K
This method of detection of SoftICE (as well as the following one) is( s- g) z7 n* X0 Q4 P: ]
used by the majority of packers/encryptors found on Internet.
1 f  k0 w5 `1 i! B) ^It seeks the signature of BoundsChecker in SoftICE
2 T4 `1 I. r1 e* M% P2 h
' y$ z# _6 i2 l& q) e    mov     ebp, 04243484Bh        ; 'BCHK'' G# ^: N- W2 k7 W
    mov     ax, 04h$ ?$ C0 M& q% i  f4 Y8 E
    int     3       % I$ Q) B0 x/ m1 a
    cmp     al,4( c+ H% \( a& Q1 R. }# I
    jnz     SoftICE_Detected3 q- ^" \. P" l; H

( r( P9 ?5 m* O. T" d4 v5 C7 k___________________________________________________________________________3 t8 \7 ~8 n5 {7 H! L2 P

3 ?0 R' K7 ]) t# bMethod 02
8 B; B, D2 c- R2 Y- m" y=========. n7 l2 u$ ?1 Q+ s! T3 L1 b& D5 a

* V1 B0 _; `% Y! vStill a method very much used (perhaps the most frequent one).  It is used- A2 v, Z# a, s" K. z6 G+ F
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 |" N  _  p1 N4 a( Q* p! @
or execute SoftICE commands...
. d, X) [3 e" iIt is also used to crash SoftICE and to force it to execute any commands, j* }# ?9 L- M4 s, x& R$ h: |
(HBOOT...) :-((  % }/ ^; H7 @5 ^

- V6 L5 _( J7 L) NHere is a quick description:- b/ M5 a5 ]+ m2 r, L4 b4 N' A
-AX = 0910h   (Display string in SIce windows)& u; t: G9 L3 y& y- i# R
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)& S; s$ L1 ]0 y7 v( w
-AX = 0912h   (Get breakpoint infos)
: {% D7 r" u& q1 q2 e  J! [- V-AX = 0913h   (Set Sice breakpoints)* @9 D9 `2 \6 m! l) w& ?4 |5 F- R
-AX = 0914h   (Remove SIce breakoints)
1 m4 p& ~/ K/ z; t  y/ s2 z3 ^+ f' ?# l0 C1 M
Each time you'll meet this trick, you'll see:% D. ^- g  `8 g% K. s; \
-SI = 4647h
# g& d' A' i! e& n/ R- H-DI = 4A4Dh
! g; e: w; `. ZWhich are the 'magic values' used by SoftIce.  U0 M% a  s8 C
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ R7 y8 j, G% x# i- X2 A: W$ ?3 G; J9 l& k4 n! o
Here is one example from the file "Haspinst.exe" which is the dongle HASP) Y8 a+ M) H2 y8 k
Envelope utility use to protect DOS applications:
" o, {2 G+ u" w: Q1 K; Y" T! F% k: U  v' G" D% t) ], k
! G7 k! |. ]/ C
4C19:0095   MOV    AX,0911  ; execute command.
  ^5 H" X7 A6 P  j8 w! ~4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
1 n- a, U5 ~* P" ]8 b+ y. z4C19:009A   MOV    SI,4647  ; 1st magic value.
1 ^$ d5 \, [( |, Z7 Q5 ~4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
1 F: e& z) E9 `4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 _; A; Y( X5 y$ O
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 Q' h8 d* ?: @, n
4C19:00A4   INC    CX- r' T  h# b" _4 L* H
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# E' G; q, A6 {9 Y6 r
4C19:00A8   JB     0095     ; 6 different commands.
) L( V! B# K! B3 S. R4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
5 Z' G. s* }+ O8 l& o4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)# x0 |% X2 ^3 T7 y

! |7 O( T1 @* [( P' x5 jThe program will execute 6 different SIce commands located at ds:dx, which) p8 m9 {$ W4 g- `0 Y0 X- c
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 u8 A, P6 M) c; {* s7 O2 S: X
' s" F: N1 A- L$ K8 Q0 g2 x+ K* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.( N* U6 h5 w& A! q; p
___________________________________________________________________________% w( s( l8 ^8 D! v, h3 W3 Y

# P1 g0 w3 D: ?; I* {2 \- Z9 v7 w2 b3 D
Method 03
1 z6 x& J/ _0 i) k. S=========
7 w- M! Q% A# |/ [' _3 ?1 t# e) ^% \
7 N, _3 p7 r  Q4 X: G; lLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
- I6 \6 h/ N, p  E! b. @(API Get entry point)6 o. q8 f* z+ }( X* A: S! }7 F
        ; ^/ X2 r$ F( [' A$ E! W. [

2 n/ U8 i2 i$ Y5 ?    xor     di,di  ~$ f4 x& J* E0 ^' P+ J
    mov     es,di5 b* e3 ?2 T6 U0 A
    mov     ax, 1684h      
- _, Y; A1 h- A8 W    mov     bx, 0202h       ; VxD ID of winice( b1 c  \, ^2 l! W5 `
    int     2Fh
4 X9 A  Q) V0 ]% @* w2 O" a    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 b; O/ [- M7 C1 l
    add     ax, di
" S' S! d/ M  z+ e7 O" S    test    ax,ax
  }2 Z# x: e1 B9 |    jnz     SoftICE_Detected/ |* e2 b9 A3 ^, X, W

, k6 i' ~8 [+ \* M0 x: @___________________________________________________________________________
. W9 _4 s, K% s6 |
0 q/ o3 [! `6 q6 Q4 yMethod 04
0 P( F2 Z' R/ l% O' `" O=========
  f3 |; B6 P5 m
. e6 X3 u; H5 J# C* h* }5 N8 gMethod identical to the preceding one except that it seeks the ID of SoftICE& ^* p! Z5 u; n, }. l0 c! [5 C
GFX VxD.8 I8 Y' [3 j6 l: e. M+ q4 |: w' `

3 s! C- k4 r; [    xor     di,di
+ d" P" C7 h; x' J5 w4 z/ ^9 v    mov     es,di# n- V- a7 g, W5 c/ A! s
    mov     ax, 1684h       . e3 i+ K$ r0 p. y* x
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 q6 u+ G2 ~+ L1 ~3 U& R( \/ `    int     2fh  b( ]  d5 U$ b5 U( q8 w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- o) r/ M+ ]& n: v    add     ax, di
% t! C5 Q! S9 l; F5 b    test    ax,ax
; v6 u, z+ F% X  B, q& H& L; _    jnz     SoftICE_Detected
- D3 ~* ]1 H" t8 \: _) n9 v5 x! f
0 \% N2 ]3 H0 z3 |% S__________________________________________________________________________* i  E+ O; m4 O0 j# Q& N" H% U8 r3 \

1 W3 X3 p3 L$ f+ U- j
2 a- V, v5 O  O7 V" pMethod 05: Y' Z7 o, [0 J1 f5 T3 Q
=========3 ^% I* [6 A! g8 g  b# Q( V
" i2 `: J) u) U0 z: v
Method seeking the 'magic number' 0F386h returned (in ax) by all system
- D" u6 o- |5 D9 t) }6 v3 B9 L4 u. wdebugger. It calls the int 41h, function 4Fh.; `2 X9 A. K, r' T
There are several alternatives.  ; D* j2 B% S# [. z

& h9 f7 i3 X/ [. IThe following one is the simplest:
* }2 a7 x8 }9 H3 G/ B' v: e; h: F  Z5 Q2 g+ Q
    mov     ax,4fh) e, o+ s4 Q0 i& R2 L8 X( `
    int     41h( S3 F/ q$ x, D: p1 J' t- e* E8 Q3 V
    cmp     ax, 0F386% P% ~0 |4 f2 ?$ r8 j8 t. }
    jz      SoftICE_detected
- O: n6 H& k/ [- S3 z& n, D
1 f# A1 W1 J  e4 X2 p. I6 I
* x/ V5 f3 b# s( \Next method as well as the following one are 2 examples from Stone's
5 q) Q/ h7 w; C. E4 R( w6 h"stn-wid.zip" (www.cracking.net):; t* W  o+ _3 z5 _, j
( ?1 a  j4 ^& W# g. v9 R" s5 W
    mov     bx, cs* O+ }, F3 z$ F0 j/ E8 x4 k+ [
    lea     dx, int41handler2
7 L: u$ U$ z* j* ~& k  Y) n    xchg    dx, es:[41h*4]
% D* B6 ^4 ?8 y    xchg    bx, es:[41h*4+2]
+ q+ B" j# B( W1 g; z: `    mov     ax,4fh
; V( f( [9 v3 a7 u  {: J1 w8 H    int     41h+ M+ e# O7 A$ Y$ |/ C
    xchg    dx, es:[41h*4]6 L1 w, E: f& A& g. Q$ ^
    xchg    bx, es:[41h*4+2]8 E7 S3 S- e/ a( H- H* m# E7 ]
    cmp     ax, 0f386h
; ], Y* h9 ^# f9 ~, T3 b1 b1 s; ^) g    jz      SoftICE_detected* L9 m  V4 t& c4 R( d% \7 b8 N
; s2 k+ k; @) h/ B( X
int41handler2 PROC! b, e# v( m6 `* r+ L
    iret
  k" z1 k# ?$ Sint41handler2 ENDP( S: K- c. e+ G

3 [: {' Y: B1 p+ M
& ?7 O9 O, S: n3 X4 t2 l2 B% B_________________________________________________________________________
& T* }5 }( @; m0 O3 P  ]# |
( s: o0 K2 V+ J2 @9 T1 Y8 P+ ?' d' V% Z3 e5 N5 j
Method 06  g# K4 `* N4 z) D
=========) }, D$ M" P3 m( e; B$ W5 y

9 K3 s5 J! f; m6 l' M# A5 A! a4 Z1 P( f# y- `  t) j8 j
2nd method similar to the preceding one but more difficult to detect:2 l2 F+ d: y% S7 E6 r- m& Y) R1 F
4 V" U2 A9 t" P7 @0 b0 |' r* e
  H! O' R: D2 K
int41handler PROC) R, r) ~/ I; S3 Q# r
    mov     cl,al( V3 R4 ^% W* `  m# ^4 t
    iret
* X6 L% z' M5 V* ]- G# F0 A% Oint41handler ENDP
, Q2 I' x$ [! K6 X4 x5 o9 i
) L% B, J$ Q: X9 F& m( N- H! o) x2 G7 t. @$ @! a& ?
    xor     ax,ax
- x, ?9 Q% Z1 ?2 l. ]5 q  z( V) {    mov     es,ax
% u! [0 f* o# x# T1 c1 U    mov     bx, cs
1 s+ f* Z* P9 A! ~  Q5 L* ^    lea     dx, int41handler6 @  B+ R- U0 \8 d0 u' h! N
    xchg    dx, es:[41h*4]' ~  d# Y" u5 m& L1 c
    xchg    bx, es:[41h*4+2]. l: }  o7 i- h. C9 ]
    in      al, 40h
7 i" j. `$ h6 j& N! H: @# ^5 `    xor     cx,cx) d+ K2 p& c# X
    int     41h
7 V4 j: ^2 M( P$ k5 ]& Z    xchg    dx, es:[41h*4]
# ]$ q6 p3 M# s% x    xchg    bx, es:[41h*4+2]" U8 G6 W# ]& A! k  ?
    cmp     cl,al" c0 h/ _$ [! r9 o0 O: r
    jnz     SoftICE_detected
0 D7 c- J+ C6 ?
8 h# t! @# m% G1 ^. g, P_________________________________________________________________________# l0 U2 t5 p- W; f* S: `

  X9 p8 ]5 S) d5 w8 G8 e5 D2 VMethod 07
( I- A/ f/ i- [=========
8 s5 S$ R* [/ f9 n/ W; S5 S) r1 i( l" M7 K) I% Q
Method of detection of the WinICE handler in the int68h (V86)
* |) e' G* C( A3 b9 `- u& y3 |& V% \7 B' q# e3 R" ~) D8 Z
    mov     ah,43h7 `% w/ O5 w! K4 c
    int     68h
( k" D3 F; M' n% l2 r8 r    cmp     ax,0F386h: u. C2 }, {# _1 ~, Z+ n2 {, t; }
    jz      SoftICE_Detected9 U6 g' \4 Z4 {; B1 q6 v; x
& N/ ~7 |. _: o8 u( ~( ~0 @+ T
0 r7 O0 y, R! J* l+ N
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& S! K! O2 K0 Z
   app like this:
0 X* ^3 R) R2 r9 |
8 l7 m& C# U3 }4 U  f   BPX exec_int if ax==68( Y0 |- t7 h; s6 p/ k
   (function called is located at byte ptr [ebp+1Dh] and client eip is
0 W2 y7 z: J, ?8 b* A   located at [ebp+48h] for 32Bit apps); Z8 |/ c8 T/ D
__________________________________________________________________________
$ R' `; z% }8 Z+ {! M2 @! v. k! G0 e* H' r" r0 _
% U$ o6 V3 v1 s2 n  F0 E% l
Method 08
( b+ y' L; z7 p4 m- }" N=========1 ~2 B) ?5 b) ~0 X$ X

1 p! K2 I6 H& A# K4 kIt is not a method of detection of SoftICE but a possibility to crash the
" @  J* R" B' r5 ~6 I0 [system by intercepting int 01h and int 03h and redirecting them to another
- N3 R( W) p: Z5 N& v# O0 N0 broutine.6 i9 u- p/ A9 V' n
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& S) @4 c5 L1 _7 y% ]4 V
to the new routine to execute (hangs computer...)
) @) {3 A8 |, s& C; t5 ?+ c& p8 m5 q3 o; H8 X+ I  P  E3 h6 C
    mov     ah, 25h
2 c- K0 E" R7 G! C7 B) A    mov     al, Int_Number (01h or 03h)
& K, n& _" x. [- ^) z: {2 |4 Q    mov     dx, offset New_Int_Routine" A2 j  z' q6 l7 i' |) [# S% B
    int     21h
7 H- N8 n7 O; P! P* Q' u- j/ D, m$ G+ m" g2 m" @$ o
__________________________________________________________________________
3 @) t( X- }' A6 {2 c7 a7 M
+ S6 o7 T9 d, w6 L1 mMethod 099 Q9 w2 ], y: G) S% m8 z
=========
% N# g: H3 G" @- T
  @5 b% q1 F& p( J8 e! t) GThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
) p' g, i7 Q. ^6 Tperformed in ring0 (VxD or a ring3 app using the VxdCall)." b, W& `6 a: H3 l% s$ E$ _
The Get_DDB service is used to determine whether or not a VxD is installed
* B5 U! x- I" T" d8 |; U  r" q  Tfor the specified device and returns a Device Description Block (in ecx) for
) f2 v* R& b  q. Mthat device if it is installed.# `0 G4 _3 I1 i% o- c4 T/ T; K
: D- D& V; c8 \: {& c
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( |8 u! j" v4 e  n, Y6 `% c( p6 [
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- ]. Z: c5 r5 F0 s2 w: a
   VMMCall Get_DDB
  |$ Y+ z2 Z3 g  W, M  \7 O- \! T! `8 x   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! a6 m# h( d4 d4 A6 I+ x1 [$ q+ F
Note as well that you can easily detect this method with SoftICE:
* q# ^& s. O1 u3 {$ ]   bpx Get_DDB if ax==0202 || ax==7a5fh
& @" \$ P7 N5 ~; {5 O6 H3 C1 r& Z9 b! l. w. L8 w: ^: v* O% J; x
__________________________________________________________________________5 f& |) }! R( [, T9 ~. G

+ @. [7 Z& i, k; H/ GMethod 10
, `  t9 k; P. Z& T" m=========7 w! U/ b) I9 l, I4 k
8 r- Z" B" B' m9 `+ m* g
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" B8 j) i9 c9 u. X+ y
  SoftICE while the option is enable!!, G: U2 D4 W& P) m, K2 P

9 _7 I/ v! o8 w# b5 ^  k6 x% G  D* xThis trick is very efficient:
$ H: Z( h5 C& y4 ]" ^by checking the Debug Registers, you can detect if SoftICE is loaded2 K; K6 ^1 h, g( `" z
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, e, v' Q* U" V' e5 x" @" q
there are some memory breakpoints set (dr0 to dr3) simply by reading their3 L* F; a/ Q+ O" P$ W& s$ v9 @1 g
value (in ring0 only). Values can be manipulated and or changed as well
: \1 H9 A+ a2 r+ D" ?(clearing BPMs for instance)
+ a& V, \" k( y" N
$ k7 M  f/ I; q& Z' X' C5 ?' d__________________________________________________________________________2 X" `# U8 x- c4 p
$ h, J5 q+ F+ e2 c) g
Method 11
9 N4 Z; S' U( I. h# s8 q=========/ K9 B5 n9 w. I, S* T* [6 }

& Q* z  T6 D4 u0 U0 DThis method is most known as 'MeltICE' because it has been freely distributed
& F8 q5 X( v; v7 ^0 p# Qvia www.winfiles.com. However it was first used by NuMega people to allow
& q9 a4 N$ O; c8 u$ z7 L& H$ VSymbol Loader to check if SoftICE was active or not (the code is located
; O* P" {9 M/ A1 W! }inside nmtrans.dll).1 i3 M. Y6 W* Q# R0 ?
; P: W: N& X# y+ r5 T( ~7 Q! R3 d
The way it works is very simple:
+ p: q0 l- ]9 S1 RIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ c. e, |2 G) ]( R
WinNT) with the CreateFileA API.1 x5 P2 w2 ]: n, O
1 R" x5 m/ _: ~
Here is a sample (checking for 'SICE'):6 S/ S. Q, k- w* T' m% _$ S

8 f2 U9 O% }7 b$ \/ ABOOL IsSoftIce95Loaded()+ E5 Q. O7 y% T: X- H
{+ w% Y% m- [8 d4 \& H% `/ {
   HANDLE hFile;  
: ]! f, s+ f  y0 s   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,- j5 K9 J7 V: ^6 q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
* K. A' S% O# x$ n' r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ T" k( x8 w% ]; e+ J   if( hFile != INVALID_HANDLE_VALUE )
; O" N) }1 H0 n/ _5 T) u   {/ {; d4 {& ~: j7 n( u" R9 S
      CloseHandle(hFile);
7 c7 T, b  D# i, D( B      return TRUE;7 [9 H  J* Z# {2 y, W& R0 m7 B
   }
& j6 j, j( A/ S# D$ X: c& f5 S   return FALSE;/ O3 M* {8 D; H4 _; _' t; C( [
}& ]* n2 \% J+ B# `2 _6 d# g' J, U

6 `4 v$ f: l7 f5 f0 d8 oAlthough this trick calls the CreateFileA function, don't even expect to be: S& z8 y4 V  \) y: H' ]0 E2 T
able to intercept it by installing a IFS hook: it will not work, no way!3 E) U. o" ~) x8 |! X7 H4 V
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
3 M  u! }( w9 O8 ?2 D4 K4 Fservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
* ?1 y, x# n0 _  h6 mand then browse the DDB list until it find the VxD and its DDB_Control_Proc
' N& {3 ^, W" m; Afield.
9 G! _7 x( p2 B- @; D0 VIn fact, its purpose is not to load/unload VxDs but only to send a
; M, @; O' t5 t* A) D3 V  d; J4 ]( oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
* {3 W2 c3 t8 p9 ~8 t6 _" Lto the VxD Control_Dispatch proc (how the hell a shareware soft could try
' f: U- h1 b( P2 rto load/unload a non-dynamically loadable driver such as SoftICE ;-).0 y5 D0 u$ Z/ S& x$ }
If the VxD is loaded, it will always clear eax and the Carry flag to allow! O5 g. L7 v/ m% k' L7 h
its handle to be opened and then, will be detected.
5 a" \$ o4 |; oYou can check that simply by hooking Winice.exe control proc entry point  ]2 B  t* a8 j9 ~0 k
while running MeltICE.6 {# [1 r& I0 Z3 k' J. |
; |; M" H. b4 Y/ I6 K6 D$ i: ]

) C, W" s2 w; P& G" W  R2 F  00401067:  push      00402025    ; \\.\SICE
6 a% t5 H3 ~7 \1 y1 v  E  0040106C:  call      CreateFileA9 D/ v. t+ F) C
  00401071:  cmp       eax,-001
& P0 F* j9 Y" o( ]  00401074:  je        00401091$ P* d3 N/ Z0 p' K

* r( F/ a! V1 }" n! H
$ A. p( E9 Q, R/ q( w" oThere could be hundreds of BPX you could use to detect this trick.3 A7 w8 O3 I# M
-The most classical one is:# \" a" I& C: M* a
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||* i  q- y! l- d8 d' h. N" e& c
    *(esp-&gt;4+4)=='NTIC'
+ G  ~/ T8 W: `3 ]: @7 D
! m+ B0 p# A. ?5 Z# M-The most exotic ones (could be very slooooow :-(# q# g( t5 p; i  e# R8 v* @/ l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  1 B! _7 B1 X  n! t+ `. Y
     ;will break 3 times :-(4 q. F  n3 I( D  P0 l" b' T

* i- f* g& v) o3 f4 E; l-or (a bit) faster: ' q2 ]3 {: G# F- @. o% ]: C6 b
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'); S% f' m7 c4 o  I6 C
3 i' E* D  D* A* t" p* Z3 x8 a& K' q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
0 r4 j0 h( [) K2 N9 A     ;will break 3 times :-(* H5 [4 S7 x  L" J) G

7 C0 m! Q# p& K8 }# Y-Much faster:
, [; X" d+ m6 ~1 o8 f   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 m2 Q' Q# f, L9 s& d4 n

) ^* s) ]7 \+ G3 bNote also that some programs (like AZPR3.00) use de old 16-bit _lopen2 P. Z$ P' {$ Q  ~+ I
function to do the same job:$ C  z+ ]! `9 [% H( L4 U
1 s4 F6 {* o& @6 B6 L0 H# j
   push    00                        ; OF_READ' ?( }- v3 L% g& v: R5 k- {$ ]& x
   mov     eax,[00656634]            ; '\\.\SICE',0
# `3 U% }8 p4 X9 T% `, @* o8 k: t   push    eax9 h4 k0 ?3 `: H( y2 j
   call    KERNEL32!_lopen2 {! |. b$ N+ T* K; O' F: h1 M
   inc     eax  L, N9 z, h+ ]1 r, D5 F
   jnz     00650589                  ; detected
8 x6 o7 J7 z) ]9 ~   push    00                        ; OF_READ$ c& l9 h+ m: k, q. @
   mov     eax,[00656638]            ; '\\.\SICE'
- M$ a' c( f4 q  \   push    eax& \& A5 _- {* c3 M
   call    KERNEL32!_lopen# s2 r- W3 l7 Q) i& f  V6 p5 W
   inc     eax
( p  S/ T( e2 P. `; F3 _$ @, e   jz      006505ae                  ; not detected
- C8 e& ~9 p' n4 {( {' p8 H& g) h/ h  o# s  T1 V" J

4 u8 b9 f( e& q__________________________________________________________________________
  C* W" [5 U- Q7 E+ c9 m& c& e/ ]$ f/ A% Q. z; d3 e' @% Y
Method 12
9 A+ Z! d+ J- q% V2 ]=========/ Q: l' ^% f7 t/ c8 B
+ W8 m- Z- l9 V! F2 o& e
This trick is similar to int41h/4fh Debugger installation check (code 05& v! a% g8 b( g( K. ?! I0 }
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ m+ u3 Z$ _! y# I# was it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 r' e$ h5 Q/ K4 g9 e! x5 C# o0 A- G% _
   push  0000004fh         ; function 4fh
. d! a& d* u4 P7 ~2 P0 G, p   push  002a002ah         ; high word specifies which VxD (VWIN32)  k5 h/ K$ b% b8 \6 y9 u
                           ; low word specifies which service
2 {) U, _7 ]4 l# X                             (VWIN32_Int41Dispatch)
- z6 T5 F9 B+ m# w/ n; t' @   call  Kernel32!ORD_001  ; VxdCall
7 L: m# z7 P- a( J% }( L   cmp   ax, 0f386h        ; magic number returned by system debuggers
# ?: g# c8 a( f# j2 [: Z   jz    SoftICE_detected
' A- c, q- [1 [; w+ m) Y
. @: {# g  q6 Z$ U8 M5 WHere again, several ways to detect it:! ~3 D9 K0 }3 ~0 Q8 M- A

6 R+ V: _  w# D3 Y% Y    BPINT 41 if ax==4f: |1 s: b0 x! G5 z4 B& V

4 [, s6 p5 }: F6 m/ `* U& z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 v# C. u" n8 q
+ J1 ]6 D# M& j3 K7 P" _3 k    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. q4 v9 J& |5 Q; Q6 p9 B) U

: s1 Y5 b: m1 Y$ r' t    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 W- w0 ]- ~9 |* O- [1 X
, O# J" J' l6 {0 J, _
__________________________________________________________________________
0 c( r' [  s6 }5 V* R- R2 {% C0 B# e2 Y, j
Method 13- h0 T+ c/ A4 z/ o
=========
/ o7 P8 j$ |, e1 W1 l
$ K' I7 b: g* D5 C" t& fNot a real method of detection, but a good way to know if SoftICE is
! K& {' K' y4 S! N3 Einstalled on a computer and to locate its installation directory.5 b- V% a4 ?. j4 ?
It is used by few softs which access the following registry keys (usually #2) :
) u, Y* k* i  D- C
. u: H  I7 f, O4 O! m! [+ J-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- f' r7 B. @5 E: D; H. {
\Uninstall\SoftICE* f2 c! H+ a$ n9 C: s  P
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( `8 Y/ \$ U( a1 U- a) H-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( e  `: E4 L0 b' ?/ `6 Y% M& Z+ t\App Paths\Loader32.Exe
, X9 }2 [0 K. Y3 ]9 G5 e; ]! S+ K+ u  U0 I# s1 i

; t) r: f& t/ Q7 {* P  t5 ^Note that some nasty apps could then erase all files from SoftICE directory, i5 @. J8 U7 u3 G; K) m
(I faced that once :-(
. ?. l% m5 m" E0 u3 A! c3 w/ {4 m( X2 [
Useful breakpoint to detect it:# N8 i2 L) D& @
+ P! Q0 T: c5 @; N
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" v. h5 P! O+ a( N( Z2 d( I6 S, S. s4 E" a
__________________________________________________________________________
" N8 c7 G' u6 c- y
( |' |" n# [$ S# N9 l' X3 v7 H8 V! D' X( g5 I* P- p
Method 14 ' y# i- H* U' q- w
=========# b% A- ~; W7 F" V$ O6 x
+ c5 {9 V9 u2 J2 Y6 ]
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, o6 k5 H) a( Q/ ]6 w" y& ]8 Wis to determines whether a debugger is running on your system (ring0 only).
' q9 O  |6 T+ p. B2 y2 G9 e# l2 @% N) F! [% [
   VMMCall Test_Debug_Installed4 \% P# e6 ?6 E% `3 v7 U
   je      not_installed# ^% W% O+ N. O) R- h
  p, ?" `/ c4 I. T) S3 C
This service just checks a flag.
* H' ]' @+ e- z! e) Q- f3 L! ]</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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