About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 [0 `9 p. l9 Y$ t5 S<TBODY>
5 c2 z& C) s" M/ Y5 Q/ J# n<TR>
8 `) f% n) E5 k1 r! |, \<TD><PRE>Method 01 3 p+ h& w9 ]/ l  i  Z* D6 b
=========
( O# o+ C: Q( j/ X' M
3 }5 l$ ^6 w# U0 mThis method of detection of SoftICE (as well as the following one) is9 ~5 e" ]' X; n, d
used by the majority of packers/encryptors found on Internet." b, A! |% t& B7 b/ i2 E  G
It seeks the signature of BoundsChecker in SoftICE
  ^  W* j6 @& D) \6 w4 u1 }
$ e8 P$ I0 Z. L4 J# @    mov     ebp, 04243484Bh        ; 'BCHK'
* @8 H- @2 p, Y& x/ j    mov     ax, 04h
, @1 H) N0 K1 |    int     3      
! @) B; E% ~, K$ v  F0 t    cmp     al,4
9 ~) A" _& u9 D' u  [' q; G    jnz     SoftICE_Detected* l( j- \: {) M* I; d

+ ^# c9 S- Y7 V0 O/ z) f___________________________________________________________________________
+ e( S2 e7 _$ D$ i1 o+ y  b1 ?) a1 i1 q1 h2 S5 C5 a) X
Method 02
6 b3 j! z, R6 @=========
( l6 ~; f& y7 f: r+ v6 d1 g: u  o' J1 q8 D
Still a method very much used (perhaps the most frequent one).  It is used4 F. q: W" S" u* j; l3 ]) l
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ R2 I% E' Q& l6 Xor execute SoftICE commands...0 O9 m: c- {! Q  g
It is also used to crash SoftICE and to force it to execute any commands! d5 j/ h' \( P! v+ |$ P
(HBOOT...) :-((  
* L' ]0 i% _/ X8 r/ }
) D" j( j# p, p3 L8 W/ CHere is a quick description:; @+ I/ r$ R/ n7 [4 z
-AX = 0910h   (Display string in SIce windows)" |9 Y1 V6 N9 v0 Q3 }
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* {' G; i  T4 I( ?- D. D/ [) N6 w-AX = 0912h   (Get breakpoint infos)
; d5 N1 U& n# f. N-AX = 0913h   (Set Sice breakpoints): [. X  {$ z: Q- K3 f+ ^0 \  @
-AX = 0914h   (Remove SIce breakoints)7 D. O' W! q5 O3 `6 Y
4 u  J0 o) J; E' y
Each time you'll meet this trick, you'll see:7 |7 g2 m! x" ~5 T/ t
-SI = 4647h
+ _4 ?" V/ e# {3 j-DI = 4A4Dh  }8 j8 S! j; e$ q
Which are the 'magic values' used by SoftIce.2 p/ D0 D1 A1 k( r3 M
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% d1 }' B2 k! ?, x7 f/ R3 p4 o! a
Here is one example from the file "Haspinst.exe" which is the dongle HASP5 W; N8 _% z) _- ]
Envelope utility use to protect DOS applications:
4 b2 I0 D. j" \' k6 @. ?0 {' R+ z3 f3 V/ j( F0 D- y

