About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 H0 t2 i2 K) C% b+ J
<TBODY>
+ s0 |! J, k6 v  u* w<TR>) d; g1 ~) x- l; x  S# U
<TD><PRE>Method 01
9 ^1 A/ [, z$ d7 p: W2 h=========
( b2 U0 o5 G8 K3 e9 v! e  l# }! A
; G1 U6 w9 ^) U% b9 x0 B; J$ f* mThis method of detection of SoftICE (as well as the following one) is
% I4 y3 n/ v1 Z9 cused by the majority of packers/encryptors found on Internet.! a9 M6 u4 a9 s! B1 e& X8 J  @" e, _
It seeks the signature of BoundsChecker in SoftICE
4 d: {! e3 U8 h9 b3 Z/ r, O# H% q; L
    mov     ebp, 04243484Bh        ; 'BCHK', Y- b  ?4 A7 i
    mov     ax, 04h
: G' k* A! o' n" l/ u) @8 Z0 d    int     3      
4 L( h8 w' S) C' }6 V    cmp     al,4* R( q9 ~& X  f3 N: v
    jnz     SoftICE_Detected
5 y8 t; C4 c; Y- |+ V& S, [' ]4 L) z2 g* k! I
___________________________________________________________________________
! E+ r. G7 h  |1 Q- o9 a" U( g: W# j
Method 02
3 y& R, B7 D5 }=========+ Z  G: {. i- V2 u- J+ k* d3 j
- T, h- T2 s1 s" Z; s4 S& Z8 E
Still a method very much used (perhaps the most frequent one).  It is used# n9 m$ l, s- G" R6 K
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, ]1 ~! n2 X5 k; \or execute SoftICE commands...
) y( w; Y! H! i1 f% d) ]3 ?  jIt is also used to crash SoftICE and to force it to execute any commands9 c9 @) T+ s- L+ ^& Z, `0 w
(HBOOT...) :-((  
/ H# g  V8 K: t; E# J9 q: ^1 N4 T6 d- d
Here is a quick description:5 B2 W( a) J" n5 i% h9 M- F
-AX = 0910h   (Display string in SIce windows), B! N9 S. d. c3 W$ |: v, g( R
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)# [& W2 _+ s6 A% Z
-AX = 0912h   (Get breakpoint infos)
3 \# Z) ]( c7 \) W* `* _-AX = 0913h   (Set Sice breakpoints)
: ?/ F, o* b/ R( l/ W. V, ]0 |4 w7 Z-AX = 0914h   (Remove SIce breakoints)1 z; H6 q3 I, ^# o6 G

