About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ b2 ]3 ^+ w6 Y. \( l/ a<TBODY>
/ M, V# \6 p1 v6 Q4 E) a+ g6 e<TR>. |) n  r, c: i# d3 k
<TD><PRE>Method 01 ) m* H* |' U0 U
=========# [* w. g0 ~$ f3 Y& n

7 {) a: a# i% ~7 C4 J  G, C' gThis method of detection of SoftICE (as well as the following one) is
2 s+ t$ w8 w) g! e2 c" J2 q. k" Dused by the majority of packers/encryptors found on Internet.
" @( }$ D0 J6 U$ a) ^$ \% xIt seeks the signature of BoundsChecker in SoftICE9 i( n4 b; ~, R& ~, m7 ^/ S- m

( E: X) G' g% Y7 L' x    mov     ebp, 04243484Bh        ; 'BCHK'. p) d' N$ M6 J2 t5 \
    mov     ax, 04h( O  \4 X& ~1 F$ |6 w
    int     3       - a6 @" `8 g( D: o7 Y
    cmp     al,4
, T) i: ^! p$ A0 b+ E- {! l    jnz     SoftICE_Detected: m& a, ]/ e" {) y0 ^% Q: d2 M8 L( D

! |4 i: d( r5 r5 m6 D6 \5 {___________________________________________________________________________+ U2 G$ p4 t* x* k) y

' c& _: I& {6 f: @; Z/ AMethod 02
4 Y( V4 X: J& H; p4 q3 X=========  Y2 O3 E# q/ X

) Z5 Q  @" y# }7 L# q# H. LStill a method very much used (perhaps the most frequent one).  It is used
; U; f$ d3 l1 nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
. r/ q% q! Y+ Z# f* xor execute SoftICE commands...
3 i% {! q. N% jIt is also used to crash SoftICE and to force it to execute any commands
( E$ U% U$ n5 q(HBOOT...) :-((  
6 B0 [# Y1 B. K. Z" b; v! S8 Q# [9 q7 W
Here is a quick description:  n4 G) q' r: {) O5 ~$ i- D
-AX = 0910h   (Display string in SIce windows), f( ]2 T+ D+ v/ v, d# L5 z' q4 u3 L
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)# G6 D, B8 o+ s+ O4 E! Z
-AX = 0912h   (Get breakpoint infos)
5 p( w9 d0 Q+ d+ H$ X-AX = 0913h   (Set Sice breakpoints)  W7 G: a  C7 x% }0 l( E
-AX = 0914h   (Remove SIce breakoints)
8 V6 u2 j1 n% B$ J0 T  C+ C/ _& V5 Z3 K
. F, T. [5 \! A2 W' DEach time you'll meet this trick, you'll see:! v: o+ |% p  L
-SI = 4647h3 [9 A6 \# ~9 v% M! d
-DI = 4A4Dh! Q# M, r  v/ P
Which are the 'magic values' used by SoftIce.
. h% d2 j  S+ w: oFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.7 Q0 Z  F# y0 L! I  d( X. j0 P/ O

" v$ D/ t$ K$ ]7 C: M1 H6 O. s6 lHere is one example from the file "Haspinst.exe" which is the dongle HASP
5 [9 q9 E# O( i" f$ o/ YEnvelope utility use to protect DOS applications:
/ X3 i) h( M- M2 N. R$ x5 P6 U/ r) D

- ~; S- |# w' D- `4C19:0095   MOV    AX,0911  ; execute command.% Q( m& D' o; P
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: Q! t* d) w' V+ I5 \7 C7 e: i4C19:009A   MOV    SI,4647  ; 1st magic value.3 A; J3 W# r; \$ ~' S$ H5 |. F
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; J1 h# c  E9 f% J- a
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*); ~# ]3 q/ C* M( y. c
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( U4 i# {4 y2 N! w
4C19:00A4   INC    CX8 z1 }% W. `7 g$ W1 L
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: m/ x3 C& a4 x6 L, I1 g* x
4C19:00A8   JB     0095     ; 6 different commands.
0 U" Q& L' F8 e0 f4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' m# ~* ?6 R1 V* }9 H6 `/ U4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
4 T8 f7 s( u5 x9 q7 f! g
' K0 j- U. R1 _; GThe program will execute 6 different SIce commands located at ds:dx, which
) N/ O4 k  o. @6 ^: Uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( H1 R7 d1 x3 ?# s% _
5 j. v& _0 W- ^, U3 a7 a- {2 K* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
0 T" P6 p4 B+ Y0 |___________________________________________________________________________$ u9 p( y6 S* ?: W7 K8 {

8 h/ ^* J& K6 G6 R# t) d$ ~
3 q2 p- a4 K# ]+ N/ @% b  F/ i4 ?Method 03* h: c; |/ s3 x- h  P/ K% U4 M/ d
=========- n8 d0 ~. o- z" g* @5 A
( s3 F" z6 J) _* l
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h# q! `" ~8 P2 e* L6 t% J
(API Get entry point)
  w# w5 c' T$ `2 Y0 [: l        
2 e; L: i* ?4 C7 y! Q6 f; _4 D' G- ?7 _/ k8 k/ _7 z
    xor     di,di* E2 X% ?+ ]# ]9 g) r% s$ H
    mov     es,di
- b/ z% B/ [0 N    mov     ax, 1684h       2 j7 Q, }! l% Y5 K  t
    mov     bx, 0202h       ; VxD ID of winice
  R4 ?/ ~$ r- L7 o% x! J: z    int     2Fh; u( k+ A2 B" S2 |6 D; z" j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 G7 z" X- Z9 H2 L$ \
    add     ax, di4 p( s/ ~; ?" `" p9 Z6 x
    test    ax,ax( \0 C4 [; E0 p3 c. n
    jnz     SoftICE_Detected
# [2 r% F6 R& H
5 k- A4 r2 z+ z; q$ i( z___________________________________________________________________________
. ~; B" H( n1 ?7 G9 l* n3 P* m% Q; ~" z: Z4 i! ?; M/ b3 X# f
Method 04! s5 z& R- ~2 W# e. T* m
=========
  ~- b, P9 p5 c9 A. K% U
+ x+ O/ [4 v5 L5 L" S- j; KMethod identical to the preceding one except that it seeks the ID of SoftICE1 K& C3 C' i) W0 J0 H( v, q9 w! R
GFX VxD.
* l( Q1 D. D* @5 Y6 ~0 g2 G5 p+ g. f  N* N& D2 e3 Y0 c6 D& M
    xor     di,di2 y$ i0 q' K5 b% N
    mov     es,di; `; T  U9 m, r3 Y9 C
    mov     ax, 1684h      
) a- W0 G( `( [8 m4 K- C" W    mov     bx, 7a5Fh       ; VxD ID of SIWVID* c2 \( j1 J0 |- G% K* S# W
    int     2fh
7 y' M7 {; Y/ d5 c- K# O. G' A  A    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' j0 N# g& W% }    add     ax, di* n. N. ?1 n7 Q2 m  b( D( ]% ^
    test    ax,ax
3 F3 H% [( j. |8 Z8 {( \    jnz     SoftICE_Detected
9 o  z6 r9 C! P$ {8 t
4 Q' _" N9 t: ~. l0 p: P__________________________________________________________________________! M. N, Z% c6 h8 j0 f8 `, Z
$ o' Q0 z: h. f3 q" Z$ f: O! d

5 f* @, m! P2 h8 JMethod 05$ E& ]9 v7 _, C
=========) {# A7 |6 B6 l. s, H
4 N1 _- B2 v& i5 J
Method seeking the 'magic number' 0F386h returned (in ax) by all system
3 u' W9 w3 y1 z# b$ Ldebugger. It calls the int 41h, function 4Fh.( J8 x6 J; c  q* w- o# s
There are several alternatives.  7 R$ N( _+ I1 E
2 Q5 B0 z. t3 m' Y) f
The following one is the simplest:
9 [5 |. |2 `* m* l# s% D$ ?" {7 Y+ Z+ d
    mov     ax,4fh; s, O( B9 h2 }! @
    int     41h+ Y8 ^+ p3 {3 n, B: |
    cmp     ax, 0F3861 m* E* l  Q9 w1 u! N9 a4 G' J, W
    jz      SoftICE_detected
9 Z; f7 h5 O: C( s6 K0 b/ }, |4 [

. A% r" E* Z$ b; k2 XNext method as well as the following one are 2 examples from Stone's
8 R6 _$ @, b" ^# S) L"stn-wid.zip" (www.cracking.net):# K* H9 k9 Q% v: b4 v% _0 x9 J

. Z; C  }, s' L; M/ l% V2 L3 _6 r    mov     bx, cs: W9 g/ C: |  T8 d" N/ x
    lea     dx, int41handler2
! M) s" Y3 z1 \    xchg    dx, es:[41h*4]+ X$ d" p8 S: F) y
    xchg    bx, es:[41h*4+2]/ [; u9 w; b- O
    mov     ax,4fh2 Q8 y2 _- \; M' e
    int     41h
1 r' b' X( W+ ~6 C6 U8 H    xchg    dx, es:[41h*4]( ?. z: R% c7 ^' N
    xchg    bx, es:[41h*4+2]
1 g9 q6 k# i  h: L' z4 D) r! v' F    cmp     ax, 0f386h& O5 A2 g7 @; J, [' N; v4 H; t
    jz      SoftICE_detected2 e" k) H- L0 O
$ B% H0 l* W2 `5 q
int41handler2 PROC
0 a8 N$ Z$ Q) e) }" }" ?+ N( y: g, f    iret
( T. }3 X1 |- q5 d& lint41handler2 ENDP
4 M' C3 i( ~* ~* S) O8 F7 `
) [* K8 K! t7 }4 @: F6 x# V9 l" |$ W$ q2 y9 D; Z
_________________________________________________________________________8 ?1 M+ R* @4 w2 z% ?9 W2 ~9 y" V
, `/ _0 p' c5 ?+ y3 f9 L

& ~% E; f; q5 s3 YMethod 066 R; X, e! ~0 ~% o
=========
6 N8 G9 N5 r- C" J, F" j, |# |: J8 \
( C  x7 j- p4 A: L
2nd method similar to the preceding one but more difficult to detect:
3 L& l: V. c/ X) |4 @! ^9 M8 R$ w. i7 t6 u. m8 w/ A
7 M0 K8 O8 K* T9 C* g- u" R
int41handler PROC
% e$ i7 w( _9 Q, y! n" Z' L    mov     cl,al1 T% F6 B4 i! S6 p2 A& I* T
    iret
1 h& Q. z% G9 m% b* rint41handler ENDP0 M/ C* n- O4 o; _+ ]3 D* _, j

1 G7 _7 U! a8 j/ C5 ^& C* [# i3 Q, V# z* ^& T$ [
    xor     ax,ax, P6 E7 F) |5 [) |
    mov     es,ax* B2 ]( u3 f0 T. f' e
    mov     bx, cs
8 M' c' a1 H/ \; z( p; k0 x( L    lea     dx, int41handler
( U  F% n, M8 F" P" h9 P# j    xchg    dx, es:[41h*4]
$ E- U* |; p8 d/ S5 ~) i- w9 [+ s    xchg    bx, es:[41h*4+2]2 }: K: F# x4 ~: O1 l
    in      al, 40h# Y( b4 ]- U6 b* a( F, `
    xor     cx,cx
/ g" a" I) d5 v% ?6 M; S$ y    int     41h
6 C" Y7 S+ b' U' x  C6 M: V    xchg    dx, es:[41h*4]
6 T9 d1 [: k+ R, }. i    xchg    bx, es:[41h*4+2]! Q) @* @% {" I% O$ m; V' [( ~
    cmp     cl,al4 t. L& B2 f3 G  l$ e! M+ f3 q
    jnz     SoftICE_detected/ L) }6 @! T* h5 S& b( r

% y9 b" l* H  Y_________________________________________________________________________
8 v- K* Z# Y; t5 b) e6 @9 u) u* q1 F" C* |0 Q
Method 072 ~4 q" S: l# H4 s
=========& e0 n: b2 A6 k7 G, t* `3 k

$ r9 R- f( ~" F" h( SMethod of detection of the WinICE handler in the int68h (V86)  t! \9 x2 ?4 a6 J

# k' u: ?7 K1 Z4 H; N    mov     ah,43h# I# R5 s3 T) X/ F. P+ ]
    int     68h/ }4 b2 N- \2 z9 y' n; H/ Q0 U
    cmp     ax,0F386h
; r% a! {! J: [    jz      SoftICE_Detected! I: ~5 V8 ?  ^. c
# U: i9 ^# k, N, H! ^

! z( {! j0 q& o5 O/ @5 {$ c=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ w- T$ a2 T1 M   app like this:
+ e' T% C% n! t. B" o9 L7 _- R1 A9 t0 @) p, K& S% j
   BPX exec_int if ax==684 X( i2 Y) b. ^. Y
   (function called is located at byte ptr [ebp+1Dh] and client eip is+ S( J& ]5 \# M; ^) q
   located at [ebp+48h] for 32Bit apps)
$ t$ n/ t9 U# @/ O- a  M8 V8 x__________________________________________________________________________# o4 a7 b0 C& V. p- e$ c. u) X
& q% Q, [9 e' O
' v: _1 I! M* u" \
Method 08
. X0 D& x- P! M7 i=========
0 ~& E9 o: l& q9 |; ^/ }$ |. N
; ~/ L) z0 }- x2 t; UIt is not a method of detection of SoftICE but a possibility to crash the) s' k# a. u1 E+ ?' o
system by intercepting int 01h and int 03h and redirecting them to another
* }4 C: ]/ P& W" d. y: Qroutine.
! G. P8 E* R  B- g, x* VIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' `. c- B% }3 o8 M) Z4 x
to the new routine to execute (hangs computer...)
  ]+ i  a, m4 S/ W4 Z3 d1 M0 ~7 z4 a& [* Y/ L
    mov     ah, 25h
% P6 E9 V9 A! u. E# D2 C2 G    mov     al, Int_Number (01h or 03h)  M2 D- M- L1 I5 @0 n
    mov     dx, offset New_Int_Routine
% G4 a, I& R% c+ a7 U7 T  i    int     21h9 j: U! z+ A) u" U5 X7 @! \
. `! h) A9 v! q# }6 ]/ _" i
__________________________________________________________________________! `$ w! h& ?& p9 g
- e! f8 P* s# `9 c+ B7 ~
Method 09
- Y7 w$ r4 S6 R  V: O  F% a. ?' a=========& S+ ?! y6 o8 m3 B" f* ?* _

7 F2 N+ ]% i- bThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( v; ?0 n+ K; Z+ H6 O- N
performed in ring0 (VxD or a ring3 app using the VxdCall).
& V/ c. ?, g. Z9 R/ jThe Get_DDB service is used to determine whether or not a VxD is installed
1 W1 b. f! Y( n( }% j) S( B, x+ [for the specified device and returns a Device Description Block (in ecx) for- o, Y& m7 {) ^7 X
that device if it is installed.
! l8 O+ [7 y# O: c3 |) G7 W  `! m+ T
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 O3 d# `* E! F4 U3 E
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% d$ @+ ]5 T1 M/ _
   VMMCall Get_DDB
- d/ p& O7 @9 \' C9 Y  m& h   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ g( n5 n5 l* X+ ]
' {7 p' M. r6 xNote as well that you can easily detect this method with SoftICE:
0 S5 K  y% L6 K! t( Y/ R   bpx Get_DDB if ax==0202 || ax==7a5fh
# @" n! f7 l: u+ C. H+ Z& w0 v2 x; L
__________________________________________________________________________
( p- ]( q% z9 v% \& i. O/ \: W( A' V: n
Method 10
- |  r- T, K+ \; b! b" g4 }=========7 R5 l. Q! t" W  t& z+ p# U

: a$ ~/ ~5 A7 R* o& [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" X. f# C; C( V. y% s  SoftICE while the option is enable!!
9 [" K, o1 g* s
# F- E" E% B- w3 M' BThis trick is very efficient:
# e0 \! F' h# |8 J3 Hby checking the Debug Registers, you can detect if SoftICE is loaded* W* @) R3 b! ~, `% @5 v# ^, i6 q3 n8 \
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if- k9 q6 O6 _2 J# G5 I, F. F
there are some memory breakpoints set (dr0 to dr3) simply by reading their
7 i7 V$ Z" s5 N; t. q) J! Hvalue (in ring0 only). Values can be manipulated and or changed as well6 ?! v' m; c: N$ q+ [
(clearing BPMs for instance)  z8 {7 q$ A. |. B0 K0 b0 H
8 l& J8 l+ {1 m. f$ r0 m0 F
__________________________________________________________________________
4 D: n9 U8 L* [4 `/ p& S; B8 y: K" Y5 W& k2 T
Method 11
/ K, a7 @0 Q  k1 o. Q* x) s=========
' F; R  m+ {" G6 m4 A: `
5 y- G$ u4 [" M) DThis method is most known as 'MeltICE' because it has been freely distributed
' Z- ~* E  N/ C. l- Tvia www.winfiles.com. However it was first used by NuMega people to allow  n3 ^- c" k  Q! q  G
Symbol Loader to check if SoftICE was active or not (the code is located
+ R8 ]2 u, p& r, R7 p8 hinside nmtrans.dll).3 {$ Q, k2 p2 ]1 h- }4 y. W% t

& h2 t: \2 v7 T! ~+ j8 @+ T$ \The way it works is very simple:% G* o4 y& l: C6 b
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* p: Y- q) J% p9 s/ T" l+ I! v0 dWinNT) with the CreateFileA API.
! n2 ~% k1 W+ O1 A+ N) L! [1 t- n) C4 p8 {2 e* y( j9 J
Here is a sample (checking for 'SICE'):. J) i+ d/ \) d$ }0 n: l. B- r* I# Y; j

" m9 L7 A2 w/ {; XBOOL IsSoftIce95Loaded()
7 u2 Y  ^1 e0 K" `4 t$ P8 ~& E{( @# L* z9 q8 ]2 j
   HANDLE hFile;  
1 l  C3 t( N) q   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
7 D& n, U6 U, C" J                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 ?4 ^, G  t3 V2 `% W8 Z, |8 k+ M
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);" a& V  I# S8 V2 R: @0 X- ]
   if( hFile != INVALID_HANDLE_VALUE )$ x* z( B/ A! q  e; \
   {
; U. J( T- I3 t. e      CloseHandle(hFile);$ n, A4 i8 h8 k4 c1 A( D0 n
      return TRUE;
$ d% R$ r# X( j. s8 |  w   }' y/ U7 _: S% r& |" e: [2 |% a$ v  Y" B
   return FALSE;: u. S8 ~# l) c0 ]/ a/ b
}
' ?0 c4 S( b- }, s! c5 a
9 _5 B# Z7 ]* d0 N$ z& x1 gAlthough this trick calls the CreateFileA function, don't even expect to be
3 x( ^3 k2 F8 p- Y3 C! aable to intercept it by installing a IFS hook: it will not work, no way!
6 f# J! D0 f0 ^* R5 L& x& UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F6 R* U" ]( c3 X+ ]
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)6 d; Q; p' I* p) z. g
and then browse the DDB list until it find the VxD and its DDB_Control_Proc( n" p* s0 y/ Z6 i; l
field.$ ~* X7 f. G. d3 k+ v/ _& c7 m; X5 H
In fact, its purpose is not to load/unload VxDs but only to send a . Q5 r7 u- f' @- X
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)/ x, }* o, w% h/ W
to the VxD Control_Dispatch proc (how the hell a shareware soft could try9 A0 h4 z8 V' [; z4 O7 T1 q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).2 c) Z5 K* s+ \4 _
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* w7 j' S: i; a, E# h' M+ ?7 Jits handle to be opened and then, will be detected.2 c# l/ a/ `# L/ d* o
You can check that simply by hooking Winice.exe control proc entry point& T( P$ f3 h$ ^( P
while running MeltICE.
0 \, a* A" N9 F4 u  O
! F1 b* h7 f/ e/ w; l4 y2 R' ]) ~* k" Y1 J5 h4 a4 z. t
  00401067:  push      00402025    ; \\.\SICE7 |) S# j8 v4 E# ?4 q
  0040106C:  call      CreateFileA
6 I2 i. Q' @' D  00401071:  cmp       eax,-001
) I2 O* E1 B( c  00401074:  je        00401091
' W: k  c6 f0 X: e2 ~  Z
) P, Z2 c: B4 ~6 o6 Y1 q, A
+ U; [# Q( a2 d) S* ]There could be hundreds of BPX you could use to detect this trick." `3 Y6 K$ Z* C/ E
-The most classical one is:
* U1 y( p3 w9 D. A8 [3 h. ?2 N  U) t  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 }% a% K# ^3 P: M% H
    *(esp-&gt;4+4)=='NTIC'* r1 Q/ t$ x7 }, ^

1 t: [) c3 s1 k4 a+ f' e1 n6 h-The most exotic ones (could be very slooooow :-(, ]0 I: |# P1 d
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 h% e. b# C% i  G; a4 z( w: H     ;will break 3 times :-(
! F) ~, c0 l. C/ |: G! d8 q; L) l8 c5 B' f7 I) V
-or (a bit) faster:
7 k9 `- Q) r  o# ^1 L2 }; a$ s# n   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')1 _8 r0 X( A5 r
" D$ I$ _( @1 H- n% U  V
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
  V# X# A1 j) i, }% d     ;will break 3 times :-(
: g7 ^! W' F) {+ h
/ ~+ |: }  I% n  X-Much faster:  i! N0 D4 a" Q7 @  I2 X& @4 @
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
3 R/ k# M( H3 _
4 Q: a" e, m; [Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
! ~3 R9 `! y# X# {& g& mfunction to do the same job:5 G/ L9 [7 S! c, k# c
( V- J( h3 V  a  |
   push    00                        ; OF_READ6 y" b( E$ }+ v
   mov     eax,[00656634]            ; '\\.\SICE',0
4 g+ L( g# ?( G0 s2 k, ~( f4 h7 G$ t   push    eax
, t, p! H- f: p$ `   call    KERNEL32!_lopen
1 |3 v/ {/ f; A1 H" a! e8 c   inc     eax
; `  X5 ^6 X- [* [   jnz     00650589                  ; detected$ B. A( d/ @) y6 [1 X! Y! y
   push    00                        ; OF_READ
' o0 q- v' ^1 J3 s5 p) p( E   mov     eax,[00656638]            ; '\\.\SICE'2 Z( b* L6 L& I( P- y
   push    eax3 U* ?6 I, S) J% X4 v# M  L6 }
   call    KERNEL32!_lopen) h2 W: ?' P) k8 G. a. _
   inc     eax
! l/ ]1 c' G7 y  T   jz      006505ae                  ; not detected5 r! j5 H6 x/ W. z' z6 [5 v
. `% y1 |! l* `# Y1 l

, [( X. F* W4 M2 |8 `__________________________________________________________________________
4 v4 ]: }! P, h2 P5 v5 E$ `1 u  e% P3 E0 u4 y4 ?
Method 12+ u; t& R9 e/ X" m+ q* l
=========
" h  B) h1 G2 M+ b2 z; D1 s( g0 o% U- S  y
This trick is similar to int41h/4fh Debugger installation check (code 05: F- C. F5 V! V' ^
&amp; 06) but very limited because it's only available for Win95/98 (not NT)7 ?! Z; D) q" }. \4 p
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
* b# z/ |- d. d
9 e3 S& B& H" X* x2 G   push  0000004fh         ; function 4fh& V; k- E0 ^$ S- l
   push  002a002ah         ; high word specifies which VxD (VWIN32)1 {: F  h, p- T% v* J
                           ; low word specifies which service, i( A3 J; ?) v0 g
                             (VWIN32_Int41Dispatch)
7 Y4 ?9 c' Z3 `; C6 \' ~" w   call  Kernel32!ORD_001  ; VxdCall# b- t* n2 X- w2 j, Z
   cmp   ax, 0f386h        ; magic number returned by system debuggers
( N" i  r, F9 m# n1 x8 l! [   jz    SoftICE_detected3 ^! ?. A8 F8 M* p

% M: h8 k  X3 Z3 ]# b- M3 XHere again, several ways to detect it:8 \9 I% P/ d  n( W8 Q
# z. l- A" K2 t$ [- I* R7 L/ Y
    BPINT 41 if ax==4f8 \7 C9 @% w% u, U+ W( y: z
1 \" f9 t( F% B, G/ c. J9 r- Y; b6 N
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 L( ?; Z' x! h. W; c0 q: F
! V4 G( m( v' v5 m; T
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& g9 i3 p( g* W" w' x0 ]2 h1 c# p9 h. ]: @8 n
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
& r$ N* B) N; p: i& \
) I7 s8 M: U4 R  V7 h, Z) S3 }__________________________________________________________________________
3 C$ e& Z0 i% m* K6 p+ F+ O7 l4 t% D
Method 13+ Y2 a/ H5 W6 M. {3 o, f' R/ K
=========7 S; |4 {/ H+ R6 k# [% g; U6 _) F

- s' W' I0 A' n0 z+ J5 y- UNot a real method of detection, but a good way to know if SoftICE is2 e0 M$ D3 G5 n3 A$ U
installed on a computer and to locate its installation directory.$ e  D1 k0 j7 o/ b4 R* r$ t6 b
It is used by few softs which access the following registry keys (usually #2) :
) ~! _, S# A5 _4 h9 J
2 J1 [; i' P' v9 y* e  Z$ X-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ _  [% `' T4 j& t\Uninstall\SoftICE  D6 o4 P  x3 O6 `5 f
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 q. S0 A/ \: d) u5 N- l! h3 W
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, ]0 P7 w" M- B0 G5 k0 V, _0 G
\App Paths\Loader32.Exe. v/ f' [7 Q8 g) r
( w8 V! b* n: j3 W5 R

% R0 B  K6 S4 l" f& SNote that some nasty apps could then erase all files from SoftICE directory
/ m. [' d( g  ^8 m6 E(I faced that once :-(
3 G7 h) t' \& D; r' u; Y0 ~% z/ c# l
Useful breakpoint to detect it:
) i/ V- O- J9 q+ z+ g4 ]# s6 M8 r. h- G3 U& Q1 u& }
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 a$ z5 P9 E* \0 Z- C) D

# L' n) [* {+ {9 `% J9 {8 h- f, V) G( J__________________________________________________________________________( }& M: h7 Y3 o7 z; v# H

8 C3 o# n$ I' D1 d3 q, o: m
$ a8 o- U* w( `9 B, v2 o3 P1 @Method 14
2 N! ~9 v# \6 z3 ?- z2 v/ C=========# K" a# c/ f5 z" Y7 m
' }& L) Z( A, O( w3 J
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ E, u* {" v' O+ M  |
is to determines whether a debugger is running on your system (ring0 only).' k6 H. s* W; E

: G$ B* N: t0 r1 r   VMMCall Test_Debug_Installed3 I7 n' C6 Z% N. U. [
   je      not_installed  k* V, K1 s8 @# ~1 z1 Y. A

" O5 F6 I2 [( N- T' `" pThis service just checks a flag.
. f( E' P3 r- W4 U& Y</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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