About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>7 Q) j- P1 q( E7 s# r8 p. S& q
<TBODY>& f; E! X$ q$ g: x9 K. e* \; w+ g
<TR>
/ I2 Q. Z" ~( J/ _  M<TD><PRE>Method 01
* j! A4 e* o& t# v=========" ~3 S/ d9 |& X
. C4 H2 r: m; Z5 r
This method of detection of SoftICE (as well as the following one) is
+ C3 Y7 J4 j. ^" X/ c( `used by the majority of packers/encryptors found on Internet.- n  _0 E6 Q* l+ E3 K
It seeks the signature of BoundsChecker in SoftICE
& Y/ P" G% c: D# K
2 H5 ~5 ]; S6 r7 m  r) [6 y( s    mov     ebp, 04243484Bh        ; 'BCHK'
1 u) R' J: p* G" V$ E    mov     ax, 04h; W5 I8 F- p  P5 z6 J
    int     3      
- n" E7 u5 S/ N  {. F, M" x# K    cmp     al,4
8 ^' }( y; S- o    jnz     SoftICE_Detected8 G; ]' i. \7 E$ C  k. H

1 b8 ~/ }- I8 V6 ^___________________________________________________________________________
8 g7 V/ B7 \( v: Q: u
! m3 Q& I/ E1 OMethod 02% t, ?4 ]! [. k, ]8 |
=========% f2 a& X0 b5 p) w; r

& K% E8 D7 D6 c, y# HStill a method very much used (perhaps the most frequent one).  It is used
+ F- Z; |3 c2 d! |) X5 ^, \: Bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 H+ R9 T( N  z7 t2 \3 w# v
or execute SoftICE commands..." O7 I8 y6 Z$ o+ M
It is also used to crash SoftICE and to force it to execute any commands
" G% d2 }; }, b: C3 i& g(HBOOT...) :-((  & u* `! h9 f% Q3 o7 C" j) }. U

