About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ }( C. Q0 T+ h
<TBODY>
$ e& @, O( \  H5 ?4 u: ~<TR>/ z8 |, X! D8 H+ @' I0 N. \# |
<TD><PRE>Method 01 ! _0 U; q, s  _5 d: [2 i
=========
5 r8 g9 N6 F; L2 `
/ W0 w" D' S1 @/ [0 rThis method of detection of SoftICE (as well as the following one) is" O; ~5 b! j! N  }' u
used by the majority of packers/encryptors found on Internet.) G4 {5 [8 b& Z7 [
It seeks the signature of BoundsChecker in SoftICE; D1 m, V, a+ d, X6 h

# p5 S- t9 Z4 [; ~% I- y4 B5 H. }    mov     ebp, 04243484Bh        ; 'BCHK'5 c- ]0 O2 n8 F: R" t9 ~* Y5 o) R
    mov     ax, 04h
+ }5 G/ p- S! I+ R    int     3       2 U! ~% ^: ?( Q1 d
    cmp     al,4" T- O' u1 n- ]" r* H  B
    jnz     SoftICE_Detected
9 G& E3 b. T( T" t* Q3 k  z! Q, {! P5 L
___________________________________________________________________________4 c3 L5 n# V. [  b
3 S3 ~/ C3 ^1 Q0 t2 f
Method 02
8 x- m9 w% {  J+ w=========7 _0 Y2 A' ~7 H2 @

' J3 Z& l" t' L9 q/ r" rStill a method very much used (perhaps the most frequent one).  It is used
" c3 a  @% c9 H6 R9 Cto get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ s, i8 _' e% \8 V; O1 f  c
or execute SoftICE commands...% K* _  }5 R7 n! Z6 P) O9 j3 X
It is also used to crash SoftICE and to force it to execute any commands
' n2 X- ]0 Q" a(HBOOT...) :-((  4 S6 w6 j$ I* U, a: h0 U
. V* F' y8 ^# G1 r# |
Here is a quick description:
# t: M0 h- M9 s6 |9 {% m& ^% V-AX = 0910h   (Display string in SIce windows)! w" |+ c0 h5 u! U
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 ?5 }+ G, K  T( o7 c
-AX = 0912h   (Get breakpoint infos)6 s$ Y; H6 a6 t. W1 U! t9 p3 n* H
-AX = 0913h   (Set Sice breakpoints), z. N; F- d+ \7 i  G: I* y
-AX = 0914h   (Remove SIce breakoints)
2 F  |9 P/ x+ C! a* H' ?6 I- I/ {
5 E2 A% O" g- T( }6 _5 s' \Each time you'll meet this trick, you'll see:5 x7 j0 o7 T1 T- d
-SI = 4647h  W" d( ^, Z9 G. B* B3 h
-DI = 4A4Dh  C# b1 T( i: c4 x- N7 C
Which are the 'magic values' used by SoftIce.. I) j- v( M# ~7 w; ~" N* y
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 f8 U( Y$ |/ c$ D+ V1 ]) K$ o/ d+ Q
: ?4 |/ R5 Y2 ]! z: c8 X# \6 t
Here is one example from the file "Haspinst.exe" which is the dongle HASP
: i2 M/ I5 H5 y$ v& d& yEnvelope utility use to protect DOS applications:* [( Y' n0 M$ N( F0 f, O
  L9 r* i! p: v' ?; N% g) B

' K9 i& D* I  O3 d% W4C19:0095   MOV    AX,0911  ; execute command.
  [6 j( y+ \( [$ M( j+ H4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, H" j: o- m3 d# g8 p4C19:009A   MOV    SI,4647  ; 1st magic value.
9 f2 {# p$ E) p$ r4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 v+ P4 Q% m$ D1 m" N& b  Q3 q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)/ s' b) {, c& W6 g" p
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute' a/ a8 O6 \7 N- c
4C19:00A4   INC    CX
! ~8 I- W% X5 ~7 R: ]4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute1 x# o& b2 ^( V! R8 Q
4C19:00A8   JB     0095     ; 6 different commands., i6 w1 a" L/ `) ]3 ]
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 V; M3 w8 z# @! R: }% o4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& M! M/ N& t2 r5 U  g

