About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ }' f, b$ B: C
<TBODY>
. Y3 R1 Z) h! \7 R, h% f* L3 N<TR>
$ f3 U# H( K8 b- {: V<TD><PRE>Method 01 . g7 |2 Q+ w9 ?" a" \7 h
=========) g  p+ H: A& a7 k  o# }# h6 I2 W4 e
- ?1 A7 n9 B6 h+ `* w% G
This method of detection of SoftICE (as well as the following one) is
( d9 H4 Z" H7 M5 Lused by the majority of packers/encryptors found on Internet.' ?* m) Y! R4 t
It seeks the signature of BoundsChecker in SoftICE
% ^. f( H, |3 |+ \* E. P3 l, H& d" R6 h9 u% d+ ]1 f8 Y
    mov     ebp, 04243484Bh        ; 'BCHK'
* i' D/ F! S+ o9 I    mov     ax, 04h
6 v$ S# u3 i8 u1 d$ M- y8 _    int     3       7 e8 k* j2 R% T" A3 ]) W6 ~0 z
    cmp     al,4! g9 ]* W6 S* S- w' f9 w
    jnz     SoftICE_Detected' ~; L4 P4 j3 s
) P( a# g; I" k2 e) U) W2 k
___________________________________________________________________________  R6 x8 {; @  }) N# g% {, L* b! \" f
7 H6 G1 ?2 L7 X( E, i
Method 02
/ h% ^7 d8 N5 x' l1 h5 |$ a=========+ G) H4 Q+ Q0 l# n5 P/ r

1 a; V  ~9 n: e& MStill a method very much used (perhaps the most frequent one).  It is used, h6 \& Y: n4 W! m
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
- l* I" z( J* R0 \& j# O& vor execute SoftICE commands...
& a: Q! `" i' A1 o4 x" E1 e, {It is also used to crash SoftICE and to force it to execute any commands
* i9 F( t% N* J(HBOOT...) :-((  % j7 u0 p. ]$ k6 a- n
/ U) u! i4 U5 C9 q& i/ M
Here is a quick description:
* q+ O, z# U5 D4 M3 `6 T/ Q& I-AX = 0910h   (Display string in SIce windows)
8 |* I1 x7 Y8 A/ G' g- [$ X-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. ]0 |" Q( l! _-AX = 0912h   (Get breakpoint infos)
1 }# l9 M% F% C-AX = 0913h   (Set Sice breakpoints)
5 |4 F9 O+ f! l3 m* p* i. u, X& f-AX = 0914h   (Remove SIce breakoints)
: [( o- J# V' C  \3 C) C8 |; h
$ {' p4 l- g. k, v+ m( HEach time you'll meet this trick, you'll see:& C) i* O0 s) L( q1 }% l  o
-SI = 4647h
  r5 c6 ~9 g1 ?6 R/ Q/ z4 P-DI = 4A4Dh
' n& P" j/ @) E0 B0 @. R& }7 Q* uWhich are the 'magic values' used by SoftIce.7 ~+ x6 ~( M) E, c1 U+ @7 `+ q
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" c) S5 u3 U6 d; P% K5 W& C3 I3 I7 d7 F) ]# z0 V( k
Here is one example from the file "Haspinst.exe" which is the dongle HASP& Q+ \  `7 Y: o4 \, g; M9 f
Envelope utility use to protect DOS applications:* Y& g+ ]: F: X
( d8 ^2 T0 Q6 a, ~, a# {5 e( V
0 a  j0 a( s+ c. \
4C19:0095   MOV    AX,0911  ; execute command.
4 P' }; m/ e2 Y8 w+ r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 p1 k* z3 ~5 x, @/ R4C19:009A   MOV    SI,4647  ; 1st magic value.2 u1 h: q! K  s: l# C6 t
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
9 b; R: v! o. _4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*), J$ x( y8 j! o$ @
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; p/ v) [; F, V4C19:00A4   INC    CX7 ]# M( ^1 R. {# K# n$ o( _6 p; Z
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  F' @' Y6 u, x) a) c: U9 D4C19:00A8   JB     0095     ; 6 different commands.9 u% W, W; q' J# J( ?
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." H# m# k4 [. g  \. {; \
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 S  e6 p4 z* [9 D1 p5 G( w7 O

4 i) Q6 B" C9 G7 J1 {& K$ X/ nThe program will execute 6 different SIce commands located at ds:dx, which
! a% L4 M, E4 w3 J" s0 pare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, V. X2 ?! }9 N/ s6 V. J) f, D  P
$ T) m( x; f" o4 f& s- w6 u5 `* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' O. ^# M( t) J1 |8 y% F3 R$ U
___________________________________________________________________________. G: }# G+ k9 t  R  V

7 y0 \5 d/ X9 P$ O5 V$ y, u3 I9 u3 i
Method 03
4 F  [- @$ s. A& H  l! o=========
- ~, Q$ {2 A0 K
% j4 Q4 O6 ^8 ~  W. p5 ]! _( ZLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, Y  t) o9 d" V0 L/ d(API Get entry point)
4 }. `% L% R" A+ j7 H        ( a8 z5 }& I, t$ W

, y! R+ k+ V3 c# L1 @" X0 ^    xor     di,di+ J# v8 s- h! i3 P8 j8 |0 V- x
    mov     es,di2 E9 V* x' ?' J9 r  b' e8 A& @
    mov     ax, 1684h      
2 {) A% y1 F% h. V; b& ]    mov     bx, 0202h       ; VxD ID of winice
' d$ I; c( Y' e8 Z* x( |    int     2Fh0 E- x( F; v0 `. w- V6 ~2 F
    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 Y6 o' h! k# B% o8 i  n1 H9 H6 B
    add     ax, di/ W3 Z) \) d$ s$ I' _
    test    ax,ax; |2 F, }( c  }( v. O- o& K
    jnz     SoftICE_Detected
" o+ }& B: B0 [# n" G7 ~2 ?1 Z! }" z/ I6 W) Q# |/ d
___________________________________________________________________________; ?& J/ T" S9 ?8 R5 p6 t
7 |: }" w2 w7 ^8 N: F
Method 04" p' n2 A- e! o. e) D% [
=========( @, L4 C/ H6 J$ C, w
, s0 r/ |6 [1 Z- ^5 f
Method identical to the preceding one except that it seeks the ID of SoftICE
! ?# s5 O: |' {! s* x8 T# j( Z+ yGFX VxD.2 ]' j5 y4 S# C' J2 h/ Q+ k" |
1 Y! _+ e2 i% y# b
    xor     di,di
0 M8 N' |# S$ k  v5 n    mov     es,di; Y* A& g9 y! a" K1 ~3 d5 u
    mov     ax, 1684h      
: k# V4 K; n1 o    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! U) w+ R+ y7 g    int     2fh! k" ]/ s) R: x3 D, z; ?# d9 t/ ]
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& ~; d& T9 t7 G1 y    add     ax, di
: M+ `8 P* P0 q2 w9 f    test    ax,ax& |6 W$ G, t) J( c; Z/ G- t
    jnz     SoftICE_Detected
" a" D  t1 B$ V2 N- v  G. E8 W  X+ [* j& q/ X
__________________________________________________________________________, n. [, \$ U2 H- s( ?( P' h" R

- p8 l, u; K  i& G% D' p
- B( B- Q4 f2 `6 r- OMethod 05
. w* s7 \' `* b  K. L=========
9 P" p# q: K+ C
5 U% c) ?# W* `5 a" ?& E3 N- a6 WMethod seeking the 'magic number' 0F386h returned (in ax) by all system
: B7 e6 o4 j+ ?* \* c. Zdebugger. It calls the int 41h, function 4Fh.
* J) U) ~; v! j1 M2 _There are several alternatives.  
$ V2 D- _2 ]8 B8 ^- Z8 D; p, d8 P
5 T) R; w- x4 t4 z7 H9 T4 l' p1 OThe following one is the simplest:
& V" [  V& }" e2 d" W% L& [/ V1 Q
    mov     ax,4fh/ t& _* E2 @+ C  c
    int     41h* E8 Y2 j8 e, _' ?) h
    cmp     ax, 0F386
  W) J' i5 c# i5 j# [0 L/ ^* P    jz      SoftICE_detected" ~" Q7 O# O4 f7 \9 H  }  s

