About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  k1 |4 F$ w9 w# S5 M) a# T" ~<TBODY>+ Z/ n, X9 \4 c/ t" ~+ W
<TR>
8 I, {1 f+ M& d* N% e# p) ~3 p2 ^<TD><PRE>Method 01 9 G8 Z# y+ I! T$ c0 q
=========
& `) q" A* E/ J  o0 k' t
! {: K% m) B! e/ n* D3 |This method of detection of SoftICE (as well as the following one) is) B! z) ^5 `* n
used by the majority of packers/encryptors found on Internet.
- E( `5 n- |3 J9 Y. Y! K$ d  S( FIt seeks the signature of BoundsChecker in SoftICE
1 v  N# C3 S- j. ~" u
6 b; z4 s6 b2 z6 `7 Y7 ^6 H7 N1 |  [    mov     ebp, 04243484Bh        ; 'BCHK'
2 B5 z' |- m3 r4 F" t+ Z    mov     ax, 04h* _9 C; S2 }8 m* N( l3 `6 s
    int     3       , x7 p7 E, B! O
    cmp     al,4
& V& K4 C( y% u1 }# b9 h    jnz     SoftICE_Detected' O& p. D9 [8 |# \
  x: Y& S& L6 ~2 |& ?
___________________________________________________________________________  j1 G+ U( z0 i* u3 x
2 v  o* Y& Z4 W# |4 [. c7 ]5 L, f$ e
Method 02, c; F/ M7 Y4 Q8 T  [7 j
=========
( V0 f2 M6 y8 X  q4 H& ~& o3 t% G8 Z: Z  m6 c
Still a method very much used (perhaps the most frequent one).  It is used; Y& q4 h. F8 D) [0 ]7 q/ L4 k& u
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
& ]7 i$ i, a' n- H9 hor execute SoftICE commands...
1 A# {* n, |3 eIt is also used to crash SoftICE and to force it to execute any commands
4 E& V/ c* A" W+ l/ |* `- K(HBOOT...) :-((  ( z$ Z$ c5 Y$ T2 e3 c, Y

* @7 @0 R) z  H: m0 m3 SHere is a quick description:
7 S* e0 c1 A( O6 V" m7 b5 a-AX = 0910h   (Display string in SIce windows)5 k! V8 o& }1 q+ R* c) Y
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  }  Y5 S3 e* z8 D6 V" F' l8 R
-AX = 0912h   (Get breakpoint infos)
+ `$ O- m( s! u7 W& r-AX = 0913h   (Set Sice breakpoints)% c4 O' L. M( b/ X: f0 n$ D
-AX = 0914h   (Remove SIce breakoints)
+ O" v5 b( A1 E3 U% P& ]  K# g; U+ s
Each time you'll meet this trick, you'll see:
6 v! \5 @4 X) @) B) w+ i# c* ~-SI = 4647h8 p. S8 o! D8 D0 [: }( m
-DI = 4A4Dh
* [: Z% h' T/ O+ [( s4 Y9 {Which are the 'magic values' used by SoftIce." w1 y) W  h: O
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
: ^8 |+ \- \2 a" G$ V, _% k7 W4 r- i4 h2 D
Here is one example from the file "Haspinst.exe" which is the dongle HASP
: d3 h" R/ {; |3 l7 v! t' tEnvelope utility use to protect DOS applications:
5 c- ~4 f3 y7 w9 I% t$ ^2 U# I0 ^& @" _% R( `6 Z* A1 r! {
1 i" V/ S% V# o5 M
4C19:0095   MOV    AX,0911  ; execute command.+ Z; y6 }' m* P; U) C. V! i& J9 D
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
+ P! j, }% M% S  p& [% _4C19:009A   MOV    SI,4647  ; 1st magic value.- M) z$ P; U- P
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.( B* n; l* ?: m6 I
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
. \6 I* k% x8 }4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 t, h( X! K, e; I% z. [
4C19:00A4   INC    CX; e. v5 ?0 C2 |- n' Q, L: J: f
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 _4 H( n) b& H. e' R8 d/ j5 z4C19:00A8   JB     0095     ; 6 different commands.2 e+ ?( @! g/ \. ^9 }
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 [1 G4 e, [/ S1 g' l& V7 }. q% Z4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)8 N: e8 Z/ Q( O8 i7 ^; P

) @: T: O. V0 r' j. oThe program will execute 6 different SIce commands located at ds:dx, which
- d' ]' p6 J6 A! R' Yare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
/ G- G4 L% f$ |0 A1 k& q( e
, R5 |& b1 {& K$ a* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 `0 U) q- C4 i; q___________________________________________________________________________
% S% F& h) C( o( r; Y
' e$ G& s" B7 l4 ?/ y, \1 `' {6 F  j/ v
Method 03
+ g) x8 G' P" j. o, Z% T=========7 V- Q( b/ ?# p1 d9 I8 t( r

1 \% W& c! U5 X6 c7 _Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  w* d. K: b2 h
(API Get entry point)
  i& g3 L5 I+ `+ V1 N        ! Q8 q6 W! A$ `9 Q+ d* h
. f2 f8 R5 ~# x6 l/ j
    xor     di,di- f: x: p0 Y. P0 j
    mov     es,di
9 I, G% w$ G" b: ^2 y* }; Z  Q    mov     ax, 1684h      
7 T4 U6 K1 C5 |/ k5 e    mov     bx, 0202h       ; VxD ID of winice0 t0 s! D& ?8 z$ \* j4 N
    int     2Fh) I$ K8 Q5 q* V
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ N5 Q  h7 }. w( g: e
    add     ax, di' t% p9 U9 G+ O! K; X% {
    test    ax,ax
1 ~# l! x. f3 p& Q    jnz     SoftICE_Detected
1 i$ U- c) b* |7 U; Q: E  v' o0 ~+ ^' A% S3 I& |+ s
___________________________________________________________________________
9 S( J3 x% ~( v8 n: m1 c9 M7 H& @' I0 ]  M* D, Y/ i
Method 049 @' D* ^/ u! s! q, I( C
=========
# q3 X! [7 a4 J
! w0 Q3 a& F, [Method identical to the preceding one except that it seeks the ID of SoftICE8 D/ U4 A* W2 c1 b
GFX VxD.
; E4 }+ l9 K. X& I* p1 x' ]+ o% t/ q9 `) {, y" v, g
    xor     di,di
! A8 d; E5 L$ j    mov     es,di
) }& i- T9 S, K% G8 v7 @    mov     ax, 1684h      
! t4 ?( c' M5 x3 r% b; O. i    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ t+ I* O, y* u5 W/ }: ?) v4 A: B
    int     2fh
) o! V, l9 ^1 i! }( V0 i6 t    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 N* d" ^) P1 Y8 [1 x6 Q7 L2 D- k    add     ax, di
  u2 D6 m4 o" N& R5 X8 c    test    ax,ax
3 j/ N# Z- u6 b% a) M' B# C    jnz     SoftICE_Detected
4 C3 e* k& b" R- C
4 _1 q1 \6 S; U! w) d__________________________________________________________________________
7 n/ l. p; L8 `4 ~% j
$ g  t% [3 Q8 q. K' a8 W9 W$ J# p, M0 S2 }* P$ m
Method 05
* s0 N, x) x% x  {=========% d% Q4 `8 {4 |: i- V

  p: O8 ]0 H8 H1 Y; hMethod seeking the 'magic number' 0F386h returned (in ax) by all system1 ~- u, J, Z; I9 }& a; g
debugger. It calls the int 41h, function 4Fh.. K4 A2 l8 h: Z( x
There are several alternatives.  % |1 i) v2 d+ _6 I

* B& V' r- u/ E. K: u4 C& TThe following one is the simplest:
& o# o7 D% ^+ Q: C# W. B- C* x, ~/ B4 V- o! ]5 d
    mov     ax,4fh; b# l. b+ ^* p! s' o
    int     41h  X! l* w2 O9 a) l5 K, r
    cmp     ax, 0F386
0 i9 ^2 Z+ a# n    jz      SoftICE_detected
" Y/ K& |) v" R( F5 L& S$ G
: }8 a5 X: ^9 t) g0 O# }# ?
+ ]+ P0 x6 E$ r) W, l* CNext method as well as the following one are 2 examples from Stone's
! z8 W) ~. M, ?( Y6 G" V) z& v$ v"stn-wid.zip" (www.cracking.net):
. u; b) [8 |" @: y1 Y$ j+ s& h3 w1 Y: T  t" a7 l
    mov     bx, cs. _" F0 y7 S, K% S; `4 ?! z6 I" Z
    lea     dx, int41handler2
% U9 G) L4 S- `# Y8 ~  M- _    xchg    dx, es:[41h*4]
% b- m& w9 a7 ?6 n8 L- V    xchg    bx, es:[41h*4+2]" p8 _, y' m% S  f
    mov     ax,4fh- R! J) ^0 {* \' X6 j) d# q" J! X
    int     41h# E/ x! y" K5 e. N* z
    xchg    dx, es:[41h*4]* a5 f* o4 _& M* b4 ^) ^
    xchg    bx, es:[41h*4+2]
7 R* D7 j3 P: D7 x* L% \2 g    cmp     ax, 0f386h( V2 l. k! w! B
    jz      SoftICE_detected7 P9 m* p) I; n/ @+ N  [! ^
; U4 n" z- P8 H) o. Y" Z% m4 x& a
int41handler2 PROC; w: h1 M1 r5 E7 L
    iret$ a5 Y6 ?' {& M" U' \
int41handler2 ENDP
! c2 T. i6 p4 K; b. d9 m& z4 f2 u0 T5 ?. \  k  ]  o
/ ~  a/ Q  D' }4 p# S8 Q
_________________________________________________________________________
+ m5 R8 g3 ~8 ~) i3 i: j; ~3 Z# M: {
) C1 H# o6 l0 L* d" y2 T  L9 d
Method 06
/ p: c) {& A0 e% k=========) U5 g  Y$ C4 v( k4 q, H
) B* g- {6 C% _0 Z% n- x
7 `0 x0 O( L2 ?& `
2nd method similar to the preceding one but more difficult to detect:
. N6 n+ W, `# s# i1 ~
3 {7 _7 o1 U7 e7 t* _$ m3 R
  N9 o2 [0 R) @1 E+ c6 m0 H' Zint41handler PROC
2 d# A6 m6 g, P    mov     cl,al7 k" q5 S6 w3 O$ D( J
    iret
0 D7 i; x% i  ^. Y3 W3 aint41handler ENDP  l' K' Z( N# |( j

! _2 O6 y. B$ c' r' n0 G( o
3 H+ S/ O! F" Z( g% t6 G* A    xor     ax,ax. O+ J! l; E0 {8 z8 |( e6 z
    mov     es,ax: }" o+ |! k- H) m  Z* i( i4 v
    mov     bx, cs0 L. ^; E! D; o8 ?/ [# [
    lea     dx, int41handler
+ ?6 R8 [) d5 Q2 S! Y8 D    xchg    dx, es:[41h*4]9 k) v* R6 T( l" y/ k: b  z& P' [7 r
    xchg    bx, es:[41h*4+2]1 n* G; y% F. a
    in      al, 40h9 a' v( X, m' _* w+ W% q3 t% c/ g
    xor     cx,cx. u( J0 o5 E- H- V
    int     41h/ M* ~  V# ?# i, Y8 I9 |
    xchg    dx, es:[41h*4]
; @6 F* E. A$ S3 j# p    xchg    bx, es:[41h*4+2]
: p, V2 }% h; b0 B3 `1 V0 `7 h    cmp     cl,al
9 H; ~: F0 n9 y% f    jnz     SoftICE_detected% t; S- ^$ ~5 r# j7 G
* _" }# a/ g0 {* Y
_________________________________________________________________________* j: I! B3 {0 N

" f; U9 Q& P0 g$ X+ r# B% X5 KMethod 07
' T9 j% ^6 ^  Q4 I: I( w7 L=========
9 A* i+ I5 k7 v6 c' p' h+ Y5 q4 C- k) U4 q+ g2 T. b7 O
Method of detection of the WinICE handler in the int68h (V86)6 M# f# x8 G5 R5 a5 ~0 v9 I' ~

4 z1 O/ C  c/ U7 z8 g  X/ u    mov     ah,43h2 R" t0 g: i: z3 _3 X5 m' c' b
    int     68h+ C/ `5 P) A+ y! ?) z
    cmp     ax,0F386h
- U3 ?6 |. C! c    jz      SoftICE_Detected
: s8 f  Z0 W" N% l3 c: F2 }* _. }* v2 ^
$ A7 s) h+ @7 O# g& T! `
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 l* t: [/ r+ q   app like this:2 e0 _5 J$ b: }8 e  M: ]! }8 n
8 e0 {: y# [* x
   BPX exec_int if ax==686 d0 i1 m2 D- J0 s1 t( ~1 F
   (function called is located at byte ptr [ebp+1Dh] and client eip is; O2 j$ S/ h7 ^4 F9 I0 q
   located at [ebp+48h] for 32Bit apps)% S  r. {5 V$ B2 q) f# u$ @
__________________________________________________________________________
* C3 \* J1 v# ^- s+ B( g  L6 p; R  ]1 I) U% `/ y0 g

, Z4 q! ^$ X1 k! X( }+ M9 O) ^Method 08" _4 S/ k) ^" t4 r4 p" Y$ g
=========
" g! g* y& L" a: S0 G9 O9 P2 `% L( q- b0 P2 }9 E0 F
It is not a method of detection of SoftICE but a possibility to crash the
1 |$ s( C$ M/ T: |system by intercepting int 01h and int 03h and redirecting them to another5 _2 Q* h- M; ~
routine.
/ }+ n9 r1 c3 B+ q" lIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 j4 ^7 Y9 r. u4 g  C: @to the new routine to execute (hangs computer...)( l2 c( Z1 B5 u' G5 U
2 ^) n5 O$ J$ X9 B2 j
    mov     ah, 25h. q' O# a+ L5 W. U; k+ S
    mov     al, Int_Number (01h or 03h)$ S+ {3 |8 B) j1 w% K+ ?4 G: N! v
    mov     dx, offset New_Int_Routine$ S9 Y2 x; y4 J
    int     21h
. f2 Z! N5 I1 a( Y' e
+ ?) A  t* j8 @  a' }7 U& k5 b__________________________________________________________________________
5 K/ m3 \. J& H5 a) C# j7 e* d( v# g
Method 09/ }; \( I( `, e# g+ G9 W( m
=========/ ^! {; f! |+ E, p) F9 f+ u

4 q% p% A$ x$ h  P: SThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
' ^+ U4 T- e6 N) R( Nperformed in ring0 (VxD or a ring3 app using the VxdCall).
5 U1 D: J! v2 z! ]8 f( A& E: JThe Get_DDB service is used to determine whether or not a VxD is installed
2 S7 q' F  N/ Zfor the specified device and returns a Device Description Block (in ecx) for+ v3 n; Q$ }# V% j
that device if it is installed.
" O& y+ @4 I) J/ Q0 @1 P
1 f' ?: c6 L5 j8 w7 l   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: Z) W5 R& ~! T0 U; ]3 @3 p   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); Y" X: G( I/ b' j. g
   VMMCall Get_DDB
8 F! R, t& V2 I7 `2 K   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ j6 w' b/ a6 p
- N% g! h: n& R" C" F3 y
Note as well that you can easily detect this method with SoftICE:
  L' X; M5 |! Z# H7 o0 V+ v1 t2 d   bpx Get_DDB if ax==0202 || ax==7a5fh% d$ j2 c6 ^% |

6 m4 M' u1 ]+ i# |9 B__________________________________________________________________________6 [: ^: o; U  U+ @

) f9 X8 k6 o* nMethod 10
3 Z5 H2 c4 X  L=========& S2 j. ^7 N% n6 `8 M0 @
9 {+ T6 ^  W. c5 v) r
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with- A- H2 J) h" `+ x3 Z6 b; L8 r
  SoftICE while the option is enable!!3 x. G% G+ R: T  w
) S5 t: A: i8 K" t1 j0 c* `
This trick is very efficient:$ N8 u8 i1 q& V  q
by checking the Debug Registers, you can detect if SoftICE is loaded
5 {) r6 K$ }% l8 ^! ?* I(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; v0 O& J" X$ l% V
there are some memory breakpoints set (dr0 to dr3) simply by reading their
+ A; Z8 p! x! _, a6 U! x! @( p1 H( nvalue (in ring0 only). Values can be manipulated and or changed as well
, I7 n0 Z1 z4 n' B(clearing BPMs for instance). m6 r1 z& `" k1 K$ G7 V

8 }9 J1 O& }& b; o( {9 O: L__________________________________________________________________________. C/ F3 Q9 |( B9 ^) P# u

, x% V7 f9 E( j" T: [" @Method 11
  {5 {; f4 y7 W; D6 q=========" |3 K3 i. ]) s9 y# ^

) k5 p) S; N/ AThis method is most known as 'MeltICE' because it has been freely distributed
; i4 l3 d( |" k2 hvia www.winfiles.com. However it was first used by NuMega people to allow
' E0 Z5 ?2 a2 k+ ?+ jSymbol Loader to check if SoftICE was active or not (the code is located& g3 |1 S9 t& J! a. e
inside nmtrans.dll).
) |& [- C' S6 ]- l
/ i1 _& K. y4 H$ q, SThe way it works is very simple:
+ a7 N6 E6 ?8 K% Z* t, e' C' RIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
, v$ S$ Y, c3 P5 g! z% n8 TWinNT) with the CreateFileA API.6 m3 H8 _9 F3 |( |8 a5 @4 b6 `
/ Z; h  O/ B) {. F& U! O
Here is a sample (checking for 'SICE'):
. c, s* e  _" b7 x" |4 s0 c
: x) q1 N/ L6 i% ~4 TBOOL IsSoftIce95Loaded()3 X2 o, c. f7 |% F! d2 d
{
- O1 f0 a3 e( q# B   HANDLE hFile;  4 ~; {1 r) `9 _% o
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
/ B- ?8 P2 T% ~# D$ q                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 V( |& H9 y% C/ c2 G# X% \7 o# G
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 F+ Y6 w6 i+ P   if( hFile != INVALID_HANDLE_VALUE )
0 u4 Z0 g+ `; [$ P   {! @, X6 n8 X- c
      CloseHandle(hFile);: f- g# V7 x' J/ |  ^0 P* N
      return TRUE;' R+ y" z/ K# `( x& v% m0 O
   }
- F( m9 |$ @2 ?1 s   return FALSE;
/ |9 K/ F$ u' N. S9 K" s/ I( S' M}
. a" H6 E% U! f! x' k% n9 i: f# ~& g- F6 q
Although this trick calls the CreateFileA function, don't even expect to be
, K4 x3 b. b; f: |able to intercept it by installing a IFS hook: it will not work, no way!
- {, ^2 S( [  ZIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
  k5 @) Z, P8 a* N+ gservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 Q+ f3 T0 f* u2 Xand then browse the DDB list until it find the VxD and its DDB_Control_Proc. i6 P. D8 ~& {' q9 c8 ]
field.0 t) \9 p, W) w
In fact, its purpose is not to load/unload VxDs but only to send a ! l8 y' J& n1 m1 F
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* _, c6 F  u: n1 E
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
# I% o( a8 I& u1 Ato load/unload a non-dynamically loadable driver such as SoftICE ;-).
& O7 z, r  x6 e! H* D( iIf the VxD is loaded, it will always clear eax and the Carry flag to allow
7 t  K+ J+ [( T4 L$ n! d# oits handle to be opened and then, will be detected.
' W6 @- V; {  M& L& dYou can check that simply by hooking Winice.exe control proc entry point. ^. l0 C, {4 b4 |0 w
while running MeltICE.
0 `1 ]" }( N/ Y6 T4 k  U$ @3 l$ W+ q- X# Q0 K$ {  n4 N

% t  a3 N4 S# q: n$ ~/ _+ D  00401067:  push      00402025    ; \\.\SICE9 r8 x+ P( @0 x: T( \$ m: y" n
  0040106C:  call      CreateFileA
1 g3 M6 b4 s/ a( E( r; c( q  00401071:  cmp       eax,-001
& O+ `' e5 @# F' O/ }. Z1 o+ L  00401074:  je        00401091
$ i9 o7 ?' N8 \3 ?( k! S; `9 l0 Y3 y; X% y9 t0 `% N! ^
; s# D, D9 I: E2 l1 @* n: [/ C
There could be hundreds of BPX you could use to detect this trick.3 o$ G1 [/ P9 Z3 c8 i: W
-The most classical one is:
  B4 i, a" y+ Y! ^9 R8 q- _1 x2 R  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
. ~( E0 y9 F, F* v8 v& e/ z" a    *(esp-&gt;4+4)=='NTIC'- o! Y  [  r* w$ B
' B) J* }# {0 O5 u$ N
-The most exotic ones (could be very slooooow :-(
. a& t! @& m/ R   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ a# B% K; ]5 q* U" z/ \2 d
     ;will break 3 times :-(
5 @9 E' C9 A' n0 H0 m# V0 H% |  y) K! e. d0 u
-or (a bit) faster:
+ U( {/ a! I( w/ [' c   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) m. A/ Y! z4 q5 A( a
% C, n* Y- ^" Y: ]' B7 ]8 w   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- w9 O1 u: H: k$ W8 \     ;will break 3 times :-($ P0 |7 S! f" G7 k# O
/ m( y6 l% ~/ ?+ O, l" O
-Much faster:
; q3 A" \1 j; ^! k! m: S, A   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ h4 W9 s$ G1 S* l& a3 z; Y8 a3 T: M- a9 q. Z9 m8 G- B" f
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* b6 S/ _6 F) n0 \) Rfunction to do the same job:
' A$ O4 w- y. ^2 U
7 x* ?$ B( ?3 T; f9 \6 E' h   push    00                        ; OF_READ+ f3 t; @, r6 _" Z& i4 e, S
   mov     eax,[00656634]            ; '\\.\SICE',0# b0 L, s2 {  U
   push    eax) s' D$ M, B) \
   call    KERNEL32!_lopen
: ]- Q; X7 a, o: S   inc     eax
9 {3 ?0 ]# O5 z5 V" s% E   jnz     00650589                  ; detected2 S6 v) d2 E5 Y; H
   push    00                        ; OF_READ
" j- q7 u8 H/ q1 L3 n6 N   mov     eax,[00656638]            ; '\\.\SICE'- k% \9 R" Q9 s& E7 m1 Q8 w- d
   push    eax( x/ v: i4 c5 e/ O9 l. m, W
   call    KERNEL32!_lopen
! g) s1 V" K0 b0 A- _% w   inc     eax6 ?5 P8 Y- M: D$ p* h, ^3 A
   jz      006505ae                  ; not detected
/ e& C+ e( H% y6 j- x- w: }
$ J5 G, o$ c# M
0 C5 @2 a+ B7 q9 U6 ~# E) V__________________________________________________________________________6 u* _4 Q7 @4 q, }  L4 Z# A& u, b

3 Z! o1 H" ]- o& E4 nMethod 12
7 z' v0 N5 o2 B( ]# p. \=========
4 B0 H5 f' C. W
' w# {  }$ X/ h( V/ S* z/ FThis trick is similar to int41h/4fh Debugger installation check (code 057 V+ k9 G- i4 ~& p! L0 \
&amp; 06) but very limited because it's only available for Win95/98 (not NT)" Z5 M2 G. F. X+ t7 v
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.8 n  J1 ~* \4 O; h% r
7 @( K* F) ~, B2 y- Y) G6 q
   push  0000004fh         ; function 4fh& T$ h; ^& o% O: u  j6 D* l) _
   push  002a002ah         ; high word specifies which VxD (VWIN32)8 }$ K0 g4 n& G; z' V
                           ; low word specifies which service
5 \; n' f0 o9 w' U3 D/ \- w                             (VWIN32_Int41Dispatch)( S, w, N6 S" N; C% E
   call  Kernel32!ORD_001  ; VxdCall2 }5 y+ x. ?: ^! i- o9 H
   cmp   ax, 0f386h        ; magic number returned by system debuggers4 ^" f! {& B; H" D
   jz    SoftICE_detected
0 B# {' s( |) C3 P/ k7 P% w3 Q+ B3 E& \9 h
Here again, several ways to detect it:% d4 t/ v# Z* D2 _0 v* x
) R/ \. C- R7 u4 w
    BPINT 41 if ax==4f
& u! c) c8 N$ e: o0 F% l# G7 k: }+ N  p0 ?$ R6 ~: [
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
$ o& e" P) B% U  I1 ?: w
: {$ n. _2 ^- J7 }2 z# o9 [$ j    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( P, ^4 t) c# w

6 Q1 B7 h0 L7 K; k    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 m; S: l7 d8 g0 ~2 b
; N7 ~$ e: ?7 W' A- @
__________________________________________________________________________
3 s  n# F+ D6 l: C( P# n
" e) k+ A. S% d4 KMethod 13
. t% n# e4 P9 I5 Z( d=========
- I  z  `! {' U
) l7 F: p; ]" |8 @5 z! XNot a real method of detection, but a good way to know if SoftICE is
6 j3 o1 z4 u0 k( winstalled on a computer and to locate its installation directory.7 n$ K4 w+ J6 `  h3 t9 U
It is used by few softs which access the following registry keys (usually #2) :
- D/ v) |; p1 f# V" q: Q* E7 p: d0 a8 Z" j1 \: W
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( o. O$ u# r( m" E* R
\Uninstall\SoftICE
: E% r6 e6 U. G* R3 R4 _-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
. O# I5 J2 ]5 X) `# r) z-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% C: G/ @2 S1 r+ H( z/ W
\App Paths\Loader32.Exe
. J5 l0 R7 F# A3 R6 L0 R0 O$ T5 A
9 \! y2 }$ a- ~; m9 \8 W" L
Note that some nasty apps could then erase all files from SoftICE directory! X) f6 _+ ]; P- }
(I faced that once :-(8 w, H# l) V+ v8 O3 G$ C4 n6 {
! W# |( {6 D& U
Useful breakpoint to detect it:
8 m  `( m' K7 \$ e8 J; R: ]$ B+ c6 C$ I$ b4 A1 Q) ~
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& q$ e7 T! G$ J7 W/ r8 o1 ]4 M0 Y8 W5 F! ]
__________________________________________________________________________) V7 w3 i# x4 ^; A( o' w

6 t; j& m! H+ l3 a0 c, A0 u0 Z. j
Method 14
9 V6 c1 d! l- b; q: L=========
  Z  M& O( h) _
) d, n& }  d4 E0 @- e* @+ q* |$ pA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose1 ^# p: {8 N: U" }5 b
is to determines whether a debugger is running on your system (ring0 only).' b# G! P* n8 w5 J: X% ^4 B
8 G, q( G0 M8 Z7 H+ m
   VMMCall Test_Debug_Installed# I% Z) p& s5 D. K. ~
   je      not_installed
  K  L* B6 y8 K! B. u: d" U
9 H/ i7 @9 q6 MThis service just checks a flag.
, G0 D) F! @6 m3 I/ a7 O6 Q7 {' ^</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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