+ T0 a* P8 ]7 ~( g9 p- n+ r- m3 B* zThe program will execute 6 different SIce commands located at ds:dx, which
& C$ Q( \7 J2 w5 ?& ~are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) C- |+ |: \3 F9 |2 Y, {, c$ r  r, Z  r0 e0 O5 t% i
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 o( ]; _) K) F' F: J$ z0 I, {
___________________________________________________________________________) ~- u$ v9 F( r) _/ L% v3 z6 }
- }- Z# s4 _; ~. `& Y, U. U

2 x; Z0 y: W0 q% Y2 t0 }7 Q- jMethod 030 ^4 K! @+ a  n- |, o/ R
=========
# T5 m1 g( M) {5 F5 w9 a, o1 u: n+ A4 p6 X, y% J7 C1 k+ A7 \
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* I" m( {7 Y. [; r; N. o# S7 }
(API Get entry point)* F# k. R  m: ^( w: H6 K9 Q
        
' v% e7 U! n  b0 k+ x/ ^/ Z) H: D) g
+ e$ V, p! ~8 B( @    xor     di,di
0 K3 S5 Q% ~& W; j/ w    mov     es,di) a. N6 l+ A/ U& k
    mov     ax, 1684h       , o- t4 n' G! m
    mov     bx, 0202h       ; VxD ID of winice
+ v. d0 w0 t3 c1 p  o# [& T    int     2Fh
1 F0 T. h7 F( ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 R# w  k) l2 o5 m8 _& B* R    add     ax, di
' l9 F' E( L; M5 c  O5 W    test    ax,ax& i$ N5 C' I1 X, b+ t* n& i
    jnz     SoftICE_Detected5 [' e; Y  q* w7 X! H" P  T2 c

1 m1 o3 d' G# M; m. [  t9 q___________________________________________________________________________+ F+ M8 W) @8 R2 }* B/ g

% B1 w2 I6 x) a. t6 D+ `: V% _  @Method 04# t) M0 R  o5 k: R5 h) @
=========9 y. Y; q, [) Z8 ^& T
+ w2 L: f5 A4 i7 z& m0 W) F
Method identical to the preceding one except that it seeks the ID of SoftICE
% w. F4 a7 n9 tGFX VxD.
3 o; Z6 z5 z& w* k) ^9 b: n; E0 q' j$ l6 k: L+ c
    xor     di,di
/ @# q0 q* E/ C    mov     es,di
6 _$ M" \- |; _$ p# \9 c    mov     ax, 1684h       ( V$ L0 C* b7 J
    mov     bx, 7a5Fh       ; VxD ID of SIWVID# P4 g$ p- Q! b  e$ Z
    int     2fh
! @  {! l2 g) ~! H. n7 K9 P' w    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 c/ z' Q/ g; Z8 t, r6 S    add     ax, di
! }! q# v. l  N! F, ?  i    test    ax,ax# l0 A; c& r+ I* ]  E' [3 v$ R9 C
    jnz     SoftICE_Detected
* n. f+ ?# T: R4 Z$ ^/ [7 T" ]! s# @# P: E3 P
__________________________________________________________________________1 i, J/ H6 C0 X- L# J- y

' o: _  h7 D7 e; e, B. O1 ?' w  M2 d
Method 05. ~4 _& S8 S7 C( n* T
=========
  K# a/ C9 W' F+ ?! j
* f$ a; T5 G' S% ~% z& ~% bMethod seeking the 'magic number' 0F386h returned (in ax) by all system
) x2 u# u# N  V0 n4 sdebugger. It calls the int 41h, function 4Fh.' ~* F5 J+ @0 v: N
There are several alternatives.  
& t  O$ U& W- \$ g/ W. a% S" _6 ?% g+ @2 O% o
The following one is the simplest:
3 C% S2 X$ K2 `) d9 @+ G( y: n4 z/ V
    mov     ax,4fh* k- T: c. n3 B# q" |  j7 T' N
    int     41h
% g& `" U1 t) ?0 E& [    cmp     ax, 0F386% h: g! o# p* D
    jz      SoftICE_detected( _' w1 b$ V% X- v8 {, r+ |# `
5 i0 A4 o2 ?: F; z8 }6 d2 T% K& ?
* c7 ^0 Y# ~5 @1 o5 F# b
Next method as well as the following one are 2 examples from Stone's
/ C. E: t7 W6 M$ U"stn-wid.zip" (www.cracking.net):* z; u. G3 M( j* b1 |
+ s/ a* ~  a9 ^: n2 p8 V# N
    mov     bx, cs
/ Q$ e4 |9 P1 T3 d; y2 h" ?6 B    lea     dx, int41handler2
1 C4 }. a  l6 P/ H+ y# i$ q    xchg    dx, es:[41h*4]
- w! H. i1 Y- h0 g3 {' S. I    xchg    bx, es:[41h*4+2]0 F$ ?: j/ k% b
    mov     ax,4fh8 N: ~& f1 @7 q) S" k1 R
    int     41h
* ]! p' j  o( S7 w4 p    xchg    dx, es:[41h*4]
7 V) {. C9 N% b6 r" S    xchg    bx, es:[41h*4+2]3 ?' B. f3 j' P, X  D! e* l
    cmp     ax, 0f386h- t! I: Y2 B  Q) C+ n
    jz      SoftICE_detected1 c7 i- g+ ]3 Q- p