' `, y% x+ j8 S7 ^! |  {- WEach time you'll meet this trick, you'll see:5 j  i6 `/ v- O2 R4 a
-SI = 4647h) d8 d; i$ t8 a( K* ?5 d
-DI = 4A4Dh) b, d) u) D* e7 `6 i
Which are the 'magic values' used by SoftIce.
6 y0 m7 z5 n6 K5 x/ n: d. sFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.' f4 w2 Y* J, X; }. B  Y- j4 g5 Q( a, E3 {

  d8 P# k6 M* }  c" a7 K$ ~0 AHere is one example from the file "Haspinst.exe" which is the dongle HASP
" ~- A6 V7 f% p/ c2 b" D' s0 A# j" NEnvelope utility use to protect DOS applications:3 D* }8 X) P8 A! s3 ^% g- V. G
. `% l) q, B/ E+ {& m
3 f; [9 I: V3 S7 Q, V
4C19:0095   MOV    AX,0911  ; execute command.
  z+ J" [: Y. M# k4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 \8 G2 M4 o0 N$ w* C. j' ~5 \2 a
4C19:009A   MOV    SI,4647  ; 1st magic value.
, \/ q; b! }4 ?3 P2 Q4C19:009D   MOV    DI,4A4D  ; 2nd magic value.# d4 A$ H; {3 t& x. N
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" T# c) T7 S) w" G: g0 e
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: G# @4 [9 ?; ?' L2 X7 D
4C19:00A4   INC    CX" j: Y6 g3 j2 c: m- f1 J1 `8 v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" }4 y' H5 e% w4 a6 J
4C19:00A8   JB     0095     ; 6 different commands.2 f1 E& x% J4 z4 @
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 S. v1 x5 d/ Q! g6 p/ J
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( U/ a/ ^+ h/ y/ I3 Y. y  ^. Z
; i1 R5 _) A* I7 v/ UThe program will execute 6 different SIce commands located at ds:dx, which& N, ~- i3 }+ h% [1 Z  \
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! i# M% C2 b/ A- {1 o
2 M. i+ n& T0 E! M* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ y' v8 G) L/ P4 o+ f8 d___________________________________________________________________________
9 a/ L$ Y8 c- P" j
' W$ c& a; t7 P- F$ }8 F+ J  Q! r1 c) C. h
Method 03
3 e9 Y0 i* e( E7 S% m=========" @& R% ^4 e  f8 P" e

( N! w+ Y3 |  b& {, ^& rLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' Z/ D: p) X# A. d+ o* u(API Get entry point), ?7 s) H' W4 ^4 ^* |3 A1 j& M( f
        # e9 c2 |1 t/ F

3 B3 @/ ]& u8 z) u, t. `# V    xor     di,di
. _9 w- P# _" x    mov     es,di  s7 p8 H: v9 `3 L' J7 q
    mov     ax, 1684h      
  F3 W- K9 m& P; b5 R4 V0 Q5 A    mov     bx, 0202h       ; VxD ID of winice
6 ^) [$ U. x, |) h5 ~: E    int     2Fh$ C) t  V% H! N+ l+ f
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- K8 |, a3 M# k0 A: Q1 I    add     ax, di! E3 p6 G  v  @$ o+ e) l
    test    ax,ax4 O/ ]; W. S4 @0 @1 f% w" A
    jnz     SoftICE_Detected
