About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. W7 W; O% d9 ~" ]' P/ [$ y, D
<TBODY>- D+ c4 h$ t3 H
<TR>; c: S* ~: p" O3 P5 f
<TD><PRE>Method 01
" q6 N5 {' ?/ m" ]" `: j: h=========
6 D) T3 N/ M+ g  k( U% z% m+ g! X' z5 z
This method of detection of SoftICE (as well as the following one) is
9 E! N+ v1 p" F% E% eused by the majority of packers/encryptors found on Internet.
) d. F/ W2 N' C5 R5 Z5 @It seeks the signature of BoundsChecker in SoftICE: R" @" [* F5 K) H+ q* }7 i
  O( _* j* I7 B3 k! B5 c1 h
    mov     ebp, 04243484Bh        ; 'BCHK'" A8 C* N" h4 ?6 J- p4 y( V
    mov     ax, 04h& b. o7 F7 }6 n9 I- v
    int     3      
1 a  F" ?: Y$ w1 @9 f    cmp     al,4
0 H& q) h  r9 w+ Z4 g$ }    jnz     SoftICE_Detected  t8 w  q5 Y3 X/ e

* j2 m6 J- M  c  R  r/ p$ n( y___________________________________________________________________________1 u2 o) q& E4 g- P
+ x) [2 i8 V* K* a, v; j# [
Method 02' U4 W! A7 ~9 ^
=========+ F) z; b7 L9 }# S: l

% ~" @4 F1 J0 b* B& n7 xStill a method very much used (perhaps the most frequent one).  It is used
- r. g7 @2 g: C* \' e3 D( cto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ c  X% Q3 T) yor execute SoftICE commands...
  c2 M1 s' i' \  A: y3 rIt is also used to crash SoftICE and to force it to execute any commands4 N  L' Y! E, ]+ s5 g
