About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ A4 M; p2 O8 ]. E9 T5 f- T
<TBODY>! ^, N  a" n) w/ u
<TR>
, S# U( X. e  F0 C<TD><PRE>Method 01
* Y, |6 g! M/ N0 M1 C- t=========. I" p3 o1 S1 M( u' f
  H  Q* q: [; D  U6 c0 T( o2 H' X
This method of detection of SoftICE (as well as the following one) is7 o/ S6 l: `. S/ R+ n
used by the majority of packers/encryptors found on Internet.5 G9 q5 V! b8 F6 t5 N
It seeks the signature of BoundsChecker in SoftICE
. L" n8 q6 M, ~2 o8 r/ [* p$ w
5 [& G7 V0 J6 x$ d    mov     ebp, 04243484Bh        ; 'BCHK'
+ {% I+ P" b) Z1 @* H    mov     ax, 04h
6 k. L# V* U8 y" o3 ]; |7 W    int     3      
, Y! x& }( L/ O! `7 f* c- y7 b% P    cmp     al,4
; w. A! {( u7 C; Q! x( a9 j    jnz     SoftICE_Detected
' j! B1 @; y- j2 j2 q# [
/ w* r# B; w9 q___________________________________________________________________________+ J6 b0 {9 m- z. {3 r" I$ f2 f

! C; T0 I5 c/ ~0 YMethod 02
  t% G# K; |1 T=========$ n2 Z! _" V: O  W

% c; N$ Q% M0 R! nStill a method very much used (perhaps the most frequent one).  It is used
; S) a: ?$ T0 z: n- Dto get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 ?+ g  r( \8 z( a; }
or execute SoftICE commands...  P: @( M$ R6 x8 z; P
It is also used to crash SoftICE and to force it to execute any commands- }+ A- Q8 v* P: \% A  ]
(HBOOT...) :-((  ) U0 Z8 ]" O# s4 _
0 ?8 A7 C8 U/ y6 P5 a
Here is a quick description:" O  c$ Q2 b1 e% |; \
-AX = 0910h   (Display string in SIce windows)6 d1 U( u  x$ j. r1 r, `
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx), b$ P! ~0 |8 g5 F( p! ]
-AX = 0912h   (Get breakpoint infos)
+ e5 a) X0 ?& C-AX = 0913h   (Set Sice breakpoints)% l# M7 q8 `* W# S! z; J
-AX = 0914h   (Remove SIce breakoints)1 k* D/ s7 L* f* P4 `

1 I3 D* Z9 J2 r$ ~- G0 ^Each time you'll meet this trick, you'll see:
& U+ I) r. l. r% ?- ^-SI = 4647h
, ?  f: z( K7 ]& W3 t1 Z-DI = 4A4Dh
. M4 b/ e* Y* F  u% KWhich are the 'magic values' used by SoftIce.
" R9 s' E) Z7 q% C8 _For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& Z7 _% v# H. M7 P$ }+ K* U1 m1 a6 g! l4 u% L+ o
Here is one example from the file "Haspinst.exe" which is the dongle HASP; G9 H4 O0 i4 E1 u  w
Envelope utility use to protect DOS applications:
  {5 j) m' f7 E* R  D: C
  p! E4 {1 z9 e
; J4 f" ~% R8 ~0 ]8 o: d4C19:0095   MOV    AX,0911  ; execute command.+ Y( c  M7 }" f5 M
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 J& W6 g& _4 u( F* {: _7 q, V
4C19:009A   MOV    SI,4647  ; 1st magic value.) R. U8 \2 n) D9 I& T/ Z# A" C( m
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.8 M# n4 `7 L9 W( {9 |* v  r! H
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% m  A! B: t3 _  l3 ^4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
( X: ^+ D9 y& y/ G% R- q4C19:00A4   INC    CX
8 X) l& ]+ {4 M. c+ ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute. B: R  z2 E5 m# [5 j! O7 ^, O
4C19:00A8   JB     0095     ; 6 different commands.  U2 e! A0 z- @! N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." o+ t- H$ V* c" l
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 j- c6 k6 M7 O
- x: f! N' `3 j6 O( HThe program will execute 6 different SIce commands located at ds:dx, which5 }/ a0 S; T7 p1 C% N0 U9 \" t& W
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.+ U0 f* M5 Z: H& |

: o5 y7 W; A' u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* w1 J6 O, T5 o) u; g' D, f' s9 v___________________________________________________________________________
' `' D( [2 h$ D* c- u; K7 G0 b5 Q  ?2 c# U$ g$ U

2 j2 T. ^/ w& [0 iMethod 03
& T7 q) ]9 D. F# f=========
# t6 n' z! ^- o: I3 O0 N, L0 L6 u) `% Q  [  z
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h4 ]/ o! R# \( O* O" O- G
(API Get entry point)
  k4 b1 M9 t4 a        1 o: `6 N$ P$ Q5 w5 [
! ~0 ]' v9 S# e
    xor     di,di  m; Z9 a; w7 H( _
    mov     es,di0 Z; g& H3 Y# c1 W' {- ~
    mov     ax, 1684h       / w- p' Q  }( A/ d$ a( i8 Q9 m" H
    mov     bx, 0202h       ; VxD ID of winice
: B0 b3 j/ G( l# m% [7 _    int     2Fh
% t' \+ X+ U! s' S/ E5 U    mov     ax, es          ; ES:DI -&gt; VxD API entry point: B. R2 C6 L7 X( ?) p7 ^
    add     ax, di
) |: p. n) |7 `% d( b    test    ax,ax
7 {1 a3 A3 P: x* O, ^    jnz     SoftICE_Detected
6 L7 \* s6 M: _" x" ?0 f  R0 N  H- ?8 U
___________________________________________________________________________4 k9 Q0 I8 |4 t# _  L) r$ g+ K6 c
+ ~4 U- [' I6 w
Method 04- I& M1 H$ c( I5 R% A
=========
6 ~  T* G8 x/ Z9 ^  {$ {/ ?( x; [9 v9 K
Method identical to the preceding one except that it seeks the ID of SoftICE
! |1 E% I: Y( O3 V  W8 k' S5 ^GFX VxD.
1 Z8 x$ \9 q+ S: e  O3 y% Q' |
; H+ i7 j3 K+ ^1 V' k/ O0 o3 {    xor     di,di
1 O  p) p* \" R. G) M7 n    mov     es,di6 F2 K2 [1 a  W9 K7 T3 W' d
    mov     ax, 1684h       8 x9 N7 d' j, X+ @, t5 p" c
    mov     bx, 7a5Fh       ; VxD ID of SIWVID" B- c$ ?0 K, ~0 v
    int     2fh
. S$ C4 m) ~5 _8 Q/ V' ~, _/ e    mov     ax, es          ; ES:DI -&gt; VxD API entry point* ^1 C; [1 D. W* Z; V* [
    add     ax, di8 U6 e0 D8 x2 a. i+ L! ]
    test    ax,ax7 I5 I5 g4 x1 U8 m' [
    jnz     SoftICE_Detected7 p# W0 t$ E! B; D3 ~5 ?* e" F! U" R
9 v  ?( u  H$ a( Q0 d1 `
__________________________________________________________________________
) A, ~' s  R$ \4 D3 F6 N2 l$ W6 d
, z) ?3 C9 j& |; z7 h# x6 Z' L$ C
Method 05& [9 \3 V8 q8 r8 {- y1 s
=========7 {  @' G' C/ V: k& q0 ]: U
4 g5 N9 t* ~, }% D% B2 H
Method seeking the 'magic number' 0F386h returned (in ax) by all system
  b9 ?, R4 P5 k, @* M9 W6 v) E  Edebugger. It calls the int 41h, function 4Fh.4 Q- U1 _1 C) Q( l, Z7 P6 _. R# ^
There are several alternatives.  " ^7 N/ k) d1 o4 v

6 m7 r  Z7 t0 D% a6 d. D) gThe following one is the simplest:3 v( u+ b$ N$ ~$ e$ i, Z! _
* }+ v! ^" K, z  L2 s4 a. T$ {
    mov     ax,4fh
) p+ n3 B) g) v* j; O    int     41h$ G" z# l/ v8 A- I1 [' o
    cmp     ax, 0F386
6 B7 v/ Y$ _+ D  n: A5 O    jz      SoftICE_detected
  S0 ^5 u9 ?& X' w! p
& G2 ^/ ^& c7 o  D
* F8 |% i( B; p6 ZNext method as well as the following one are 2 examples from Stone's + r6 ~0 T) _% I! H
"stn-wid.zip" (www.cracking.net):$ P( [# |0 A: c/ o- @: ?" ^% p5 k

# ?; E& f% z+ {, \4 X    mov     bx, cs- t8 V+ [1 I  N7 A
    lea     dx, int41handler2
" B. S0 W$ g7 ~    xchg    dx, es:[41h*4]
( J6 B& ]4 e1 A. `+ \" C0 g& t    xchg    bx, es:[41h*4+2]
! _: ?* H4 y6 Q) ]: D0 s* z, l    mov     ax,4fh$ A) e  U' S  }) l  C% g& d
    int     41h
, y$ l8 ]! o6 J    xchg    dx, es:[41h*4]
  j6 ~  `  G( q    xchg    bx, es:[41h*4+2]
. a& |% F- s# J& x    cmp     ax, 0f386h' E" l# F/ v' s( Y8 s
    jz      SoftICE_detected% C1 ]9 L3 c. K5 h* q

3 T1 e+ g* X4 m9 [- J! hint41handler2 PROC- L9 P. a# v5 K( r, t- a
    iret
, e# F. o/ j' }+ F: pint41handler2 ENDP5 D/ m- A2 \( D+ h

  ^8 @/ G$ @; ~+ R( B- `9 `2 O3 k
9 q0 N0 V& o* b# J* @# N" D% E_________________________________________________________________________
9 R% i1 W. e, v+ Y8 g0 d8 j! Q0 d2 u. {# [
1 d* k. C, r- _* H# m. N
Method 06* U& \! @/ k# ^  T4 T; z7 w) e* s
=========/ h/ `2 q* \' i$ N( i- C; G+ n
  O8 ]9 e% T0 |; c

$ H, J0 V+ Y9 {2 y- @, `2nd method similar to the preceding one but more difficult to detect:
" E: Y# L* F  @) T/ z8 z3 q9 {) p9 l" h' O( W6 L  J# u

+ O: Y7 Q1 `2 m$ k7 ]5 A! zint41handler PROC  t9 T( Y" q9 }2 {
    mov     cl,al& y7 w9 t6 W; w* I
    iret& G9 D% V# U/ U& R) y5 Y3 r
int41handler ENDP
& G" Z2 e, G3 a/ M: n: u, Y  b0 q# H+ P0 s" r" R' n2 i

& k4 s/ ~- q( y  P5 E6 e    xor     ax,ax8 l7 ~3 v% l% N: z
    mov     es,ax! Z1 [! |& T4 u# B
    mov     bx, cs) [4 @+ A* j, r: ]& m
    lea     dx, int41handler
* K8 R; z5 ~' D* e- |    xchg    dx, es:[41h*4]
, Y* }  v& _$ |4 m' N    xchg    bx, es:[41h*4+2]
  Q' s& W4 F  I6 G9 g6 {$ h! _    in      al, 40h$ O# X* y3 X& @& D! [" ?: c- M1 K1 c
    xor     cx,cx
0 V( p& i! ~& j' y$ L& J! c    int     41h
8 [" U) _/ i: ~6 V6 @6 r% X    xchg    dx, es:[41h*4]) P  t, M1 D/ K3 o8 {" t' n
    xchg    bx, es:[41h*4+2]- x' y: C* D; D! O3 x5 D1 |4 ?
    cmp     cl,al" X6 T* ?# p; ^" Q/ D
    jnz     SoftICE_detected
) L+ l7 x+ a4 T0 {9 j+ ~1 j: Z; Y% a1 E! L
_________________________________________________________________________
$ v7 e8 ]! ?. _7 w+ r( M+ C- d, r$ u% L" K' p" T  x3 T
Method 07
/ Z  U, O7 O$ _' J=========
( b! W( ^3 X9 z$ ^- u! f1 N. t! C( h& s9 w$ h% y
Method of detection of the WinICE handler in the int68h (V86)
* u/ y3 Z* \# Y' j7 _7 i
; g! x* ]. O, M. w; A6 m    mov     ah,43h
1 o, q8 t& D, `    int     68h- T4 I( R) x  A
    cmp     ax,0F386h
7 {' `: k- I8 ~% R3 C' Y% ]) Z    jz      SoftICE_Detected
( I4 K. U. q! _( d5 Q4 h
: @6 g& r1 L7 K1 b" Z
* I/ ?; r4 b+ x* ?/ |=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 w% d+ G; f- ^0 |& Q/ x; v% \   app like this:
9 Y6 {! P9 I, c" l
$ }& g8 v" M% u   BPX exec_int if ax==68
, i1 n  r; S3 M" {, z7 \$ n& `   (function called is located at byte ptr [ebp+1Dh] and client eip is0 c# }* R; N" o; {9 V: h
   located at [ebp+48h] for 32Bit apps)
, V" e: ~  F  [# s__________________________________________________________________________% b; G" N1 g) v7 V* O" x3 J

, u; z+ `' w, z) t: ~6 E8 v7 I# a' o! g) W# Z6 C
Method 08
6 u+ l' }, W, K6 U5 N=========( s5 P7 B) B4 Z5 z6 \

! e) L* d8 [$ R& q( ~6 `: n% Y" UIt is not a method of detection of SoftICE but a possibility to crash the, v1 G, ]; {6 m+ g3 \
system by intercepting int 01h and int 03h and redirecting them to another
" o  Y6 F% Z2 L8 Oroutine.0 S) X8 C  M& O  F9 u9 M2 D
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ `. C, L% K, M+ J  Fto the new routine to execute (hangs computer...)
- S4 p. y% S9 p' `& ~% D4 W3 h0 r' |$ G: U( L! f2 f. L
    mov     ah, 25h7 E# }  N9 u$ s# F
    mov     al, Int_Number (01h or 03h)
3 s6 D/ `: K# }# A/ j3 O! x    mov     dx, offset New_Int_Routine8 y6 l7 i6 o) W  y0 o2 H) m, s
    int     21h
/ j3 o5 g6 I) J! k' c* U
  s5 q* ?* x* T( [& O% z# O__________________________________________________________________________
2 m8 U. `" [( Z! |7 l1 w- n% A4 H1 p) h, B& W
Method 09% Q3 d' C5 H& O( g8 {) e2 ~
=========
# S$ r! o  |% r, F4 r5 `7 f' ~" Q7 U/ P" G
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% A) E7 j0 c+ J4 {/ K0 _8 \
performed in ring0 (VxD or a ring3 app using the VxdCall).
9 i( x! c2 q+ x  }- Z' {$ mThe Get_DDB service is used to determine whether or not a VxD is installed$ E4 N3 T& F. R' W- `
for the specified device and returns a Device Description Block (in ecx) for
$ w. _. s, U' ~6 U% G' k: u0 Cthat device if it is installed.
9 ~( O0 ^; A5 ~/ V$ a& d/ x; J! y) ]& _7 p
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 y( A8 G7 o' R* ~6 f. O* F" q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): E1 f# i# I. [" D
   VMMCall Get_DDB
' _. h/ P7 a0 o) M0 Y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed$ _/ F4 E( H. w; K! x
5 Z5 w/ O$ f- N5 I; W, ]2 {" F" _
Note as well that you can easily detect this method with SoftICE:
4 {( Z/ r" h7 Y2 f   bpx Get_DDB if ax==0202 || ax==7a5fh6 U( C$ S- T% Q+ ?) A
' J  J( u* {9 q! f4 P, k6 [9 ]3 P; e
__________________________________________________________________________  f7 ^" T" S- P
7 P4 Q; D* L- T) R
Method 10* S4 H. P. K- a  D5 f" |1 ]: N0 ]
=========
6 y, X( ^. ~. H5 P+ F+ o$ E
; Y$ |  D1 |( ~1 W9 u, e=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- u' Y7 \9 P" m& Z: Y
  SoftICE while the option is enable!!
2 U& D& n& a3 E( a
2 A0 ^3 ~. _: n- F  o7 u, QThis trick is very efficient:. @/ Q7 P3 t1 M
by checking the Debug Registers, you can detect if SoftICE is loaded- X1 s( u5 D) j# }1 p
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
; {! g$ Q7 o. v6 [4 V& s4 Rthere are some memory breakpoints set (dr0 to dr3) simply by reading their5 p0 V, t5 g- ], Y2 z3 a" a& j, G
value (in ring0 only). Values can be manipulated and or changed as well) {7 H0 I- k  H: p+ R% w* X5 P: P
(clearing BPMs for instance)
! q# b( }3 X) g5 ?+ l) I& l, r- F, g' z* I5 m4 _( p
__________________________________________________________________________9 _+ u9 r% R7 M
# b+ V9 p8 }7 l) k2 O/ I: X3 b
Method 118 F+ O8 h" D. C- }6 E2 t
=========" i+ U' h- \8 b( @$ R; P8 f
4 `3 u+ M- z3 v: d: s# ]0 ~
This method is most known as 'MeltICE' because it has been freely distributed
" r" E6 |9 l* v- V* u: Cvia www.winfiles.com. However it was first used by NuMega people to allow4 X# q) m& H, K! k# C; G. @
Symbol Loader to check if SoftICE was active or not (the code is located1 e% J- R, ]/ s3 K
inside nmtrans.dll).
1 g' e) w2 S# [3 c
( v. C& {; |' l% O3 c7 x( u" p+ C0 bThe way it works is very simple:
  _% ]" G" ?' H5 J" ]" S7 P% BIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( J. R: u/ `1 m3 T# S3 _4 QWinNT) with the CreateFileA API./ r# K- o. ]8 V: A" s9 q

4 S4 W& p& v$ sHere is a sample (checking for 'SICE'):* D$ ?0 J. p; t" K
$ b/ G, Q$ p) I. @7 R5 H6 Q
BOOL IsSoftIce95Loaded()
) O" h# k( j8 O' W/ {- f6 s6 n4 w& W{* S4 H: [+ |; z& p" e9 L" |
   HANDLE hFile;  
! @* n4 I4 g& x6 x# j   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  }6 b: m; ]1 n5 x5 c
                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ t& b: M6 I- p; W
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 R  B. u: b: x# C; E  H# X   if( hFile != INVALID_HANDLE_VALUE )
, E7 |- N+ P- u0 ?  }+ M) S   {/ C8 M& I2 i+ `
      CloseHandle(hFile);
) `! I: k4 p+ n6 z% o3 W* M      return TRUE;) H& x+ T5 }  t$ ]
   }+ X/ E* u6 T$ Y+ e' P
   return FALSE;
9 z, m8 N$ ?* C9 B% f8 l$ ?}- s: B& s  N* D4 [
- k( R7 F1 X  J- o; c! K- B
Although this trick calls the CreateFileA function, don't even expect to be$ P: {1 `* S  ~; \- U# H: H
able to intercept it by installing a IFS hook: it will not work, no way!
! P+ C9 f) J: K( y( VIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
3 O; G( C. y5 i, W8 H2 Kservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
# M* d) h4 a7 m1 h6 {and then browse the DDB list until it find the VxD and its DDB_Control_Proc. s7 e. O: N/ ~9 w/ Y# \. K/ |( D
field.
2 ^7 s3 v1 k* e) ]In fact, its purpose is not to load/unload VxDs but only to send a
4 x3 H; w4 D/ z8 e+ ^  \* aW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
& }* G9 q+ N4 tto the VxD Control_Dispatch proc (how the hell a shareware soft could try, v- e2 q9 f  Y6 N: E. H
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ Y4 L: D6 G6 ?8 }7 `) Z; g( TIf the VxD is loaded, it will always clear eax and the Carry flag to allow0 d* L5 k, d+ y9 ~5 H$ z+ v
its handle to be opened and then, will be detected.
; ^' I; O* F  K' @% {0 o2 CYou can check that simply by hooking Winice.exe control proc entry point
! I( V) j2 I5 j  }' h9 e$ twhile running MeltICE.
: v, C* c% r7 T( D
' C( U. v8 |4 E- v9 x' [7 B$ g8 Q6 u8 s" B3 Z9 A& [4 H
  00401067:  push      00402025    ; \\.\SICE
. k' v: N  a7 ~$ O, b6 D  0040106C:  call      CreateFileA( t: R  Y- z4 E0 C. m
  00401071:  cmp       eax,-0013 o7 A  U6 u! x
  00401074:  je        00401091
+ S" J- o6 o" k# _' T7 P+ w
# \. Q. w( o. X* B3 |1 k% I: E
7 @5 B0 C, ^" e' h3 s) oThere could be hundreds of BPX you could use to detect this trick., u& Q: Q, r0 l) {6 \) z/ w+ k
-The most classical one is:
7 I$ D% A) I/ y3 j; Z2 M7 t( a4 T  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, K' x1 K* Z) E/ [  {& v) `8 w0 Q4 D6 R    *(esp-&gt;4+4)=='NTIC'! _  _" e+ |. _+ E- e& G( g1 W

, o) q1 Q1 ^! @  N4 S( s-The most exotic ones (could be very slooooow :-(
0 X: n& R* E8 S+ m2 ]+ X, O( k   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + \* B, G$ }; ~
     ;will break 3 times :-(# B, b& O& d2 o8 X$ X

! y/ t9 f5 Z6 i) [) P  M6 F$ l-or (a bit) faster:
! V/ }! U. J, I* L   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 z$ @  ~4 _4 z8 s5 v6 Z/ m  ]: e" k0 n$ Y4 m0 ~; D
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
3 K* S1 v9 d0 B: x     ;will break 3 times :-(
# A/ A  o% Q8 Z9 ~, g
, s9 }7 g- n# u4 ]0 m-Much faster:
: n- L9 `0 Q/ [+ ]" k9 m   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'1 D- N3 i9 @+ |+ q2 p6 B

4 Z7 p8 f* @. l+ P, }Note also that some programs (like AZPR3.00) use de old 16-bit _lopen" i6 R5 t+ [& T$ F6 u
function to do the same job:
9 m0 ]' j4 X1 D/ o% J1 S+ X' @, S5 [
9 j/ P& A0 b% ^- [   push    00                        ; OF_READ  _0 m- \3 @0 z- R' B
   mov     eax,[00656634]            ; '\\.\SICE',0
' w/ g9 f, X, e4 X; s) d9 p# p5 V   push    eax: Z9 w$ S7 v' ~: y6 Q
   call    KERNEL32!_lopen
; j. f/ K! o9 U) x   inc     eax0 o: d. t5 s* F7 `! D. q; V) p
   jnz     00650589                  ; detected
, s3 A2 V/ y8 X* b4 Y9 y. N- C   push    00                        ; OF_READ
, B5 b  \0 j: q5 s   mov     eax,[00656638]            ; '\\.\SICE'
, P1 s! ~; g7 S; f   push    eax
3 f# c" k/ V: r+ s$ ]& n! x9 u   call    KERNEL32!_lopen
( j; i/ i% a# E6 r   inc     eax9 @2 |. b) j" p% L# b) _" \
   jz      006505ae                  ; not detected
. k1 Q, a: Q$ W$ b
5 d3 Q( ^7 b1 \3 D& a( ~+ `. C3 U9 c2 y4 V
__________________________________________________________________________
& y. C$ U9 ~$ P1 z( [
: Y; z9 ~3 |2 o) j) ?Method 12, X& ~2 J3 g& A
=========
& T+ ]! X* }0 M8 w5 }1 v: k% A) N
9 h6 \) ]- I8 C$ n! u3 g" g/ B2 PThis trick is similar to int41h/4fh Debugger installation check (code 05( u. W' Z- b; R* ?" }. y0 o
&amp; 06) but very limited because it's only available for Win95/98 (not NT)( C; `7 a+ g2 _1 W1 [
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& p: z4 ]8 X& a; T
( n& s) `( e1 a) K, D6 |7 ~   push  0000004fh         ; function 4fh9 x) q8 J1 K+ b. P# P& R% E4 ]
   push  002a002ah         ; high word specifies which VxD (VWIN32)
" x, ?4 Z8 e/ J6 x) l5 A- y                           ; low word specifies which service8 A  u9 l0 \& Q  t. ^" K
                             (VWIN32_Int41Dispatch)8 I- q; ?$ F: W7 G
   call  Kernel32!ORD_001  ; VxdCall
, x1 E8 Y2 r4 ~& F7 n4 w) T8 M4 \   cmp   ax, 0f386h        ; magic number returned by system debuggers) ^6 v2 M  L4 Y% c  p4 i$ J
   jz    SoftICE_detected( M9 W+ G1 O$ J9 Q9 P- T" Y; v

1 [: H7 B2 O! \7 MHere again, several ways to detect it:3 u+ O+ d' h' e, t6 t

7 |0 ^! l! z1 E" q6 a  `    BPINT 41 if ax==4f2 M; |& G( c  a

, h1 v) O; O% X/ \0 v# ]    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 T' ~2 t. i! m5 x6 g, E" F0 F
+ j1 d7 F# m' ]6 G% T8 P    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) O- z  \! D. H1 N* i* M5 K+ |

. z. w  F+ G" i* s    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ C* Q2 _4 ?; r  x. k7 e2 k( P6 A  R" A  G3 B. `
__________________________________________________________________________3 u9 g  T# M7 _, a- P
; Y: i, Q% f% a
Method 13# A, W2 o0 I: n4 p' d, M
=========
$ e$ J9 d1 T# \: a5 x. O& |/ ]# Y: {% l! S& O( ^: r% n
Not a real method of detection, but a good way to know if SoftICE is
' J* S- s$ I; xinstalled on a computer and to locate its installation directory.
% }5 D: |3 }; `4 J7 q- KIt is used by few softs which access the following registry keys (usually #2) :2 T; i( [, Z: A( i

" W* l% y( j5 ^6 u-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, y) `$ Y# @" b0 e. I: H\Uninstall\SoftICE
/ Y4 U4 j6 d- M0 d-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 k' y( g, O1 q& G0 d% e2 i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
5 _2 u( o3 b5 {3 }" t\App Paths\Loader32.Exe
, O- z* k, Q* p$ Q; r5 V4 W" g1 _, i7 N
+ S2 k" j3 Y0 ]9 S# p
Note that some nasty apps could then erase all files from SoftICE directory) ~$ X: q8 W. o6 ~3 L8 t
(I faced that once :-(
; G, l# U% q! u! G' S
1 W/ G  \  |* S! Q7 B" FUseful breakpoint to detect it:
1 m- a- N# S" c" ]! N5 O( Z
+ N# ~1 F, ~+ F) Y; E2 w5 q4 \' g# m7 i% u     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ s7 Y6 i" @' y1 j
" n6 l' C$ }% d% W/ Y__________________________________________________________________________6 H2 j& p- U* l+ c
3 |( j- x( @. ?$ A: Q! Y4 ~: l4 N( U. d
, C( [1 Q8 G, }4 k
Method 14
8 }; n3 f/ t% z# O" Z=========5 p2 d! }$ y# Q8 Z8 N  M

) o! h; |% {) \6 c7 l* s& b# SA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose. I1 N" u5 x9 E2 P* W) {5 G
is to determines whether a debugger is running on your system (ring0 only).5 I/ ~: e0 b' Z# W7 g) ^/ k
3 A+ O6 A" r4 T- C
   VMMCall Test_Debug_Installed' y. S; J& @& m9 u- M' F. }0 q
   je      not_installed
! K1 W  j1 d5 e$ L' ]! B4 X8 C0 ~  I9 N5 p' z9 b$ `
This service just checks a flag.
2 N7 `( D6 A  s# S) z+ Z& |9 V) {</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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