# ~/ M' X: T; P: ~6 W' l) G! zHere is a quick description:
0 ~& ~, l" H; n+ T! J8 m+ j-AX = 0910h   (Display string in SIce windows)! N/ p0 W6 H6 b% V$ ?5 t8 {
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! g' b7 ~- K+ r0 I, Q, b
-AX = 0912h   (Get breakpoint infos)
7 c* [2 f4 M7 j$ s5 ]2 u: U% d-AX = 0913h   (Set Sice breakpoints)
# Y$ j9 P% ~" h) i' v* {( a-AX = 0914h   (Remove SIce breakoints)! `9 Z3 c# b5 v3 Y( N
- z; H2 y8 r+ q6 T/ y3 O; k
Each time you'll meet this trick, you'll see:
9 K) d; T; U1 h/ e! l  k-SI = 4647h
. L+ {7 r2 ^/ o6 ]9 M( z/ {0 \-DI = 4A4Dh
' ]7 B6 ?0 Y. |. O  j" P" \Which are the 'magic values' used by SoftIce.1 C3 A( s' T# c. J5 t) z( {
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& X. a7 Q/ g' A0 v9 S5 N0 E( O, k+ a/ r& l6 i+ l
Here is one example from the file "Haspinst.exe" which is the dongle HASP
; X+ F( U2 g( j7 iEnvelope utility use to protect DOS applications:
7 U2 E1 ]1 l5 g
# g* s- h" b; j1 J2 L6 e. y% X5 k/ q2 Q
4C19:0095   MOV    AX,0911  ; execute command.! |8 W$ F  F3 ^. h1 g
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
( n: ?8 g/ f/ v0 [( K4C19:009A   MOV    SI,4647  ; 1st magic value.: Y' c9 Q' d+ {+ [4 \: D
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
* T2 w" F& \$ ~; n7 o4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)/ r" z: s+ T7 F
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
$ N* b; z$ d5 }6 x3 L4 ^$ [0 k4C19:00A4   INC    CX4 W5 f- D3 h$ t" J+ B  l: x  [
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
8 E" A9 p  o. q/ Q' r4C19:00A8   JB     0095     ; 6 different commands.$ B" n6 p) W1 \; u. k$ ~! Q
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% K1 x2 P5 E" L: E! K: w8 S0 R4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 z7 H& V9 m1 A2 D
+ K* G# ^. W; u2 jThe program will execute 6 different SIce commands located at ds:dx, which4 b4 A. s/ E, ]! |
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% }& B# l7 ~8 z) d! e
" W5 u  F. L; M& \  s* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% u/ E% s& ]: X0 U# q6 E8 }
___________________________________________________________________________
" x5 Q6 @8 G7 c% O9 s( V7 {2 z& M! z* O  _/ G, a

9 T: k0 S4 Z  s$ o* A" R: `Method 03$ \: f, Q! a) E( T- P
=========
8 X6 l! u/ Y. \0 S6 T/ h1 q% R) n# e+ ]. p8 M5 U( D
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
. e& S1 j! [/ Z, n0 F(API Get entry point)
0 e- ~4 n5 y0 u1 \2 g# u7 L9 X6 p        ( \/ H9 \! T4 F3 |

; m! r& {: H1 i5 h  A6 c  K    xor     di,di
, p9 D5 u7 Y0 B    mov     es,di
" X: Y2 Z; q8 [" L    mov     ax, 1684h       : P& b  n: Z+ F7 F; e1 O6 U, c, Z, A0 T
    mov     bx, 0202h       ; VxD ID of winice* v3 g9 U, I7 Y. M9 O2 Q$ U
    int     2Fh
+ `6 X$ Q$ l8 i7 k7 P" a& @8 w    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& c6 [5 P$ q* h8 H: ^9 g    add     ax, di
9 Z1 q! z) K- c; a/ ]    test    ax,ax. [- ~, A. A0 Y5 S/ G5 z7 ~
    jnz     SoftICE_Detected
; R' Q* P# E' g% A, T2 Z, R% e, m" H9 p/ W5 @
___________________________________________________________________________
9 x- \6 v, X0 ~
5 Z! S1 `; v, x( U" IMethod 045 I( g- X# W" y
=========
. t" p( i3 i3 l  d% U- N+ ~/ `3 \4 E) f9 G) Q" I
Method identical to the preceding one except that it seeks the ID of SoftICE- d  F/ q9 S$ X" V
GFX VxD.
+ r' M! ^% u* X9 n; @; Y( S
4 U! J  S) W! G( \2 R6 I    xor     di,di
$ D& u5 b  Q6 c7 b" i    mov     es,di
" U8 e3 R) T0 h  @* f% t    mov     ax, 1684h      
5 d8 w& o0 X( c: N2 o) D    mov     bx, 7a5Fh       ; VxD ID of SIWVID
- j4 \0 h8 a) e* w  d0 e    int     2fh
2 l8 N( G, w: `# z0 R    mov     ax, es          ; ES:DI -&gt; VxD API entry point% o; Q6 h4 d( h3 U1 B
    add     ax, di
9 S2 N4 S; Z8 v8 F! @3 b! W    test    ax,ax( B! @8 j1 {6 d- m
    jnz     SoftICE_Detected
6 f; x- {) P5 {0 n0 v( q  C+ a% \' v3 m4 c4 X  ~; B# f1 a8 F( C
__________________________________________________________________________
) n) t; h1 W% r+ U' B0 `$ i$ E2 e( H' H+ e

- A) l9 f# ~4 R1 B/ hMethod 05
  o3 a" N0 k: }6 z=========
$ ^' I  A' p  C; b7 ^- F
" |0 M" {# Q5 hMethod seeking the 'magic number' 0F386h returned (in ax) by all system
( x" O8 @1 Z; }" Ndebugger. It calls the int 41h, function 4Fh.
6 i' L+ s2 p( m- sThere are several alternatives.  ! u  x3 d7 P$ A  g! }/ g) S/ E
* c9 p, u# F5 {. `0 g
The following one is the simplest:! r, |6 |: j4 D; h
; u( t' B; D. M2 H
    mov     ax,4fh
& x# v3 {, E; A1 m    int     41h6 b/ R  g! R1 X" }2 S) G; K3 p
    cmp     ax, 0F386
2 z' d/ e* z" O, I6 H: O( Q    jz      SoftICE_detected
! z0 V& F8 y7 A2 O  E% w9 l5 g: s* [7 Y* h0 p/ a1 H+ ~

+ I: n3 e3 |$ X8 yNext method as well as the following one are 2 examples from Stone's ! i$ K/ @; d4 B- s" z" [+ n; y
"stn-wid.zip" (www.cracking.net):
& I* V% t; K" _9 N6 W, H+ V6 {$ @5 k1 [4 h  r, w. p. P) a
    mov     bx, cs
9 x, o- p3 F* E7 S8 c3 D    lea     dx, int41handler2
: Z# J! O3 A  ^& X& e" y' n4 `    xchg    dx, es:[41h*4]
: _& Y+ k  ^4 T& i+ w    xchg    bx, es:[41h*4+2]4 y6 f/ o. T* v8 ?# M2 r2 o, r' s
    mov     ax,4fh" P$ l( f) g! g9 A! \7 A' S% Y0 o
    int     41h
# ~/ d% o9 H4 }- a3 y6 F    xchg    dx, es:[41h*4]
" L6 g1 Z" W0 f3 [% p    xchg    bx, es:[41h*4+2]
0 M7 w% ]' K! w7 z; P    cmp     ax, 0f386h: u9 Z- z* z2 D/ m' J0 [
    jz      SoftICE_detected/ y6 @! _! e( H, N9 t6 ?# R
' @% A% O4 C  N9 |% o/ N4 V6 k/ x
int41handler2 PROC
6 k3 M" h7 H& K5 B! ^! P    iret
& b# T, l1 U7 S4 p; {int41handler2 ENDP
+ m! b! A2 O8 e+ A* N) w" _7 _7 n7 h9 q) \. W% P3 m8 S% V

* q  G; w( |3 _3 {9 u_________________________________________________________________________- t4 c( k9 N7 c4 D/ [1 H

5 J) C; C1 I1 }/ P: X+ X
' P7 b7 }; ~) @7 J8 b& b* WMethod 06, B/ E: N6 z( c' W8 h( X
=========& N. B" t6 ?! m6 D

$ C/ i1 m9 [/ K7 d
* n1 M; P9 _2 R2 ^2nd method similar to the preceding one but more difficult to detect:
' Z$ X1 W) I- n
( c: A0 g. c  h! _
4 W) e" q2 z5 c# g% B. v7 Yint41handler PROC
. R* j0 q5 B4 g4 K& g    mov     cl,al
7 L* L7 w! ?/ `  T$ Z8 T! x6 ?; G    iret- {  O1 b' @: h9 g
int41handler ENDP8 a, b7 E8 j. O; G/ B7 q+ g, m

- I! Z5 r5 ^  k; s7 e& h0 L3 m+ F* f/ Y( u# g6 `0 H
    xor     ax,ax6 Y. ?- \3 w9 J+ x/ Q! e
    mov     es,ax& n: }9 r* v4 Q# w6 q' i% U( L
    mov     bx, cs  ~1 s; ^$ n# K) L9 A& l' {
    lea     dx, int41handler" G) Z' N  O. T* z0 b5 L: {, m+ p" z+ p6 m
    xchg    dx, es:[41h*4]1 b% t( H! n6 o; w2 l, D: a' ]
    xchg    bx, es:[41h*4+2]3 `+ C4 C- w! J6 E) _( Q
    in      al, 40h
0 l' i8 L8 L8 `9 Z. i0 q    xor     cx,cx/ M# B1 ]( U+ D; `% p$ T4 k: x  ?
    int     41h' \6 _$ M+ n+ W7 E! u8 x7 O  W6 X( c
    xchg    dx, es:[41h*4]+ [- t% _/ s5 u% r
    xchg    bx, es:[41h*4+2]: l6 Y  B4 T8 t
    cmp     cl,al
0 S, w  ~; h- [/ Y3 j    jnz     SoftICE_detected
% @9 c  y  E5 J; m6 ~% z1 m, d$ L* |5 n: W  i9 c. m
_________________________________________________________________________
7 D3 O- J& ~: p8 H5 g4 U% `9 K$ D" d; `. _
Method 07
9 n  b" H$ N* B& B: U( u& Y=========
! k, V& @& }; v9 o( r; ?7 i; Y. L' ^( E! p4 y
Method of detection of the WinICE handler in the int68h (V86)
6 k) D7 p) Y2 e" R- }' H/ R. K( o% J8 e# B% d* l0 s9 {
    mov     ah,43h0 @2 \9 ^. R4 h5 o* O1 d  @. v
    int     68h
! d$ e% x6 X; r" o  Z; Q1 Q    cmp     ax,0F386h
2 t! k2 S- j+ k$ [    jz      SoftICE_Detected
  F* C7 u1 s  f8 H/ N8 H
( z8 z* j3 X$ t( X  x
" ?4 M3 w" i5 y: ?% H8 u8 I6 o, ]=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 V! L# N$ d$ _" z# X' |. n; A& d   app like this:3 _! Y! o6 n6 g1 P" Z" ^% X+ G
9 @: \/ m9 X; d* `: N$ ~
   BPX exec_int if ax==68
7 Y5 H8 a$ E6 o6 l# n   (function called is located at byte ptr [ebp+1Dh] and client eip is
7 j4 I* E6 Q# G   located at [ebp+48h] for 32Bit apps), P0 v/ h1 Y: K9 k0 Z3 L3 p, b
__________________________________________________________________________; ]6 L. U$ }" {8 ^5 @' o

5 E$ }9 {/ }+ n1 z6 ^* h( E
% R8 i9 h- V7 D; ~Method 08
4 @) U- I* C' h/ V" K" w=========' |' O2 Z6 h0 Z6 V: O
# I8 J/ B- U( ^6 E1 ]
It is not a method of detection of SoftICE but a possibility to crash the
+ P1 z9 G9 t/ Y4 psystem by intercepting int 01h and int 03h and redirecting them to another
0 L; D$ `8 I$ vroutine.* i7 T! W: Q9 [( F* u: r
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points- f  z3 @% ]. S3 n
to the new routine to execute (hangs computer...)
" w8 N+ Y+ b$ n" ~5 f. `( u+ h" G$ W. |
    mov     ah, 25h- h& i$ g' c# \, `* M! M
    mov     al, Int_Number (01h or 03h)3 \5 x# c+ M: M  {" N/ @: M
    mov     dx, offset New_Int_Routine! B: t/ k  y0 Y6 D1 e
    int     21h
& G! v) R" w3 @$ u
( S8 B  O. E" W0 X' h0 m, [3 E$ G. I. t7 ]__________________________________________________________________________% P5 T/ e7 W3 @8 X' `5 v
: i! N) r6 x# q/ r8 E: L
Method 093 ^) U+ A& W5 G  a6 M; j
=========# n' m, [7 ?/ G3 E- W. _

% j; u9 F5 Z! D/ g" z9 ZThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% U( s8 X; v$ j; Dperformed in ring0 (VxD or a ring3 app using the VxdCall).
3 J0 x5 q- A, E) c, IThe Get_DDB service is used to determine whether or not a VxD is installed
0 Z5 T, H6 t+ r% tfor the specified device and returns a Device Description Block (in ecx) for
; F8 T: R5 W- p% z6 {) p9 h9 ythat device if it is installed.
5 F, F1 V8 Q$ [: m; P  ]
4 ?1 w* E; R! C. t& a' `# N# v   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 D7 E4 y* k: H9 ?, X# {
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; q8 a" k: S: w; _8 q   VMMCall Get_DDB# z+ H- @  G% q: j7 m* Y
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, w( n5 \8 k$ ~+ Q2 E7 C7 Z7 ^. j
( L8 _- n; ^/ t5 |4 B0 w3 J9 xNote as well that you can easily detect this method with SoftICE:. F: D1 g# C, K4 j
   bpx Get_DDB if ax==0202 || ax==7a5fh5 M3 D4 Y( s0 c' h
, H+ u9 i8 l- }  g8 F- i
__________________________________________________________________________
' o4 ]( w4 J* a) q% |; [& c- g7 v( I( d5 q3 X
Method 10; g' E1 p% [& ~7 _, L
=========- G( z8 I; q* F

! c3 R6 n# x! p: ^! W=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 D) s1 \) w. k4 m' S  r  SoftICE while the option is enable!!
1 K! a+ G4 H: V1 J' E# c; d: I
5 c3 z. R" R$ d7 }9 oThis trick is very efficient:6 L+ Q( n2 j; l- ~. E' ]
by checking the Debug Registers, you can detect if SoftICE is loaded2 w  T  b, I$ I/ k3 f; I1 m, S
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' x2 E0 z- N5 A. {
there are some memory breakpoints set (dr0 to dr3) simply by reading their
0 s+ _' j( P7 [4 h: V/ xvalue (in ring0 only). Values can be manipulated and or changed as well
  ]2 s- c6 @: k, F7 o(clearing BPMs for instance)
9 x' [6 D, N! G6 Q
3 [/ @, l) K- N" f__________________________________________________________________________
, L( r. L! {, }0 n5 O) e/ Y. g7 N4 x. l; O" C0 M
Method 117 `$ Q+ `5 S' ^& K
=========% h3 n- H. u) C5 ?9 W

1 s' v% }: b. `4 p7 A2 dThis method is most known as 'MeltICE' because it has been freely distributed1 o& V- K6 j5 O; t. k% k' b
via www.winfiles.com. However it was first used by NuMega people to allow: i0 \1 u9 }' [$ ]
Symbol Loader to check if SoftICE was active or not (the code is located, [/ N( T! d) W% R. ^% C( Y
inside nmtrans.dll).6 w& E* M: U5 Y& t

+ E. u/ l% ?0 \6 bThe way it works is very simple:
, v7 d: X& m. ^( wIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for  Y. V9 z, ^% ~" ?+ L
WinNT) with the CreateFileA API.
3 J; r/ F- o5 u( V- H" P9 p0 f( _) _( i- a( M
Here is a sample (checking for 'SICE'):: i$ l) h' c8 D6 Q
  K$ @- F8 x2 V1 u# ~4 Z6 F7 [2 }& `' r4 [, @
BOOL IsSoftIce95Loaded()3 c- {' w) F+ _, B$ H
{
! I) r0 k/ c- v! K7 ?0 L/ r   HANDLE hFile;  
) V$ v3 y9 i2 t6 Q* s   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,, c8 _' b9 B4 X/ ?
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ A8 }: h' S* r; k& b3 n                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);- e& U6 U- F! n. K8 |
   if( hFile != INVALID_HANDLE_VALUE )
8 W. B/ q# x2 T! C$ U   {
1 l' V$ k0 Z& |1 z2 }      CloseHandle(hFile);( s3 f7 f+ w$ J5 f: A  ~) C' t
      return TRUE;: f7 p  S) Q5 I. k6 t9 O  \3 w
   }: _0 @- ^0 D! y: D" _7 f
   return FALSE;. s9 I/ l0 T# }# W( F
}, P' ^. r  ^; @% H; m5 t' m+ _% s
3 a1 ?: ?( w- G1 _9 M6 e4 Q
Although this trick calls the CreateFileA function, don't even expect to be
6 H+ x4 s( z( K' wable to intercept it by installing a IFS hook: it will not work, no way!
& F7 V( d9 L7 f( M" UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F; j4 z- A' g/ u
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); h) x% p- w! O! K& r
and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 z9 Q: U1 P5 p  N* F* h  ^
field.6 w7 I+ Y1 {: F3 k1 J+ {8 I
In fact, its purpose is not to load/unload VxDs but only to send a ) {. m4 y7 M# L1 Q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)4 K8 |6 @$ o% L* N" s+ Z
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
2 b$ v" I4 \& R/ e& ito load/unload a non-dynamically loadable driver such as SoftICE ;-).
  B4 }9 L! G4 {2 ]+ s- TIf the VxD is loaded, it will always clear eax and the Carry flag to allow# K9 j* o" P) h9 s% h9 i# Q
its handle to be opened and then, will be detected.
/ a" y( Q2 ^3 [# J; HYou can check that simply by hooking Winice.exe control proc entry point
( U2 m: F  ~$ z& T% r: x7 u5 _while running MeltICE.6 I! y6 \* f, ~5 m; m" a# p
( ]- B  n! t9 v; e4 `

# x2 @& s! e3 u% c+ l  00401067:  push      00402025    ; \\.\SICE7 h% i  I" k6 d% T4 i4 O
  0040106C:  call      CreateFileA1 Z1 s4 w+ H! c1 o& |
  00401071:  cmp       eax,-001, r$ k  o+ q" r* [; T
  00401074:  je        00401091. f! ^7 K( h- ]1 z% i( B0 c

* U8 S/ E8 u+ ?- e4 p& q" c, {/ g" d. c* G; Z- [8 d) p& C, n! y* p
There could be hundreds of BPX you could use to detect this trick.& ?( ]: d6 j2 g5 A" K
-The most classical one is:& j) y) A; d2 U
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 g# f8 U3 O: }: n
    *(esp-&gt;4+4)=='NTIC'
. K" O- ^" D) |  a1 B% z1 A. a; O1 `- [/ c9 L2 h- Q
-The most exotic ones (could be very slooooow :-(" x, v, o% h/ o0 z' o6 ]
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ |1 D& d8 C0 @: M     ;will break 3 times :-(
& z' t" [4 J% P7 }/ O7 K# u7 v# v4 }0 i! f- d5 m1 J
-or (a bit) faster:
/ w4 }" [" W9 i# f) _7 z3 R0 _8 W' X   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 T( R! Q# o# }; t
3 x7 f# I! ^% b
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) O. Y1 h& u; {" T& J
     ;will break 3 times :-(
; |/ b* s9 K# F6 G  u0 e+ G
( m0 r8 ^: ]$ W# F" }$ o, A-Much faster:
- v* J; J( p3 g2 E5 U   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& m6 W0 ^7 B0 m; W( v" |3 L. M: v: s
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen# z4 i/ e8 [! b
function to do the same job:
6 v! r0 E% I. o  h8 _2 `7 j+ v7 Q  w) L  B, y) ]: U/ j
   push    00                        ; OF_READ
1 D1 {& C  ^7 {9 E. [& F   mov     eax,[00656634]            ; '\\.\SICE',0
2 l/ A4 V  }( N& b" x5 y   push    eax
/ @, }, ]4 u( Z5 [   call    KERNEL32!_lopen
* }5 }6 {6 J# V) o; p% {3 [   inc     eax
2 e8 L% v6 z7 `   jnz     00650589                  ; detected5 o4 E% K. }6 m) c! _
   push    00                        ; OF_READ; l/ ]7 t+ @/ h# u$ c
   mov     eax,[00656638]            ; '\\.\SICE'* p, s7 k2 h; b( M
   push    eax/ L. C/ z  G: a$ P# I- ?5 h0 I7 a
   call    KERNEL32!_lopen: d9 E1 Q5 }7 r0 @
   inc     eax
. z9 b  H5 D1 T6 z/ i' U3 i6 p   jz      006505ae                  ; not detected/ p: s) N- v  `- ]) i, E+ r

2 U8 v/ Y! g: h0 r7 K0 Y% _6 N
7 B0 C. F- r' D__________________________________________________________________________
. |& O! \, E1 r. t8 M
! g/ x$ Y& f( RMethod 12
$ ~3 a& ?7 |8 ]=========' v7 S; q5 k: m3 B9 E1 e& Q

4 z1 t) v0 V: t/ f3 UThis trick is similar to int41h/4fh Debugger installation check (code 05
  j1 J' O8 r! D* F$ ?8 ~3 h&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: x# G- x. l. O8 V# H8 S1 Cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.% S1 u& A9 W* c- p

& R( [* l" L: i: s/ |   push  0000004fh         ; function 4fh
3 ^* G- B5 ^( w# ]: J8 f3 u   push  002a002ah         ; high word specifies which VxD (VWIN32)
; b1 q) t7 P8 Y. I                           ; low word specifies which service
5 ?4 D+ ~) L' J                             (VWIN32_Int41Dispatch)
% z; i1 h) V* q* `  j; C4 y2 ~   call  Kernel32!ORD_001  ; VxdCall0 V% H" I; ^, x- h
   cmp   ax, 0f386h        ; magic number returned by system debuggers/ m: t% i0 Z( n, V3 R6 i
   jz    SoftICE_detected
) @. R! {1 E' U& ?% U) r( _( r+ X4 W8 p+ R' D  b( |  {5 @
Here again, several ways to detect it:2 d( V( ~% \, F  B; L  d2 {) h

8 U1 w# H  y3 o0 P    BPINT 41 if ax==4f, j5 Y) k0 {: N6 L8 a( @2 n

8 ~7 i7 Q- P# g8 g: T    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 |5 E/ X& ^4 J* Q" z4 M" p8 ]5 N& T2 Q0 G$ K) r! f, U& b9 t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  m# w% c5 v( ~( N. @+ ]
0 Y% d# t1 R! K5 L9 D5 T( }' X  r
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) j8 S  }" W, w1 X2 L9 D
2 I) q% I2 P- j! M__________________________________________________________________________
$ Z* y: Y7 m, C) E8 N; l
2 }& D7 ?' m5 m) V& rMethod 131 N9 F  S1 M- B. @
=========) l' V! k9 _; {7 l! N5 H* `
7 N, {3 j" d+ \) U
Not a real method of detection, but a good way to know if SoftICE is
$ c- S# B# Y# z! Linstalled on a computer and to locate its installation directory.7 g( ^+ \" x8 X* c6 H
It is used by few softs which access the following registry keys (usually #2) :
0 t1 o: |+ ]) f- H
' Q3 q- g( H8 e: z' l6 `5 E: C* g+ b-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' A# [0 m$ w" o9 y, k- g\Uninstall\SoftICE
: Q0 x, |$ k3 t  D' j$ R) l4 r-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE" @2 c# E; N( R$ `. N9 v
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 R2 E/ A, U6 v0 {\App Paths\Loader32.Exe1 H: B  e$ d+ v' X3 m

2 l* G6 Q' F0 @' \* B4 |0 k
: b* L2 G7 x* c! E9 f! xNote that some nasty apps could then erase all files from SoftICE directory2 i: J1 v/ I* \0 {' R" F5 I, v" R4 g
(I faced that once :-(
$ g( w' {* N( [0 R+ n
0 D" n7 K0 Q: u' LUseful breakpoint to detect it:
" O7 j( j. o5 E/ e% z2 u0 P' N5 z  I, W2 X# |% S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ w2 S$ k  q& n0 {& l5 ^+ d4 e4 i1 z8 V+ P
__________________________________________________________________________
+ S8 t6 S5 O+ |4 |4 g+ T/ c* d+ m  m: c8 c( ]% j

' ~. v* J( h! z# ]+ Z, A. N. AMethod 14
  r# ^8 e% J( h5 ]$ F7 M0 K0 I=========
/ n4 ~, b& J; `# w3 Z
4 m5 _7 ^8 W4 ]6 Z. M2 J7 f) @A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose' L' _# e- i2 e8 \
is to determines whether a debugger is running on your system (ring0 only).7 J1 m* M4 g7 b0 B% ^8 ~7 J

! g, c, y7 M( n   VMMCall Test_Debug_Installed
; G) n2 R5 f1 p7 `$ A1 A  j   je      not_installed
1 q9 u" H, d" w. [2 b2 L. s
2 e$ l9 L& X' v" OThis service just checks a flag.
4 ~) U; ?' g3 L( h+ `</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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