About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; C$ D' h2 X4 [4 U6 c  p( L<TBODY>' N5 j/ P; k* U8 z& ^
<TR>
6 F/ s, |* }/ y' e0 {; p<TD><PRE>Method 01 " Q- Z( p; U/ C
=========& h% w2 a4 w3 b! L  j
& K( Z1 j* w+ A2 `" W  S
This method of detection of SoftICE (as well as the following one) is
, [0 g. z8 ]7 Z; Yused by the majority of packers/encryptors found on Internet.
8 g: ?% C& z( P; p( YIt seeks the signature of BoundsChecker in SoftICE$ ~' o6 W% X0 x9 N. a( ?
% ^* t0 y2 p( B& e, \- a2 F# E
    mov     ebp, 04243484Bh        ; 'BCHK'3 o* ?: L3 I: P
    mov     ax, 04h
# [2 ~9 ~4 A; e7 D! o# q7 l    int     3       * ]! o/ V, K8 V6 }, ]( }& y& I
    cmp     al,4& Y: E% }! K0 y3 B! `. H+ \( T# ?& }% @
    jnz     SoftICE_Detected
- q4 t/ Q. K9 ?, q% R7 f& L
8 _/ @& l5 S; `- ]6 U6 W1 E___________________________________________________________________________
7 C; x% R9 i; \- a4 G1 V. }3 B* f! W* d" c, M8 v; M! \" |
Method 022 g. K6 E6 b- N' j2 _5 _! K$ }
=========  c- a2 i% p$ {6 ~! B7 l% Q3 X
; [0 t- B' d+ k) u4 \  {4 ^
Still a method very much used (perhaps the most frequent one).  It is used2 [% [# }% O' G4 F- \: z0 ]5 v
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ @8 H9 J$ y8 Q7 F$ x; R+ Hor execute SoftICE commands...
+ [3 n! m  R% YIt is also used to crash SoftICE and to force it to execute any commands* x/ {# s5 [. l" ]- m% C7 _7 ~
(HBOOT...) :-((  . L' q$ v' ?: U! R* p

7 Z, v- U% j3 b3 I- x+ ]Here is a quick description:
! V6 s" x5 I3 v, g/ e-AX = 0910h   (Display string in SIce windows). ~% ]9 M( t- P6 z8 D* j
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 |# ~1 H1 S, ?& a" A+ A( a
-AX = 0912h   (Get breakpoint infos)
1 B. }' n. e. D3 u* S/ Q5 v4 u  E-AX = 0913h   (Set Sice breakpoints)2 [; ?! l3 S' h5 i5 P0 f4 n
-AX = 0914h   (Remove SIce breakoints)/ L& u# s, A' m) ?" c' o% g
' B- U- z( \1 W/ [0 M2 w
Each time you'll meet this trick, you'll see:
$ Z) }# n5 L- k5 r& d7 P# Q% G-SI = 4647h, ?4 P) f9 |  h+ S$ V
-DI = 4A4Dh* b, d- F- V% a! R& J5 n* I
Which are the 'magic values' used by SoftIce.! h* k/ K" e" [1 ~: T
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 G" I) {: ]2 g

, Q8 k9 J" P) A) OHere is one example from the file "Haspinst.exe" which is the dongle HASP
9 h, }+ D: F1 h9 g8 r" u+ u: ~Envelope utility use to protect DOS applications:% [9 U4 j+ |( n5 b3 @

) m7 ^6 g9 L1 f) R3 V0 J3 Z, H4 s" L6 J+ j+ t
4C19:0095   MOV    AX,0911  ; execute command.9 z3 }, {- C: m& o; S8 K
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! L7 r- O# Z( g; y. B1 k# f! i, j4C19:009A   MOV    SI,4647  ; 1st magic value.% ]$ F. |4 \- Z& E1 O4 N4 ~
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
$ `% W0 L$ ?7 U  c) n% E8 ^4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% |" A  A' s5 _4 f4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  _( Q0 `7 u6 \- o+ C$ |5 Q. O4C19:00A4   INC    CX
' B. }9 T- y& W0 i5 I: a7 \4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& t9 B  y2 E8 C% L( @7 ?9 ]4C19:00A8   JB     0095     ; 6 different commands.
& r; X1 ?5 s3 S5 S4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 Z  e* S7 u; j1 J3 K4 r4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 y( j! h9 A$ T" h4 }/ H; `
7 Q# ^% i5 o- eThe program will execute 6 different SIce commands located at ds:dx, which! o6 v  G7 C  q% o9 V  _
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.; V' ~4 v5 V$ y7 ]' l  y

: K" r" Q, |- v& w* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 H8 U" l9 {0 ~8 N' V5 J/ A$ A
___________________________________________________________________________
, ~9 C7 r1 A# K  ?4 y, r% Q/ k. @: J- a: _0 ?

: `! ^- h+ o/ y4 S$ K% u: u% f# tMethod 03* D! g9 n# x' K! G
=========
* j: u3 }* ?; K7 ]0 ]' y' }7 w- [3 m. n5 ~" N
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* Q* t2 t3 \. B7 L) h3 a
(API Get entry point)5 S2 x! @' N/ @  |# d9 {5 ~
        - }9 j' }& F$ ]1 G9 b

9 Z" Z$ o( F9 n/ t7 t, o9 \    xor     di,di
* P; m9 p1 R6 V2 ]    mov     es,di
4 _6 i3 t1 b: T) C    mov     ax, 1684h       0 x7 ~, R! U2 `
    mov     bx, 0202h       ; VxD ID of winice
; |9 E3 r( F& l% @! o. F5 G* u6 E& u    int     2Fh+ o0 b$ c9 g7 p1 f' ^
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# Z2 O) H* ~) k: u
    add     ax, di
' F" V/ r, h( F7 D. k7 j! O    test    ax,ax- T$ T* w6 G4 K! n9 L
    jnz     SoftICE_Detected. `* B: ~) l8 g- c$ D+ `

2 N) a, H7 P( H1 X6 R3 T4 \6 X___________________________________________________________________________5 V) ]& E7 X) `5 z2 O; t8 Z, O
; ^5 R- U; q, T1 w0 w- Y
Method 04+ q( D9 ]. f2 C" X
=========; q; x' h3 g7 ?) Z
/ Y0 l& w% Q1 B' d* V9 a8 y
Method identical to the preceding one except that it seeks the ID of SoftICE" ?8 z: E3 ^; R+ \1 M( w$ q
GFX VxD.8 d  g3 X$ _- s6 m2 w; p6 J+ U

4 t3 L& x. e. ]) v    xor     di,di
4 s2 ^" w) A, s4 Z& c    mov     es,di
) C  O. x+ M, D& d    mov     ax, 1684h       8 P- Q) X7 j% l$ x9 G
    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 q. w- j7 x- V8 A% k9 Q
    int     2fh2 P7 q  u0 e! z3 ~
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% A1 ?; m1 M7 i( ?; v( c) C
    add     ax, di
. d$ d2 h* Y9 d3 B6 d7 w6 y    test    ax,ax
, j- s- e6 R* c. ?+ Y- Y    jnz     SoftICE_Detected
6 g! f0 X- i  i1 e. j/ |
- Q7 m0 Z) X4 u__________________________________________________________________________6 r- A# C( t6 M. F9 X8 W6 I
/ y5 {* r& J6 h9 z# M2 P( ~1 v

, |. ]2 b% m8 e: I( r" zMethod 05
5 _. u, C1 [; E- C2 t0 {. f6 h=========
: ?5 r! r: j6 F3 \6 u! }/ S2 y( g9 F& m, t6 h, O
Method seeking the 'magic number' 0F386h returned (in ax) by all system+ N' w- }$ Y& u" i0 A# G; E
debugger. It calls the int 41h, function 4Fh.; w5 l$ E2 M2 ?; z
There are several alternatives.  
$ _0 T5 {: k3 `: d
7 q) H3 h! @& ~/ Q# Y3 Y0 \The following one is the simplest:7 t# a" ?! e) M: I$ _

