About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 j6 F, s- @! P- c, E
<TBODY>
  i4 m$ _3 y1 u/ h<TR>
* |' f8 z1 ?: D8 ~. H9 s6 z<TD><PRE>Method 01 9 h. v' ]: ]3 |: _) |5 O9 Y4 ?3 d
=========
( ]) b( l4 S" r/ Y
6 ~9 i  V- B7 |4 b; RThis method of detection of SoftICE (as well as the following one) is
- M7 S2 ^4 M0 t5 {used by the majority of packers/encryptors found on Internet.8 M, d- u9 U" _7 f, N) J
It seeks the signature of BoundsChecker in SoftICE
4 U6 Y/ x7 A3 Y1 j7 X3 \& G; _& b( V8 |- G/ G! e
    mov     ebp, 04243484Bh        ; 'BCHK', f0 W9 r' s/ Y
    mov     ax, 04h
8 S! A1 N# n7 A    int     3      
$ M% r* G2 _# M: u% q    cmp     al,49 Y6 B) h$ Q, D/ a9 n, B, l/ e
    jnz     SoftICE_Detected5 |4 |8 \8 Y8 I5 I" S- O) [6 _! c
9 L: C' Z" T3 i. F4 f
___________________________________________________________________________( O  O$ k' c7 A+ B
$ K1 W9 ?% c3 t5 k1 M8 d+ F0 r
Method 02
9 t# A5 [0 Y; o& N=========
) j. _3 C5 @0 w" T5 ]. X+ Q  w1 p( z
Still a method very much used (perhaps the most frequent one).  It is used# r) d* K6 @) H5 x
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 t) k/ t0 N) p. U: F) _& l
or execute SoftICE commands...  c$ M) d4 |# w2 f/ J
It is also used to crash SoftICE and to force it to execute any commands0 `: T( ?4 n4 w
(HBOOT...) :-((  " |- w  m. M+ v+ k8 t$ C: R
1 s! k0 |( \" C" ?0 N# {: A0 C" x
Here is a quick description:. A3 U; @( D; w  y2 R
-AX = 0910h   (Display string in SIce windows): j& M, T) h% k
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
3 {" [: t$ P) q' G& j1 i4 X-AX = 0912h   (Get breakpoint infos)
# a! L5 `, U+ R* b. X6 x-AX = 0913h   (Set Sice breakpoints)4 M( W* Q. g/ Q- y) Z* y  q+ ?
-AX = 0914h   (Remove SIce breakoints)
! B& @4 p. R5 I4 n: Y1 J8 d1 e. Z6 @1 Q1 t
Each time you'll meet this trick, you'll see:
; @' ]2 x; q8 c-SI = 4647h
, h" u5 Y$ Q+ S$ l-DI = 4A4Dh
9 N, X& a6 a" t2 [% R2 v1 o' h3 vWhich are the 'magic values' used by SoftIce.+ S# s7 b8 u0 D; q4 ^6 c  \( z" k! P
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.8 v/ S9 }& l# M
# E7 R( x, |3 Q8 v/ W
Here is one example from the file "Haspinst.exe" which is the dongle HASP. r- M: {5 p% m: v& ?) R
Envelope utility use to protect DOS applications:) S' p; w. X+ b

