About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 }3 E* P1 s7 k, @<TBODY>
8 U  J, S. m3 @  Z- G<TR>
. c1 S" h7 e# \4 h% D. i2 |; o<TD><PRE>Method 01
/ @1 x( D; J  \8 p! [=========" |  \7 k2 Y( Q; V- |; W

) H3 w# T8 h! r7 TThis method of detection of SoftICE (as well as the following one) is
4 o) M) K9 q# ^8 H6 Tused by the majority of packers/encryptors found on Internet.0 l' D& g! N, g* G
It seeks the signature of BoundsChecker in SoftICE" w- |" U& E! Y/ @+ z/ `' V% |
+ r6 u+ E6 g0 l; X+ u" G* }! l. f7 d
    mov     ebp, 04243484Bh        ; 'BCHK'; d9 G% X3 e+ x
    mov     ax, 04h- {7 i" q  }# z) c
    int     3       4 o* d/ C. ]+ I0 U! ]7 O- _
    cmp     al,4
6 ]! K1 a+ o6 H# E% s    jnz     SoftICE_Detected
# j: ?% }! ?0 Z" O+ U0 ^+ p3 ]: T7 r& F3 p, g: \# }
___________________________________________________________________________0 f" I8 Q# @# T0 N1 C8 S

1 _0 X+ f5 G3 S1 \+ m0 ^  }, ~6 c3 ZMethod 02
6 i8 q! r" r0 ~, t5 K1 y=========
1 R3 o/ h. A3 L' T3 {% D
! i  N( l6 e. K, M- y# n5 iStill a method very much used (perhaps the most frequent one).  It is used1 u8 O; \$ R# s0 @# J1 s, N
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: `$ S6 f4 r$ m; y! n* b- ~or execute SoftICE commands..., K: N' X7 |* `" Z& k
It is also used to crash SoftICE and to force it to execute any commands) C5 r4 |( {# A, j5 m8 B. t& ]( d7 C
(HBOOT...) :-((  
8 U& ]8 a0 g* U) J+ I. b% h, E- f7 k# ~( a- ^' J
Here is a quick description:! i7 o0 u4 ~" S" v" N
-AX = 0910h   (Display string in SIce windows)" Z, m' ]+ a; _" I- v& m
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): H4 m3 R, p  L0 y
-AX = 0912h   (Get breakpoint infos)
. {' z8 h  B0 V2 L. m3 Z& B-AX = 0913h   (Set Sice breakpoints)
( P  j( |. q/ n0 u-AX = 0914h   (Remove SIce breakoints)& d! _2 z5 E% P
9 }% q% W1 [9 @: p
Each time you'll meet this trick, you'll see:! l, z$ b, X7 N8 I/ S) E
-SI = 4647h3 s$ U- |% Y% `
-DI = 4A4Dh8 @8 A8 H2 T. \4 Y3 ^+ g6 }) J9 R
Which are the 'magic values' used by SoftIce.. Z3 `/ m( t9 B: M9 Y
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.; g, p' A$ N# y7 {9 }( q
9 @* |0 F1 y( v/ G. _+ t- {
Here is one example from the file "Haspinst.exe" which is the dongle HASP4 z9 Z! f7 `# O1 N
Envelope utility use to protect DOS applications:! }& I6 r# s' c- ^# n; J0 ^# }

! e" D7 c- q4 I. N* L* O
4 P/ t8 b3 x1 m8 D3 I6 X4C19:0095   MOV    AX,0911  ; execute command.. M& o4 z6 u1 G4 `- ^: |
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  S' O. s3 J+ [) D6 s4C19:009A   MOV    SI,4647  ; 1st magic value.
" `/ \9 @: V7 {( ^: p3 Q& \. P4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 U3 c- Q' S" Q9 r( t4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# w7 ?. M3 I' ]# T
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute4 p$ I4 r: Z) r  @6 h- H* j7 m
4C19:00A4   INC    CX( W( x$ j% i" G% }$ E, b, p
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute9 r; c$ r% J; G8 L+ m% d. y7 w
4C19:00A8   JB     0095     ; 6 different commands.; U/ m: d/ F7 o! H/ C
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! j% d" F, s, g4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; S  w2 @1 X6 p' _# P9 |% z' Z3 ^
The program will execute 6 different SIce commands located at ds:dx, which# P. ~- @) o* D# }2 d
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! H9 J3 Q; [4 t6 A. P1 j

. u9 p1 T9 O& O! `5 M( q0 d* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., z5 P6 X5 d+ ]/ v1 Y1 j. J
___________________________________________________________________________
2 n; B- p7 p, N
" w0 p; B3 {. F' C2 q' S# d! H+ t% h& @. m; S. ^
Method 03
$ n9 ~: J% Y$ i; c=========: c+ v! \, Q( e/ y( s$ l3 B

  v0 {& K; l! X8 t1 }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& i5 y( L7 x: |; s, k1 ?! ^(API Get entry point)
4 M; r7 K4 w  M, I* t. T# f        1 G1 Z" [# F3 T3 O/ z& Q

# o$ K4 O+ Q* m$ L9 }    xor     di,di# l7 Y% v" y9 K/ @% z8 Z
    mov     es,di) f/ s" `4 a1 X+ m$ X2 `
    mov     ax, 1684h      
5 {( _# A* s. D+ p    mov     bx, 0202h       ; VxD ID of winice9 k( E* m( p* V5 H; K
    int     2Fh
2 ~; K* [6 n; d0 N' L- ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 l: c3 L" S9 d: C$ W    add     ax, di
2 c9 ~; N! G. |8 M  I( Y  ^    test    ax,ax$ H" }0 L9 B9 W4 i
    jnz     SoftICE_Detected
) ]* _3 n' l' N2 `. @, q& t  v/ r% Q' \$ i7 c
___________________________________________________________________________  b6 d* w! F8 J6 w4 D4 F! }
4 K3 x+ V* T3 j7 Q9 g
Method 04" l& N' i% k# m" {) T# y8 ]
=========
9 C8 c0 g; n# }% a  F, S$ E: F" X8 V- i( @
Method identical to the preceding one except that it seeks the ID of SoftICE
: t: R3 p0 e/ yGFX VxD.* F: Z0 j2 B7 V- s( n

; U" w1 a& I8 I5 @# s. J    xor     di,di
4 n3 }5 i) u% j# a8 }+ a8 ?0 s' |    mov     es,di
2 u9 v( d+ W& K( P& K# \    mov     ax, 1684h       % i1 ^( \" L9 j4 U, Z4 p9 N. W. P
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 i) w0 u3 D* i8 [5 W    int     2fh
# w. c; r8 Y0 ^9 }& {    mov     ax, es          ; ES:DI -&gt; VxD API entry point; u, W) K) z  W! _& }" V4 d
    add     ax, di: {! T* N" x/ V. u, L
    test    ax,ax
! O$ j0 T) V1 q1 V0 o  D7 B* w3 W    jnz     SoftICE_Detected
4 ?: o- d6 u0 W3 ^$ Y: L0 j7 W5 v0 d9 v/ w, \; P
__________________________________________________________________________
$ i# N& b' A/ L7 ~, a' @
* o1 E$ {# f) }6 {% z
1 ~5 Y( @1 \8 Y$ S4 J$ |Method 05
' Y9 I% Q" C9 ~: ^3 O9 b+ ^. |! @% n=========
" F& s# a3 _9 D' D* F% Q. Y6 i8 V: p7 F# c1 `6 E; C9 F. z8 j
Method seeking the 'magic number' 0F386h returned (in ax) by all system6 \" ~) T8 b0 l. G! f6 B
debugger. It calls the int 41h, function 4Fh.  t* m& `, A8 V' O) y
There are several alternatives.  
- }- t/ Y0 |! E1 P- t% z
4 z- w8 l  h' [5 _; _0 D  lThe following one is the simplest:
3 H$ W7 U  U1 C8 ?9 X/ D& s
' N# B& p2 R/ z6 O, T# t0 h    mov     ax,4fh
* e. J  S2 k9 V' w. E5 f# k    int     41h
  |$ ]* {8 b' S5 \$ `2 c    cmp     ax, 0F386) m+ N; J7 l  Q' d, q
    jz      SoftICE_detected. Z. [" L" ~8 u9 r- D; P( B
% w# l) |7 k9 |% l' O% H3 ~

5 s. Z  }- ?- J* FNext method as well as the following one are 2 examples from Stone's # S% b  v; s$ \2 c
"stn-wid.zip" (www.cracking.net):
2 [" x  E# V3 ^# d$ j0 s4 C7 k" c: D  n- c
    mov     bx, cs" d% T/ z/ Y( h/ E2 @) t" q
    lea     dx, int41handler2' m, u% ?) G* H3 w3 m3 N3 I
    xchg    dx, es:[41h*4]6 ]& g( G* {9 n% q% f
    xchg    bx, es:[41h*4+2]7 e6 x( Z; E9 k" J0 J5 U
    mov     ax,4fh& m+ T) _5 {( V- p. O- N
    int     41h, l$ o. \0 X- s! @
    xchg    dx, es:[41h*4]) Y6 m$ I' F* P0 d) Y  ]
    xchg    bx, es:[41h*4+2]
+ D- T- ~: K' V4 c1 C. z' q    cmp     ax, 0f386h
( u8 u0 i. H/ t- S    jz      SoftICE_detected* r8 Q; h0 k, B9 p( L5 j

2 P) x- G0 |" H5 P7 X" V1 b4 L2 oint41handler2 PROC$ r+ m4 S8 Z* c
    iret
! W  G. X4 ~0 e( a3 z8 Mint41handler2 ENDP" i% e  f3 x+ p

: i4 n$ E1 m: p1 I/ n- D
; V' l$ ]2 g# P1 [: Z_________________________________________________________________________) h0 f3 e1 O' M$ q9 a! E9 e

7 ^; E0 D2 i: K0 n) g
" [! F. D2 I3 E' w5 d+ EMethod 06/ m( b- g: d  b- y( n# s! L
=========
5 G" p, `# |8 s0 g1 s( }% I  ]9 e1 y1 W
4 l* k* F% B9 r" m8 V: U" C2 o7 ?* J6 v
2nd method similar to the preceding one but more difficult to detect:5 L, M# m( B, S4 m) o0 J* Z$ s
9 D5 j1 |0 |* \2 i9 y+ h
. t2 R$ P4 y6 N  h) \% m/ r+ c! ]1 G
int41handler PROC) p! K; n  @( C/ f' p
    mov     cl,al
# \# }7 x6 m3 W' \1 U3 t    iret
3 O, x! z) l. C& }) {3 g2 ^. y9 rint41handler ENDP4 v) F9 Q" t- o

- r4 l) U$ q! p3 @+ S1 i* w
* R: \  ]% {5 U$ N% Q4 x& i1 \, e* J    xor     ax,ax! t& p' O/ r. a% p0 x
    mov     es,ax
6 r8 ?. ~% y5 I7 L    mov     bx, cs
2 y  @" N: U! p4 u    lea     dx, int41handler
: v/ {* T  h! f& ^- q& R    xchg    dx, es:[41h*4]
3 _* }7 ?* m' M, G    xchg    bx, es:[41h*4+2]! @* g9 o4 F1 U/ ^
    in      al, 40h
1 i# `0 W# D# h; K- |% f    xor     cx,cx
5 R+ F$ t! y8 ~; M: S; R, I# _4 U6 O- X    int     41h
, k) g2 e& M% Y1 j5 ^9 T. K    xchg    dx, es:[41h*4]
- R  s$ t; Z: t$ n' e6 P    xchg    bx, es:[41h*4+2]6 I7 X# Y+ S3 R. d6 e
    cmp     cl,al
( H" Y6 ^% `8 Q" Y# h    jnz     SoftICE_detected
- {& f7 i$ ?$ w& q. l4 Y5 z
; p# V! |+ F8 d* X4 b6 V5 \- Q_________________________________________________________________________
0 `2 x. W0 i" T$ M9 r5 U/ z
: ?+ M) g9 A8 lMethod 077 r3 }; q7 G/ M
=========
( B8 O8 M0 d8 }& Z) p; r) S. d1 a4 s5 A. s' d! c1 o+ o
Method of detection of the WinICE handler in the int68h (V86), L1 z7 N& b0 r! a  I' {1 t1 f" I1 W

$ i0 J$ k* Y# @    mov     ah,43h
! Z) O1 L1 g$ h  X7 b0 \- I    int     68h$ Q% B( K1 `% t- L; \
    cmp     ax,0F386h
" D9 L: O9 o+ a, i- P! H5 w# X    jz      SoftICE_Detected
( V" N( x; G8 z; D# }; R5 m8 a, p6 b# {' W0 c$ ^) \

$ t7 ]# e" ?# I' \. Y- i% M* q=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
+ d8 X$ S. Z, I, B7 w8 i% h2 {; o   app like this:, s/ H' z; h! M" _8 s1 _$ G
; t/ [3 D; I  V0 n/ w; e
   BPX exec_int if ax==68
1 R' ?, T6 Q! j1 Z/ N   (function called is located at byte ptr [ebp+1Dh] and client eip is
& @* [+ x5 g, D% ]% u   located at [ebp+48h] for 32Bit apps)
4 e) c7 h/ q; o__________________________________________________________________________
$ b. _% i6 s% |, B8 G9 U: J  q" J. d
$ C- m9 N1 ?+ l0 [9 \6 ]- `5 C# L7 Q% O7 E( j- v6 l( b7 b
Method 08
4 O3 b/ A0 d* r" B=========
9 B( e; ~( v4 P6 v: @1 ]6 c1 s3 _' I# D: S, P0 N( a$ o
It is not a method of detection of SoftICE but a possibility to crash the
  J& V) g3 E+ [system by intercepting int 01h and int 03h and redirecting them to another
( m+ D# V6 J/ q7 Wroutine.$ k- O0 J, A1 y! w
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 u- A! x$ M4 y. I% wto the new routine to execute (hangs computer...)9 {+ g1 I2 V1 Z; w0 F" R

8 T& D! }5 ~2 _! D    mov     ah, 25h
; a0 z$ F; a. n. O9 X# c    mov     al, Int_Number (01h or 03h): O& g  Z: T  Y
    mov     dx, offset New_Int_Routine
" {1 }& m6 S; t' t% d( I    int     21h
8 k: d& V! d3 F2 S4 a, S2 O9 E
__________________________________________________________________________
6 R9 R* N  j7 j, `( o3 O5 }* I2 Y( B1 {. W
Method 09
& w7 ], [$ f$ S7 Z=========
+ Q8 W% h9 c% I" y. n1 ~
9 L; K+ S: L" N& I% [( YThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 o3 X8 i4 k) \$ A3 f$ o
performed in ring0 (VxD or a ring3 app using the VxdCall).* T3 g  G5 r! O0 j
The Get_DDB service is used to determine whether or not a VxD is installed
! H6 x1 L) j- x1 U; F3 ~for the specified device and returns a Device Description Block (in ecx) for% J. _9 k$ _* K4 [4 x
that device if it is installed.7 `3 }* u4 X; i& X  @1 I4 X

6 |; |$ c6 U" i! j6 R# x' `& q  D   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID% F6 b9 G/ q$ P- Q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)7 f, z3 G/ o* x1 j: t# ^
   VMMCall Get_DDB
3 H* @6 D; j, L; u9 m  \% K# t   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
# [0 r$ t: S# ]8 N$ Z: a- C6 ?6 \1 A' e
Note as well that you can easily detect this method with SoftICE:8 c: f: d( w" Z# s0 e
   bpx Get_DDB if ax==0202 || ax==7a5fh
0 H' Z1 M5 x9 c! w4 i5 k& [. C
) o' ~5 X8 s$ K% U, Y2 m5 Y( U8 O__________________________________________________________________________
! Q, U. J7 i" v6 |% ?6 H- t7 c, j: u/ l: u
Method 10* O/ O8 N# {3 h' N) z' {; A: Y4 Z
=========
: |, _/ y+ s- y
1 l# w: j; {. \% R6 c1 ^8 |4 _7 V. b=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with$ v. m! K0 D5 H. o6 K
  SoftICE while the option is enable!!
9 A$ {! i! D0 E: U9 q/ m
# d1 e& o/ _7 iThis trick is very efficient:
5 W) _) m& s: G0 i' mby checking the Debug Registers, you can detect if SoftICE is loaded+ a; K. k' @8 h) n2 m, U8 J6 C
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 Q+ D8 p' D0 s# ^7 dthere are some memory breakpoints set (dr0 to dr3) simply by reading their: j+ D/ k; j5 j0 g% d" ^
value (in ring0 only). Values can be manipulated and or changed as well( N% J& c" H3 _. S! t
(clearing BPMs for instance)
! V; g& _2 s$ K" B5 ?1 R& [# d" H0 w- L( |7 x, W, s, t
__________________________________________________________________________. w8 c- o3 Q( {  Y5 V
7 ~" ]6 p6 M: e
Method 11& x  I7 g7 r  Q; j
=========
0 B0 f2 G" `0 Z6 e* Z! X! v9 T; b# W. \# Z
This method is most known as 'MeltICE' because it has been freely distributed
  ~) q" O3 q. k4 W( fvia www.winfiles.com. However it was first used by NuMega people to allow- _% o, ~1 s2 }
Symbol Loader to check if SoftICE was active or not (the code is located8 ?* Y' j+ M: x8 K  t
inside nmtrans.dll).
+ Y4 W- j8 G/ O- V  x2 |2 d! A1 G
+ U. ^3 G* @1 U) FThe way it works is very simple:
" U' M4 B7 q4 z( h! rIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) p# i" i+ ?5 m5 i9 C  K
WinNT) with the CreateFileA API.
  M% w* n+ ?* N; \! ?, u/ R! _# C
Here is a sample (checking for 'SICE'):
, o4 R* S- u; g% n! Y9 v0 m+ f& Z
0 q1 T5 p6 l# c- g. Y2 ]BOOL IsSoftIce95Loaded()2 N, f0 m  \6 B$ l6 N
{5 `, N6 b/ W; C' M
   HANDLE hFile;  ) z) Q0 [  J; ~+ _5 U: s- L! ]
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
/ T; V& V6 E" h                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& C, [1 K! k8 h: K                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
( j; b1 D9 M7 m% V( h9 u# Y   if( hFile != INVALID_HANDLE_VALUE )
  a. s6 T! j& E+ b6 e2 j' K   {) ~% n+ }- J3 [  p
      CloseHandle(hFile);" ?8 @4 {+ U3 T- O/ R* ]& `7 v
      return TRUE;. h2 s2 \4 O, ]) f, F
   }( j7 K8 _5 ^1 [+ A' o  ?* _
   return FALSE;
0 C! m' [' h/ e; c) J}* O' A, d8 O9 H# C! N6 H3 H8 q' _) h

) n4 d: g( F$ HAlthough this trick calls the CreateFileA function, don't even expect to be
8 O5 ]; @  i0 H: q9 B6 Rable to intercept it by installing a IFS hook: it will not work, no way!
% [9 {( q, A6 _In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 x5 Q1 Z2 u' M& T1 U
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)1 W% a( p" i& T! h# d' E- r6 C
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
  |9 T% {& n# |/ V5 G6 Z! w6 ^field.; v$ @0 R& z$ A$ i
In fact, its purpose is not to load/unload VxDs but only to send a $ x+ ?5 W' |8 X0 U" D# A
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)2 t; F6 E, Y6 l6 ~9 N& g* b
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ ]* Y9 U( R; e' C1 cto load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 w. ]+ o# D+ u- Y* }- }5 FIf the VxD is loaded, it will always clear eax and the Carry flag to allow9 C6 g* R$ P! s7 u% h
its handle to be opened and then, will be detected.
7 e. p) _- n- O, j% D4 w5 dYou can check that simply by hooking Winice.exe control proc entry point  j$ y8 [+ e- i1 b( ^$ s% U
while running MeltICE.! B5 j2 `0 Z/ c3 ^4 l

! H4 n1 A' z* `8 _
( d( K) j% c9 P: h7 i) z( @2 }  00401067:  push      00402025    ; \\.\SICE2 {$ b8 H# H3 d- W
  0040106C:  call      CreateFileA' |# G9 {/ @/ F. }' N$ ?0 a" s/ [
  00401071:  cmp       eax,-0015 u4 Y7 N& C9 D5 S  x% ]
  00401074:  je        00401091
: y1 F1 B0 s1 v, M1 e, H# |/ Z6 R* D+ n* M3 S" X* C
8 d( N% x5 D! L8 z  Q" Y3 z; O
There could be hundreds of BPX you could use to detect this trick.
6 u% j4 K7 ]) A4 V7 Q, q7 x; u  U-The most classical one is:6 |* o6 e- [$ m5 M* B
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 P8 t2 j/ l0 R/ A
    *(esp-&gt;4+4)=='NTIC'
) H+ u% g! b- Q! z3 o6 W1 }& Z0 C8 l' G4 K+ B  x
-The most exotic ones (could be very slooooow :-(# x0 B0 }  t, u2 a6 z# b  |, z) v
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ( W2 n' D* M& w' a0 u  W( |/ }& |
     ;will break 3 times :-(0 D1 X+ A( H, U9 k- W) m/ z

( I" O5 ?7 m+ a1 U  q-or (a bit) faster:
: v& }2 q1 s9 U2 U. N1 A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')4 v2 T* w  Y: ]5 b+ M# d7 M% H

, u* S) i+ ?! J. r4 B* \6 W& q, d# ]   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  - w3 W; j; ~' g5 N
     ;will break 3 times :-(; G7 }; N' R, R0 `- b+ P3 S! `

) J* O; h* w. }5 N-Much faster:
1 U1 A% r; F; m; d3 a) j4 t. y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
3 x, }% ^+ `$ ^0 Y* t4 F  b% f5 V  k  k2 R* `+ a2 l# M
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen; d" v0 Z8 W- ]/ e# Y2 m
function to do the same job:
5 A% J7 a( s3 T/ }, @+ P7 H+ c8 }  Z4 a# q$ V! `3 Z
   push    00                        ; OF_READ/ Y  |; @1 ]$ S* j9 H% A( ]$ u
   mov     eax,[00656634]            ; '\\.\SICE',0
- ^0 O  W( r. }3 P   push    eax( ?4 Y' B) U# e  X: m, u8 j
   call    KERNEL32!_lopen
1 z6 r* c* T8 x" ]( P" S% b8 Q/ b' Y   inc     eax! K) k: T  E! S
   jnz     00650589                  ; detected4 l2 l" i/ @( m; S( L$ z
   push    00                        ; OF_READ1 A/ j. I1 Y7 i; Y( {; @9 e
   mov     eax,[00656638]            ; '\\.\SICE'* J, v  P7 g3 i; P  E$ T
   push    eax
! [1 g9 X" j- x& Q% d- _   call    KERNEL32!_lopen
, {2 t0 `* R; C   inc     eax
, M0 _: r$ i1 _+ ]& a7 \9 j" m   jz      006505ae                  ; not detected6 }+ K# |. z1 E) q

% F$ ~' H: Y/ n* q/ l
+ J4 m, |# ^6 P" s/ f/ Z0 {4 _9 m__________________________________________________________________________3 d- |2 _! H4 f& M# _4 D9 {5 P

$ t/ |- V8 Q# L/ _9 t$ NMethod 12
7 a% x" X: o4 z2 B# ?# ]+ c  t=========
+ G7 e' K0 a8 R9 A) {1 F9 }2 r2 J! y/ X, a. _. M
This trick is similar to int41h/4fh Debugger installation check (code 05& _8 v8 Y7 l% O* F% z" v4 Q7 }
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ h/ f6 d4 B# E( j" r0 Nas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 @7 |7 L! s7 o& r6 q: [% }; f/ o- `" l5 L- [  m& R2 I
   push  0000004fh         ; function 4fh
, d' M1 S! z# j6 f. m  ^   push  002a002ah         ; high word specifies which VxD (VWIN32)
) E0 ]/ I$ [6 N3 O- f9 r                           ; low word specifies which service
8 M0 S! n* r+ b% I+ u                             (VWIN32_Int41Dispatch)
9 n  g) V3 P3 B' f9 c   call  Kernel32!ORD_001  ; VxdCall
/ N) q2 u8 F2 w1 l7 X5 S" J) _7 p; I   cmp   ax, 0f386h        ; magic number returned by system debuggers1 r* R! U6 a: v: m; Y5 @" q. }; y% K
   jz    SoftICE_detected
1 X' J6 h$ v! ^! X; _; j& R: E5 v& b3 ^3 o, S4 I2 r
Here again, several ways to detect it:+ v+ a8 v& N1 K% P5 z* n( n" }# F9 `
# I+ Z: U6 F& r3 @# E
    BPINT 41 if ax==4f
- A) c; Y& @. o# E% y& I! v  e! ]' c; s* O" b+ f0 F, {
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' R- P; B) G' {# ^  {! W( E5 W% R
" Y+ A2 X# h& S% I) t3 F! R    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 c/ w  H8 f2 I, C( x

& T" _4 S0 C; \7 X# U$ J    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!( S! G2 S0 n' @+ `8 R

( b  T- j9 o/ ~* E__________________________________________________________________________+ o) y: x# h5 m5 @" g9 ?$ q, c1 Z4 N
7 v' a" _$ X$ ]0 j+ T0 N
Method 13
% Y& \# `) r; e: ~8 B=========  Z- m; m3 Q" O* t

) Z* g! M: q# d4 ^+ FNot a real method of detection, but a good way to know if SoftICE is3 D9 n, |$ C, a' R
installed on a computer and to locate its installation directory.; j" d( R5 {4 P+ l
It is used by few softs which access the following registry keys (usually #2) :
* N" T+ T4 F. K: \: U. h) l; A& N% G$ m5 d
* w5 v% T, \' f-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: W! y) B; H7 K
\Uninstall\SoftICE
% T* N& h: b$ V0 N/ f-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE: I* z) [& ^# p$ e
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* h2 u6 _7 }: F1 x
\App Paths\Loader32.Exe
8 V6 g7 p1 w. B+ l9 E! l3 c9 y; a& T. t6 e" _! @
0 k) `/ m5 K& T' l8 ~
Note that some nasty apps could then erase all files from SoftICE directory
. k+ P/ P* F9 T# x3 ](I faced that once :-(* |) u& v" e( E: s4 _; ]3 ~

) \( Q. B8 \0 x9 ]) W( N- OUseful breakpoint to detect it:! B# @8 n6 u4 u; @* b# b) w4 o% Y

1 c0 V: x# \) T) v6 M2 c     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 I  c9 _4 ?4 u

: ~; ~$ e$ m6 e6 J! b( ?* b__________________________________________________________________________4 ~( n1 R& q" E# v

0 t: A2 h9 c( B5 q$ i3 p( h( N$ [) j9 d3 @6 b& x, B3 D3 ]# }
Method 14 6 Z& D+ e3 }3 ~9 O$ L2 K! E
=========
! N( n2 O( g3 h1 n6 t7 T# R) T7 N
/ D6 q& @# v' F: SA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; }/ ^$ |! x% ais to determines whether a debugger is running on your system (ring0 only).
: E3 x7 `+ v/ Q7 `: A+ g) N. n! z: _3 u4 K. w
   VMMCall Test_Debug_Installed
8 h, k& L! b9 w' K5 T; }; z8 y   je      not_installed2 n& ]9 P6 C' c/ |3 ]" b
) p' m: M6 P( X% i& t
This service just checks a flag.8 O8 j/ ~1 Y1 B- x9 W
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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