About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ W2 R* h) h& W8 f9 t' Z% }% k& H4 c9 E<TBODY>1 X1 o/ y/ N2 c6 S
<TR>4 Z+ h7 T4 U" n* T: z( j; h+ G
<TD><PRE>Method 01
3 m! u4 Q3 m; L  B9 Z=========. `0 {7 Z% E3 }# V1 n* f1 Y
- U# z; o* A6 h: b3 ]) E
This method of detection of SoftICE (as well as the following one) is4 x* M% D1 o7 e8 M7 J! o
used by the majority of packers/encryptors found on Internet.
( D4 R/ I# c. v" {9 C; VIt seeks the signature of BoundsChecker in SoftICE
# q5 f! f7 r/ q8 R2 r4 Z  k2 `7 c/ a2 t
    mov     ebp, 04243484Bh        ; 'BCHK'
- |& [8 W+ _/ ]2 ?- f5 i$ [& s    mov     ax, 04h# \1 M& K, Y7 {3 z  X( p# u% G3 \" J
    int     3      
$ H5 W# E" x2 o* l2 [    cmp     al,4
$ g) `$ U/ o; u. P" b    jnz     SoftICE_Detected
/ _/ D+ Q2 D7 I7 o
, Q' ^) t$ ^" A) x8 r# L+ f5 ____________________________________________________________________________
2 F! O: ~6 W6 V$ Z/ {! {, y& m; n$ w9 X* I8 O- ?
Method 02
$ n0 Z# q4 H5 _3 q4 E' \$ F5 Y' j=========4 @* W8 m" ^5 ~$ P: e  p  ]
4 `, ]* d. |  W! k
Still a method very much used (perhaps the most frequent one).  It is used
  I$ d6 C# i! M( c% `  Rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,- R  C! K5 d/ h' P) ]
or execute SoftICE commands...
6 a# x# O, g0 iIt is also used to crash SoftICE and to force it to execute any commands
( W/ c8 }  b/ w. ?. }(HBOOT...) :-((  % O( k! z* N( G9 j/ j1 N: n
( e# V0 c1 Q, g5 ?/ \9 O
Here is a quick description:
* R/ }7 s2 S6 V% O) u-AX = 0910h   (Display string in SIce windows)1 y8 a  m) S) Y8 O- ]
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& i; W1 h* T( j$ V-AX = 0912h   (Get breakpoint infos)
6 h. c# R0 s9 ~/ ]-AX = 0913h   (Set Sice breakpoints)' F' w- N7 U: F4 f: e2 m
-AX = 0914h   (Remove SIce breakoints)" V1 Y( f, o" r% H  j+ T3 S
3 S6 R+ W5 E5 D5 p: R0 i: t/ |/ q
Each time you'll meet this trick, you'll see:
1 V% U0 J* f9 t+ E-SI = 4647h
0 t3 }/ O$ l& _* v-DI = 4A4Dh
0 d! z, ^# V. b8 ^: h0 k9 l& YWhich are the 'magic values' used by SoftIce.
: |) G" Y8 r' hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ P* }- r8 P! I

