找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& r4 b; D0 Z) Y. X) [<TBODY>
; ~, |4 z6 J; C<TR>5 ^4 f2 o; o# k6 b" Q% B5 w
<TD><PRE>Method 01
+ X& W& u; z( @# p4 T+ C; Z=========$ U1 a7 B9 Y# {* N/ m

5 c; P( U4 p0 L% ~This method of detection of SoftICE (as well as the following one) is
" A5 @/ Y- _" |: R' E6 o6 {0 uused by the majority of packers/encryptors found on Internet.+ y# D1 f( c7 t! ~8 F
It seeks the signature of BoundsChecker in SoftICE
) Y! K" k4 [$ b
# A  z& `0 ^3 V0 k$ D: q8 Z    mov     ebp, 04243484Bh        ; 'BCHK': A  g7 }9 x: X
    mov     ax, 04h) ~/ m. h# D; m) D# {
    int     3       & ^5 g6 R+ J: [, m- {; a" F- G
    cmp     al,4) ]' r$ \- h$ b" U
    jnz     SoftICE_Detected
# b" D) M$ e: r$ g( u+ B5 j$ q9 c1 x" O" W  ^
___________________________________________________________________________- l: n" b4 p3 u: [/ S

4 y! x8 x/ m$ W0 n  t8 EMethod 02
! g& i; C  m# V8 I! N$ j- |=========6 G% D+ Y: B1 p( k
& |4 `: m5 u& E  K6 T7 x
Still a method very much used (perhaps the most frequent one).  It is used
  I( Y1 [+ p9 t. K$ `, S5 gto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ k4 {: o) d& _1 z* g1 ^& Hor execute SoftICE commands...
( s9 x8 B. A# N9 _  jIt is also used to crash SoftICE and to force it to execute any commands4 k( u8 [- q! v) q
(HBOOT...) :-((  4 m% A8 f1 H+ p4 [8 k9 u

) w3 |* g: f* c" pHere is a quick description:
5 I, R" V: f# G# W" `-AX = 0910h   (Display string in SIce windows)7 }) r. {/ f$ t* E% l, Y
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
: j3 }9 y5 z- b9 h& j& T& h-AX = 0912h   (Get breakpoint infos)
! {$ g/ i+ a. s* q-AX = 0913h   (Set Sice breakpoints)  b& d( F( h7 Y: Y8 R! N( i
-AX = 0914h   (Remove SIce breakoints)
' I% q6 a- V) b. j% p/ p- ]4 t! M/ V8 e/ m: U/ k
Each time you'll meet this trick, you'll see:' \9 U9 a2 I7 d1 x8 [2 o  r
-SI = 4647h, e" q* v3 O) b9 ]
-DI = 4A4Dh0 ~  g9 N, [( p. N2 c( \# F; F
Which are the 'magic values' used by SoftIce.
' w) _3 P, I! y) yFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
2 F2 [. L, e. B, \0 }$ o& i2 O# E; m2 z2 X7 v: P
Here is one example from the file "Haspinst.exe" which is the dongle HASP# e0 F0 I. F. S
Envelope utility use to protect DOS applications:5 ^4 Y" A% c; x- [& y2 F6 o+ P' s
3 x& `  a& m- t1 y3 E( F
! t6 N7 \0 W4 G* t0 `8 F( L' L
4C19:0095   MOV    AX,0911  ; execute command.2 Y: D. Q3 V% ?: w: _9 R0 y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 b/ P$ V, ^& m9 b+ ]- [. \8 m4C19:009A   MOV    SI,4647  ; 1st magic value.$ H7 j2 s7 X6 I
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: v- ]! {) C! k) t9 P2 e
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 r7 X  A) o  v$ W
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute& |/ L. {/ _/ O$ C" D( O9 W! V
4C19:00A4   INC    CX: _3 L! }6 r2 ~9 [) X% [& Y' g! X, L% M
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
/ O7 V* G% n6 h$ ]9 I4 {& x4C19:00A8   JB     0095     ; 6 different commands.
% y4 Q8 @* F! e5 d' z+ u4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 j% O: I7 ^. U6 r  \0 c) y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% W) k0 }& A5 P# B& O2 E$ f0 d: p' }( E* Y/ E; y* h8 u
The program will execute 6 different SIce commands located at ds:dx, which9 s! E2 S- e0 U5 \; E
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
4 I0 l( s2 ?# q
5 f; }7 L- v2 j+ P+ o0 {* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
" ~0 Y  ^: H) l7 U___________________________________________________________________________. L7 }  @) Y" x' [( y3 E0 n
9 D5 v) P/ Z$ x) {
4 b: e+ N4 D9 O. C/ t% P7 V
Method 03
, c% B9 g0 c+ x( r2 k+ N7 Q6 P/ Y=========( e6 I" G0 r; q- F$ r
& C- c! I6 A2 M& \
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 T4 d; K. Z4 G
(API Get entry point)
% n/ g# X; q/ ~$ r        
4 E) c, V7 A/ S, E( ?5 f: l6 r9 ~
; P1 y! T% M5 F; e* u    xor     di,di
6 o5 H% F7 p" L    mov     es,di; Z# j9 B0 y/ T' ]! T3 A' C
    mov     ax, 1684h      
0 S0 A$ c7 K! [    mov     bx, 0202h       ; VxD ID of winice
' v" m0 b0 V( |( i    int     2Fh
6 k$ F) s* ]+ S$ ?# W    mov     ax, es          ; ES:DI -&gt; VxD API entry point9 S6 T. j& s2 f6 E' B
    add     ax, di
1 p* D' `9 i  @4 {( }" v$ [* o+ A* G    test    ax,ax
0 j0 P1 K8 L. m7 Q0 t8 q3 \    jnz     SoftICE_Detected
  d' X: U& g0 K$ E
1 Y4 Y/ \+ h' ~9 m9 I9 f* A' Q- O( h___________________________________________________________________________4 V; A' \. ~, R7 A6 B) s' J+ \5 d
" K/ g3 ~3 N# Q- p& x
Method 04" n  l+ Z( p  F
=========9 ^8 |' j7 @: a" {) ]8 A
) e/ G7 h# F1 w% g  B" I0 J- g
Method identical to the preceding one except that it seeks the ID of SoftICE
( S7 U( B# i  U  l; `8 rGFX VxD.' u$ a" M- |3 ?3 M" U# i" @

' u, [6 I5 l3 j! B% q7 t    xor     di,di0 |3 {7 {. X: l' M) O% Z
    mov     es,di
2 I7 F" _+ u8 R' ]: a    mov     ax, 1684h      
7 b' I. S1 L6 k& X7 y0 e4 z    mov     bx, 7a5Fh       ; VxD ID of SIWVID, R- [" d, r# W, K# F1 U9 N
    int     2fh* z, t: y/ {0 W! W7 I. x- L
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  A. Y) B/ S7 f) Y, ]% M    add     ax, di+ G# n- r5 t( R# e- s) S' P
    test    ax,ax
$ B* f. w$ I3 w1 ]. g: F    jnz     SoftICE_Detected
+ n* x; W$ e3 y
. m. ?, @% [9 W% I5 u__________________________________________________________________________4 k# I5 M; n9 T, w$ W8 |

3 Z9 f. V; A4 Z- ?8 I2 {0 c/ o! y' C4 V6 X2 h
Method 05
% n1 F, P' L; c2 A7 J=========  i$ I) u! X1 `8 a: z  g
: r( V! D$ |. w/ M5 T3 i" W4 ?: l" b9 s
Method seeking the 'magic number' 0F386h returned (in ax) by all system" r" c6 v8 n* t$ Q% F( q& |
debugger. It calls the int 41h, function 4Fh.
/ X/ M" H8 K( aThere are several alternatives.  ' N! J$ k. C) @1 u! s, n
0 i8 Y; Q" V9 ?  v8 D' u
The following one is the simplest:$ F2 j' u0 m5 e5 M0 T
) t7 [4 ~- W( l% h) o
    mov     ax,4fh
; n5 ^$ E/ U( S( q3 z- l. v1 k" T    int     41h: q5 Q7 f. y* H- P1 b' K! M
    cmp     ax, 0F3862 U0 _+ x5 _3 P, H
    jz      SoftICE_detected
4 x: t- [# e( p; ~# n$ [% g8 i% ^  ^3 @2 j$ d

9 H, Q5 q! Q% o( P" KNext method as well as the following one are 2 examples from Stone's " h3 I5 S. q; O
"stn-wid.zip" (www.cracking.net):
/ h! n4 L" A$ I6 h
( k7 i- ~- g. d; y    mov     bx, cs" D* B+ v: w) ]! `: O
    lea     dx, int41handler2
% R+ i- Y- k& G; ]    xchg    dx, es:[41h*4]6 c" V; `) ?( J5 F9 X
    xchg    bx, es:[41h*4+2]. ^% V; h# }) |. k, o5 i# C
    mov     ax,4fh
7 N( Y" L: o; N  x3 F    int     41h9 h" E9 }) z; |+ @- g
    xchg    dx, es:[41h*4], M5 _; V9 r" p3 Q1 L9 }3 Z3 ^
    xchg    bx, es:[41h*4+2]# v1 Q: N3 o) R" Q$ ~
    cmp     ax, 0f386h
: K2 l) Q: J2 l) C* \9 e. c    jz      SoftICE_detected: L/ `8 m# F7 {6 U4 d7 G

- m0 P" V! t: _  s5 q1 _/ Gint41handler2 PROC3 T! j' Z8 g4 c0 H/ z" f- w  `
    iret. ~! @* j  I0 h& A0 {9 B# G
int41handler2 ENDP
2 k$ ?+ U2 R8 Y2 ^7 c2 j" q, r& @9 y6 U& s1 V6 U( a  a! H- C/ V

$ ~, q" ~! Y' y  t/ r_________________________________________________________________________8 v% I! ?$ b% p2 c5 B6 n

0 ~* Y- L7 E& H) ~- Z: w8 |) x8 ^& Z2 B( }
Method 06
" Z. h$ l) H+ U+ M8 d2 p=========
% p2 g4 ~% v7 r1 f+ v$ x  K8 j$ A) ~8 o# c8 k% ?7 k; v) ?

! a: {" K7 t4 j' B3 w6 Q2nd method similar to the preceding one but more difficult to detect:
! }5 m; N5 C5 }8 e/ U. ~3 X/ f4 j: A/ A6 }5 q0 y" Y& A7 V

0 Q1 M& {0 Q) yint41handler PROC
( b( Z' z: Q5 [% M9 P3 y( m    mov     cl,al, E1 N; X) k5 G1 B
    iret
0 V+ l9 C* D  E$ c& O2 j8 u4 l1 c- Vint41handler ENDP9 g4 L: z0 }0 P
0 f8 C7 [( [# R7 f& @+ e# ?

! j+ R9 g) K: B- ]& l2 O    xor     ax,ax# }/ Q. O% u5 N
    mov     es,ax
$ q; [: k7 |6 T; {. r6 S- [    mov     bx, cs
4 h2 h; _, o3 v    lea     dx, int41handler
% M& u) T! \0 g5 U    xchg    dx, es:[41h*4]) Z$ q: |" p( P& _4 \; \; e0 y
    xchg    bx, es:[41h*4+2]% W3 r6 [& u7 U1 u
    in      al, 40h: c3 y3 ~6 v+ S: m
    xor     cx,cx) c  J1 T6 J2 d3 }+ ^$ x
    int     41h
( Z  N* [6 ?9 _! U+ M, T, X    xchg    dx, es:[41h*4]- u& x& _/ b5 Y. o: t; y
    xchg    bx, es:[41h*4+2]
" }3 `( @0 Q1 n8 I( s4 [# S    cmp     cl,al0 M3 `; y, P# k+ m8 w+ z
    jnz     SoftICE_detected  O3 S  k( G+ c2 o; L4 b
6 H+ @0 c" w( C: w; I; @+ i8 R
_________________________________________________________________________
8 Z% v/ S, o5 K
0 z+ L( b; s3 e1 `Method 071 d( {. ~( R, X" s  S* h
=========, ?8 e: H6 q2 C. x4 D

- g" Z8 U  a& _7 B, z% K) `Method of detection of the WinICE handler in the int68h (V86)
- `5 t* F1 d: v' b% v
( v0 E" U! i5 [1 ]6 t    mov     ah,43h
3 y/ `) K. G8 g! ~" Q9 t  {    int     68h
7 d8 {/ z8 R5 @; ~1 E) A    cmp     ax,0F386h
3 _# O& ?  F" j5 S  T# ~# E% i4 p    jz      SoftICE_Detected
1 W8 n+ o5 E% e1 |; C* v* k# K4 x! G4 g' L; }+ q

" n  h) c' A& N1 A=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' A5 p# l0 k0 D- i
   app like this:
, Z, h  K* A: T% X; O5 j) x" D& f6 Y; s+ Z
   BPX exec_int if ax==68
: ?  P. V. A) s' {$ ~/ I7 H   (function called is located at byte ptr [ebp+1Dh] and client eip is
# J$ z$ p1 y2 m$ e7 n# G* e   located at [ebp+48h] for 32Bit apps)$ L/ W2 K' w- Q! q9 P
__________________________________________________________________________
* @% n; c1 z* v2 ~$ O( N6 o+ I* Q$ A% ]) G1 v( |6 B
9 `' O2 b& _7 z/ y/ k
Method 08; T% ^# u% j) b- q
=========3 A; V7 C! y2 X) E

  w" A( f. ], J0 }8 z, t& hIt is not a method of detection of SoftICE but a possibility to crash the
1 a- E6 g( Z5 V$ P: o8 N7 g4 x* }system by intercepting int 01h and int 03h and redirecting them to another
% e, x1 g- X- u( t4 T3 troutine.2 j1 x0 k& ^: b5 `
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  d* Z1 F# G+ m7 R& E% Pto the new routine to execute (hangs computer...)" P  d' S: j6 d& M, s. ~

, i# E, s; ?  ?" i+ o    mov     ah, 25h6 w3 e3 o4 Z# A: Z
    mov     al, Int_Number (01h or 03h)
. Y- Z8 H# y/ U! M6 R! o    mov     dx, offset New_Int_Routine8 U! P. B  u; d, d9 e
    int     21h
% j$ i. O' p3 z2 p3 C
" u. U2 l3 T% U( b9 t+ ^. C8 w' F__________________________________________________________________________
% `& Q% j7 {3 W/ a; \* {+ }2 |7 X, i. \* L9 F; E/ L+ S
Method 09
: p3 T: D2 `. L=========" D+ l, A1 M: x0 T" _- f" b; E' B6 G, D

$ Y" X* W: P* }& `1 y2 _7 [5 }This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only. l/ b; _7 ~8 g) b# H  d
performed in ring0 (VxD or a ring3 app using the VxdCall).* V: A. x% b8 D& l  P
The Get_DDB service is used to determine whether or not a VxD is installed- C( p$ y: R2 s7 Y( T& ]! t: i
for the specified device and returns a Device Description Block (in ecx) for
+ I6 U8 [$ O' z+ z) T0 Uthat device if it is installed.
2 _8 O: X& M! u/ K; C2 I8 G3 S
' Q+ h# g) G2 E( X+ P6 {5 w   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
& R' e: B- u3 a- T- K; Q) G) S0 o1 M1 U   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), a, B- {1 Q8 f
   VMMCall Get_DDB
* V) m" ^$ ?0 y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed$ @( R% s, N, z: g$ `

: }3 H" ^* ]4 G& i' B3 o6 R; pNote as well that you can easily detect this method with SoftICE:: O+ I* B+ c, J2 q: j8 B
   bpx Get_DDB if ax==0202 || ax==7a5fh, C+ [5 @' h+ o; ~1 n0 h6 l3 ?, q
6 z+ v) _" q  G1 V9 @8 V* C' Z
__________________________________________________________________________
. H0 n+ l1 {9 l! b3 c; ]6 f" o: D0 |& ]9 l) ^" ?$ D- }3 r) O$ E
Method 10
) ]" V1 v# t0 y. |=========0 j; f! L; S4 R7 P  {
3 D  _& m& ~3 l* x
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with. J# K0 R5 e* i1 _7 ^
  SoftICE while the option is enable!!$ s/ k/ d! Y/ l0 }9 j/ e$ y6 I
  c5 X! P9 X* o$ X! h
This trick is very efficient:) f- x0 V, [" x7 A
by checking the Debug Registers, you can detect if SoftICE is loaded
3 ?3 u: @7 x1 f(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 e3 A' }$ x' t( h% Y
there are some memory breakpoints set (dr0 to dr3) simply by reading their0 }2 M7 A/ N" O0 O" ^( p
value (in ring0 only). Values can be manipulated and or changed as well
/ f; t1 c' @+ T6 e0 y(clearing BPMs for instance)
0 B" K4 J; D0 \% i# O" H" D. U) V9 G7 l! z& b9 t# y' u6 k' S
__________________________________________________________________________
( `: h  u- t+ f6 J5 n3 u9 M; e4 `4 n  d
Method 117 G3 a& r* Z+ ]4 X
=========
0 X( U7 W3 b% C# g( b/ ~7 X' W- r( _) b0 J. Z% n; Z
This method is most known as 'MeltICE' because it has been freely distributed: y4 J3 u% M% u( O
via www.winfiles.com. However it was first used by NuMega people to allow; Z# i  p! S. @
Symbol Loader to check if SoftICE was active or not (the code is located
9 `. |  l1 `) E8 t- g0 Jinside nmtrans.dll).
2 `. }3 T" F/ Q" A& J3 t" ?% u$ ~0 E( ^9 @( O% x) \
The way it works is very simple:( s2 u1 I* i  [4 Y/ u3 w
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
/ W& o9 J" U; D2 j4 I3 E, fWinNT) with the CreateFileA API.
# T# e) Y- K6 c  r! f) x% ?4 E7 B: k2 G' [; G* U
Here is a sample (checking for 'SICE'):
' j* h: |  I3 b! ~3 b7 J9 A2 U) v# |  v. [6 ]6 D1 e
BOOL IsSoftIce95Loaded()
5 u" a' p0 Q! R4 l; h+ z" O{
: ~4 n1 c8 L$ O3 I- U( L   HANDLE hFile;  
  L  ]; X; t6 ]9 Q' G0 C! P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 U. D$ i4 _; y* U1 u' l
                      FILE_SHARE_READ | FILE_SHARE_WRITE,  v$ R4 W; C% @# W8 w; P
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 Z8 H7 f/ i9 y" L9 I2 E$ b   if( hFile != INVALID_HANDLE_VALUE )2 m" o  C: {9 k4 f
   {
1 A* y! S2 F2 z1 G0 N      CloseHandle(hFile);2 T) ^1 c: l* p* b+ K! ~8 b* o
      return TRUE;7 c7 y0 y$ I$ n  b1 H$ a+ d7 Z% T9 s
   }
8 [! d* ?6 e; Q2 w   return FALSE;
0 c; Y7 t% @( W5 x1 B}
1 v0 Y" c! c; I' b% t! u, C* J0 o$ H  m. T
Although this trick calls the CreateFileA function, don't even expect to be% H9 d2 ^8 |- Y6 z9 _
able to intercept it by installing a IFS hook: it will not work, no way!
& d9 b- |1 h6 O) U+ {% l4 X5 S: TIn fact, after the call to CreateFileA it will get through VWIN32 0x001F- H. @/ e5 h! s: l; ^( D
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! K/ Y8 z  \1 T4 U# A/ F  Fand then browse the DDB list until it find the VxD and its DDB_Control_Proc
; t. \7 z8 R. K' @1 xfield.9 X# j  g. Z$ X9 G4 b' `) i4 r
In fact, its purpose is not to load/unload VxDs but only to send a # W, S4 p* o" _! B
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)$ _! D+ Y$ E# \2 S1 a
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 e9 r7 K7 T) ~9 V$ z( Wto load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 V/ F2 B1 i5 z( iIf the VxD is loaded, it will always clear eax and the Carry flag to allow
9 Y) V7 M1 @+ n1 {5 m9 Y  k1 b; Oits handle to be opened and then, will be detected.
8 b3 t$ o# K5 y3 E0 `You can check that simply by hooking Winice.exe control proc entry point
0 t7 u% y3 W2 N$ Pwhile running MeltICE.
; F6 b4 L, A1 @, X) {' a% `7 a  ]% M6 g1 _
% ^# l2 z9 q1 X# _4 A# t
  00401067:  push      00402025    ; \\.\SICE2 Z/ S; K! T4 Y' k0 U
  0040106C:  call      CreateFileA7 M% J' b: {# T
  00401071:  cmp       eax,-001
% H- e; |+ N- l, w  00401074:  je        00401091* N, }9 [) d  P7 p- l8 E

% \( Q4 z0 ^1 o8 L% B
+ ]4 h+ l$ [3 ?" }# j6 d: sThere could be hundreds of BPX you could use to detect this trick.- ~% t9 f* {! B! H: m* h
-The most classical one is:
# O( d! ?7 l$ k- \" H6 P3 b: S/ [  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 R( H' p, t# k    *(esp-&gt;4+4)=='NTIC'
# w2 S9 F& j$ w  n7 J
; D/ d- v5 `$ a0 q- o( N% c-The most exotic ones (could be very slooooow :-(
8 f' `. t+ c) O; G! a1 H) X/ |& w   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' `# a5 ^! l! }- G9 [3 p' I
     ;will break 3 times :-(
+ `- a% J' l5 M2 g; r% o+ e
4 ]9 y2 I0 Y3 u6 z-or (a bit) faster:
+ @* z' j& j9 k   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ h/ a  |7 `1 e% v3 H& l5 _, S$ f) \4 B0 H8 o, V/ G: s" F
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( b- i' y+ _6 R6 ~
     ;will break 3 times :-(: S3 T/ t1 j" V2 N* W3 u* t
- ~' r  r, _) Q  v, _" ]
-Much faster:
) L, n2 e* `' h7 g   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
: L! Y# ~# X' |/ c2 W) {1 m( k: X" a7 I" y. T" C8 Y
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen* d2 {: W0 L; {
function to do the same job:
& F% G' f1 |, ^9 l9 d
% v! x8 j+ ~; B$ {  f   push    00                        ; OF_READ
" a! |# }7 d( q8 N1 `+ x2 E. k# F   mov     eax,[00656634]            ; '\\.\SICE',0
# x$ g  @" c& V9 z) y" u   push    eax
( S+ [; Y% e" d% m" X# @   call    KERNEL32!_lopen
2 n) E6 ]8 ]! b: F2 o   inc     eax. N6 j+ a3 V! u
   jnz     00650589                  ; detected/ O: j, P& @) N
   push    00                        ; OF_READ6 f% N& d3 a  U3 }
   mov     eax,[00656638]            ; '\\.\SICE'8 O7 V% i4 U6 x$ a' e" W# V' E1 A
   push    eax' @  ?# z! a% i3 G9 p- ~: w' v
   call    KERNEL32!_lopen
0 D# D; i  t2 m( h' F7 p$ n   inc     eax9 Z( j+ E7 b7 Z' V* L
   jz      006505ae                  ; not detected; ]% i  f6 J: l& Z) ]

