About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 @) I# w/ v2 @  }0 e' m% X7 z$ t
<TBODY>
' y% u! ^" W3 f* w9 v; L<TR>1 b8 g% y6 Z0 k8 L8 V" |5 ]' d
<TD><PRE>Method 01 1 r# m) `0 }! x/ |& ^, z! ~1 D
=========: N' H/ M. I. C* k* Q" ~& q

2 D- W# F+ O( c9 V# Z2 kThis method of detection of SoftICE (as well as the following one) is! a) F# r- I/ D9 S
used by the majority of packers/encryptors found on Internet.
5 f% O4 a6 e1 X* x3 u, y  ]It seeks the signature of BoundsChecker in SoftICE
3 E8 o$ q/ a6 c# J3 z: l. G" R8 _& a
& U# b1 j; [$ G( R5 D; v    mov     ebp, 04243484Bh        ; 'BCHK'3 \; E( p% v9 L' T
    mov     ax, 04h1 u( `( I6 v% ?1 [) O! R
    int     3       ; }5 S" }4 i3 k) |. x2 S' ?
    cmp     al,4
1 o% `. P' T! U# F    jnz     SoftICE_Detected& D* e2 v; ?: a$ e' J# I4 Z3 B

5 E! ^! y, F3 Y% O9 Q' q___________________________________________________________________________4 T. L7 P+ T9 R
) K; _; X0 W+ K- F+ ?3 j
Method 024 a# j  `, I* I5 `1 H1 }
=========
4 u+ `- `  V; A: p( {- j  k* K4 v8 P" O
Still a method very much used (perhaps the most frequent one).  It is used
& J: ?/ z5 z, b) u' L, R7 Z' ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,& Y& d* M) i0 w
or execute SoftICE commands...
# q9 z' X- o7 ^) T, ?% `% B6 FIt is also used to crash SoftICE and to force it to execute any commands
. M. E3 j" o# l" F, f2 M3 x(HBOOT...) :-((  0 a1 a! L. V$ l
$ g% ?9 w- H2 p
Here is a quick description:
8 X0 G: }, g1 v-AX = 0910h   (Display string in SIce windows)2 c+ r" N7 H0 P, H/ K6 F5 u
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 @/ F& Y# x' m( ~7 O-AX = 0912h   (Get breakpoint infos)- l7 d/ p2 a+ F1 U+ G* ^" l% s
-AX = 0913h   (Set Sice breakpoints)
& k3 E. g) ^7 Z) l0 w3 ^1 V( E-AX = 0914h   (Remove SIce breakoints)
8 X: A. i  a  C- b1 }! U3 b
/ s' I" W) `8 T7 i" [5 l9 ]Each time you'll meet this trick, you'll see:
4 E9 |2 Y' v( Y* E' q$ d! Z-SI = 4647h/ C' Z( ?* c$ p* f# l3 j2 P
-DI = 4A4Dh  M. v: U9 M# ~" G5 y/ _- i
Which are the 'magic values' used by SoftIce.
0 h9 `* W1 J! v5 H' P6 p8 G6 VFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
2 X4 P7 v0 K8 c
6 z; N5 M, G( x% M& ^Here is one example from the file "Haspinst.exe" which is the dongle HASP
/ e# c6 j% v. a+ ?' w9 _) H/ V/ iEnvelope utility use to protect DOS applications:$ ?) Z' [, E3 z( I( S4 u0 X
2 p5 C6 |1 z; E  r

7 q* q) `5 D! b/ h4C19:0095   MOV    AX,0911  ; execute command.& n/ y$ D* u: y, ?* x9 ?+ R) Q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).& P, d6 K( f8 @: d6 O, P) ^) {) G
4C19:009A   MOV    SI,4647  ; 1st magic value.
4 ]0 c/ l* h& I* Q- [: t8 A4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
* Z9 S" o" `! x, g4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# l: E# v1 J% R
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# M' P: J9 f, h4C19:00A4   INC    CX
9 P* t0 U! V& z4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
* W( x3 Q4 Y, z4 k. a  |9 ?4C19:00A8   JB     0095     ; 6 different commands.
9 F9 Y& H; R2 m+ c4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- J5 K" c; ]$ ^2 ~
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
4 Y2 N- H6 A% _  o" Z' \
3 h1 i+ C; @$ c3 JThe program will execute 6 different SIce commands located at ds:dx, which! m3 ~: M& o' f. Q5 b
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- u3 k  ~9 w' P3 V' U  W

& R. x* k: Z. ^/ a4 b* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
9 B6 R/ \6 }4 N___________________________________________________________________________. r% B! p* U6 I* ?( [9 V) p, ^
4 O( G) n3 u7 u6 |6 a) x; F" F, }
8 s* e- Q" u2 e  i7 }
Method 03
; \0 R( c& m$ G# e) R. s=========
3 d5 ?) G, T! b$ @3 }" s% p, C. ~3 j& t0 O7 n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, [1 o* M' `* x2 d(API Get entry point)
2 W3 I, X" N8 v, y) V3 l8 D        1 X; j' h& _3 r( E$ \
) B# m! X' g/ H" K* h8 ~/ }
    xor     di,di