(HBOOT...) :-((  
2 h$ v9 p. r0 E; S7 s- y$ U* A8 g
/ r  X1 c" C* w8 ~8 SHere is a quick description:
: o' @3 v& S2 @* _. C-AX = 0910h   (Display string in SIce windows)' |& y: l( {) Z; c" Z
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 o+ @% X) g7 B2 ?2 m; c. z% v" N-AX = 0912h   (Get breakpoint infos)
* Z6 R, t4 ^8 N3 D2 }+ I  g-AX = 0913h   (Set Sice breakpoints)
" c8 B5 _2 e+ U$ a+ P-AX = 0914h   (Remove SIce breakoints)
' L) |5 j) P' f) o: N% I1 _6 k% J  D
Each time you'll meet this trick, you'll see:* W  ], o4 @+ Z
-SI = 4647h
9 R/ ?2 R1 z8 c) @" N$ w-DI = 4A4Dh! j; i& T6 F) O( |7 f% |
Which are the 'magic values' used by SoftIce.
1 Q' g+ e  ^/ XFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
5 b0 B/ V, }& c" E
( D- W* D# \% l* A! AHere is one example from the file "Haspinst.exe" which is the dongle HASP" X$ K* @4 q. b1 o. J) R& K
Envelope utility use to protect DOS applications:/ k: F& N8 u1 K( o# j5 U7 T
- S% S4 ]6 I, V" X% U  \0 z
4 S  C9 c2 l% r5 g
4C19:0095   MOV    AX,0911  ; execute command.
- _( t! c- ^4 l9 ~2 r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).' B! I) a) _2 B* Z1 q% L
4C19:009A   MOV    SI,4647  ; 1st magic value.
8 E5 u! t7 i  w  i% ]  G$ p# l4C19:009D   MOV    DI,4A4D  ; 2nd magic value.) V9 }3 E! r3 U$ @% S
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  @3 f3 k1 m4 i
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute& }& y: d! C: i
4C19:00A4   INC    CX& D' V) t! Q: |/ q2 J
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( C, P  ~( f% [0 b8 t4C19:00A8   JB     0095     ; 6 different commands.+ E4 _/ d  c; t" p, m- S3 W
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  S4 q& Z1 Z$ R: z8 W3 z# a5 L+ _4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)# o* Y4 B, q5 x" A: ]  _+ L
( u. e- \2 F. T( X8 o) e0 A5 h( `4 s
The program will execute 6 different SIce commands located at ds:dx, which# a0 l7 p5 b, b6 j; O
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 z7 n  Z, |5 F7 \0 k7 Q) V7 m' M0 ^) q0 }: s" h0 a
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ x9 Z; `. j' Z
___________________________________________________________________________' t" Y6 {6 \) ]# D0 n
. b8 P7 _4 Q8 ?% T& n
- ?6 h/ h# |% z2 C1 ^& q, i! v
Method 03
4 m0 K/ V8 q) L& |9 G+ a$ `=========5 y# h7 c1 N+ W6 t7 n- b: W
- z+ V5 q0 ]) S9 e/ b
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 o4 F7 k4 F6 _+ }5 p" y(API Get entry point)7 u$ [$ J/ _6 A6 G0 F
        . f7 ]' R# O' {0 t
% K! U/ G% w; @. `( v; s4 {
    xor     di,di
  H) A! ?" H* k" |1 v( p9 _% l    mov     es,di
4 [) W, C. L9 L' m, \    mov     ax, 1684h       $ {- n, {5 d1 X8 {. |9 N. R6 L1 h
    mov     bx, 0202h       ; VxD ID of winice$ z% l  \  H  N# ]$ B
    int     2Fh5 f) {# f# X) @" x; j5 M) v7 ?
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; ^" J/ d3 Q! B8 Z# t    add     ax, di3 }5 Z2 I7 Y& @& W6 S7 x" K
    test    ax,ax- c6 ~4 N- o8 V' F- U
    jnz     SoftICE_Detected) I% F* q+ v1 A% N, C9 Q& `

( f) L7 z. S$ q8 F___________________________________________________________________________
! w& f: w5 Z7 ?( A, ?# ~" ~
% }; l. D/ V3 A3 N, t* {3 iMethod 04
9 B3 w* r3 S7 c- s5 Y=========  n& I7 |. M9 e' C0 J# p' B

0 c( C! r+ \6 T2 ^- M& {  b3 _8 N4 RMethod identical to the preceding one except that it seeks the ID of SoftICE( K% F1 G* d% @. h5 N; D3 ~4 r
GFX VxD.
! k2 H/ h8 q' h- M1 Z7 }& A6 ^+ [, ~3 ]
    xor     di,di
% y' }5 S. B* B' X8 D% x" V8 Z) J# V    mov     es,di
1 O) X4 ]/ h) h: d: U  K    mov     ax, 1684h       8 {! Y# v9 b7 P" f7 p
    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ I1 A6 n) |# Q  ^  _  {
    int     2fh
& o8 O. a* e% X; Q. W2 M    mov     ax, es          ; ES:DI -&gt; VxD API entry point, f; v9 B+ G, s2 N3 F0 v
    add     ax, di9 y: e5 w: [" Y$ }* `2 M
    test    ax,ax  Q! U. j% A- T
    jnz     SoftICE_Detected, Z& }# y' e6 W9 J) M3 d8 R/ A

% ^; q; U6 h" {) {' h__________________________________________________________________________( d" h7 o9 u, _

. ?+ @/ G4 _3 v% P2 q
7 W7 B" P* ?5 E* LMethod 05/ K6 F0 _- B) x6 I3 v, B+ G
=========
" D+ E$ z& H% M9 f4 |7 w  [0 J3 x9 n. |6 n8 V5 ?
Method seeking the 'magic number' 0F386h returned (in ax) by all system
: L0 m( X8 K0 j+ |debugger. It calls the int 41h, function 4Fh.
1 h$ \0 ?6 f8 T6 f) @- {9 N3 oThere are several alternatives.  # m7 N% ~3 o5 W& `) A

, S& U5 I% V" }: \1 {# U6 KThe following one is the simplest:
- Q/ j! j1 u7 a( j, w2 G% J( D: N; q- [# m
    mov     ax,4fh' a9 r% m2 ~, H6 Y
    int     41h5 N; Q7 w, X& g4 u
    cmp     ax, 0F386
' K# v8 D! B* _$ V8 R: x, Z    jz      SoftICE_detected; g8 Z( b2 j* e1 ~  _

" U0 \  x; e( _. t* N3 |- u
6 {  ]5 z0 M* d; b! uNext method as well as the following one are 2 examples from Stone's ! h) U4 \8 M4 O& Q; s- d7 w
"stn-wid.zip" (www.cracking.net):; }! P0 L. J  o, v8 l1 g8 e
( o( B* ?* G0 C$ c5 s
    mov     bx, cs& v  @& L/ A0 m; b5 y
    lea     dx, int41handler2* n, c8 q$ b" K  ?9 A9 R+ ^
    xchg    dx, es:[41h*4]5 ]+ z$ q1 G; `5 S& P2 i
    xchg    bx, es:[41h*4+2]2 [8 B" D/ v2 b$ a; I
    mov     ax,4fh
$ Q( r' z6 o$ }. O5 N9 R    int     41h
$ Q  A0 Y# c! c2 F    xchg    dx, es:[41h*4]
( x5 _$ [+ D: z0 R. N$ p  e    xchg    bx, es:[41h*4+2]
" u( r. }; D  s# d0 I1 k: \3 {# k. ]    cmp     ax, 0f386h
; O9 g. P0 A$ k7 m8 z$ z    jz      SoftICE_detected) ^3 z, @& A7 @
( Y1 D( C( K4 V5 v5 B" R" q  U- v- x
int41handler2 PROC
# ?% @+ \9 a5 D/ d! L( u    iret
% k" h$ U9 R& V4 U/ Q/ [. Tint41handler2 ENDP
, c; v9 j( m4 s
% G1 O3 E* P5 P3 O' k3 u1 \# E2 u7 f0 A# b% Q% \" D
_________________________________________________________________________% O1 `$ \' w4 B$ j9 W' P

$ T9 t2 L% T& B5 [- I, q- X/ v6 {% r" l3 h/ F; h( s1 p5 e9 S7 M
Method 06
8 C/ K, N+ G  y7 _& ^=========
4 ?2 r, k8 L# a- ]0 z/ f# D
( V! w$ ^3 \6 R* R5 W' d
/ t3 I" l. _3 _/ d7 @$ {2nd method similar to the preceding one but more difficult to detect:
: g& j1 Z  E2 c7 Y9 U, L, K: R% O- P0 G% j# d- T9 [

8 F9 t7 [% m0 h* v" ~4 t$ `0 Gint41handler PROC
$ v3 ~3 G& R" x    mov     cl,al
2 K. S/ k- X& H2 C3 `    iret) {+ K( ^" G' M4 o4 ?, j
int41handler ENDP
* [$ x( n1 w- U! }! [5 Q: f
7 f' {. }: X  i; O& h# b3 }% F2 e' N, B# i1 Y
    xor     ax,ax+ c9 [/ k! w5 P" E1 b! a
    mov     es,ax6 R  {0 K$ `" C. n0 m
    mov     bx, cs
$ y$ q- c4 ]3 g% v1 F$ a    lea     dx, int41handler# y6 z# M2 V' [% \* u
    xchg    dx, es:[41h*4]
9 d# m* `0 {# I7 `    xchg    bx, es:[41h*4+2]
! {/ L, }" a- @7 M    in      al, 40h
4 A0 F$ m9 x) m2 B1 F    xor     cx,cx
7 N) Q7 h0 |- f* ]    int     41h) Y0 G) l7 q1 ]( ]- ?8 Z% Z
    xchg    dx, es:[41h*4]
1 ^( M/ t  v7 d! ~8 n/ N3 S    xchg    bx, es:[41h*4+2]
# r( j: e) h- A, e# N; t    cmp     cl,al
% J: X  Y9 y2 ^& A: @0 ~( L    jnz     SoftICE_detected" u+ i3 p8 ?% Z' I1 G
" A5 h! G  _; a2 b) W2 G
_________________________________________________________________________
7 r# ?3 T9 p% @3 T+ d' G: j& w. i( l! w" B
Method 077 F. |% f, h3 Q2 I! Q
=========
& s+ D( h  q  J& J0 _7 Y' b2 [9 C- r9 Y
Method of detection of the WinICE handler in the int68h (V86)3 Y: x2 d% J. E" Z  I3 N, ~

" ?1 `: {' z( b- D/ Q3 l9 j, O$ r8 z    mov     ah,43h
3 E3 L1 v5 q4 o2 @4 w    int     68h
0 ^8 Y) J. u3 `# O, i    cmp     ax,0F386h+ L9 I: k" n% O7 R- T
    jz      SoftICE_Detected7 o  z5 z5 Z1 X& u0 U

. i/ ~8 J$ s  a( T. s1 v- y  I
) r; @5 M! {( Q=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 S8 |, C$ `! `' V. K- Z7 }2 i, D. C   app like this:+ F1 Q  c, V( o$ W

3 g- j/ K; G* |0 L) V+ }* a   BPX exec_int if ax==685 B* D4 K8 _# m- i4 `9 B
   (function called is located at byte ptr [ebp+1Dh] and client eip is+ i( p# J4 i/ ~) s) @6 F. [4 p
   located at [ebp+48h] for 32Bit apps)6 `6 u  l% _% G$ f3 C5 ~+ w1 U8 Q
__________________________________________________________________________
- f; w; X  G' o% q2 ~* f( j4 T+ X% P( u. v- t2 m
% K/ p/ j8 J% S6 T
Method 08) z' ^- c6 I/ |/ I
=========$ a) f  T8 x! U8 \5 [
. c9 u$ Z1 g9 s' {' B
It is not a method of detection of SoftICE but a possibility to crash the
: F4 `3 E' X* x2 @system by intercepting int 01h and int 03h and redirecting them to another
7 u+ q. ^2 H3 G8 k# @8 Groutine.8 M% j; f; ~) E/ E5 _
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ E3 H1 P" P9 `# I* D! ?- }
to the new routine to execute (hangs computer...)3 W5 k1 Y7 W/ ]

. o8 H! i: }8 k    mov     ah, 25h
( P% U- m6 [) a% }7 x4 N5 `    mov     al, Int_Number (01h or 03h)9 W& B7 D* F$ g* ?/ y
    mov     dx, offset New_Int_Routine
, f4 t$ T/ U$ ?0 h- \5 ^* B7 h    int     21h
6 m0 M, ], b* t2 W* i' X+ P4 Y& V: _8 D8 x: L5 [
__________________________________________________________________________( ?5 R7 q5 {1 F2 W
; S( ~! u7 C/ |( L4 |) t* s; O
Method 09
  ]% ?9 T, P4 y9 W) W=========
% ~" R, Y' M" d& S5 R& w4 j( H) Q. J! X! k! Q3 ^, C
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only, ^2 k: |% _% I" q4 b: o& X
performed in ring0 (VxD or a ring3 app using the VxdCall).7 m' H& Z2 i+ j/ l
The Get_DDB service is used to determine whether or not a VxD is installed
; i9 r4 x* R: b' ofor the specified device and returns a Device Description Block (in ecx) for" U9 u/ P9 c) ]! M% k  D
that device if it is installed.% Z. j* i+ {% i: k) q  f! r' k1 K

: ^2 ?2 F" J" T) ^$ t# G3 a   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& J( J4 w. c5 V# o4 H2 h
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): v: K# d( D7 q4 A% q
   VMMCall Get_DDB
$ X4 B6 F: J8 o$ d   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
$ v# V0 A3 n6 A. d+ ~& \
& Q! ?& C4 \0 ~Note as well that you can easily detect this method with SoftICE:
/ ]  r* x. s/ x6 ?0 t/ X; L   bpx Get_DDB if ax==0202 || ax==7a5fh
5 P9 y0 K" D& X1 M# x# i' b7 q
( i) \( S0 D8 I6 D+ r__________________________________________________________________________
' D1 G9 [* V( E) ~6 X" @, v! p" a& b/ E1 f" g
Method 102 L! a" c' ?( c
=========  G& v- h! [  K  e2 Y( I1 `4 b8 P

+ j8 {) [) ?- @' S! N=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 N/ j" j3 n- ]6 g
  SoftICE while the option is enable!!
+ [* z% j% d/ c- |/ D
+ |2 ^& B; a- J0 k$ h8 XThis trick is very efficient:! x6 ~8 E6 C* P5 A
by checking the Debug Registers, you can detect if SoftICE is loaded
+ f9 D  }9 D5 @  A( D2 Q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ [% p2 U" }; V( Q, O4 U. {( S) gthere are some memory breakpoints set (dr0 to dr3) simply by reading their/ V" Q/ c! [1 P) D( Y6 _) u) i
value (in ring0 only). Values can be manipulated and or changed as well
, Z# Q& S- {2 P# j(clearing BPMs for instance): ~8 M1 e1 O. m' b- u. p

- k$ i6 O! n( @# D+ B# Y) ~__________________________________________________________________________
' Y; I, V+ Z& A# ^
+ N/ x# v) L3 f, [! L7 V( N: HMethod 11
( I  R" ?' N4 K3 D2 s) ^=========
4 l+ o8 X- V" p" |* G' d
( y. ]/ ^9 ^* ?5 L8 `  YThis method is most known as 'MeltICE' because it has been freely distributed
1 G! M1 p" A5 C7 r& v4 Ovia www.winfiles.com. However it was first used by NuMega people to allow
& n, `% `6 [/ B2 z. `Symbol Loader to check if SoftICE was active or not (the code is located% J) l2 \7 m* n2 K6 t* f
inside nmtrans.dll).
$ u4 X/ ?& N8 w: `, r. H$ \4 I
+ P$ F+ z4 N; _' i' J, kThe way it works is very simple:
/ n' g  x$ l& Q! LIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
1 e" ]4 W3 _7 IWinNT) with the CreateFileA API.
. p0 X  U" F! M  ^! x/ E/ m, m. |# B
Here is a sample (checking for 'SICE'):7 R( r% |; s4 t* }
  a4 _+ s8 U: k9 K
BOOL IsSoftIce95Loaded(), z0 d. v- t! E
{
- z) H% X9 K7 M& I* H   HANDLE hFile;  
# y8 R- M% B( g& y   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' N3 ^9 n% X" M2 h3 E                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 g3 L( s) G) x8 g% |% a6 l
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ Y  {7 e* C. K, H   if( hFile != INVALID_HANDLE_VALUE )
$ i: ~, E+ y& k0 c. @0 @   {
8 n9 I. K4 |5 N7 G" j/ V6 v+ S1 w4 L      CloseHandle(hFile);
5 \9 J- }" }7 n( I# r      return TRUE;3 L# c3 Y# O. b+ O7 E+ _
   }1 j, M* l% A' b# z! [
   return FALSE;5 B  D% x) ~! c2 k6 t7 \1 W
}: A$ F# T! v# q( t% }0 V

- y1 `, h+ V* ]) JAlthough this trick calls the CreateFileA function, don't even expect to be' e+ W4 f( D, C
able to intercept it by installing a IFS hook: it will not work, no way!% h! Y6 \0 E9 ^9 p2 T
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
. S- G# u9 U& z$ n; j$ r+ dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( A+ l% Z7 T0 }) K7 U/ Q* {6 I
and then browse the DDB list until it find the VxD and its DDB_Control_Proc4 S4 y0 `. f' t  i' u
field.
1 f+ T" P# N, [0 T1 NIn fact, its purpose is not to load/unload VxDs but only to send a " ^7 u9 R" j7 h  s6 I
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# |9 D9 [) p, g' X
to the VxD Control_Dispatch proc (how the hell a shareware soft could try5 e1 Y9 h5 m; l0 \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# g1 [, j  w/ n6 P+ BIf the VxD is loaded, it will always clear eax and the Carry flag to allow
3 m8 r6 x' t; I" c" A- ?its handle to be opened and then, will be detected.
, w, C! T2 ?( J, ?! _You can check that simply by hooking Winice.exe control proc entry point
+ Z* H  j* d0 g; ]3 Ywhile running MeltICE." K3 q9 F6 F) }; H: q% \- d; O
6 h: ~- B2 J6 X& z& U, X  J
5 h- ^$ [) J  g0 t  Z6 O
  00401067:  push      00402025    ; \\.\SICE
! m- z9 W2 u) H& O  Z2 c  0040106C:  call      CreateFileA
# _3 u: ]6 y# u6 e0 R2 P  00401071:  cmp       eax,-0014 h, l( d  P+ h8 L) ^" Y
  00401074:  je        00401091
- R# S, x( f7 j+ r/ _3 g# ?" d/ Z6 Z' ]; J

2 J! u1 M* q8 P3 cThere could be hundreds of BPX you could use to detect this trick.
" g" u+ b0 l$ ^! O1 U1 I- q7 j9 U-The most classical one is:
8 A& T* |3 h; H2 L+ R  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||: S! N. ~2 y5 z! R
    *(esp-&gt;4+4)=='NTIC'
  r, ~- R' T! N0 I! B
' [3 a: I4 V/ B: \/ s1 B! p-The most exotic ones (could be very slooooow :-(
0 R% R7 V8 N) d- \   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" {0 [7 ~5 t$ ~( \& {8 C     ;will break 3 times :-(
* B0 s/ C8 x1 Y$ H$ R8 o4 J! H2 U) j, Y0 S3 j5 r' i* ]
-or (a bit) faster: " f: X( d( T/ y  Z) ~0 Z# ?
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 }% }+ Y8 _" Z, L3 C$ x' A5 L
; T9 N# J- @7 N( a% k( T   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 ^- x/ |+ n' ~" Q8 [     ;will break 3 times :-(( s, ?( ]* u8 R! }0 t+ P8 |
5 Z5 v0 U' e8 h' f! D, g9 T
-Much faster:
; z. s5 J( w( ~) t% I& {1 r- O4 p" d   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 ^) D0 J3 p, P
% r) K/ R( r" Q- F* l2 yNote also that some programs (like AZPR3.00) use de old 16-bit _lopen, k/ P$ h* y) v
function to do the same job:
5 R) q! L+ ]5 z5 j
# n4 V6 g6 E0 q! ~% v2 P% S   push    00                        ; OF_READ9 }# \4 U3 M" x5 x
   mov     eax,[00656634]            ; '\\.\SICE',05 R! x) F; W! g
   push    eax
* }/ |* q$ u4 w! z% R   call    KERNEL32!_lopen
' d% Y8 ^6 f7 p( L   inc     eax
! z; q; V6 @; l; F* |   jnz     00650589                  ; detected7 Y7 _% C& [* f& R
   push    00                        ; OF_READ
3 C+ E) V, \; ]% _1 Z# k   mov     eax,[00656638]            ; '\\.\SICE'
! N6 @  y3 @( k* e/ M   push    eax$ S# Q) a/ G: B
   call    KERNEL32!_lopen2 V% ~. ^( J$ D0 ^6 t& d& }: n5 u: `
   inc     eax
5 t  E1 o3 |6 p* W0 k0 J   jz      006505ae                  ; not detected
# A2 M- f1 x+ S: z/ b. w$ Z6 H# r; m
+ p0 P" _; |0 N5 _/ t3 Q8 L
__________________________________________________________________________( F4 ?( x% ~7 M2 Q2 N4 Q0 h

7 {" V6 u2 s8 P+ K' g: sMethod 12
$ C) X: X6 n, h( t' z0 S% M=========, J* ]$ W/ c" G1 z' @8 b' N

9 l* ^) X1 Y* j  z- N9 MThis trick is similar to int41h/4fh Debugger installation check (code 052 D$ s# Y8 u9 L* r" O
&amp; 06) but very limited because it's only available for Win95/98 (not NT)5 r/ t5 M$ K- x: z* u2 A1 U" X- N
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 W, F- v! h8 Q$ u& R

9 i2 ~# n$ i" m( n2 u   push  0000004fh         ; function 4fh2 P; d( e$ u7 d3 R3 X
   push  002a002ah         ; high word specifies which VxD (VWIN32)
6 u# P6 Q( V) u% W                           ; low word specifies which service
" F. a- a0 U6 U) j8 V                             (VWIN32_Int41Dispatch)
- u; X$ ~9 q. n4 L- ?   call  Kernel32!ORD_001  ; VxdCall
0 w+ s/ Z* H6 F& a. h   cmp   ax, 0f386h        ; magic number returned by system debuggers. O7 n7 G, L* m$ ]
   jz    SoftICE_detected+ t3 S( ?6 [: K' W1 \$ d+ H" s
: p' w/ }& h! X# z3 Z, J7 N/ y  Z
Here again, several ways to detect it:3 P, O" a% [6 _
8 g4 }. V& J4 U! N$ o
    BPINT 41 if ax==4f
4 G2 j$ \+ W/ Y$ Q
: S& j5 Z- R  {* J    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one+ ^# y: J( _( C- t8 I
. ]0 ^; ~$ f8 M3 W$ G2 t7 T+ `, M
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* y5 Q. F$ t3 `- L4 l
+ B5 E9 j/ F9 L$ M1 V# |. ~
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* H$ l0 n# k2 E+ ]; ~
' E) A$ y! z% e8 i/ m! P1 s$ l; b+ a. B__________________________________________________________________________9 K+ h. `% J. T
. k( x- ]4 c9 a* c
Method 13
, w# I6 H9 J& A; z* d; ?=========
) `- {$ P: T9 Y$ ]$ r. b5 D! ?; ?" t/ v. {1 P4 y% X: f  y% g& O
Not a real method of detection, but a good way to know if SoftICE is
1 C- s" U) P. o9 finstalled on a computer and to locate its installation directory.
+ E. ~6 R% L0 l, ~% c+ ?It is used by few softs which access the following registry keys (usually #2) :
3 Q- K7 H/ E$ Z
4 S1 x4 h# z4 t  c-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ x- o8 T  {/ D( b4 N% D9 \- {
\Uninstall\SoftICE$ \3 `" S. K9 C% b% l
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
: r' J3 q* l$ w! J" Y-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: O: x4 K6 P. p" f
\App Paths\Loader32.Exe
. B0 Q! z) w; L' u6 W3 d; @
" `; M- A0 f) i* ^+ T( D; o
4 V7 ~# E( @/ k" Y- j5 @Note that some nasty apps could then erase all files from SoftICE directory
0 \+ i4 _5 p$ d" E8 Q/ m9 e(I faced that once :-(
: }- c* c& _" i8 @2 }, d+ N+ r5 a9 Y( H5 b6 n: _
Useful breakpoint to detect it:0 }: {  C! W+ C6 G1 G' F

( h8 y- A  q, ]4 t     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" Y7 o9 P, I1 j% M3 }/ i: v9 x2 v* ?: _( {+ y* M4 a7 ?
__________________________________________________________________________
# d9 n8 F0 h: R. k8 P) l! u6 T% o
7 V' \* y; g. n) i
Method 14 2 j7 O, T+ c4 h( u* G2 |
=========& A2 x' R  g! Y
8 @, U$ l; o0 q  z3 y" N
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose8 {3 i* {) N  P
is to determines whether a debugger is running on your system (ring0 only).! _/ ^) k8 m. o. i) p

, T$ G9 G: S8 L" `$ ]$ n$ K   VMMCall Test_Debug_Installed
) C1 [3 z8 }, \# O) A( _6 T: c   je      not_installed' M; j7 q- J, x; L. \5 r
. U# h+ t3 a) ]1 T8 S
This service just checks a flag.
3 m+ S$ J* M" t) X+ G- d; f# F' q3 w</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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