( z$ k8 W% R( y0 Q6 z8 k
int41handler2 PROC
: l" o$ [0 E' B! M9 |8 ~9 b7 V    iret9 x4 J3 Z6 u% z( U0 C
int41handler2 ENDP9 S# }6 M" I" T" Q4 b1 r8 f; u. ~
# A% @7 T1 z" B2 _2 a0 p3 @8 T
7 w: o8 K9 q+ A- W0 M; H0 K
_________________________________________________________________________
/ u$ e6 g& \% B8 S6 E& \3 ~
3 O+ y; _8 k) J& H/ x4 ]9 h# O( F
' W  U+ j& j  I: J& bMethod 06; G. z! }' i/ N; k' i: [2 ~
=========- ]1 O- I  O6 Z, ~' r0 A  C
! i/ y$ t# [2 _# h. Y7 K' R
2 o0 P4 T8 x+ Z2 c
2nd method similar to the preceding one but more difficult to detect:
" V' }. k- y' e0 @& Z- g/ n1 l$ e7 x5 q/ Y5 t* t3 x5 d0 y

* c. a1 Q) {) {" N0 N1 g7 Zint41handler PROC
$ }$ i. \! E1 F: A7 X, ]6 A    mov     cl,al
* l- q, \& @; h/ H% c3 N7 e    iret
3 V7 ?9 K. z% D" a* s+ R. h# Lint41handler ENDP
. A" o% q  r6 _; [3 Y
3 H" X6 z* @& o+ D* n7 ^  ~! Q
    xor     ax,ax
4 ^" u1 Z& X! S: _$ A    mov     es,ax9 N/ N# w/ J0 t! G% T4 {3 j
    mov     bx, cs/ ?0 a: Z  e/ x
    lea     dx, int41handler2 |/ h* R5 F+ V3 F
    xchg    dx, es:[41h*4]- }! y% V9 ~4 I! ]3 u" `; D
    xchg    bx, es:[41h*4+2]) u5 `# F# D; Z. B' u/ y
    in      al, 40h
3 @8 v. ?) O4 b( |( E+ f3 f- S    xor     cx,cx
0 p7 p- V$ d/ y2 U* t    int     41h
5 w4 J" `# T4 F. ^) G3 ~7 V6 N    xchg    dx, es:[41h*4]/ j0 |4 y0 a* G9 D5 d
    xchg    bx, es:[41h*4+2]