- K$ D3 O7 }, L2 X! r9 h* \
- Q, C- k8 {& N  ?% ]% j# fNext method as well as the following one are 2 examples from Stone's
0 M( v, ?# o% }8 V3 k5 g9 I"stn-wid.zip" (www.cracking.net):) N* G& R  i) A8 t8 k

, E" k, @+ C" `    mov     bx, cs
% O9 T9 g% C$ q: ]8 O7 H" s# {, y    lea     dx, int41handler2
$ K7 ^. e+ a8 c7 \    xchg    dx, es:[41h*4]7 v. P- a8 B3 G( u' ^
    xchg    bx, es:[41h*4+2]5 _$ d  Q# p7 t8 G1 ^
    mov     ax,4fh
% S0 I* ?/ `( c    int     41h8 t: T9 T; }+ H0 o  r" c
    xchg    dx, es:[41h*4]1 E" R; G6 e4 `5 _+ d
    xchg    bx, es:[41h*4+2]
2 N9 j: j& u9 f6 W& g; h    cmp     ax, 0f386h" V  e' Y0 \1 O8 C& h/ P
    jz      SoftICE_detected
* F" H0 i$ m9 {- O. }! r5 |' v" Y: t4 m( d3 X
int41handler2 PROC; ?/ }8 {  k' e
    iret. `# `1 g2 l: y$ m8 q
int41handler2 ENDP. t$ h: x% \% Z" A+ ^1 s

7 E( F9 S. X$ }' R' ]4 Y
7 o3 w9 c( s! [% O# V_________________________________________________________________________
+ E' {6 d$ L/ t8 w/ ^$ M8 U$ Z  r5 C

& s3 g* ]! n( _# D9 d: C0 K7 v) e/ cMethod 06
$ `: q+ t, l  z6 u=========
7 a/ Q0 x! T% ]  G" ]0 Q8 u
+ P$ s  S/ l- n! s+ D  n. g5 K
) D+ ^3 l9 Y$ @' F$ `$ I) K2nd method similar to the preceding one but more difficult to detect:8 W2 s+ `4 p7 e: t6 |- t
4 q4 b" |7 l, _2 h& h; W
, L+ t/ o# l3 [. R2 `( Y
int41handler PROC. g( J3 p9 r4 k; l) n5 Y. X
    mov     cl,al
, a1 U. l, u; A3 }+ Y7 f! x    iret* h4 I. F$ i0 _3 y  `- D% t
int41handler ENDP
4 E' ^% _  Z0 G% s% y  U8 {
; j, A1 H6 H3 U& o
0 [; y# Y3 S6 ^. x9 x, ~- s3 a4 ~    xor     ax,ax; P2 V' |. T% p: b% ?& S# A
    mov     es,ax+ U* W" H$ h1 E$ L
    mov     bx, cs1 l4 Z: k# b& o% W: E0 ?" y3 f) R, W
    lea     dx, int41handler
9 V% R. e4 p' W* X! ^    xchg    dx, es:[41h*4]# [8 S6 X* Z& P8 K
    xchg    bx, es:[41h*4+2]
) g& k3 b& G. q. ^    in      al, 40h2 Q! B2 |" o. a7 V0 B
    xor     cx,cx1 Q$ v* \1 G$ @4 n1 [6 t: z
    int     41h, W* x; k$ v2 l9 W  {8 r: t
    xchg    dx, es:[41h*4]4 S% A. e  p; Y: {5 f9 z" c( A
    xchg    bx, es:[41h*4+2]
4 P& C! q- ^( @2 Y    cmp     cl,al: R6 _0 @7 X9 P. e8 r0 u
    jnz     SoftICE_detected+ X6 ~  X" q5 G' K0 Z! U
0 c, P& c3 D: u" O7 t
_________________________________________________________________________4 b4 F, w- g* K
* H- E" W* e! z7 M5 b0 I5 D. f
Method 072 m! p2 V+ D5 f- z# `6 T
=========( Q! l/ E( P3 ^" C

1 D$ M( N4 y* @: n2 L- aMethod of detection of the WinICE handler in the int68h (V86)( F0 s1 H. Q; Q

; Z% h/ g; _& Q    mov     ah,43h
0 u$ B8 |% O6 d$ `# \8 u* k    int     68h
1 ?4 y# q3 a; V6 Q! q# H    cmp     ax,0F386h
+ F! i7 ^# U- J    jz      SoftICE_Detected
5 o# j' ^# e5 a" [2 x# S) T5 ^! X, h- c  J6 a; Y
0 H9 c+ y$ v; v. ^2 H  c
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ A' V& P; d& \+ w# o
   app like this:6 N( j8 w1 m, {; m9 U2 M8 V
, f* K) D: q" y, o5 n. y
   BPX exec_int if ax==68! f( V4 E! o7 F0 u, n0 L1 C
   (function called is located at byte ptr [ebp+1Dh] and client eip is4 D: o: C9 v. B* {* Y
   located at [ebp+48h] for 32Bit apps)
! U  e" i1 D6 d0 ^: L, T% ?5 [: e__________________________________________________________________________* p& B1 r; d9 u5 m

/ \( g+ O6 Z8 j" n
6 I& z9 `  ]- [0 _7 Q/ uMethod 08
! ~1 X+ C& Y; }! \=========; o* p% J8 M* x9 w! W4 F+ U

1 y) e% P1 ]7 P6 V* n; vIt is not a method of detection of SoftICE but a possibility to crash the
. ?; l- c& \9 zsystem by intercepting int 01h and int 03h and redirecting them to another; K- K7 [9 K0 x, V7 W
routine., `, r$ l& t/ f) i: Y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' ]  F; k1 }& _9 l- yto the new routine to execute (hangs computer...)
( I) B0 B1 @$ u  w
1 u4 K; a1 i8 y& V9 Y, L' p8 X    mov     ah, 25h* g4 l, [- `5 ^  q* Z7 @. F
    mov     al, Int_Number (01h or 03h)5 b0 Y2 Q: N+ r, ?5 g: G7 w1 j
    mov     dx, offset New_Int_Routine
& j# g0 ?; i  D4 s+ l    int     21h7 M- R% C/ O/ H! m4 @
* B" v; u4 l- n0 l" \
__________________________________________________________________________' a0 p4 o, b& J# H$ ~
$ j# M. ^# ~7 F) D
Method 09$ X. X& L7 T- ?& \. J, T: ~
=========2 Q# \5 t* c2 h1 D. H. V

: C% t7 I" {1 o+ e1 _. iThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 ?6 J4 k- c; G; X1 R5 T) z1 e
performed in ring0 (VxD or a ring3 app using the VxdCall)." K- g0 V& z, b/ c
The Get_DDB service is used to determine whether or not a VxD is installed. f. W6 v4 _% c" D7 `' X
for the specified device and returns a Device Description Block (in ecx) for
4 K/ _  J4 {) o; Jthat device if it is installed.' x. K1 R' ]' X( m% e8 Q

9 f/ T' |) ?+ f/ ?   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 `: g9 Z: U1 s) y5 x
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( R6 l- @8 ~/ [5 i& l% l* S   VMMCall Get_DDB' A# n0 G- L5 L3 ^) F- `8 q! M. X/ w
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
0 Y! h' _; ~+ c0 P" n; }" S
) U; \4 r' H4 _1 Q/ c) CNote as well that you can easily detect this method with SoftICE:
, U# a3 d, t+ u4 Z# I' {3 I+ D   bpx Get_DDB if ax==0202 || ax==7a5fh7 ]. \3 W. o8 }3 h- B
* ]( I* F  E2 _  r; b
__________________________________________________________________________7 O  \5 s+ P/ p" g2 |4 r8 L3 y

; u7 t# U) R7 |3 G3 tMethod 108 h( L' [2 Z6 N4 @; F$ A5 d1 ]$ c/ C) g
=========$ F3 r( v' S" }+ h" p% e( P" ^" U; S
4 S" f# n5 K. n( X% r) t
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' s" u0 _! p: {' `7 @" ]0 O0 }2 |7 k  SoftICE while the option is enable!!
; H' B' p, J4 K# _6 ]* L
$ _. f4 I: z0 ~This trick is very efficient:
3 f5 \+ x/ T9 d- }! F; F6 dby checking the Debug Registers, you can detect if SoftICE is loaded' n( G! }1 A4 F! H/ O5 o! |
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: b+ F- o( Z" k/ {; F2 _there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 F/ F/ ^1 n- g/ H/ bvalue (in ring0 only). Values can be manipulated and or changed as well
* c, q5 Y( M0 b" [, h+ m* ~(clearing BPMs for instance)
+ E$ L4 U& s/ R0 S& u4 r/ f. b4 J, |% J* p& d: p
__________________________________________________________________________
3 m) X  d* z4 K3 a. `" x: e1 S) x- V
Method 11
5 F# C5 h# ~7 G3 U" z3 B! X=========) t! k6 r' ?7 z! T; s7 C
7 T1 d+ ?  }9 z# h" V" }( R
This method is most known as 'MeltICE' because it has been freely distributed$ i6 P0 d* Y/ E) ?( T7 y- j: o
via www.winfiles.com. However it was first used by NuMega people to allow
7 I$ e# g" [, h3 H2 ^! BSymbol Loader to check if SoftICE was active or not (the code is located
: D2 U( B% _& t* t) N+ O; s" z, ~inside nmtrans.dll).
0 s$ D0 R: ~4 p) v  R; K
! E! w* g, A9 \- q7 Z# jThe way it works is very simple:
5 I  |  I3 G! x& e1 _+ YIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# v  |+ Q- z4 O
WinNT) with the CreateFileA API.& ?) ~2 u$ E0 R8 V- k2 T% [: E9 @

6 ?- J0 s  \; y. Q& jHere is a sample (checking for 'SICE'):
8 x) x; L! {, }9 x- O7 l, B8 n, @6 m7 a8 ]& W0 z3 R  k* J
BOOL IsSoftIce95Loaded()
& p; Y* ~  }" d4 g0 x* `# K{
4 q+ Y! e8 T# B  i   HANDLE hFile;  
6 X* h! [2 t9 u5 J) Z! u   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
; J( M  b$ a' F9 e+ \                      FILE_SHARE_READ | FILE_SHARE_WRITE," y! u( ]( X& N- \6 g
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 Y* W  M, k1 ]   if( hFile != INVALID_HANDLE_VALUE )% g% E$ D# `* ?% ^2 c. D
   {
& X" Y8 F: S/ R' i  M      CloseHandle(hFile);* k) |/ w  t! ?4 T" Q
      return TRUE;0 c, k6 y  e  [  R3 _/ o
   }) F9 Y: A5 L3 ^6 G5 J; S2 v, ^1 b* B0 t
   return FALSE;% C& z  U& n& u7 a8 d  C2 `. B$ L
}
4 e! o4 B: f/ z& R3 ^8 Q( U/ S6 U' `# m' O$ p1 h6 ?! l- D: f# u
Although this trick calls the CreateFileA function, don't even expect to be
) s* ?6 o0 j  x% \5 G0 Iable to intercept it by installing a IFS hook: it will not work, no way!
: f9 J) a" F! V9 v; z  c' oIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
7 _" C/ F6 T8 v7 N$ y3 vservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" A* g: Z& T0 b% yand then browse the DDB list until it find the VxD and its DDB_Control_Proc
9 Y4 m4 Z- U9 k& O: S$ h0 t+ xfield.
3 j4 a6 p/ |: a' s% X9 AIn fact, its purpose is not to load/unload VxDs but only to send a
' G' O4 `5 c: O3 P- mW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE): a! v  _  h3 B6 i0 L
to the VxD Control_Dispatch proc (how the hell a shareware soft could try  B1 E) c* W' l
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
; I+ j& i  e: f5 B7 A. BIf the VxD is loaded, it will always clear eax and the Carry flag to allow
) A$ H* e  S- K) J* \its handle to be opened and then, will be detected.
# u3 y* X* x, i' J  f2 iYou can check that simply by hooking Winice.exe control proc entry point
+ S3 \* e1 K/ r1 d! s" Fwhile running MeltICE.
) W: O4 j/ o/ `5 ~# ]' ^( D& W6 t% ~( w# h$ _  `