. J6 e2 A+ K4 S& l: N! u: f$ F( A6 Q  o& b$ W
___________________________________________________________________________
+ Q) g* {8 E- C0 M5 x9 F& t# \. b6 H9 P: ~% B1 S
Method 044 b& @  K3 T9 I$ J3 x8 y- `$ I. S
=========  S4 N& `' t3 h) S  w9 a- d; _
0 `' P1 ~, c# f9 R
Method identical to the preceding one except that it seeks the ID of SoftICE% @# @9 U, @& E
GFX VxD.
& y. N$ f4 D$ T' D3 F
8 _& N* |& {0 J8 `: f9 Q8 g( ?* u1 B: K    xor     di,di
. Y, e" D* \- n0 _    mov     es,di( F3 P% Z, f1 c' L9 A
    mov     ax, 1684h       $ K% U& e1 ?3 I/ o
    mov     bx, 7a5Fh       ; VxD ID of SIWVID  f' M1 c" X, l0 H+ \3 C) Q$ \
    int     2fh
" c. J' u- |  x* K) _: F/ t) T    mov     ax, es          ; ES:DI -&gt; VxD API entry point% ?* G; Y1 L; V% o0 S
    add     ax, di
. q* Y/ L# a/ ~6 {    test    ax,ax4 Y/ p7 `7 [& P
    jnz     SoftICE_Detected' @" I8 j  u2 N* N' R
& n, {2 l& d) l0 S8 |0 }' Z2 q
__________________________________________________________________________9 h# `' p" g3 X* [

. D0 r! q2 ^* ~  L! _+ R6 s1 T* q: N" l
Method 05
( O- K# N) U4 {' u! r( u4 c, C=========) m2 Q- c8 D# i

. s( D* G' c6 w5 D- C1 H9 jMethod seeking the 'magic number' 0F386h returned (in ax) by all system
& Q. _1 Y$ }. Q5 Q4 b4 r" T7 }debugger. It calls the int 41h, function 4Fh.
' h0 D* d6 I& f8 c8 _- RThere are several alternatives.  
7 C/ q/ Q1 F3 M7 y: m9 I; ?9 R3 t! o" r9 ^$ x( G2 B- G/ V% T/ @
The following one is the simplest:
( K+ f1 T4 B+ O# j1 K
5 u( {9 d1 r: ?6 n    mov     ax,4fh( B% g7 ?- }* S: |* C& w1 S% y' q& S
    int     41h* B2 N/ e: A1 I9 C$ Z$ A1 O  w
    cmp     ax, 0F386$ B. o' S7 X. `2 C5 a. L; d: i% q6 R
    jz      SoftICE_detected
5 X$ @' `0 {) V* }* ^7 q# k, L1 D4 r. ]

7 z  M3 \* Q+ ]% p2 sNext method as well as the following one are 2 examples from Stone's
! n7 e1 v% D' a4 Y* \"stn-wid.zip" (www.cracking.net):
# b" d0 m/ n* q& q2 j  ]# _8 r2 E2 B
( Z3 n" _0 a0 ]: E8 ]7 `0 l    mov     bx, cs" A: N* d; ?0 @8 J$ q( @& Z
    lea     dx, int41handler2
% ^* Q7 P4 |; u9 q* z    xchg    dx, es:[41h*4]
  ]- S9 `- m; o' @3 F    xchg    bx, es:[41h*4+2]
* f% X, t6 @# F& O  f  ?    mov     ax,4fh) S: k$ s9 {2 a
    int     41h
. i' d, H) S; |' x    xchg    dx, es:[41h*4]! N5 q% y6 q6 f% `0 c
    xchg    bx, es:[41h*4+2]6 V# l' A$ {! T5 C# k# w
    cmp     ax, 0f386h
8 H4 r7 v& v$ J& g    jz      SoftICE_detected
$ \  w% _# W) ^' _0 G/ v( `/ s1 c/ Y2 m: [: N
int41handler2 PROC
  u9 h; R, a' N$ `# J    iret0 A  r2 J+ |- e/ D* j& c8 g
int41handler2 ENDP( `9 P' y7 V. r- K% w; X9 n9 }  n
4 Y4 e. c; _) \& R9 q+ e
! M* f1 C5 {: i+ B7 x% C6 ^/ Y
_________________________________________________________________________2 y6 h" {7 C) H, T* x8 J* F+ p5 {
( e# @1 C+ L. E* I6 ~

0 G! B4 ^& `7 N% F; }+ XMethod 067 P$ j4 s( s5 Z  {6 T! G* g
=========
- {& k6 D# Z( ~! ?' v/ f1 U! I' L) \, v, |/ L7 X

3 F; m# Q( J! W( R6 c. w6 T9 ~2nd method similar to the preceding one but more difficult to detect:* n$ Q2 X$ l9 p& K

8 X1 O$ r. P0 V, C0 V
- [3 l& t2 q# sint41handler PROC
4 t/ x; u- e5 t6 Y    mov     cl,al
8 x+ }  l  N: C' u) A/ i) v  R    iret: l- x# B2 ~' M0 ]8 s
int41handler ENDP% G- q/ ~# i4 D6 u. T& x( W, j

! X4 s+ R+ }; i5 L* t  t
9 z9 V6 J. ?. @; w    xor     ax,ax( H8 F$ V/ W$ d# N' V/ u# i
    mov     es,ax4 U7 ^' v/ g- X/ j" ?3 N" M( W
    mov     bx, cs: K2 {- j# Y" C4 k) N) `; L! ^
    lea     dx, int41handler7 H6 I6 c; Q  m7 Q) U$ X
    xchg    dx, es:[41h*4]
* g& L1 Q0 z1 u7 B' L5 F9 T! q    xchg    bx, es:[41h*4+2]- t$ K. V0 v+ |8 Z: X: G! t
    in      al, 40h. X% J, n4 {* f. ^9 d" T* c9 [8 r
    xor     cx,cx+ l5 |2 J7 N& Z; v) {, j
    int     41h) F8 P! w. S; r3 f* D; s
    xchg    dx, es:[41h*4]9 D& E1 \: {: n: j1 d' w
    xchg    bx, es:[41h*4+2]
0 c5 H! i( ?) [' k$ O    cmp     cl,al
+ p  b+ O: \/ ^- V8 N6 `, t" w    jnz     SoftICE_detected' b, t! C) j; Q  o: @
, Y. I( q! g5 J! H/ ^9 |
_________________________________________________________________________
. c1 a  `# |$ ]- w$ j9 a  Q- ?2 o
/ ~$ z( a( m$ u7 hMethod 07
# h. u( z: \# `/ z1 M% H+ E=========
) v# G( b) c" @' W" T
! C. Q. F8 ~5 JMethod of detection of the WinICE handler in the int68h (V86)
9 Y" e; I: c; v! k; [# @# J8 O  k, j  Z# z  [; E# p- `# Y
    mov     ah,43h& I& g0 o! {2 V" y/ N  E$ W: `% `, g1 M
    int     68h
7 e6 F, W5 b! J( P  e5 S, J# f# E6 E    cmp     ax,0F386h: Z0 b8 M1 H$ W7 ?* W
    jz      SoftICE_Detected# D3 f" y& ^. H; H/ h$ k
) z% |# k. t8 c* }' w+ N) ?

9 \) q* i0 U% ^=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
, X& T9 v; {* l% x- ^   app like this:
! g1 H+ x9 Q" r1 P* @% e% f1 h) f; j: [* g& _9 u! l1 p+ d: x; a
   BPX exec_int if ax==681 F9 n0 U% E  o" X" ?6 G) L. i
   (function called is located at byte ptr [ebp+1Dh] and client eip is
7 W. V2 A- h. F9 t$ f   located at [ebp+48h] for 32Bit apps)
7 g% \0 u, L% ~) I' ]__________________________________________________________________________
; M6 ?5 d3 T: x  M; M& q, u- ~' J2 t4 ^' ^8 s5 b

$ C: v) C- z: _Method 08+ l- c- B8 _* ]! y  R3 W
=========
2 W9 z# Y# L% \9 e8 Z0 A3 W& w# T' U* S0 v) J
It is not a method of detection of SoftICE but a possibility to crash the
$ U* P! ^; \) z) M3 @system by intercepting int 01h and int 03h and redirecting them to another! Q: T2 P) N9 r& w& K4 b
routine.# m1 l* G: O! W+ e0 s( c, y" c$ h
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
* q- z* z% M0 t8 Uto the new routine to execute (hangs computer...)
3 U* J% {+ L, z6 e' a" j1 U% B% ?
% \9 ?1 C% J) e( X9 e# t! S/ R    mov     ah, 25h6 }8 R8 l  j! Q9 C
    mov     al, Int_Number (01h or 03h)
7 W% F% P) Q8 r. Q, C! g    mov     dx, offset New_Int_Routine; ~8 v/ `* t# N
    int     21h) W! R6 Z" G, ~, N8 u5 V

+ M4 o" c1 r; f/ U0 z3 N* B1 T__________________________________________________________________________) @: Y  K2 O& y) o' Q6 V

1 r, w9 j; p, y% v+ _+ AMethod 098 a$ w8 K2 c5 V! j! D% q
=========. Y( I" N* I% d5 _; Q
/ L) c8 o6 F6 X# t2 e% I- `
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only$ D' s. e7 r1 [: [
performed in ring0 (VxD or a ring3 app using the VxdCall).
  B, B+ g0 y2 i1 \0 f2 `The Get_DDB service is used to determine whether or not a VxD is installed
5 Q7 E& j6 Y8 B6 |+ m# g2 ~, Ffor the specified device and returns a Device Description Block (in ecx) for
+ e2 H6 S2 K6 l1 d; xthat device if it is installed.
. A! {, k, X3 q) B* A
1 D  U: i4 H6 Q) U   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( n8 u0 g8 n2 }
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). t' ?/ _' ~3 z7 A# W
   VMMCall Get_DDB1 y8 x% }- v( g. c9 C
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ [! U' x0 D$ o7 o( E; a! ]) d2 p- A5 k+ U) h
Note as well that you can easily detect this method with SoftICE:
8 O+ u3 Z5 {) q; p* l   bpx Get_DDB if ax==0202 || ax==7a5fh9 F$ }) q$ H9 c8 i# b9 `. \2 i

+ R4 U2 r0 `6 @) e4 |/ j__________________________________________________________________________
5 i+ Z# v4 f( p& X% A- n
, o% F. y/ t: ]( D5 i* B9 ?Method 10% S# s$ M# [# c9 k
=========9 g6 t* c; T6 U: [& R

$ U; S- X" ]9 a! ]& F=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ o: f) w7 }8 N# r8 S+ }- E
  SoftICE while the option is enable!!5 y! J( P, V9 P& I. g
6 p, g! X, ?2 v1 u7 E$ l+ s. e
This trick is very efficient:
' b+ ~; h/ X9 Nby checking the Debug Registers, you can detect if SoftICE is loaded
7 [0 f  h3 T- ?: T8 w6 \- k(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
% t, {- {) j! Q* e1 N9 `. rthere are some memory breakpoints set (dr0 to dr3) simply by reading their
' P2 d8 H( V5 E, r& a4 M$ z* O# hvalue (in ring0 only). Values can be manipulated and or changed as well
; T5 i0 J2 |6 V5 ^(clearing BPMs for instance)
! C: ~' X0 j) M7 {; m% }) e$ c/ r
2 z. q  K' }% b8 |9 C__________________________________________________________________________) V% D) i+ y2 L" k& Q

5 S! {9 o. r$ V2 |8 CMethod 11
/ q: {- ~1 f+ a2 G=========
- C4 f4 s. d$ ~5 x5 F+ {+ T4 g" O, W& Y# N
This method is most known as 'MeltICE' because it has been freely distributed
) h# ]7 e% T( Lvia www.winfiles.com. However it was first used by NuMega people to allow
2 G- W3 y/ U3 Y6 pSymbol Loader to check if SoftICE was active or not (the code is located6 g. U: e. _, A" w
inside nmtrans.dll).& M, P! \) ?3 Y0 E% S
. m6 d5 E. m2 C! w- D
The way it works is very simple:
. v! q. c! y! `6 i- z) R7 eIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 x5 U2 u6 D, Z4 ~WinNT) with the CreateFileA API.
% W5 L4 g$ R  y) \! f
9 f% j* \1 x/ c/ B9 OHere is a sample (checking for 'SICE'):
* x: @8 ?' j1 W2 F& l& V8 h% _' W  g8 w* \
BOOL IsSoftIce95Loaded()8 A" g% `* Z9 M+ x, x2 A: i
{( p5 D* M- p0 F! z! ]9 r# K$ o' M
   HANDLE hFile;  
7 w8 {4 S% F; z+ g9 X7 n* }( Q7 q( `   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% |7 M, o  \6 @$ {! q                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( z" x; k$ p" T. ^* F                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ S* c3 N5 ?' G* r   if( hFile != INVALID_HANDLE_VALUE )# L7 ^4 J' Z+ [& U9 h6 f
   {* G/ t; x: b+ b
      CloseHandle(hFile);5 y3 h( ?7 U1 D1 S8 a( I
      return TRUE;
7 R/ g+ @  V3 N( R   }
4 Y. M) F  a9 h- E" E- w8 Z   return FALSE;: H; k+ Q6 h8 D& Z! \. z5 f
}
6 A: V* M7 I( }1 y# r9 S, T% K0 i1 N1 @  b
Although this trick calls the CreateFileA function, don't even expect to be* J( t6 ^0 ?5 M- Q& ^6 Q  H: `
able to intercept it by installing a IFS hook: it will not work, no way!
9 h; Q  W9 }1 l% YIn fact, after the call to CreateFileA it will get through VWIN32 0x001F9 n+ h- W# \$ t: |8 a
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
9 [* [7 g. X$ y' c$ Nand then browse the DDB list until it find the VxD and its DDB_Control_Proc
% @+ I) C- X6 f- _6 `field.
2 C3 j$ |2 U3 \7 D0 G- ~In fact, its purpose is not to load/unload VxDs but only to send a
/ n! B. [0 g6 }0 T5 o2 ?W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% N2 d6 t: I' N) w! y3 \
to the VxD Control_Dispatch proc (how the hell a shareware soft could try4 F) L0 i3 n# Q) w- }9 F- t2 X
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& T: m6 u7 X" }9 B3 r# Z' ~If the VxD is loaded, it will always clear eax and the Carry flag to allow2 R7 R3 ^. N& o7 W7 k6 N
its handle to be opened and then, will be detected.- R, b( W. i4 Y8 i+ W: f; n
You can check that simply by hooking Winice.exe control proc entry point
0 F* P( H( W, ~1 s+ {; Hwhile running MeltICE.
1 ^# @% G' q" p' G, I3 ?8 K/ R# K! d9 t% R8 s4 J" D
3 M2 X8 @2 Q8 J( l
  00401067:  push      00402025    ; \\.\SICE% r( L* c  d. }/ {" m
  0040106C:  call      CreateFileA5 [: H/ o) Y2 v, E, J5 U( }
  00401071:  cmp       eax,-001) o7 @- @# @" I3 ~
  00401074:  je        00401091  q  K/ n  E) [( {+ s7 D

- r& @: `6 a9 o9 r( t2 g* p& y* p
There could be hundreds of BPX you could use to detect this trick.: c$ b8 F) r8 K# R
-The most classical one is:
3 |4 K# @0 ]8 }  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||- }5 Q0 d( ^8 v
    *(esp-&gt;4+4)=='NTIC'( g; F6 Y- }  f/ O
! m, x0 W& o. t$ r, W9 F0 C- _
-The most exotic ones (could be very slooooow :-(* l# I; G  u  W6 R. X8 }- m5 s
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 s0 A+ L2 L; U8 Q0 \* k9 W     ;will break 3 times :-(
! \9 v# `1 ^+ q9 L, }, ?( G- C3 ?* k. Q! ]2 B/ n
-or (a bit) faster: ( L* G( n( t7 }2 i8 L- n' [* f
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
- E* ^4 H; L6 i1 o7 E  K; J  u) }" G7 Q$ u
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
) u- k5 m: m4 y! Y0 X     ;will break 3 times :-(
6 a- f( r- o( {. Q
, h; Q' U5 X$ t: E& T- y+ s-Much faster:7 D; w" _6 C1 E; G( t$ m0 H
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
2 y; p8 R: S( ^- q& y' X5 s' K1 B* T. C
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 k& o$ u3 c  h% q8 K' D5 ufunction to do the same job:
& Q. Q7 q+ j$ }- [* l7 o
: a, e- `7 h4 J. z- J" I   push    00                        ; OF_READ. L: e8 o" d) B" L1 q' l
   mov     eax,[00656634]            ; '\\.\SICE',0
: @  ~, f: H3 Y; B   push    eax- f6 V$ U7 X, x4 E6 B, ?
   call    KERNEL32!_lopen
/ c) t; r1 E5 r# w2 w   inc     eax9 A* x" J* C  O0 x% F
   jnz     00650589                  ; detected
9 m4 j4 p& j: r3 w) R  ?+ `/ ]' D- k   push    00                        ; OF_READ1 r& @9 i+ V7 I
   mov     eax,[00656638]            ; '\\.\SICE') P* D8 r+ H. q2 t
   push    eax
: M2 u0 [# P$ V5 J/ U, ~" c* h   call    KERNEL32!_lopen
. H, W7 c) D- k; w  J   inc     eax
& D+ R5 r9 d! T- t: h) a: z   jz      006505ae                  ; not detected( d+ ?. ~, r" s
8 O+ E7 h) J1 r( e6 b' ?; F

4 M: u. K- _* @& k__________________________________________________________________________" m' ]! f& X+ A* ?# X* K' U

" R; P, v& a" M- KMethod 12
, a% _/ @2 V+ M' z: V=========8 [5 ~. J$ ~2 z/ o7 A
8 x/ l3 b/ {$ G) }' S" M
This trick is similar to int41h/4fh Debugger installation check (code 050 |- [! I: p1 l5 Y+ |4 L) }
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. ~' h2 `! Z6 ?4 v( b9 {as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: I# I% |" y" o7 M& S) E- |' Q
   push  0000004fh         ; function 4fh
! s: {  J) n1 M7 s   push  002a002ah         ; high word specifies which VxD (VWIN32)
. ~2 i9 G& q0 X' r6 ]                           ; low word specifies which service6 f2 x% N6 Q4 A7 f$ }
                             (VWIN32_Int41Dispatch)6 m& T6 r( ^" D7 r& p) u
   call  Kernel32!ORD_001  ; VxdCall
5 g1 o7 R( ^& P4 s8 M. B   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 A" G7 f2 X) _; Z   jz    SoftICE_detected$ v# g2 c5 V/ K; E% J

. Q5 ~# P$ h6 x/ mHere again, several ways to detect it:
& S. D8 {9 K! n6 p% o9 _! e
# l) p/ P2 j. j7 k. v    BPINT 41 if ax==4f" S. j" r+ T: t, E

$ b& E, ?7 C( A2 [% i    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
; x. \6 B- H8 O. L6 U/ p# s+ j+ Z( W2 f: `  o* e' N/ O
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A# L( \5 v8 I/ A5 \& B8 D
' g3 u; K# k: H" @
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! y8 ~4 ]  E- U
) m/ h: q( i  _# _1 C! g
__________________________________________________________________________; e0 e: H+ R! U2 T* E
8 Z, |( j* }+ K* [- C
Method 13# F, J& S& I' X3 I9 o0 J
=========5 m: b: q+ |4 F6 C: J' [

* ~$ R5 g2 ^3 S3 DNot a real method of detection, but a good way to know if SoftICE is, R4 E3 m$ U% M9 P( q! h
installed on a computer and to locate its installation directory.# W: r5 A% [. G: w
It is used by few softs which access the following registry keys (usually #2) :
+ o* O' h6 V* L  ^: U  o! }! E/ H& j: U: Y- Q
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& g; \: P! E& o; J* s, j( U
\Uninstall\SoftICE+ O- b' p) r3 L* r9 F+ U
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- f3 ]1 ?0 e  K3 B/ @6 A2 F-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& f  O# \0 Q& Z$ W) O* s7 f
\App Paths\Loader32.Exe
( @3 f6 l$ S+ N& _/ `2 P% w0 Z7 T
- J( \, w% Q% k) p4 Y6 Q8 _8 ^1 s0 P0 }5 S
Note that some nasty apps could then erase all files from SoftICE directory. o& e% z' M2 U  V
(I faced that once :-(  W% Z  ^! b8 P' i  C

5 o+ v4 T( _7 O9 f) Y$ N0 BUseful breakpoint to detect it:% P6 y) n- ?/ c2 O" p6 q
: d) x9 ^( ]/ i7 T- [6 ?" }
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# J! I) L. t# \" X; D& {. z% `9 U
( f( W; p' B- }: o  k, Q__________________________________________________________________________
4 D1 Y' I6 s8 P9 k
' @/ I" Z+ M! U: C7 P7 T' E' ]: F9 M! j" r  j8 L4 O6 b' ]# u% m
Method 14
" z( C$ q0 b  N+ s=========# T9 X, A" B; H
# m/ D$ y9 c" V) u* n( ]: V8 B
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) [, e' F$ d* b' ^is to determines whether a debugger is running on your system (ring0 only).
7 N) e+ d7 O; F7 L8 P8 q! z/ h: M5 n8 T
   VMMCall Test_Debug_Installed1 w9 I6 r1 C( @" f$ b! t2 {
   je      not_installed
, N0 N, ^0 f( T" g1 l) Q/ Q6 d- v$ p
4 j. m  W; J& Z; Y5 v+ Y/ X; wThis service just checks a flag.. b* z( z9 ^0 `: f
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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