' z- }; K' K! C+ n* E% B    mov     ax,4fh0 Z: M; h7 j: k3 T5 I7 ^
    int     41h
2 _$ P. ?/ ~# H' ]0 n, L    cmp     ax, 0F3864 n7 h/ o! R: E
    jz      SoftICE_detected- g* H) k4 T5 ]* i3 F

, e4 F8 ?6 ~% y" `4 X8 @$ x$ H2 N: r8 ~
Next method as well as the following one are 2 examples from Stone's
6 |, N' k: G. {) [# D' v' V"stn-wid.zip" (www.cracking.net):7 Z/ [. B, e; R/ s& Z

  a+ K9 h/ G$ T0 X9 D    mov     bx, cs# |' W& K8 Q8 ^/ ]: ?4 P: D( _
    lea     dx, int41handler2
$ ]) c- v, q8 `3 `* A3 z    xchg    dx, es:[41h*4]
) A" h9 P1 `# U2 G; A* I    xchg    bx, es:[41h*4+2]' F& N1 E6 c) X0 [, i5 @
    mov     ax,4fh6 E& `1 ~, k% v$ b# c- [
    int     41h5 G6 v4 d/ Q0 [" w  I6 K
    xchg    dx, es:[41h*4]1 q7 O) \) x) F# Z4 U$ }+ T
    xchg    bx, es:[41h*4+2]
& c- x+ y# D+ I( f7 k3 e; ?    cmp     ax, 0f386h8 l6 C. q) w2 f1 Z5 j
    jz      SoftICE_detected
) V# x4 N: m7 ]& `  z7 Q% ^# ^7 s  k/ p0 U$ X/ r9 K1 R- J
int41handler2 PROC
3 r1 G+ x8 ?0 W2 X8 L5 }$ z9 k0 E    iret
8 a$ X+ G) J- Q) Q7 bint41handler2 ENDP* k' C5 J/ @' t$ ?