3 w& F" S: e2 k! z* @( Y- y" n  00401067:  push      00402025    ; \\.\SICE* n% i( B8 _' L4 R. w6 t
  0040106C:  call      CreateFileA- v  Y1 M5 ], Z+ C+ n' m
  00401071:  cmp       eax,-001
/ B/ X* E$ z, K9 T, v  00401074:  je        00401091
3 N1 y- v4 Y: |  Q7 {5 S
% O6 ?' n- R' y/ _: k; E4 k
$ J% ^' m# `, T* Z" N# JThere could be hundreds of BPX you could use to detect this trick.
& P3 M! U4 f% C: g* S-The most classical one is:
) ]( }2 Z. @7 U8 d  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" R8 a2 d& Y, t- _
    *(esp-&gt;4+4)=='NTIC'. w" j( |/ b" c1 Y9 l. x  s
4 p4 j7 V1 H" k6 ?* m3 L
-The most exotic ones (could be very slooooow :-($ q5 B. \7 z1 `1 c
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
2 m' T8 m. f" \  O0 C9 O2 d* ~& F" l1 U     ;will break 3 times :-(
. R( I3 a- R/ B, A, N1 w; [# ]
# u; c+ X3 z' e9 Q-or (a bit) faster:
9 V7 u# Y% `0 q% x7 D" C) b. t   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) R' Z2 o; Y' G! F* `

2 `+ R1 C  i1 n7 a  H, r, O   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( l8 O0 I  o" s* u& U
     ;will break 3 times :-(" H, @0 ^/ a0 [4 A: K

7 x' W9 r+ X3 J2 s: I" P-Much faster:6 b+ |# h; |* [6 c% t! U- y' }
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV': s$ g: o# y+ r6 z6 s
. J/ I* x- ^# w+ L
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 T# o: B# c) G  v0 H  `/ T+ ifunction to do the same job:/ \$ @7 `' r6 i. O: D8 q1 D
5 Z. V+ L# {/ b
   push    00                        ; OF_READ
- w: C' A9 o. o+ F+ ~  b   mov     eax,[00656634]            ; '\\.\SICE',0  a4 h) |) N2 w- ?# l0 h- X& P
   push    eax+ u9 b& O( F( r/ t
   call    KERNEL32!_lopen
$ t% M* D1 F5 a# a* Z1 P- K4 X   inc     eax
! A/ Y# j9 q: H  |" U9 b9 f5 |" Z+ D   jnz     00650589                  ; detected: n4 l: q9 V; L3 c. H
   push    00                        ; OF_READ9 W3 }) C; I) W7 i( h- |- v& R
   mov     eax,[00656638]            ; '\\.\SICE'
2 J) O' g6 L9 r7 s3 _9 g- q   push    eax
6 h8 c8 T: p6 h3 J   call    KERNEL32!_lopen
- K- |% h2 X1 @  }& f6 F2 v, d   inc     eax2 n# _5 |) i/ z6 H4 _% ?' R
   jz      006505ae                  ; not detected2 p( t! g+ u! A* q) o; `4 d

/ q3 U3 |) q- V1 f+ f5 x" J
9 a' ^/ I$ P# j2 Q/ t5 ^) ~; p__________________________________________________________________________
6 Y  {, d6 o9 a7 \, I( }3 E1 P6 C) X) Z- L; l
Method 12! j9 {1 d, o  m0 M; ?3 k& v! o/ W7 I
=========
2 n: z/ k2 r7 x% N- _" O  ~% u) i& S6 N" d* Y/ A
This trick is similar to int41h/4fh Debugger installation check (code 056 J  @$ h& z# x! O9 u
&amp; 06) but very limited because it's only available for Win95/98 (not NT)% v' Y- I: M+ X3 b
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.. l( Z) z. L) j" O
. T' ]# M$ E. i$ ]
   push  0000004fh         ; function 4fh5 a3 a, `% [5 w# i
   push  002a002ah         ; high word specifies which VxD (VWIN32)8 Z8 G. ~5 g3 G
                           ; low word specifies which service
! D8 W3 p- w# H% E' K) s                             (VWIN32_Int41Dispatch)+ r$ j; O7 `( Y  Y
   call  Kernel32!ORD_001  ; VxdCall+ ?6 N7 G) R, `0 [, B# X
   cmp   ax, 0f386h        ; magic number returned by system debuggers
: {3 q1 l& L; m3 d# q   jz    SoftICE_detected4 [' f/ i# F) E
3 J8 ^! V/ e* N( r9 W' a
Here again, several ways to detect it:
7 o) c8 u" ~  k  Z7 ~: Y
( L7 \  F: G- r4 r1 E8 }1 k    BPINT 41 if ax==4f
# [- V# z/ d& r" m) ?! h! h( @( m  K
2 A) C9 [: |3 q+ @! h) T5 D    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one% u" U, \" ~( [* Q! s5 q" ^% S

$ O. v5 F/ _& N. v    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
7 V9 O+ m. @( e
4 A8 v; U9 f' X8 w6 D) j    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
: {) Q6 Y0 c- r$ j+ ]8 r  z7 w, B! ^& g& W( u$ c* n
__________________________________________________________________________
6 O- n) u6 s* k  ], Q7 z$ r& V# S( k% Z* a
Method 13# i# [. T+ Z" N8 o3 c$ ~4 }
=========
% o+ Q& p1 G1 S* E
; O4 X# W( X7 s1 G- lNot a real method of detection, but a good way to know if SoftICE is* G+ G3 q+ M8 ~7 r9 t
installed on a computer and to locate its installation directory.; B4 y! b6 a/ o, {
It is used by few softs which access the following registry keys (usually #2) :
2 D; d8 f( {& o$ i( M) k
) W+ z) v, R8 j: d2 B) u-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 p- S, v* H9 f: z- k* ]\Uninstall\SoftICE
! u5 }) Q+ I, E6 b-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  w" i/ U2 O$ n) h
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" o! ~( d4 W" Y9 J  X+ W\App Paths\Loader32.Exe1 s7 G( g8 }' K) k& @7 H0 k

, M9 c" i( J9 ?8 J5 o( y; P. W* q& a5 a, _" V, b3 X% g1 L9 w, g, Q
Note that some nasty apps could then erase all files from SoftICE directory
9 B/ V4 U8 G5 ?(I faced that once :-(
8 h$ U" ]' y9 k, @
: c$ D. m( B  u0 kUseful breakpoint to detect it:, z4 l, g7 J2 P* y: c0 _6 ]+ Q: V
- U) i; n5 t% ^0 Y$ |
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 Y+ A( R9 t. }! h; R2 a9 c5 ~# a9 K% r  ~7 Z. u
__________________________________________________________________________2 m: x$ \: l% \, d6 A

( W( \2 ~: V% f' b' J0 f: Z  w
Method 14
9 v0 [; {3 H4 ~, z* P# `$ K$ P=========
7 @* Z/ j2 E- ]3 f' i. E/ y) E2 N9 D: c: U) B) l' x" c( g
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose' |# K5 Y8 o; B3 O7 M
is to determines whether a debugger is running on your system (ring0 only).
) c, z+ h2 A: r/ l% T' F( }3 Z+ q8 `, _7 n4 t6 w0 @3 y! ~" H0 v
   VMMCall Test_Debug_Installed
7 ~/ \7 U) i8 i7 l, T% d* y; y   je      not_installed+ i6 |# U: t8 B  g

' G! u4 [/ |8 Q) EThis service just checks a flag.4 K  a1 T2 V% P1 Q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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