About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 o$ T% H1 J; `+ u3 B
<TBODY>
7 p6 _0 K. V  H- X+ r8 W# T<TR>
& k$ i5 V6 \$ W% [" g4 `% ^# i<TD><PRE>Method 01 1 {4 C2 m: J+ N# s0 X8 ?4 S6 h
=========
1 ]& z6 d3 F( [5 k, ]1 J: U
* d- ?/ {' N4 V+ T6 y3 aThis method of detection of SoftICE (as well as the following one) is2 a8 O2 ]' l, p3 S) f
used by the majority of packers/encryptors found on Internet.  [( @) \- S% V; u5 K* x
It seeks the signature of BoundsChecker in SoftICE
. q3 T" q0 P* }9 n1 Q
! F( d  V3 U" p. A- H% ~: s. z    mov     ebp, 04243484Bh        ; 'BCHK'
* p4 _0 {( Q9 D: F! m    mov     ax, 04h
, S4 E  X" p9 F. h    int     3       3 j2 z* v) h& j1 C
    cmp     al,46 A/ d$ j0 j9 z& j7 n0 Y
    jnz     SoftICE_Detected
$ e1 V- V% G! j+ Q2 U
- H8 W( z' M) T7 O" {2 h1 C___________________________________________________________________________9 M) T, N/ M! u0 B1 j. k7 z
& h; i1 @, t8 z: A& \$ K$ `
Method 02
5 F" o$ R/ F; D- _5 q' H' i# r=========- A. A( ^/ N7 Q
9 y6 A, _$ H$ p! K% l5 I
Still a method very much used (perhaps the most frequent one).  It is used5 d. @' V( H8 L/ X
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,$ ~+ o9 L6 }: C& j6 ?
or execute SoftICE commands...
( r* v' T! g+ V) c3 kIt is also used to crash SoftICE and to force it to execute any commands3 G4 N! m# t+ U# ?
(HBOOT...) :-((  & E, d1 J$ _& Q: o/ p! {
/ Z  N9 W5 k* o+ y# [! i
Here is a quick description:
0 a+ g- g$ b" l3 K3 X+ G6 E, Y-AX = 0910h   (Display string in SIce windows)
! [' D( w; ~1 t, w-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) \7 C) N! t  P
-AX = 0912h   (Get breakpoint infos)
9 d- U8 q5 ?# q* c/ p+ ^- Z-AX = 0913h   (Set Sice breakpoints)
; t9 |3 B5 w+ O! G-AX = 0914h   (Remove SIce breakoints)7 r# p9 E3 R0 `7 c$ G3 E

3 p+ m; A+ h) y/ Z& D3 Q* q2 TEach time you'll meet this trick, you'll see:/ G+ I' k, z3 l3 C, Z( Q  h
-SI = 4647h+ B3 ?1 W/ v! u3 z
-DI = 4A4Dh
4 x: g7 D% ~& zWhich are the 'magic values' used by SoftIce./ s3 H7 J' n7 l* B* n3 ?. ]8 G* \
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
' k/ p. V# c) g2 a, d
4 n9 d8 `) {0 s! [& NHere is one example from the file "Haspinst.exe" which is the dongle HASP
7 M/ ^" p+ ~9 M" H. Z% t2 _Envelope utility use to protect DOS applications:8 Q/ J, l: W; W6 n% I
" B( d( @2 ?; g$ d
1 k" G* [1 W% v& M% X: w6 P* T
4C19:0095   MOV    AX,0911  ; execute command.
* o2 m9 ^; Q9 P# r7 H! q% a3 K/ s4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. @6 d; H  l5 R$ G) r
4C19:009A   MOV    SI,4647  ; 1st magic value.
# U: g8 h4 @* ?; t! s4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: ~0 B  r. K' M8 m9 Y" n" i4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- b( v, k9 R) W6 t' h  `! A4 j4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* c2 U$ V+ j# f! G
4C19:00A4   INC    CX: M7 ^( a  A, q% N- Z( C
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
; a6 X& c! ^0 x- s* r7 F2 G3 w# q  |4C19:00A8   JB     0095     ; 6 different commands.
) {6 t( E# D% i# {: K4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
& h" s5 b6 n" A4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 t$ S4 w7 ]7 P! @+ L' f# e% X
& t  D  a& I" r2 u" B$ |) K- gThe program will execute 6 different SIce commands located at ds:dx, which
. r( m5 r( \+ o4 f; _. sare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  M/ f! R$ S. U2 W  C# b
) H; R6 a6 O2 k# T/ ~* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% N- C* W3 k3 g! ~# [. m  `, q
___________________________________________________________________________
# f" D1 Y# d3 A) u
% R+ G3 z! B. R! @
. m' j# q6 V/ DMethod 039 n0 H: B0 j" s
=========
1 T  m. L& k  k+ g. L, C
: \  P% J3 W+ |: x: kLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( Y% T0 s7 q( ^(API Get entry point)$ m; _3 ]! H1 E
        3 l% Q! D& C9 @

. W/ e! ^2 w! o, \1 ], v    xor     di,di# I+ b0 [  T0 M8 h- I3 G
    mov     es,di. u4 s# t: G3 y) G* J
    mov     ax, 1684h       / L% u5 ^! F6 y% G
    mov     bx, 0202h       ; VxD ID of winice% T& x5 d* B6 H
    int     2Fh
; t9 d( f; O; r  U1 U  F: `* L9 l    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ L, G9 i! n  A2 K! _3 X% z    add     ax, di
$ H- A8 b/ A0 }2 w6 H    test    ax,ax
" V( C+ Q! R4 G$ l    jnz     SoftICE_Detected. h7 G0 c& F$ I
- [% z3 W. F8 q
___________________________________________________________________________
0 a) U* }8 Y4 v( t% G4 ]8 s
5 z8 {) y- r5 c" wMethod 04- \: `8 c8 E. T* o  Z7 |
=========
. o2 r5 e& s* e$ Q6 e/ g6 t& B9 W& ~2 n, E! K, n
Method identical to the preceding one except that it seeks the ID of SoftICE
! Q5 n2 u' z4 v' q) K4 TGFX VxD.+ n5 @8 R1 c: J$ a6 f# \2 }

" t2 M% f  y, d; [    xor     di,di9 X& w0 T$ T: E
    mov     es,di$ x4 [  G3 G5 L2 c! b: }( v0 @8 ?
    mov     ax, 1684h      
5 m) a7 Z( p! w. P3 x% V3 P/ U    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 d$ [+ l0 p: D9 ?6 g- Z
    int     2fh8 G+ N4 E9 v: a7 k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, D3 F* ?! E5 S  q. ~8 t    add     ax, di1 K! |6 e2 X' h
    test    ax,ax$ F8 f2 j0 p, \0 q7 s& v/ L, G* \
    jnz     SoftICE_Detected# p9 Q) z+ N- _, u, p% H$ E7 E

! P2 ^. Z+ G. z; O+ F; z__________________________________________________________________________
( v- A0 R  M7 U! ~; L  g7 F4 Q! X
$ U( H& N7 d/ F$ u1 j3 D; h+ k( q8 Q4 G, R2 b$ M
Method 05' C/ s5 c% i# A5 w( P) c. a
=========
$ o* Y! B% ?9 c2 `9 p
8 `! N4 f5 Z; p/ C$ o, IMethod seeking the 'magic number' 0F386h returned (in ax) by all system4 o( ]( m3 f1 e# x" m4 c
debugger. It calls the int 41h, function 4Fh.
; f* v9 c8 t# W4 m: M) v4 a) ~& SThere are several alternatives.  
& h, w) o# A# ~; W2 F. I+ L3 w* U; P4 O0 U5 Q
The following one is the simplest:# s  Z9 j( i' a- A7 {

5 |, r9 ~# C. D1 o    mov     ax,4fh
# ~. U0 w+ @2 G* A6 m, |( |( R0 @0 m    int     41h5 u# m& d/ [: m
    cmp     ax, 0F3864 s% J1 [% q* G/ D2 V2 Q
    jz      SoftICE_detected
. X- C- A8 i  h6 V) x& {
# n+ Q; B. Z# }) r* @* E) p. U# o( z: A* i  O5 s& J" {/ B$ o
Next method as well as the following one are 2 examples from Stone's
* m* Q! o- k' W' p- X+ \- x"stn-wid.zip" (www.cracking.net):) e& I/ e# ?$ ^2 t% k
8 l. C' V3 m- Z3 F' P* _
    mov     bx, cs. i7 Z% K* ?& N) Q
    lea     dx, int41handler2: N5 b! Q' w5 C6 A3 W3 r
    xchg    dx, es:[41h*4]' ?6 p" F+ k7 F! C" V$ U5 x
    xchg    bx, es:[41h*4+2]
5 m+ _' _( v4 S* k# n; ]    mov     ax,4fh
+ c/ y( j6 i8 d( C+ g2 t+ W    int     41h5 c7 ?" d1 f* B2 T& I3 v  |3 ?
    xchg    dx, es:[41h*4]7 x* o4 f. L/ s% N" H/ p
    xchg    bx, es:[41h*4+2]
$ U$ x& k! }4 V$ C& q  F' {    cmp     ax, 0f386h
3 d1 j. g; N6 v; P4 I    jz      SoftICE_detected. C& @$ O9 X3 i( Q  Y
0 ^1 A% a4 F" J/ W3 J2 d7 W
int41handler2 PROC, ?! m3 d& x: O% P9 S
    iret
8 X: `6 t$ E  e9 s/ P$ ~0 P3 Yint41handler2 ENDP/ X$ X& V9 k* W- ~$ y
2 e3 W8 V% y1 Y
+ Z8 n' h6 s% g0 |& n0 a3 r/ \( o+ f
_________________________________________________________________________
; I' W/ U/ g0 Q8 Q2 M& z! L+ r, V, n* X4 _7 F
" @6 v+ Q+ \6 i" S8 a; k
Method 06
8 L! m* x! q4 G, u  K2 [=========
, k2 n# `% e; a. l! p0 s: z
( o" K+ r5 t; O9 L6 J  p: G9 I; b6 S8 f' ^3 E  o5 H0 O! Y2 W2 I
2nd method similar to the preceding one but more difficult to detect:% F7 q4 h+ j& F6 w6 n
  H2 S" R" j. ]  G% r# [( w2 a

% t$ _: S- s9 T) h! |( w9 iint41handler PROC
  H) T" u1 f! w' n; {    mov     cl,al
& z1 I$ W  D) C    iret* w* s: ~3 ?5 S3 z" F
int41handler ENDP
# W8 z9 e( R9 F0 d. w& Q
  W0 _. D+ |+ p: }- F! O; U8 Q$ ?" C- ]8 s' V9 X2 A0 `6 B; B7 }
    xor     ax,ax
+ }/ H7 q" {/ X: }9 |1 S6 j8 ^7 n- d    mov     es,ax
- [8 H: u9 F. r+ z    mov     bx, cs
( {  y! [+ N& c9 g    lea     dx, int41handler) r3 `5 A! L! ^4 b. ?% P" d- p5 x
    xchg    dx, es:[41h*4]
5 G( |1 d- V# c4 I8 \$ V4 A    xchg    bx, es:[41h*4+2]
8 N+ c4 a; d  Y) I1 l0 M    in      al, 40h
% j( i/ n& t/ m    xor     cx,cx
$ I8 B* S; \- @& k9 z7 N0 z" O    int     41h
5 Z' ]- k* l5 {  D2 C    xchg    dx, es:[41h*4]
/ t; a. T" d7 ]2 X    xchg    bx, es:[41h*4+2]
2 C% ], P2 k6 I$ u8 j+ `$ K( @5 y6 n    cmp     cl,al1 M; W' X" Z# j$ V& e( U( s) N& |& K
    jnz     SoftICE_detected
& o' _* Q) o9 R9 j4 e. Y
  x- u$ \: Q; G1 C3 x$ y7 Y_________________________________________________________________________3 [$ ~1 S6 a# \/ z+ B4 ?
8 @$ q" T7 I/ Y7 I+ }
Method 07
( N" v1 c( B$ ^# y/ Y  N=========
/ T" e/ j, z; @. v) J1 v, ]4 V3 M% H- \# E& [1 j' s
Method of detection of the WinICE handler in the int68h (V86)
1 K% L! O% m1 j7 l8 o6 a1 X  m6 U& J4 o, s* v: I1 \
    mov     ah,43h4 B# x, j$ G& r; ?5 a  q( @
    int     68h6 n: n5 x+ R8 v& x7 R8 d1 ?' b: ]
    cmp     ax,0F386h
' D; c, c# ]9 t% D" k5 {    jz      SoftICE_Detected
9 n: Z! N0 ]5 Q! n) j4 \; u- X7 Q: q  V) d  V

! f' g' l! F4 P8 q; _=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 P' l, t. f( L6 R' X7 \! F6 f3 u   app like this:( O  [& ?) G( \/ F/ R

4 @: M  h  o8 o" W   BPX exec_int if ax==687 G$ i! [- b& O; h2 i' c- A
   (function called is located at byte ptr [ebp+1Dh] and client eip is4 S1 l- n' O# m& N" i
   located at [ebp+48h] for 32Bit apps)5 V3 e; Z1 r! H2 r  d, u  M+ C: X
__________________________________________________________________________' `, q2 _1 [) G; [  h+ q
- x! @+ A7 U! G) T+ {5 Y! M. ]* ?$ O

% X. N4 N9 I1 f, h9 bMethod 08
& I, G, x! a9 q=========; r; R% L" x4 S3 k2 E
! ]# T9 P) S, c( Q1 r+ a& b5 _2 e
It is not a method of detection of SoftICE but a possibility to crash the3 Z& O$ {* [* w) I$ b1 q/ Y) t* X
system by intercepting int 01h and int 03h and redirecting them to another
5 B  f- r+ m; f" b; N/ c' S  Yroutine.9 W6 B6 y& S$ v/ J9 G0 L
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points3 C7 n4 [, F, [
to the new routine to execute (hangs computer...)( c9 n0 B( P3 v: [

/ _3 b! _+ z9 l/ b    mov     ah, 25h$ u1 G, Z! Q5 {' B! E* ~4 ]$ }
    mov     al, Int_Number (01h or 03h)
! L9 w# n. c9 h* @: i    mov     dx, offset New_Int_Routine, d3 i+ h: R, f7 Y
    int     21h5 |' F4 A. y) Y
4 y3 b5 J. R% A6 u$ |. \. ~! Y
__________________________________________________________________________
4 O' _2 |$ N% N! E1 v9 \5 F1 c  ~- V9 V* V; U# ?2 w, T
Method 091 q" n& X( z4 f* u7 Q+ L% _5 C
=========9 r4 Z6 Y' E: X# x$ i1 I9 U0 g

3 K! b: B, j  @6 b: q# iThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, U& k* s0 Z4 rperformed in ring0 (VxD or a ring3 app using the VxdCall).
0 _0 C$ p) `4 F5 J+ lThe Get_DDB service is used to determine whether or not a VxD is installed
8 f! C3 x1 T$ C) {! r2 @  G9 sfor the specified device and returns a Device Description Block (in ecx) for
7 {6 b* `0 k/ b3 e$ n- fthat device if it is installed./ ~8 z8 t3 \0 L

5 D1 P( p! s8 i( e   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID0 U+ P8 a  O2 @( }
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 [* p7 a! [5 t% @6 O
   VMMCall Get_DDB4 B: ~) Y. S; E' y3 D0 r
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed4 [7 [+ v* r0 b; n7 z) d0 j
2 i" b& R0 P, K  q
Note as well that you can easily detect this method with SoftICE:4 R; W# N% j/ E
   bpx Get_DDB if ax==0202 || ax==7a5fh4 p1 Y+ I% a( x6 d' y

- R* \" e; Y( n$ W__________________________________________________________________________
( o, F6 c* w" s( U
) |0 Q3 M0 c# Z( U1 J2 t) SMethod 100 s3 I6 }- c# Y/ s. L. y1 g
=========
, p1 D+ ^4 b0 ^5 R1 H  S* R% A/ c) J8 c# |( [/ M# r. V8 _0 g
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) \& T3 L' _! h) a& c
  SoftICE while the option is enable!!$ Q. |' t0 m' e! r0 V- X
- ^' _* q7 I  h& m, q
This trick is very efficient:
  B: Y* e& L/ c% m  z. Aby checking the Debug Registers, you can detect if SoftICE is loaded
+ o# r' {! M! i  f  [/ V$ z(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# A" C2 N8 o& G  \7 ^/ Z- F2 b' t9 pthere are some memory breakpoints set (dr0 to dr3) simply by reading their
5 Z. k: \+ Q3 z7 b4 c; kvalue (in ring0 only). Values can be manipulated and or changed as well
+ q8 k$ c% T0 E4 W0 z/ h6 @(clearing BPMs for instance)' ]7 \5 a7 W& S! V' e/ p, E' R- b) Y
9 {. M. L& N. ?6 ^2 d9 P
__________________________________________________________________________
9 a& k/ m" ^  s; {
) T8 M* U+ T; |; f- sMethod 11
/ R+ ~3 m" ]9 p& {" H% K9 `8 T=========# l) k/ r0 [" I: n

1 V! L+ r1 P6 B# i: A$ z- i! kThis method is most known as 'MeltICE' because it has been freely distributed1 u, l% q, E+ `) ~: |' ~
via www.winfiles.com. However it was first used by NuMega people to allow
3 a5 e9 j+ O( {5 ^: I! ISymbol Loader to check if SoftICE was active or not (the code is located0 o3 {, I! u1 ~6 \
inside nmtrans.dll).
4 |( W7 f5 B7 \# p3 I! C! Z1 Z* {& [, x: _
The way it works is very simple:
) Z; }6 [8 U0 Q5 \0 O9 G, F# ^It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
1 X; a1 w* v( s3 i, W$ t7 T: H7 vWinNT) with the CreateFileA API./ o4 v& ?( y, a

/ N, \2 V* \& z0 X# LHere is a sample (checking for 'SICE'):
! n) |+ |  M+ f! R, L7 k9 }
/ i8 t8 n, s1 uBOOL IsSoftIce95Loaded()
/ W8 K6 H, c+ `" M  H0 b{
% B7 B( n9 P! B* W/ ?' R1 a/ E   HANDLE hFile;  1 c8 F6 ^) U! z& K1 K  ~& ?( \" Y
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! N, r1 s$ s3 ^  R" C                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 `8 g  u$ Y  [+ D$ I$ U8 f
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. E/ r+ J; O: T
   if( hFile != INVALID_HANDLE_VALUE )
* b+ e: i2 I$ r   {
. S$ x: G- Z# q# E  c2 C      CloseHandle(hFile);
% B5 Q4 A8 B6 Q( b% P      return TRUE;: o* X# i3 ]2 w
   }
% d; G' j; b. d) m0 z9 {   return FALSE;. D+ U8 A! c7 C: A& o* L, j
}7 l4 A, g. ~0 [" N$ r! {( R" ~5 ?, a

% s% T) i- k+ B& Z( Y9 \# ?Although this trick calls the CreateFileA function, don't even expect to be
8 z' ^; b  w8 M9 `able to intercept it by installing a IFS hook: it will not work, no way!
3 |: z  Q  X) h+ b0 L5 A  ~In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, |4 n0 l; o! _$ q# Gservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) A- c) _# I3 H4 hand then browse the DDB list until it find the VxD and its DDB_Control_Proc
) b; D* i4 \( Q' H  H  kfield.5 l. Q: L. m6 f% ?5 G7 q
In fact, its purpose is not to load/unload VxDs but only to send a
0 i! |9 G5 z6 B1 ?( p) G0 vW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 W$ h" P" O  K1 @2 m: h! R% qto the VxD Control_Dispatch proc (how the hell a shareware soft could try
8 c- w. j- M, w7 X; P9 ?9 h' Zto load/unload a non-dynamically loadable driver such as SoftICE ;-).( C5 n  J2 t4 k; }& v, a* g6 y
If the VxD is loaded, it will always clear eax and the Carry flag to allow9 |6 q: _3 j( d3 f6 }5 M
its handle to be opened and then, will be detected.9 C5 O0 ^1 r/ \7 Q& e3 k0 r2 s
You can check that simply by hooking Winice.exe control proc entry point
" c! J1 y3 T7 g# ~+ c: s, R" Rwhile running MeltICE.4 U+ `% X2 F7 \. v3 a

$ G: r6 j2 i% M( T' [: y/ d- O! L2 E
  00401067:  push      00402025    ; \\.\SICE
5 q# v  }, s% I: x  0040106C:  call      CreateFileA
: H+ k8 U0 X  T5 H, f, O  00401071:  cmp       eax,-001
: d6 X/ ?  b# k- z8 e( r  Q  Z( a  00401074:  je        00401091; ~6 {4 D; l, D4 P4 z
/ Y- @# Q3 L6 K' M) l" T
1 `8 h" I, d2 A( u) n- A+ c5 j
There could be hundreds of BPX you could use to detect this trick.
. e  s! M: p* ~-The most classical one is:
* g2 u- N: V& s* [  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||* r5 S, y9 u, L1 \
    *(esp-&gt;4+4)=='NTIC'
! e% B& x, W& w! q
  E6 |2 |& |& e  ], i; V-The most exotic ones (could be very slooooow :-(
5 z( i" x0 {6 v$ v+ W/ _   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 \- p/ `7 ]" D6 m     ;will break 3 times :-(% H  m) h; p1 s% m; G% B7 m$ |

2 _3 M2 J: x9 d" t" q5 R-or (a bit) faster: ' {& n8 b$ ?3 u$ ]. p7 S! @& Y4 h
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')' `8 H. ?( v3 s. e3 p6 h
3 h0 _; H9 A+ |7 y
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 D4 K; X- v5 V% `3 B     ;will break 3 times :-(
' l4 v# {4 l+ Q! M8 q$ P1 ]: D0 |# G0 m% s$ w; r# \
-Much faster:) I. z% K3 S  C. j+ c8 K: G' E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'& J; }& }7 A  L5 i2 Z

- X3 Z& S9 S6 z9 JNote also that some programs (like AZPR3.00) use de old 16-bit _lopen! s% Q! K5 v  A( M& x4 K( y
function to do the same job:
2 \2 J  a. P% b7 w+ k1 N( |
0 N% w+ c6 O+ I/ a+ Y5 s, g   push    00                        ; OF_READ
) x2 }, v. {2 g7 w( a3 r3 o7 @9 m   mov     eax,[00656634]            ; '\\.\SICE',01 T" X$ ?  `; `1 S0 f% W6 T0 `$ k
   push    eax
7 W; Y' v8 s3 i4 {  o   call    KERNEL32!_lopen* M9 K1 L' p% B3 `: X& V
   inc     eax' ]) x( }# o# l8 j0 c' O' @1 d
   jnz     00650589                  ; detected
9 Q# p/ g0 K, i, n   push    00                        ; OF_READ3 \8 U& b+ \: u) o3 A7 p5 \
   mov     eax,[00656638]            ; '\\.\SICE', @  a  \1 {, v! _* ^
   push    eax0 m  c  s9 @% W/ p; n
   call    KERNEL32!_lopen
  L* j6 F; n6 B3 W   inc     eax
- \' z: v0 z2 O  M7 O$ k   jz      006505ae                  ; not detected
- n) y( Q; B& }0 l: |1 H$ w; s' z- L8 ^/ A2 _; a2 M1 V
- {5 d. E' Z! a* f6 ^; I; [: m
__________________________________________________________________________; @* {8 w. Q' n9 {1 ^

: U) t! Y5 D5 p( p6 T( Z7 Z: xMethod 12
3 h: u$ N7 E; f- W% j4 o' z=========- ^" u! {5 z% h) ?: O. s9 g. |5 n
* \$ m3 d2 C, G3 V  Z0 F
This trick is similar to int41h/4fh Debugger installation check (code 05
1 @4 h: k0 o3 |- Q9 [&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 f+ g! I4 F1 E
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.4 ?* g9 E8 m) z& y
/ ^; F6 C$ s& O% a$ t  b1 D+ T
   push  0000004fh         ; function 4fh4 }9 p, l/ `* m9 j, \# P
   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 C* Q  E" q/ \6 o- i' ?; S                           ; low word specifies which service. R/ ?$ P& T; N* t
                             (VWIN32_Int41Dispatch)5 _; E9 w; Q8 q& E: N0 L2 l
   call  Kernel32!ORD_001  ; VxdCall
) c/ L! q8 M  g   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 @. M4 S  Z7 [   jz    SoftICE_detected  T8 s6 C8 r6 u, D$ w! G: j

( O+ l$ |( v7 G2 f* y" C! yHere again, several ways to detect it:
  Y+ B' v. z: S  I  |: I% x5 o9 A
    BPINT 41 if ax==4f
2 }- s/ [' @5 u9 H! s" M$ I, x( j) f0 t4 W* j
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one5 n! a6 h  d9 Z
7 b5 Z9 K+ q  z6 I/ l
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A! k- J$ k. B5 |1 q" n& h+ C

) Q! v$ I; f) ~; T    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!8 F  ^; z: I! Y
- j/ n& {4 I2 m% h/ \' ~1 w8 v
__________________________________________________________________________! j5 {5 _+ ]/ ]

, D5 @" v% l# I. c5 XMethod 138 c9 Y2 G, |0 Q. a; a0 |! X
=========* B0 ]0 j# E- f* `# D0 Y

0 f- |; Z. W, Z: D; ~# t. hNot a real method of detection, but a good way to know if SoftICE is
/ Z- ?  w1 L& L# V$ m8 `, ]installed on a computer and to locate its installation directory.
9 Z  `- b# B1 U/ B1 y" P& NIt is used by few softs which access the following registry keys (usually #2) :# k: X9 c" k: s

( r! g0 m; b& a; W- `-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 v6 [0 a& c. v- N5 D\Uninstall\SoftICE
6 f" L6 F/ w, L) A-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE2 r4 P+ ^3 h3 Q, P( U) M' u: l
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" Z& F3 M: _8 I, v4 H! ^& m' {6 m
\App Paths\Loader32.Exe+ D- M7 L) w; P$ n* L# n& G. A" A% M

1 L; ?; n. k- d9 k) g0 `: V5 |& O9 z0 x/ H% d2 B- o
Note that some nasty apps could then erase all files from SoftICE directory& o4 o$ Q6 _( t6 E# G
(I faced that once :-(
, H" X( P( T4 k; T. _2 e* B! @( l! B  f
Useful breakpoint to detect it:
, e' Y1 j4 f/ A) Q/ f+ w: }4 }
/ ?# U( ?, F: l& z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* _* h- r9 {4 o6 w) f( S$ d( [0 V1 E2 Y1 @
8 F1 z3 B) T8 L8 h
__________________________________________________________________________* m. V) V/ B! P* X/ j6 Z

% R! K3 O6 C8 Y
- q8 G! G; o) ]* m1 p1 WMethod 14
: T5 p. B% N, `' s1 y/ {4 }: S( D$ h' X=========/ z6 V% ]# R2 z% w. r
% n9 R6 K; A- F( o5 B) Z, H% J
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose& n1 X' J( x6 |; T" s
is to determines whether a debugger is running on your system (ring0 only).. f! e2 Q+ D* b+ W; ^7 o" {" W: e

& O. q5 ^6 `8 N   VMMCall Test_Debug_Installed
( s) M! R& S5 Z1 v" Q& ^   je      not_installed4 G( w# g; z$ b; H. l; f

) B1 g# p9 [: n" M: v1 q- jThis service just checks a flag.7 u4 B3 ^' C! Z; |4 r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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