9 S4 J/ ^" T- n# r  A+ P( ]# B* _0 R5 n9 L' P
__________________________________________________________________________
4 F& r' `  G; R4 \# _! m3 z. y: v% h, I
Method 126 O( S, H- u9 d1 g) B6 |+ H
=========
6 @/ n7 F" d7 U# C0 H
8 c9 U1 l8 r8 y  uThis trick is similar to int41h/4fh Debugger installation check (code 056 e+ ]2 U  D% h7 J8 E( `8 p3 V% L
&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ e  g% G! R2 P+ E6 v( v+ o
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.( F- r( S' X8 w6 W! T8 _
- t( _4 d+ D* j$ K
   push  0000004fh         ; function 4fh
: @: k" g( C. I1 x   push  002a002ah         ; high word specifies which VxD (VWIN32)$ b, l7 s4 z. C7 t& @, R0 a7 j% M
                           ; low word specifies which service
+ i$ h& x( M, y6 }/ m  J                             (VWIN32_Int41Dispatch), {: G7 M5 y( \/ n6 l
   call  Kernel32!ORD_001  ; VxdCall
1 s9 O$ Y2 J+ u# Z# i9 S   cmp   ax, 0f386h        ; magic number returned by system debuggers
) R6 n, e2 v& H! V) \   jz    SoftICE_detected2 r7 m) f5 H1 B% g6 a  L
7 e. E, `9 |3 g' w# Z3 Q. e
Here again, several ways to detect it:9 t, p  t0 C+ q+ D- n
. C# C. }7 I: l. |' I
    BPINT 41 if ax==4f
; \3 Y1 E3 K( J; ~" Q: _. P( ]2 K6 A6 p# m: p) v) v
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& H5 U2 X/ {6 y2 X& E
5 f( ]7 i* @- U3 b, Z0 |% y4 f    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 T" w2 ?# A; q$ P
+ Z0 x  [& ?' s! Q
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) }8 F( |2 A" `* g- f$ Q* C5 [6 J: A! o
__________________________________________________________________________- R- y5 S# ~  \2 ^0 y3 e! H
9 }; _' N' y2 i, p* w$ ]0 Y% ^
Method 13
6 y8 p" [; \* v/ v=========0 ^7 K# M. Z, h& ?9 m

6 o) ~1 O9 c3 M4 G. h1 Y4 q& iNot a real method of detection, but a good way to know if SoftICE is
8 N& g6 o7 |( D# K( q$ @5 g- minstalled on a computer and to locate its installation directory.
, ]! Z, b# U# h& c- h# k+ yIt is used by few softs which access the following registry keys (usually #2) :
: {- B8 @: n. t  _) R) Q
  Y7 [1 L9 g( V* l' s-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 J- F* h* G1 U# f& K# k
\Uninstall\SoftICE
+ q8 V9 l$ u( [. Q$ s-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# e# z0 y; Y' r6 ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: V5 f7 e4 E' `: O0 Y# u1 l
\App Paths\Loader32.Exe0 E" b- G6 _& f+ ]3 E+ G" _. I
0 F7 n4 n( @8 Y0 {' R0 {
& m9 x1 F! L* o/ d
Note that some nasty apps could then erase all files from SoftICE directory# \  \" L5 e9 ~( S$ n1 Y9 c# Z
(I faced that once :-(- Z- W0 H5 j' e' @

1 r( k7 t: r" B" ?4 d0 pUseful breakpoint to detect it:
# U; u8 S' z/ B# p
: k7 {1 O* X% _) `" i$ J6 e     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE', {- q! n/ j* v
9 ^1 V0 C9 N- m& @/ h( O
__________________________________________________________________________, }# X  Q; w1 Z

! f- I: J3 H/ c) j( @* `( X& e8 A( R. ^$ J0 S5 Q
Method 14
, ]) X& D! Z9 I  ~! Q) T=========
* c4 {' z- j) \* j% }- L7 U$ S8 ^: ?) r6 w6 x0 L2 G6 w
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 c* r, O- t" H5 C& Nis to determines whether a debugger is running on your system (ring0 only).5 [- q3 ~. ^" V% f! M' h6 ~
( R0 y2 @! T( t+ K- a
   VMMCall Test_Debug_Installed
& m& d5 w0 E' j& H: o1 ^3 j   je      not_installed3 @/ u  @# ~# ?2 ]9 x: L
( z* q) K8 W, w  T* k
This service just checks a flag.  {# V4 O. e# t
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-7-21 00:39

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表