+ G. w$ [, Z, x    cmp     cl,al
" M- u1 r2 a* r( C! C4 A    jnz     SoftICE_detected
! M' g$ J  N+ s5 V3 J7 }' a
: s( u1 p5 U0 C_________________________________________________________________________5 K; G# e9 d4 h% j% t- W' N) g
2 C8 S) n, r" |
Method 076 J1 d9 G/ j4 I
=========7 O. _  l$ e# h0 g1 D

( T1 Z) K% i4 t8 KMethod of detection of the WinICE handler in the int68h (V86)7 i0 }8 y- f3 q9 q8 a- r  i. c

& G, }! S- [  f9 U    mov     ah,43h
1 q" b' N% D" s& F4 T2 ^- R1 Y& Z    int     68h& J8 _5 a+ t; T1 A! S
    cmp     ax,0F386h
% y2 {) m) x1 J5 ?$ W    jz      SoftICE_Detected. y' \$ J: e3 O- X
7 b5 P, g9 H; |' k

+ }+ X7 H% o2 Z$ l9 t: w=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, ^& {, H. j/ x! q& @1 w" ?! y
   app like this:- V" X, ~& j, d" x

" ^8 H+ F4 T" I& E2 A2 i7 W   BPX exec_int if ax==68  Y8 i$ Y- a8 F3 R5 I
   (function called is located at byte ptr [ebp+1Dh] and client eip is
) T  P1 R, W1 S! v; ?# H   located at [ebp+48h] for 32Bit apps)
6 J5 t5 O! ?4 M6 R1 [% k__________________________________________________________________________' B" a. F4 t  @
) s. L, c  Z( ?' M$ E0 s; G. \. t

7 I; O+ ~; R8 c0 a" t4 M% J; J1 pMethod 08
6 }3 _( c% n7 O9 M% m=========1 [7 z/ n; L' ^- b
2 [( `+ M& p6 S9 [2 s
It is not a method of detection of SoftICE but a possibility to crash the
( ]; H% R, F1 P) D  z( f: Xsystem by intercepting int 01h and int 03h and redirecting them to another
# W( p& I6 c+ f' Q0 f. U0 B9 ^routine.& [' i7 b' \+ I4 c; p% {
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
3 W0 k; p8 ^/ p' P& ~to the new routine to execute (hangs computer...)
4 C$ ?% n/ w8 K: \. s' T
; V: H, f$ D+ i. D1 V! C% d5 \    mov     ah, 25h* |7 D+ q. _) F
    mov     al, Int_Number (01h or 03h)0 N) e! S: S9 w: y  y* a9 m: q
    mov     dx, offset New_Int_Routine- C' @0 t/ f1 s5 m) g
    int     21h
( _$ k. j* r$ Z; O" W  ^5 D' p# h
# q/ }: s5 D! x6 S__________________________________________________________________________
5 G$ ^0 Q  n! \  g5 w+ m* t3 C5 a" p$ o. J
Method 09- X- D& A* P* Z% x
=========
! C! j* E- |2 K& w1 i. _* C5 ^' a1 D" ]' P" }( Q
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only3 t" ]) q8 D& D/ G! d0 V% \
performed in ring0 (VxD or a ring3 app using the VxdCall).
+ X. i* Y0 u% g8 j  Q6 lThe Get_DDB service is used to determine whether or not a VxD is installed6 i9 T! R( Q# s$ r+ z" @# d
for the specified device and returns a Device Description Block (in ecx) for
4 Z' P8 F7 O: [2 o. M5 b2 ithat device if it is installed., G, h4 T- u; ~' Y$ f2 H1 U: g

; N) X8 D( I! ^+ O; f5 ?   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
, v  w# ]# D5 `3 f1 q$ B   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
1 I) X1 v3 R0 j  V   VMMCall Get_DDB
5 N& m, O3 d# U. h  ?   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed6 s" f5 [+ ^0 W/ d
* B9 j% b" K2 E# a
Note as well that you can easily detect this method with SoftICE:& z$ S$ G+ F, f3 C7 p
   bpx Get_DDB if ax==0202 || ax==7a5fh: e# F" y$ f/ ?6 f
* [+ w  g' h' M) ?' x5 R' B
__________________________________________________________________________
0 s7 q: ?* v- p/ I$ y" E: o  Y1 x. {- J7 A
Method 10
& V* z: L, w9 @. ]5 `; }3 ?=========
3 B3 p1 k4 n* V0 S: Y  `) N9 G9 o4 T& V" `
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 M5 }; z' O! o1 x" Y
  SoftICE while the option is enable!!6 D3 i5 z8 T+ X7 {

! T5 L: W7 G; Y+ d8 i- }This trick is very efficient:8 X/ H& G' Z$ X$ h
by checking the Debug Registers, you can detect if SoftICE is loaded
. p- y9 {& }9 y" Y(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
) ]" b2 V% Y0 ~+ Ethere are some memory breakpoints set (dr0 to dr3) simply by reading their
) z4 s3 a* _4 g: N7 jvalue (in ring0 only). Values can be manipulated and or changed as well
8 c; Q' ?2 q! d% w/ K(clearing BPMs for instance)& L- t' ?& \$ L1 T2 S/ f8 z1 c

  R8 U' z+ A" x__________________________________________________________________________  ]" f  d# P% P6 v! @- [

