About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 w' Y+ G$ [: ]6 n* B
<TBODY>
3 S9 m# w4 g& f6 l6 N% @<TR>
- J% A8 a7 w* o' d; z. J1 D<TD><PRE>Method 01 ' e2 k& I# {+ l/ F& H1 ?3 \
=========
8 C4 `$ H/ x$ u9 t& h  J
) U1 i0 k. U& a: @3 pThis method of detection of SoftICE (as well as the following one) is
; a) ~# {. u7 W0 c. d6 z: S4 Jused by the majority of packers/encryptors found on Internet.0 {8 g& E5 |1 k. C
It seeks the signature of BoundsChecker in SoftICE
- ~: Z6 A& o/ H  k! P2 U$ ~  d7 @4 Y: G
    mov     ebp, 04243484Bh        ; 'BCHK'6 A% J& i- \9 n# u
    mov     ax, 04h' x; {# d) G7 h
    int     3       + j* \% N* N9 {0 q8 _. X7 E5 a
    cmp     al,4
- J8 L7 ]' M: w2 x# ~' P1 w: H2 F2 q1 G    jnz     SoftICE_Detected0 \) b4 X5 z" C" U& t  t- N
6 `% k* I7 ~3 V" y9 _
___________________________________________________________________________
9 S9 E! n$ h5 B+ w' U3 F+ S9 C
  l0 Y& `7 f' n' [9 O0 UMethod 028 v: D. N0 r) Q0 X2 M! t
=========+ z# E  ?/ p3 V0 J. ~9 ~

( s9 B8 D# G1 Y3 M7 H+ C* YStill a method very much used (perhaps the most frequent one).  It is used  D! R7 w# d; Q" T
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, ~' Q% Z# m. c- N" Yor execute SoftICE commands...
6 B' A2 \0 `5 L, M7 MIt is also used to crash SoftICE and to force it to execute any commands
9 U. q( U+ m* k2 M4 T(HBOOT...) :-((  " s# q4 Q: v6 u% H% S% T
) e2 A6 o! K  |5 H/ D- r) n
Here is a quick description:
$ ^4 t- \' d) z9 Z4 @-AX = 0910h   (Display string in SIce windows)
0 R( m6 v+ }1 k3 O/ X  k-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); ?0 W4 M( z' c6 R- R/ ~
-AX = 0912h   (Get breakpoint infos)! N6 w' b( b5 O
-AX = 0913h   (Set Sice breakpoints)( K/ v  A! E9 R" C! t' Q, T
-AX = 0914h   (Remove SIce breakoints)! `6 b4 V2 J! T3 @1 Q

0 x# S- v+ x  {6 K9 OEach time you'll meet this trick, you'll see:
6 A1 I& u: I0 i. y) i+ ?# d-SI = 4647h
- H( K( C9 Y$ p* h. ]$ ~-DI = 4A4Dh4 Q' @: _' p$ D7 X4 \4 J
Which are the 'magic values' used by SoftIce.% n5 ^0 y& `" ?" m# q" m3 h$ J
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- b1 k8 W1 O8 ]. N7 p* k7 L% f6 z/ i( W6 K  B- ?9 B3 [
Here is one example from the file "Haspinst.exe" which is the dongle HASP" t. i/ X6 a  P6 x! A
Envelope utility use to protect DOS applications:; r9 x/ H7 s; C) x8 h9 ?% d

: l  P& A: t; w7 R  m7 K4 T
: E) }- O0 j7 o4C19:0095   MOV    AX,0911  ; execute command.6 {2 N! i0 b% R: `, d# T9 E
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. ~8 [8 Z$ l, o( G; K- C. ]5 l4 W
4C19:009A   MOV    SI,4647  ; 1st magic value.4 _$ N, {" I- s4 n' ]* e/ N% b5 y. M9 m
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  G- a1 k, ]) J/ ?# o
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' k$ z3 O7 s% H7 R% Y# I4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) f8 O, I! c9 T  y8 S! q
4C19:00A4   INC    CX
( X) }5 c! }8 t- Q, y) k- r% u4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 R9 F, t. \" {4C19:00A8   JB     0095     ; 6 different commands.
, w( B; Y- u8 L1 ^  F1 D; r' K4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
+ H& n( R! w4 x9 I4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 a# K1 X0 j! G: R. ]5 O

. J* V/ [) ^- g) g7 E! i+ Z1 JThe program will execute 6 different SIce commands located at ds:dx, which
8 {5 _& q0 P$ t3 [+ q0 N3 ], sare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
0 h! N# ~7 X& S  A% U- c. b; o6 b4 ~1 U# o
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 [6 b4 _7 e) j4 l' K3 E' Z___________________________________________________________________________: [: b8 p6 J; e' x% n+ {7 N4 \, P
! d3 }' w$ v, p8 U; ]9 n+ g
# ~5 q# _0 f9 t" g- [! ?
Method 03
" \9 {0 r) A  i2 a- [' A1 x=========
/ v6 Y+ v0 q7 y- x( H: i) E, m
7 y- x- h  a0 j8 ULess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 \6 y/ W3 ~+ h, O. y
(API Get entry point)
0 \  S/ N) B9 y" ^  u5 F7 x6 V        5 h- A* b6 ^) G% R" ^8 J3 Z, M* @: q

* _8 w& I  n) B* P- W$ ~    xor     di,di
& Z" D5 u9 j$ e5 E7 ?% N0 a; \- q    mov     es,di
" v0 q" k) C1 G    mov     ax, 1684h      
/ n6 x9 Y: Y& D& M    mov     bx, 0202h       ; VxD ID of winice7 H( H4 U! h5 `0 Q+ I- T/ }: q
    int     2Fh
) V9 s4 a4 P+ |! J  ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point( ~7 C' {" H8 |3 Y( @
    add     ax, di
- _9 v: a, j+ y& C    test    ax,ax
8 ]  t2 k# w0 Q    jnz     SoftICE_Detected# P) ]) Z3 q' b- v
; s0 v: d; i7 e) B: \, [
___________________________________________________________________________* }( Z0 f6 [$ A4 X7 h- S* r

" y' q# a5 R! U  A" F( oMethod 04
: N. @; u6 `) J9 O# M. v=========4 {8 A) {5 x8 W- b+ F- }* `2 a

3 S% Q1 k4 p! U; x0 V: {' S/ cMethod identical to the preceding one except that it seeks the ID of SoftICE( |! b* G* E7 N! ]
GFX VxD./ q* r  F* v9 s9 n
5 y$ {5 O3 t6 \  v, o
    xor     di,di
# Q7 e" ]/ u, b  u( {( u    mov     es,di! k% o1 T" o$ p* m5 O
    mov     ax, 1684h      
9 b+ f5 ?( ~# y6 k" k    mov     bx, 7a5Fh       ; VxD ID of SIWVID
# s5 L% s$ ^. m( b/ m8 Q8 N! _( _    int     2fh1 a/ ^9 m/ y& Y2 D  ]3 x  m& g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  I! K6 S! }" Z
    add     ax, di( K  e' r; a, O- k$ c
    test    ax,ax
3 u) W7 ?" i+ F0 b, |    jnz     SoftICE_Detected
0 i. l# S, h1 [  x& z; Y1 \. K! J
% S9 S# F# d4 U$ o" H6 M* G; K' A__________________________________________________________________________
( E8 ?. K6 H  l/ d: j. i( g
9 _0 i2 X' I! L0 R% L; G
0 f' D% H, u( Y* iMethod 05) @* P) j6 E7 l7 f8 Q( k
=========
& r: D5 _( y6 X5 T6 [3 A/ i9 M2 V( _# o3 N, E% d
Method seeking the 'magic number' 0F386h returned (in ax) by all system0 N) e% n, Z5 W- l, S8 n* E9 @
debugger. It calls the int 41h, function 4Fh.
2 P2 f" k9 K" c2 sThere are several alternatives.  5 P0 Z0 c! R0 E
  O0 M  e5 A# i+ `( \
The following one is the simplest:
* m$ T5 p- E. N- s7 R' o( t/ H1 |' E5 j
    mov     ax,4fh7 ^2 j" X0 D2 v1 C
    int     41h
  E2 }# v+ f( F    cmp     ax, 0F386. F9 x9 h/ k  K8 B+ j% R
    jz      SoftICE_detected
  _$ t: N7 V& _& k2 n' R7 G4 t- a& J: N: o6 z- ?

/ P  r8 U& a, @( M% E# [2 v: a; YNext method as well as the following one are 2 examples from Stone's
; A$ j4 l! V1 X! B6 h2 {"stn-wid.zip" (www.cracking.net):3 Y3 n8 o" ~0 R4 k! Q& \
. {1 \; J' V" F+ j, O
    mov     bx, cs- T9 J( s+ t5 q/ I, X+ A
    lea     dx, int41handler28 B  G: k7 v8 [. O( F* ]/ f) V
    xchg    dx, es:[41h*4]! z% @" \/ Q7 W5 t8 U( Y. {
    xchg    bx, es:[41h*4+2]; h0 o4 k$ e* ^; [/ }: s+ O" U
    mov     ax,4fh+ h8 {( I# }" A7 u  [) P: M5 \
    int     41h
4 W# x  S' E" P    xchg    dx, es:[41h*4]
! v0 y; j( G" ~4 u4 B    xchg    bx, es:[41h*4+2]
$ o' e8 P. I! x    cmp     ax, 0f386h7 u* W* x0 g8 s3 |
    jz      SoftICE_detected) ~* V  P5 g, |4 N4 r
& c- y" J( u/ c
int41handler2 PROC
- @+ s. k0 {/ M( s    iret/ x- Y0 C- F/ \! k# x7 k7 p- V5 d
int41handler2 ENDP) d6 d, \) |/ k) s, S7 D

" O4 u+ a1 h) l; v0 N+ s( r( g5 l! o2 D
_________________________________________________________________________6 w9 [2 T% r  j0 L4 w
% e2 q) }/ w* C
( k+ b! V* D2 ~8 r, g5 p
Method 06
; C6 d1 f3 Y9 f' ]: ]=========& ?7 S& r) x; {% ^* v' Z
. @9 i# t$ e- j+ K$ D6 ]
3 [2 i; G0 i- N" r' i
2nd method similar to the preceding one but more difficult to detect:. b( g5 c& n3 p4 f$ k* s8 f
! M! F/ E( Y% B9 R

4 o  ]8 Z  H! [/ k. G3 [int41handler PROC
) D  B/ V7 I' u: P    mov     cl,al
5 J+ h8 p) N/ s: U: Y6 Z  }; W    iret
  s7 v/ ^1 _% w" I+ B% [' }int41handler ENDP
& H+ ~# l; k/ d8 f4 p. C+ c: [3 V

; o; P& q+ [7 V5 Y0 `5 t8 [    xor     ax,ax
6 c; q' d; B" H8 K    mov     es,ax- L& q3 Z" m; O* {* F
    mov     bx, cs
  n0 W" k# h5 @% R    lea     dx, int41handler; Z) S0 O; S! d$ Q# f
    xchg    dx, es:[41h*4]
- i( u* E: k0 \8 L/ S8 a    xchg    bx, es:[41h*4+2]
1 @8 f4 n, }1 C: d2 }+ H: P    in      al, 40h
" x+ I% |( ?  y$ M- Z    xor     cx,cx
) r  d' a% z& i    int     41h
& f  R+ ]5 q! e5 C    xchg    dx, es:[41h*4]
/ v3 q- B# V! \2 l    xchg    bx, es:[41h*4+2]
6 e! X" j0 l1 R, V) K6 e. T! Z    cmp     cl,al+ H7 Y( u# b3 h! X9 Z) ~! l
    jnz     SoftICE_detected$ x# \0 E1 z9 R) V8 L8 ]

0 N5 D6 X2 W& C_________________________________________________________________________
! S8 G1 v' c/ M; a& I# t
) ]2 H7 f/ f$ R' Q, V4 z& ?) q3 [0 wMethod 07$ j$ ^: D6 R. e, z$ V( T
=========) Z" g) c. e! U
5 {; c6 D6 ?/ d  V7 Z& C8 T
Method of detection of the WinICE handler in the int68h (V86)
0 d7 I! E! Z- p; _2 e8 h& ]. K9 `0 p: ?5 O  Y! e/ j  n
    mov     ah,43h9 c- S! f7 x8 u; V. E% W
    int     68h
  D5 W+ E- g2 o8 |0 Y9 ^( j    cmp     ax,0F386h
3 K5 m% J2 b1 w/ b# X  |# r    jz      SoftICE_Detected
4 e  W! m# h" `% o8 D. {1 M5 K  |

( N: ^8 F0 I3 [) T8 Z2 b5 k# z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 p& R, M' `  S) S# [( g
   app like this:
7 W+ H' F5 G& h  y6 F  o# O; x
0 I- @, ~: H- |' v/ Q   BPX exec_int if ax==68
6 Z2 P1 R- f* t   (function called is located at byte ptr [ebp+1Dh] and client eip is% O6 M  K8 S) B
   located at [ebp+48h] for 32Bit apps)
9 M. H' a6 j0 J__________________________________________________________________________
3 P# Q  o+ h# f: h+ P) e- ?0 K' z# I/ S: h
" `0 [* e( |) D3 W
Method 08
' A/ }1 ~$ k" o=========
% C( r4 Y& t  t
4 I) @9 Y4 h- B9 r& S, N) o* A; UIt is not a method of detection of SoftICE but a possibility to crash the
3 d9 z# n, R8 O  C" e) }" x, Vsystem by intercepting int 01h and int 03h and redirecting them to another
& T8 T' ~8 q1 |& nroutine.' B6 a) k$ b- m+ K. B; v" n& u  j
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ h0 B. h- ?9 _4 }
to the new routine to execute (hangs computer...)" d9 M& _6 V1 e) q2 E8 M: v
$ a+ t1 H8 I; Z* \0 }
    mov     ah, 25h
6 _9 E6 d: k9 u1 @- T; M: K    mov     al, Int_Number (01h or 03h)0 m" b$ t) e7 o0 \  D/ x7 |& P; c
    mov     dx, offset New_Int_Routine
# {  b/ `* Z, J6 I  l, A% t5 H) u7 K* [    int     21h
% D+ L) s" |/ K( ~
5 E; h6 o4 I+ c: H% c__________________________________________________________________________
* R- x  J1 T* [/ q, C* r. J
" q8 u0 D6 W" n+ I, F5 GMethod 09
  _, \( o) B& a, C=========% b7 F8 d4 W  \7 m! \
# X! ~" ^; S. O  f, t: {6 J
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 ^/ o+ j! v5 K5 _( F, Z6 a
performed in ring0 (VxD or a ring3 app using the VxdCall).7 a! ^. z3 k  l) @& {
The Get_DDB service is used to determine whether or not a VxD is installed
0 \1 _' _' ?; sfor the specified device and returns a Device Description Block (in ecx) for
0 s( H, q* ^: A+ q, x" b! wthat device if it is installed.
8 y% h. b" M0 b& h$ w1 N) Q
7 f& I5 m  p  L* S   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID" R9 R8 H& P, w4 _5 ~( S
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
$ w4 ~& A  \7 G, p, z   VMMCall Get_DDB( i& a; Q2 c$ y$ X2 `1 L( w: J
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
5 y+ c6 s! o, ?) O% m5 L1 C: @! U0 X- L" \, @! k
Note as well that you can easily detect this method with SoftICE:
( h, H' c  u0 X( i) Z" ^5 p2 ^   bpx Get_DDB if ax==0202 || ax==7a5fh9 P+ L+ {% f# h0 p7 `6 x8 \8 H

$ S0 U( B4 o  @6 H__________________________________________________________________________
; C6 D& U2 c4 x
6 @) x' m$ ?4 A& ~9 A/ zMethod 10
" Z3 U. B7 p7 z# E. L=========
# o5 _3 [8 Y- V5 {. h- D$ B/ [
' |/ ]* D+ O, \. @) W4 C=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 J4 g; u9 Z" S3 w: z5 \1 }; p
  SoftICE while the option is enable!!" y( c) F2 `0 D
6 Y9 O6 q! q+ {
This trick is very efficient:
! X/ m  `6 P" F% J* z8 pby checking the Debug Registers, you can detect if SoftICE is loaded- {2 `! q" G( n0 f* f
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
' V8 w- P6 G# ~0 O; O- lthere are some memory breakpoints set (dr0 to dr3) simply by reading their( @4 D9 `+ d8 G9 e5 ]  f* Y
value (in ring0 only). Values can be manipulated and or changed as well$ @+ P+ p9 v" V4 A( g
(clearing BPMs for instance)
0 H) r" p" C9 [* F7 C) d( C* t2 d  U. s& c. D5 Z
__________________________________________________________________________
' Z# h% V& t) a  S* K2 X4 Q
% J+ U+ _; H; f4 k) J2 R! a* I6 uMethod 11% j* N" w$ M$ O/ m' S
=========! z6 t& T* e& E0 U

1 _5 d; v" `' F0 `$ T; Q3 MThis method is most known as 'MeltICE' because it has been freely distributed
" f6 u, c. u0 Fvia www.winfiles.com. However it was first used by NuMega people to allow
) D2 E( j2 a- g3 ^Symbol Loader to check if SoftICE was active or not (the code is located1 Z) p7 E- `' n0 n+ ^+ D
inside nmtrans.dll).  D; I5 I2 Y4 \! D. _
8 H+ z+ D. [  [8 J
The way it works is very simple:
9 B+ l# I( L- v: KIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 c! o! q8 O- ?( v) V' l1 i
WinNT) with the CreateFileA API." r6 B3 G/ O+ [9 g
, k( c+ o9 ~- n/ ^: W; c* s1 R& y: {
Here is a sample (checking for 'SICE'):9 r: Y( }- c$ a2 a4 ~5 A* i( F; k
0 O2 ^% t% x, k7 r8 l7 P+ m
BOOL IsSoftIce95Loaded()' [9 `2 E2 [, F- S
{
' O6 Y+ \* w: I/ [   HANDLE hFile;  9 F9 r; Z9 W% t2 L1 ^: h
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& C9 y# b% n4 E4 d: ]3 K                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 C2 y7 W5 t% T3 X1 P! h9 Q* Y+ ]                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  e* c; z7 ~/ e6 ^
   if( hFile != INVALID_HANDLE_VALUE )& ^7 ]  x. z7 {- N7 v! T+ i+ Z
   {
1 q- P, }/ A+ x7 ~      CloseHandle(hFile);/ S. K# ~7 v& j+ O. [% f' P1 m7 D
      return TRUE;
/ q: Z2 g( T5 d; G5 q   }
, u/ [- l2 ]: O. s/ d! Z   return FALSE;9 L# o. N0 Q$ H* a  ~5 y) x- v/ V
}
4 K' T6 y( X, j9 _) ^( B! r4 L1 w  J0 g7 ^/ v1 I
Although this trick calls the CreateFileA function, don't even expect to be
! N8 c% M6 }% ]. @. h* U: fable to intercept it by installing a IFS hook: it will not work, no way!0 X" A/ R, F% y4 u
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ e  Y" u/ h# r. S& M5 Uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ v. V5 Y9 y. Z, Y' S/ m( |8 e( eand then browse the DDB list until it find the VxD and its DDB_Control_Proc
( w5 U/ R) V: v5 ]0 Z& h6 Xfield.9 f% x8 d, ^! i6 `7 f% l
In fact, its purpose is not to load/unload VxDs but only to send a   R& T/ N% n: P; }
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
* u8 k! R% F$ j6 V4 mto the VxD Control_Dispatch proc (how the hell a shareware soft could try
* D0 B# w: X9 y3 a' u* C7 W5 }9 R" i! {to load/unload a non-dynamically loadable driver such as SoftICE ;-).
4 @! p" U) B# `' FIf the VxD is loaded, it will always clear eax and the Carry flag to allow5 e3 G% h  d; ]. p9 ]
its handle to be opened and then, will be detected.8 l. q7 n# p5 Y! V2 o" G
You can check that simply by hooking Winice.exe control proc entry point4 ?9 Q% L' G+ p. S+ U1 F
while running MeltICE.
6 K0 q1 T# D# a% G+ t
. n' i* `0 K! h# a3 I' u' r$ G  g  ^/ I
  00401067:  push      00402025    ; \\.\SICE+ i0 t/ F' N6 T, g' h
  0040106C:  call      CreateFileA
9 [- e4 k) Z" |. F: @, N  00401071:  cmp       eax,-001% x/ ?9 z0 \* v( S1 @2 {% Y7 i6 j. w+ m
  00401074:  je        00401091
8 x- U/ N- r" e! o% t
, ~' d4 S' [5 O
+ k1 g; B) y2 c: Q4 X3 p; CThere could be hundreds of BPX you could use to detect this trick.
% z7 y! A$ _, ^# ^-The most classical one is:
6 T3 D( n0 A" y) x  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||; N, H+ V# Z3 a) R- r
    *(esp-&gt;4+4)=='NTIC'& D" \' ^+ Y) ^1 U

+ K6 c; P8 Q/ M9 f6 z) b4 d-The most exotic ones (could be very slooooow :-(
+ r2 T- `& R, {" L, m1 Y* _   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
/ k; o2 {- y) {1 G$ Q! y     ;will break 3 times :-(
3 \) m/ ^) a; k8 z  m8 k* K4 N3 A4 |1 W/ W1 ^# Y  m9 C
-or (a bit) faster: 5 b# ^6 l! r1 J7 o" b
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 [5 o$ |5 Q2 G# t1 X
3 I2 e' l2 I6 S/ D/ J
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- y$ S, [" P; j2 a" @     ;will break 3 times :-(9 n: ~% _3 t! V4 x' \# L
2 A2 d) {: k8 I
-Much faster:. m2 L$ Y/ }* w! B
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 m6 Y$ G1 @) W% g" Q# e1 }. T8 K7 D" q
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
( S7 m7 {' z1 B; t5 Afunction to do the same job:6 B7 ^! D) b0 x

! ?+ S. f  L9 v   push    00                        ; OF_READ
( K- P* k$ D7 t1 e8 `   mov     eax,[00656634]            ; '\\.\SICE',0/ E3 Y- M2 @3 E
   push    eax8 C7 t$ x: T+ V% |' Y
   call    KERNEL32!_lopen5 A. G% p  [$ A, I( n9 k) u
   inc     eax
5 W' Y; A2 u! A: p+ s   jnz     00650589                  ; detected& u8 U3 V8 u' p( Q3 v( ~  v
   push    00                        ; OF_READ9 C0 x8 B9 _+ s0 D+ M
   mov     eax,[00656638]            ; '\\.\SICE') T/ i! O3 V0 s: v/ T% m- [! V) }
   push    eax$ a1 u* o% m5 h& O' s
   call    KERNEL32!_lopen
0 N. k2 I, h& x9 I: r; J7 K+ C   inc     eax5 ~; y! Q$ N, P6 z1 N+ {/ _
   jz      006505ae                  ; not detected% Y* p- Z- `9 }' e  r7 d2 H" r
! q, t& V* ]& q2 X/ y' P/ [' B

+ h$ Z; G3 O( \8 K( c& @__________________________________________________________________________6 t: ]5 `8 m% _" o% m5 }
9 J$ W- t) i; q5 D  b" G
Method 12
. h" B( ]' R- D( N- I. h6 g=========" p( p# |8 ~7 F. C7 d; @  Z' R& H
4 ]. E; z# \, Y- B9 W
This trick is similar to int41h/4fh Debugger installation check (code 05
3 ^; B& u0 A+ L. l&amp; 06) but very limited because it's only available for Win95/98 (not NT)1 E3 h: p7 N1 M4 ?' @! r4 z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, o7 t$ O3 ]8 e6 h. ?" z+ O5 T* d; D/ v4 H0 {
   push  0000004fh         ; function 4fh
2 |  m9 a  C& [- u# l, b! }" v7 Y   push  002a002ah         ; high word specifies which VxD (VWIN32)* l( g. [: V& C; n0 e4 O
                           ; low word specifies which service- l% u8 _: O* Q
                             (VWIN32_Int41Dispatch)
7 R7 [# I4 P( p- k   call  Kernel32!ORD_001  ; VxdCall
7 A) _+ P2 U2 z4 G   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ ^# [+ W+ a9 G% E2 L# W   jz    SoftICE_detected8 Y/ l' x. Z5 D5 S% C2 ~% ~
5 d+ f' n4 P. R
Here again, several ways to detect it:
' }) ?/ L& A- C! w! T3 V' V  m
* C) e7 {1 T, v% h1 w    BPINT 41 if ax==4f
. K2 S1 h, M7 O% B3 p3 ]$ N
4 n% \# W! t( W0 l' l  [3 n    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 C) v3 S% m4 Q
/ G, f5 x4 H$ i  v- E( q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 `$ u6 t0 ^8 y7 b
3 u/ B) Y4 y9 W" u2 h  h% ?$ B" c
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 s& n9 J$ {7 A, D2 k8 E) d4 h
/ m) {0 _' N- @* a2 X9 H$ r& f! v1 H
__________________________________________________________________________' Z  R; |. L0 K/ z3 B/ s) t
# |  B: z/ T3 r9 R4 N6 C. t
Method 133 J9 U/ ?7 y) i$ d) _5 I& w/ e1 k4 f0 |
=========
! d6 e3 v5 B2 G. L
4 W  ^; y5 P: _" ~! M4 YNot a real method of detection, but a good way to know if SoftICE is0 B9 `3 ?) H7 P* [
installed on a computer and to locate its installation directory.. u4 R2 b8 N! y! ~9 m9 k+ [. X0 J
It is used by few softs which access the following registry keys (usually #2) :
9 }, s$ z5 m4 q2 f: l! |' c2 f* l! h2 t' T. z) j9 e6 B
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 J, z2 I  t- E1 j! e' c\Uninstall\SoftICE/ Z# {3 C1 `! i+ s8 y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE' \+ f9 K) L# Z4 N6 }) N
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" P+ K+ Y! x) S* Q
\App Paths\Loader32.Exe7 V$ J3 T3 l$ W! k# n9 N% R# \1 k
4 z8 Y% R$ b6 _1 T2 y& v& A

0 u2 N* T  P) G$ d; z7 ^, WNote that some nasty apps could then erase all files from SoftICE directory
& l& ?# h! \2 Y2 j3 u(I faced that once :-(* P  \( v% c% }3 Z/ ]
, M. e0 C4 P1 x7 N0 t( w7 m
Useful breakpoint to detect it:
5 F3 s3 k! G0 q! G7 _+ q/ e6 c' _  }* C+ X9 A! W1 Y0 [0 I
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': N4 [4 x9 E! @0 c0 Q" X

5 G' w2 R  A5 i- s9 ~( ?__________________________________________________________________________' c$ k1 Z: ^$ |: x
4 ~. S- S: ?* z! o  O, H

, i& d* d) `+ V+ W2 e9 Q) sMethod 14
5 L4 s- X6 l8 U' v* F" }=========0 w6 J) ~: u$ J" ?$ S: Q4 m$ r$ C

2 D- x# t. t3 PA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) [9 [5 K2 v2 {, g8 ois to determines whether a debugger is running on your system (ring0 only).
# G! Q4 m( E5 U* h* j$ d+ c- M- F8 s5 v* W  \4 U! y5 N7 {
   VMMCall Test_Debug_Installed
+ u  X& T$ M* c0 t1 i   je      not_installed! U9 f: Y% R: w1 Y- X9 c1 |0 ]

. I! |% d5 C8 yThis service just checks a flag.
$ h6 D1 o+ x6 t0 ]/ M; ?</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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