About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>, R7 V) s. |; @0 r( ?. c
<TBODY># T7 R% n' S2 z  ?  y
<TR>) g; H3 T/ G0 Z- M: R
<TD><PRE>Method 01
5 |& l; h8 z' v" Y, ^=========
$ Q" ~. K$ v& }
- w$ u* \1 p- pThis method of detection of SoftICE (as well as the following one) is) S+ i4 ?- d( v
used by the majority of packers/encryptors found on Internet.+ }' ]2 l  D+ w5 ~5 r+ j) s
It seeks the signature of BoundsChecker in SoftICE/ @; |1 B$ E. P+ C) P! B

! ^* O3 g. u. @0 F. z    mov     ebp, 04243484Bh        ; 'BCHK'* A; ~! x3 W& H) ]9 I
    mov     ax, 04h
" n5 r* K3 P6 L2 {- m    int     3      
) m: d2 H" K" c& x    cmp     al,4
! K0 E6 \4 R2 M  I+ W) f    jnz     SoftICE_Detected
: U; L( ]+ k! R) L
  I4 n8 v  w6 @) k' I% P  E5 E  ____________________________________________________________________________
  |- O0 h2 T4 {9 b1 s3 _: @- H2 u% n5 J1 F8 k  G  t5 u9 {, _
Method 02
% h2 ?+ E, C" C: k=========
: b" f5 ^  @- t6 _0 Y! D9 N1 }5 [# ^( e2 y5 B& L1 Y! \
Still a method very much used (perhaps the most frequent one).  It is used
' C$ @. E% `+ O4 t+ b. Jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 A# |% a! R3 g: x  V8 m8 \: ~0 [or execute SoftICE commands...& G; z3 n- u' S' l" O6 i, h
It is also used to crash SoftICE and to force it to execute any commands; m8 I$ m/ u9 e4 y3 y& \
(HBOOT...) :-((  
3 L. O2 Q4 p" \7 ?) k; S
1 B' b' g* @. n1 k& A+ l- I& e. z( jHere is a quick description:
' f, p& d6 y% r  a4 A7 C5 @-AX = 0910h   (Display string in SIce windows)
$ q) m. `! H" j-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)& A* d- P" ~' b# f7 E
-AX = 0912h   (Get breakpoint infos)1 m% w6 B. C! n
-AX = 0913h   (Set Sice breakpoints)
* k" ?. x/ t1 D: g" U4 G. n-AX = 0914h   (Remove SIce breakoints)
2 u9 @( Y  Z: n5 Y2 K# E+ z/ v9 ^4 M7 G! F8 d
Each time you'll meet this trick, you'll see:& D+ x! [8 M" t1 f( M, f
-SI = 4647h
9 D2 @& G, ?. J( f  f$ R-DI = 4A4Dh
. F# z9 s' g2 q4 m; AWhich are the 'magic values' used by SoftIce.
7 Y. r5 w9 |5 ~: G0 r3 J; ~( jFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% G8 W! H% m! N, {0 d2 L

- K, W( R0 v' ?+ B) R$ E$ S0 kHere is one example from the file "Haspinst.exe" which is the dongle HASP* v+ p/ t  J4 D  f+ O8 _
Envelope utility use to protect DOS applications:& t0 K7 a% H0 y: G& s7 ~8 v% o
5 ?1 c4 G( D/ q
: e, ?" a, L: O7 l2 e7 F
4C19:0095   MOV    AX,0911  ; execute command.
+ ~0 ]$ E# b$ @3 r+ Z# x4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 h/ |2 O7 b- k! J1 ~! M4C19:009A   MOV    SI,4647  ; 1st magic value.
6 L- G8 _( ~9 x! C. W4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 h$ E$ Z0 X' ]* s4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 V1 I8 j( j( ~0 N5 N
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
) ?7 y- d% K$ H% {. L4C19:00A4   INC    CX
# h% G0 f( n  r1 s) J4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- J/ ^# d# ^# Y. g4C19:00A8   JB     0095     ; 6 different commands.. C  \8 L" p* u1 W+ D
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ `$ K9 y' i* |, A0 A; p
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( o; _! }5 F; R
4 v3 o" c2 U6 r, y, [! J; Q3 Q# s' s* KThe program will execute 6 different SIce commands located at ds:dx, which
7 G! k* W6 T0 w, {- Ware: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- N% x! Q. S' s  P
5 N/ F$ S$ d6 I+ {: ^* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 s# n% v" w5 T) ~# ?___________________________________________________________________________
$ b) E+ |& m5 ~  K1 b$ _& J; J3 @5 D: Y" {( \
! h3 U5 O: V$ u- P$ C
Method 03
/ r- I: y# g. U' W$ x=========2 K% ]" b. F2 c2 {  p

3 u9 t7 c: P9 [" ILess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h% a  }; D- ?% `) |) p+ t
(API Get entry point)
+ }. I/ o6 f2 L4 G; }% k        
2 [# c; |2 c  X% n: Y
' H' i( q+ g. p$ ~0 n6 @    xor     di,di
& q( w- Y# B" Z  A  c( G" V3 T    mov     es,di
( B- ?8 p- A& M( `& @) z    mov     ax, 1684h      
$ u" s2 `+ S/ _- V" g    mov     bx, 0202h       ; VxD ID of winice
! R0 s! E8 q  N: m    int     2Fh6 d( ~  X# e+ h3 C# N4 D0 v4 j! _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 {3 l4 w+ L& c
    add     ax, di8 ]" J9 z) x, e: a
    test    ax,ax7 Y$ f6 O! S# F! o" C
    jnz     SoftICE_Detected/ ?$ k8 Z4 A: z4 `7 U; N, P
5 y: ]; D- [. |( ~1 M
___________________________________________________________________________
4 ]1 y+ y" V; I6 A
5 N- a- I* M/ R+ @+ S2 RMethod 04
6 Y1 k2 R0 A+ {! L7 O=========1 _5 S/ B3 f/ T+ x( P$ \+ I
# j/ h' C0 V- ], f3 d7 t! x/ [
Method identical to the preceding one except that it seeks the ID of SoftICE
8 |+ D' M1 R! vGFX VxD.) G% f' |: V0 }$ E* X; n

2 s. ?7 |( I# F    xor     di,di0 S( v8 \4 j9 _1 ^: d! S- X
    mov     es,di. I; k7 C/ b) }" X9 e/ Z. c7 O
    mov     ax, 1684h       - [: W0 V2 a' i6 |( C( _# A: a
    mov     bx, 7a5Fh       ; VxD ID of SIWVID. t3 z6 N8 U% k! P" k7 k( ]# x! i- ]
    int     2fh0 K! m8 k8 ]8 ?# }0 n- B
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 C# f2 _  Z. Q% J8 j- v
    add     ax, di
1 ?4 ?$ S0 F: U# W; _6 j2 e    test    ax,ax) D( X, }. X' a& F4 Q
    jnz     SoftICE_Detected9 x8 H' G( T: N1 k* C0 H
' {2 M7 Q0 I3 P
__________________________________________________________________________
. J/ Y$ n5 v( _! L4 v6 G/ J. `& A: K  c6 N" B- \$ }. V* v3 ~0 O
% Z6 B0 X% c: {
Method 05
! z4 @- }6 @! V4 e# l0 Z9 ^) D=========; O1 {# y9 j# h

( c( `9 A! a1 O6 ]( Z4 S6 QMethod seeking the 'magic number' 0F386h returned (in ax) by all system& b% b7 J5 j$ O0 A7 v9 S
debugger. It calls the int 41h, function 4Fh.8 n1 {0 |) Z8 ?$ _5 r4 S
There are several alternatives.  & N0 P0 R3 X( @$ i4 e
3 y, h1 y( R% t* n
The following one is the simplest:/ @; \" y( j- K% W
4 L$ F1 s8 ?# r0 e% N
    mov     ax,4fh
% R6 Y9 @8 [7 T3 t& z5 r3 t    int     41h3 O, ]9 e% _' @0 v3 t/ H
    cmp     ax, 0F386
7 l# I& \: S  b    jz      SoftICE_detected
/ D+ u5 b# ~7 T: O' X
" Q; J7 l: g2 M' C- v
: g& ]2 d' k" g/ l1 r3 A/ ]" \Next method as well as the following one are 2 examples from Stone's
/ p6 E, W. z. |% @"stn-wid.zip" (www.cracking.net):8 R$ R( O: P  n

# B  K: x( ^2 z9 M. `* z- w5 @3 {    mov     bx, cs
; m/ C: O8 w2 f2 p+ L5 d9 E    lea     dx, int41handler2% r: J' p- [. v
    xchg    dx, es:[41h*4]2 b' O: [* R  a! i( z4 G$ K0 L
    xchg    bx, es:[41h*4+2]
, `" J, f  j6 L5 }    mov     ax,4fh4 ~- e  c- F& l) i/ G0 ^2 x- \& w. E: o* F
    int     41h
8 j4 |* G' }& G0 [2 x! M: `    xchg    dx, es:[41h*4]
5 U( p# E* b& v$ N" V2 f    xchg    bx, es:[41h*4+2]0 R) f' d  \' r; I4 U; O2 r
    cmp     ax, 0f386h& t- W* u. J( ?1 d' u  z7 V. R
    jz      SoftICE_detected
; t6 {, ^) g* q8 |5 y2 ~
: m" R* b. e6 jint41handler2 PROC$ N& B6 R2 ~! v1 f. i. P
    iret
" \% u& V+ o. D1 F0 eint41handler2 ENDP6 r* J8 k0 e. i- y% t/ r8 p! A

. x3 p+ H/ T; B, i4 ]0 W& u% V! ?" q7 A
_________________________________________________________________________
- s0 Y" a- D7 k! r6 e. o
  O/ v# Z* B: Q7 G' M0 N  G. S+ V+ z/ t
Method 068 p/ W' V" v& w  {& f; i1 c
=========
0 |- X' a) P7 R/ O2 Y! X/ t
9 T+ E! x, S/ Y+ M' \$ Q- G7 n! y: |4 p7 F
2nd method similar to the preceding one but more difficult to detect:
% x2 y& U3 j  H! X( [  x7 p# L
, }+ g. P& J: _( F; t' z( ?
2 L* b. J7 Y8 _$ h# B" _! K+ eint41handler PROC5 h4 A8 c, z, |1 o7 b- s' y
    mov     cl,al
8 |3 |. A0 z6 Z( A$ r( o, [    iret
( G5 f+ V3 B# \7 lint41handler ENDP5 s/ \1 y& }1 P5 e
" w6 W9 v: c2 W

" X2 _+ k7 C* @6 u0 R( x    xor     ax,ax
& _! I6 W+ t. E- a: \    mov     es,ax) j0 P6 z5 q, C4 F5 a
    mov     bx, cs) @0 Y# ~- x/ A0 ^$ d) V" W
    lea     dx, int41handler
* x# ~$ ~0 B- |+ U& V7 Q- y    xchg    dx, es:[41h*4]
3 w+ V; G* B$ m2 _4 u! B    xchg    bx, es:[41h*4+2]& V% N4 |- W. f+ I4 O
    in      al, 40h3 a* i, V/ _; Y
    xor     cx,cx
% p3 p& i- @, B* V% s) P7 D    int     41h
7 p: b6 i* p' [  [) r! u    xchg    dx, es:[41h*4]# h0 c% w0 k2 v( T- }1 }; J
    xchg    bx, es:[41h*4+2]
- M: l  K; p7 s( S& a( g    cmp     cl,al
2 r) `9 d5 F" V! X    jnz     SoftICE_detected
0 z& A$ y# D: f2 c
0 k- C. G" G( }  x2 T9 g_________________________________________________________________________
# M9 f3 ^' |  ^9 R- g: S7 S2 Z. y. K" K6 q0 h( _
Method 07
' l  k' T: O$ I- w4 M& O=========
& i) @; \2 @- H  ?2 D) S0 N' Z% p: f2 b& Q! U
Method of detection of the WinICE handler in the int68h (V86)- x$ ?# V5 l! R7 ?( Q
9 G7 u7 `$ W' j  I1 N
    mov     ah,43h
" e; s4 T, {( o, R9 g    int     68h" N5 j8 a7 _# B. [& q/ K
    cmp     ax,0F386h
* F* L' R$ S. \' v0 {  R. A    jz      SoftICE_Detected
# k9 s$ a$ C! E3 l) m2 |! |7 j. }1 c
0 e0 e( f  m9 B7 t0 Q
# `, g7 |* x) N! x/ i0 y=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) T& ^  C/ x5 i& A
   app like this:, @5 o: Y) n- z: H
" y2 q6 p4 z, l: j, [
   BPX exec_int if ax==68
( e+ j( }5 u1 @$ S! c/ q! [: h) W   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 ?( f) O; f4 S# V" z( d, a7 M& V   located at [ebp+48h] for 32Bit apps)
4 S7 a& q/ P1 E$ t3 I5 o__________________________________________________________________________# h$ P+ b* y$ b, s4 n7 w- q

: G- x4 n) ]( O) B
; K3 @( ?' m) A9 t4 U4 k! [. EMethod 08& O. Y, C" }4 P& l
=========
: a0 `# F3 g; a6 o/ s: {' J0 ]) I, D; _
It is not a method of detection of SoftICE but a possibility to crash the
0 s& m9 }8 Z1 v9 ]system by intercepting int 01h and int 03h and redirecting them to another
( {( |$ F5 M8 U: y" d9 _routine.: r5 q0 C& C. _% B
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points- U8 r. V% u0 x1 Z! l# t) j
to the new routine to execute (hangs computer...)
3 I( w9 [% O, b, ?8 Y# u. n$ M& ]+ F% u( v, x8 `. Y) I2 @4 n
    mov     ah, 25h
5 q3 F  [6 L* B& e0 ^. x    mov     al, Int_Number (01h or 03h)
4 j4 q7 Z- G' t6 ~4 Q3 M! w6 \    mov     dx, offset New_Int_Routine# h$ T5 \2 r8 s; v5 r( t4 g$ b$ n
    int     21h
3 n- V) Y! f/ w+ |3 d
4 R4 Y" T) E1 J0 m- [9 g& p__________________________________________________________________________
2 o; Z- m% p5 a7 U  R( l9 S3 H% v& Z  p1 Y0 l) ^; [
Method 094 X0 x* \# z7 J- p' i. k. {" P
=========
( E) o; }3 [, U9 W( n- Q- n# e. o, e- |/ d% W6 V# L% o
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 f3 H$ V, X- b9 b! B( Uperformed in ring0 (VxD or a ring3 app using the VxdCall).
% P$ h9 Q4 F+ I6 QThe Get_DDB service is used to determine whether or not a VxD is installed1 U: B5 O; d& N' ?6 B% n# z
for the specified device and returns a Device Description Block (in ecx) for- ?% m2 l+ _6 m  U: `) E
that device if it is installed.+ p4 `( d2 y0 [  C0 e8 d2 t9 V
* ^- s5 `, }, l! l' w: I
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID7 v1 N4 |# |4 c9 X2 ~. R. S$ R# \
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): j6 r- \  G" r/ j3 t
   VMMCall Get_DDB
& B+ z) w- d" ?; d8 Z9 j   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed' q. B$ \0 V( P6 N$ K) H0 a
+ E6 S" k& \5 ~6 U' `) J
Note as well that you can easily detect this method with SoftICE:# W0 m# m( p) l
   bpx Get_DDB if ax==0202 || ax==7a5fh8 Q, D! m7 B. D; B( S) }- D/ w4 A! e
! R9 A! A' I+ s, u
__________________________________________________________________________
' \5 ~' F! I) t) ]: J2 ~
5 W5 U3 S2 k% U$ IMethod 10
( h- ?8 D' X( r2 X( m. K=========
) @+ r% p& X+ n7 j1 f" @$ n5 z& k6 U. s3 T3 m9 G: D7 {
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, t7 {: o7 @% p3 j7 i3 d
  SoftICE while the option is enable!!4 Y( f- _7 l8 p
3 J& e( f% R+ A& a+ T% o/ S7 B+ X
This trick is very efficient:* Y& N- n' q% W8 ^% \
by checking the Debug Registers, you can detect if SoftICE is loaded9 f& y9 W6 d. V" K) X1 f
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 y; b8 [3 e4 q- p4 |+ Jthere are some memory breakpoints set (dr0 to dr3) simply by reading their3 A0 [# o1 n& L; D% f
value (in ring0 only). Values can be manipulated and or changed as well
6 m+ ^7 [, h9 R0 r8 x* e9 Y9 F(clearing BPMs for instance)
' S( S8 y& N/ k( H. g+ ]' z2 ~9 t) C' U1 N5 {: j
__________________________________________________________________________
, o% @+ x8 t$ V2 N6 S* W" A8 C% {/ {- e5 J( r
Method 11! B& V) O8 y' u+ ?% r9 y% O
=========; t/ I7 P: O$ f/ ]+ s
$ `$ P2 M0 u# }7 w7 R$ X# S2 c
This method is most known as 'MeltICE' because it has been freely distributed4 }4 }2 J4 c! P+ S+ `0 i
via www.winfiles.com. However it was first used by NuMega people to allow
5 J# c3 B& i1 Q: KSymbol Loader to check if SoftICE was active or not (the code is located
  q: @' t0 I* uinside nmtrans.dll).
# L9 {: k* u  H- F' Z
( _! ]. d1 @! \/ iThe way it works is very simple:# R. W: Q$ ~. j" D2 o" M' h
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 B! U. D9 X/ \' S: y" w
WinNT) with the CreateFileA API.8 O; C% O. q/ Y* `! j) p

9 w! D( t0 N6 \4 k5 iHere is a sample (checking for 'SICE'):
" P( w- U; H! D" f# {+ M" `- G- O7 ~1 {8 x1 C3 B2 q4 {
BOOL IsSoftIce95Loaded()  ~7 J  K, _6 n3 L; z0 H) l
{
: Z. X+ q1 i$ O4 L   HANDLE hFile;  ) j' g4 H5 \! }( n, G, h/ t
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
1 w3 w$ T3 Y" P                      FILE_SHARE_READ | FILE_SHARE_WRITE,
$ `3 Y: ^6 I- y' a3 y# q5 L5 ~/ K7 h                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! \; r' u  u' b: @( P  u% I   if( hFile != INVALID_HANDLE_VALUE )# i: H3 O, B/ O2 l  h2 F
   {
, [" r. n* U6 p+ E+ o  Z      CloseHandle(hFile);* }+ K) J: E3 [$ P+ h; W8 @+ x) @3 E
      return TRUE;
# g$ E8 d1 H2 a3 ]   }
8 A) z# [- B' L! K, Z3 ?  y1 c   return FALSE;
- ^0 W; u9 V0 U3 u: Y}' M: X: s5 Y9 x0 a% p
8 }& @- _. B" [7 ]7 K
Although this trick calls the CreateFileA function, don't even expect to be
! |2 ~5 V! |9 x+ H2 Oable to intercept it by installing a IFS hook: it will not work, no way!
3 k+ @4 l2 V4 }2 t+ `In fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 t4 R# [/ K/ P$ f; g& N- Zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 ?% C3 |  m5 }. [" G4 p4 _
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
, J/ ?+ ?+ Z' {6 W- x4 Bfield.8 l5 }$ t* H- t1 S
In fact, its purpose is not to load/unload VxDs but only to send a
6 }" s- y) Q6 z5 v; b5 y! JW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)/ }+ _! B1 U/ z/ F( F1 v
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 `5 T3 y7 ~: V5 d2 Pto load/unload a non-dynamically loadable driver such as SoftICE ;-).4 l9 @, \* p0 _8 D4 {/ F7 ]) g
If the VxD is loaded, it will always clear eax and the Carry flag to allow
: F* V/ c  ^7 S( Iits handle to be opened and then, will be detected.$ G" T2 i; ~2 A* Q& c6 d
You can check that simply by hooking Winice.exe control proc entry point6 F8 C" v# j0 h  B
while running MeltICE.
$ y, \+ o: h- p' P  E$ J6 h: \+ H

% _: {/ U  w+ E" ]! h$ C, J, j  00401067:  push      00402025    ; \\.\SICE# n2 _  f0 F. `/ u; Y" G
  0040106C:  call      CreateFileA& }6 z6 n6 d$ g7 D, n. K/ X
  00401071:  cmp       eax,-001
- D1 f2 i6 k- ?4 O  00401074:  je        004010910 C6 u4 Z4 q9 A1 a0 o5 A* ]
( n$ d4 C: G: N: o0 n  l
' g1 \. |, j" `( m& W0 y9 m
There could be hundreds of BPX you could use to detect this trick.
6 y, d" o1 o8 J, w( K) g-The most classical one is:. Z# L4 x$ q; m) N9 L
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
& m: F  Q- L5 V: l/ B5 A- u    *(esp-&gt;4+4)=='NTIC'
3 ^) M% ^$ A7 V2 L6 u
& \2 e5 I. q) Q-The most exotic ones (could be very slooooow :-(
9 p1 H* a. K$ o8 @( `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* K8 v8 m4 k$ P6 G9 F     ;will break 3 times :-(
) P' ?$ B% u2 p$ G: e# q9 J. d
/ _+ Z; F  D) N-or (a bit) faster:
" q! T5 V) ~' h: \" W   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
4 L; J+ d/ }/ Y
1 B( C$ g2 d2 u: I5 _: {; `1 W" u   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 D3 a5 z: o$ }, \) U) ~. {     ;will break 3 times :-() j: x5 l# o" Q

' _/ x* m6 C4 P1 J-Much faster:
  C6 f: y" u$ o( ^- ^   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 M& ]  @4 S2 C" ]" w
2 B$ w6 [) v: D  v. `Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 E% Y$ `7 z5 c  o6 u4 U
function to do the same job:
  y; B! t) \) ]+ l) e1 v' w% d+ u/ |
   push    00                        ; OF_READ$ J( O! [' R/ n+ {4 N
   mov     eax,[00656634]            ; '\\.\SICE',0
3 T5 X5 u  p5 b   push    eax
& d+ L0 L) ^. y% z! K4 _/ z   call    KERNEL32!_lopen
" f0 e1 B4 o* }0 S# c/ S" x5 _+ a   inc     eax
4 M+ @5 Y1 s/ K. L   jnz     00650589                  ; detected$ Y1 \4 I( X2 B. |* R3 J9 Y; f' I
   push    00                        ; OF_READ
+ G4 F# t, f! s; N& d( a0 q' I9 m   mov     eax,[00656638]            ; '\\.\SICE'+ C. F1 z6 q$ c# Z  S
   push    eax. {) n% ?* b# d! Y( Z
   call    KERNEL32!_lopen
1 o  X" S  `3 y+ q; [) R# u   inc     eax" k4 }8 l: X3 y- {
   jz      006505ae                  ; not detected9 h* n$ [0 |: l: ~
( S+ ~4 @9 s6 W
1 q' }3 y: O! o* M
__________________________________________________________________________% o; m2 f. \, T/ d% S( u, j, j

( e6 n/ @' D" T2 i; l; }) iMethod 12" R) a4 }. a8 i. E3 y% A
=========+ a( K# T8 v! _, _$ J( s( A! L
+ X7 z, i. U" C3 Y
This trick is similar to int41h/4fh Debugger installation check (code 05  N5 e& u, w$ o0 c  P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)" ^7 r. o- g3 t( ]4 \
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" H+ t# {; b8 h+ |* j" l
  J2 b: I) ~! g6 ?# J/ v3 q   push  0000004fh         ; function 4fh$ V, I" H1 p. h$ F
   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 _0 r* @2 F9 m# o                           ; low word specifies which service' m; M0 V) ]& c' a( ]% h
                             (VWIN32_Int41Dispatch)
4 Y  q$ i  X7 e9 E, b   call  Kernel32!ORD_001  ; VxdCall
2 O) K: a  c/ Y  X- }: B( o3 ^   cmp   ax, 0f386h        ; magic number returned by system debuggers7 D/ A7 ~& D; z3 F' a+ h
   jz    SoftICE_detected
! \( D; L, U& E2 D, l8 Z5 t) R+ {5 ~, Z9 \# A7 v
Here again, several ways to detect it:
2 C' ]2 J7 d0 x, A$ |3 O+ E1 U
3 J' A  h* j& {& {: r7 u    BPINT 41 if ax==4f, i, m, Z% V: u; P( p
4 o# t6 H' j% I
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one# d; P! ^5 G- Y4 u9 ~# o

6 z; w$ n; g( g1 r    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 s" g* \5 G- I5 e4 q* s" P+ R

" m% m' i" V9 Y! R* ~+ w    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
  m' N  S2 P  L0 u# P0 k+ |4 q) e$ l8 {: B2 K+ M1 \
__________________________________________________________________________* g. ^/ X) u& I4 \
$ A- e) X5 |4 c: Q' e9 c8 R# ?
Method 133 e2 X# Q4 G1 @2 W/ D* K, g
=========
9 f& U# _3 L- N) ?! K
3 _2 r- o# B% b7 lNot a real method of detection, but a good way to know if SoftICE is
: |8 t: i) x; q3 _7 i4 Xinstalled on a computer and to locate its installation directory.  U8 {/ l& r% g+ C
It is used by few softs which access the following registry keys (usually #2) :; n# M+ p, t, a8 a) p
1 a! P* f; T3 H: P! b
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" R5 o* f% D/ c\Uninstall\SoftICE
: @  S6 H( ]0 S- C  u" n-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 G) ?2 d4 k0 v  J+ A# f% u
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 ^% s* q, P! n' `; b0 E  q2 H
\App Paths\Loader32.Exe8 b$ T8 ]6 D6 T2 j

3 Z- W' C; q5 y* ~% r3 o8 C1 H5 r8 `* \
Note that some nasty apps could then erase all files from SoftICE directory
0 {1 h8 ]7 l( @" T) L( }(I faced that once :-(
4 H+ H9 n3 `# O5 e* D9 s  n- U; z8 J7 S/ k! W
Useful breakpoint to detect it:
( {( r" w5 E! _6 N' S
5 h3 p( X5 g( Q& \& A9 F     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'/ ?3 m+ [' v+ R' u0 z* n1 j
* U9 k" h1 S/ t/ V1 d; K9 R
__________________________________________________________________________/ b9 O' z2 l, M- q, j$ R

+ s, ~+ W9 |: [2 q8 x- P3 ]% q* {( g/ X" T& S% W8 z. d
Method 14 + s) V/ V4 D" c* l
=========2 c$ J( l: N$ Y# s( D, C
) P- Z+ B7 ~  y3 Z; }; ^
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
. I: R6 `9 |' m; l4 R$ w) a0 ?is to determines whether a debugger is running on your system (ring0 only).3 n7 ]9 i+ d! ]4 g6 t
5 X( o4 a( r$ j* Y
   VMMCall Test_Debug_Installed+ f& Z0 G% v5 [  j6 ~
   je      not_installed4 E- c% ]; G9 I. P8 L7 }" ~& r5 @
# @! W8 ^9 q/ n3 s, y
This service just checks a flag.
  }) k/ s+ M3 f- `  K% l</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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