* c! j& f4 N5 I2 b& j3 L+ P! s$ _- GMethod 11" I& c* w+ {7 S
=========
% K8 c3 C- V. n9 Q
" h" h5 Q6 V4 Z# g  E6 j/ F) mThis method is most known as 'MeltICE' because it has been freely distributed
( Y3 r  E) \% A  L- S- D* o; Wvia www.winfiles.com. However it was first used by NuMega people to allow- o/ e8 V1 k% l
Symbol Loader to check if SoftICE was active or not (the code is located
" [' Q; O& h' `/ J% F4 ]- winside nmtrans.dll).% R$ _# U- H0 O  U% A
  B  r% F% K9 a4 V9 ^
The way it works is very simple:
) N4 m6 l5 {. S/ h8 p1 A5 yIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 e$ f! \/ a9 oWinNT) with the CreateFileA API.; ?  i$ q) Z/ ?
" }7 {# I$ d- [5 r$ T0 ]1 ?! O
Here is a sample (checking for 'SICE'):
$ h- E! M2 S( c- T1 o) \$ o  r# w
  p, a4 o( Q( j: W; BBOOL IsSoftIce95Loaded()2 K' t5 e" t+ L$ g3 l, a& W
{
! Y9 ?$ ]9 U  g+ }   HANDLE hFile;  
, z0 \$ Y1 i9 A: O   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
7 B$ T! T4 W  W+ @                      FILE_SHARE_READ | FILE_SHARE_WRITE,& S/ T6 }" q3 r. B3 A# Y7 y+ @
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);" w7 K$ B/ [* Y; n- _7 V6 S
   if( hFile != INVALID_HANDLE_VALUE )# W' o6 g9 R; ~7 ~  |
   {
2 I/ C, ]1 d, o1 T4 X( G( Z      CloseHandle(hFile);, ^  t, A+ I/ e2 d+ `4 t; J
      return TRUE;# s+ ?: t1 u, J/ o0 Q: ]; u
   }
( D1 a7 F& o* J4 s   return FALSE;( H  D, _, I$ k
}' H6 ~* z: e1 V/ e

$ d% ?( o+ F! r: A5 NAlthough this trick calls the CreateFileA function, don't even expect to be
& X( H- P. N% ^5 ?. V  p$ {! Yable to intercept it by installing a IFS hook: it will not work, no way!
" ?0 D, i8 F( CIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
$ ~$ _8 g9 X/ yservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ g4 @& a* D; Z
and then browse the DDB list until it find the VxD and its DDB_Control_Proc6 T$ B% q; ~4 w( k# I& S. G
field.
1 Q9 V- g: v" ?In fact, its purpose is not to load/unload VxDs but only to send a
3 d! _( s) l( v# k; c3 _W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# C- u3 ^. ]3 s0 P, M7 o8 U9 y0 ~( ^
to the VxD Control_Dispatch proc (how the hell a shareware soft could try0 Q3 T- t# H9 T
to load/unload a non-dynamically loadable driver such as SoftICE ;-).+ {- J& V1 Q9 k
If the VxD is loaded, it will always clear eax and the Carry flag to allow' \" K1 C/ ^0 i# [5 e
its handle to be opened and then, will be detected.
" M. y1 f- \. Q1 C; `You can check that simply by hooking Winice.exe control proc entry point+ A+ W4 A" J2 c
while running MeltICE.
" f3 P; v' Z0 k" ^! C: x$ B, c$ O( N8 ^. Z3 N& A% x$ a# u
1 Q. P. L) g- s  |$ s4 u# o1 ]
  00401067:  push      00402025    ; \\.\SICE
2 s5 }! [( h" X" \. ~# q% V* C  0040106C:  call      CreateFileA  ^! i& i% V' A7 o/ T
  00401071:  cmp       eax,-001! a+ Q  k) w! @
  00401074:  je        00401091
. }! z" ^1 J+ }8 I( P8 a. K5 B/ U$ E

' a7 C6 Z& Y1 d& lThere could be hundreds of BPX you could use to detect this trick.) u% D9 L- q$ r: d3 d% h/ z- q* U
-The most classical one is:, V/ j1 n) K5 z2 z' P- |) f) S
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- _1 e3 a1 v% _6 G: [6 J    *(esp-&gt;4+4)=='NTIC'
. f8 I) b; ~2 X  ~2 n* Z
( t( V* m' `6 \0 H; z-The most exotic ones (could be very slooooow :-(
8 [. D, l. o+ s+ Q- B   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
. N6 z3 q: H& e0 A     ;will break 3 times :-(
1 p' X9 a2 p6 b  ~' Q$ t" x& E' `3 {( {2 `  X' a
-or (a bit) faster:
! \' b" l9 u. }% O) {5 p; @   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
0 E* d: R+ ^3 b; S: z+ z/ U( \2 h# X+ _, Z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 v! c( ^/ D& d. a; T4 z" |
     ;will break 3 times :-(3 S: j& Z3 q0 Y4 \9 D: }+ S

- q, P+ Q* F% L7 ^. \-Much faster:
$ n* u' X- F; K5 y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' m5 U$ C4 [. ]% d- G3 x
$ T$ x( e0 }3 x
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen3 }  x' a, a% [3 m
function to do the same job:  p9 N; O& @0 k: C+ n

! J) Z7 k1 K+ y6 C9 q+ I   push    00                        ; OF_READ# U! m4 f) m3 L* ?" O
   mov     eax,[00656634]            ; '\\.\SICE',0+ e7 W" @3 [$ N! H$ n$ ~5 o
   push    eax
3 q3 ?9 b8 K7 j9 w9 t$ ^   call    KERNEL32!_lopen3 g# Y6 B) j/ k
   inc     eax9 \+ t" A; F) _7 u3 u1 ~# @- F) z
   jnz     00650589                  ; detected
/ n/ S' ]$ h% Z( R* C   push    00                        ; OF_READ
  W. P) L, q% B- ^$ I' ]   mov     eax,[00656638]            ; '\\.\SICE'7 v* a0 z1 k: H. l8 y8 n6 v5 m
   push    eax: J- K5 R! I: p: q
   call    KERNEL32!_lopen& F5 H. H  f* y1 G
   inc     eax" L5 {5 E8 I: h9 ]! K2 ?( m- y
   jz      006505ae                  ; not detected6 d" a/ p8 i  W& `1 i

2 N% J6 \  c) C, Y1 n3 n& g) Y
9 @6 e2 z' R; M' H8 W  O__________________________________________________________________________7 U8 p7 e* I# w. |