+ C8 R6 S3 q& A1 C: C4C19:0095   MOV    AX,0911  ; execute command.5 F/ i# ]$ u! w
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. a/ v8 s( A1 H- n' K4C19:009A   MOV    SI,4647  ; 1st magic value.* Y/ |' y# ^' p/ Y" `, ~
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
( n( k/ J# Y7 \3 @. A+ Y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 z& M* ~" f6 V/ L+ {: w: [4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
1 ], K2 b/ q' Z/ d* I4C19:00A4   INC    CX
$ J$ H! s4 D7 @! u4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute9 Y$ F. h! i' F% U2 B+ y! K  ]
4C19:00A8   JB     0095     ; 6 different commands.
. i  U0 L8 g6 {0 i- X: j- B7 n4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 {4 `$ v* U" y" y* ^4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)1 s. N5 i( Q' s, B7 I
$ o; r" [' \- ^# r
The program will execute 6 different SIce commands located at ds:dx, which5 E. I% `" \" ^! E2 {0 K) ?. S: q' S& ]
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT." S7 Y1 v/ F- M* L/ t: H# b
0 y/ D% \, g% Y4 F: d- N6 {
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.: _* _' |" V* H
___________________________________________________________________________
- @5 i/ u1 H$ {# Q' z2 N9 A7 O" ^+ G5 N1 g" I
7 D$ \5 S( l1 S7 {
Method 032 y9 X. w- f5 x" B  l: m
=========
" ~. H0 B" Z2 d" s, ^& E' p2 `/ U
; Z2 }8 D9 q) W6 O* ZLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 [3 b" r$ G! p7 @(API Get entry point)
( A8 f! S+ S! z7 q& f5 X" [        5 C, E  R0 S) h) Q
0 {5 u9 c7 b$ q5 O4 C; \: i& Z" u
    xor     di,di. O/ i8 L" h" B& J+ t1 K
    mov     es,di
$ l  i2 [2 c2 t, `8 q; B8 f    mov     ax, 1684h      
% N( V8 f8 M* _- R6 {    mov     bx, 0202h       ; VxD ID of winice
+ Y* {6 \9 _7 s) P2 i. ~) x& R. Y" C    int     2Fh
# g. c4 @. W* s! k3 P. T! S    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ j; `6 Y4 E/ C0 i    add     ax, di
+ D9 b; r" o* P2 e: C" c    test    ax,ax, F. \+ ]$ ^2 H  b! w# Z- `
    jnz     SoftICE_Detected4 r, \$ Q: ^! ]
9 }) R6 |* X. l8 X. x- i
___________________________________________________________________________
+ ?+ }. N  F# ]
5 I3 c% a4 v* ^4 t' l/ HMethod 04
$ _8 p& t- M- Q1 E6 a0 c=========
. U# V" D$ o! @: H2 i) q1 u9 ^8 d6 Z4 u, |
Method identical to the preceding one except that it seeks the ID of SoftICE2 I6 @) k. J( a8 a6 X: f
GFX VxD." e/ ]' f( K6 f1 ]; d
, F! ?) k: W* ^3 L: @
    xor     di,di
0 `2 q! n3 E; g, p( Z. \" V% U* y    mov     es,di4 y$ Q+ f# [. ^5 n% [
    mov     ax, 1684h       9 W/ f* K  `% _8 e* V1 M5 b
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 N! {" j0 n# M) f    int     2fh- @' `% u: ~3 D7 f) b
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( p" {& t' J& j& B  x/ l    add     ax, di
8 ~' o5 _  G3 ~- _    test    ax,ax
* t) F8 {) n2 _$ p/ Q    jnz     SoftICE_Detected: x) v* C9 M* q. r0 X: b  s$ F
% k* Z0 t( v! ]
__________________________________________________________________________3 o- l9 ^7 Y/ o% n2 u, _
; n! I8 S4 d4 n0 @" B! ~6 [" V
3 S$ Y  h/ t4 F# c- L/ r% F$ {
Method 051 n, f: H2 g: r8 Y2 f# A5 w* t
=========
6 ?- W7 p5 t, d7 `6 s' z6 Q0 Q" w. B* g/ C
Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 r6 K! \0 @2 tdebugger. It calls the int 41h, function 4Fh.7 y/ H! f# |0 b, s  X
There are several alternatives.  4 F% s$ e3 W; x! ^7 @

3 F- p. [& v" K+ hThe following one is the simplest:
. b8 r* R" M: e" P/ \' f2 t& e! t. q0 P5 y/ ?
    mov     ax,4fh' _9 I$ ^) ^, Z. ?) \2 ^2 T# M
    int     41h, p) U/ }5 ^8 ~8 c: h: Q4 a0 h& @
    cmp     ax, 0F386" i0 T. g$ d2 _4 _- P) h
    jz      SoftICE_detected% t7 {# X- i9 a# x" n1 C! R7 r

+ Y8 S' b! }+ [! ?
  M1 g1 U% ]) t% @( zNext method as well as the following one are 2 examples from Stone's
/ d2 `- S4 T0 V$ T5 l, A3 e) b"stn-wid.zip" (www.cracking.net):
  e: i% _* C- O5 T0 N; P
) t) O: ^1 W4 b0 [1 d8 A    mov     bx, cs: r, N/ V1 B5 ~& a
    lea     dx, int41handler27 b# u  M4 [! ^! t" f
    xchg    dx, es:[41h*4]
  l6 G9 P+ j3 h9 ?. u+ U    xchg    bx, es:[41h*4+2]
2 [( g* U) c2 m  c7 g    mov     ax,4fh
$ r  }1 ~4 {; H3 I; L/ q* L    int     41h0 k" R8 V% o7 S1 P
    xchg    dx, es:[41h*4]( _$ L1 h' G& {9 ~' @+ |" k3 a6 W0 k
    xchg    bx, es:[41h*4+2]
# Y" _& g# c; R# V4 y% z    cmp     ax, 0f386h
7 u5 G2 }* P* Q" D% z; T    jz      SoftICE_detected# c3 X6 I3 Y5 {6 F

# L  v& m# z# `. `int41handler2 PROC8 k  e5 Z& ]0 U9 y/ s
    iret- ]' v' f( u& B
int41handler2 ENDP' q& P  M8 P8 A1 s. z8 }# R" q
$ K$ m1 }+ s( F- |; n& V1 q- V5 Y
4 E& E+ J7 z) x+ |. `" w4 C  ]
_________________________________________________________________________
4 d# A. t8 P1 a
+ g- d+ I% k8 r, w' Y8 J
) y" `' _. J6 \+ f( CMethod 06
$ f2 m; G( ~; L* |( ?=========
3 O' E2 z7 R& F) p, ?
2 y- n! [% y) A( u" v+ _. |; a: k6 s) X, B
2nd method similar to the preceding one but more difficult to detect:' h5 }( u- B) c0 s+ J

/ K# V% G4 |8 s; _" h' n' `% }
# k, \& _* C3 b% Q4 [int41handler PROC
" }5 `& Z) B( G% B: ~6 \    mov     cl,al1 K, i( d5 N$ Y2 |1 q
    iret( S; t. X/ M; o# H7 K  N9 o$ |
int41handler ENDP, [+ v9 w( V! X/ B! k& o3 ^. j
) Q% X/ G, {, I, l: P8 M- U% a7 Z

5 x3 x0 C3 Q- g    xor     ax,ax
/ ?$ M9 d8 C! k5 U7 q$ Y( J    mov     es,ax) \6 n- R! {- [0 k$ R5 A  u
    mov     bx, cs( i4 l0 x1 b" {1 N
    lea     dx, int41handler
5 q* [7 J$ }* o* @    xchg    dx, es:[41h*4]
. e; i9 A7 k: f& |5 |, s    xchg    bx, es:[41h*4+2]. |' D* M0 N0 M4 `$ A
    in      al, 40h
9 r( e2 N- R8 L7 k8 ]    xor     cx,cx
! y% Z' J- R* R0 f7 w    int     41h* M, X; u+ e2 j5 R* S$ V& Y+ D0 l/ a
    xchg    dx, es:[41h*4]& M5 k4 r4 o: V4 E" S
    xchg    bx, es:[41h*4+2]
7 o$ _& v. t3 ]) B0 H/ o    cmp     cl,al, W0 i( W# F7 l; I  L0 F+ C5 ^9 V
    jnz     SoftICE_detected9 X0 B5 u6 ?- Z  e
" z- u6 O' F2 U
_________________________________________________________________________0 F* h6 e7 U  h  d7 l9 a

! Y' u7 z* D% D0 D, ^, iMethod 07; k6 l. {  ?. O; ?1 i3 g; }
=========3 W/ p! z, m# R5 p( \

9 C2 E8 {$ p% B4 s5 z6 jMethod of detection of the WinICE handler in the int68h (V86)
! a6 H8 o) ~$ n; S. L: m) V2 p& L9 I  D- y9 B% E* [
    mov     ah,43h, ^& g5 n# x$ m
    int     68h
. s5 t3 j. s3 \( C- b    cmp     ax,0F386h6 B5 P$ r3 g( W1 D: P5 S! q0 ]+ m
    jz      SoftICE_Detected
; s3 H9 p. l. ]: A! G) i: k' i$ V, u9 A+ k- H/ X* q# Y

+ q2 f& g  r& R3 d* H2 c# y; J=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. e! {5 Z; O6 S( ?0 ^: v  s   app like this:5 E2 z5 t7 C7 p% b- ^
6 p2 D5 s( e% Q
   BPX exec_int if ax==68  v, M. z" J9 U( h% Y1 c: w
   (function called is located at byte ptr [ebp+1Dh] and client eip is2 C$ ~; d1 u- X# Q( e3 t
   located at [ebp+48h] for 32Bit apps)
' o2 O! j$ z: b: v6 `: D; s__________________________________________________________________________+ k: J3 o% x3 z0 K. l& E. r

. y2 @2 D% i& D- L$ ?* ]/ R7 g* J7 }+ K! L3 h1 a" |
Method 083 n7 q- }- K& G
=========
+ f# f$ k, ~7 _6 ~, c7 e
6 Z: N. V, m1 Z6 \$ ^, ]: DIt is not a method of detection of SoftICE but a possibility to crash the3 e8 W9 C( K+ T: U- i$ w
system by intercepting int 01h and int 03h and redirecting them to another' ^! j, k: Q: ~: {8 n6 V- N  a
routine.2 n% d$ _/ u$ u+ k
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% Z3 S1 O' y! T6 Z1 ~; m8 I9 {. wto the new routine to execute (hangs computer...)& F% o# F8 K: D
# H/ _; e$ o8 {( X' J# c! Y$ ]
    mov     ah, 25h3 X5 J6 \0 [. h$ I$ u6 T7 Q
    mov     al, Int_Number (01h or 03h)3 N* q& |5 V6 O1 p8 p! z
    mov     dx, offset New_Int_Routine
: L$ ^, f4 w/ k& o- K/ A    int     21h
% P4 k2 I. A% i* q
. Q3 a: Z6 g# U( X__________________________________________________________________________
9 ]" {+ O! \3 P4 L$ N/ r4 ^8 {. U2 n
Method 09
- V9 i; l0 U7 a- ?3 u+ a=========9 {! `8 r8 }6 ?( E0 M- |5 b. ~

' h1 h; P+ P0 J; a- W8 }This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
5 V  H+ z- n" ]; K3 N3 Q: Y2 i7 Fperformed in ring0 (VxD or a ring3 app using the VxdCall).3 \" @) j( F6 W5 p( Y) S* g
The Get_DDB service is used to determine whether or not a VxD is installed, b0 g/ h4 G3 W2 z# u
for the specified device and returns a Device Description Block (in ecx) for6 L9 Y0 {# C- S  d2 z1 m! V
that device if it is installed.& |' r3 _# d' X  Z, j
0 R1 P  n* {' B2 R* A4 ]
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
4 f% V1 m0 m: J   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
' ?" m* b- G5 U4 d8 @  V6 O+ r! P   VMMCall Get_DDB5 f) U* L3 X8 c6 m
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: [" x% ?4 Z) D6 d+ C$ s5 v/ _. G5 u8 J6 _
Note as well that you can easily detect this method with SoftICE:
4 C1 o" Q; Y9 h( W1 N( |  ^   bpx Get_DDB if ax==0202 || ax==7a5fh6 I- J1 ^0 r( Q

% [" ]! H8 t9 Z; ~9 l__________________________________________________________________________
, u9 u8 r; q) L0 d/ y' w; }3 J  G0 N" Z) Y1 @* p6 ?
Method 10/ r/ i& g, ]7 L  h# U6 i/ K* U
=========) f  v  `  R$ _) h0 r: Y
; Z1 }8 s% }2 }$ f
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
8 [, H/ k$ ?/ }1 r  SoftICE while the option is enable!!
8 T# j( r# m' o1 z: C+ \1 f) k9 h" R0 V0 F: a3 [$ N
This trick is very efficient:
! G# L8 r7 r7 @8 W4 s3 U3 dby checking the Debug Registers, you can detect if SoftICE is loaded7 }1 O% b$ S: A" ~: A
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: r0 v/ \9 ^4 {) k+ U% \  Ethere are some memory breakpoints set (dr0 to dr3) simply by reading their) \. D( R2 `/ ]
value (in ring0 only). Values can be manipulated and or changed as well
4 J7 f0 `6 k4 ?, {! M, R- b& J(clearing BPMs for instance); e- F; U2 G7 m: i8 x5 ?* W& X. U

$ I* z! H* `4 h) Z  s* c( K__________________________________________________________________________- k2 I7 N, s: j; `* v' V4 N
- {4 D% C' n2 d! x+ ]3 _! l4 J
Method 11
2 r. w( F, t; m* B- M=========- `' o( Y# ~# V* i" O- z5 C; V! A

5 C! i9 c6 o$ m7 j) E% q. gThis method is most known as 'MeltICE' because it has been freely distributed
: ?1 `. p7 f% ?3 O! Z2 m, S# `! v, Yvia www.winfiles.com. However it was first used by NuMega people to allow
0 `$ T. _1 e" s0 N" V. a  R. ASymbol Loader to check if SoftICE was active or not (the code is located
2 I# `. Q- b% U8 dinside nmtrans.dll)., Q8 @/ b* O) F% x4 a
) v1 B! q8 }+ P0 _6 e+ ]/ V
The way it works is very simple:' @8 }/ @$ k# _: w
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* J/ ?# j. b( i9 v/ a* o' o6 K6 lWinNT) with the CreateFileA API.4 A4 A- v* V: Y0 r

% w. M# M( u- X" E) rHere is a sample (checking for 'SICE'):$ x( q9 w4 _! o; T+ m
5 g) k6 k$ [; q& n5 r* ~9 F# r
BOOL IsSoftIce95Loaded()
9 P- O6 E6 ?. y1 |1 Z{
; b$ O* r* S1 s5 C% J   HANDLE hFile;  
/ `6 u# r8 L) x4 [   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% c. F3 Z8 f) x  W) O( b- g7 ^                      FILE_SHARE_READ | FILE_SHARE_WRITE,! c% H% E2 m6 T/ j0 Q4 }; T# E
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  d: P  }. }* b+ b& @   if( hFile != INVALID_HANDLE_VALUE )
3 ]! [% d; [' `& X+ ?& n) N   {
* \# W9 L6 Z! E- v, N& M! P) {      CloseHandle(hFile);; V: F* w0 U* m3 Y$ }0 ~
      return TRUE;
% y* D. i+ \0 M1 W   }! Q9 M4 Z) x4 C" v& S& f) ?2 B
   return FALSE;
' m) H$ G3 f! T6 Y. b}* O: ]4 L7 |# M

7 }! @" h3 |' Z# N/ b) D8 z  a% cAlthough this trick calls the CreateFileA function, don't even expect to be/ w8 Y2 l" J8 s
able to intercept it by installing a IFS hook: it will not work, no way!
/ y3 F* }; f6 Q6 `In fact, after the call to CreateFileA it will get through VWIN32 0x001F
* d  K5 t$ X, E+ a' k5 F1 s  bservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( d  a/ ^* G; V3 a; }$ s2 P7 Xand then browse the DDB list until it find the VxD and its DDB_Control_Proc/ J. J5 i0 i1 L2 f; B0 F
field.6 J2 O% [, V7 J  B
In fact, its purpose is not to load/unload VxDs but only to send a
! `. M- }! g# x( i& h0 y# dW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- J" H; ?! p  Fto the VxD Control_Dispatch proc (how the hell a shareware soft could try; `$ n* W6 i2 h7 j
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 x+ i- J/ ?; WIf the VxD is loaded, it will always clear eax and the Carry flag to allow! r- z7 U- f* C" x2 k$ [$ i
its handle to be opened and then, will be detected.
" Y8 M$ Y6 ^4 O! R, j( V9 H& j' V! V0 |You can check that simply by hooking Winice.exe control proc entry point6 p/ h7 j. L9 j8 V& M
while running MeltICE.- }+ E0 E1 ]$ o% V$ B- F* R$ N
% g, C1 f5 |: H7 y
4 a( E" I; ~* n: {4 `, A
  00401067:  push      00402025    ; \\.\SICE& |- C1 `; |& _
  0040106C:  call      CreateFileA
3 F& D( R6 k$ l  00401071:  cmp       eax,-001/ {% m* V; y2 x8 j4 ?% ]
  00401074:  je        00401091
# z: E$ z: r2 x3 h' c5 J6 B; v  `- K/ o$ S

% H; W$ c& n& L5 n8 sThere could be hundreds of BPX you could use to detect this trick.
5 ]; b! T& x5 S3 @0 O6 F6 F/ f  h-The most classical one is:8 `1 Q8 O' N) H/ x* |1 ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 j2 E6 z' e% e9 y+ g! {    *(esp-&gt;4+4)=='NTIC'7 N8 ?5 M& X' ?1 K* }1 ?1 t

' b9 n$ L7 \- u, x' R: A-The most exotic ones (could be very slooooow :-(
4 X- @8 F; ~7 h8 f/ u2 j   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- u% r: e  ]* x3 f. |8 l3 ~5 g     ;will break 3 times :-(
/ y0 k2 Q* d! I8 h2 B
5 C: y) i& b5 x4 H% F* p$ {3 A7 ^-or (a bit) faster: " K: t5 B3 `' G- i5 O% S+ V  x
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
8 e/ ]( p: q  Y1 x$ e* u, @0 [( J5 a3 l/ a. B) ?' S# z4 Q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* ]! ?& h+ N$ g5 y     ;will break 3 times :-(& O* W) o+ R1 w: N+ k! u6 B  W

2 F! J" F* [/ _6 c8 m-Much faster:# ?1 ~- k# I/ n- V$ a$ G# L3 l
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 m! L9 |4 k! h" c
* l6 ?, l% F. Q, O, k. r* `Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
4 K" R/ Y8 q% efunction to do the same job:# x6 \' \& Q* G5 f

! ?) I* y! Y" r6 }   push    00                        ; OF_READ
0 J) j  a: g9 x& P$ [; t   mov     eax,[00656634]            ; '\\.\SICE',0
+ X2 O+ I: o& R4 r: z   push    eax
- \2 D2 H0 d0 H& m   call    KERNEL32!_lopen
' z) U, G8 ~% w' h: z; v0 @   inc     eax
* F1 l% u* S! J' i   jnz     00650589                  ; detected& L1 t/ d1 l2 w; e& E. V
   push    00                        ; OF_READ
9 Z+ A  R+ M; W" Q9 M   mov     eax,[00656638]            ; '\\.\SICE'
. |, Y$ I& r9 t+ p   push    eax
) {) Y# y. ]1 L/ \0 _/ N9 S   call    KERNEL32!_lopen
5 B" `/ Z4 c0 g+ X3 a! M" [( v   inc     eax
7 T- N: [9 R, r7 a   jz      006505ae                  ; not detected& O( D" Q4 ^; L
  X' B; x/ L- n. [
/ E- g- j1 C6 T, }$ P2 ?: u
__________________________________________________________________________
1 n  {8 u/ G) J- @7 L5 x6 w- c& r; G% g1 K0 p" C/ n) a* l
Method 12+ p- l6 ]; s; T& [9 p2 [: I/ C
=========$ a' T- i, S3 ~* v: v4 e$ v
/ H; P5 q* x6 U; ^8 g6 L
This trick is similar to int41h/4fh Debugger installation check (code 05
$ q9 G$ k. Z9 H/ w&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; c& E2 D/ H# P9 ]# Vas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 C2 r0 c0 r1 ]3 ~  o( Y
5 o# G0 f6 \: J; v+ @/ l0 s; w   push  0000004fh         ; function 4fh  m7 x( h: H. m' O0 ?& p" x  z4 G" n
   push  002a002ah         ; high word specifies which VxD (VWIN32)4 r! z2 s& n# d0 [0 T8 R
                           ; low word specifies which service
% Z9 c5 W# |3 a3 {  R. j                             (VWIN32_Int41Dispatch)
7 c: h; [: q) V, w9 P3 R/ Q   call  Kernel32!ORD_001  ; VxdCall" B5 B3 o- y& J/ Z
   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 t, \" @* x; p+ t" g9 O3 `4 F   jz    SoftICE_detected
5 E0 z! L: P# s0 ]/ `; {4 X( U
" }+ j' I. |: t0 kHere again, several ways to detect it:
/ N% Y4 v0 Q  O8 a& k5 m  Z# c6 U# }+ k- n6 n
    BPINT 41 if ax==4f
/ p9 O: Q' t& t" i, Y: L7 \
! M7 |( ?  y  \" H- f7 }% D, ^+ C    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 B$ {+ U  ~! t# ?. R" q8 |# g

! O* }( H" R) b& Z& P7 L! `& c: s; D    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* Y5 R9 j( @$ u% L7 L

  w5 V2 `' r% r! m6 z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# X6 k: u5 n9 Y, M/ f8 K
+ y3 n$ w: y3 \: \2 E1 V
__________________________________________________________________________
; a5 G3 B$ ]( `- m
  N$ t9 j& x+ GMethod 13
9 u$ \$ s6 ^( Q: X: G=========1 ^& l' |5 ~: b/ \
: R( j9 Z2 d$ t, A( h1 i
Not a real method of detection, but a good way to know if SoftICE is6 G9 {% l3 r8 O
installed on a computer and to locate its installation directory.
+ G& v( u& b3 N2 }3 MIt is used by few softs which access the following registry keys (usually #2) :6 a1 f6 L/ {; c0 D

' c7 u" `; Z; f9 B- S-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ \8 Y, k. c/ U
\Uninstall\SoftICE
2 {3 E8 j' ~+ t+ T/ w" E5 W-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
0 S2 Q" H; R6 Q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- d0 x6 }4 ~0 A! }1 g" m  W+ a  }
\App Paths\Loader32.Exe
0 Y. x4 g3 |$ o7 t8 c4 d4 N3 B( P3 _/ p! k( a
+ ~8 X) i: g* n- j6 s  x' }& U
Note that some nasty apps could then erase all files from SoftICE directory
, A/ d) }3 U% W& V7 K8 Q: n(I faced that once :-(
1 }; X: ?2 j! ~/ a" }6 I% f4 w" z& h
Useful breakpoint to detect it:5 P" T8 Y; X9 @6 ]' w  r

' y+ O" H$ S; \& X$ Y" u     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  a# S6 @9 j7 M
, @9 d# w( w7 y& V+ f
__________________________________________________________________________
, I  P% H% d" H: {3 o* w# E( W* j, }$ j

* g) Q8 p+ `( Z9 d1 dMethod 14
) {" M7 t* `1 r5 A0 s, W=========# K" u* v' r+ a6 y  [! Y

$ F# b' x& F3 ~* R- f( u7 FA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose( T& J# K) o+ ^+ |0 f' w
is to determines whether a debugger is running on your system (ring0 only).7 E; u! M- W" n" v" F0 D
( B3 L  [8 B" H6 D4 p) a
   VMMCall Test_Debug_Installed" r/ z4 r/ F0 z& A4 ]( ]3 h4 C4 d" D
   je      not_installed
( R" @* z/ i) ^
6 }( R9 e* O$ I0 i5 K- ]This service just checks a flag.
2 u8 i6 s  f4 E4 o: X1 B9 j. z. W</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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