找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>2 m8 A  t1 m$ D8 r3 o8 h
<TBODY>% v4 v; B2 {! {. E- [: }
<TR>
9 ?2 X3 T0 V9 f7 {- L" _* _<TD><PRE>Method 01 6 b* Y* b( f. L/ n
=========
+ Q2 Z) A% b$ t: e: ~4 a
% W: i8 o/ u0 bThis method of detection of SoftICE (as well as the following one) is
* ]( N* \! w. `9 ]5 E3 Yused by the majority of packers/encryptors found on Internet.
# W. x0 b1 A2 D& g+ W; `9 H; N' [It seeks the signature of BoundsChecker in SoftICE
. ^9 g! m; I6 J1 z0 }
. O) o0 f5 L# E    mov     ebp, 04243484Bh        ; 'BCHK'
" l7 w, X5 U3 L5 Q) F) \  `: C    mov     ax, 04h) \; q5 R. i  W. X4 d9 s$ e
    int     3      
! P$ f; `5 K4 i3 l    cmp     al,4, n0 _1 j4 F& e
    jnz     SoftICE_Detected$ O' T4 ^  ]/ }/ ~7 \
0 v8 L7 e( }/ [. E: u
___________________________________________________________________________
9 S7 Z3 r+ e* W- [2 B) }5 ^* z1 `% \
4 Z+ E! U- Z; @7 N$ dMethod 02
2 [  \! U' Z) [; g=========
7 A( [: Q/ d: n1 h8 N' r8 {) i( l4 L$ t5 L+ @3 w
Still a method very much used (perhaps the most frequent one).  It is used+ {) b6 \# |7 k6 x
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,. r+ L3 V- J* R* f, {1 d8 w
or execute SoftICE commands...7 O( c( c$ b& ]# H
It is also used to crash SoftICE and to force it to execute any commands
9 h) i1 V, n8 H* @(HBOOT...) :-((  - a  H+ ?8 p! {8 I7 _$ e- z( M
' z6 |1 j. D, l6 X( a
Here is a quick description:
( Z0 M8 p  K5 J9 k% v-AX = 0910h   (Display string in SIce windows)
) W. O2 C: s% A1 o; i+ ~-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 F9 Q) O' d0 G6 T3 u: J, r
-AX = 0912h   (Get breakpoint infos)
9 `( t9 K# l, x1 ]-AX = 0913h   (Set Sice breakpoints)
$ S" ]* m' Q0 z2 X0 _7 i-AX = 0914h   (Remove SIce breakoints); Z) p1 d1 K9 ?. |& l1 m9 I

  V0 l4 l+ W5 L$ B/ |3 MEach time you'll meet this trick, you'll see:
  Q: V; E9 F; D8 H' r7 p-SI = 4647h
# |8 T& B, d# \7 Z6 o-DI = 4A4Dh8 g( k+ a2 G  b8 ~0 Q  a8 ?
Which are the 'magic values' used by SoftIce.
6 Y+ ]( M9 {; {4 kFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
2 w; G" p0 r" Y3 W) E1 o1 ?
8 L8 U6 J+ q- m# ~6 S9 R9 e! BHere is one example from the file "Haspinst.exe" which is the dongle HASP
" i. O& N2 V7 ^: Z0 mEnvelope utility use to protect DOS applications:
- w4 r) `6 _2 a! ]3 x5 x$ ]' K" X/ X& s
1 h5 |6 @2 N, k/ Y# y' ^/ I
4C19:0095   MOV    AX,0911  ; execute command.
6 Y( D! z& S: u- C: f4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ O2 c$ e' u2 z
4C19:009A   MOV    SI,4647  ; 1st magic value.
  J: Q  y' J, d! z! A5 h9 G4C19:009D   MOV    DI,4A4D  ; 2nd magic value.! L5 _  ^% C9 J$ x9 b7 J
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
( I, y$ {* q& |/ N# ^8 }4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! W- ^2 j. t  |5 g2 |" ^7 a/ G
4C19:00A4   INC    CX, x5 Q1 V5 C/ T1 v7 e. o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 B% o3 N8 j: J, C
4C19:00A8   JB     0095     ; 6 different commands.
* X: X& F4 U' n2 P. X5 b5 B  k. J3 H! ]4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% \# s. O% T2 ?3 _1 w
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 P  S' K2 g9 l2 i, N3 H0 O" e- R' |9 X1 j+ W/ N! Z% z
The program will execute 6 different SIce commands located at ds:dx, which
1 @- Q% ^! n2 Dare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% q/ e9 z* [" R. Q

* ^# s. B2 `; s1 Z7 N: O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ ?6 D, [2 M- E0 E2 @___________________________________________________________________________- x5 ?  C2 Q% j) N# W3 w
; {0 Y4 z1 c2 F: L9 s3 L

* Q0 i; y7 I4 v6 X( l, V& kMethod 03! q8 u# U, z! M+ C" u3 b
=========
5 \7 [( g5 N; W% S# X
1 i3 D+ O8 O1 P4 x% H) x' J+ G2 E2 vLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  O' O1 F8 A5 B: p7 ~0 M(API Get entry point)9 n: c2 `7 ~6 i9 C7 x$ k
        
: x& O& C5 y. C$ t* c
( A; o' [& _. c( O& [# I    xor     di,di
+ g0 c2 {, c- L; A9 l6 r4 q: N# m    mov     es,di
- b: [6 [4 Q# x3 T    mov     ax, 1684h       % p0 w. O# q; c/ W
    mov     bx, 0202h       ; VxD ID of winice# L4 k8 N) b9 f2 i; V
    int     2Fh& ]- ^" i- D& ~: f1 s" w7 A7 N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( ^; I& n3 b) A! l6 L; B; }9 }
    add     ax, di
0 x7 W: u/ B7 ~" Z$ z    test    ax,ax
  @0 G* k1 E. H, v    jnz     SoftICE_Detected
% x! f# y6 v/ K3 R6 J5 |8 K- j, b! J8 U8 P4 ~6 U
___________________________________________________________________________
1 y! M! P% ]; X! ~. Z3 L8 h( C! _: {
6 d8 N  ~. i" C3 J6 WMethod 047 k3 l1 c; q' w$ d2 p2 w. a, d0 F
=========
$ e' n$ Z  u+ Q. U' ~4 a- H" O) t% ]9 i! ]6 K0 n# U8 P
Method identical to the preceding one except that it seeks the ID of SoftICE0 v: Q& U; O& W7 B/ }) V
GFX VxD.
1 s3 B; d- h& f' ~0 n4 F( a' x/ e! {+ L7 z( M2 @
    xor     di,di
/ }8 q$ ]  K9 e1 v6 X: t    mov     es,di) M0 h+ \$ ]' t( R4 b! z# H
    mov     ax, 1684h       + |0 G; F" {# o5 x6 d! x) G3 f
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
: g2 g8 h2 L) c4 [  |$ P1 G    int     2fh
/ w6 D6 G; n6 }$ v8 `    mov     ax, es          ; ES:DI -&gt; VxD API entry point, C. G4 q# |$ [; R7 E
    add     ax, di
! R8 `; N7 o% O2 ?# Z( h+ G    test    ax,ax  s4 f# e3 k& r+ O. y% b
    jnz     SoftICE_Detected3 c* _9 Q$ E+ a
4 Y$ R' q: L% s6 B  U3 G
__________________________________________________________________________
6 c6 [. P$ V1 D7 t7 c. \
; n+ M1 J1 z4 a+ U# a7 Q. J5 k7 ~$ p2 X
Method 05
, B5 j. a8 j+ m; K/ f9 n- A, ]=========/ j( S. y1 l1 `

, @, ?9 e2 B6 e+ JMethod seeking the 'magic number' 0F386h returned (in ax) by all system; G2 D( m; H0 e5 ], E: }5 N: B
debugger. It calls the int 41h, function 4Fh.& o9 F3 T) u: m; h4 E8 O
There are several alternatives.  ( n# m' A% p% r2 j2 T! r8 J7 {3 M
$ {! m$ V- T8 U- X: |' ~, B
The following one is the simplest:! ^' d. ~4 ^0 E2 g

9 F4 Z. |. _6 X0 Y1 |4 W; d    mov     ax,4fh, h) @3 x3 Q$ o
    int     41h2 W, B/ a: j1 V! M( D) g$ u
    cmp     ax, 0F386
7 Q3 g! ]% u* b, F: D; M* t    jz      SoftICE_detected/ Z& l, u! X7 j3 U; V; K

' T  o! p+ V1 e' ~4 ]* s9 r0 r
* A- V' V9 E% _( ENext method as well as the following one are 2 examples from Stone's
; o7 L; v* I6 [' r6 R+ ]1 c9 o"stn-wid.zip" (www.cracking.net):, g- Q) X# Y' c; G

* P. V9 g8 R; k; r' N4 V    mov     bx, cs* P7 F1 a2 [1 @; `, g3 o! K
    lea     dx, int41handler2
& [; s  z3 D8 N: q$ ?    xchg    dx, es:[41h*4]
4 B; Y7 @# A( n7 C    xchg    bx, es:[41h*4+2]
- P7 r% N2 H* k    mov     ax,4fh
9 d- J0 W' K# Z" ~: A! e    int     41h+ w* g/ [. i2 N; O8 |" y* m0 m0 A
    xchg    dx, es:[41h*4]; Q6 F' W* c. M; k/ d
    xchg    bx, es:[41h*4+2]; j9 g; {; i+ x0 y
    cmp     ax, 0f386h
. c6 y3 p0 Q3 V/ ?, N    jz      SoftICE_detected
5 _+ Y, S# j+ m9 ~; O8 _# F  t* N3 B. b. C: B  b1 S( a
int41handler2 PROC
8 y0 C6 [$ k, A( H5 K& Q    iret
$ }; Z6 R# A( u8 uint41handler2 ENDP
2 K9 ^" I& X' }5 W9 h
9 J8 @9 o# z* L- k; U' y2 g- {. }
7 F  K! m* ]( ]/ s) C  z& K) s_________________________________________________________________________1 @+ j9 U1 D  q4 G6 o  A7 y3 G
* Z  H. F$ }% [* R
# x# x+ H; d: I, H+ d5 p- v
Method 06
5 ?4 s0 k: A# L/ O=========. F- Z) [% I9 K$ W4 _) l
4 Y: G) A/ Q% ~

7 {2 X& f2 u# s' S, W" n$ V5 l8 R) x2nd method similar to the preceding one but more difficult to detect:9 ?! b5 K: U3 \
3 i6 M* K8 y! f  n
9 C9 g- ~0 i! B& e
int41handler PROC
$ v4 k, U% p4 ?9 T! f  e+ j# E    mov     cl,al5 s, ?7 w9 M, I+ j. O
    iret! ~; v) @8 J& t0 P% o) Q
int41handler ENDP
+ X* ^* o* [' c
1 s, V  [% O0 Y
/ _7 h, ?. r3 ~9 C    xor     ax,ax6 z, t6 u; M1 q; X
    mov     es,ax
  I" L5 \. H" o  D    mov     bx, cs2 u: T. G" l9 e5 H
    lea     dx, int41handler
3 |/ X3 r/ N$ l1 G% A& D    xchg    dx, es:[41h*4]: F2 l0 l( @" f& o4 R# O: @+ K
    xchg    bx, es:[41h*4+2]
: Z' u; x" {$ y& w' f    in      al, 40h
. o) B# ?+ G, A- b, V    xor     cx,cx& \& z+ L2 v3 }- h2 E  \
    int     41h
/ j% {( ]1 E$ |0 ]" x5 g8 |: i    xchg    dx, es:[41h*4]
& K6 ^) m& s# i    xchg    bx, es:[41h*4+2]
: l; k0 ~+ D) }/ U" C+ [! ?    cmp     cl,al
) p4 ~/ S$ G' @& }& G    jnz     SoftICE_detected2 _5 A# |0 D! Y" J8 O
: p7 }" R. |- F0 {( T
_________________________________________________________________________% A9 c+ e2 g) H+ V7 `
8 C, d9 R: [8 a2 k& W8 Q) ]
Method 073 ?  w7 K9 m  a
=========4 Q2 q: u  u# l& W8 G1 F
4 k% x3 u% C( X5 |$ D* |2 `& J- u# a
Method of detection of the WinICE handler in the int68h (V86)
9 i! Y; C; |' e" f2 e: }, u
! E. B9 x% @- s; M" g% ]4 s    mov     ah,43h4 y4 B* m) Y" Y7 r/ a
    int     68h
* u& P& V8 i1 z. i( u! e    cmp     ax,0F386h$ i8 }8 k- X3 y$ U
    jz      SoftICE_Detected
" R0 ?/ X- ?8 s
4 ]& T! ^- e+ _. M
$ ^- A3 ^: x" b, E9 I; \6 n  Z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
7 g( H4 T, u% a) E6 r: w/ W) u   app like this:# u) h) i! P& `! E
: t! K" ^' w/ J+ S* |
   BPX exec_int if ax==68: j8 o) G, d* Q
   (function called is located at byte ptr [ebp+1Dh] and client eip is
* u% a$ q9 x' X& S: M8 m9 |   located at [ebp+48h] for 32Bit apps)% U1 r, _0 y3 \
__________________________________________________________________________
# k1 w  O, L1 g3 a' _
6 ^+ F. E+ F( Z& w( r  k. f5 y+ o: w# i% @/ T+ x& b0 o
Method 08( }: F) X- f/ K3 Q
=========
! V7 c1 x) B7 U, u) }0 a
# W0 H+ Y0 @- O) ~+ NIt is not a method of detection of SoftICE but a possibility to crash the
# }2 s( ?# ~( Q# q7 X# U. Bsystem by intercepting int 01h and int 03h and redirecting them to another
- x3 v  E- c/ t9 ~) T: ^. Wroutine.8 B2 R% K$ g6 x  V: ^' ^
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points4 g& U8 t, X# x
to the new routine to execute (hangs computer...)
4 Q, u3 h/ [, w! r$ K) I8 U6 C1 r) C( U$ B3 n% T7 g  E
    mov     ah, 25h
- I" X9 n3 A* g. @3 |. u    mov     al, Int_Number (01h or 03h)4 J% W$ a4 o0 S- m3 X( H
    mov     dx, offset New_Int_Routine9 K- V& `1 u0 X& \
    int     21h
, \/ N6 S" s2 d+ f
- _+ S7 u! C9 L: P5 z: n$ R__________________________________________________________________________9 f! r7 @" L# W: S9 j" ]

0 j+ D; [- P% J8 xMethod 090 p8 b, O$ o: q, c: ~! W6 o/ e) @' z
=========* G; L' s. m3 j+ O8 X
# ^. @/ r3 Q4 f* f& M9 S
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
7 ?% {& X) D4 C" V% tperformed in ring0 (VxD or a ring3 app using the VxdCall).
# Z. j7 K/ j+ S5 Q! d; D& \The Get_DDB service is used to determine whether or not a VxD is installed
6 [/ U& @. n. B: Zfor the specified device and returns a Device Description Block (in ecx) for0 a6 u8 N+ g. N7 w) \8 \/ r
that device if it is installed.2 j0 t4 _! N# |; A; |
* K: R7 q/ A9 _" H. d' Z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 ^  {1 {; I! @* T7 t+ H# R' m   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 S6 d3 U8 e8 r' G2 D2 r0 J6 S   VMMCall Get_DDB& {1 J, O( l5 j$ D/ a3 ?
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ r1 z/ k' S( q/ A' D8 \

, |1 H8 q9 k7 L7 _% [1 x  b' [Note as well that you can easily detect this method with SoftICE:$ k7 a7 g1 F0 V
   bpx Get_DDB if ax==0202 || ax==7a5fh
4 O: E5 W" a; F! i3 ?/ {6 P# Q% m' O, J8 `) ?9 [
__________________________________________________________________________
$ M  M; V  M- f% Q
! ]7 D4 K; `' kMethod 10
9 |& Z' [! O7 V5 A% n+ t  G=========" n' ^0 v. T4 h$ d0 L( }' [* x
' C- I# O! n, O$ K
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! t7 i3 c+ \( v  P  L' y7 M
  SoftICE while the option is enable!!1 ~; C& O4 s; q( @8 ?9 T2 U1 h
6 C- `" I9 z) ^7 b
This trick is very efficient:) l$ o  ?! v) z2 _3 J4 @
by checking the Debug Registers, you can detect if SoftICE is loaded
& p* Z- J3 c4 F) v0 W(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
; o  A3 m4 s% D7 Mthere are some memory breakpoints set (dr0 to dr3) simply by reading their9 y. h3 d! |. q+ C( O
value (in ring0 only). Values can be manipulated and or changed as well
$ q9 v: X6 \" R* Q5 }(clearing BPMs for instance)* t9 Z6 h/ i! j$ a& g8 h

9 @" X9 F/ }/ E$ G__________________________________________________________________________# N' v' C8 D( z( [3 M
/ z, P* U0 [) @& ^) C" n4 x
Method 11. w0 ~! u& `8 u. W3 y
=========
5 T) l: [! h" T! t* C& x) [  r' ^$ U6 q! t& U& R; ~+ ~9 O# E! e# }
This method is most known as 'MeltICE' because it has been freely distributed  ^( K" O5 P+ O
via www.winfiles.com. However it was first used by NuMega people to allow
# Q1 |  q* J" RSymbol Loader to check if SoftICE was active or not (the code is located( Z1 J3 G5 I/ g
inside nmtrans.dll).( G+ Q2 D8 N1 ?, q9 R8 L/ s- ?

- v$ A/ @6 ?+ k  C* s; NThe way it works is very simple:" V0 e0 K, \2 j' m8 B/ |; o3 q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for) K+ r' M# d9 @$ d9 J& j
WinNT) with the CreateFileA API./ s! v5 i. {+ i3 D: I( Y; z9 n

4 \/ t( M. ]: r* s7 CHere is a sample (checking for 'SICE'):
7 ~0 |2 g0 Q' K& x3 \$ m/ |% ~
- q" M5 B8 o. C. g9 k: EBOOL IsSoftIce95Loaded()
# H. ^6 ]9 x( |% T' Q{
7 z' F' c5 x7 _. \; y( f   HANDLE hFile;  / s5 A: J- c( B0 x$ G
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,3 x1 I2 x, i6 T( o7 W0 a$ v  L3 u
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& q) N) T7 a4 J  j4 [$ h# h                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# h' f7 o* {' s
   if( hFile != INVALID_HANDLE_VALUE )
# E! U' {/ L% j) f6 n* f   {
3 ]* J. s! P3 }! |) I% [$ `3 y* c7 _      CloseHandle(hFile);9 l( V( x* W' ]1 L. ?
      return TRUE;
- @5 E3 h/ `/ ]/ G! p$ L! y1 t   }
5 @& h% w1 @+ U6 L6 S   return FALSE;
$ N3 ]! w- h# P8 q}
/ d5 a8 O" n% {8 `' h
8 S  J" l$ Z8 F" kAlthough this trick calls the CreateFileA function, don't even expect to be
' D# y: m$ G5 P! o9 I' ?able to intercept it by installing a IFS hook: it will not work, no way!8 {9 ]$ |( n. W' a9 Q( B' ^
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, q; h. T7 i5 `' t  b
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
- Z8 g; I& d" Q$ g7 fand then browse the DDB list until it find the VxD and its DDB_Control_Proc- c9 Y  {7 V$ z/ U8 t  R
field.+ w7 H7 V/ j4 k3 y+ L
In fact, its purpose is not to load/unload VxDs but only to send a
5 z) E$ V, t  G* I2 g' _1 I- oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 j* _7 B+ q* b* P; Q5 a/ t4 k
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
. G/ A4 b2 w5 L, J( ^to load/unload a non-dynamically loadable driver such as SoftICE ;-).
7 L' Z# r! q" v2 M$ T+ LIf the VxD is loaded, it will always clear eax and the Carry flag to allow* @8 W0 F* K5 L' Z& s. D
its handle to be opened and then, will be detected.
* |8 C3 ~  Q# H: ?3 bYou can check that simply by hooking Winice.exe control proc entry point
7 r% d* Q/ k0 Nwhile running MeltICE.
0 w: y' F! ]$ s# H' f1 z8 S
- A+ {  |. F& X. O9 U2 }! i6 F/ w0 @0 h
  00401067:  push      00402025    ; \\.\SICE4 v7 f( L( ^! \6 @3 a5 A$ n
  0040106C:  call      CreateFileA
* y; L+ N# k% z9 y  00401071:  cmp       eax,-001
8 ?  V# G( }) s7 Z0 Y  00401074:  je        00401091
6 g/ J: k8 q8 l8 g0 v, z2 _( Z7 f, I. B8 V, ?) ^! S
. H" R0 P/ v! ^% l& _3 D  Y5 x
There could be hundreds of BPX you could use to detect this trick.+ ^4 V  l  e# H
-The most classical one is:
- X; w1 {# O) L1 Q! F  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ q: }0 b/ k! F    *(esp-&gt;4+4)=='NTIC'. `: N) u4 V) f

* _0 O2 F( y& E/ p- z0 o-The most exotic ones (could be very slooooow :-(' s8 I. s. b9 X7 c2 o9 K
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  p$ |1 J7 ?( F) ^     ;will break 3 times :-(
6 N: z, N6 L* v+ k
) s6 J2 n- u, _4 z8 `-or (a bit) faster: / m, b: L9 W" t# @, f
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'). U2 f- Z' h5 R" m5 o2 X6 b
( \2 o& L% t8 p3 S5 X; c0 n
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + W1 k* o" B( a, ^" t7 o) D, z5 b
     ;will break 3 times :-(
7 r$ L: q% H* Z! G5 m5 F9 A  ]- a
' J& e5 A+ F5 x-Much faster:, ~- l. A3 H. Q! ], ]6 L) b
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 e  ^& a' ^% \& y' P2 ]: y

% x5 x3 h4 e1 q' X  y3 HNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
" G8 v& X6 i* c2 C. }function to do the same job:
4 E9 b' _1 e. y$ D- G; L8 `$ e8 [: y2 f* q
   push    00                        ; OF_READ
7 `6 J5 g* C7 D4 p0 C7 H   mov     eax,[00656634]            ; '\\.\SICE',03 ~/ e3 S- K! y
   push    eax
% X- u. X4 j( E/ i   call    KERNEL32!_lopen
5 V5 H5 X4 H2 c% M5 }: {   inc     eax( t8 J, c- x6 b" i7 }4 N* v( V6 x
   jnz     00650589                  ; detected
- }, |5 P% H5 {6 Y. _   push    00                        ; OF_READ" ?  P& @* C" T2 X
   mov     eax,[00656638]            ; '\\.\SICE'7 \8 T1 P7 {8 j: C7 ?0 `
   push    eax
4 t' J: j/ D; e* s+ ]   call    KERNEL32!_lopen) L1 s( w9 s4 Z0 }, m; }/ o. r
   inc     eax
0 q$ r# F6 K. {0 I. S   jz      006505ae                  ; not detected4 ^. t6 i5 H# T' N1 y

0 B, ]- c5 s  q6 |! O2 K0 W1 |5 B: _( Y- r. g0 r
__________________________________________________________________________
  V% u% |2 @- @* D, M1 g, X5 y- g; w9 @3 ]+ K# D
Method 12
* s& k9 F) s! j" ?=========
8 A7 V- C2 Z# J8 l1 W+ j  c. h! B6 I% [2 ?$ F" e  o+ v
This trick is similar to int41h/4fh Debugger installation check (code 05+ h( A( B$ S! X4 U3 U$ Z% {
&amp; 06) but very limited because it's only available for Win95/98 (not NT)! ]" v. A+ k8 R  q& G$ A
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: ]0 e+ o5 p. S$ p- N: g/ G, ]+ w9 e7 l) x
   push  0000004fh         ; function 4fh
( p0 t! H$ ^& v$ F: c   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 }) r: s0 Z4 J+ k: R                           ; low word specifies which service
# F7 i2 p% }' y. W- T- H3 q6 i                             (VWIN32_Int41Dispatch)6 h3 k, T* \2 O& q" R
   call  Kernel32!ORD_001  ; VxdCall
2 D# x  L/ p; r, Q   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ Q; \6 L+ @; b5 K   jz    SoftICE_detected6 ?' @# q9 v# W0 X+ f; ?
9 e+ w8 L  g/ B( L+ {) d% G
Here again, several ways to detect it:& b$ \6 I7 g, X' O& a6 _1 P. I+ u

, @0 b/ S$ c7 E& F" w1 f    BPINT 41 if ax==4f
1 K; {# h9 I* y" g; {
$ S# }4 C8 O- E- U+ _1 e    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 i2 y+ v$ [& v- G& M
. k( [# d* W3 s+ E  U! j4 J    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. n8 s- @7 D; Z2 o5 n
  U+ r' ?4 V; O* Q    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# s' U& }$ I, Y5 X3 z# j6 z6 X- K' X+ s, T0 A: ~
__________________________________________________________________________4 o+ z: A6 A. w

  F) Z' K, N: v! ^' ?$ H+ K6 P/ t& n% lMethod 13
5 L6 v: B8 [' T6 z% a8 w" [) S=========
2 z$ p$ I; |$ I; M6 t+ _' u# z3 L% u: ~
Not a real method of detection, but a good way to know if SoftICE is
2 w4 x% y" T( |$ einstalled on a computer and to locate its installation directory.
! L0 R- y) y' h9 N& f( x& e6 v6 sIt is used by few softs which access the following registry keys (usually #2) :
. h& f+ T0 Z" i7 b5 I6 ?; W9 K: ~% o( k2 ~4 B
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, V- s+ E! c$ k  }4 o\Uninstall\SoftICE
4 b% j! H4 O* _; N; F* |-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% D+ `) E: d( f6 S-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) l; _- V% g+ h% V6 ^! S
\App Paths\Loader32.Exe
" {, V$ U1 S0 E! X  @/ l4 [* G  d) z+ W: W$ x5 p- H; E

5 H4 w# R  p3 g3 tNote that some nasty apps could then erase all files from SoftICE directory* W3 k% G0 ~5 W2 p
(I faced that once :-(: q9 {. F! {: j0 o6 x  f) j  g" J

5 g6 O( S9 Q% h2 S: Z# cUseful breakpoint to detect it:" c8 A7 H& L0 q' H

% `3 L! y* N3 z, b     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% Q  _. ^5 x! j% d
, e8 }1 J4 z8 f0 Y' a9 c& p
__________________________________________________________________________( U' N" \8 s9 {, b6 x. m6 p, T3 O

/ j( T* `' j& m# O5 E
! O( x& ^9 y8 j( ]Method 14 ; l- V% e/ i, P3 r6 s' e: B
=========. x% ?+ a3 \/ u0 i  k! l

! W6 F! Y# T# G% A9 n8 CA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 U# i1 ]5 W9 W. E, c- F/ ]is to determines whether a debugger is running on your system (ring0 only).5 p$ T2 e5 S- a0 x. f$ I

+ ^! v/ v& P- j   VMMCall Test_Debug_Installed
9 P2 J# F6 ~+ a: a3 h, ?3 k   je      not_installed
7 \1 p5 Q; ~% A" L. G) q3 n' u0 O9 E+ a  Y
This service just checks a flag.2 M7 {: `8 A2 ]1 v" T% u6 F- s
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-5 07:11

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表