& H% E& o  S9 K2 r' O
. ~5 k0 I5 W9 ?' m1 s_________________________________________________________________________; Y/ m0 e- q2 [4 T6 A

8 d1 m; o" C: ]+ z/ X' n; N/ C3 a1 k2 T4 y; z
Method 06
+ E% v6 r$ _; Z6 Q1 [1 }=========% m" y, Y( u! F& D

5 ~0 I; s# R& I% l- Z9 I# }9 `+ w: k1 ]9 i9 m; ]* ]5 D! U
2nd method similar to the preceding one but more difficult to detect:; _5 a) M! O7 Z0 e! ?' X  b8 Y( u

! v- x2 {8 e6 Q* }. d
& L$ j: P# w6 xint41handler PROC
' x! a; J5 R" Q9 d+ {% k1 D5 _1 s    mov     cl,al
. j: d3 E6 o* [+ W/ n$ w    iret& Q: N  }: K- h: K. Z) N: C
int41handler ENDP
! c! k7 |3 v$ t; Z: \: c# {# s4 t5 a; D$ b

- `$ m) S+ k& }8 k    xor     ax,ax
2 @* V$ L+ g9 W$ H4 T( O    mov     es,ax
. a' ~0 v  @' _    mov     bx, cs0 }0 _- D5 A8 a
    lea     dx, int41handler) t. h9 a- t5 b0 I4 M: b2 K8 O
    xchg    dx, es:[41h*4]. Z4 b" \- y7 K, H( }
    xchg    bx, es:[41h*4+2]4 Y( T$ R0 X$ F9 r6 k. w1 ~# r
    in      al, 40h( s+ `$ e4 x* |2 K
    xor     cx,cx
) I$ Q$ G( i& @$ P; y  l( L    int     41h; ]/ i. ^& Y% J7 q- |6 t1 l
    xchg    dx, es:[41h*4]8 A& q7 [7 F7 ~3 z2 @0 y+ p
    xchg    bx, es:[41h*4+2]
3 z+ n8 H; |' M* y8 q    cmp     cl,al0 Y: _3 {# ~: _% ?5 S
    jnz     SoftICE_detected
" c/ p4 M7 f: u8 B4 V4 [0 `9 D1 M8 F& R1 @3 E
_________________________________________________________________________
: t# c5 D! Q" N  _& I' e1 T  G
6 Q: {* B$ u( E; ?" e+ {4 ]Method 07
0 ], p$ @2 n# S/ O! H2 E1 m8 W=========8 S& A- w& g  m, I5 O/ k. H$ ]

) K0 i; S& A$ t/ u+ |/ `Method of detection of the WinICE handler in the int68h (V86)
% e! ?/ j0 r2 U1 h9 ?/ o% l6 \
, q3 D/ j% g# B' j7 b/ w    mov     ah,43h' Q% M5 M% f& J. R; O
    int     68h3 {' ~. p0 ^6 {+ ]4 o
    cmp     ax,0F386h  d" ~4 Q. `4 }" t; P
    jz      SoftICE_Detected3 Z, Q! D3 y" t; Z  `

) |; p' X" i- \6 j
9 X. k* [3 j: K/ {, p- L0 m=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit+ f2 C) `5 N" P, ~, R1 G- C
   app like this:! P$ J: `1 Q1 ?. d, u, d0 i. G3 s
1 r  _" a, F/ S3 }; g6 N
   BPX exec_int if ax==685 j3 I6 |3 T1 u
   (function called is located at byte ptr [ebp+1Dh] and client eip is9 _! _4 z7 |; U( T
   located at [ebp+48h] for 32Bit apps)
) c: e: Z6 Q4 T$ g9 W, t__________________________________________________________________________
$ K2 {3 Q6 T8 z
& M& ]% ?. G. B6 f% R
# ?; C( r/ T" R6 V' W; YMethod 08) a$ O' ~5 h$ B5 f; k8 t
=========
2 ^+ ~7 w1 @4 h" S6 s
& |7 \: r0 L2 ?$ K# gIt is not a method of detection of SoftICE but a possibility to crash the# u" E! b' e. G1 t3 b. J& R% X+ e! w
system by intercepting int 01h and int 03h and redirecting them to another
- S0 \! s/ R3 g" `/ g+ B# h. nroutine.7 b) Q- @: R# j) Y2 G
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points2 n5 m* }5 i& f/ M" v
to the new routine to execute (hangs computer...)" L2 _* C5 T9 Y7 @9 R. r8 Q$ E, H# t

  Q6 M0 E4 f0 b' C/ H    mov     ah, 25h