' ]: ]0 a# A9 S7 h* r+ `Method 12
9 e. z* _/ r: V3 h& W+ [=========
) e! P8 M8 k8 X
) n4 z7 c) r: P2 ?: o( lThis trick is similar to int41h/4fh Debugger installation check (code 05
' U9 P2 S# Q- y$ m&amp; 06) but very limited because it's only available for Win95/98 (not NT)* w9 z5 k# k# b) F; C" o
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( {' ~' q) \" a( V5 l/ @) ]9 ]2 F* T% h+ |, a0 h6 P0 ^+ l0 S
   push  0000004fh         ; function 4fh  A% _4 ~2 }7 A2 a$ q6 M
   push  002a002ah         ; high word specifies which VxD (VWIN32)
4 E+ q5 E; F! {  J                           ; low word specifies which service. v* _, T; t/ I$ u- k; U
                             (VWIN32_Int41Dispatch)
% v& c7 ~8 B  p  v0 j( z7 N+ G   call  Kernel32!ORD_001  ; VxdCall
5 E' q% L/ `, Z   cmp   ax, 0f386h        ; magic number returned by system debuggers" l& Q  Y4 @+ b+ S1 e: F# b+ J% M& U! s* Y
   jz    SoftICE_detected) h' K" l' L1 `' ?# i

9 l% N; P+ v# Q- UHere again, several ways to detect it:* I/ N. t' x/ n. Y
# _9 Q. n, B8 u" v: Y/ e0 n, O
    BPINT 41 if ax==4f, j% g! j* C" ]  Y3 D
( a. y' r1 @( d
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) j! I+ d- w1 @) f0 Y& A0 n

* h# |# a# d5 N. m: V    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
# l# c  f0 _8 ?- S6 I4 }# U
3 M- W" J9 [; f! F6 R5 ]( z. I& d, F9 f    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ q" V& e# r: o. D; m$ {0 C* G
* k) I0 }; v9 K2 M- ~9 R__________________________________________________________________________
6 E# @  i( o" D
6 A3 w+ @- C7 u( K' SMethod 13
+ n! W) [3 ^# Q5 \* v. U=========% _/ D9 J% r$ t  ]

: I  Z- \1 f" i& U7 M/ o: G' {Not a real method of detection, but a good way to know if SoftICE is/ _  J2 l/ h) W0 U
installed on a computer and to locate its installation directory.
6 p7 P/ F3 O- V* }4 H4 VIt is used by few softs which access the following registry keys (usually #2) :4 G' \2 d% V7 H5 i, X

9 C7 v1 o* F( T) j, g& F-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 }' h2 d7 v) ^  C9 C\Uninstall\SoftICE
5 x& h$ l' Q7 T-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. ?8 M" b( L1 o1 _' v- i! V
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! v0 J+ F/ W$ x. x& v0 M\App Paths\Loader32.Exe' W6 b! h" t* Q, G# C6 O
/ ~4 U4 R/ \" G( _+ J6 G* A

  p( g3 I: b! V  W# p3 QNote that some nasty apps could then erase all files from SoftICE directory
9 s) s, ^/ q# I6 K2 L(I faced that once :-(* ]$ h3 f# E! h( J& k

" O" n9 J: {8 V; hUseful breakpoint to detect it:
3 H/ E, y5 |4 O# x- V' R4 T% c2 @9 Q5 m9 f
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
2 I) F* g, r* b0 {
) w9 p) ?/ C: i7 ], x__________________________________________________________________________0 h9 e9 y  \- G: e9 ?
7 ]- x3 @. G3 Q  a5 ^8 \

4 z" k* ^  x6 o/ o/ AMethod 14 9 d+ O/ _+ S% M& B( v
=========3 I: [% E" [* M3 V* h  {
8 Q7 z+ P$ k- z8 v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, g. V4 C: B' ^6 xis to determines whether a debugger is running on your system (ring0 only).& ^+ X& n& X* o9 L$ W/ j+ G7 C! g

  j2 m  Q. ^; T   VMMCall Test_Debug_Installed3 l$ o, b0 d  w+ ^4 d! l, r
   je      not_installed# {# N7 J* [9 S; y1 `
/ ?7 h; V4 C- j0 {0 W
This service just checks a flag., Y7 U5 I9 F$ B6 n$ R- i& d
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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