About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
/ N& o$ Y& D" e; b8 z- @3 E<TBODY>8 u+ d! z6 N! o+ t' S
<TR>) _& I) I& Y1 Y4 {
<TD><PRE>Method 01 ! m2 c1 t7 M% H+ V/ d
=========. G% n3 S  t" c) o2 p+ q: {: f
- F2 J- `, s4 t$ J* l% _9 {
This method of detection of SoftICE (as well as the following one) is* Z+ c1 U8 |6 Z
used by the majority of packers/encryptors found on Internet.
6 |* V2 D$ c8 a3 n: X& YIt seeks the signature of BoundsChecker in SoftICE
" j" S% ]& V. d4 k0 c7 U. N$ f  j9 F$ `' D0 n* K% a
    mov     ebp, 04243484Bh        ; 'BCHK'
  S+ ?6 s, }  i- M% E    mov     ax, 04h
. W/ D! m  ^  b$ A; i    int     3      
, Q8 Y' R8 J8 @8 G' B* J) m    cmp     al,4. g4 W- M, X( x! _) ^& \7 O  w7 z' O
    jnz     SoftICE_Detected- o  C0 d5 I9 h# u1 R
0 R' |6 g1 G7 b6 o$ q  t
___________________________________________________________________________) C7 b' m$ Y9 R0 l3 A* w* a' {5 e

9 k) S5 X9 t7 i/ e, t' m: ~; \Method 028 F# C# C9 y( s; ^& M6 E* h# R; s2 t
=========
# S6 P- A- g- J8 w3 o+ j* S: n
) s: i# w+ J. B$ A& c; L* F& SStill a method very much used (perhaps the most frequent one).  It is used9 |& e; f2 D0 N
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 O0 \! e8 F% v9 n/ l/ C3 N  q
or execute SoftICE commands...
( ]1 I: t7 Q/ M7 m! G9 xIt is also used to crash SoftICE and to force it to execute any commands1 L* H$ a: z: c  ?( L$ H# W
(HBOOT...) :-((  1 \0 L& [: S- P! u0 P$ b

1 W4 v9 I5 T- iHere is a quick description:
. t4 t3 b: O/ e-AX = 0910h   (Display string in SIce windows)6 R% E* X- e  Z& L9 j
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 b" c8 b$ v  N8 A0 d' l0 W
-AX = 0912h   (Get breakpoint infos)
' B* `7 L$ q/ j5 V-AX = 0913h   (Set Sice breakpoints)' N* w& I8 u, j4 ^. |
-AX = 0914h   (Remove SIce breakoints)
( ?# F& l' [" U4 W2 x1 k' z
6 d, w# r* B: ^6 \! x: fEach time you'll meet this trick, you'll see:9 z# \, S; r7 z. e
-SI = 4647h- O5 D3 K) u' z! V4 A1 i- m
-DI = 4A4Dh0 C# {* A- N/ S7 p& |. A
Which are the 'magic values' used by SoftIce.1 a0 t& a& D5 s1 C( F
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" v0 A2 `. j3 j/ z5 L
8 q+ I: C3 G0 n& _- vHere is one example from the file "Haspinst.exe" which is the dongle HASP
, N3 y7 ]# h/ x# h0 v0 k  j* ^, @# VEnvelope utility use to protect DOS applications:
" H! S9 L5 ?: N/ r+ P* z
% }2 S$ J6 |, X7 W8 s
3 p7 Q2 e7 U" M; L) B5 p0 f, m4C19:0095   MOV    AX,0911  ; execute command.
) W1 i: j8 h' u% F4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. w1 v* l( O: c& e/ r4C19:009A   MOV    SI,4647  ; 1st magic value.0 H* k) j3 p. F- T( r
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
4 k9 i& C! M5 q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*). M; ~' L* T0 e
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- Z0 L% q" X2 R& c4C19:00A4   INC    CX/ U- Z' J5 u& b  \0 ?3 [5 T
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% K2 z, ?3 @4 P4 F0 l0 X
4C19:00A8   JB     0095     ; 6 different commands.
: p1 Z; F7 D' h/ g: ?5 j; B7 y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! |* _# o/ x! ?7 F/ r+ v  ]+ X4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
" Q4 \% j( X/ [5 f, ?9 f. W# W4 h" v  Z, _; X- U% _
The program will execute 6 different SIce commands located at ds:dx, which# D, w" e) v5 u2 c4 ~7 M! x! F
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
/ `+ m5 G/ `# X$ p1 d8 l5 D& _8 J6 ^+ W8 r! v8 u
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* I5 H& ?' C7 ~7 P( [___________________________________________________________________________- R( c! k" ]0 b8 y7 {$ X
/ o5 g- I7 a# q6 {# x6 i9 R

$ P: m- `2 p0 P4 [8 qMethod 03
  J6 m4 ~/ b4 G5 P) m5 \=========
2 a; o: q6 H% G1 D/ U: I
6 i: N; ~. e+ \* j( ]8 E5 K+ o# }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 v  s. i3 s8 T(API Get entry point)
+ v* I3 U2 E' {: j3 L6 \( k$ |# W        1 m# j5 u/ y- M( {8 d, _; _! y
- O! Q, P+ }3 B# m5 i% Q3 b
    xor     di,di4 }; s$ k$ X) e& I2 ]
    mov     es,di
. h6 y  J! ^1 \( P8 J) D    mov     ax, 1684h       - t5 I8 z7 o# p# ~! _) ?
    mov     bx, 0202h       ; VxD ID of winice4 P+ v; a8 G6 `5 u3 S2 i
    int     2Fh
' d6 `& F% g" W6 s- f3 D' Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 y8 }, m. Q' f" p# W    add     ax, di
, ]2 P: i: h& l& X5 X+ }    test    ax,ax
& ^6 C) \5 \0 s" a3 [) M7 ~    jnz     SoftICE_Detected
$ m9 C, [# W& l; y! K9 E6 C" w% X" b; \( S* V
___________________________________________________________________________  V. U5 q* i, P: R
' Y- }+ V! H& W# D
Method 04! l6 p$ Y5 m/ D) _/ }4 |
=========
5 W& ?- z* c# p8 y3 ], _! A* p2 k
Method identical to the preceding one except that it seeks the ID of SoftICE$ v" ?. b  K4 ^* ^
GFX VxD.
7 Q3 \  q. k: [/ j( l& I4 a& }. S) L/ ^2 f2 O- [2 u5 o5 d# O% P
    xor     di,di( T7 F+ K9 l5 D6 ~& d: w/ q; F, z
    mov     es,di
, L# W% `$ g1 g9 f7 z0 X    mov     ax, 1684h       " Y2 \, n/ e; n4 C3 h* ]
    mov     bx, 7a5Fh       ; VxD ID of SIWVID4 A* {1 e- x! \) A5 n$ h
    int     2fh
4 O# d# [+ a. G    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 H: h6 }! e6 `/ d6 f# H    add     ax, di% T. [( b! T  q% t0 `8 z& m- z
    test    ax,ax
1 y, d3 N! R% x3 ?    jnz     SoftICE_Detected- e/ o9 ^# x% l2 K0 f& v
$ m, q" Q* [; u1 H# j
__________________________________________________________________________* L9 P( k* C5 O9 ^

! X' q& i6 m7 _
5 Y4 Z; p: l, B' R4 sMethod 05
0 M3 Y$ N+ x* G& A/ I' k5 O=========
6 ~5 W+ i0 z0 R" e* `
" k1 n4 F2 z. `Method seeking the 'magic number' 0F386h returned (in ax) by all system1 a' r4 x. p& a; o
debugger. It calls the int 41h, function 4Fh.# E5 }$ w! v$ A$ ]9 E
There are several alternatives.  0 B, L) @, H/ z# W9 A

* n& {3 W$ i$ l5 U  @4 CThe following one is the simplest:; o+ e& e+ E" O7 L6 L2 }& ^$ J
5 |4 m6 M5 _1 K
    mov     ax,4fh& Z% F# v0 J, c6 [
    int     41h7 T' C5 _: _" S; I
    cmp     ax, 0F386
8 f5 ?9 S; Z1 U, c" Y    jz      SoftICE_detected. d, b& ?. j) E
/ d2 r* T$ ^  i6 k9 y' a

9 ?; Y# \! l0 }. Y& `/ V2 l) wNext method as well as the following one are 2 examples from Stone's
$ x4 `1 y  Y- V+ ^1 X! y1 |"stn-wid.zip" (www.cracking.net):! H; i- C  r, D- y& [4 ^4 z* \
- [. z5 ]' j) @% `$ _( ]' L
    mov     bx, cs
8 a# _4 M* {/ F+ ]5 D" s2 N& Y$ T    lea     dx, int41handler2
6 S& a  o$ b# h1 P    xchg    dx, es:[41h*4]
4 N' y7 ~& w( w- W' R# N; q    xchg    bx, es:[41h*4+2]
9 W, a6 L- q8 h" v' \    mov     ax,4fh( q) k. W$ ~% z  F2 s
    int     41h8 S; z2 ?8 S  k3 X9 B8 C% n5 L
    xchg    dx, es:[41h*4]
1 h& p1 W& F' H4 T4 J    xchg    bx, es:[41h*4+2]
, G. o3 J) E/ D/ p7 [& b( L* v. j    cmp     ax, 0f386h0 K$ d6 x; c! w: A/ N
    jz      SoftICE_detected
& |7 s0 c: O; T
2 H8 i7 o; U, |int41handler2 PROC
/ M( o$ t. s0 K8 Y; U    iret
1 j! W7 E5 u6 d9 t& W) bint41handler2 ENDP* o! C( S7 b8 ~8 a5 n" H

7 C. j$ _7 L& V9 i
" U  }- U  e8 f5 `( C- b_________________________________________________________________________. \+ J9 N9 k8 ?- [
. N  t- I) y; m! m8 T" s4 |9 [

& M; j6 V0 Y! X% B' \, Y* a& qMethod 06# E: t3 y2 W! |+ |! w! X0 @5 Q
=========9 R" Z: S# p. R/ E. q1 E

: R; h1 @& D- _
9 C, Y( e3 Q; S! k* r5 W% P) C2nd method similar to the preceding one but more difficult to detect:* p4 G& K5 _' j' |3 T
- g1 H: n3 u0 d6 Z! `; ^

- c9 p& c' n- Z; L. Yint41handler PROC
9 ^' ~1 i/ F& I0 P    mov     cl,al- m+ O9 a. [0 Y) @" i
    iret
4 a2 z- a9 A# ?0 b7 {int41handler ENDP( |4 t" L- u8 ]2 {/ k0 G" p7 x3 v

) H  k/ u  p, m% l/ u# o, ^- M9 g0 P& \: \* b- l
    xor     ax,ax
; {) \- `: C& X    mov     es,ax
% k( {7 m, E/ Y8 a- k; {4 W9 t    mov     bx, cs
% K+ Z" o% J' a; O* C0 ?  {2 r    lea     dx, int41handler
; a4 I( K* a, Y8 r% Q3 @/ }5 @    xchg    dx, es:[41h*4]
0 n& |7 A3 a& s, p0 A, ^    xchg    bx, es:[41h*4+2]
4 k  M' v$ L% ]7 c" T( V    in      al, 40h* Z# t9 ~$ }: m5 H
    xor     cx,cx
- A: `2 ^7 p& `6 A/ w, B1 b' K    int     41h/ e* E& L: u4 [. X
    xchg    dx, es:[41h*4]
1 U; F) i1 f! P1 [+ d8 G    xchg    bx, es:[41h*4+2]: k1 i. x$ ]8 x) Z
    cmp     cl,al( ?! G0 S  z( x7 v9 f) C& e
    jnz     SoftICE_detected
. z# q0 u+ B/ {# g+ ^: u) Z- k. s. c0 C9 ?0 w. y. k9 x7 L
_________________________________________________________________________1 S/ n- w& s" \, _4 w4 z
7 I5 w" v$ ?$ I& N8 S
Method 070 h3 ~% V8 e$ r3 [# l
=========
1 g5 u; N' a' g) D' u- ~: V- w" E; O
Method of detection of the WinICE handler in the int68h (V86)  u  W* w( I2 A7 E  ?4 U/ l7 w

8 O0 F9 v( B; S& W% V    mov     ah,43h
+ I5 B+ B% R) K7 d- |4 j    int     68h
; J& G+ b+ t* w3 H; m# ~+ p    cmp     ax,0F386h5 J# U$ y+ N4 R4 M# g( o1 ^) y" ^
    jz      SoftICE_Detected6 P; R. G, r) V" o  r& C

% M8 U; a8 t7 \& d9 i' V; v. x5 ]1 Q& B+ S( ?$ T, O6 V0 `/ ^9 D! l6 [
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% b6 \) `" {7 v$ u5 e
   app like this:
4 u- `  u! [3 r7 J2 j
* ~# W/ z% [( ^6 ^& s3 d   BPX exec_int if ax==68, S8 P' [9 e; w- M9 O$ w
   (function called is located at byte ptr [ebp+1Dh] and client eip is
0 l" V7 z# o" c( ^( w   located at [ebp+48h] for 32Bit apps)5 r( S( b. B6 J; j- A
__________________________________________________________________________
# ?/ g0 i- ~' U+ _  C- k) }  Q( h) b5 {' n  P+ d) M* x
- C2 I# @0 n4 b# A4 v
Method 08% x* c; @$ S2 \# W' y# ^
=========
4 i; A# `1 d9 R
: G+ N& }8 C* ~7 T" g6 H6 gIt is not a method of detection of SoftICE but a possibility to crash the
. k* r. @$ F+ H+ j5 `3 Q: I- i2 @system by intercepting int 01h and int 03h and redirecting them to another
" A. q1 y0 V% {" q8 ?% I' n% i. l. ~routine.
) W: b( A7 H0 W2 a8 AIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 j' Y% I* Y  c+ {5 ~4 zto the new routine to execute (hangs computer...)" M: c1 b3 U0 y* M/ B! ?

' b0 H& p* e  K( l" w. q; F    mov     ah, 25h
6 S! k3 Y0 c1 X% v: R% z    mov     al, Int_Number (01h or 03h)
3 V6 u* }+ J2 V$ A8 a; Z    mov     dx, offset New_Int_Routine
& |8 {- o8 Q+ [! d    int     21h
; q/ b. T: `/ L5 H5 v. f2 i, ~: Q6 j
__________________________________________________________________________
; f! s- E4 I8 Q1 Q2 g. c  L2 X) ]+ J
$ O( ~. C# N+ }. B% V) tMethod 09
) ^& I  t  f1 Z. ~$ E7 X=========
$ W/ `1 Y- E0 ?( }6 J: w" M1 M8 n) M* ^! X8 L
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only2 G8 K. T  s+ ^# |+ S" u
performed in ring0 (VxD or a ring3 app using the VxdCall).
% E4 u( ]( u: V2 f' u( |6 qThe Get_DDB service is used to determine whether or not a VxD is installed* \* H1 b. Y% Z7 g! J
for the specified device and returns a Device Description Block (in ecx) for
4 _, V& g' P3 O9 Kthat device if it is installed.
- u/ a0 R" o. p3 X6 Y& x, n" J' z! ~
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ x+ s: J3 F  B! b8 [   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)& }7 v; G: H9 L! W
   VMMCall Get_DDB
8 d' V1 H7 m! p( I5 ^2 O' d, x! A   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
3 M2 t% V5 W& e7 w( h1 B2 s
1 p9 ]# S' [' S- z. W. xNote as well that you can easily detect this method with SoftICE:+ ^3 j( ?" B+ R% q2 ?+ a% P
   bpx Get_DDB if ax==0202 || ax==7a5fh
* f; n" t3 c- l) \/ i8 M& R
! _+ [" @! |# n( q4 H" A__________________________________________________________________________
5 y  n- ~$ W8 F& z# d5 K1 V" `& [- x( O6 u
Method 10
  x0 v# Q) t% ]' A3 m4 ?$ E& h# B=========) B5 ^7 f& N5 i, C6 U& O" w
/ c0 O. J3 p* Q, ^
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 N- l/ ?) e# `& B* d- H! Q. b  SoftICE while the option is enable!!
" F/ b/ L3 N' f1 ], m- q9 z! F' ]; ~+ @& c* }7 C7 q$ T& J* G" l
This trick is very efficient:3 V3 f  K! i6 e7 x, V
by checking the Debug Registers, you can detect if SoftICE is loaded
5 g- W& V0 v  x, h6 T  J+ ~4 T2 e(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' [  |8 Y& e4 ]- Z9 c
there are some memory breakpoints set (dr0 to dr3) simply by reading their7 O$ T! ?# U" Y) m
value (in ring0 only). Values can be manipulated and or changed as well
3 j) m. M0 x' n4 J4 A; \! n(clearing BPMs for instance)
. e+ ?5 t: U# E1 x
7 f( J/ B- F) d2 d, T__________________________________________________________________________; m5 t4 A9 P& G' W1 n
  a* t, t0 H' X! f
Method 113 M3 ]0 Y* k/ U( n3 {, _
=========4 Q) ?2 r: H0 `* P  p
- q* i/ ]2 t( ~
This method is most known as 'MeltICE' because it has been freely distributed
+ V7 M9 k' T+ f$ M* S( B* Lvia www.winfiles.com. However it was first used by NuMega people to allow& G$ }$ F( J6 _& A9 q. v  ~
Symbol Loader to check if SoftICE was active or not (the code is located, X* z! u. S2 U+ B( `; m% G) w+ U
inside nmtrans.dll).) w( Y8 Z: _4 i+ ^' H

1 T7 u7 S8 Q7 J, J) @$ hThe way it works is very simple:1 a* `. d1 ~; R1 e# P
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for  g3 V* O/ b' F. p. Y+ O
WinNT) with the CreateFileA API.- a, W9 m3 |4 T/ ]! y& {% Y7 C

, {: F1 p  [0 K2 N% T5 ZHere is a sample (checking for 'SICE'):
) d( r! ~, Q. j: I/ r: I) Y" r, v" a+ n7 C
BOOL IsSoftIce95Loaded()
2 ~) j8 H# o# y, P( n% G{. a" }4 q1 D+ Q% M8 c) [/ w# o
   HANDLE hFile;  2 ]3 q/ G& M3 @" r
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
. A' u/ j# p. X; P9 d1 U! H% d2 Q                      FILE_SHARE_READ | FILE_SHARE_WRITE,, V, n' W& Y" D
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 `, J( s) N5 y& U( k, o" k+ j   if( hFile != INVALID_HANDLE_VALUE )
: S) f: g- d0 `   {. [# B' _5 j1 Z: x* ~9 _
      CloseHandle(hFile);
# F/ J5 E" B( R# o, Q( M' C) b6 B5 j      return TRUE;
+ C, {; k) j! T" @$ I/ ~   }
& B/ `8 J8 V' W5 \/ m   return FALSE;
7 I, R2 t; i1 a}" _" V/ P) O. o/ s6 ^! U
% @1 }9 U1 P% {, S7 z
Although this trick calls the CreateFileA function, don't even expect to be
" y6 T4 Q# |8 z4 s* q2 kable to intercept it by installing a IFS hook: it will not work, no way!+ ^4 {* }8 A% d" B/ S# u
In fact, after the call to CreateFileA it will get through VWIN32 0x001F" P5 G5 F% _8 ~5 W$ k' _! j
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: |7 c. s% {- _4 f  ^* A6 J& f5 Dand then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 Z4 M& i$ L/ y# [field.
5 H' I  Y. b+ I( X$ DIn fact, its purpose is not to load/unload VxDs but only to send a
( Y5 m0 _0 W7 @7 T$ KW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
+ [% ]7 j( W# w1 Qto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ |1 \4 t$ ]3 y: ?% a  g
to load/unload a non-dynamically loadable driver such as SoftICE ;-).6 l4 a, a' H3 s! r7 S
If the VxD is loaded, it will always clear eax and the Carry flag to allow
" n, C$ Z$ i, N1 a$ rits handle to be opened and then, will be detected.
$ D) |$ N, k; z& _5 e/ PYou can check that simply by hooking Winice.exe control proc entry point
% B- K- F3 W2 K9 e1 N% @while running MeltICE.- b  V4 ]; C: S" K/ \  W

, e/ d5 l! o6 i/ Q" q+ x
8 c# P) w# @0 b; J% `  00401067:  push      00402025    ; \\.\SICE
6 B" y5 r; R; n( e/ O  0040106C:  call      CreateFileA# E! |1 W. B/ k5 B: f
  00401071:  cmp       eax,-001
/ y% G! Q$ m" ~" z" v  00401074:  je        00401091
9 m3 j& u% @2 |- ]# j/ h8 c" w# T3 Z3 f
/ V7 K7 f6 l# t; m" U7 o$ k- o; P, P2 L: a/ |- x9 B4 G
There could be hundreds of BPX you could use to detect this trick.: ?/ @+ ]/ D$ A3 Y# j% V4 ^3 Q
-The most classical one is:. B7 X# ?1 p( N' s. M
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||6 [' ?1 b% K! q1 r* k, Y( h
    *(esp-&gt;4+4)=='NTIC'
1 d7 T" q5 E# V/ y
* R  v, w- v, c/ ]/ n$ U-The most exotic ones (could be very slooooow :-(# ]+ M5 [; O2 q& I& Q* l& T
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  : K6 p( F2 V: V0 O7 j. z
     ;will break 3 times :-(. d+ {! S/ j; O7 D5 i

) }  K1 B+ r/ p  J* h; |: s+ [  D9 b4 k! S-or (a bit) faster: 4 p" \# ^4 Q, |
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( ~$ F% r' W5 d( J
5 ]; s1 [+ U: ^2 n
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 h4 Y% D% h# G$ Q) i, v" l
     ;will break 3 times :-(; e4 Q- ~! P+ W9 p: S  F; s+ G, P
* P6 T  P2 c6 S# W7 Z
-Much faster:
  K/ P4 l+ P. k   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& u. k7 l3 M! D% d
2 ^  @3 e9 j. q7 B. F7 c7 @6 G3 Z# B4 QNote also that some programs (like AZPR3.00) use de old 16-bit _lopen! x9 B2 T2 P. O+ t! h
function to do the same job:3 H9 ~/ v6 Y2 ^& @

' B( h5 a1 X1 n; j; H9 ^! h0 d   push    00                        ; OF_READ4 P0 b' L; L2 u5 J2 Y
   mov     eax,[00656634]            ; '\\.\SICE',0! n: I; U5 I/ C
   push    eax
7 ]% w4 P5 |% o2 @   call    KERNEL32!_lopen
* |. X/ A: m$ T8 K+ Y0 L   inc     eax
' t) ~! J( @2 m2 G. k9 X$ ?( L   jnz     00650589                  ; detected
3 k# N' I3 r! b" T& x# J5 @   push    00                        ; OF_READ1 R3 y8 x; }2 W+ r( W8 Z
   mov     eax,[00656638]            ; '\\.\SICE'4 a, f4 B: w3 A2 S% q& ^
   push    eax
* {( X6 o+ T9 [/ F6 L& r4 K   call    KERNEL32!_lopen/ V3 O' P( r" c% J( b, |# J
   inc     eax
4 e0 P- |+ i! F0 ?  T' O  g' u   jz      006505ae                  ; not detected9 o$ t8 i- U6 g9 G% j5 l! j6 u9 x
" F1 m9 m/ M, A" ~& C, i$ d

, M, Y, Y  j3 [6 Q0 J% `__________________________________________________________________________  Q$ j5 C7 q$ u" O0 q# t6 D; }/ c" b1 i
# O( }$ T8 \4 c  d1 n% R& y% ~
Method 12
5 ], T6 F3 F* Z; {+ q% m& ?' R=========
4 z/ L/ A" N7 Q4 F
' X, G8 `+ t5 O* _This trick is similar to int41h/4fh Debugger installation check (code 05% `* x( _' }% j2 q$ `; ^
&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 C  G  |) O2 I- Z9 u% V% e! q* _* G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) Y2 I- e( E' P+ [1 ^1 U. k& Z2 |" x' U
9 F( \1 [& D# c5 W! C6 ?0 E   push  0000004fh         ; function 4fh
5 A: B& r! X( ]/ e   push  002a002ah         ; high word specifies which VxD (VWIN32)
3 P- ?( B* ^) x& P8 x+ c                           ; low word specifies which service5 h* J  ?& W+ n7 L. p
                             (VWIN32_Int41Dispatch), V; `( q' u5 N
   call  Kernel32!ORD_001  ; VxdCall
( ?3 Q: ^2 x& K  q- m   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 @, Y8 A1 S0 ^: _& {+ t   jz    SoftICE_detected
+ u# n& X0 o5 Z* K& q
+ o/ T& D4 {" p( x3 ^Here again, several ways to detect it:
) M) U- d* \, `* `) k  {: D  n
3 u* `/ O4 w6 ]0 J5 v  Q7 D9 P    BPINT 41 if ax==4f
6 `3 T( D- F( `( i, j. Q
( e. \0 g- f; G# v/ z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 d( F: e6 h: J1 l  A& f
! n( \4 g  Q1 M, Q6 w    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 k7 H7 z- M# b) Z% X% h7 Z1 [$ |
: U* k2 j; d7 Q0 z' L) v    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!; b) y! d! J7 B7 y! [% y( T) |% [

! y" h9 \  r  ^7 l__________________________________________________________________________3 Z6 A$ L& l9 r) h1 A1 w0 u) M4 }

0 O) \& f  l* @3 {, `Method 13
( f6 V, R, ]. @% x6 t. h% ?=========
# I5 ^" H2 M. p1 U, R) b. C4 R# J+ p
Not a real method of detection, but a good way to know if SoftICE is  |" o7 d7 }9 x' G
installed on a computer and to locate its installation directory.
) P. x3 r' r3 ^. t2 k4 w0 B' f) H. iIt is used by few softs which access the following registry keys (usually #2) :( i, z; Q( I$ I6 u7 A
2 E) q6 w+ z; F; [
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 f* D, B& u9 p) g$ i$ k
\Uninstall\SoftICE; \3 `! @) j+ ^% u7 h! s# P
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
! D7 k6 J3 o6 t! n) q) ~- u, b-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 [4 |8 S7 ~9 F2 c8 @
\App Paths\Loader32.Exe
% W8 a* e+ O9 N7 ]  Q' D* U' j: e; ~9 ~8 t# ?

3 |% k, x5 v4 sNote that some nasty apps could then erase all files from SoftICE directory- t/ D7 @3 m/ _" g; s" @/ c7 h
(I faced that once :-(; u% p  A  ]5 B& U( {, U- U

- \, ?# l9 p# h. a% A/ u3 JUseful breakpoint to detect it:
- }! n* V2 }8 P& K% t& |
" `6 o8 n/ Q" Q- W$ ~2 t     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' Q% R4 V7 t6 E8 {# ^4 P2 M: `2 n0 W: @  G* m; h+ x
__________________________________________________________________________
; N/ q( b$ `+ |  ?+ O2 V9 `3 I& t% v" m7 S9 |' Z' B

7 t- p) V! `7 o5 z4 _/ h8 A9 `Method 14 ; @+ [9 W' h" H
=========
* Z  t( |$ Q% c' w& N) o$ P' [7 V) b2 e$ b) Y0 S
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose  P7 C' Y% L. o* G( t
is to determines whether a debugger is running on your system (ring0 only).! D9 i! F: q0 d4 j) h, M; z
$ }& f+ i; j/ x4 ~# ^* o( s
   VMMCall Test_Debug_Installed. K+ \# }2 @: v* j
   je      not_installed
6 B9 g5 _) r5 I! n+ K7 x! Q% S* Z. L# C1 A. Y( w
This service just checks a flag.* F# n$ I- ^( L/ P- _
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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