1 ~& c- b$ l& g4 ~# z
6 ]. H/ g" O: k4C19:0095   MOV    AX,0911  ; execute command.
" x0 [( w" [- F5 M4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; o0 [/ n$ H3 [% j
4C19:009A   MOV    SI,4647  ; 1st magic value.
/ G1 n- {8 b, k4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
( x% M* V; y: d; P6 R) \; e* D" b9 ~- y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! Q+ X" }9 e/ A- s4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: `/ D( U, l& r0 K. l
4C19:00A4   INC    CX; |4 j4 r6 f! M. f1 X! s' X
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
. r2 |; J# O& k. L4C19:00A8   JB     0095     ; 6 different commands.6 c; j7 R( k" @1 {! Z  G% A
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
; |. `8 X" g" W' @  K: d" a1 N4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); T+ k+ P! N9 f  H
( S: }" b7 J) a* O  J2 r
The program will execute 6 different SIce commands located at ds:dx, which) ~, @% \3 x$ G3 F# F* S
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
2 z" a: Y+ C3 Y- ]4 p  Y
; ~% _4 D7 S: `) ]4 w4 P8 ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ l/ p" {0 j9 j. K3 ~! B; A) q
___________________________________________________________________________* S# q3 h) a' L) }5 Z* c/ p

" _) B$ r5 T1 G$ v8 {7 U
0 i$ b: P0 R8 b" u% Q! e" IMethod 034 z, H& ~3 F) P
=========  ?( O# p. R2 W% M* N

; x4 Z5 e+ W# w2 B3 tLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h& V2 X# S, a+ s/ S9 f
(API Get entry point)
. n9 J) ?3 s5 }        9 `' q! p5 F- n& ^

) y0 I+ e5 a7 s6 I4 X- d; }    xor     di,di
8 X6 y- y) z5 Q( J    mov     es,di  V2 I( ]1 I/ ?! s% W, l
    mov     ax, 1684h       + |$ r5 S& d3 J/ X
    mov     bx, 0202h       ; VxD ID of winice, u) _, S3 U; \" r3 O/ O
    int     2Fh' i( ]* R: t" p( q- o# L% A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 D4 V7 n" u0 I0 \$ ~2 Q% ?9 l' ?    add     ax, di3 }- Q% P6 N# a4 E9 i( t" F
    test    ax,ax$ h! z& P# [' J( [$ z$ r9 m
    jnz     SoftICE_Detected
1 [; R+ t4 u$ F2 b8 z- X* n% ~- y5 g, ^7 z; g" B
___________________________________________________________________________
/ b2 m' X9 e/ P% U  f% k, v" ~4 H: @) R0 r, @5 s/ c5 H
Method 04
) m8 ^4 k% }0 f4 S) B) V=========
9 b: v* Z& o. W2 M; ~0 i
0 s& O. z% n" O) WMethod identical to the preceding one except that it seeks the ID of SoftICE
$ `7 R, D& i# Y' d8 @1 G4 s& hGFX VxD.
; f( d% D1 {0 c
1 c/ R4 b; M  b) L. Z; J: o$ J4 }+ ]) ]    xor     di,di
5 R. j" i- m! J7 z, @    mov     es,di
1 l3 ?. a8 E8 `4 ?- R" p    mov     ax, 1684h       * a$ n* m' r* B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
/ j' N# l) U2 e- `: Y1 ?7 c) A7 t    int     2fh
$ e' O7 l$ n) c& @    mov     ax, es          ; ES:DI -&gt; VxD API entry point: l+ F: W3 i$ Z  y# y
    add     ax, di- R+ W- _/ v- T, h- ~* E5 G
    test    ax,ax, s! G/ d$ q' Q
    jnz     SoftICE_Detected
