About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" z/ C$ J  x7 R- C3 D3 }3 `
<TBODY>
3 s) k- j6 Z3 Z/ U<TR>
" G6 h  X# k4 S3 a1 p" e<TD><PRE>Method 01
' o! ]0 o/ s, L' @5 \3 D. J$ R=========
& A4 K2 k) G; E3 Z9 A8 T% q) X" x' H: B5 N
This method of detection of SoftICE (as well as the following one) is2 p5 _5 m3 i, [" S3 K' \  O  V3 f
used by the majority of packers/encryptors found on Internet.
, F: I7 j7 |) U; V( C9 w! `It seeks the signature of BoundsChecker in SoftICE
1 e: m/ K4 t4 A6 g4 P
6 L' c1 h: z2 `  c4 ~8 B    mov     ebp, 04243484Bh        ; 'BCHK'
( X) u8 l) J0 W3 k7 Q, D    mov     ax, 04h; l4 d9 q' k" G+ E; Z. B3 [" N/ c
    int     3      
- Y2 I# v3 l; C    cmp     al,4# k5 k/ w, c. X" Z# V+ H
    jnz     SoftICE_Detected, M3 h7 x% E$ a* W/ \9 n2 T
) }2 ?+ c: E, Q& W
___________________________________________________________________________
# F- e( R' ~# `) G+ T6 A3 p# o- L( U0 s4 X/ J
Method 02! u/ @4 l+ j7 g6 O
=========
/ x8 T7 _$ }; m  D* h
% P' N% o1 M5 I6 H: E$ V& K* fStill a method very much used (perhaps the most frequent one).  It is used
2 C8 B0 U3 y2 k$ u0 m8 i. _$ `, Mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,  r! y- _9 H4 L4 k) {" I
or execute SoftICE commands...
6 J+ v3 e* D* T* I# Z" |( L& v. nIt is also used to crash SoftICE and to force it to execute any commands
  @+ @- Y5 y1 y2 D( a(HBOOT...) :-((  3 l4 l# C6 j6 `9 V' `
6 G* m( _6 F' L$ X0 e$ w
Here is a quick description:! f8 T) y' L6 a
-AX = 0910h   (Display string in SIce windows)
* V5 V( X/ C( N3 w0 V-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)4 ^, I' W. \) @" I9 b
-AX = 0912h   (Get breakpoint infos)
; J  R' R" _( V-AX = 0913h   (Set Sice breakpoints)
: [6 y; T5 Q; b! |6 W9 T) K# q-AX = 0914h   (Remove SIce breakoints)
) E2 R* D8 b' x1 ?4 c9 y- C, T! R
- M( K% S. R+ S1 F# ^& e3 wEach time you'll meet this trick, you'll see:0 o' r* U. i6 H3 g
-SI = 4647h5 z: d) R' s9 U  ^, _0 y
-DI = 4A4Dh
8 l' Y) Z% S: R# t) A  MWhich are the 'magic values' used by SoftIce.
; o  C: A; ^; I( k3 O  L* RFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% q. v7 D/ u1 x& s3 i. W' ^0 o

  l6 {5 h. e" n* j4 [6 PHere is one example from the file "Haspinst.exe" which is the dongle HASP
8 K3 Y( A4 E1 wEnvelope utility use to protect DOS applications:5 S: V" J: q. _" Y- L; i3 H

8 V; K$ A( b2 ?) F  }' l$ p
, {) S+ E/ d0 Q4C19:0095   MOV    AX,0911  ; execute command.
2 m1 E6 {2 D5 w1 s" C0 m7 L4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- v# ]3 x, Z% u& C) q4C19:009A   MOV    SI,4647  ; 1st magic value.5 c3 `- f* j2 j" v5 }% U, j6 Y
4C19:009D   MOV    DI,4A4D  ; 2nd magic value." {- E+ x% `5 ^( f& L. J. @8 b/ L0 ^
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
) r: u- G, [, i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ b) m  S/ r- p# i; d- _, t0 H! x7 }
4C19:00A4   INC    CX4 }% N; @1 K2 S, p$ ^2 r. A5 w& l! W! @
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 g. G3 l5 ~2 D, }* I" {# p5 c4C19:00A8   JB     0095     ; 6 different commands.3 \/ X; o! d* `9 ?
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  Y6 W& b0 |7 _- w& I
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 e! s4 \% {- X6 Z6 b
" c; q" r& l8 o1 I
The program will execute 6 different SIce commands located at ds:dx, which. a  o, @# a, @2 ~# r, c" w5 ?* v
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
" P$ W% S, v2 f' E) G0 }
3 `, U/ H9 A' Z* H* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% x5 J0 k& |! I% w) V. o___________________________________________________________________________
7 I% U: R( t7 g9 V' L
$ T" t- y7 y- i; ^! W  [: `: m" S% w( P! A
Method 03* X. q* H. k: u+ A- S) @. I$ w2 W
=========
: P, x& g' N2 t' x) L+ J' |; R2 b6 y' r# k
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: I: Y7 C7 {" h& t4 Z4 q7 X" @: K, u4 p(API Get entry point)
* o" I6 B" T# i; V. h3 w# O        # ?% ~7 J! W" Q) T4 U6 b) \3 k! Z

; J7 ~0 c) a+ I0 u( m! x. O9 T    xor     di,di9 g2 ~; U7 z1 u
    mov     es,di
, I) q$ Y( S5 m3 R# J    mov     ax, 1684h      
# A2 [: \8 R7 V7 q/ X: ^" @" I# l    mov     bx, 0202h       ; VxD ID of winice
2 _8 ~# Z5 k) P& E- H0 Z. Y9 O    int     2Fh. x7 W! v3 c" `. I4 K
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 }# z7 A4 O* Q# z    add     ax, di
& w( P4 r) G3 Q3 t. D    test    ax,ax' I5 I- x+ c3 X0 c$ r
    jnz     SoftICE_Detected3 S! y/ n: Y  J% H1 r