. K/ D& C( i$ O6 Y4 |Here is one example from the file "Haspinst.exe" which is the dongle HASP# D. L  V8 z2 f0 w2 v8 E8 T
Envelope utility use to protect DOS applications:
: K$ H- S) Y4 M2 ^. M; t* @, z$ L: {. z: |2 c- {2 L

! N: z! |: ]6 C/ X/ Q5 q1 Q  Z4C19:0095   MOV    AX,0911  ; execute command.5 L; P) V; R. W5 C
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).+ a/ H/ `1 Q+ N( j
4C19:009A   MOV    SI,4647  ; 1st magic value.
- J) A3 G8 t3 ~% w$ s% v6 L4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
$ B0 l! n7 O2 R" E% v, o' Q% W4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 P" X6 s- L& e$ d: `4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 k" l+ {: h, J4 f  ^8 b& p4C19:00A4   INC    CX
0 ?: {7 d  ]: _# Q: n4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# I: N' x; E' X4C19:00A8   JB     0095     ; 6 different commands.: h1 o2 S+ M# P1 N5 f) G: P4 P
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ N- S$ f) X" N" P/ a4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 {: T0 {' u) C9 m+ I; x2 n/ U7 Q, W1 p% z/ E: i: g2 k1 Z
The program will execute 6 different SIce commands located at ds:dx, which
$ D. m9 f6 m9 d- Jare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& i" c5 J$ y5 \& E; W, m
7 {$ B' |5 a5 u3 T& x$ y* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
! Q/ z% r' v  G- G) K___________________________________________________________________________
1 h# Q. E% z+ U9 R! k& K' a
- A: ?7 E  [* A5 {( e8 W0 \5 T: _; A  W1 e, b( o% d1 T! j+ e
Method 03
4 W, L: p; f. C& N) S2 h=========
6 g4 t4 w0 G3 L
. Z+ e5 e; Y, S6 ^  QLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h7 _5 H  X8 v) W! Q3 d# r
(API Get entry point)
+ O) t4 O6 O9 H) d9 d        
7 H/ t. n5 G. `" c& d& m; L; O0 W" W! Z! }; d7 L& Y4 B* M
    xor     di,di8 ]/ ]6 I, W# q, f! @; h( ?$ v: X
    mov     es,di
  O2 q" z, [* O" \* c    mov     ax, 1684h      
: h5 J& Q" {$ U6 q/ b  N. t6 Q    mov     bx, 0202h       ; VxD ID of winice  A# ^( H  M% a6 y, A
    int     2Fh$ q2 |+ ]3 y# }, F. j5 X! ]" m
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ a* u& r: @) y2 I
    add     ax, di* f- J  J& @9 g% K
    test    ax,ax
7 u/ \+ u; i: t) _0 j    jnz     SoftICE_Detected
  X( A/ A+ t) |! W9 A
% m: P7 X8 T- x7 I) A___________________________________________________________________________
5 f- L& P* s" _+ g1 d; s$ [
  [0 ?; M. j. ]  O3 z* P# |$ IMethod 04' q. Z; n8 T4 r& Q) D) L6 m
=========
- Q6 h6 {  S3 j! t' \) g# b6 m
0 P4 Q8 @, |0 @9 z% x; fMethod identical to the preceding one except that it seeks the ID of SoftICE3 N, V* x* Z- Q( V: [3 Z
GFX VxD.
# p% D1 W2 B( a9 W( C8 ~4 G
5 g6 }' B" X1 I4 O- q    xor     di,di
) N3 X- D+ d, ?: M" C    mov     es,di
' B$ i7 s2 {) V* S    mov     ax, 1684h       ( H4 f$ Y2 N! z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 H4 b% l4 J" o) j9 ]) H% N1 B    int     2fh! y, R% u+ h4 Q/ t
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 d# p7 D2 H+ ~2 p
    add     ax, di* w2 _" A  s% }( @5 O
    test    ax,ax
  ~8 ]5 p/ p/ P    jnz     SoftICE_Detected
: O  n$ D6 t: W8 U/ q4 ^# k3 i2 {! m0 }% }
__________________________________________________________________________
8 l+ F8 R- U; W0 v- ^3 {4 [: s2 }; L* Z9 O2 K. t
5 l( g+ d9 P9 n
Method 052 [& f$ U( ^% K& [  f
=========
; g( H$ R& D: l1 b, Y# d1 t' F
4 J8 Z, h3 U. J2 D+ Y. t* P% dMethod seeking the 'magic number' 0F386h returned (in ax) by all system' Z" r, x# W' J2 d& @. w$ _, B
debugger. It calls the int 41h, function 4Fh.( a4 @& y( D( b( w0 w
There are several alternatives.  0 A1 k& G- ]* t
: h2 f3 y/ l' `1 p
The following one is the simplest:, ~4 W1 X/ N, f! j

6 R- D& W# P9 L( @& u4 T5 V    mov     ax,4fh
# O8 {$ \3 S/ M/ m8 m6 |8 E7 F4 ^    int     41h) y' C1 H, J2 _" Z
    cmp     ax, 0F3861 Z* m3 C- t+ @
    jz      SoftICE_detected
& t' Z3 l6 a4 a5 `% p0 x+ q4 v2 L2 l* y: t# ^0 Y
0 a1 y0 ]) W/ S' ^/ G  v* I
Next method as well as the following one are 2 examples from Stone's " i0 B0 i8 B  r5 _
"stn-wid.zip" (www.cracking.net):# O0 `0 Q1 {( ]7 c0 v7 |

' [! J5 e) p3 t4 O/ n1 I    mov     bx, cs
; z1 J# v1 {" \; a2 n" s    lea     dx, int41handler2
- G$ m7 X$ x. O* A- ?) O- ~$ h    xchg    dx, es:[41h*4]
0 v9 l+ Q- f/ i' N$ w( x    xchg    bx, es:[41h*4+2]( ]4 v' P, y* k( Z2 B+ x
    mov     ax,4fh5 ?4 b& \1 g/ K% }6 i
    int     41h