5 F! Z, Q7 m6 b, L3 r0 |- J
: O7 E3 }9 h1 t5 W9 u5 X; ~$ X__________________________________________________________________________
$ X* U. }7 U1 J& Q3 h2 K$ v5 [1 I* ]
/ _, w# l' O& O! c/ s. }. c' x0 ?2 d" ?0 n
Method 05
- ~& l5 s6 Y/ w. q! h=========
4 l( {# T5 A4 V2 M5 N9 @4 n
6 {- m; o& }: e! K; ?0 `1 yMethod seeking the 'magic number' 0F386h returned (in ax) by all system2 z! w6 p3 U, f
debugger. It calls the int 41h, function 4Fh.7 N5 d( A( ?% U+ K  ^9 l
There are several alternatives.  - L" X9 i/ ?: Q5 c" G
3 x( J- w7 v2 Z8 o7 ?
The following one is the simplest:' \- ?' J. W. c% N4 {0 t
; F( s* q' V$ I8 d
    mov     ax,4fh
; i! U2 D: Q% ]  h! d6 S! R8 E+ |    int     41h
# D( b: K/ W  R! `- K( A$ E    cmp     ax, 0F386
/ X2 [0 R$ h, |' E+ X    jz      SoftICE_detected
$ N( ?/ X2 ], a% Z% T9 m
0 ]$ s. u' J+ i+ d+ J4 Q, O2 N. q. R+ ]8 _+ M1 t$ J* y
Next method as well as the following one are 2 examples from Stone's . P5 u/ F4 B: P4 E$ G
"stn-wid.zip" (www.cracking.net):/ {2 {* c- c/ ?$ h! S" r: r( R) }

7 o, ]2 c% g0 ^5 o8 O! f+ M+ t% K    mov     bx, cs
3 r# N# {% s: o& h    lea     dx, int41handler2& T! }+ l9 K) o6 Q7 s! n6 B) |
    xchg    dx, es:[41h*4]
1 x3 i8 r5 L  D( h/ t! j    xchg    bx, es:[41h*4+2]
/ d6 C, ~! S( a4 O    mov     ax,4fh# U) U8 g8 ~* a+ U7 I/ H
    int     41h
5 E, K% G! ^# k: t, a( X    xchg    dx, es:[41h*4]
( a6 b1 y" q3 d# m9 A) s    xchg    bx, es:[41h*4+2]; M7 {+ i+ p/ z/ f: u# ?
    cmp     ax, 0f386h& M' @' E- f! ~' J# G9 v4 G* _9 F
    jz      SoftICE_detected
% C9 L) d. d; F3 w0 H6 O3 h* g
5 I5 M  l/ O* w3 Jint41handler2 PROC# a2 l* O$ F/ p/ l, H) I# p
    iret
7 Y% ~. g, s' G: M4 H) |8 M0 Fint41handler2 ENDP
; j/ y6 F2 T- `' p) r5 V# ^4 [0 W; W7 V7 j- L
0 F  r, z3 l; T! Q- n+ _2 |; F, L
_________________________________________________________________________
  o: x" p% p: h5 b. C0 l9 B
' K$ q* g4 n- T+ a) T! y/ z% @+ ?3 L: h. f4 j: d1 E3 p
Method 06
: Y$ C6 W) |% ~=========4 a1 N% k; g% l! x" V. G

- x2 u) ]9 V5 Z1 D, D# H6 c7 R
+ a3 F2 a9 D% p" i2nd method similar to the preceding one but more difficult to detect:$ w: r- ?$ ?/ `  a

- ^# i. ?  j) I: e( F. B
5 f5 |; {% @: i; m8 @int41handler PROC; I# M9 T2 O9 c& Q' L: L5 }
    mov     cl,al+ X; R! s) T( {) _
    iret/ Y! U& f! z9 A3 P
int41handler ENDP
$ K% H. V5 q& E; B( V8 }& x1 g; v) v) [7 c2 z, s- a

8 b. c3 I: H$ T9 ^& H5 V    xor     ax,ax# M% E2 |( o. I' r7 @
    mov     es,ax
6 g: J3 G1 p" z* f! o3 T7 ?$ ~    mov     bx, cs* n0 |+ ~; g. k2 {
    lea     dx, int41handler5 `8 {$ j, l) Y
    xchg    dx, es:[41h*4]
2 H: |( |  r0 E. \6 H" o    xchg    bx, es:[41h*4+2]  s5 q' `+ y* S1 M8 n, C
    in      al, 40h8 [0 Z9 s5 |! \4 G5 e
    xor     cx,cx
4 m6 d6 V% F$ T2 q8 k/ c# F    int     41h, R; {: t! r2 w
    xchg    dx, es:[41h*4]4 M9 g/ E1 Z" ^7 T4 j
    xchg    bx, es:[41h*4+2]: E" d+ a) h! U+ t% L: ^0 {! H
    cmp     cl,al
; I, q/ z3 V' v2 }6 x8 \+ D    jnz     SoftICE_detected
: Q1 p5 L1 H& a
. B9 H, p9 u# S1 S! `_________________________________________________________________________" O; e2 \3 H0 t$ q: D2 {
$ x  E& x0 m2 ^: P/ e3 k/ o
Method 07/ [& i$ a% z. v
=========
! V$ j( h% J; b; R; {
7 O" L3 J- K$ d. m9 b9 zMethod of detection of the WinICE handler in the int68h (V86)
6 C& V- ]. Y6 p1 z6 D7 R* ]* U# a3 e  |+ }2 Q$ `; n
    mov     ah,43h
' d8 i3 j0 U/ i9 P3 Z    int     68h
6 w& r/ V. C; X. o1 T" y0 Q    cmp     ax,0F386h/ ^: h$ A$ \7 x8 A, C5 N
    jz      SoftICE_Detected
( S; c% A8 Z2 T( \6 J
' N% W- B. G" _9 t; t# \% Y7 E0 s8 C  A) V- F
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& j* a8 ^6 X( A, U0 ~9 \
   app like this:
: l4 H- r1 O" I. n0 S$ W$ e! f4 T% p* x% o
   BPX exec_int if ax==68
& p1 u5 ]$ }7 _. ]0 D$ F, I   (function called is located at byte ptr [ebp+1Dh] and client eip is% G. t  c9 s5 V3 J
   located at [ebp+48h] for 32Bit apps)# D! n; I: u4 c
__________________________________________________________________________
) i) L6 {( J1 l. W) @6 b: e
5 ~! w1 U0 U4 Y4 F7 E5 o
0 y; l1 K4 j0 ^, F- t4 B% V9 U- LMethod 08" n* U9 w; p" [* g% P- j
=========
) m3 `; L0 ]; O+ E) N
" h. r7 O) i5 [$ y7 s/ vIt is not a method of detection of SoftICE but a possibility to crash the) }0 j( g" D6 R2 ~5 d* v
system by intercepting int 01h and int 03h and redirecting them to another
2 b% c7 H- \0 B$ aroutine.' G5 m7 o, V7 d, T0 h. ]
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 R. e) M* i$ w# y  bto the new routine to execute (hangs computer...)
! ]& h. C0 c& n5 ^6 w- x: D
9 S5 i2 f* h, P- {; z% e6 j& }    mov     ah, 25h
9 _% p% ~3 q; \/ }+ s    mov     al, Int_Number (01h or 03h)
: K/ @' W  T7 C; y3 t    mov     dx, offset New_Int_Routine/ d6 u: V% i( D$ b
    int     21h
7 v# q, k, M1 {! k7 q4 t. l* e7 m9 L8 y  u
__________________________________________________________________________
& A1 u, D# F1 J& ^4 i6 n+ w. }
  {; O) H) m6 n! h. f, E: lMethod 09
5 a: O& ]9 f: Q! v=========: A( b5 U' r8 s7 ?; x5 D

/ m! Q8 _+ o1 p: p8 oThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
* J* R8 t% t- X- `performed in ring0 (VxD or a ring3 app using the VxdCall).1 e3 y) @! E* C  z0 P! p$ B* m( F6 g
The Get_DDB service is used to determine whether or not a VxD is installed
5 j% R  j, B" ffor the specified device and returns a Device Description Block (in ecx) for$ F7 W  u& Z7 a) i
that device if it is installed.
5 J' _# a' s6 @% x8 ]: H' @4 }, p' Y& t4 F  [
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID5 L, z5 z5 Y! L1 {
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), Z2 D+ n5 I' V) ~. w, X: Y  i
   VMMCall Get_DDB
' e5 h& C1 v' q6 E9 o   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: g  |' x" A4 Y/ P8 W: u( s. N3 h' `" B) X9 U
Note as well that you can easily detect this method with SoftICE:
1 c( d! D8 y& z# R" x, A7 q0 w) d   bpx Get_DDB if ax==0202 || ax==7a5fh
+ ?7 t( h. T  t( f* m, u$ d: U$ ^) |' s
__________________________________________________________________________5 B* |- x7 Y4 c3 C' O' B

* u8 m& Y$ }% r  c; z# y. kMethod 103 b  ?3 K: A# s/ H
=========* s3 L- q" T8 @: o: P, |2 o
8 D# [& T( w1 v
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ q% v0 B" h& @0 J3 ^  SoftICE while the option is enable!!6 w) J* g$ \2 m: W
0 X3 ]* w* |/ U/ x* |, ?' R7 q
This trick is very efficient:, H3 o2 n! D9 X* ]/ X: \
by checking the Debug Registers, you can detect if SoftICE is loaded
; ]9 Z1 a, }5 G8 d8 Y/ x(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ D. e$ x- Y3 k1 ]. X6 g2 m2 [3 x
there are some memory breakpoints set (dr0 to dr3) simply by reading their1 S$ e3 H( i8 K9 m
value (in ring0 only). Values can be manipulated and or changed as well3 c2 n8 R3 `$ D5 z( i% R; ?/ l
(clearing BPMs for instance)
/ ?/ b5 I4 X8 [1 H) E% u; p4 n9 n. M5 G2 D
__________________________________________________________________________1 i8 W  ^  L0 _% B
' a8 C# q1 a' X0 i
Method 11: G; s# k: z- j5 L: t+ u# t
=========7 S9 {7 P- U9 ~9 P6 I$ s) x

0 i3 J& X: g1 B8 |+ w) Q" aThis method is most known as 'MeltICE' because it has been freely distributed
( K. o( y, u1 w' q! \; Vvia www.winfiles.com. However it was first used by NuMega people to allow
) _1 i3 a) i( \" x, G9 _Symbol Loader to check if SoftICE was active or not (the code is located
# }! N0 ~& s9 G4 z+ D6 G7 \inside nmtrans.dll).
- {6 K% T, o' B; o( ~  o6 q) ]
9 v! Z- F2 R  V7 bThe way it works is very simple:/ M1 Z! t, w1 I- B; R5 f2 D7 ^' M
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: ^$ H7 U7 A# E8 @$ _8 ~! p& S$ E* p3 MWinNT) with the CreateFileA API.% A  ?' _0 E4 F9 P

" O. R7 {7 E# k, k+ R' I, [' U" f. SHere is a sample (checking for 'SICE'):; `$ j! V! h5 p- x2 y' }* f. m

2 |; m7 b! j' A& YBOOL IsSoftIce95Loaded()1 d) [) C8 m6 i# X2 N  f
{
, F! X, ^; Y$ M7 f7 ~% @   HANDLE hFile;    `: j7 C; ~" e1 P+ o7 j! L2 n
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 k  p* I  v& {6 {8 a% g$ h                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 \+ s. T0 B9 [. @3 |1 e* F  E                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
) Q: I! R6 T) J4 t, C* }8 B! z   if( hFile != INVALID_HANDLE_VALUE )/ ?7 e6 w; \: q% I+ B  Q* |
   {
/ s1 [, O. r6 e# V+ L7 w      CloseHandle(hFile);6 b/ C: `6 b) w" n' @
      return TRUE;
- {( N: Z4 J/ ~* D# O$ `  B$ m   }4 f1 z. W: l9 @, R1 I
   return FALSE;
0 ^4 t4 _2 Q" p5 _2 N3 h6 k" N}6 s; g; m( v' d6 `% i0 n% j( v- U

! y/ m% v5 i( ]) C/ i# Y( sAlthough this trick calls the CreateFileA function, don't even expect to be( s( I6 K( H0 b1 ~8 g! W0 w
able to intercept it by installing a IFS hook: it will not work, no way!" r& G2 ^9 S1 K8 `' d
In fact, after the call to CreateFileA it will get through VWIN32 0x001F" j& W* Y/ n5 S) N; O% @
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) {7 V# V$ F6 F& Q- q; vand then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 {/ q5 }. D* }# D  Z# K& a& ~field.
+ B* H/ m' e- X; z. L# ]In fact, its purpose is not to load/unload VxDs but only to send a 7 m( R% q1 u: ]
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 ^0 H1 Y( y4 x" mto the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 i/ `3 }" D; M% v$ Tto load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 M6 L: E/ B7 K- Q6 t4 z+ i0 q5 W' O' {If the VxD is loaded, it will always clear eax and the Carry flag to allow
8 L# v# i. c& [' x! Uits handle to be opened and then, will be detected.! Q3 J8 G) p: S1 ~7 l: Y2 i8 b
You can check that simply by hooking Winice.exe control proc entry point
5 ?) S4 o- z4 Q1 A( [. Gwhile running MeltICE.- |# `) t8 S  M
$ T2 w& E- U0 B

5 M$ ^" U& a% V% ]% w% k8 ^  00401067:  push      00402025    ; \\.\SICE
) j) S$ X3 m" P+ w9 G  0040106C:  call      CreateFileA
& f* t7 w5 t6 C" G  00401071:  cmp       eax,-001
. t  T3 m" F1 O8 X  00401074:  je        00401091: \, g5 o3 D9 d( B0 o
  }+ a6 ^' o6 G2 @( o" ], Q
0 t. A: G# i, e- h8 Y
There could be hundreds of BPX you could use to detect this trick.9 Y9 S) f& k( M% ~7 T  H3 y
-The most classical one is:. W7 u, r9 n6 q5 E8 S* @
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) L% S- ~; {7 U/ z3 a3 a1 g
    *(esp-&gt;4+4)=='NTIC'* t. ~" J" _) ?" b4 a' b# h4 x

+ G' W  K7 d0 S; ~- N- G-The most exotic ones (could be very slooooow :-(
6 O, M+ Z, \( i8 @   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 _; c# w6 i3 x* ]& Y7 A3 N% B% R9 h     ;will break 3 times :-(
0 o; J) z% S* [
0 E& ?6 i. Y. j- F* @-or (a bit) faster:
. _4 {: W+ c* R8 _: S: K- m. O   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 G) f. s/ I% Y# q8 @" _* w, h+ v" J0 B. O& }9 }( B/ q3 |7 a
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& c8 G6 {4 e4 {0 B9 z1 ~     ;will break 3 times :-(1 H* y! ?( Y0 l: l+ }9 a

  E7 z$ Q7 \, g. ~; g( w-Much faster:
& |2 x/ A9 _; D' `& a2 e" A   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 K# `# v1 B' g6 ]% n
4 [1 u$ c% Q; @, t- C& X# P! F- D6 ZNote also that some programs (like AZPR3.00) use de old 16-bit _lopen5 [' y" [# }4 s3 ]
function to do the same job:5 v' G/ ?; l8 Z8 |

! O7 n. R! v# w" {2 z, n   push    00                        ; OF_READ6 t7 c& k9 ?7 k% \8 W# s% E6 V
   mov     eax,[00656634]            ; '\\.\SICE',0- ^" k# {. I2 ?4 V, k! {
   push    eax
, ^2 C1 ~4 _( S   call    KERNEL32!_lopen* W! C0 L, b& ]
   inc     eax
& X4 Z- C( ^# v) N   jnz     00650589                  ; detected% [3 M' |2 z( z; `, P' y
   push    00                        ; OF_READ
- N# {; F  y; |% p! A- @   mov     eax,[00656638]            ; '\\.\SICE'$ `& _8 ]9 ?4 M) G
   push    eax
) }! E, C) z8 ^; q" u! A' q) |   call    KERNEL32!_lopen" M3 d7 H+ ^: s6 C6 d! }, Y
   inc     eax6 g, a# O/ j( `3 l
   jz      006505ae                  ; not detected5 @, N) O- l0 c. t# S: I
/ q8 B2 t7 c) S0 s* I6 c& }
* i$ B2 ^& x! J9 H
__________________________________________________________________________2 ?: ]' x+ P) j# r3 Y- i

6 I% |8 n  [" E6 j  e% F/ }0 D2 c9 bMethod 12; @( J) q8 o. J% D! I
=========( v# x4 I9 l- r; B- K. ^$ W' w

( H$ y- U9 _) I* [This trick is similar to int41h/4fh Debugger installation check (code 058 s8 X- v0 A! I8 k
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
1 o4 `, N! ~( L, g) z) _as it uses the VxDCall backdoor. This detection was found in Bleem Demo.2 s  b0 }: ?' o: }& I# Y! E8 t4 E

( X  G( D. i3 x) C6 z   push  0000004fh         ; function 4fh! u  M; }4 r( b! N
   push  002a002ah         ; high word specifies which VxD (VWIN32)$ C, O, }" N$ R) r$ }3 v. e7 ~0 ?
                           ; low word specifies which service) d+ A& L, a2 y) G2 |
                             (VWIN32_Int41Dispatch)
( T- r- j7 R3 @3 i   call  Kernel32!ORD_001  ; VxdCall6 _- b' t, _. R
   cmp   ax, 0f386h        ; magic number returned by system debuggers( t. {$ }$ F. I9 _) `) W) P
   jz    SoftICE_detected
% ]/ [( @5 i5 J1 G, A- l. L8 x. Z! v- ~; c3 C/ O7 c
Here again, several ways to detect it:
8 b( ?/ {  ~* \& W0 `
6 C* b  A& z. l1 K; c- `( T    BPINT 41 if ax==4f+ |9 t$ q" q0 r; F* g  {: i
. J9 t# @" x( p, ?9 Z; K/ m2 T
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) X8 I+ U# j% ~8 ~. p
& n: M/ W, j: D* ^* o+ R2 `
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" h$ R5 ^) `: W) `) u7 |# ~8 x
9 e+ `: h" M0 T6 \0 Z: A- @
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!: C2 g! s2 }% I4 M1 ?/ z, Y0 `
3 Y6 ~9 C- d" F$ w
__________________________________________________________________________
# y, d( [, z* [: y4 V2 Q& T+ {& p* E$ N4 B" h# N3 k* n
Method 13! W+ e, ?, S' C1 {  T: k* `: F* d
=========
0 F" o5 p* i( H" Y4 ?5 ]
" J8 z' E1 Z' j+ p; Y0 J3 I- kNot a real method of detection, but a good way to know if SoftICE is# H$ R; \% J& J& E; y3 [2 v/ u; @) N
installed on a computer and to locate its installation directory.' s" s2 b1 }# a. H" y- K
It is used by few softs which access the following registry keys (usually #2) :
% R! B8 h$ \  g3 c9 \* q8 r
/ k5 I% T$ o; O$ L& }7 v-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 `5 V  Y4 Y% l. F. G" O6 N\Uninstall\SoftICE
9 d# R0 a% F- Z: J! C5 K-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
: n6 u! A- p" q  ]-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( W1 t* o/ s( M) d. p+ ]+ H! U! w8 J* ^
\App Paths\Loader32.Exe
. g' ^' |  \2 V4 n" G0 H
  P  r1 y9 ?+ ^+ ?$ R
/ v5 n# b& x7 |: ^* }1 MNote that some nasty apps could then erase all files from SoftICE directory& D( k6 P0 `9 [3 B1 G/ J$ K
(I faced that once :-(2 V  a+ ?' Y" I+ a$ ~, u0 n
/ X5 {0 j9 `; n" O7 }, g
Useful breakpoint to detect it:
/ }- c9 g' C. w
8 K: [% i- ]3 ^/ [     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'& l8 j7 t6 Q8 q

! x( l0 O! _& K& q__________________________________________________________________________2 n! W& M  x; h0 j% a- W
+ b8 `8 h. ]9 ]

7 f* O# }" Q* q4 W9 T1 y' xMethod 14
8 D4 D2 i" |/ l; `& n=========5 k/ e) X1 F0 E: Z. V, M, j
# O; v# i! n) M
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 I! t6 S* B' V5 M$ a2 O6 |0 xis to determines whether a debugger is running on your system (ring0 only).- s) N+ \% N2 f0 M( r1 n
4 S9 b2 @( H) u
   VMMCall Test_Debug_Installed
" `: }' G, R9 d   je      not_installed
; g  X+ {# N) p# Z8 ]3 i3 l* {( n; l: m. N& l7 l& i0 ~
This service just checks a flag.7 z# u/ y. t; k2 {  Y$ l
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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