' Z6 P5 B' l& Z: X    mov     al, Int_Number (01h or 03h)
# F% ^: p7 ]4 F' s$ [    mov     dx, offset New_Int_Routine9 A% ]% [6 t  x
    int     21h
$ h4 _3 C2 [1 S6 V  d8 A
! ~" v4 Q* \# v, G__________________________________________________________________________0 y. J6 x0 Q5 J" ?
& f5 H+ o4 U( p* k: G6 W
Method 098 R) t1 g+ V8 Y6 ~4 |
=========
4 J( z1 l/ l9 y) N6 r5 j4 |/ f
, o/ q5 |# n) \8 XThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
' q: ~# `  `/ T% G9 {performed in ring0 (VxD or a ring3 app using the VxdCall).
9 \) V, R$ {4 L9 Z8 dThe Get_DDB service is used to determine whether or not a VxD is installed; {- E$ ?: C& p- g8 G/ o" q+ b. @% C
for the specified device and returns a Device Description Block (in ecx) for
2 ]; a2 _9 b" ?! Ethat device if it is installed.
+ n& l0 V; _' b3 u: k  Q
! a! D. F! o7 j. P( z1 s   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ W5 h7 b! J1 R, G) e   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 ^' }* `" k# d+ e0 L
   VMMCall Get_DDB
* Z: s$ L/ Z& i1 v9 o& k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. L0 y+ s( Y; Z" b' i2 t# b& R6 S( t6 L3 Z; R8 s2 q9 m2 W0 W+ C. I
Note as well that you can easily detect this method with SoftICE:7 y" e/ Q$ c8 }. {- `8 b
   bpx Get_DDB if ax==0202 || ax==7a5fh
: i1 E4 W+ O/ w. _. G1 |% `  h) @% m* F' w& t/ _  o' P8 C) s3 D
__________________________________________________________________________( `, R0 m4 j% {) Z; |. G

; G5 b' D' B  R5 J/ `3 e# JMethod 10; l  r  a: `& f
=========. M9 F  {& h* ?. S" u% t9 v

4 J2 H! G/ K- y* l# X# g=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% K6 K  Q) _( Q3 d. f3 `
  SoftICE while the option is enable!!' k% R( i9 s# m
! t1 t9 ?9 j7 q) M" ^0 ~
This trick is very efficient:
$ S" e$ l; t( O' ^( y& j) B+ qby checking the Debug Registers, you can detect if SoftICE is loaded
# _* D4 h1 v  G0 n! l& r+ v(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
6 e% U0 ^& w# x- T! X7 u& q( a2 fthere are some memory breakpoints set (dr0 to dr3) simply by reading their
4 g$ y/ V6 S9 O$ k& `5 ?* Zvalue (in ring0 only). Values can be manipulated and or changed as well, V, T( A2 X& k$ j# @; n5 q
(clearing BPMs for instance)
8 }* n" `& ]; N' P' i/ {, m; a' Q2 z& b! F7 ?& Y8 |
__________________________________________________________________________( D( S$ w+ \7 Y* D' T
6 i, Z3 e% v$ v" [8 t4 ~
Method 11
. I5 K9 ^0 W( ~/ n) k+ k7 s  U=========* `( r: h+ n# r: I3 |0 a0 ]1 g6 W

# I( t: Q6 N4 u8 pThis method is most known as 'MeltICE' because it has been freely distributed
* [. u7 W$ X( g  T( b% ivia www.winfiles.com. However it was first used by NuMega people to allow
: ?3 i/ I3 L( ]8 K% L8 Z7 iSymbol Loader to check if SoftICE was active or not (the code is located
- L, ^( s  h( ^' t. einside nmtrans.dll).
3 I$ h( `1 d3 Q. p9 a; H
4 d/ c6 }5 S; k7 |The way it works is very simple:; o0 x" u+ M& W: G
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 d2 X+ u" l; X5 B4 E+ k  J4 _, g4 M
WinNT) with the CreateFileA API.' A5 R7 _) g8 Y3 W& }; \2 J
4 l; T# h4 @6 O; h
Here is a sample (checking for 'SICE'):+ m; `& R+ Y( d6 r- W
; i2 j  D3 U% W1 _
BOOL IsSoftIce95Loaded(), W4 L8 }0 ~7 o1 u
{4 K8 h/ ]' V% d. D6 [
   HANDLE hFile;  : q8 l# K) I& D7 s
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& C6 C% P1 {% ^
                      FILE_SHARE_READ | FILE_SHARE_WRITE,# @6 o6 R3 x' a; ?7 m
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 N  K, T% t  m% Y+ Y5 l8 o* g   if( hFile != INVALID_HANDLE_VALUE )/ i3 a* N) m/ V1 R+ \% ~+ I; D
   {
0 Z; L* m; c" ]0 N# `* v6 k6 W      CloseHandle(hFile);( k' P. d1 j+ ?+ P
      return TRUE;
# l% P" m4 o* l   }; {& _$ |. B: Q% v# d5 _1 Z
   return FALSE;4 c4 E/ C3 @$ p$ ?' n) _, V
}
  z+ L* c+ F( q" g) p5 S+ }
4 _$ T2 K" b  i/ m! y, @Although this trick calls the CreateFileA function, don't even expect to be
1 E+ m9 k9 O& p% a' table to intercept it by installing a IFS hook: it will not work, no way!
0 N3 q. E- x% f8 W. AIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
; O! ~, Z3 f7 r2 F6 S! ^$ e5 jservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
* y! x* @3 K3 iand then browse the DDB list until it find the VxD and its DDB_Control_Proc2 p3 G0 h5 y1 g$ M
field.8 O5 ?0 |' K# d1 \- b  ^) {
In fact, its purpose is not to load/unload VxDs but only to send a 8 B5 _" N- Z$ W$ v
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 E. V% u6 k8 Y% n1 s4 \
to the VxD Control_Dispatch proc (how the hell a shareware soft could try, e6 `2 E; q+ o' D* M
to load/unload a non-dynamically loadable driver such as SoftICE ;-).4 M" U( G& j) R, i9 i4 [. F. [
If the VxD is loaded, it will always clear eax and the Carry flag to allow
$ \' h) Q6 l/ S% I, lits handle to be opened and then, will be detected.
* x1 D# O0 K5 R- HYou can check that simply by hooking Winice.exe control proc entry point9 c. z) T6 m" R" E! `) E6 i
while running MeltICE.2 \' U5 U# J, P, ~; I4 H6 ?, q
4 T' e; G9 ^1 k- B. z
) q& x% j! ~8 T( s4 @& R
  00401067:  push      00402025    ; \\.\SICE
+ ~* Z- e4 O! \. h4 @  0040106C:  call      CreateFileA- o  o$ W7 D: B( F# @3 d
  00401071:  cmp       eax,-001
2 \9 J+ Y9 ?5 I& Y& D0 X3 O  00401074:  je        00401091
4 ], t3 c: ]+ S: J# F. ]( Y2 W  Z+ Q) V# w- R! m5 X

: O/ X9 Q, P/ V7 w) t/ IThere could be hundreds of BPX you could use to detect this trick.0 o/ L2 V3 j7 m% \: h: W
-The most classical one is:
$ D3 E& X( J) A  C/ Q$ j  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||8 k- r8 ]8 o( W' [: d
    *(esp-&gt;4+4)=='NTIC'
& ?0 c5 o0 p  _* O2 Q& o  V9 I
3 ^: }' p. [$ y3 Q-The most exotic ones (could be very slooooow :-(
' z% r  Q+ }3 u; u   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  9 D; J& U2 l, d" J8 Q* j
     ;will break 3 times :-(
; R  a9 U8 {% s0 d, j! ~* V" l7 |- |9 e: t: n
-or (a bit) faster: . ~: N. x3 a! q/ h! m- `3 H: {
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. M3 j, ~6 V; T5 j' a( I" ~; C* Y1 y1 Z3 n& h8 V
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
2 ^0 B5 @; v, \! }0 h2 B     ;will break 3 times :-(
* H) f' Q5 @0 c, V% W: M% Z$ d/ q8 [6 d* P% @5 t8 H/ l
-Much faster:! a4 ~  E1 h9 D( J/ o
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 |8 y: {; }* x) G4 w
+ `0 [+ z3 ^$ `' Y
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ J! I: N; @3 C! gfunction to do the same job:
! l% j& Q+ T& U6 L1 Q* E3 F+ x; u  e  I
   push    00                        ; OF_READ) n/ p4 \% f9 }+ P
   mov     eax,[00656634]            ; '\\.\SICE',0, L+ K$ V! _# n+ b: O+ u! a( D1 M
   push    eax" H3 X& \* G- ]" S. d* \
   call    KERNEL32!_lopen7 g# h* ]% ]/ U+ ?) k2 y+ ^9 j8 a" A
   inc     eax& }4 ^9 W, ?! j% i& X" V- T0 i
   jnz     00650589                  ; detected
7 Z: u- b8 Q& R7 l   push    00                        ; OF_READ
9 T2 Z4 ^" t0 w2 O& l, H; J# X   mov     eax,[00656638]            ; '\\.\SICE'
, N+ G! x/ a9 p1 X1 s. h+ N   push    eax
7 L1 p4 r8 t0 c5 g9 l$ c* @) {' O   call    KERNEL32!_lopen" O5 Q. W( G+ C4 z) s
   inc     eax
6 K4 L2 a3 I9 o5 [   jz      006505ae                  ; not detected
3 N0 {% g5 ?/ A" Q2 {" `4 j; i3 C

; p/ C! ~( w" F4 u" S! z__________________________________________________________________________) F5 c  p; b) l5 M' p
/ a7 P7 \. c3 r, w2 W0 @7 h' p
Method 12; l. U- q$ v* o( G, o
=========
5 w. w2 n% p5 z" e
5 |9 Z* {8 p* \2 Y5 yThis trick is similar to int41h/4fh Debugger installation check (code 05
+ t% t  N8 v; q4 i( f&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! i. e) T8 t( q5 x: ?0 X; }" |as it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 }1 L3 [- Y+ y* j3 c
+ Z: ^' Q7 w/ Z  f
   push  0000004fh         ; function 4fh$ i) L4 Z8 {7 A% P) x
   push  002a002ah         ; high word specifies which VxD (VWIN32)2 l4 H% n- G0 k- R% Y6 U, C
                           ; low word specifies which service
; K" f# w( L* ~; E- W                             (VWIN32_Int41Dispatch)# X  b% z. `* `3 K! L- L
   call  Kernel32!ORD_001  ; VxdCall
! N, a) k( s- N   cmp   ax, 0f386h        ; magic number returned by system debuggers
" Y6 R( w: M6 B$ c   jz    SoftICE_detected
1 {0 }9 R, X- V. T+ l7 w9 L& E3 J5 ]/ V) Y
Here again, several ways to detect it:; I2 e$ k/ v7 x: j/ j

8 d. _+ M- c0 P$ h0 z! v    BPINT 41 if ax==4f
7 F7 o& k! h' Z8 H; }4 `
6 {# i+ p8 j- s: O2 I/ N    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
. A* f/ L( r, j% D8 j2 R5 x2 J$ V3 K8 n$ }5 e! \2 ~
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
# R1 P; T& g1 I' U% X$ P1 W- {6 ]* I- h. n$ w9 `2 ^# f; }
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; l9 F$ T2 Y% u6 j
! `7 c/ ?9 h. e. S+ I__________________________________________________________________________" G- s8 \" _1 U. i
" ^# c1 w. Y' _' M9 v  Y
Method 13# ]7 @) u( R3 d1 m% r
=========- H( m+ h" U  t% u

8 o2 p1 v6 a5 TNot a real method of detection, but a good way to know if SoftICE is
" y5 |: v( q3 T  x6 finstalled on a computer and to locate its installation directory.. B# f7 D, q4 d3 A& m0 z
It is used by few softs which access the following registry keys (usually #2) :/ X. w. v" t4 H; p; r
: ~4 t/ P' ^* U% |
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: Q% A( d7 y" ~\Uninstall\SoftICE
, P! D, k: ?/ G, ~& `5 D-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 q9 Y8 `1 a  w  d  o
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 a% q, @$ h: G7 d+ K* {
\App Paths\Loader32.Exe
: F  x- K$ H8 ^0 G8 S( z6 |
4 C6 i* B7 T4 V! w1 I" D. }5 d; j$ q6 }
Note that some nasty apps could then erase all files from SoftICE directory5 w! s- J. c: O
(I faced that once :-(( R7 V% D8 B' f( A

- o4 j4 R# Y/ F4 R' A& u3 oUseful breakpoint to detect it:; D) Q$ ]" {. ^! w4 H2 o, Q
! z# y% |9 w7 {" z. o
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
% H; `, F9 Q' ^- C
5 |) e3 C  _: K0 I2 e__________________________________________________________________________: k2 `+ o) O3 a5 G

9 r( n( y4 o7 v( l
' @' d+ W) x0 IMethod 14
  ?% R+ q) P8 G1 ]7 J=========
% z" v7 ]9 ^$ m+ O; B' q
+ L" S! V$ J+ @5 K7 w" yA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 a# w6 v8 M0 ]9 c2 u6 J
is to determines whether a debugger is running on your system (ring0 only).
; t$ z- _8 o% F3 p8 k
0 s& i% w/ l  y) U7 U  F   VMMCall Test_Debug_Installed# V! W# j1 G! y& ]8 V3 q# y
   je      not_installed5 I# K9 c* O; o( X- q1 j" Q
& B$ X! z3 z( o
This service just checks a flag.
$ M8 [# x" ]( h+ t: l</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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