About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; \7 T( o8 X: r& @2 ~
<TBODY>2 F+ o. p  b) M8 A# S: f
<TR>* }3 M& @( w! A+ c% I4 h7 U: i+ V
<TD><PRE>Method 01
  m& J; H9 Q1 O9 C7 n) f9 \3 b=========* I/ T0 f. N2 K( Y

: E# n+ j9 n. f4 ~6 B8 d' Q: C% gThis method of detection of SoftICE (as well as the following one) is" y' B! T0 T0 x
used by the majority of packers/encryptors found on Internet.
, o+ Q9 {$ J+ H; O6 z, fIt seeks the signature of BoundsChecker in SoftICE  o; k& t. f* p2 S! k3 x6 g
# I7 n9 c# ]  Q9 }) c, a! M
    mov     ebp, 04243484Bh        ; 'BCHK'
& V; _6 n! ?+ D6 l5 U    mov     ax, 04h
; r: O* p+ ?. S1 g) K; D& M    int     3      
) L, z/ ?: f' [    cmp     al,4) [# L( j" X  H8 b: D
    jnz     SoftICE_Detected7 }( f# r! f, ^2 @

5 |. `! f( |3 S4 w! `$ Y, F___________________________________________________________________________- h1 b* e& k% f- ^

: e, z* c) {! Z9 l; TMethod 02
$ t  Q' M; a4 t8 D7 ]=========3 |. f% L/ e6 v
. |  z7 h$ R" Q" U2 C+ a$ Y
Still a method very much used (perhaps the most frequent one).  It is used! p" Z( I: }8 x& g, Q
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 ], g7 X7 K! I$ Ior execute SoftICE commands...
5 j/ Z7 `5 I5 ~0 J  t# k# @It is also used to crash SoftICE and to force it to execute any commands7 k( x9 {$ r* U4 c3 f; }9 }
(HBOOT...) :-((  ( T' e* W' i, k& D/ r7 q9 z4 ]
. f; v9 z( y; _3 h. H6 R( H2 ]7 }
Here is a quick description:
9 p+ d: G" \. C3 [-AX = 0910h   (Display string in SIce windows): z2 ]8 j7 u' ]& f+ T6 q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx). v  M! r2 o6 W
-AX = 0912h   (Get breakpoint infos)
% y( u. V. O: O' g/ y3 P-AX = 0913h   (Set Sice breakpoints)
5 t+ r4 ~1 ]) r- o1 l2 _# x-AX = 0914h   (Remove SIce breakoints)
; [- w) _! W" A; u, B& _
; C9 I) r. _/ XEach time you'll meet this trick, you'll see:
: u: E$ c* d) F4 M% Q) g# a-SI = 4647h# E) [0 Y, j8 A% C6 d/ z" e. K* P
-DI = 4A4Dh! K/ `& [; t4 y
Which are the 'magic values' used by SoftIce.
2 `- b0 \- `* V- p. hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
7 b2 ^9 G2 u1 d5 Y6 ~: R( V
5 I" h) b) c# G, g4 mHere is one example from the file "Haspinst.exe" which is the dongle HASP
, z' l; p. O! z" K) hEnvelope utility use to protect DOS applications:- g+ F2 x4 D- g8 ^, @

* c6 c+ g2 }  s0 y# q
$ _1 k# w9 i9 q# Q9 {% J. q4C19:0095   MOV    AX,0911  ; execute command.
, S: I( j, f) C+ ]4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- V# ^& l! Q0 N# G, s( \4C19:009A   MOV    SI,4647  ; 1st magic value.' |2 @$ O5 ^& L& H
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
4 q$ Q4 b% e+ Y' h/ e: t' c+ N4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
  U$ S/ E4 X: H) B' v4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- U0 @' O% n7 M* z1 J. f3 R! |4C19:00A4   INC    CX