/ d( T: ~' }$ E  p5 Y$ U    xchg    dx, es:[41h*4]
7 H2 M3 `9 q. d& Z    xchg    bx, es:[41h*4+2]
" \" j2 j2 K3 \. ^$ z3 T- h    cmp     ax, 0f386h
3 o4 b+ m4 O: i2 Z6 Y+ v4 H  U    jz      SoftICE_detected
, N0 b. W% p% p8 _$ q& o
8 F( u9 j9 z' J! \int41handler2 PROC
, X+ d9 D6 G( V9 @, e7 d. k    iret
2 }6 r- A/ `. F+ G2 t0 `int41handler2 ENDP! |; E$ Q# m5 Q1 h
$ V6 I! q3 M) |( b+ f  X  N& m
5 v. r- T% Y& ]0 F8 F
_________________________________________________________________________
3 D$ R  x1 b8 \: ]) M1 G! `3 j2 w$ b' R- p) g+ x4 l7 s

- E. ~9 S8 l5 E7 r9 x; HMethod 06
: d, ]- @. P. H/ o0 `/ x3 w=========
2 ]% h# T2 g+ L, h' v
, j+ j, R, G' k/ N+ s/ M7 j" ~5 o2 B7 x; o8 [
2nd method similar to the preceding one but more difficult to detect:
2 y7 R5 Q. o8 U' R4 S) N8 e" ]! @% S' i5 R
1 C; Y. `6 R7 X0 J+ `0 F
int41handler PROC
# L6 y; H# y# m9 ^$ P5 t( V    mov     cl,al
. G. l; I2 m/ S" P    iret
# z& L. o& q& Q  Eint41handler ENDP
9 r" _9 r3 J  o9 \9 k
2 `" Q3 n, J6 d
2 z9 x9 ]( ~4 `7 o6 u& b, V, G    xor     ax,ax# e# e; c( i) P+ ]5 @1 f2 u
    mov     es,ax
6 e0 c$ Y5 N" i, C, ~# H+ b: H' {% w& k    mov     bx, cs% X& ]/ N. E" L8 D
    lea     dx, int41handler
# g) A2 i8 V8 L    xchg    dx, es:[41h*4]9 q/ C( }8 ^( {5 k, t4 [6 J
    xchg    bx, es:[41h*4+2]
8 U" i, ]% d. ^) m    in      al, 40h
3 l' `' u$ q9 @5 G3 C! X    xor     cx,cx
2 y9 w: T, g8 f. S. q% c% a1 `    int     41h
2 t8 s" {. E9 s! W    xchg    dx, es:[41h*4]1 u' }% \4 j6 a% F
    xchg    bx, es:[41h*4+2]
& B! |/ X0 [9 B    cmp     cl,al
1 V# s/ e) v& H3 M# p    jnz     SoftICE_detected$ t" G$ `4 K& {

" g; T- B8 p% a% t  U_________________________________________________________________________1 F" d) Q) g3 _: {- Q9 M4 j9 L  y

' O) n+ H# v' }. mMethod 07$ y! M) @  A0 N1 l7 k
=========
/ T2 v3 e9 r  q) V' A5 L  g, ]9 z, {" l" b7 Y/ g7 X9 y
Method of detection of the WinICE handler in the int68h (V86)
: g( S! K& O9 _1 U% W  c- b! R' d; z% l8 f; H- g! O
    mov     ah,43h/ q" Q6 ^, C: R' a7 G4 i+ Y8 l
    int     68h: t+ D* K" r- ^( Q3 ~6 L: H" `' N
    cmp     ax,0F386h
: @& ^4 }+ A0 ~# X* C" K8 n    jz      SoftICE_Detected
- V2 [# V* Z$ b, M+ x3 v
0 a0 o" q1 R* Q! c9 U+ u% h
2 e8 M7 H8 O- t' B. a7 M=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 S- j6 [% I5 k, r5 ^' N8 V- p% C5 w7 _   app like this:
, C8 Y, N$ o, `6 i3 m4 [4 c( R1 k5 ]0 n; p$ d& v% L
   BPX exec_int if ax==68
+ f6 E0 m% K! H: ?   (function called is located at byte ptr [ebp+1Dh] and client eip is
% W% E8 `) V* t% \   located at [ebp+48h] for 32Bit apps), h8 _+ D$ R* f- g1 v( g
__________________________________________________________________________
" C# [6 P0 S5 k& k
0 e9 W1 G8 ]. o; a  x3 Y2 `
7 {$ C1 ~1 b* c: l; ^Method 08
% r& z7 [" F! [: X% u, m=========
# Y$ p1 h2 K4 K- g* X8 U. S
" z$ l$ f! T2 ^9 D* e5 c3 o( EIt is not a method of detection of SoftICE but a possibility to crash the5 P0 H+ c& [& x6 ^4 j- k8 \6 \
system by intercepting int 01h and int 03h and redirecting them to another
2 D$ V; ?$ Q- Z3 oroutine.6 K. @: I! I/ ]2 j: S9 a
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
! {- J7 R% T0 v. ]to the new routine to execute (hangs computer...)
5 _3 I& H5 W  F/ q) ]$ ]- c' V$ `5 _. V5 X
    mov     ah, 25h3 j, }. s/ `9 T& v: Q! Z5 K
    mov     al, Int_Number (01h or 03h)
5 E& S7 j+ x. L% O* W8 h% X    mov     dx, offset New_Int_Routine5 g, w' G- d2 |; P9 `" Y$ s. n7 s
    int     21h