! r7 @8 @, ~8 ]! n
___________________________________________________________________________
% |' T: i4 X! c- D8 q1 p) s) M# v8 Q/ _0 l9 q
Method 04
  L; G# k: q. R4 ?' y1 p! G  L% i=========: P0 i' f0 f3 q' @" u- T) l( |% w5 c

8 |$ B( ?. Z) Z8 Y6 Z: [& Y/ k) ^Method identical to the preceding one except that it seeks the ID of SoftICE
$ d6 \! Y+ o1 {% v1 }' ~2 UGFX VxD.
' ?- N6 C  T* t. G2 J  H6 b7 A; M: R! Y  x) h4 I0 s
    xor     di,di7 @% C5 M2 g5 ^2 k: e( o% v
    mov     es,di
7 U7 d: t. b* M+ T) V0 X    mov     ax, 1684h       ( V' s8 S1 W4 r  b' Z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
6 T6 H2 O0 u( G    int     2fh
/ x6 o& E* k, m# d/ O; ]    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ s0 _- [* s: `6 `$ w- J* E
    add     ax, di
- Z" V( [+ P7 H0 ]# T) i+ ?    test    ax,ax
+ C; f( {' u9 `    jnz     SoftICE_Detected
" h  t' o0 h4 J) {. j0 ^2 v* F. D/ d8 g( y
__________________________________________________________________________& F- @& [7 N) V, f1 A  e
% w  ?! m2 _5 H

& u) v- g( G, z' M5 P$ \: qMethod 05
: U- |" B* o" y7 ~1 r=========
# }2 [! c* B7 C; c
8 P. ]+ {7 k) b; Q" UMethod seeking the 'magic number' 0F386h returned (in ax) by all system
* E6 S( D$ o  Qdebugger. It calls the int 41h, function 4Fh.. ~- t- L, o$ _
There are several alternatives.  3 f+ w( {2 ^! v, u; z, Q( {

# B5 S- Y* |" [( N, TThe following one is the simplest:
9 K2 K. _1 Q; {- b4 G+ N* k6 X5 B
    mov     ax,4fh/ F5 I! x4 N; i& {, t
    int     41h
' i6 e& y- _  L) D' j$ H    cmp     ax, 0F386; g7 ?/ v# b: b6 B4 ~$ b8 z2 J6 |
    jz      SoftICE_detected/ b3 I7 x! n; J4 _4 s
9 i1 ], a! Y2 g

* ^5 v8 S( I0 ^- t8 `Next method as well as the following one are 2 examples from Stone's
! g) o$ [6 n, D6 r"stn-wid.zip" (www.cracking.net):) H9 w! P, B4 s5 l. n
* g- d# A1 {' I+ ?" Z1 o
    mov     bx, cs
2 A' F+ n- z0 w    lea     dx, int41handler2  X& b1 B5 N2 T1 f9 ?$ a
    xchg    dx, es:[41h*4]
; |" [  V% h, E4 z# W& V2 R6 c    xchg    bx, es:[41h*4+2]
2 G# g9 Z; ?: _( I/ ^( b& F" B    mov     ax,4fh
" e0 F; i6 E" U  |2 N    int     41h' ]6 f) o, b8 I5 K
    xchg    dx, es:[41h*4]
4 ~3 F2 k. h3 Z. h' E1 r3 ^    xchg    bx, es:[41h*4+2], w1 x9 I! h3 n6 U0 Q/ g5 a
    cmp     ax, 0f386h* p, T0 i/ S' l2 z
    jz      SoftICE_detected0 m. O& l  O( f( W$ t! z8 p

! v1 Q# `' A) O2 @; ^' O% Pint41handler2 PROC5 J* W1 R. k0 Z' X- ~$ h9 L) m
    iret  |5 g! E" F  X% ?* @9 R) k
int41handler2 ENDP" H& Q. Y5 A* f

- L  R* i- ~) f& A- W
4 b8 U# n( x3 T% {% X/ o_________________________________________________________________________
7 U( |% u8 p! ^5 e, J* A* m6 c; Q4 h" }: d3 ]* L7 Q. T+ O

& w6 T: u' b- f8 l# R1 lMethod 06% e3 I, Z7 G9 i
=========. X2 L. p9 F. w$ X8 ]! O

4 N- R7 O7 L: O' @& t1 J/ x$ Q5 X. q' E, l' b
2nd method similar to the preceding one but more difficult to detect:# r3 X( ^. }& l6 ^

5 i2 t1 a6 y) ?+ K+ q+ W  u2 J1 q
: n0 d: C+ K% J' L6 wint41handler PROC6 X; o- O( O, `" W" D3 h3 Q
    mov     cl,al: a- j2 Z5 ]1 t  d: _2 Z9 ^! x
    iret
% A0 b6 u8 E' U  P) Z1 Nint41handler ENDP
. y6 Q# G& F# J$ e' l& {' f% a+ F$ y# M8 w

: S  P, v% }/ @9 b: |& t$ h6 z    xor     ax,ax  L' ~$ z  A& x
    mov     es,ax
# s+ h' F4 f$ X) s$ j7 |7 R    mov     bx, cs
  B; k8 Q% j  t* v$ ?    lea     dx, int41handler" p8 T4 C2 Q0 H$ I
    xchg    dx, es:[41h*4]! m- t- H. d0 _" q+ M
    xchg    bx, es:[41h*4+2]
! N) t  @4 |+ S/ {8 [    in      al, 40h
1 J, ~% d0 }4 l2 a& n' K" F$ r8 p    xor     cx,cx" D6 V( o) Y9 C# J3 {$ Q
    int     41h( W: [, l& k  [, r
    xchg    dx, es:[41h*4]4 O' T3 N" ?, A& N2 t# A- O
    xchg    bx, es:[41h*4+2]9 h1 H+ w/ Y. f& |2 }
    cmp     cl,al: D& K' _9 a! P! N
    jnz     SoftICE_detected
  @5 m6 N4 y  X+ `: i4 R' k( p
% w6 T$ V2 S5 z_________________________________________________________________________
! _+ c* Y% Y6 E3 l+ B
* w1 p) o5 Y0 d4 i7 K" S1 PMethod 07% T$ a5 ~8 n. @5 ^; S9 F9 x) }: w4 C. F
=========
9 V! T: s6 X0 F/ M# h' z, e' f7 f' R. w% a3 J, z- r0 k( S
Method of detection of the WinICE handler in the int68h (V86)6 q% o) t# e4 j4 L3 G& k* a

  f( I' Y2 O# v    mov     ah,43h
3 f$ k/ k1 L* P1 a8 D3 }    int     68h
! i( E8 X3 x. k& J    cmp     ax,0F386h
9 R- a0 s; ?/ p5 W6 s* l/ E; C6 B    jz      SoftICE_Detected
6 A5 P1 ^6 e: T( E3 ~. _
$ X( T& e3 E# O; @, F+ }1 V9 q# @# }
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 N8 O$ G  u% S- B1 w" a3 |# [  a* m( `   app like this:
: P2 Z6 e9 F+ u/ P& j0 W9 w+ a, n  A; `. a, v
   BPX exec_int if ax==68
, H. t( Q' |0 h   (function called is located at byte ptr [ebp+1Dh] and client eip is! R; F/ @6 P/ r
   located at [ebp+48h] for 32Bit apps)! _, l# g( ^$ s" ]) a7 z( M
__________________________________________________________________________
2 F3 S. l) r4 B* }6 z6 J- p( A
9 Y9 _$ @: @. Y. y. m! |- y/ z
; H8 z+ V9 ~) uMethod 08
" L9 [: ?. V3 }! A* {=========" l: J+ z) G0 p9 O! Z0 |

! D% \! y$ R: {7 o! i% WIt is not a method of detection of SoftICE but a possibility to crash the# c* ~% i! K+ W5 a# S! K) U
system by intercepting int 01h and int 03h and redirecting them to another' V7 V2 t3 j) O2 Q: Q4 ~
routine.% j& ^) u! k& g( Y! G
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' W; F* p; k2 p/ q: Wto the new routine to execute (hangs computer...)
3 }. I/ Q4 d+ ^: j4 l8 n3 X$ P( Y: f. }9 F; g
    mov     ah, 25h0 P& X# Q& @& Q
    mov     al, Int_Number (01h or 03h)
9 x0 h" a: ~. m+ @0 G6 ?    mov     dx, offset New_Int_Routine' O) C' K" a  u2 z. z: T
    int     21h
- _" T3 R* h& |- F6 a  h
/ g; F4 }8 P9 |) t7 n! ___________________________________________________________________________* \; Z1 c: Y$ W) s; ~# U

5 e% D' V. s; e' _Method 09
6 q, h! ?* }* r. s=========
& Y1 G1 U' b! O; Q
+ L8 l! ~: g6 z* UThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
' E; A6 n# q# p6 L! O# [performed in ring0 (VxD or a ring3 app using the VxdCall).
8 a* J$ T& E$ [# M% C  o$ {The Get_DDB service is used to determine whether or not a VxD is installed- B( H/ C- Q' P8 q9 B8 b; k/ Y
for the specified device and returns a Device Description Block (in ecx) for
* M9 C. N( K( G0 V" t9 R! V9 Ythat device if it is installed.
8 m  G" f& |. I6 Q  N4 @0 I/ F  l1 u7 z6 f+ u3 N8 c. j
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( n5 B, I$ q5 s. d9 f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
7 b. N& _6 O# L8 Y! r/ c( a( H   VMMCall Get_DDB
' C# \/ ]3 h  t0 S0 Z1 ]  @   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed& U+ g2 c7 L/ {+ G+ c/ K! D

/ h2 T5 [9 _/ o; SNote as well that you can easily detect this method with SoftICE:  [% S5 ?. p+ u
   bpx Get_DDB if ax==0202 || ax==7a5fh
$ G4 J8 @( H; D
. g3 L) Z4 J  \) x6 B__________________________________________________________________________6 \8 a; S1 R3 B0 |7 s
5 t3 ~: w) g: y% _, G5 z
Method 10+ H( G. w5 }$ }9 ?/ c0 h2 Q* c5 u# c
=========
1 W8 y) e, O- _& C9 h: j9 A, K7 f; s& E  ^7 O8 t5 F
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 o: F2 E! I- n" X) X4 _  SoftICE while the option is enable!!& }6 W+ `) p4 T1 P4 H
, K2 {$ K" @, R; d/ E( Z- A* s
This trick is very efficient:* W8 C( {4 Q! G0 c$ s
by checking the Debug Registers, you can detect if SoftICE is loaded. ^7 X, v6 ]' U# a
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
7 _" o# h' n$ Y; Z- ]9 E- zthere are some memory breakpoints set (dr0 to dr3) simply by reading their
8 D9 t& i: C! J) ?5 n- l" |value (in ring0 only). Values can be manipulated and or changed as well1 I6 @1 y( \, O" Y4 m
(clearing BPMs for instance)
8 m5 |; G/ D+ I. _3 W( u$ X1 B# L! R% H! Q8 x; l+ o
__________________________________________________________________________
! _# |) ^. y& G' {9 }. I2 Y  I$ g0 ~/ G$ y0 ^
Method 11
* E7 O( @1 Y& q. C7 B. \) I=========5 h$ G9 S% j: C. }5 K1 H
2 \; p' m) H1 b) l
This method is most known as 'MeltICE' because it has been freely distributed# |! x1 f" T5 H' K
via www.winfiles.com. However it was first used by NuMega people to allow( ^2 E+ q' ?8 D: ^3 j3 ~
Symbol Loader to check if SoftICE was active or not (the code is located
2 V3 ^) ^- c. u9 uinside nmtrans.dll).1 w! W# @# r" V9 z& H( k# }% C: H+ @

' a6 V) r4 V/ M2 K$ n  r  f& bThe way it works is very simple:6 J( h2 E* Y# `8 Q1 u$ k9 i/ I
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 ]/ b- {/ Y! E0 m  t% k3 R. j
WinNT) with the CreateFileA API.
, u6 p: u: S3 k5 R8 O' J% ^! c' Z& I' P; [2 `- q( V& [* \/ A
Here is a sample (checking for 'SICE'):
! ^6 L  t4 e5 M9 X
. p3 Q* {" O1 i" q( MBOOL IsSoftIce95Loaded()
0 u- X  g6 X+ g3 u/ f% H8 z5 _{
3 p) S8 [* B+ `* I" G2 F   HANDLE hFile;  " S0 [5 z( y! _/ F$ @, z' I4 V/ i6 ^
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' a) C+ G1 @5 p, W                      FILE_SHARE_READ | FILE_SHARE_WRITE,
- M& w6 T- f& F" M% ~6 J                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- c/ @( L8 y$ _2 {, G   if( hFile != INVALID_HANDLE_VALUE )4 J& |2 r/ f, @- O# y  g
   {
( _9 Y- D, o/ I, Z" x  J# P' B5 c2 v      CloseHandle(hFile);
* q3 C' a1 {( m      return TRUE;
5 h& T. D. J: F$ S: E   }6 N# t2 C7 w0 ]7 H
   return FALSE;' j8 Z: K0 e' f/ U# G# L6 v
}
6 T" ~/ F( s# x
0 c: I! n: N; b$ D8 j5 A+ H) rAlthough this trick calls the CreateFileA function, don't even expect to be$ K8 g* I2 U" R  `- W! Y
able to intercept it by installing a IFS hook: it will not work, no way!
" F0 {+ G) B" w6 G0 Y% oIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
6 Q$ o% z' {, y( J6 \) dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
2 K9 j5 x1 d1 W3 oand then browse the DDB list until it find the VxD and its DDB_Control_Proc. [+ I: S$ P' q) B* [6 H
field.
3 N, _- D- c% d/ Z4 yIn fact, its purpose is not to load/unload VxDs but only to send a + C7 a) {7 u$ F
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)' J; Y; i6 G7 k* h1 O
to the VxD Control_Dispatch proc (how the hell a shareware soft could try  W2 S& A' L3 J& N; G  p0 J, R
to load/unload a non-dynamically loadable driver such as SoftICE ;-).! [6 o) t! S9 ?) y3 {7 Y3 n
If the VxD is loaded, it will always clear eax and the Carry flag to allow
0 u$ c9 W6 z. s, oits handle to be opened and then, will be detected.
8 ?" g( F5 Z5 ?$ c. nYou can check that simply by hooking Winice.exe control proc entry point& ~! h7 H  R4 a4 l% u5 F
while running MeltICE.) o1 Y( K  |" t# J/ Y
# i' F& [, n# {, U! I0 K

  r3 X  p, s$ i; S2 ~  00401067:  push      00402025    ; \\.\SICE. l; J% d0 P: S8 F0 y1 W
  0040106C:  call      CreateFileA2 t4 x4 H. x5 i/ i+ a; f. N
  00401071:  cmp       eax,-0018 K) y2 d% S' e, @2 E7 j) ^
  00401074:  je        00401091
% \' E  b( q8 y+ |
% v+ L3 d+ `8 X4 g( `, P3 F" O5 c$ B
There could be hundreds of BPX you could use to detect this trick.
( ^! ]9 J, d$ f5 _4 x-The most classical one is:
& z8 z! g" h) p6 y2 Z3 f  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 }$ }0 [- v$ W2 g
    *(esp-&gt;4+4)=='NTIC'
- |3 U+ w' v; ?8 r: B8 B
; ?6 |# r% W3 D  d0 `, S+ v0 S-The most exotic ones (could be very slooooow :-(1 f9 y4 V8 s  ]1 K
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 V9 d5 v+ Z* `0 a3 c7 Q# X
     ;will break 3 times :-(
' o3 T0 i2 Z8 N5 ~* Q0 ?- F5 x  M  M) V8 |( [4 ^
-or (a bit) faster: 3 \% x% c# N6 I; C1 x. \, L
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
6 L% \5 }0 G; O
5 q, K8 X& H1 g1 y' E3 x8 I! l   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 e$ W7 J9 a6 K9 S2 B4 H" X
     ;will break 3 times :-(
2 I5 A6 Y+ @7 ~' V( }+ w. k8 R9 B3 _/ o3 A0 H) [* B6 m- n
-Much faster:5 Y! d1 @; G7 m( f" a9 ?* z1 P0 K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ Q1 J1 O2 }) Z  _' u1 s. p/ p8 X6 C' ?+ b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen$ G2 ^& d  {/ P5 V+ E. C1 W
function to do the same job:9 k4 G1 i4 ?  ?- q
+ p: f/ B/ m2 k+ w% _2 i
   push    00                        ; OF_READ
8 I1 \' V9 `( {- p+ Q: S/ h   mov     eax,[00656634]            ; '\\.\SICE',0
- d! s! f0 H# M2 ]   push    eax+ d/ b+ P2 h' r$ T4 [
   call    KERNEL32!_lopen; |# Q8 U- C! x( m, Z0 r6 k
   inc     eax
- b$ y( I: @! r7 R   jnz     00650589                  ; detected
: A. e9 N" P$ p/ N, _4 o! F   push    00                        ; OF_READ
. ^2 K7 k, N' L- s  v* N* C" B   mov     eax,[00656638]            ; '\\.\SICE'; }+ u0 O5 m  P9 z: d6 w
   push    eax) N8 p1 ]2 A' Z( S; {" k+ r" o
   call    KERNEL32!_lopen
; u, k/ R; o1 a3 _8 [   inc     eax
4 ^6 o+ e9 y' S   jz      006505ae                  ; not detected
8 i8 U7 s% F, Y: T4 K. L' z# D% C+ A$ ~3 N
, X; _1 r7 U8 j
__________________________________________________________________________
. i# [2 b; G" y+ ]+ m3 Q) g3 r
Method 12
! s9 N- I0 r; x$ t=========
" D$ w9 y- w" @3 j# W+ M9 Z4 j' r8 V3 u" L# h3 ^& P$ y. m
This trick is similar to int41h/4fh Debugger installation check (code 059 b4 Y1 f" W7 L2 o/ J' c* P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
2 F4 _2 R9 f# U' ^" s: S: uas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 t/ t+ u4 R9 B3 k$ n( g" M" p
, p6 P, ]8 Y. l( X1 `8 i9 o   push  0000004fh         ; function 4fh
8 ?" z! O' m2 d" @; A   push  002a002ah         ; high word specifies which VxD (VWIN32)
, }/ W3 r$ D( y" C' z9 ]                           ; low word specifies which service( q7 R/ k- f0 b. y  \# c( T1 T
                             (VWIN32_Int41Dispatch)
( W8 i- i+ a& F  }+ _   call  Kernel32!ORD_001  ; VxdCall* r, q( ]2 `5 K+ H
   cmp   ax, 0f386h        ; magic number returned by system debuggers
- ]3 p  P5 Q' X6 [! a8 _# N   jz    SoftICE_detected6 T! q: d8 g% Z- i

+ [" H- A$ p# s( O. LHere again, several ways to detect it:
+ ~; ~. X$ S7 B$ f  t9 Y- q) f; q& @. d9 P. ]$ Y
    BPINT 41 if ax==4f
4 h0 h, `* Q$ U3 B' D$ T+ z: n8 @5 \, i5 g5 L0 R! H
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 M* z5 G. n1 c0 G3 w' T

3 ^, C/ ]: s: e( X4 y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
  ^# o# z/ U9 I# [
. A% X( u0 W0 q& j# A0 @8 t    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!" {) V; K4 s; ]7 b# T+ v

5 A( l1 u/ y2 u& x__________________________________________________________________________4 a  `3 }3 T, b+ l' Y1 @3 ?
! d; [- L# }# Z3 Z2 h! M* ]
Method 13
) U2 s7 L" P. c=========
1 ~# t5 |/ q9 e$ U0 N
' K! c! J- l% Q: V4 K& j4 J5 mNot a real method of detection, but a good way to know if SoftICE is
+ g- i8 @, r9 r7 v, Pinstalled on a computer and to locate its installation directory.
. Q0 P& X: [7 v7 T7 X4 @- G7 ?3 GIt is used by few softs which access the following registry keys (usually #2) :5 A* ], }8 D. K5 f7 V  M. z
! H' K7 ~9 w8 q
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ R/ r/ D1 B( F5 E
\Uninstall\SoftICE6 }& M1 O9 X' [: l
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 a, y+ P( W: V& Y& o( A/ M6 U, \% t
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: C7 {1 G; e+ _( o8 v\App Paths\Loader32.Exe
  `/ K5 C6 K6 P. R; {4 s
2 t7 E! B' |6 Z' b( f1 H" [" P4 U6 O+ ~/ @. f4 a
Note that some nasty apps could then erase all files from SoftICE directory
3 _5 {. h! V- Q: d7 J, D3 j(I faced that once :-(
0 Z0 J2 d) ?* ~3 Z1 P2 E& @- V0 f
) v) x( d$ G7 t% `! |Useful breakpoint to detect it:
9 ]/ \# S0 F7 ^& B2 M% W8 d: |
- w/ X! g( j+ e/ G     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 H1 |" L' u* |- g
+ z, m2 w' X3 r$ t. B__________________________________________________________________________
/ p; s: `0 X, T" R3 a6 Z3 Y
) X& x9 R+ j* a- {' d- X9 c8 I2 }) E; U& u7 x
Method 14 0 f% c2 Q' f/ Q+ U% S
=========
- Q: p! Y: p1 \' A6 a+ J- _7 A% D( w# }( ~- `; c- v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 |5 J2 C; i0 n9 [1 G# |is to determines whether a debugger is running on your system (ring0 only).* N  q$ \- L% p2 ~
- o. }6 P/ S% z
   VMMCall Test_Debug_Installed+ A6 _; T3 ?: A4 f) T
   je      not_installed
) U, T9 w. S1 R7 z. P7 W1 X* G
$ j* V# [% P1 z' d2 Q* W2 gThis service just checks a flag.
) k; Z3 U! w5 {</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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