8 |' Z1 h0 Y; h" F1 |" _* O4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute  A4 b2 x- j: t* B* @; K; j6 _
4C19:00A8   JB     0095     ; 6 different commands.
3 j" @5 f& U9 O- Q4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 [/ m' {/ U& n' j9 @2 ~4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" H" |( [! b1 }. H
7 F8 ~, q; [0 C; S0 L3 D# m5 S
The program will execute 6 different SIce commands located at ds:dx, which
5 p8 U# o( v" qare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 M0 e& |+ i% S4 p5 T$ K. l
: O& O# j! `% f8 A4 |5 T' B; X* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& [% X( f( x: o  n___________________________________________________________________________( w( a8 C8 P; J$ i* A

4 P3 E$ ^5 P; V' b1 f5 N& K) O8 q/ ]3 f6 ~7 m- |2 U4 t5 e6 G& k0 K
Method 03
0 _5 W" m0 t/ U# H; Y( j7 p=========
, }1 q" L+ c1 f9 D- H! f+ ~' T
4 F4 G( l2 n% d! {Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
6 d) o1 A  \/ x) E& i) I1 \, E(API Get entry point)
9 f! ?: g% v  h        7 b7 ?4 p" X$ X" v8 w6 R4 W
( S5 p. k2 n, }. u
    xor     di,di1 {1 ~  ~0 l' n9 g1 A7 Q) u
    mov     es,di
* L7 o& k7 |. O  Z/ w6 @* ~, U    mov     ax, 1684h      
% ~  p! x8 @* j; N0 M+ i: E6 Z    mov     bx, 0202h       ; VxD ID of winice* `# v; Y1 c( V- J4 H% V
    int     2Fh; v7 T) X7 H. ?! e
    mov     ax, es          ; ES:DI -&gt; VxD API entry point' y8 H9 j( T; J% J
    add     ax, di$ o- Y# C3 p- d+ D& T$ q* E' N
    test    ax,ax
& J! \/ G9 S6 n2 F: n    jnz     SoftICE_Detected+ _# \: I* H2 w- _/ z3 m
* O4 u8 t3 y6 @% |
___________________________________________________________________________
1 y/ I, g3 Y: c8 u8 C$ E! l
! e* X$ K; d) z* G3 M" b5 WMethod 04
/ g, I5 y) `/ P1 E=========  ]1 h2 I( I: f0 M* R+ r

1 w, I- \3 V8 i0 |* k5 R+ NMethod identical to the preceding one except that it seeks the ID of SoftICE
8 r" `; i# z8 L+ p0 D2 j0 SGFX VxD.
8 @8 F& k$ O) P* G
, u+ m. Z5 _" i) X1 @2 V    xor     di,di
2 ?: C( F3 g0 d; R: M7 y+ D! G    mov     es,di' c  `- I# A) k/ B: D
    mov     ax, 1684h       ) A( j6 x  ~: E' |  l+ O9 P5 \
    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 {+ C8 |, l6 d0 e
    int     2fh
, O3 K( v* {* Y. m    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 l/ B' F7 v) U
    add     ax, di
- x. M+ M" h9 s+ [    test    ax,ax5 F9 Z* _; f1 @1 t8 w
    jnz     SoftICE_Detected
- v: n: I  L5 b* j6 U( B: ~5 E# P' m! n- D
__________________________________________________________________________
. V: l- q( X! G0 e. V. B9 f
3 r* J& c* l' K3 h" T: k' @# b3 Z+ C, [6 L  k8 w
Method 05
- b+ }1 j% l( y=========! `, V1 k! V3 x. X* X# R& _( y7 O$ b

$ P8 D' G' ^' C$ X6 _Method seeking the 'magic number' 0F386h returned (in ax) by all system  x. L& V6 z0 d5 l1 v0 h. l, r! p
debugger. It calls the int 41h, function 4Fh.
  {; o3 P9 V& S7 @1 y" B# tThere are several alternatives.  # X5 ?- {" [+ c0 E2 |: y1 L

' K: @1 P& @1 }! G! OThe following one is the simplest:
5 m0 }4 A7 d' Y$ c/ P$ N! ~- H; |% L% i' @8 H/ c
    mov     ax,4fh  O2 {7 d( B% F7 J. S
    int     41h
& F7 X* @( N  C, d' p    cmp     ax, 0F386
: d  c1 c! [( \' ^    jz      SoftICE_detected( j5 m6 A5 u9 O7 c

  K- o0 P. {4 ?. v: ]! h
7 F" s4 [" l3 `# k/ N# lNext method as well as the following one are 2 examples from Stone's " v! e) S6 ^9 W9 T* k0 a
"stn-wid.zip" (www.cracking.net):3 w4 _: u# z  V

+ \6 M/ y1 M' k' J) `    mov     bx, cs
  s+ Y# p9 k+ p9 i    lea     dx, int41handler27 q; z2 c; @$ k" t8 G( _' |
    xchg    dx, es:[41h*4]
& G. c# j; }& F2 q. M' P3 d3 U& d    xchg    bx, es:[41h*4+2]
3 r" E4 C6 e$ P1 u+ r' F$ i    mov     ax,4fh  j# Q$ ?# N8 h* f% }4 |6 A  I
    int     41h& A7 `7 S) B1 W  R) w/ L- n& G
    xchg    dx, es:[41h*4]3 f- S+ O* w: ^! t, U4 |; X! f8 |! ]
    xchg    bx, es:[41h*4+2]6 p8 j& G+ G! \& z6 D; Z  t# Y# _3 j/ t
    cmp     ax, 0f386h: |6 E+ z0 [. k; |. _
    jz      SoftICE_detected
6 _' x. O, _% |+ v+ |$ N3 B0 a2 F. M! Q5 ^
int41handler2 PROC, `3 k6 m( p0 z# z/ q
    iret4 F6 [; M2 n7 w0 R; B
int41handler2 ENDP: N1 h( J- j; A: Q% a0 i+ i' _9 L6 x
) W( N; _7 e. {: h5 x
7 g5 {1 k% a/ _) z9 z: K
_________________________________________________________________________
! x5 `& q* ]& L6 e" h) S9 L, w2 J. L4 V1 S/ ~( L

! J5 Y1 T: d/ fMethod 06
: Q( n0 L: v+ p3 F/ P) ]=========8 G/ b5 D/ r" I+ H) T
# C$ q; i' {" d/ `6 g