# f6 Y( F0 a6 _5 }) O2 P& b0 u. }2 o
3 A. ^# M% P' f  Q! n__________________________________________________________________________
; ~1 K: t1 ]% q! I" J1 Q6 k
$ z3 }# A% K4 J4 G' cMethod 09
0 B' [% r; Z4 v' c6 \4 a=========
) A* l5 N, C6 I; B2 }) n8 Z
& r. \# _9 O+ E  bThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 `  B2 _4 ^3 k/ x1 S8 Dperformed in ring0 (VxD or a ring3 app using the VxdCall).
) q  {. t( a" F6 @The Get_DDB service is used to determine whether or not a VxD is installed* {5 P& c  x7 }! Q
for the specified device and returns a Device Description Block (in ecx) for
6 _1 f" v1 Q; w1 `& Y9 othat device if it is installed.
. N9 D! q" @$ p4 i' _4 c2 e4 R! ^, K( a& d! ~: _% p$ M
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
9 o. g! V+ j2 X4 |( V   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" Y# {3 E7 [+ ^1 C5 M3 y   VMMCall Get_DDB
- d" W  M9 Q4 p" t: @   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% b! }7 t- P# }0 y+ \7 m. U3 u# E6 ~
: F/ \( V( ^' @' @" v% G
Note as well that you can easily detect this method with SoftICE:
6 d; y7 R6 N6 _   bpx Get_DDB if ax==0202 || ax==7a5fh/ D8 o9 x! I/ F3 v4 C
9 i9 |* I  s: a% V" O; n" e
__________________________________________________________________________% E5 `3 h- u0 K, F* h' _

1 d; z7 s6 j! I& Z, WMethod 10: ^! q; \# K7 q1 k' m
=========
4 K1 n- L% T9 v& ?& o" o" G+ A7 b. Y. s6 @5 e5 K9 o
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 n- f* ?6 y* Q7 U
  SoftICE while the option is enable!!) W+ j2 F* ]; G

9 d$ Q. m2 \7 ^; R. r4 a* N+ m. OThis trick is very efficient:/ K6 c/ x3 W9 o
by checking the Debug Registers, you can detect if SoftICE is loaded1 [) m/ p2 ^7 H& Y
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
+ m" z3 r  l) J# }/ P4 F0 Gthere are some memory breakpoints set (dr0 to dr3) simply by reading their
' c- w7 x) t8 O8 ~. j) d+ }value (in ring0 only). Values can be manipulated and or changed as well
' i2 ]) {6 o6 `1 F9 Y0 ~(clearing BPMs for instance)8 P; F7 W8 n6 J3 Z( k+ X

$ s4 }* j0 R7 R! |__________________________________________________________________________
2 U2 U% I, w7 f9 v* I$ a5 ~9 ]2 s
Method 11" N" N) J- O3 U
=========
5 W0 b9 {$ h- [
3 y7 u2 y# V1 G. ?! z9 v: bThis method is most known as 'MeltICE' because it has been freely distributed
/ G: d! z. D5 _0 Z& c! n* ivia www.winfiles.com. However it was first used by NuMega people to allow4 X  @# A3 A  j% d3 e: }9 L: a
Symbol Loader to check if SoftICE was active or not (the code is located
8 I. f7 |' V: _6 m7 Rinside nmtrans.dll).
, z" V$ v9 R8 x, \, [. m# G+ [) `1 v& g! ?$ h
The way it works is very simple:
3 B1 }# p  f1 y) L; m4 g3 ?- T* T# HIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
6 v6 n5 S: M- e, w9 B5 N5 ]WinNT) with the CreateFileA API.7 g, f. d- e  _5 i, j

8 [) e+ `2 {3 ^+ ^; U( X  x9 Q0 @Here is a sample (checking for 'SICE'):- G& a, \2 |, K; w' U

) w+ q* R% `9 CBOOL IsSoftIce95Loaded(); b7 y8 z+ ~7 a  E" _# B5 G
{
( o* J0 x% \0 Q3 C6 A7 P; c2 `   HANDLE hFile;  
) B6 k) \6 ?8 G- W: @   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 B* I# E  u4 Y. O3 D
                      FILE_SHARE_READ | FILE_SHARE_WRITE,4 h% z# G* w  `! l' K
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 _- S7 p1 Y/ N& T   if( hFile != INVALID_HANDLE_VALUE )& b( Y3 b& C+ Q, M: J2 j7 e* o
   {
* w6 j4 j& \! {& M2 f* X      CloseHandle(hFile);8 S$ f6 j6 @: v# N9 F  v
      return TRUE;
' }! I$ b6 T$ p  T( j, F5 s9 Q   }1 ?- z- O) H) T: X% u
   return FALSE;4 J; V( X( y1 b* m
}: U% K9 T5 u4 c! Q4 H
# D8 E1 K, [6 Y' K% t/ H$ ]
Although this trick calls the CreateFileA function, don't even expect to be) K' `9 [3 e2 Q
able to intercept it by installing a IFS hook: it will not work, no way!
" Y* Y* w& n- G3 Z4 WIn fact, after the call to CreateFileA it will get through VWIN32 0x001F/ n, J3 I# ?! y7 n4 @: }, g% _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 S* B+ P6 ~+ l  g* s, f
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
9 C3 G# D* i2 E2 l* U6 Qfield.% q# u- K6 G9 t4 n# k
In fact, its purpose is not to load/unload VxDs but only to send a
8 x: T: c* |% O- P( CW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% C0 [4 R: T, n2 M& H7 Ito the VxD Control_Dispatch proc (how the hell a shareware soft could try) P8 B5 }! l& W! \5 d
to load/unload a non-dynamically loadable driver such as SoftICE ;-).- W# F4 y. Z. d  f
If the VxD is loaded, it will always clear eax and the Carry flag to allow% F  {0 g$ E" P
its handle to be opened and then, will be detected.
! p7 B. k# [; T" @, M# wYou can check that simply by hooking Winice.exe control proc entry point  m+ p  O4 n+ \
while running MeltICE.& t8 v$ e+ t, F2 O0 {# t5 H
" W1 s: J, t$ n1 V
/ v* R8 g$ v$ R7 z" Q1 L/ g* t
  00401067:  push      00402025    ; \\.\SICE- m0 F* F4 X- W: w! Q& C. D
  0040106C:  call      CreateFileA
' {/ q( x- w4 y$ ?+ ^" `  00401071:  cmp       eax,-001
% Y1 i- a' E2 \+ i1 S7 ^3 t  00401074:  je        00401091+ E' _5 a' j/ Q  y# T% K7 H

/ E8 i# o6 k9 ?- I$ m2 u/ w5 P
8 h8 B, y* G0 G1 u8 K$ zThere could be hundreds of BPX you could use to detect this trick.( l. h- n: s& H* u; R9 z1 q* W
-The most classical one is:) A- T# b5 U8 X8 [7 \% o
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 b, y/ b: l" }4 U    *(esp-&gt;4+4)=='NTIC'
; S5 U! U- B/ q+ {6 G4 B/ ?* i8 p9 j- l. {, \
-The most exotic ones (could be very slooooow :-(! n; ]$ L7 B: p& a2 [- T* O& ]
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  8 k4 U% I. W! F
     ;will break 3 times :-(
- @1 m( G% A* Q& a/ z0 Y9 ^, ^* n3 x8 d
-or (a bit) faster:
; D; Y6 R5 E( g  f4 B7 @   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# k4 w- J0 U; }, A- f# |( M5 h
! I* f. @: {% i0 H% ?
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 _5 ?& p' A+ k) w0 [
     ;will break 3 times :-(( P( L) E  [" j8 T5 d1 Q
2 d* d& ]: ]' c& D1 |" I
-Much faster:
  H9 g9 c. r; T  n5 C   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" d4 t. m4 q9 [% w  H
, Q" M0 a1 Y! w+ B9 e8 _
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
0 P* G: Y4 g  L/ U/ K. zfunction to do the same job:3 e6 z$ q2 S$ ^* f8 U3 ^
3 H9 _+ [* U! J3 c. t
   push    00                        ; OF_READ' @' S( y% [0 Q9 R& ]0 a* r
   mov     eax,[00656634]            ; '\\.\SICE',0
5 B( O, L* I7 C" U1 D1 S3 F! t( c4 M   push    eax
8 q4 O& I3 R. t9 ^/ d. B1 {; F   call    KERNEL32!_lopen; e  h; c5 Z) W0 I
   inc     eax
% n7 c0 Q* B; K, s4 x: }- |   jnz     00650589                  ; detected
; Q1 N9 j6 _9 R/ ?( M; U& L! R8 \3 e4 x* r   push    00                        ; OF_READ
$ a+ x* o6 p4 z" H   mov     eax,[00656638]            ; '\\.\SICE'
& x# r  g" `9 P/ n   push    eax
6 Y* B- o5 d9 T0 j* N% p. ?   call    KERNEL32!_lopen
8 c/ ]0 P0 N. k+ e7 Q+ Z# r+ x   inc     eax
5 V, \5 w- B. {" o$ W' S   jz      006505ae                  ; not detected
7 g: u) e, E0 z4 H3 w1 E% X2 d: H" V3 Q' o" z

4 ^" f7 d8 j: r: G__________________________________________________________________________
; B+ f$ K; G! y2 @4 X
' _2 O4 c/ e; oMethod 12
0 |) G3 f* H7 ^$ ?7 @=========
0 P% I( `) t$ ~" Q- M1 X9 F0 Y, g: d
This trick is similar to int41h/4fh Debugger installation check (code 055 d7 d2 U3 h# s! H- s
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; P# R7 Q. f+ z/ oas it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ J. L, }* u' Q

1 n. R  I2 p, }& h6 K( h   push  0000004fh         ; function 4fh
; v( g' v. ?5 Q8 d   push  002a002ah         ; high word specifies which VxD (VWIN32)# {& m, a% O# J2 ]# C
                           ; low word specifies which service- t* O, [5 i3 U3 H( H; F
                             (VWIN32_Int41Dispatch)# q# w* q2 a$ U1 q: r
   call  Kernel32!ORD_001  ; VxdCall7 L; Y3 f. E9 R
   cmp   ax, 0f386h        ; magic number returned by system debuggers& a5 e0 t: ]- C8 \( ?
   jz    SoftICE_detected' F6 w: }& j! \
" D+ l3 a+ I: J  C" q2 L
Here again, several ways to detect it:% O6 H1 _9 w1 F+ v
3 _4 J% L+ T4 k* P9 U
    BPINT 41 if ax==4f; S" V) y! u$ J4 ~0 i1 d
! n0 I: H) |- {3 J! W$ v  Y6 K7 P
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' F1 J% W- H  z3 @$ Q6 O6 O( O9 _# q, p+ U; W% p5 \2 k3 P8 j) T
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- B: e9 ^  O. H! P* K. G! R% a" `& Z' s8 ]/ i) N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' ~' n' r' C7 M" g) L; J

' @! T+ m" O. d/ T$ E& l__________________________________________________________________________
, F) J. z* w$ D5 l; a/ t" x
+ [" R- J; d7 ^. L; b, d7 |9 E8 q/ u5 EMethod 13
+ Z+ v5 {* h  F0 ^/ g=========
  [; l$ D6 }1 n% Y( \
5 X" m8 {* t$ {7 Y1 `" uNot a real method of detection, but a good way to know if SoftICE is7 z9 z# B0 }( q% o
installed on a computer and to locate its installation directory.8 a$ M6 ?" v# s/ Z6 ~
It is used by few softs which access the following registry keys (usually #2) :' c% m; a  Z- D" Z$ m1 h, H5 k
- Q. f1 f6 a* n! H
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" r8 U" X& R8 x1 |, P* L6 S, c+ \; ^\Uninstall\SoftICE
9 u  Y' c8 l- Z1 \8 z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 F! e' L+ r) M' }$ c4 u7 z-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" q: _$ o; ~; u2 i! o# M\App Paths\Loader32.Exe! A  z0 [/ t# _' X' O
+ o( x3 ?0 i- v6 V
  s: D6 x& ^( j
Note that some nasty apps could then erase all files from SoftICE directory/ B4 F, w9 f: a# [% J$ I
(I faced that once :-(
, [% `4 u! t# X$ U7 X% a0 {" U6 E5 z! ]& G4 f" h
Useful breakpoint to detect it:
  O! r3 e( d+ a6 l6 t; L0 J6 M/ ?; D! x* q4 j! F. s
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
7 Q' t, V) G: W" b% K. x6 _- `- [9 f, s( S4 P
__________________________________________________________________________
: J7 C  ]$ q) g) q6 ^6 K
( a' p6 I& y; d% U* o2 M  L- T% m9 \0 t; G6 k5 k* T
Method 14 9 H+ v0 E8 N3 K& y" `4 N% D& t
=========0 Z: L- Q# X1 x  E
9 \0 `- K: ^9 r: Y! W
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
& I* S8 B/ j* d& nis to determines whether a debugger is running on your system (ring0 only).
8 K0 |" T. T- u4 i# w$ X/ D" K
+ B/ h5 v# G6 b3 z   VMMCall Test_Debug_Installed% I( K7 O% z: }7 i* l
   je      not_installed: K" J& ^) k+ ^5 ?: H

" i/ R$ Y6 L0 }2 T1 h! IThis service just checks a flag.
3 G% b& m# k; V7 n9 _</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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