# W: z, z& Y$ |+ x- m    mov     es,di
) Q2 G" S5 k' D6 x& T    mov     ax, 1684h       ' A5 g  O* V$ v7 U
    mov     bx, 0202h       ; VxD ID of winice$ T9 |" h2 T* v% s6 y5 B) b( ?
    int     2Fh" Z7 t0 c3 @' h- [! p2 N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 [; W- N0 Y" g) F2 e    add     ax, di8 t7 v: F9 ~. S. V+ J/ d6 S% M
    test    ax,ax
. ^+ c& `# L6 d" [$ y: n    jnz     SoftICE_Detected
; `5 w5 p1 t9 e3 e/ F- \( L! {1 M6 `
7 s6 B! v8 Y( G6 G___________________________________________________________________________9 |4 t+ O) q2 \# v+ c

; c4 E1 N( }/ IMethod 04
! g6 `- C6 O9 g: i  A/ p=========
6 C) V3 r- L" D. z1 a( }9 Z! I* A/ [
Method identical to the preceding one except that it seeks the ID of SoftICE. U$ C9 c4 n9 H5 B, E
GFX VxD.% k: C3 @& c5 `5 a0 t9 [7 x
* K8 G# b5 Z5 {) V7 u
    xor     di,di
, x9 S: h  C4 K0 x$ p+ A    mov     es,di
7 A, e# K3 v) G. Q9 _    mov     ax, 1684h      
: h3 B3 u; N" k' A' |! q4 d: v& S: L    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 f# W# E1 V- S
    int     2fh; P4 ?- z6 M' v; y' s
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' R2 ]- t' k- m# z; i0 i    add     ax, di
" R' Y& C% P0 k- G$ b6 q    test    ax,ax) I1 s. C5 J" n
    jnz     SoftICE_Detected
. N7 g7 ~! O  M6 u
8 ?& g, C3 E1 `* t__________________________________________________________________________! N+ z0 E+ q8 w, F6 U

" j2 j7 g( L3 L1 j% L! u
: U$ \1 c8 H( ?  G) v. |2 x! ?Method 05+ ~4 S1 r. c0 H* ~
=========
' z/ S' h8 A2 \9 {. P5 y! b2 t6 ]& {- z
Method seeking the 'magic number' 0F386h returned (in ax) by all system1 _- |3 E7 g) j
debugger. It calls the int 41h, function 4Fh.; Y1 W* w4 R* n7 k; M! e* j
There are several alternatives.  . W  b- b4 w: R

( V) j2 g2 D7 Q! S* v+ p& _: [; _The following one is the simplest:6 J9 c( \: X, W
7 \3 a" K- U  T% X( V9 G
    mov     ax,4fh" m' j, H) S& q) a
    int     41h
* }; J5 P5 {9 {; H( u8 u0 s    cmp     ax, 0F386
  {( ?. z! n# P* P8 r* V    jz      SoftICE_detected3 H# Z* a5 m% y' f4 \

, p* j4 R2 ?3 @6 `5 L
. N' l# E% Q6 c$ K6 }& bNext method as well as the following one are 2 examples from Stone's
5 P/ D) D, ]3 F2 e. N"stn-wid.zip" (www.cracking.net):
+ r- J6 l' }; |1 F" G8 k# S5 r; M6 n- c+ v& K3 h* a  h
    mov     bx, cs
0 p3 X' J% R' @    lea     dx, int41handler2
5 [* J( b0 N8 C5 I1 A    xchg    dx, es:[41h*4]
1 e! `! m  [  W" y    xchg    bx, es:[41h*4+2]
9 |# w  ]% w( Z1 |8 n    mov     ax,4fh8 O+ _, Z. g' h- @5 x  h' i" B
    int     41h
3 C( {" I3 ~$ }4 C. f* y' l1 n0 G    xchg    dx, es:[41h*4]* D  `! \7 Y3 J9 B# e- a9 ]% O
    xchg    bx, es:[41h*4+2]* S" @' [' b2 r; a# n
    cmp     ax, 0f386h
, C# ^$ v* D. Y) f    jz      SoftICE_detected
4 Z; Z/ C% Q5 ^" G$ F# c# M+ F4 m# m0 \, @
int41handler2 PROC
) e6 i/ a5 Q/ W% |# Q0 ]    iret/ R, R- j& _2 J' N
int41handler2 ENDP
* l. P0 |: m. R8 E) b8 y( H9 F* ^, g# f8 ^

- H( o8 E8 ^( s+ ?_________________________________________________________________________$ I1 B% \8 _+ k2 Q2 h) e
+ s5 ~: `. ?& V1 |! O+ U+ w+ y; O
6 M/ D- j2 z# N( h% D+ d7 q
Method 06. O4 V9 w# M( A6 O' j
=========( \/ `" G3 w0 `2 I; D- a

6 @" ]) Y( C7 e
- e0 X' k2 L" |4 C2nd method similar to the preceding one but more difficult to detect:
/ i. i, P2 e7 d1 G( i* @4 g6 u/ \9 C6 [* D' y! i" b

+ ^. I2 v2 L1 j. ^; s$ M5 E+ c6 Nint41handler PROC' ?8 F& a7 g: R7 Y6 W( O1 d
    mov     cl,al
( R) Y7 K- [; o, C9 @$ S    iret
( [+ L2 b! W7 m& e( j" P3 eint41handler ENDP' p* T. @6 B; H

( ?/ E6 I( k# U/ j( H4 Z
" j+ u" P) ^9 N* {    xor     ax,ax; |7 U2 Z& v" z9 w# q" P: X& ^
    mov     es,ax
2 T, s0 V8 p$ I3 n; M* q! V    mov     bx, cs4 m( I+ U6 K% n& o: @
    lea     dx, int41handler
0 ?+ l8 _" ?) \$ n( P    xchg    dx, es:[41h*4]8 ^4 a* t2 U4 f  P
    xchg    bx, es:[41h*4+2]
' I4 n7 l8 a, _8 ~" x! j) A    in      al, 40h
, ^# M# U: s4 j    xor     cx,cx
, V4 M2 P' k0 U- |! o    int     41h  V2 A  S$ z* P3 K& B5 V
    xchg    dx, es:[41h*4]: U# q" ?6 k2 N# h
    xchg    bx, es:[41h*4+2]
1 T, N1 K/ k2 h) [    cmp     cl,al" F" V; ]+ r; q! [* z- \- g
    jnz     SoftICE_detected
2 t, ^$ D6 k& G* }7 ~3 A! ?8 W3 N4 Y* I, o% d
_________________________________________________________________________. X) S5 j0 U$ c4 `7 C; ^

* d3 T0 y! ]8 h' ~Method 07
% O/ e( Y' F3 [) V=========
+ r9 K8 _% |: H
) x4 b$ g4 n2 @/ l& s% wMethod of detection of the WinICE handler in the int68h (V86)
  G& ^) v/ q  M
# U( g" U/ y( _8 T    mov     ah,43h6 x, n; U; x" j9 k, [
    int     68h8 d6 [5 H& U$ H* D
    cmp     ax,0F386h
" x7 S" E. C' X7 a$ |$ f    jz      SoftICE_Detected
3 k/ j! j( z* N5 c% `) w" ^+ C  d! d( m* ^

; p* T4 Y) X# k9 s% n) s=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
+ }" O6 Q7 v0 w0 D* p   app like this:" ^  J# ~; n* O( }, b2 w+ g( a) I
/ g. G% q- |, p+ {- \$ @
   BPX exec_int if ax==681 R. b/ X4 S# E
   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 k( ~# b- w9 u: @2 D3 p$ g   located at [ebp+48h] for 32Bit apps)
4 W% H- y$ n3 W6 {  ~) T__________________________________________________________________________
" j4 L& M; v* h
$ a0 f/ x1 Z* J  K4 B6 [' J& m5 z7 D. x+ k$ O5 R
Method 08
9 O& n% I( m$ N: K=========
8 n! v$ `2 l3 y' I# o9 ?2 H
0 P$ O2 r  L. w: ]) _  |9 \It is not a method of detection of SoftICE but a possibility to crash the
& T. E% H% I. Y$ ^system by intercepting int 01h and int 03h and redirecting them to another, c4 z8 `/ j- W% i3 K
routine.7 m8 C1 y, {& T; S
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: u" E: V! D* L  K3 Gto the new routine to execute (hangs computer...)
3 L; T8 e1 q: R
5 `8 x& ?. A5 F5 K# ?* d    mov     ah, 25h$ B% h# i% @0 e0 Q
    mov     al, Int_Number (01h or 03h)
- a5 T" |5 i2 P1 n    mov     dx, offset New_Int_Routine, h- n3 X9 b! G
    int     21h
# y- q8 D# p$ o6 ?6 D1 _
# Q4 S% M- W+ ~- k( k__________________________________________________________________________1 C, C1 _9 K4 l% J0 Z* U
1 s0 v) i, u) b9 F' H
Method 09
; \$ ~. \: }  P1 A=========- P7 h/ r# M$ U5 {

. M% ?( |/ z, S$ hThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% }* L0 L% a% t; h7 q& a, A: K
performed in ring0 (VxD or a ring3 app using the VxdCall).2 s2 v5 |9 k" g" D
The Get_DDB service is used to determine whether or not a VxD is installed
' n6 |9 R! e0 I! V( ofor the specified device and returns a Device Description Block (in ecx) for9 X! t+ r* D$ p' v
that device if it is installed.5 y) a; l0 Y# g6 v: U4 h
% E( J) f- E) L4 P* \$ z: }
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ e6 T! \. Z' D( q' U/ T7 e# W   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ E3 E& r8 @" A4 U
   VMMCall Get_DDB3 C( [1 R  r9 t4 O  R8 [4 k  b
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. y3 }! W2 R, ]  S  O  l, @0 R; X

  h. u. ^. F% a' d0 X  ^6 p6 rNote as well that you can easily detect this method with SoftICE:
- x/ d; R6 |" V$ C# Z   bpx Get_DDB if ax==0202 || ax==7a5fh) E# b/ G; j- W, R
3 j( ]5 i- h* `! o: }
__________________________________________________________________________
  E* G5 V, P6 [3 |& P# K3 ^/ R7 D1 N" C, I
Method 10' B/ E# m) M" b& i. v
=========+ u* Z! y% t$ w7 c5 ?2 j5 Z2 S
. q; Z/ A& N; G+ V  \0 L) w0 y- }( O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ k( |. Z; @" }! {) g" R  SoftICE while the option is enable!!0 j/ `# `7 D2 r* m
/ @7 X& i1 J1 B; P& s
This trick is very efficient:
0 i* b4 m& i  k" J: N3 [by checking the Debug Registers, you can detect if SoftICE is loaded
% T2 N1 Y; l! J! C7 I+ u(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if% F( W4 B6 t& t2 q% z5 \
there are some memory breakpoints set (dr0 to dr3) simply by reading their
& u. V: V" }  [* Z7 Uvalue (in ring0 only). Values can be manipulated and or changed as well5 a7 O+ O7 ^+ @$ T' z
(clearing BPMs for instance); c. v7 P" u. C, E; i2 K9 a+ B
- O, k6 @" r4 [% {
__________________________________________________________________________
1 I7 m7 l/ X6 C' v1 r" w. W/ }( m! Q9 \
Method 11; k  U) T0 N: _: |2 M. B- F5 ]4 L4 [
=========2 c, y- X& V% W$ C

9 q. C  k) E7 EThis method is most known as 'MeltICE' because it has been freely distributed
  w6 B7 U7 {  ~  M4 |3 S" f. @via www.winfiles.com. However it was first used by NuMega people to allow8 m  k& `: g+ q! G! k3 z
Symbol Loader to check if SoftICE was active or not (the code is located
  k+ }( W% e. Kinside nmtrans.dll).
+ y' R. W8 X; ^% z+ ^# q% r+ h% r
/ {. A, C; Q2 }) J: v1 ]4 OThe way it works is very simple:" v# d  W4 k4 ]# S: C: y' A
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( C% P, b9 ^/ C' a  X* T- FWinNT) with the CreateFileA API.) }# O/ `! M. l/ {! E" ]
* }8 M5 u/ N+ T9 @- o7 k
Here is a sample (checking for 'SICE'):9 q3 L  O: \4 l: s( G

5 t2 w, T! J* Y4 H6 b7 K3 YBOOL IsSoftIce95Loaded()6 c1 \  ?+ L+ i
{
6 `, M. u) |: q" M" Q; F0 u3 W   HANDLE hFile;  + }1 C1 Z! d, r5 r% ~
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* X$ @6 [7 {7 f6 e. U& A
                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 C7 _5 l( H+ g/ s0 F! V+ h
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, Q" X$ p+ Y1 {- s; x9 J
   if( hFile != INVALID_HANDLE_VALUE )
4 Z" x* T) ~; `, R& X4 |: F   {
2 u. L$ w9 [, ^      CloseHandle(hFile);
0 t: B8 z, t! K7 S5 a      return TRUE;
5 B# P5 [  n6 [& f5 U, @   }$ F+ ^, l: `. n3 |6 H0 X, ~, J$ y) K
   return FALSE;- c5 H! r4 y- k6 Y* Z- [
}# ^: U+ t( R! G( o! f, }
! ]+ T0 d4 I- I: {
Although this trick calls the CreateFileA function, don't even expect to be
" Z: K. c+ s6 `) K( t7 L2 vable to intercept it by installing a IFS hook: it will not work, no way!! `* d0 V# g& O5 d, t
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
: m& v5 L& T- F. ?service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)$ `1 O+ l5 S) w0 ^$ i1 ~$ }
and then browse the DDB list until it find the VxD and its DDB_Control_Proc  `7 I  R& A; O% p
field.
- J2 K' x# w& H/ [$ ?+ q% d* WIn fact, its purpose is not to load/unload VxDs but only to send a 9 L4 N# k0 N3 Q5 m
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, O8 |- D2 e) A9 d% mto the VxD Control_Dispatch proc (how the hell a shareware soft could try* L0 h# c" r0 `
to load/unload a non-dynamically loadable driver such as SoftICE ;-).8 E( A- B! p+ L2 m4 R7 \( @
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 P& x: [) u  Z. v' _9 B- A
its handle to be opened and then, will be detected.
* [9 k5 H; ?5 LYou can check that simply by hooking Winice.exe control proc entry point
9 g% ^* N0 m9 F( I! }9 `. a, Zwhile running MeltICE.
7 w. a3 O- H& ~8 u! G
" Q' ^. i3 ?, M2 b0 P+ Y
9 Z: j( n- V: q* d* a# w1 Y/ ?% V  00401067:  push      00402025    ; \\.\SICE
* d- `& h( D) n8 x' }: w4 X  0040106C:  call      CreateFileA
9 @) E! V: }5 V  00401071:  cmp       eax,-001- W) X/ {& u% n7 _! T* s
  00401074:  je        00401091; h- ^8 Q2 ~0 F. f
, N6 e8 e2 A1 O+ W/ M" Z  }; q) q, r

0 c. h. ~; J& n( D; r- {6 yThere could be hundreds of BPX you could use to detect this trick.
4 m5 Z! O9 }# e- S3 p1 i) |  ], V. w# u-The most classical one is:
; A8 S% X1 o8 k! ^. ]; q+ _  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
0 F% {2 {* Q7 @0 {# k, P# Z7 i    *(esp-&gt;4+4)=='NTIC'- q# j: m4 i& s. d- Z
* n( h9 X9 u! p, N. z
-The most exotic ones (could be very slooooow :-(
6 Q0 {) ~9 P) D" S8 b2 K' ~9 h" s   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  8 k$ |( [. G2 M* d' M: X" A
     ;will break 3 times :-(" g' e& \8 z) g- x7 W2 f: @# C
1 ]5 x' _& }  D& l7 V1 T: i
-or (a bit) faster: ! W4 Q- p1 x* c' A: g
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')8 g. x+ t$ v3 R, M0 v

# f6 {$ y: Q, S* Y- [2 P   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : k# z9 p' f# V: Y7 y! |
     ;will break 3 times :-(
; c8 F! y/ T3 P
# A, ^3 g& \# w  N% q8 c8 H-Much faster:
6 L% F! V" S, ]" V5 p) R   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. R! {& E" }0 s/ w  D

2 R* w) M( S7 u4 o; Y# r: U* pNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
  ^/ B: k% Y9 Pfunction to do the same job:
4 T- G& g+ e. a8 j  Q4 I  B/ U# [4 r7 _
5 r) n8 o0 m" P) N" ?  l) w4 g   push    00                        ; OF_READ; |3 _* r: J6 @
   mov     eax,[00656634]            ; '\\.\SICE',0+ Q7 U4 U3 G- E5 X  u( F, K) n
   push    eax2 k4 E: @+ o7 S. d3 {- a
   call    KERNEL32!_lopen6 D+ t2 y( Z! F
   inc     eax, U5 d  T* o+ V# J9 i
   jnz     00650589                  ; detected/ w& I* l/ k! {' U/ |
   push    00                        ; OF_READ* f1 I6 @2 Y2 i9 S
   mov     eax,[00656638]            ; '\\.\SICE'
8 T& r8 J* K. R- I   push    eax
) f: C4 z1 E5 I% B   call    KERNEL32!_lopen
6 B6 n- ^) H# C  r+ ^   inc     eax
% t  S# d% i1 d7 o4 J& K1 n# m; C) ?" s   jz      006505ae                  ; not detected
' m/ W& m4 n! [. F
/ S1 U6 E9 Q, Z. g- L& ?# w7 }+ H/ z( T6 q7 b- q$ j& m
__________________________________________________________________________
1 }( r& }# X  S" [7 W' I7 M/ S" j
0 l! D/ M1 v" oMethod 12
5 V& l) I+ s8 b; ]4 `. w7 i3 [=========; N9 \7 }8 {8 q+ V. R( i

: G: `$ d5 l$ F4 JThis trick is similar to int41h/4fh Debugger installation check (code 05( a: l8 v! a: N% B( z4 b8 c2 h
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ E$ x1 [5 ?3 Las it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 M5 U2 ]& q: h& \4 ~8 F! @
8 p' R: Q) w4 ^
   push  0000004fh         ; function 4fh8 t$ Y. H0 r2 ^! `+ }0 o
   push  002a002ah         ; high word specifies which VxD (VWIN32)6 B# m: A9 L- p
                           ; low word specifies which service
- J# [  T, n& M) w# ^! E( N4 Y# _                             (VWIN32_Int41Dispatch)! x) l! C3 o4 |% A- |+ X9 t
   call  Kernel32!ORD_001  ; VxdCall
( ]' T- s- h5 \; u) S4 W   cmp   ax, 0f386h        ; magic number returned by system debuggers
4 e: z4 p8 K' D6 f4 c   jz    SoftICE_detected; `7 S5 X$ |3 |. j* ~' t3 K

1 {, Y0 w/ H6 h* Z7 o- v$ fHere again, several ways to detect it:
: R/ E1 B/ h6 ?- W5 k2 z# S- n9 v) d2 c1 ]/ x5 {1 C, D
    BPINT 41 if ax==4f, P: ]% J2 ^+ _' j4 X) A. D

& g# t" T! |# R    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one# n* c; r/ J" s5 _. Y
& |% m. f  ~! B) @: q! v( Z) A8 U
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 k% J. G. D$ m" `7 l. u- x. m, U9 x, O0 c2 Q! r" G+ {
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
  b% f, e6 h3 m3 I! _& T# C2 Z7 k# @7 Z, ^' o( x
__________________________________________________________________________5 e: m6 k2 K/ `' w. R+ D5 p

6 }, U5 p9 ]+ S% X7 I5 u7 uMethod 13# @: O! y' ]6 g. B/ G+ s- b
=========
- N( A8 e5 a7 ~  W3 f- n5 k2 o" H' P/ Q1 r  Y$ ?
Not a real method of detection, but a good way to know if SoftICE is1 ^, p* Q" o% i0 a
installed on a computer and to locate its installation directory.
& {7 j& h3 |5 t: K0 l7 }It is used by few softs which access the following registry keys (usually #2) :. b" ?! Y2 i. N" b. t7 Z
9 J3 G% ?/ V% \3 ?! u
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' G$ E9 V& A) p, C8 f2 _\Uninstall\SoftICE* R) w3 c0 `* u( v# v  U
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. a2 P: f( w/ W9 P
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; f3 c0 q. y+ y
\App Paths\Loader32.Exe
4 |/ T3 F$ h& O
* Q/ ~7 ^( u* s5 M: A/ R8 P9 W& w* o- j$ T$ _
Note that some nasty apps could then erase all files from SoftICE directory0 d6 B% w. R: R9 d! M! n- v
(I faced that once :-(. k* I) m% o0 ]  }# h7 y

5 O" B6 X9 S1 U4 aUseful breakpoint to detect it:
9 v1 N' O) s; y  y# }# u! t; ]1 G1 I2 ]$ u3 T; r
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, J+ G, M+ T! i& p3 i! Q( p1 }1 y! i2 ]: h
__________________________________________________________________________+ j: Y! X0 F4 m- U; u

9 V7 f2 ^# y5 _6 V7 |. [6 B7 X
0 ?; Y+ U; |! O" o7 |5 V4 CMethod 14 5 P5 E* Z5 z6 r/ ^0 t6 r
=========" w( m  Z& e4 {7 L8 R3 t) r
6 T- R! M, D8 k" D# m' L- r+ s
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose5 Y. j& g6 x) z+ Q$ v0 @# E  K
is to determines whether a debugger is running on your system (ring0 only).
6 ~+ V. }' C) X" D
# J8 x' D/ L9 F8 I0 M4 s, \   VMMCall Test_Debug_Installed4 q  `' x" \( W
   je      not_installed
: T3 o. V8 U* J+ a
! n  r! m  g! z" W5 pThis service just checks a flag.  o1 I3 M& {' W  G! x
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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