% ~1 g: @! B+ n! {2nd method similar to the preceding one but more difficult to detect:0 R9 o2 j* [2 i$ d  \5 w
3 m5 o7 c1 T1 A4 G, [+ W# m
  s) [- @! |# @' m0 _
int41handler PROC
$ S; ?8 J! z: N/ C    mov     cl,al+ T4 _8 s5 v1 q* p5 [2 ]+ C4 N
    iret0 J) P: d6 ^+ r9 b# d+ T+ \+ f
int41handler ENDP
2 o6 s0 G+ F0 o! Y- X3 F5 y3 A8 r+ P" _2 D! h

  P( o, R* S3 z8 t* j    xor     ax,ax! Q# o8 o% g0 a3 G# S; \- l1 `6 ^
    mov     es,ax# ?+ U$ F1 n+ _4 H
    mov     bx, cs
6 [+ z2 k5 S+ f. s# t# k    lea     dx, int41handler
& ?8 r  y' ]& Q! h4 X9 o" o    xchg    dx, es:[41h*4]
( O* u' ^- |/ J: X    xchg    bx, es:[41h*4+2]
; H  I* f; E- f& a    in      al, 40h
' L& `$ I2 N$ v: m    xor     cx,cx4 C, d# Z0 y) `
    int     41h
3 m3 F! Y7 F2 N) R& {    xchg    dx, es:[41h*4]7 j8 S# x; {5 {# }; p: f& |" f
    xchg    bx, es:[41h*4+2]
+ z+ b) N  c: n0 d& O% K+ M    cmp     cl,al
/ r! c4 R0 ?' t6 a! `, s" z% E/ H    jnz     SoftICE_detected+ l4 e* B+ y; @6 }

/ H3 K, R5 j) H5 `/ j3 u  V_________________________________________________________________________1 Q) A9 ^# q8 \6 y% Z. o* X$ c6 x
3 P. E: ~& C. z& l- E6 i0 Q
Method 07
! u& g9 \' J7 w4 s0 ^* N=========$ b8 ~) w/ v& L6 P% B( v- l
# L  @7 x- K/ b' d7 U5 D
Method of detection of the WinICE handler in the int68h (V86)" D4 c- }+ r$ @9 B  c( P, j
# ^+ r# B# o, G/ q$ k. d% c
    mov     ah,43h7 U8 `" M' n0 J# p" c; Z# u
    int     68h, E4 {1 p" f) h/ J
    cmp     ax,0F386h/ s- |) [$ b, b* x# w/ k& M
    jz      SoftICE_Detected
' J$ p# b  G3 N& H
! c; r. z4 m" r: ?- P
, \6 M% V/ P# C=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: o, z# y, d2 I7 V; f: a   app like this:
: n) z0 l5 g2 Z% z2 }' s  t+ ~
4 Y+ f- G1 r/ O   BPX exec_int if ax==68) c. B. `8 A$ l# X1 a% m
   (function called is located at byte ptr [ebp+1Dh] and client eip is
4 ]. l/ G! M& H- N. W% c   located at [ebp+48h] for 32Bit apps)" U: m. g5 {$ s$ }+ q- [: ]
__________________________________________________________________________8 x* z$ g  y: D3 w, M+ ^9 i: O2 L

0 l" U0 U7 \- E$ E$ R+ j! p! f
8 B" s9 u: z0 |1 ^: HMethod 08' ^$ M/ G- Z* {  O( K4 z5 b" ]# r
=========8 M( _0 d* t3 Z6 k3 @1 z& y! c/ P2 d* r

9 C& H% A5 m0 |4 k; `; uIt is not a method of detection of SoftICE but a possibility to crash the
/ P6 X! L1 [+ Hsystem by intercepting int 01h and int 03h and redirecting them to another* F6 G- s( R9 l+ Q& d$ w, q" r
routine.9 A: H0 k9 ^7 _. e' O9 m, h
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 l/ r/ b, F4 N! B+ gto the new routine to execute (hangs computer...)9 a; j. X6 _' t5 H. s/ E/ Q
  O7 J* J* e5 V! `) `* [" B
    mov     ah, 25h6 i2 v! H8 S& P2 L1 G& W, U
    mov     al, Int_Number (01h or 03h)
' n+ q# X6 T0 ]% c8 F    mov     dx, offset New_Int_Routine
; f( b; y+ x/ e( U6 ]    int     21h
2 r3 _* a! [! G% b1 e: a: Q
7 _; ]$ D- v) X" z2 ]__________________________________________________________________________! l5 X& W0 N4 }3 y$ j, v+ g
, E5 |: W$ p; ~+ g8 U5 W$ ]
Method 09& |' x; `' J. Z8 y5 X; S
=========
' F( S4 X) J. k8 u) X3 Q, Q- K4 Z9 C8 b- J& g7 J# x3 ~# n
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 V4 T+ A8 T( @+ V% f' h
performed in ring0 (VxD or a ring3 app using the VxdCall).
2 {8 `' Q0 Y5 m7 ~. dThe Get_DDB service is used to determine whether or not a VxD is installed
0 t, y$ s" v& q6 P& Qfor the specified device and returns a Device Description Block (in ecx) for
( @$ _- d- [3 W* R) @that device if it is installed.& S2 k3 \$ x. L! w9 `! t/ }6 \

2 v5 M  J3 J/ o( s   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
+ H. G* I" E. Y. C   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" N4 z6 B9 z9 m8 F   VMMCall Get_DDB5 v  j; ~8 s$ s; H9 ?6 ~. d; H7 z
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; q! B, a8 E8 J7 b/ j4 f
" V4 `( T( n6 uNote as well that you can easily detect this method with SoftICE:8 A0 |/ Y' `" i0 X
   bpx Get_DDB if ax==0202 || ax==7a5fh- F) E2 y3 h+ Y/ a, Y/ Z0 T6 |! r

! B$ f/ M; b! I, x! ^0 z. q__________________________________________________________________________
) g+ a) n5 K$ y2 j1 e3 M0 H' f$ _/ |% j# x" [
Method 10
5 N$ K8 z( {$ u, [7 F) {/ ^=========) B* f9 g5 o( y  c

0 ~5 ~+ {' G! L3 d" E=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 \4 q' l# y; ]4 b/ R  SoftICE while the option is enable!!
4 |5 g* f; H5 K' K% {- D9 e# |) p* `. p9 _
This trick is very efficient:
6 A: t" d! Q+ b* U# Sby checking the Debug Registers, you can detect if SoftICE is loaded2 p$ w+ [0 {; Q9 u: N- W
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if* Q6 H! G1 |- k+ f
there are some memory breakpoints set (dr0 to dr3) simply by reading their- `* x% V3 D& |: o$ H1 p' @# U2 b
value (in ring0 only). Values can be manipulated and or changed as well8 _2 e6 k2 A" L, f
(clearing BPMs for instance)
: z7 t3 K* I: k- ?! F9 ^- S
8 J; M7 |4 M$ Q5 t0 B# M__________________________________________________________________________
' u$ G( @0 e2 w* y8 g! r/ Q. _3 b: ]
% O% t3 v& [/ i/ pMethod 11. u1 n  P5 b' j0 [
=========* J1 C4 S; e0 }2 S$ m( O  O

1 s3 T( _9 S# dThis method is most known as 'MeltICE' because it has been freely distributed$ E! U8 Z: U/ a
via www.winfiles.com. However it was first used by NuMega people to allow- I5 }* j5 D1 Q" [1 y
Symbol Loader to check if SoftICE was active or not (the code is located, @+ Y+ z1 Q# N! W! O# T5 N4 }/ ^
inside nmtrans.dll)., q4 p: v5 ?; u! I2 Y
) L+ x% R; F2 w% P
The way it works is very simple:- ]. m5 d, Y% X  V) |9 p+ F& H
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- M: H# Z: [# {) ]$ QWinNT) with the CreateFileA API.' |5 o0 X# o) W

3 U; q" M- u0 G5 H5 EHere is a sample (checking for 'SICE'):7 R) m" }( \5 L& g+ b* M

: ?+ G, B. Z2 A$ ]& LBOOL IsSoftIce95Loaded(). g* B& X5 k" J% L% P- r
{8 R4 t+ L: B/ v! @/ g2 }% H
   HANDLE hFile;  
# I/ z0 F; c8 L, I2 n) N, _   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,( F; M% K! _' m  I3 c2 u( Q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 F: z$ q9 P& b( M
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! g. w2 h, S/ s/ w& R   if( hFile != INVALID_HANDLE_VALUE )
( P) W% f* d9 P& M+ f   {6 I+ `3 D( m! I: n
      CloseHandle(hFile);
. A* \% U: A- y% E      return TRUE;+ d0 Q" ]2 @* c! o* W8 {' U! T7 ]3 B8 l
   }
4 H6 D/ S4 s9 \$ y   return FALSE;1 |* v) H7 X) E
}
8 {9 O1 w1 e( h* j3 [9 t: W. r
' C  l# M. E! t/ dAlthough this trick calls the CreateFileA function, don't even expect to be# n0 v$ H) ]) E
able to intercept it by installing a IFS hook: it will not work, no way!
& \! U* ]  G3 |. B) @In fact, after the call to CreateFileA it will get through VWIN32 0x001F8 i8 C  O+ F# y6 {0 i& |+ x
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* y1 w8 E- T3 d' ^& S
and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 n* d* W8 n: z
field.3 u5 d* H. |# p$ N; t9 k8 H: q7 t
In fact, its purpose is not to load/unload VxDs but only to send a 8 I% W6 L. M3 `+ A
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
/ e: z  O& G8 V- a7 z7 hto the VxD Control_Dispatch proc (how the hell a shareware soft could try
" {# |* K. g1 Rto load/unload a non-dynamically loadable driver such as SoftICE ;-).4 R8 D& j4 r- K4 Z1 {
If the VxD is loaded, it will always clear eax and the Carry flag to allow
( a7 b1 d$ D: }: Tits handle to be opened and then, will be detected.
: w- a$ `" t$ Q  nYou can check that simply by hooking Winice.exe control proc entry point
& u! k* |9 Y. ~" owhile running MeltICE.
: d+ y- d0 P) b* \+ h# H: ^8 K6 ~+ S: {! e2 Q6 @* ~- J. l  ~
1 j( p/ F  e2 v! p8 G, I
  00401067:  push      00402025    ; \\.\SICE
+ b% g- b3 ^9 P6 Q  0040106C:  call      CreateFileA
4 ?4 J5 j) C! y5 O9 F- L  00401071:  cmp       eax,-001+ x2 m3 ?) \8 Y8 d+ C' e) c2 e, W$ |
  00401074:  je        00401091
5 H- z/ {! Y6 z/ A: x- D: c( c0 `! e: j
( K  ?& y8 d. w2 }+ b, o
There could be hundreds of BPX you could use to detect this trick.
0 _1 Y& [1 y7 o% c' b; d4 I- p-The most classical one is:9 w/ d0 h! K( j$ S. ~" u
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 }5 n/ `/ w% F* z  |* B    *(esp-&gt;4+4)=='NTIC'7 w& ~& c- l+ ^7 ]
" n8 K' g. k! o/ v
-The most exotic ones (could be very slooooow :-(- P) H4 n% E1 H6 n. ]' l
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  9 a& N+ f5 w- O# G7 A
     ;will break 3 times :-(- W$ A; c0 Y& h
, |& s9 o( K0 k, z9 r$ S
-or (a bit) faster:
$ {. ^5 [5 m* l1 M   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- M0 _1 p: L* h7 j3 _7 \" ]
% q5 h5 o4 }9 \5 O. q4 y
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 z3 w- ^; L0 u& w/ k+ j' ~     ;will break 3 times :-(
3 D, C# T0 E5 \( Y: i+ p
6 X% Z% e% b  j+ R3 f. m3 {-Much faster:
. `) R' Z; r! b7 M) v  e   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'! Z/ j: W  m* ^' Q; U

+ w9 A6 Q% r4 yNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 y# t7 e7 L8 Kfunction to do the same job:
1 L7 x! l+ Q, U4 U- X
+ }% A" m$ |4 [' m0 S4 R   push    00                        ; OF_READ
# [% b. Z/ C9 f8 q2 c) ^+ F7 c   mov     eax,[00656634]            ; '\\.\SICE',0
* ]' T) I5 A6 ^) c* }# }7 p% T2 p, W   push    eax- i0 z; y. k1 O" X4 }* H; ]& l
   call    KERNEL32!_lopen
0 {& z" p1 M- X# [" }( a& n2 t1 d8 E   inc     eax
+ n! {% ~& m4 X# o/ w* a' V   jnz     00650589                  ; detected
' \, `; v4 d" ^   push    00                        ; OF_READ
: l1 P( k% c3 l# m6 ~1 e% a+ q" t   mov     eax,[00656638]            ; '\\.\SICE'. Y, M4 P) l! `9 H; {& {; R! D
   push    eax
2 _3 N- P; s) k% L% ~5 P6 ]   call    KERNEL32!_lopen
# J/ B" C1 D8 C( w; B" j6 ~2 ^   inc     eax
7 h* T7 i+ P% c  m! z) l   jz      006505ae                  ; not detected! {& `  R$ \1 h8 @5 n/ K- `! \+ }

& Y. j: L' }% }$ Q$ J5 K' [6 ]2 S( i. H0 p9 [* `
__________________________________________________________________________! N5 N8 v7 J3 ~2 @; I1 d$ w+ W

% t$ y) s/ i+ t5 w+ vMethod 12; V/ ?# `0 z4 R( G/ B
=========
6 i) X5 {' p: k) b, O: t' [
% [" J0 b/ r7 `0 m- t# DThis trick is similar to int41h/4fh Debugger installation check (code 05
8 X5 ^! L$ X) J# n- J1 R1 O. u&amp; 06) but very limited because it's only available for Win95/98 (not NT)
0 o9 f& S$ r. f' a# _/ t! l" D8 ?as it uses the VxDCall backdoor. This detection was found in Bleem Demo.6 Q, u8 F5 \, ]/ {. Z/ O9 {

, ]4 _& w/ J" M& v! p   push  0000004fh         ; function 4fh4 b3 _/ k$ R# d$ w: L7 ^
   push  002a002ah         ; high word specifies which VxD (VWIN32)
- j4 q9 U; q, B6 h! c. G                           ; low word specifies which service" @; t6 |2 G- p: Q. B( R5 ?) L
                             (VWIN32_Int41Dispatch)
3 V5 y4 O! m! Q4 Z% w   call  Kernel32!ORD_001  ; VxdCall
; s4 P( i) h9 Z7 A   cmp   ax, 0f386h        ; magic number returned by system debuggers
: y' [& V( l9 U- J# u1 v1 _   jz    SoftICE_detected; }3 B) H4 z6 F# p' j9 S0 C! c2 K
3 }4 ^1 b/ `9 J
Here again, several ways to detect it:
$ A) N& u; [$ B, r4 ~7 e& _. V
' K$ q- _# x) H0 d    BPINT 41 if ax==4f
0 `  R: s# x7 c. D# g7 s0 J9 b: T( F% q, Z8 X4 _# b/ G
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one4 H1 u5 y  }: p3 z  C) l

% y( W8 z( m' L    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; N2 O) Y0 I# n/ a/ ^' F; ]
4 }; y! {* G6 L% }
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' V" x6 G4 L* T, v$ X- |! a

3 L- g( {% z' X9 n) H: t4 ?__________________________________________________________________________( G( h7 Q; d" P3 G$ s: X% K1 g

- F8 P$ Z  Y9 V, ^  bMethod 13
1 M6 A! u' I+ D4 @2 _* M=========
. }7 V, Y' [; S7 ~+ X5 ^/ M8 [$ I1 z/ U3 ?! j0 t
Not a real method of detection, but a good way to know if SoftICE is5 L8 _1 E/ ?4 y
installed on a computer and to locate its installation directory.
' P4 B+ M* n; Z4 _. p( ^2 X0 H- }It is used by few softs which access the following registry keys (usually #2) :
6 Q/ G" R# w8 X6 i* n. j1 I
) y9 [' c- o$ R" a-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* \$ U7 v6 k( Z4 \5 V\Uninstall\SoftICE
# X1 h+ f2 e) l9 v! m" O-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& f: \3 |6 V( V1 T5 A! C-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% K6 V+ p& t1 ]1 m9 x6 Q\App Paths\Loader32.Exe
  }) D3 m9 v0 z9 F1 c6 v- {, o$ Z3 _( G, I6 ~; v& `" E

  K: u, j  z: z, xNote that some nasty apps could then erase all files from SoftICE directory- @5 [6 N8 R2 T8 D. D- z9 E
(I faced that once :-(
# S' T7 d4 w( W( M4 e. @* @0 B; ]; ?/ A( M) ?
Useful breakpoint to detect it:
+ Q3 r5 L' b0 l3 H9 F3 _, T) i6 J3 {/ s( b7 i% u! ~, w' S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
$ B! j) l- a7 R7 Q5 |
$ U2 a' V" K, j5 z+ ]4 W__________________________________________________________________________
3 x0 K) r5 K4 f6 W
, g: y# u/ G: v. w) F; z* Y- T- O  W! K) ~2 d' i
Method 14 $ c# q) {8 j; \* Z4 d7 X
=========/ F( [7 v. Q! s) k( y2 w

+ y6 r# V2 D! J4 w$ B  {A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 T7 Y) Q( {; R" q2 [& [is to determines whether a debugger is running on your system (ring0 only).
( q5 Q, U5 N& `5 U7 ?
) i* ]' _& D! c# z; x' D   VMMCall Test_Debug_Installed
+ Y8 C3 j" J. X  x2 T   je      not_installed
5 X6 l/ v2 C  V9 {5 X! z3 B# M$ O
; B* M. x) T$ w; X$ U1 h) C3 DThis service just checks a flag.
. c. w* ^) N7 s- d$ }! |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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